public final class CloudTableClient extends ServiceClient
The CloudTableClient class encapsulates the base URI for the Table service endpoint and the credentials for
accessing the storage account, and provides methods to create, delete, list, and query tables, as well as methods to
execute operations and queries on table entities. These methods invoke Storage Service REST API operations to make
the requests and obtain the results that are returned.
A Table service endpoint is the base URI for Table service resources, including the DNS name of the storage account:
http://myaccount.table.core.windows.net
For more information, see the MSDN topic Addressing Table Service Resources.
The credentials can be a combination of the storage account name and a key, or a shared access signature. For more information, see the MSDN topic Authenticating Access to Your Storage Account.
| Constructor and Description |
|---|
CloudTableClient(StorageUri baseUri,
StorageCredentials credentials)
Initializes an instance of the
CloudTableClientclass using a Table service endpoint and
storage account credentials. |
CloudTableClient(URI baseUri,
StorageCredentials credentials)
Initializes an instance of the
CloudTableClient class using a Table service endpoint and
storage account credentials. |
| Modifier and Type | Method and Description |
|---|---|
ServiceProperties |
downloadServiceProperties()
Retrieves the current
ServiceProperties for the given storage service. |
ServiceProperties |
downloadServiceProperties(TableRequestOptions options,
OperationContext opContext)
Retrieves the current
ServiceProperties for the given storage service. |
TableRequestOptions |
getDefaultRequestOptions()
Gets the
TableRequestOptions that is used for requests associated with this CloudTableClient |
ServiceStats |
getServiceStats()
Queries the service for the
ServiceStats. |
ServiceStats |
getServiceStats(TableRequestOptions options,
OperationContext opContext)
Queries the given storage service for the
ServiceStats. |
CloudTable |
getTableReference(String tableName)
Gets a
CloudTable object with the specified name. |
Iterable<String> |
listTables()
Lists the table names in the storage account.
|
Iterable<String> |
listTables(String prefix)
Lists the table names in the storage account that match the specified prefix.
|
Iterable<String> |
listTables(String prefix,
TableRequestOptions options,
OperationContext opContext)
Lists the table names in the storage account that match the specified prefix, using the specified
TableRequestOptions and OperationContext. |
ResultSegment<String> |
listTablesSegmented()
Lists the table names in the storage account in segmented mode.
|
ResultSegment<String> |
listTablesSegmented(String prefix)
Lists the table names in the storage account that match the specified prefix in segmented mode.
|
ResultSegment<String> |
listTablesSegmented(String prefix,
Integer maxResults,
ResultContinuation continuationToken,
TableRequestOptions options,
OperationContext opContext)
Lists up to the specified maximum of the table names in the storage account that match the specified prefix in a
resumable mode with the specified
ResultContinuation continuation token, using the specified
TableRequestOptions and OperationContext. |
void |
setDefaultRequestOptions(TableRequestOptions defaultRequestOptions)
Sets the
TableRequestOptions that is used for any table accessed with this CloudTableClient
object. |
void |
uploadServiceProperties(ServiceProperties properties)
Uploads a new
ServiceProperties configuration to the given storage service. |
void |
uploadServiceProperties(ServiceProperties properties,
TableRequestOptions options,
OperationContext opContext)
Uploads a new
ServiceProperties configuration to the given storage service. |
getCredentials, getEndpoint, getStorageUripublic CloudTableClient(URI baseUri, StorageCredentials credentials)
CloudTableClient class using a Table service endpoint and
storage account credentials.baseUri - A java.net.URI object that represents the Table service endpoint used to initialize the
client.credentials - A StorageCredentials object that represents the storage account credentials for access.public CloudTableClient(StorageUri baseUri, StorageCredentials credentials)
CloudTableClientclass using a Table service endpoint and
storage account credentials.baseUri - A StorageUri object that represents the Table service endpoint used to initialize the
client.credentials - A StorageCredentials object that represents the storage account credentials for access.public CloudTable getTableReference(String tableName) throws URISyntaxException, StorageException
CloudTable object with the specified name.tableName - A String which represents the name of the table, which must adhere to table naming rules.
The table name should not include any path separator characters (/).
Table names are case insensitive, must be unique within an account and must be between 3-63 characters
long. Table names must start with an cannot begin with a numeric character and may only contain
alphanumeric characters. Some table names are reserved, including "table".CloudTable object.URISyntaxException - If the resource URI constructed based on the tableName is invalid.StorageException - If a storage service error occurred.@DoesServiceRequest public Iterable<String> listTables()
This method invokes the Query Tables REST API to list the table names, using the Table service endpoint and storage account credentials of this instance.
Iterable collection of the table names in the storage account retrieved lazily.@DoesServiceRequest public Iterable<String> listTables(String prefix)
This method invokes the Query Tables REST API to list the table names that match the prefix, using the Table service endpoint and storage account credentials of this instance.
prefix - A String containing the prefix to match on table names to return.Iterable collection of the table names in the storage account retrieved lazily that match
the specified prefix.@DoesServiceRequest public Iterable<String> listTables(String prefix, TableRequestOptions options, OperationContext opContext)
TableRequestOptions and OperationContext.
This method invokes the Query Tables
REST API to list the table names that match the prefix, using the Table service endpoint and storage account
credentials of this instance.
Use the TableRequestOptions to override execution options such as the timeout or retry policy for the
operation.
prefix - A String containing the prefix to match on table names to return.options - A TableRequestOptions object that specifies execution options such as retry policy and timeout
settings for the operation. Specify null to use the request options specified on the
CloudTableClient.opContext - An OperationContext object for tracking the current operation. Specify null to
safely ignore operation context.Iterable collection of the table names in the storage account retrieved lazily that match
the specified
prefix.@DoesServiceRequest public ResultSegment<String> listTablesSegmented() throws StorageException
ResultSegment object.
This method invokes the Query Tables REST API to list the table names, using the Table service endpoint and storage account credentials of this instance.
ResultSegment of String objects containing table names in the storage account.StorageException - if a storage service error occurred during the operation.@DoesServiceRequest public ResultSegment<String> listTablesSegmented(String prefix) throws StorageException
ResultSegment object.
This method invokes the Query Tables REST API to list the table names that match the prefix, using the Table service endpoint and storage account credentials of this instance.
prefix - A String containing the prefix to match on table names to return.ResultSegment of String objects containing table names matching the prefix in the
storage account.StorageException - if a storage service error occurred during the operation.@DoesServiceRequest public ResultSegment<String> listTablesSegmented(String prefix, Integer maxResults, ResultContinuation continuationToken, TableRequestOptions options, OperationContext opContext) throws StorageException
ResultContinuation continuation token, using the specified
TableRequestOptions and OperationContext. This method allows listing of tables to be resumed
after returning a page of results, using information returned by the server in the ResultSegment object.
This method invokes the Query Tables
REST API to list the table names that match the prefix, using the Table service endpoint and storage account
credentials of this instance.
Use the TableRequestOptions to override execution options such as the timeout or retry policy for the
operation.
prefix - A String containing the prefix to match on table names to return.maxResults - The maximum number of table names to return in the ResultSegment. If this parameter is null,
the query will list up to the maximum 1,000 results.continuationToken - A ResultContinuation object representing a continuation token from the server when the
operation returns a partial result. Specify null on the initial call. Call the
ResultSegment.getContinuationToken() method on the result to obtain the
ResultContinuation object to use in the next call to resume the query.options - A TableRequestOptions object that specifies execution options such as retry policy and timeout
settings for the operation. Specify null to use the request options specified on the
CloudTableClient.opContext - An OperationContext object for tracking the current operation. Specify null to
safely ignore operation context.ResultSegment of String objects containing table names in the storage account.StorageException - if a storage service error occurred during the operation.@DoesServiceRequest public ServiceStats getServiceStats() throws StorageException
ServiceStats.ServiceStats for the given storage serviceStorageException - If a storage service error occurred.@DoesServiceRequest public ServiceStats getServiceStats(TableRequestOptions options, OperationContext opContext) throws StorageException
ServiceStats.options - A BlobRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudBlobClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.ServiceStats for the given storage serviceStorageException - If a storage service error occurred.@DoesServiceRequest public final ServiceProperties downloadServiceProperties() throws StorageException
ServiceProperties for the given storage service. This includes Logging,
HourMetrics, MinuteMetrics and CORS configurations.ServiceProperties object representing the current configuration of the service.StorageException - If a storage service error occurred.@DoesServiceRequest public final ServiceProperties downloadServiceProperties(TableRequestOptions options, OperationContext opContext) throws StorageException
ServiceProperties for the given storage service. This includes Logging,
HourMetrics, MinuteMetrics and CORS configurations.options - A BlobRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudBlobClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.ServiceProperties object representing the current configuration of the service.StorageException - If a storage service error occurred.@DoesServiceRequest public void uploadServiceProperties(ServiceProperties properties) throws StorageException
ServiceProperties configuration to the given storage service. This includes Logging,
HourMetrics, MinuteMetrics and CORS configurations.properties - The ServiceProperties to upload.StorageException - If a storage service error occurred.@DoesServiceRequest public void uploadServiceProperties(ServiceProperties properties, TableRequestOptions options, OperationContext opContext) throws StorageException
ServiceProperties configuration to the given storage service. This includes Logging,
HourMetrics, MinuteMetrics and CORS configurations.properties - The ServiceProperties to upload.options - A BlobRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudBlobClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageException - If a storage service error occurred.public TableRequestOptions getDefaultRequestOptions()
TableRequestOptions that is used for requests associated with this CloudTableClientgetDefaultRequestOptions in class ServiceClientTableRequestOptions object containing the values used by this CloudTableClientpublic void setDefaultRequestOptions(TableRequestOptions defaultRequestOptions)
TableRequestOptions that is used for any table accessed with this CloudTableClient
object.defaultRequestOptions - The TableRequestOptions to use.Copyright © 2018. All Rights Reserved.