Share via


CosmosClientBuilder.WithLimitToEndpoint(Boolean) Method

Definition

Limits the operations to the provided endpoint on the CosmosClientBuilder constructor.

public Azure.Cosmos.Fluent.CosmosClientBuilder WithLimitToEndpoint (bool limitToEndpoint);
member this.WithLimitToEndpoint : bool -> Azure.Cosmos.Fluent.CosmosClientBuilder
Public Function WithLimitToEndpoint (limitToEndpoint As Boolean) As CosmosClientBuilder

Parameters

limitToEndpoint
Boolean

Whether operations are limited to the endpoint or not.

Returns

Default value is false.

Examples

The example below creates a new CosmosClientBuilder to limit the endpoint to East US.

CosmosClientBuilder cosmosClientBuilder = new CosmosClientBuilder(
    accountEndpoint: "https://testcosmos-eastus.documents.azure.com:443/",
    authKeyOrResourceToken: "SuperSecretKey")
.WithLimitToEndpoint(true);
CosmosClient client = cosmosClientBuilder.Build();

Remarks

When the value of limitToEndpoint is false, the SDK will automatically discover all account write and read regions, and use them when the configured application region is not available. When set to true, availability is limited to the endpoint specified on the CosmosClientBuilder constructor. Using WithApplicationRegion(String) is not allowed when the value is true.

Applies to

See also