你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
AsyncDocumentClient.Builder 类
- java.
lang. Object - com.
microsoft. azure. cosmosdb. rx. AsyncDocumentClient. Builder
- com.
public class Builder
帮助程序类,用于生成 AsyncDocumentClient 实例作为 Azure Cosmos DB 数据库服务的逻辑表示形式。
ConnectionPolicy connectionPolicy = new ConnectionPolicy();
connectionPolicy.setConnectionMode(ConnectionMode.Direct);
AsyncDocumentClient client = new AsyncDocumentClient.Builder()
.withServiceEndpoint(serviceEndpoint)
.withMasterKeyOrResourceToken(masterKey)
.withConnectionPolicy(connectionPolicy)
.withConsistencyLevel(ConsistencyLevel.Session)
.build();
方法摘要
方法详细信息
build
public AsyncDocumentClient build()
getConfigs
public Configs getConfigs()
getConnectionPolicy
public ConnectionPolicy getConnectionPolicy()
getDesiredConsistencyLevel
public ConsistencyLevel getDesiredConsistencyLevel()
getMasterKeyOrResourceToken
public String getMasterKeyOrResourceToken()
getPermissionFeed
public List
getServiceEndpoint
public URI getServiceEndpoint()
getTokenResolver
public TokenResolver getTokenResolver()
setConfigs
public void setConfigs(Configs configs)
参数:
setConnectionPolicy
public void setConnectionPolicy(ConnectionPolicy connectionPolicy)
参数:
setDesiredConsistencyLevel
public void setDesiredConsistencyLevel(ConsistencyLevel desiredConsistencyLevel)
参数:
setMasterKeyOrResourceToken
public void setMasterKeyOrResourceToken(String masterKeyOrResourceToken)
参数:
setPermissionFeed
public void setPermissionFeed(List
参数:
setServiceEndpoint
public void setServiceEndpoint(URI serviceEndpoint)
参数:
setTokenResolver
public void setTokenResolver(TokenResolver tokenResolver)
参数:
withConfigs
public Builder withConfigs(Configs configs)
参数:
withConnectionPolicy
public Builder withConnectionPolicy(ConnectionPolicy connectionPolicy)
参数:
withConsistencyLevel
public Builder withConsistencyLevel(ConsistencyLevel desiredConsistencyLevel)
参数:
withMasterKey
public Builder withMasterKey(String masterKeyOrResourceToken)
使用MasterKeyOrResourceToken 的新方法将采用主密钥或资源令牌,并执行访问资源的身份验证。
<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>
参数:
返回:
withMasterKeyOrResourceToken
public Builder withMasterKeyOrResourceToken(String masterKeyOrResourceToken)
此方法将接受主密钥 ,此外,它还可能使用资源令牌进行身份验证。
参数:
返回:
withPermissionFeed
public Builder withPermissionFeed(List
此方法将接受权限列表,其中包含访问资源所需的资源令牌。
参数:
返回:
withServiceEndpoint
public Builder withServiceEndpoint(String serviceEndpoint)
参数:
withTokenResolver
public Builder withTokenResolver(TokenResolver tokenResolver)
此方法将接受 tokenResolver,它是 rx 函数,它采用参数
T1 requestVerb (String) ,
T2 resourceIdOrFullName (String) ,
T3 resourceType (com.microsoft.azure.cosmosdb.internal.ResourceType) ,
T4 请求标头 (映射<字符串、字符串>)
并返回
R authenticationToken (字符串)
参数:
返回: