다음을 통해 공유


AsyncDocumentClient.Builder Class

  • java.lang.Object
    • com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder

public class Builder

Helper class to build AsyncDocumentClient instances 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();

    

  

Method Summary

Modifier and Type Method and Description
AsyncDocumentClient build()
Configs getConfigs()
ConnectionPolicy getConnectionPolicy()
ConsistencyLevel getDesiredConsistencyLevel()
String getMasterKeyOrResourceToken()
List<Permission> getPermissionFeed()
URI getServiceEndpoint()
TokenResolver getTokenResolver()
void setConfigs(Configs configs)
void setConnectionPolicy(ConnectionPolicy connectionPolicy)
void setDesiredConsistencyLevel(ConsistencyLevel desiredConsistencyLevel)
void setMasterKeyOrResourceToken(String masterKeyOrResourceToken)
void setPermissionFeed(List<Permission> permissionFeed)
void setServiceEndpoint(URI serviceEndpoint)
void setTokenResolver(TokenResolver tokenResolver)
AsyncDocumentClient.Builder withConfigs(Configs configs)
AsyncDocumentClient.Builder withConnectionPolicy(ConnectionPolicy connectionPolicy)
AsyncDocumentClient.Builder withConsistencyLevel(ConsistencyLevel desiredConsistencyLevel)
AsyncDocumentClient.Builder withMasterKey(String masterKeyOrResourceToken)

New method withMasterKeyOrResourceToken will take either master key or resource token and perform authentication for accessing resource.

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder.withMasterKeyOrResourceToken(String)" data-throw-if-not-resolved="false" data-raw-source="withMasterKeyOrResourceToken(String)"></xref> instead. </p>

</xrefdescription>

AsyncDocumentClient.Builder withMasterKeyOrResourceToken(String masterKeyOrResourceToken)

This method will accept the master key , additionally it can also consume resource token too for authentication.

AsyncDocumentClient.Builder withPermissionFeed(List<Permission> permissionFeed)

This method will accept the permission list , which contains the resource tokens needed to access resources.

AsyncDocumentClient.Builder withServiceEndpoint(String serviceEndpoint)
AsyncDocumentClient.Builder withTokenResolver(TokenResolver tokenResolver)

This method will accept tokenResolver which is rx function, it takes arguments

T1 requestVerb(String),

T2 resourceIdOrFullName(String),

T3 resourceType(com.microsoft.azure.cosmosdb.internal.ResourceType),

T4 request headers(Map<String, String>)

and return

R authenticationToken(String)

Method Details

build

public AsyncDocumentClient build()

getConfigs

public Configs getConfigs()

getConnectionPolicy

public ConnectionPolicy getConnectionPolicy()

getDesiredConsistencyLevel

public ConsistencyLevel getDesiredConsistencyLevel()

getMasterKeyOrResourceToken

public String getMasterKeyOrResourceToken()

getPermissionFeed

public List getPermissionFeed()

getServiceEndpoint

public URI getServiceEndpoint()

getTokenResolver

public TokenResolver getTokenResolver()

setConfigs

public void setConfigs(Configs configs)

Parameters:

configs

setConnectionPolicy

public void setConnectionPolicy(ConnectionPolicy connectionPolicy)

Parameters:

connectionPolicy

setDesiredConsistencyLevel

public void setDesiredConsistencyLevel(ConsistencyLevel desiredConsistencyLevel)

Parameters:

desiredConsistencyLevel

setMasterKeyOrResourceToken

public void setMasterKeyOrResourceToken(String masterKeyOrResourceToken)

Parameters:

masterKeyOrResourceToken

setPermissionFeed

public void setPermissionFeed(List permissionFeed)

Parameters:

permissionFeed

setServiceEndpoint

public void setServiceEndpoint(URI serviceEndpoint)

Parameters:

serviceEndpoint

setTokenResolver

public void setTokenResolver(TokenResolver tokenResolver)

Parameters:

tokenResolver

withConfigs

public Builder withConfigs(Configs configs)

Parameters:

configs

withConnectionPolicy

public Builder withConnectionPolicy(ConnectionPolicy connectionPolicy)

Parameters:

connectionPolicy

withConsistencyLevel

public Builder withConsistencyLevel(ConsistencyLevel desiredConsistencyLevel)

Parameters:

desiredConsistencyLevel

withMasterKey

public Builder withMasterKey(String masterKeyOrResourceToken)

New method withMasterKeyOrResourceToken will take either master key or resource token and perform authentication for accessing resource.

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>use <xref uid="com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder.withMasterKeyOrResourceToken(String)" data-throw-if-not-resolved="false" data-raw-source="withMasterKeyOrResourceToken(String)"></xref> instead. </p>

</xrefdescription>

Parameters:

masterKeyOrResourceToken - MasterKey or resourceToken for authentication.

Returns:

current Builder.

withMasterKeyOrResourceToken

public 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 Builder withPermissionFeed(List 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.

withServiceEndpoint

public Builder withServiceEndpoint(String serviceEndpoint)

Parameters:

serviceEndpoint

withTokenResolver

public Builder withTokenResolver(TokenResolver tokenResolver)

This method will accept tokenResolver which is rx function, it takes arguments

T1 requestVerb(String),

T2 resourceIdOrFullName(String),

T3 resourceType(com.microsoft.azure.cosmosdb.internal.ResourceType),

T4 request headers(Map<String, String>)

and return

R authenticationToken(String)

Parameters:

tokenResolver - tokenResolver function for authentication.

Returns:

current Builder. 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.

Applies to