Package com.microsoft.azure.cosmosdb.rx
Class AsyncDocumentClient.Builder
- java.lang.Object
-
- com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder
-
- Enclosing interface:
- AsyncDocumentClient
public static class AsyncDocumentClient.Builder extends Object
Helper class to buildAsyncDocumentClientinstances as logical representation of the Azure Cosmos DB database service.ConnectionPolicy connectionPolicy = new ConnectionPolicy(); connectionPolicy.setConnectionMode(ConnectionMode.Direct); AsyncDocumentClient client = new AsyncDocumentClient.Builder() .withServiceEndpoint(serviceEndpoint) .withMasterKeyOrResourceToken(masterKey) .withConnectionPolicy(connectionPolicy) .withConsistencyLevel(ConsistencyLevel.Session) .build();
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AsyncDocumentClientbuild()com.microsoft.azure.cosmosdb.rx.internal.ConfigsgetConfigs()com.microsoft.azure.cosmosdb.ConnectionPolicygetConnectionPolicy()com.microsoft.azure.cosmosdb.ConsistencyLevelgetDesiredConsistencyLevel()StringgetMasterKeyOrResourceToken()List<com.microsoft.azure.cosmosdb.Permission>getPermissionFeed()URIgetServiceEndpoint()com.microsoft.azure.cosmosdb.TokenResolvergetTokenResolver()voidsetConfigs(com.microsoft.azure.cosmosdb.rx.internal.Configs configs)voidsetConnectionPolicy(com.microsoft.azure.cosmosdb.ConnectionPolicy connectionPolicy)voidsetDesiredConsistencyLevel(com.microsoft.azure.cosmosdb.ConsistencyLevel desiredConsistencyLevel)voidsetMasterKeyOrResourceToken(String masterKeyOrResourceToken)voidsetPermissionFeed(List<com.microsoft.azure.cosmosdb.Permission> permissionFeed)voidsetServiceEndpoint(URI serviceEndpoint)voidsetTokenResolver(com.microsoft.azure.cosmosdb.TokenResolver tokenResolver)AsyncDocumentClient.BuilderwithConfigs(com.microsoft.azure.cosmosdb.rx.internal.Configs configs)AsyncDocumentClient.BuilderwithConnectionPolicy(com.microsoft.azure.cosmosdb.ConnectionPolicy connectionPolicy)AsyncDocumentClient.BuilderwithConsistencyLevel(com.microsoft.azure.cosmosdb.ConsistencyLevel desiredConsistencyLevel)AsyncDocumentClient.BuilderwithMasterKey(String masterKeyOrResourceToken)Deprecated.usewithMasterKeyOrResourceToken(String)instead.AsyncDocumentClient.BuilderwithMasterKeyOrResourceToken(String masterKeyOrResourceToken)This method will accept the master key , additionally it can also consume resource token too for authentication.AsyncDocumentClient.BuilderwithPermissionFeed(List<com.microsoft.azure.cosmosdb.Permission> permissionFeed)This method will accept the permission list , which contains the resource tokens needed to access resources.AsyncDocumentClient.BuilderwithServiceEndpoint(String serviceEndpoint)AsyncDocumentClient.BuilderwithTokenResolver(com.microsoft.azure.cosmosdb.TokenResolver tokenResolver)This method will accept functional interface TokenResolver which helps in generation authorization token per request.
-
-
-
Method Detail
-
withServiceEndpoint
public AsyncDocumentClient.Builder withServiceEndpoint(String serviceEndpoint)
-
withMasterKey
@Deprecated public AsyncDocumentClient.Builder withMasterKey(String masterKeyOrResourceToken)
Deprecated.usewithMasterKeyOrResourceToken(String)instead.New method withMasterKeyOrResourceToken will take either master key or resource token and perform authentication for accessing resource.- Parameters:
masterKeyOrResourceToken- MasterKey or resourceToken for authentication.- Returns:
- current Builder.
-
withMasterKeyOrResourceToken
public AsyncDocumentClient.Builder withMasterKeyOrResourceToken(String masterKeyOrResourceToken)
This method will accept the master key , additionally it can also consume resource token too for authentication.- Parameters:
masterKeyOrResourceToken- MasterKey or resourceToken for authentication.- Returns:
- current Builder.
-
withPermissionFeed
public AsyncDocumentClient.Builder withPermissionFeed(List<com.microsoft.azure.cosmosdb.Permission> permissionFeed)
This method will accept the permission list , which contains the resource tokens needed to access resources.- Parameters:
permissionFeed- Permission list for authentication.- Returns:
- current Builder.
-
withConsistencyLevel
public AsyncDocumentClient.Builder withConsistencyLevel(com.microsoft.azure.cosmosdb.ConsistencyLevel desiredConsistencyLevel)
-
withConfigs
public AsyncDocumentClient.Builder withConfigs(com.microsoft.azure.cosmosdb.rx.internal.Configs configs)
-
withConnectionPolicy
public AsyncDocumentClient.Builder withConnectionPolicy(com.microsoft.azure.cosmosdb.ConnectionPolicy connectionPolicy)
-
withTokenResolver
public AsyncDocumentClient.Builder withTokenResolver(com.microsoft.azure.cosmosdb.TokenResolver tokenResolver)
This method will accept functional interface TokenResolver which helps in generation authorization token per request. AsyncDocumentClient can be successfully initialized with this API without passing any MasterKey, ResourceToken or PermissionFeed.- Parameters:
tokenResolver- The tokenResolver- Returns:
- current Builder.
-
build
public AsyncDocumentClient build()
-
getConfigs
public com.microsoft.azure.cosmosdb.rx.internal.Configs getConfigs()
-
setConfigs
public void setConfigs(com.microsoft.azure.cosmosdb.rx.internal.Configs configs)
-
getConnectionPolicy
public com.microsoft.azure.cosmosdb.ConnectionPolicy getConnectionPolicy()
-
setConnectionPolicy
public void setConnectionPolicy(com.microsoft.azure.cosmosdb.ConnectionPolicy connectionPolicy)
-
getDesiredConsistencyLevel
public com.microsoft.azure.cosmosdb.ConsistencyLevel getDesiredConsistencyLevel()
-
setDesiredConsistencyLevel
public void setDesiredConsistencyLevel(com.microsoft.azure.cosmosdb.ConsistencyLevel desiredConsistencyLevel)
-
getPermissionFeed
public List<com.microsoft.azure.cosmosdb.Permission> getPermissionFeed()
-
setPermissionFeed
public void setPermissionFeed(List<com.microsoft.azure.cosmosdb.Permission> permissionFeed)
-
getMasterKeyOrResourceToken
public String getMasterKeyOrResourceToken()
-
setMasterKeyOrResourceToken
public void setMasterKeyOrResourceToken(String masterKeyOrResourceToken)
-
getServiceEndpoint
public URI getServiceEndpoint()
-
setServiceEndpoint
public void setServiceEndpoint(URI serviceEndpoint)
-
getTokenResolver
public com.microsoft.azure.cosmosdb.TokenResolver getTokenResolver()
-
setTokenResolver
public void setTokenResolver(com.microsoft.azure.cosmosdb.TokenResolver tokenResolver)
-
-