public final class TableServiceClientBuilder extends Object
TableServiceClient and TableServiceAsyncClient objects. Call TableServiceClientBuilder.buildClient() or
TableServiceClientBuilder.buildAsyncClient(), respectively, to construct an instance of the desired client.
The minimal configuration options required by TableServiceClientBuilder to build a
TableServiceClient or TableServiceAsyncClient are an endpoint and a form of
authentication, which can be set via: TableServiceClientBuilder.connectionString(String),
TableServiceClientBuilder.credential(AzureSasCredential),
TableServiceClientBuilder.credential(AzureNamedKeyCredential) or
TableServiceClientBuilder.sasToken(String)
Samples to construct a sync client
TableServiceClient tableServiceClient = new TableServiceClientBuilder()
.endpoint("https://myvault.azure.net/")
.credential(new AzureNamedKeyCredential("name", "key"))
.buildClient();
Samples to construct an async client
TableServiceAsyncClient tableServiceAsyncClient = new TableServiceClientBuilder()
.endpoint("https://myvault.azure.net/")
.credential(new AzureNamedKeyCredential("name", "key"))
.buildAsyncClient();
TableServiceAsyncClient,
TableServiceClient| Constructor and Description |
|---|
TableServiceClientBuilder()
Creates a builder instance that is able to configure and construct
TableServiceClient and
TableServiceAsyncClient objects. |
| Modifier and Type | Method and Description |
|---|---|
TableServiceClientBuilder |
addPolicy(com.azure.core.http.policy.HttpPipelinePolicy pipelinePolicy)
Adds a
pipeline policy to apply on each request sent. |
TableServiceAsyncClient |
buildAsyncClient()
Creates a
TableServiceAsyncClient based on options set in the builder. |
TableServiceClient |
buildClient()
Creates a
TableServiceClient based on options set in the builder. |
TableServiceClientBuilder |
clientOptions(com.azure.core.util.ClientOptions clientOptions)
Sets the
ClientOptions such as application ID and custom headers to set on a request. |
TableServiceClientBuilder |
configuration(com.azure.core.util.Configuration configuration)
Sets the
configuration object used to retrieve environment configuration values during
building of the client. |
TableServiceClientBuilder |
connectionString(String connectionString)
Sets the connection string to connect to the service.
|
TableServiceClientBuilder |
credential(com.azure.core.credential.AzureNamedKeyCredential credential)
Sets the
AzureNamedKeyCredential used to authorize requests sent to the service. |
TableServiceClientBuilder |
credential(com.azure.core.credential.AzureSasCredential credential)
Sets the
AzureSasCredential used to authorize requests sent to the service. |
TableServiceClientBuilder |
credential(com.azure.core.credential.TokenCredential credential)
Sets the
TokenCredential used to authorize requests sent to the service. |
TableServiceClientBuilder |
endpoint(String endpoint)
Sets the service endpoint.
|
TableServiceClientBuilder |
httpClient(com.azure.core.http.HttpClient httpClient)
Sets the
HttpClient to use for sending and receiving requests to and from the service. |
TableServiceClientBuilder |
httpLogOptions(com.azure.core.http.policy.HttpLogOptions logOptions)
Sets the
logging configuration to use when sending and receiving requests to and from
the service. |
TableServiceClientBuilder |
pipeline(com.azure.core.http.HttpPipeline pipeline)
Sets the
HttpPipeline to use for the service client. |
TableServiceClientBuilder |
retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
Sets the request
RetryPolicy for all the requests made through the client. |
TableServiceClientBuilder |
sasToken(String sasToken)
Sets the SAS token used to authorize requests sent to the service.
|
TableServiceClientBuilder |
serviceVersion(TableServiceVersion serviceVersion)
Sets the
service version that is used when making API requests. |
public TableServiceClientBuilder()
TableServiceClient and
TableServiceAsyncClient objects.public TableServiceClient buildClient()
TableServiceClient based on options set in the builder.TableServiceClient created from the configurations in this builder.NullPointerException - If endpoint is null.IllegalArgumentException - If endpoint is malformed or empty.IllegalStateException - If no form of authentication or endpoint have been specified or if
multiple forms of authentication are provided, with the exception of sasToken +
connectionString. Also thrown if endpoint and/or sasToken are set alongside a
connectionString and the endpoint and/or SAS token in the latter are different than the former,
respectively.public TableServiceAsyncClient buildAsyncClient()
TableServiceAsyncClient based on options set in the builder.TableServiceAsyncClient created from the configurations in this builder.NullPointerException - If endpoint is null.IllegalArgumentException - If endpoint is malformed or empty.IllegalStateException - If no form of authentication or endpoint have been specified or if
multiple forms of authentication are provided, with the exception of sasToken +
connectionString. Also thrown if endpoint and/or sasToken are set alongside a
connectionString and the endpoint and/or SAS token in the latter are different than the former,
respectively.public TableServiceClientBuilder connectionString(String connectionString)
connectionString - Connection string of the storage or CosmosDB table API account.TableServiceClientBuilder.NullPointerException - If connectionString is null.IllegalArgumentException - If connectionString isn't a valid connection string.public TableServiceClientBuilder endpoint(String endpoint)
endpoint - The URL of the storage or CosmosDB table API account endpoint.TableServiceClientBuilder.IllegalArgumentException - If endpoint isn't a valid URL.public TableServiceClientBuilder pipeline(com.azure.core.http.HttpPipeline pipeline)
HttpPipeline to use for the service client. If pipeline is set, all other settings are
ignored, aside from endpoint.pipeline - HttpPipeline to use for sending service requests and receiving responses.TableServiceClientBuilder.public TableServiceClientBuilder configuration(com.azure.core.util.Configuration configuration)
configuration object used to retrieve environment configuration values during
building of the client.
The default configuration store is a clone of the
global configuration store, use Configuration.NONE to
bypass using configuration settings during construction.
configuration - Configuration store used to retrieve environment configuration.TableServiceClientBuilder.public TableServiceClientBuilder sasToken(String sasToken)
TableServiceClientBuilder.credential(AzureNamedKeyCredential),
TableServiceClientBuilder.credential(AzureSasCredential) or
TableServiceClientBuilder.credential(TokenCredential).sasToken - The SAS token to use for authenticating requests.TableServiceClientBuilder.NullPointerException - If sasToken is null.IllegalArgumentException - If sasToken is empty.public TableServiceClientBuilder credential(com.azure.core.credential.AzureSasCredential credential)
AzureSasCredential used to authorize requests sent to the service. Setting this is mutually
exclusive with TableServiceClientBuilder.credential(AzureNamedKeyCredential),
TableServiceClientBuilder.credential(TokenCredential) or
TableServiceClientBuilder.sasToken(String).credential - AzureSasCredential used to authorize requests sent to the service.TableServiceClientBuilder.NullPointerException - If credential is null.public TableServiceClientBuilder credential(com.azure.core.credential.AzureNamedKeyCredential credential)
AzureNamedKeyCredential used to authorize requests sent to the service. Setting this is mutually
exclusive with using TableServiceClientBuilder.credential(AzureSasCredential),
TableServiceClientBuilder.credential(TokenCredential) or
TableServiceClientBuilder.sasToken(String).credential - AzureNamedKeyCredential used to authorize requests sent to the service.TableServiceClientBuilder.NullPointerException - If credential is null.public TableServiceClientBuilder credential(com.azure.core.credential.TokenCredential credential)
TokenCredential used to authorize requests sent to the service. Setting this is mutually
exclusive with using TableServiceClientBuilder.credential(AzureNamedKeyCredential),
TableServiceClientBuilder.credential(AzureSasCredential) or
TableServiceClientBuilder.sasToken(String).credential - TokenCredential used to authorize requests sent to the service.TableServiceClientBuilder.NullPointerException - If credential is null.public TableServiceClientBuilder httpClient(com.azure.core.http.HttpClient httpClient)
HttpClient to use for sending and receiving requests to and from the service.httpClient - The HttpClient to use for requests.TableServiceClientBuilder.public TableServiceClientBuilder httpLogOptions(com.azure.core.http.policy.HttpLogOptions logOptions)
logging configuration to use when sending and receiving requests to and from
the service. If a logLevel is not provided, default value of HttpLogDetailLevel.NONE is set.logOptions - The logging configuration to use when sending and receiving requests to
and from the service.TableServiceClientBuilder.public TableServiceClientBuilder addPolicy(com.azure.core.http.policy.HttpPipelinePolicy pipelinePolicy)
pipeline policy to apply on each request sent. The policy will be added
after the retry policy. If the method is called multiple times, all
policies will be added and their order preserved.pipelinePolicy - A pipeline policy.TableServiceClientBuilder.NullPointerException - If pipelinePolicy is null.public TableServiceClientBuilder serviceVersion(TableServiceVersion serviceVersion)
service version that is used when making API requests.
If a service version is not provided, the
service version that will be used will be the latest known
service version based on the version of the client library being used. If no
service version is specified, updating to a newer version of the client library will
have the result of potentially moving to a newer service version.
Targeting a specific service version may also mean that the service will return an
error for newer APIs.
serviceVersion - The TableServiceVersion of the service to be used when making requests.TableServiceClientBuilder.public TableServiceClientBuilder retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
RetryPolicy for all the requests made through the client. The default
RetryPolicy will be used in the pipeline, if not provided.retryPolicy - RetryPolicy.TableServiceClientBuilder.public TableServiceClientBuilder clientOptions(com.azure.core.util.ClientOptions clientOptions)
ClientOptions such as application ID and custom headers to set on a request.clientOptions - The ClientOptions.TableServiceClientBuilder.Copyright © 2021 Microsoft Corporation. All rights reserved.