public class CosmosClientBuilder extends Object
CosmosClient
instances
as logical representation of the Azure Cosmos database service.
ConnectionPolicy connectionPolicy = new ConnectionPolicy();
connectionPolicy.connectionMode(ConnectionMode.DIRECT);
CosmonsClient client = new CosmosClient.builder()
.endpoint(serviceEndpoint)
.key(key)
.connectionPolicy(connectionPolicy)
.consistencyLevel(ConsistencyLevel.SESSION)
.build();
Modifier and Type | Method and Description |
---|---|
CosmosClient |
build()
Builds a cosmos configuration object with the provided properties
|
ConnectionPolicy |
connectionPolicy()
Gets the (@link ConnectionPolicy) to be used
|
CosmosClientBuilder |
connectionPolicy(ConnectionPolicy connectionPolicy)
Sets the (@link ConnectionPolicy) to be used
|
ConsistencyLevel |
consistencyLevel()
Gets the (@link ConsistencyLevel) to be used
|
CosmosClientBuilder |
consistencyLevel(ConsistencyLevel desiredConsistencyLevel)
Sets the (@link ConsistencyLevel) to be used
|
String |
endpoint()
Gets the Azure Cosmos DB endpoint the SDK will connect to
|
CosmosClientBuilder |
endpoint(String endpoint)
Sets the Azure Cosmos DB endpoint the SDK will connect to
|
String |
key()
Gets either a master or readonly key used to perform authentication
for accessing resource.
|
CosmosClientBuilder |
key(String key)
Sets either a master or readonly key used to perform authentication
for accessing resource.
|
List<com.azure.data.cosmos.internal.Permission> |
permissions()
Gets the permission list, which contains the
resource tokens needed to access resources.
|
CosmosClientBuilder |
permissions(List<com.azure.data.cosmos.internal.Permission> permissions)
Sets the permission list, which contains the
resource tokens needed to access resources.
|
String |
resourceToken()
Sets a resource token used to perform authentication
for accessing resource.
|
CosmosClientBuilder |
resourceToken(String resourceToken)
Sets a resource token used to perform authentication
for accessing resource.
|
TokenResolver |
tokenResolver()
Gets the token resolver
|
CosmosClientBuilder |
tokenResolver(TokenResolver tokenResolver)
Sets the token resolver
|
public TokenResolver tokenResolver()
public CosmosClientBuilder tokenResolver(TokenResolver tokenResolver)
tokenResolver
- public String endpoint()
public CosmosClientBuilder endpoint(String endpoint)
endpoint
- the service endpointpublic String key()
public CosmosClientBuilder key(String key)
key
- master or readonly keypublic String resourceToken()
public CosmosClientBuilder resourceToken(String resourceToken)
resourceToken
- resourceToken for authenticationpublic List<com.azure.data.cosmos.internal.Permission> permissions()
public CosmosClientBuilder permissions(List<com.azure.data.cosmos.internal.Permission> permissions)
permissions
- Permission list for authentication.public ConsistencyLevel consistencyLevel()
public CosmosClientBuilder consistencyLevel(ConsistencyLevel desiredConsistencyLevel)
desiredConsistencyLevel
- ConsistencyLevel
public ConnectionPolicy connectionPolicy()
public CosmosClientBuilder connectionPolicy(ConnectionPolicy connectionPolicy)
connectionPolicy
- ConnectionPolicy
public CosmosClient build()
Copyright © 2019. All rights reserved.