public final class TableClientBuilder extends Object
TableClient and
TableAsyncClient objects. Call TableClientBuilder.buildClient() or TableClientBuilder.buildAsyncClient(), respectively, to
construct an instance of the desired client.
The minimal configuration options required by TableClientBuilder to build a TableClient or
TableAsyncClient are a tableName and endpoint and a form of authentication,
which can be set via: TableClientBuilder.connectionString(String),
TableClientBuilder.credential(AzureSasCredential),
TableClientBuilder.credential(AzureNamedKeyCredential) or TableClientBuilder.sasToken(String)
Samples to construct a sync client
TableClient tableClient = new TableClientBuilder()
.endpoint("https://myaccount.core.windows.net/")
.credential(new AzureNamedKeyCredential("name", "key"))
.tableName("myTable")
.buildClient();
Samples to construct an async client
TableAsyncClient tableAsyncClient = new TableClientBuilder()
.endpoint("https://myaccount.core.windows.net/")
.credential(new AzureNamedKeyCredential("name", "key"))
.tableName("myTable")
.buildAsyncClient();
TableAsyncClient,
TableClient| Constructor and Description |
|---|
TableClientBuilder()
Creates a builder instance that is able to configure and construct
TableClient and
TableAsyncClient objects. |
| Modifier and Type | Method and Description |
|---|---|
TableClientBuilder |
addPolicy(com.azure.core.http.policy.HttpPipelinePolicy pipelinePolicy)
Adds a
pipeline policy to apply on each request sent. |
TableAsyncClient |
buildAsyncClient()
Creates a
TableAsyncClient based on options set in the builder. |
TableClient |
buildClient()
Creates a
TableClient based on options set in the builder. |
TableClientBuilder |
clientOptions(com.azure.core.util.ClientOptions clientOptions)
Sets the
ClientOptions such as application ID and custom headers to set on a request. |
TableClientBuilder |
configuration(com.azure.core.util.Configuration configuration)
Sets the
configuration object used to retrieve environment configuration values during
building of the client. |
TableClientBuilder |
connectionString(String connectionString)
Sets the connection string to connect to the service.
|
TableClientBuilder |
credential(com.azure.core.credential.AzureNamedKeyCredential credential)
Sets the
AzureNamedKeyCredential used to authorize requests sent to the service. |
TableClientBuilder |
credential(com.azure.core.credential.AzureSasCredential credential)
Sets the
AzureSasCredential used to authorize requests sent to the service. |
TableClientBuilder |
credential(com.azure.core.credential.TokenCredential credential)
Sets the
TokenCredential used to authorize requests sent to the service. |
TableClientBuilder |
endpoint(String endpoint)
Sets the service endpoint.
|
TableClientBuilder |
httpClient(com.azure.core.http.HttpClient httpClient)
Sets the
HttpClient to use for sending and receiving requests to and from the service. |
TableClientBuilder |
httpLogOptions(com.azure.core.http.policy.HttpLogOptions logOptions)
Sets the
logging configuration to use when sending and receiving requests to and from
the service. |
TableClientBuilder |
pipeline(com.azure.core.http.HttpPipeline pipeline)
Sets the
HttpPipeline to use for the service client. |
TableClientBuilder |
retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
Sets the request
RetryPolicy for all the requests made through the client. |
TableClientBuilder |
sasToken(String sasToken)
Sets the SAS token used to authorize requests sent to the service.
|
TableClientBuilder |
serviceVersion(TableServiceVersion version)
Sets the
service version that is used when making API requests. |
TableClientBuilder |
tableName(String tableName)
Sets the name of the table.
|
public TableClientBuilder()
TableClient and
TableAsyncClient objects.public TableClient buildClient()
TableClient based on options set in the builder.TableClient created from the configurations in this builder.NullPointerException - If endpoint or tableName are null.IllegalArgumentException - If endpoint is malformed or empty or if tableName is 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 TableAsyncClient buildAsyncClient()
TableAsyncClient based on options set in the builder.TableAsyncClient created from the configurations in this builder.NullPointerException - If endpoint or tableName are null.IllegalArgumentException - If endpoint is malformed or empty or if tableName is 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 TableClientBuilder connectionString(String connectionString)
connectionString - Connection string of the storage or CosmosDB table API account.TableClientBuilder.NullPointerException - If connectionString is null.IllegalArgumentException - If connectionString isn't a valid connection string.public TableClientBuilder endpoint(String endpoint)
endpoint - The URL of the storage or CosmosDB table API account endpoint.TableClientBuilder.NullPointerException - If endpoint is null.IllegalArgumentException - If endpoint isn't a valid URL.public TableClientBuilder 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.TableClientBuilder.public TableClientBuilder 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.TableClientBuilder.public TableClientBuilder sasToken(String sasToken)
TableClientBuilder.credential(AzureNamedKeyCredential),
TableClientBuilder.credential(AzureSasCredential) or
TableClientBuilder.credential(TokenCredential).sasToken - The SAS token to use for authenticating requests.TableClientBuilder.NullPointerException - If sasToken is null.IllegalArgumentException - If sasToken is empty.public TableClientBuilder credential(com.azure.core.credential.AzureSasCredential credential)
AzureSasCredential used to authorize requests sent to the service. Setting this is mutually
exclusive with TableClientBuilder.credential(AzureNamedKeyCredential),
TableClientBuilder.credential(TokenCredential) or
TableClientBuilder.sasToken(String).credential - AzureSasCredential used to authorize requests sent to the service.TableClientBuilder.NullPointerException - If credential is null.public TableClientBuilder credential(com.azure.core.credential.AzureNamedKeyCredential credential)
AzureNamedKeyCredential used to authorize requests sent to the service. Setting this is mutually
exclusive with using TableClientBuilder.credential(AzureSasCredential),
TableClientBuilder.credential(TokenCredential) or
TableClientBuilder.sasToken(String).credential - AzureNamedKeyCredential used to authorize requests sent to the service.TableClientBuilder.NullPointerException - If credential is null.public TableClientBuilder credential(com.azure.core.credential.TokenCredential credential)
TokenCredential used to authorize requests sent to the service. Setting this is mutually
exclusive with using TableClientBuilder.credential(AzureNamedKeyCredential),
TableClientBuilder.credential(AzureSasCredential) or
TableClientBuilder.sasToken(String).credential - TokenCredential used to authorize requests sent to the service.TableClientBuilder.NullPointerException - If credential is null.public TableClientBuilder 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.TableClientBuilder.public TableClientBuilder 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.TableClientBuilder.public TableClientBuilder 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.TableClientBuilder.NullPointerException - If pipelinePolicy is null.public TableClientBuilder serviceVersion(TableServiceVersion version)
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.
version - The TableServiceVersion of the service to be used when making requests.TableClientBuilder.public TableClientBuilder 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.TableClientBuilder.public TableClientBuilder clientOptions(com.azure.core.util.ClientOptions clientOptions)
ClientOptions such as application ID and custom headers to set on a request.clientOptions - The ClientOptions.TableClientBuilder.public TableClientBuilder tableName(String tableName)
tableName - Name of the table.TableClientBuilder.IllegalArgumentException - If tableName is null or empty.Copyright © 2021 Microsoft Corporation. All rights reserved.