diff --git a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/JobRouterAdministrationClientBuilder.java b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/JobRouterAdministrationClientBuilder.java
index b7b4f5651776..6bca5ea1e831 100644
--- a/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/JobRouterAdministrationClientBuilder.java
+++ b/sdk/communication/azure-communication-jobrouter/src/main/java/com/azure/communication/jobrouter/JobRouterAdministrationClientBuilder.java
@@ -10,6 +10,7 @@
import com.azure.core.client.traits.ConfigurationTrait;
import com.azure.core.client.traits.EndpointTrait;
import com.azure.core.client.traits.HttpTrait;
+import com.azure.core.client.traits.KeyCredentialTrait;
import com.azure.core.credential.KeyCredential;
import com.azure.core.credential.TokenCredential;
import com.azure.core.http.HttpClient;
@@ -25,6 +26,7 @@
import com.azure.core.http.policy.HttpLoggingPolicy;
import com.azure.core.http.policy.HttpPipelinePolicy;
import com.azure.core.http.policy.HttpPolicyProviders;
+import com.azure.core.http.policy.KeyCredentialPolicy;
import com.azure.core.http.policy.RequestIdPolicy;
import com.azure.core.http.policy.RetryOptions;
import com.azure.core.http.policy.RetryPolicy;
@@ -46,7 +48,8 @@
@ServiceClientBuilder(
serviceClients = { JobRouterAdministrationClient.class, JobRouterAdministrationAsyncClient.class })
public final class JobRouterAdministrationClientBuilder implements HttpTrait The client encapsulates the URL for the table within the Tables service endpoint, the name of the table, and the
* credentials for accessing the storage or CosmosDB table API account. It provides methods to create and delete the
* table itself, as well as methods to create, upsert, update, delete, list, and get entities within the table. These
* methods invoke REST API operations to make the requests and obtain the results that are returned. Instances of this client are obtained by calling the {@link TableClientBuilder#buildAsyncClient()} method on a
- * {@link TableClientBuilder} object. Authenticating and building instances of this client are handled by {@link TableClientBuilder}.
+ * This sample shows how to authenticate and build a TableClient instance using the {@link TableClientBuilder} and
+ * a connection string. Samples to construct an async client For more information on building and authenticating, see the {@link TableClientBuilder} documentation. The following code samples provide examples of common operations preformed with this client. The {@link #createEntity(TableEntity) createEntity} method can be used to create a table entity within a table in your Azure Storage or Azure Cosmos account. The sample below creates a {@link TableEntity} with a partition key of "partitionKey" and a row key of "rowKey". The {@link #getEntity(String, String) getEntity} method can be used to retrieve a table entity within a table in your Azure Storage or Azure Cosmos account. The sample below retrieves a {@link TableEntity} with a partition key of "partitionKey" and a row key of "rowKey". The {@link #updateEntity(TableEntity) updateEntity} method can be used to update a table entity within a table in your Azure Storage or Azure Cosmos account. The sample below updates a {@link TableEntity} with a partition key of "partitionKey" and a row key of "rowKey", adding a new property with a key of "Property" and a value of "Value". The {@link #listEntities() listEntities} method can be used to list the entities within a table in your Azure Storage or Azure Cosmos account. The sample below lists all {@link TableEntity TableEntities} within the table without filtering out any entities. The sample below lists {@link TableEntity TableEntities} within the table, filtering out any entities that do not have a partition key of "partitionKey" and a row key of "rowKey"
+ * and only selects the "name", "lastname", and "age" properties. The {@link #deleteEntity(String, String) deleteEntity} method can be used to delete a table entity within a table in your Azure Storage or Azure Cosmos account. The sample below deletes a {@link TableEntity} with a partition key of "partitionKey" and a row key of "rowKey". The {@link #submitTransaction(List) submitTransaction} method can be used to submit a transactional batch of actions to perform on the table in your Azure Storage or Azure Cosmos account. The sample below shows how to prepare and submit a transactional batch with multiple actions.Overview
+ *
* Getting Started
+ *
+ *
* TableAsyncClient tableAsyncClient = new TableClientBuilder()
- * .endpoint("https://myaccount.core.windows.net/")
- * .credential(new AzureNamedKeyCredential("name", "key"))
+ * .connectionString("connectionstring")
* .tableName("myTable")
* .buildAsyncClient();
*
- *
+ *
+ *
+ *
+ *
+ * Create a {@link TableEntity}
+ *
+ *
+ * TableEntity tableEntity = new TableEntity("partitionKey", "rowKey")
+ * .addProperty("Property", "Value");
+ *
+ * tableAsyncClient.createEntity(tableEntity)
+ * .contextWrite(Context.of("key1", "value1", "key2", "value2"))
+ * .subscribe(unused ->
+ * System.out.printf("Table entity with partition key '%s' and row key '%s' was created.", "partitionKey",
+ * "rowKey"));
+ *
+ *
+ *
+ * Note: for a synchronous sample, refer to {@link TableClient the synchronous client}
+ *
+ *
+ *
+ * Retrieve a {@link TableEntity}
+ *
+ *
+ * tableAsyncClient.getEntity("partitionKey", "rowKey")
+ * .contextWrite(Context.of("key1", "value1", "key2", "value2"))
+ * .subscribe(tableEntity ->
+ * System.out.printf("Retrieved entity with partition key '%s' and row key '%s'.",
+ * tableEntity.getPartitionKey(), tableEntity.getRowKey()));
+ *
+ *
+ *
+ * Note: for a synchronous sample, refer to {@link TableClient the synchronous client}
+ *
+ *
+ *
+ * Update a {@link TableEntity}
+ *
+ *
+ * TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
+ * .addProperty("Property", "Value");
+ *
+ * tableAsyncClient.updateEntity(myTableEntity, TableEntityUpdateMode.REPLACE)
+ * .contextWrite(Context.of("key1", "value1", "key2", "value2"))
+ * .subscribe(unused ->
+ * System.out.printf("Table entity with partition key '%s' and row key '%s' was updated/created.",
+ * "partitionKey", "rowKey"));
+ *
+ *
+ *
+ * Note: for a synchronous sample, refer to {@link TableClient the synchronous client}
+ *
+ *
+ *
+ * Listing {@link TableEntity TableEntities}
+ *
+ *
+ * tableAsyncClient.listEntities()
+ * .subscribe(tableEntity ->
+ * System.out.printf("Retrieved entity with partition key '%s' and row key '%s'.%n",
+ * tableEntity.getPartitionKey(), tableEntity.getRowKey()));
+ *
+ *
+ *
+ * List {@link TableEntity TableEntities} with filtering and selecting
+ *
+ *
+ * List<String> propertiesToSelect = new ArrayList<>();
+ * propertiesToSelect.add("name");
+ * propertiesToSelect.add("lastname");
+ * propertiesToSelect.add("age");
+ *
+ * ListEntitiesOptions listEntitiesOptions = new ListEntitiesOptions()
+ * .setTop(15)
+ * .setFilter("PartitionKey eq 'MyPartitionKey' and RowKey eq 'MyRowKey'")
+ * .setSelect(propertiesToSelect);
+ *
+ * tableAsyncClient.listEntities(listEntitiesOptions)
+ * .subscribe(tableEntity -> {
+ * System.out.printf("Retrieved entity with partition key '%s', row key '%s' and properties:%n",
+ * tableEntity.getPartitionKey(), tableEntity.getRowKey());
+ *
+ * tableEntity.getProperties().forEach((key, value) ->
+ * System.out.printf("Name: '%s'. Value: '%s'.%n", key, value));
+ * });
+ *
+ *
+ *
+ * Note: for a synchronous sample, refer to {@link TableClient the synchronous client}
+ *
+ *
+ *
+ * Delete a {@link TableEntity}
+ *
+ *
+ * tableAsyncClient.deleteEntity("partitionKey", "rowKey")
+ * .contextWrite(Context.of("key1", "value1", "key2", "value2"))
+ * .subscribe(unused ->
+ * System.out.printf("Table entity with partition key '%s' and row key '%s' was deleted.", "partitionKey",
+ * "rowKey"));
+ *
+ *
+ *
+ * Note: for a synchronous sample, refer to {@link TableClient the synchronous client}
+ *
+ *
+ *
+ * Submit a transactional batch
+ *
+ *
+ * List<TableTransactionAction> transactionActions = new ArrayList<>();
+ *
+ * String partitionKey = "markers";
+ * String firstEntityRowKey = "m001";
+ * String secondEntityRowKey = "m002";
+ *
+ * TableEntity firstEntity = new TableEntity(partitionKey, firstEntityRowKey)
+ * .addProperty("Type", "Dry")
+ * .addProperty("Color", "Red");
+ *
+ * transactionActions.add(new TableTransactionAction(TableTransactionActionType.CREATE, firstEntity));
+ *
+ * System.out.printf("Added create action for entity with partition key '%s', and row key '%s'.%n", partitionKey,
+ * firstEntityRowKey);
+ *
+ * TableEntity secondEntity = new TableEntity(partitionKey, secondEntityRowKey)
+ * .addProperty("Type", "Wet")
+ * .addProperty("Color", "Blue");
+ *
+ * transactionActions.add(new TableTransactionAction(TableTransactionActionType.CREATE, secondEntity));
+ *
+ * System.out.printf("Added create action for entity with partition key '%s', and row key '%s'.%n", partitionKey,
+ * secondEntityRowKey);
+ *
+ * tableAsyncClient.submitTransaction(transactionActions)
+ * .contextWrite(Context.of("key1", "value1", "key2", "value2"))
+ * .subscribe(tableTransactionResult -> {
+ * System.out.print("Submitted transaction. The ordered response status codes for the actions are:");
+ *
+ * tableTransactionResult.getTransactionActionResponses().forEach(tableTransactionActionResponse ->
+ * System.out.printf("%n%d", tableTransactionActionResponse.getStatusCode()));
+ * });
+ *
+ *
+ *
+ * Note: for a synchronous sample, refer to {@link TableClient the synchronous client}
*
* @see TableClientBuilder
+ * @see TableEntity
+ * @see com.azure.data.tables
*/
@ServiceClient(builder = TableClientBuilder.class, isAsync = true)
public final class TableAsyncClient {
@@ -366,17 +555,14 @@ Mono
- * String partitionKey = "partitionKey";
- * String rowKey = "rowKey";
- *
- * TableEntity tableEntity = new TableEntity(partitionKey, rowKey)
+ * TableEntity tableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* tableAsyncClient.createEntity(tableEntity)
* .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(unused ->
- * System.out.printf("Table entity with partition key '%s' and row key '%s' was created.", partitionKey,
- * rowKey));
+ * System.out.printf("Table entity with partition key '%s' and row key '%s' was created.", "partitionKey",
+ * "rowKey"));
*
*
*
@@ -401,17 +587,14 @@ public Mono
- * String myPartitionKey = "partitionKey";
- * String myRowKey = "rowKey";
- *
- * TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ * TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* tableAsyncClient.createEntityWithResponse(myTableEntity)
* .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(response ->
* System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and"
- * + " row key '%s' was created.", response.getStatusCode(), myPartitionKey, myRowKey));
+ * + " row key '%s' was created.", response.getStatusCode(), "partitionKey", "rowKey"));
*
*
*
@@ -457,17 +640,14 @@ Mono
- * String partitionKey = "partitionKey";
- * String rowKey = "rowKey";
- *
- * TableEntity tableEntity = new TableEntity(partitionKey, rowKey)
+ * TableEntity tableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* tableAsyncClient.upsertEntity(tableEntity)
* .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(unused ->
* System.out.printf("Table entity with partition key '%s' and row key '%s' was updated/created.",
- * partitionKey, rowKey));
+ * "partitionKey", "rowKey"));
*
*
*
@@ -500,17 +680,14 @@ public Mono
- * String myPartitionKey = "partitionKey";
- * String myRowKey = "rowKey";
- *
- * TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ * TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* tableAsyncClient.upsertEntityWithResponse(myTableEntity, TableEntityUpdateMode.REPLACE)
* .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(response ->
* System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and"
- * + " row key '%s' was updated/created.", response.getStatusCode(), partitionKey, rowKey));
+ * + " row key '%s' was updated/created.", response.getStatusCode(), "partitionKey", "rowKey"));
*
*
*
@@ -572,17 +749,14 @@ Mono
- * String partitionKey = "partitionKey";
- * String rowKey = "rowKey";
- *
- * TableEntity tableEntity = new TableEntity(partitionKey, rowKey)
+ * TableEntity tableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* tableAsyncClient.updateEntity(tableEntity)
* .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(unused ->
* System.out.printf("Table entity with partition key '%s' and row key '%s' was updated/created.",
- * partitionKey, rowKey));
+ * "partitionKey", "rowKey"));
*
*
*
@@ -614,17 +788,14 @@ public Mono
- * String myPartitionKey = "partitionKey";
- * String myRowKey = "rowKey";
- *
- * TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ * TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* tableAsyncClient.updateEntity(myTableEntity, TableEntityUpdateMode.REPLACE)
* .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(unused ->
* System.out.printf("Table entity with partition key '%s' and row key '%s' was updated/created.",
- * partitionKey, rowKey));
+ * "partitionKey", "rowKey"));
*
*
*
@@ -661,17 +832,14 @@ public Mono
- * String somePartitionKey = "partitionKey";
- * String someRowKey = "rowKey";
- *
- * TableEntity someTableEntity = new TableEntity(somePartitionKey, someRowKey)
+ * TableEntity someTableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* tableAsyncClient.updateEntityWithResponse(someTableEntity, TableEntityUpdateMode.REPLACE, true)
* .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(response ->
* System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and"
- * + " row key '%s' was updated.", response.getStatusCode(), partitionKey, rowKey));
+ * + " row key '%s' was updated.", response.getStatusCode(), "partitionKey", "rowKey"));
*
*
*
@@ -739,14 +907,11 @@ Mono
- * String partitionKey = "partitionKey";
- * String rowKey = "rowKey";
- *
- * tableAsyncClient.deleteEntity(partitionKey, rowKey)
+ * tableAsyncClient.deleteEntity("partitionKey", "rowKey")
* .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(unused ->
- * System.out.printf("Table entity with partition key '%s' and row key '%s' was deleted.", partitionKey,
- * rowKey));
+ * System.out.printf("Table entity with partition key '%s' and row key '%s' was deleted.", "partitionKey",
+ * "rowKey"));
*
*
*
@@ -772,17 +937,14 @@ public Mono
- * String myPartitionKey = "partitionKey";
- * String myRowKey = "rowKey";
- *
- * TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ * TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* tableAsyncClient.deleteEntity(myTableEntity)
* .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(unused ->
- * System.out.printf("Table entity with partition key '%s' and row key '%s' was created.", partitionKey,
- * rowKey));
+ * System.out.printf("Table entity with partition key '%s' and row key '%s' was created.", "partitionKey",
+ * "rowKey"));
*
*
*
@@ -805,17 +967,14 @@ public Mono
- * String somePartitionKey = "partitionKey";
- * String someRowKey = "rowKey";
- *
- * TableEntity someTableEntity = new TableEntity(somePartitionKey, someRowKey)
+ * TableEntity someTableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* tableAsyncClient.deleteEntityWithResponse(someTableEntity, true)
* .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(response ->
* System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and"
- * + " row key '%s' was deleted.", response.getStatusCode(), somePartitionKey, someRowKey));
+ * + " row key '%s' was deleted.", response.getStatusCode(), "partitionKey", "rowKey"));
*
*
*
@@ -864,7 +1023,6 @@ Mono
* tableAsyncClient.listEntities()
- * .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(tableEntity ->
* System.out.printf("Retrieved entity with partition key '%s' and row key '%s'.%n",
* tableEntity.getPartitionKey(), tableEntity.getRowKey()));
@@ -904,7 +1062,6 @@ public PagedFlux listEntities() {
* .setSelect(propertiesToSelect);
*
* tableAsyncClient.listEntities(listEntitiesOptions)
- * .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(tableEntity -> {
* System.out.printf("Retrieved entity with partition key '%s', row key '%s' and properties:%n",
* tableEntity.getPartitionKey(), tableEntity.getRowKey());
@@ -1012,10 +1169,7 @@ private Mono> listEntities(String nextP
* {@link TableEntity entity}.
*
*
- * String partitionKey = "partitionKey";
- * String rowKey = "rowKey";
- *
- * tableAsyncClient.getEntity(partitionKey, rowKey)
+ * tableAsyncClient.getEntity("partitionKey", "rowKey")
* .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(tableEntity ->
* System.out.printf("Retrieved entity with partition key '%s' and row key '%s'.",
@@ -1046,15 +1200,12 @@ public Mono getEntity(String partitionKey, String rowKey) {
* retrieved {@link TableEntity entity}.
*
*
- * String myPartitionKey = "partitionKey";
- * String myRowKey = "rowKey";
- *
* List<String> propertiesToSelect = new ArrayList<>();
* propertiesToSelect.add("name");
* propertiesToSelect.add("lastname");
* propertiesToSelect.add("age");
*
- * tableAsyncClient.getEntityWithResponse(myPartitionKey, myRowKey, propertiesToSelect)
+ * tableAsyncClient.getEntityWithResponse("partitionKey", "rowKey", propertiesToSelect)
* .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(response -> {
* TableEntity tableEntity = response.getValue();
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClient.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClient.java
index a5d736f217c6..1543a8f94a21 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClient.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClient.java
@@ -80,26 +80,211 @@
/**
* Provides a synchronous service client for accessing a table in the Azure Tables service.
*
+ * Overview
+ *
* The client encapsulates the URL for the table within the Tables service endpoint, the name of the table, and the
- * credentials for accessing the storage or CosmosDB table API account. It provides methods to create and delete the
+ * credentials for accessing the storage or CosmosDB table API account. It provides synchronous methods to create and delete the
* table itself, as well as methods to create, upsert, update, delete, list, and get entities within the table. These
* methods invoke REST API operations to make the requests and obtain the results that are returned.
*
- * Instances of this client are obtained by calling the {@link TableClientBuilder#buildClient()} method on a
- * {@link TableClientBuilder} object.
+ * Getting Started
+ *
+ * Authenticating and building instances of this client are handled by {@link TableClientBuilder}.
+ * This sample shows how to authenticate and build a TableClient instance using the {@link TableClientBuilder} and
+ * a connection string.
*
- * Samples to construct a sync client
- *
+ *
*
* TableClient tableClient = new TableClientBuilder()
- * .endpoint("https://myaccount.core.windows.net/")
- * .credential(new AzureNamedKeyCredential("name", "key"))
+ * .connectionString("connectionstring")
* .tableName("myTable")
* .buildClient();
*
- *
+ *
+ *
+ * For more information on building and authenticating, see the {@link TableClientBuilder} documentation.
+ *
+ * The following code samples provide examples of common operations preformed with this client.
+ *
+ *
+ *
+ * Create a {@link TableEntity}
+ *
+ * The {@link #createEntity(TableEntity) createEntity} method can be used to create a table entity within a table in your Azure Storage or Azure Cosmos account.
+ *
+ * The sample below creates a {@link TableEntity} with a partition key of "partitionKey" and a row key of "rowKey".
+ *
+ *
+ *
+ * TableEntity tableEntity = new TableEntity("partitionKey", "rowKey")
+ * .addProperty("Property", "Value");
+ *
+ * tableClient.createEntity(tableEntity);
+ *
+ * System.out.printf("Table entity with partition key '%s' and row key: '%s' was created.", "partitionKey", "rowKey");
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link TableAsyncClient the asynchronous client}.
+ *
+ *
+ *
+ * Retrieve a {@link TableEntity}
+ *
+ * The {@link #getEntity(String, String) getEntity} method can be used to retrieve a table entity within a table in your Azure Storage or Azure Cosmos account.
+ *
+ * The sample below retrieves a {@link TableEntity} with a partition key of "partitionKey" and a row key of "rowKey".
+ *
+ *
+ *
+ * TableEntity tableEntity = tableClient.getEntity("partitionKey", "rowKey");
+ *
+ * System.out.printf("Retrieved entity with partition key '%s' and row key '%s'.", tableEntity.getPartitionKey(),
+ * tableEntity.getRowKey());
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link TableAsyncClient the asynchronous client}.
+ *
+ *
+ *
+ * Update a {@link TableEntity}
+ *
+ * The {@link #updateEntity(TableEntity) updateEntity} method can be used to update a table entity within a table in your Azure Storage or Azure Cosmos account.
+ *
+ * The sample below updates a {@link TableEntity} with a partition key of "partitionKey" and a row key of "rowKey", adding a new property with a key of "Property" and a value of "Value".
+ *
+ *
+ *
+ *
+ * TableEntity myTableEntity = new TableEntity("paritionKey", "rowKey")
+ * .addProperty("Property", "Value");
+ *
+ * tableClient.updateEntity(myTableEntity, TableEntityUpdateMode.REPLACE);
+ *
+ * System.out.printf("Table entity with partition key '%s' and row key: '%s' was updated/created.", "partitionKey",
+ * "rowKey");
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link TableAsyncClient the asynchronous client}.
+ *
+ *
+ *
+ * List {@link TableEntity TableEntities}
+ *
+ * The {@link #listEntities() listEntities} method can be used to list the entities within a table in your Azure Storage or Azure Cosmos account.
+ *
+ * The following sample lists all {@link TableEntity TableEntities} within the table without filtering out any entities.
+ *
+ *
+ *
+ * PagedIterable<TableEntity> tableEntities = tableClient.listEntities();
+ *
+ * tableEntities.forEach(tableEntity ->
+ * System.out.printf("Retrieved entity with partition key '%s' and row key '%s'.%n",
+ * tableEntity.getPartitionKey(), tableEntity.getRowKey()));
+ *
+ *
+ *
+ * List {@link TableEntity TableEntities} with filtering and selecting
+ *
+ * The following sample lists {@link TableEntity TableEntities} within the table, filtering out any entities that do not have a partition key of "partitionKey" and a row key of "rowKey"
+ * and only selects the "name", "lastname", and "age" properties.
+ *
+ *
+ *
+ * List<String> propertiesToSelect = new ArrayList<>();
+ * propertiesToSelect.add("name");
+ * propertiesToSelect.add("lastname");
+ * propertiesToSelect.add("age");
+ *
+ * ListEntitiesOptions listEntitiesOptions = new ListEntitiesOptions()
+ * .setTop(15)
+ * .setFilter("PartitionKey eq 'MyPartitionKey' and RowKey eq 'MyRowKey'")
+ * .setSelect(propertiesToSelect);
+ *
+ * PagedIterable<TableEntity> myTableEntities = tableClient.listEntities(listEntitiesOptions,
+ * Duration.ofSeconds(5), null);
+ *
+ * myTableEntities.forEach(tableEntity -> {
+ * System.out.printf("Retrieved entity with partition key '%s', row key '%s' and properties:%n",
+ * tableEntity.getPartitionKey(), tableEntity.getRowKey());
+ *
+ * tableEntity.getProperties().forEach((key, value) ->
+ * System.out.printf("Name: '%s'. Value: '%s'.%n", key, value));
+ * });
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link TableAsyncClient the asynchronous client}.
+ *
+ *
+ *
+ * Delete a {@link TableEntity}
+ *
+ * The {@link #deleteEntity(String, String) deleteEntity} method can be used to delete a table entity within a table in your Azure Storage or Azure Cosmos account.
+ *
+ * The sample below deletes a {@link TableEntity} with a partition key of "partitionKey" and a row key of "rowKey".
+ *
+ *
+ *
+ * tableClient.deleteEntity("partitionKey", "rowKey");
+ *
+ * System.out.printf("Table entity with partition key '%s' and row key: '%s' was deleted.", "partitionKey", "rowKey");
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link TableAsyncClient the asynchronous client}.
+ *
+ *
+ *
+ * Submit a transactional batch
+ *
+ * The {@link #submitTransaction(List) submitTransaction} method can be used to submit a transactional batch of actions to perform on the table in your Azure Storage or Azure Cosmos account.
+ *
+ * The following sample shows how to prepare and submit a transactional batch with multiple actions.
+ *
+ *
+ *
+ * List<TableTransactionAction> transactionActions = new ArrayList<>();
+ *
+ * String partitionKey = "markers";
+ * String firstEntityRowKey = "m001";
+ * String secondEntityRowKey = "m002";
+ *
+ * TableEntity firstEntity = new TableEntity(partitionKey, firstEntityRowKey)
+ * .addProperty("Type", "Dry")
+ * .addProperty("Color", "Red");
+ *
+ * transactionActions.add(new TableTransactionAction(TableTransactionActionType.CREATE, firstEntity));
+ *
+ * System.out.printf("Added create action for entity with partition key '%s', and row key '%s'.%n", partitionKey,
+ * firstEntityRowKey);
+ *
+ * TableEntity secondEntity = new TableEntity(partitionKey, secondEntityRowKey)
+ * .addProperty("Type", "Wet")
+ * .addProperty("Color", "Blue");
+ *
+ * transactionActions.add(new TableTransactionAction(TableTransactionActionType.CREATE, secondEntity));
+ *
+ * System.out.printf("Added create action for entity with partition key '%s', and row key '%s'.%n", partitionKey,
+ * secondEntityRowKey);
+ *
+ * TableTransactionResult tableTransactionResult = tableClient.submitTransaction(transactionActions);
+ *
+ * System.out.print("Submitted transaction. The ordered response status codes for the actions are:");
+ *
+ * tableTransactionResult.getTransactionActionResponses().forEach(tableTransactionActionResponse ->
+ * System.out.printf("%n%d", tableTransactionActionResponse.getStatusCode()));
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link TableAsyncClient the asynchronous client}.
*
* @see TableClientBuilder
+ * @see TableEntity
+ * @see com.azure.data.tables
*/
@ServiceClient(builder = TableClientBuilder.class)
public final class TableClient {
@@ -372,15 +557,12 @@ private Response swallow404Exception(Throwable ex) {
* {@link TableEntity entity}.
*
*
- * String partitionKey = "partitionKey";
- * String rowKey = "rowKey";
- *
- * TableEntity tableEntity = new TableEntity(partitionKey, rowKey)
+ * TableEntity tableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* tableClient.createEntity(tableEntity);
*
- * System.out.printf("Table entity with partition key '%s' and row key: '%s' was created.", partitionKey, rowKey);
+ * System.out.printf("Table entity with partition key '%s' and row key: '%s' was created.", "partitionKey", "rowKey");
*
*
*
@@ -403,17 +585,15 @@ public void createEntity(TableEntity entity) {
* {@link Response HTTP response} and the created {@link TableEntity entity}.
*
*
- * String myPartitionKey = "partitionKey";
- * String myRowKey = "rowKey";
*
- * TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ * TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* Response<Void> response = tableClient.createEntityWithResponse(myTableEntity, Duration.ofSeconds(5),
* new Context("key1", "value1"));
*
* System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and row key"
- * + " '%s' was created.", response.getStatusCode(), myPartitionKey, myRowKey);
+ * + " '%s' was created.", response.getStatusCode(), "partitionKey", "rowKey");
*
*
*
@@ -456,16 +636,13 @@ public Response createEntityWithResponse(TableEntity entity, Duration time
* {@link TableEntity entity}.
*
*
- * String partitionKey = "partitionKey";
- * String rowKey = "rowKey";
- *
- * TableEntity tableEntity = new TableEntity(partitionKey, rowKey)
+ * TableEntity tableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* tableClient.upsertEntity(tableEntity);
*
- * System.out.printf("Table entity with partition key '%s' and row key: '%s' was updated/created.", partitionKey,
- * rowKey);
+ * System.out.printf("Table entity with partition key '%s' and row key: '%s' was updated/created.", "partitionKey",
+ * "rowKey");
*
*
*
@@ -496,17 +673,14 @@ public void upsertEntity(TableEntity entity) {
* details of the {@link Response HTTP response} and the upserted {@link TableEntity entity}.
*
*
- * String myPartitionKey = "partitionKey";
- * String myRowKey = "rowKey";
- *
- * TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ * TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* Response<Void> response = tableClient.upsertEntityWithResponse(myTableEntity, TableEntityUpdateMode.REPLACE,
* Duration.ofSeconds(5), new Context("key1", "value1"));
*
* System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and row key"
- * + " '%s' was updated/created.", response.getStatusCode(), partitionKey, rowKey);
+ * + " '%s' was updated/created.", response.getStatusCode(), "partitionKey", "rowKey");
*
*
*
@@ -559,16 +733,13 @@ public Response upsertEntityWithResponse(TableEntity entity, TableEntityUp
* {@link TableEntity entity}.
*
*
- * String partitionKey = "partitionKey";
- * String rowKey = "rowKey";
- *
- * TableEntity tableEntity = new TableEntity(partitionKey, rowKey)
+ * TableEntity tableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* tableClient.updateEntity(tableEntity);
*
- * System.out.printf("Table entity with partition key '%s' and row key: '%s' was updated/created.", partitionKey,
- * rowKey);
+ * System.out.printf("Table entity with partition key '%s' and row key: '%s' was updated/created.", "partitionKey",
+ * "rowKey");
*
*
*
@@ -598,16 +769,14 @@ public void updateEntity(TableEntity entity) {
* {@link TableEntityUpdateMode update mode}. Prints out the details of the updated {@link TableEntity entity}.
*
*
- * String myPartitionKey = "partitionKey";
- * String myRowKey = "rowKey";
*
- * TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ * TableEntity myTableEntity = new TableEntity("paritionKey", "rowKey")
* .addProperty("Property", "Value");
*
* tableClient.updateEntity(myTableEntity, TableEntityUpdateMode.REPLACE);
*
- * System.out.printf("Table entity with partition key '%s' and row key: '%s' was updated/created.", partitionKey,
- * rowKey);
+ * System.out.printf("Table entity with partition key '%s' and row key: '%s' was updated/created.", "partitionKey",
+ * "rowKey");
*
*
*
@@ -640,17 +809,14 @@ public void updateEntity(TableEntity entity, TableEntityUpdateMode updateMode) {
* {@link Response HTTP response} updated {@link TableEntity entity}.
*
*
- * String somePartitionKey = "partitionKey";
- * String someRowKey = "rowKey";
- *
- * TableEntity someTableEntity = new TableEntity(somePartitionKey, someRowKey)
+ * TableEntity someTableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* Response<Void> response = tableClient.updateEntityWithResponse(someTableEntity, TableEntityUpdateMode.REPLACE,
* true, Duration.ofSeconds(5), new Context("key1", "value1"));
*
* System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and row key"
- * + " '%s' was updated.", response.getStatusCode(), partitionKey, rowKey);
+ * + " '%s' was updated.", response.getStatusCode(), "partitionKey", "rowKey");
*
*
*
@@ -708,12 +874,9 @@ public Response updateEntityWithResponse(TableEntity entity, TableEntityUp
* {@code rowKey}.
*
*
- * String partitionKey = "partitionKey";
- * String rowKey = "rowKey";
- *
- * tableClient.deleteEntity(partitionKey, rowKey);
+ * tableClient.deleteEntity("partitionKey", "rowKey");
*
- * System.out.printf("Table entity with partition key '%s' and row key: '%s' was deleted.", partitionKey, rowKey);
+ * System.out.printf("Table entity with partition key '%s' and row key: '%s' was deleted.", "partitionKey", "rowKey");
*
*
*
@@ -738,15 +901,12 @@ public void deleteEntity(String partitionKey, String rowKey) {
* {@link TableEntity entity}.
*
*
- * String myPartitionKey = "partitionKey";
- * String myRowKey = "rowKey";
- *
- * TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ * TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* tableClient.deleteEntity(myTableEntity);
*
- * System.out.printf("Table entity with partition key '%s' and row key: '%s' was created.", partitionKey, rowKey);
+ * System.out.printf("Table entity with partition key '%s' and row key: '%s' was created.", "partitionKey", "rowKey");
*
*
*
@@ -767,17 +927,14 @@ public void deleteEntity(TableEntity entity) {
* {@link Response HTTP response} and the deleted {@link TableEntity entity}.
*
*
- * String somePartitionKey = "partitionKey";
- * String someRowKey = "rowKey";
- *
- * TableEntity someTableEntity = new TableEntity(somePartitionKey, someRowKey)
+ * TableEntity someTableEntity = new TableEntity("partitionKey", "rowKey")
* .addProperty("Property", "Value");
*
* Response<Void> response = tableClient.deleteEntityWithResponse(someTableEntity, true, Duration.ofSeconds(5),
* new Context("key1", "value1"));
*
* System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and row key"
- * + " '%s' was deleted.", response.getStatusCode(), somePartitionKey, someRowKey);
+ * + " '%s' was deleted.", response.getStatusCode(), "partitionKey", "rowKey");
*
*
*
@@ -874,7 +1031,7 @@ public PagedIterable listEntities() {
* .setSelect(propertiesToSelect);
*
* PagedIterable<TableEntity> myTableEntities = tableClient.listEntities(listEntitiesOptions,
- * Duration.ofSeconds(5), new Context("key1", "value1"));
+ * Duration.ofSeconds(5), null);
*
* myTableEntities.forEach(tableEntity -> {
* System.out.printf("Retrieved entity with partition key '%s', row key '%s' and properties:%n",
@@ -978,10 +1135,7 @@ private PagedResponse listEntities(String nextPartiti
* {@link TableEntity entity}.
*
*
- * String partitionKey = "partitionKey";
- * String rowKey = "rowKey";
- *
- * TableEntity tableEntity = tableClient.getEntity(partitionKey, rowKey);
+ * TableEntity tableEntity = tableClient.getEntity("partitionKey", "rowKey");
*
* System.out.printf("Retrieved entity with partition key '%s' and row key '%s'.", tableEntity.getPartitionKey(),
* tableEntity.getRowKey());
@@ -1011,15 +1165,12 @@ public TableEntity getEntity(String partitionKey, String rowKey) {
* retrieved {@link TableEntity entity}.
*
*
- * String myPartitionKey = "partitionKey";
- * String myRowKey = "rowKey";
- *
* List<String> propertiesToSelect = new ArrayList<>();
* propertiesToSelect.add("name");
* propertiesToSelect.add("lastname");
* propertiesToSelect.add("age");
*
- * Response<TableEntity> response = tableClient.getEntityWithResponse(myPartitionKey, myRowKey, propertiesToSelect,
+ * Response<TableEntity> response = tableClient.getEntityWithResponse("partitionKey", "rowKey", propertiesToSelect,
* Duration.ofSeconds(5), new Context("key1", "value1"));
*
* TableEntity myTableEntity = response.getValue();
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClientBuilder.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClientBuilder.java
index ac6b7744df92..c3d0a3bedd46 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClientBuilder.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClientBuilder.java
@@ -40,39 +40,132 @@
import static com.azure.data.tables.BuilderHelper.validateCredentials;
/**
- * This class provides a fluent builder API to help aid the configuration and instantiation of {@link TableClient} and
- * {@link TableAsyncClient} objects. Call {@link #buildClient()} or {@link #buildAsyncClient()}, respectively, to
- * construct an instance of the desired client.
+ * Provides a fluent builder API to help aid the configuration and instantiation of a {@link TableClient} and {@link TableAsyncClient}.
+ *
+ * Overview
+ *
+ * This class provides a fluent builder API to help aid the configuration and instantiation of {@link TableClient} and
+ * {@link TableAsyncClient} objects. After properly authenticating the client, call {@link #buildClient()} or {@link #buildAsyncClient()}, respectively, to
+ * construct an instance of the desired client.
+ *
+ * Getting Started
*
* The minimal configuration options required by {@link TableClientBuilder} to build a {@link TableClient} or
* {@link TableAsyncClient} are a {@link String tableName} and {@link String endpoint} and a form of authentication,
* which can be set via: {@link TableClientBuilder#connectionString(String)},
- * {@link TableClientBuilder#credential(AzureSasCredential)},
- * {@link TableClientBuilder#credential(AzureNamedKeyCredential)} or {@link TableClientBuilder#sasToken(String)}
+ * {@link TableClientBuilder#credential(AzureNamedKeyCredential)}, {@link TableClientBuilder#credential(TokenCredential)}, {@link TableClientBuilder#credential(AzureSasCredential)},
+ * or {@link TableClientBuilder#sasToken(String)}
+ *
+ * To build an instance of {@link TableClient} or {@link TableAsyncClient} call {@link TableClientBuilder#buildClient()} or {@link TableClientBuilder#buildAsyncClient()}, respectively.
*
- * Samples to construct a sync client
- *
+ * The following example shows how to build a {@link TableClient} instance.
+ *
+ *
*
* TableClient tableClient = new TableClientBuilder()
- * .endpoint("https://myaccount.core.windows.net/")
- * .credential(new AzureNamedKeyCredential("name", "key"))
- * .tableName("myTable")
+ * .connectionString("connectionString")
+ * .tableName("tableName")
* .buildClient();
*
- *
- * Samples to construct an async client
- *
+ *
+ *
+ * The following example shows how to build a {@link TableAsyncClient} instance.
+ *
+ *
*
- * TableAsyncClient tableAsyncClient = new TableClientBuilder()
- * .endpoint("https://myaccount.core.windows.net/")
- * .credential(new AzureNamedKeyCredential("name", "key"))
- * .tableName("myTable")
+ * TableAsyncClient tableClient = new TableClientBuilder()
+ * .connectionString("connectionString")
+ * .tableName("tableName")
* .buildAsyncClient();
*
- *
+ *
+ *
+ *
+ *
+ * Authenticating via Connection String
+ *
+ * To use a connection string to authorize the client, call the builder's {@link TableClientBuilder#connectionString(String)} method with your connection string. When authenticating via a
+ * connection string, providing an endpoint is not required.
+ *
+ *
+ *
+ * TableClient tableClient = new TableClientBuilder()
+ * .connectionString("connectionString")
+ * .tableName("tableName")
+ * .buildClient();
+ *
+ *
+ *
+ *
+ *
+ * Authentication via Shared Key
+ *
+ * To use shared key authentication, create an instance of AzureNamedKeyCredential and pass it to the builder's
+ * {@link TableClientBuilder#credential(AzureNamedKeyCredential)} method. Pass the account URL to the builder's {@link TableClientBuilder#endpoint(String)} method.
+ *
+ *
+ *
+ * TableClient tableClient = new TableClientBuilder()
+ * .credential(new AzureNamedKeyCredential("name", "key"))
+ * .tableName("tableName")
+ * .endpoint("endpoint")
+ * .buildClient();
+ *
+ *
+ *
+ *
+ *
+ * Authentication via Shared Access Signature (SAS)
+ *
+ * when authorizing a client utilizing a Shared Access Signature (SAS), you have the option of using AzureSasCredential or
+ * the SAS token directly. To use an AzureSasCredential, pass it to the builder's {@link TableClientBuilder#credential(AzureSasCredential)} method. When authenticating with a SAS token, pass it to the
+ * builder's {@link TableClientBuilder#sasToken(String)} method. Pass the account URL to the builder's {@link TableClientBuilder#endpoint(String)} method.
+ *
+ * Using AzureSasCredential:
+ *
+ *
+ *
+ * TableClient tableClient = new TableClientBuilder()
+ * .credential(new AzureSasCredential("sasToken"))
+ * .endpoint("endpoint")
+ * .tableName("tableName")
+ * .buildClient();
+ *
+ *
+ *
+ * Using SAS token:
+ *
+ *
+ *
+ * TableClient tableClient = new TableClientBuilder()
+ * .sasToken("sasToken")
+ * .endpoint("endpoint")
+ * .tableName("tableName")
+ * .buildClient();
+ *
+ *
+ *
+ *
+ *
+ * Authentication via Token Credential
+ *
+ * To use token credential authentication, create an instance of a credential class that implements {@link com.azure.core.credential.TokenCredential TokenCredential} and pass it to the
+ * builder's {@link TableClientBuilder#credential(TokenCredential)} method. Pass the account URL to the builder's {@link TableClientBuilder#endpoint(String)} method.
+ *
+ *
+ *
+ * TableClient tableClient = new TableClientBuilder()
+ * .endpoint("endpoint")
+ * .credential(new DefaultAzureCredentialBuilder().build())
+ * .tableName("tableName")
+ * .buildClient();
+ *
+ *
+ *
*
* @see TableAsyncClient
* @see TableClient
+ * @see com.azure.data.tables
*/
@ServiceClientBuilder(serviceClients = {TableClient.class, TableAsyncClient.class})
public final class TableClientBuilder implements
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableScrubEtagPolicy.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableScrubEtagPolicy.java
index f0721077df2d..b3a8372b03dc 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableScrubEtagPolicy.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableScrubEtagPolicy.java
@@ -23,6 +23,14 @@
public final class TableScrubEtagPolicy implements HttpPipelinePolicy {
private static final String ETAG = "eTag";
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Creates a {@link TableScrubEtagPolicy}.
+ */
+ public TableScrubEtagPolicy() {
+
+ }
+
/**
* Wraps any potential error responses from the service and applies post processing of the response's eTag header to
* standardize the value.
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceAsyncClient.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceAsyncClient.java
index 80c4ec135ea3..e47fade2b6cf 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceAsyncClient.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceAsyncClient.java
@@ -48,26 +48,187 @@
import static com.azure.data.tables.implementation.TableUtils.swallowExceptionForStatusCode;
/**
+ *
* Provides an asynchronous service client for accessing the Azure Tables service.
*
+ * Overview
+ *
* The client encapsulates the URL for the Tables service endpoint and the credentials for accessing the storage or
* CosmosDB table API account. It provides methods to create, delete, and list tables within the account. These methods
* invoke REST API operations to make the requests and obtain the results that are returned.
*
- * Instances of this client are obtained by calling the {@link TableServiceClientBuilder#buildAsyncClient()} method
- * on a {@link TableServiceClientBuilder} object.
+ * Getting Started
+ *
+ * The building and authenticating of instances of this client are handled by {@link TableServiceClientBuilder} instances. The sample below
+ * shows how to authenticate and build a TableServiceAsyncClient using a connection string.
*
- * Samples to construct an async client
- *
+ *
*
* TableServiceAsyncClient tableServiceAsyncClient = new TableServiceClientBuilder()
- * .endpoint("https://myvault.azure.net/")
- * .credential(new AzureNamedKeyCredential("name", "key"))
+ * .connectionString("connectionstring")
* .buildAsyncClient();
*
*
*
+ * See {@link TableServiceClientBuilder} documentation for more information on constructing and authenticating a client.
+ *
+ * The following code samples show the various ways you can interact with the tables service using this client.
+ *
+ *
+ *
+ * Create a Table
+ *
+ * The {@link #createTable(String) createTable} method can be used to create a new table within an Azure Storage or Azure Cosmos account.
+ * It returns a TableClient for the newly created table.
+ *
+ * The following sample creates a table with the name "myTable".
+ *
+ *
+ *
+ * tableServiceAsyncClient.createTable("myTable")
+ * .contextWrite(Context.of("key1", "value1", "key2", "value2"))
+ * .subscribe(tableAsyncClient ->
+ * System.out.printf("Table with name '%s' was created.", tableAsyncClient.getTableName()));
+ *
+ *
+ *
+ * Note: for synchronous sample, refer to {@link TableServiceClient synchronous client}.
+ *
+ *
+ *
+ * Delete a Table
+ *
+ * The {@link #deleteTable(String) deleteTable} method can be used to delete a table within an Azure Storage or Azure Cosmos account.
+ *
+ * The following sample deletes the table with the name "myTable".
+ *
+ *
+ *
+ * tableServiceAsyncClient.deleteTable("myTable")
+ * .contextWrite(Context.of("key1", "value1", "key2", "value2"))
+ * .subscribe(unused ->
+ * System.out.printf("Table with name '%s' was deleted.", "myTable"));
+ *
+ *
+ *
+ * Note: for synchronous sample, refer to {@link TableServiceClient synchronous client}
+ *
+ *
+ *
+ * Get a {@link TableServiceAsyncClient}
+ *
+ * The {@link #getTableClient(String) getTableClient} method can be used to retrieve a {@link TableAsyncClient} for a table within an Azure Storage or Azure Cosmos account.
+ *
+ * The following sample gets a {@link TableServiceAsyncClient} using the table name "myTable".
+ *
+ *
+ *
+ * TableAsyncClient tableAsyncClient = tableServiceAsyncClient.getTableClient("myTable");
+ *
+ * System.out.printf("Table with name '%s' was retrieved.", tableAsyncClient.getTableName());
+ *
+ *
+ *
+ * Note: for synchronous sample, refer to {@link TableServiceClient synchronous client}
+ *
+ *
+ *
+ * List Tables
+ *
+ * The {@link #listTables() listTables} method can be used to list all the tables in an Azure Storage or Azure Cosmos account.
+ *
+ * The following samples list the tables in the Table service account.
+ *
+ * Without filtering, returning all tables:
+ *
+ *
+ *
+ * tableServiceAsyncClient.listTables().subscribe(tableItem ->
+ * System.out.printf("Retrieved table with name '%s'.%n", tableItem.getName()));
+ *
+ *
+ *
+ * With filtering:
+ *
+ *
+ *
+ * tableServiceAsyncClient.listTables(new ListTablesOptions().setFilter("TableName eq 'myTable'")).
+ * subscribe(tableItem -> System.out.printf("Retrieved table with name '%s'.%n", tableItem.getName()));
+ *
+ *
+ *
+ * Note: for synchronous sample, refer to {@link TableServiceClient synchronous client}
+ *
+ *
+ *
+ * Get Table Properties
+ *
+ * The {@link #getProperties() getProperties} method can be used to get the properties of the account's Table service, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules.
+ * This operation is only supported on Azure Storage endpoints.
+ *
+ * The following sample gets the properties of the Table service account.
+ *
+ *
+ *
+ * tableServiceAsyncClient.getProperties()
+ * .contextWrite(Context.of("key1", "value1", "key2", "value2"))
+ * .subscribe(properties -> System.out.print("Retrieved service properties successfully."));
+ *
+ *
+ *
+ * Note: for synchronous sample, refer to {@link TableServiceClient synchronous client}
+ *
+ *
+ *
+ * Set Table Properties
+ *
+ * The {@link #setProperties(TableServiceProperties) setProperties} method can be used to set the properties of the account's Table service, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules.
+ * This operation is only supported on Azure Storage endpoints.
+ *
+ * The following sample sets the properties of the Table service account.
+ *
+ *
+ *
+ * TableServiceProperties properties = new TableServiceProperties()
+ * .setHourMetrics(new TableServiceMetrics()
+ * .setVersion("1.0")
+ * .setEnabled(true))
+ * .setLogging(new TableServiceLogging()
+ * .setAnalyticsVersion("1.0")
+ * .setReadLogged(true)
+ * .setRetentionPolicy(new TableServiceRetentionPolicy()
+ * .setEnabled(true)
+ * .setDaysToRetain(5)));
+ *
+ * tableServiceAsyncClient.setProperties(properties)
+ * .contextWrite(Context.of("key1", "value1", "key2", "value2"))
+ * .subscribe(unused -> System.out.print("Set service properties successfully."));
+ *
+ *
+ *
+ * Note: for synchronous sample, refer to {@link TableServiceClient synchronous client}
+ *
+ *
+ *
+ * Get Table Statistics
+ *
+ * The {@link #getStatistics() getStatistics} method can be used to retrieve statistics related to replication for the account's Table service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the account.
+ * This operation is only supported on Azure Storage endpoints.
+ *
+ * The following sample gets the statistics of the Table service account.
+ *
+ *
+ *
+ * tableServiceAsyncClient.getStatistics()
+ * .contextWrite(Context.of("key1", "value1", "key2", "value2"))
+ * .subscribe(statistics -> System.out.print("Retrieved service statistics successfully."));
+ *
+ *
+ *
+ * Note: for synchronous sample, refer to {@link TableServiceClient synchronous client}
+ *
* @see TableServiceClientBuilder
+ * @see com.azure.data.tables
*/
@ServiceClient(builder = TableServiceClientBuilder.class, isAsync = true)
public final class TableServiceAsyncClient {
@@ -334,12 +495,10 @@ Mono> createTableIfNotExistsWithResponse(String table
* Deletes a table.
*
*
- * String tableName = "myTable";
- *
- * tableServiceAsyncClient.deleteTable(tableName)
+ * tableServiceAsyncClient.deleteTable("myTable")
* .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(unused ->
- * System.out.printf("Table with name '%s' was deleted.", tableName));
+ * System.out.printf("Table with name '%s' was deleted.", "myTable"));
*
*
*
@@ -362,13 +521,11 @@ public Mono deleteTable(String tableName) {
* Deletes a table.
*
*
- * String myTableName = "myTable";
- *
- * tableServiceAsyncClient.deleteTableWithResponse(myTableName)
+ * tableServiceAsyncClient.deleteTableWithResponse("myTable")
* .contextWrite(Context.of("key1", "value1", "key2", "value2"))
* .subscribe(response ->
* System.out.printf("Response successful with status code: %d. Table with name '%s' was deleted.",
- * response.getStatusCode(), myTableName));
+ * response.getStatusCode(), "myTable"));
*
*
*
@@ -428,10 +585,8 @@ public PagedFlux listTables() {
* Lists all tables that match the filter. Prints out the details of the retrieved tables.
*
*
- * ListTablesOptions options = new ListTablesOptions().setFilter("TableName eq 'myTable'");
- *
- * tableServiceAsyncClient.listTables(options).subscribe(tableItem ->
- * System.out.printf("Retrieved table with name '%s'.%n", tableItem.getName()));
+ * tableServiceAsyncClient.listTables(new ListTablesOptions().setFilter("TableName eq 'myTable'")).
+ * subscribe(tableItem -> System.out.printf("Retrieved table with name '%s'.%n", tableItem.getName()));
*
*
*
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java
index 8cd141e6bdb4..88260720b8d3 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java
@@ -52,26 +52,198 @@
import static com.azure.data.tables.implementation.TableUtils.hasTimeout;
/**
+ *
* Provides a synchronous service client for accessing the Azure Tables service.
*
+ * Overview
+ *
* The client encapsulates the URL for the Tables service endpoint and the credentials for accessing the storage or
* CosmosDB table API account. It provides methods to create, delete, and list tables within the account. These methods
* invoke REST API operations to make the requests and obtain the results that are returned.
*
- * Instances of this client are obtained by calling the {@link TableServiceClientBuilder#buildClient()} method on a
- * {@link TableServiceClientBuilder} object.
+ * Getting Started
+ *
+ * The building and authenticating of instances of this client are handled by {@link TableServiceClientBuilder} instances. The following
+ * sample shows how to authenticate and build a TableServiceClient using a connection string.
*
- * Samples to construct a sync client
- *
+ *
*
* TableServiceClient tableServiceClient = new TableServiceClientBuilder()
- * .endpoint("https://myvault.azure.net/")
- * .credential(new AzureNamedKeyCredential("name", "key"))
+ * .connectionString("connectionstring")
* .buildClient();
*
- *
+ *
+ *
+ * See {@link TableServiceClientBuilder} documentation for more information on constructing and authenticating a client.
+ *
+ * The following samples show the various ways you can interact with the tables service using this client.
+ *
+ *
+ *
+ *
+ *
+ * Create a Table
+ *
+ * The {@link #createTable(String) createTable} method can be used to create a new table within an Azure Storage or Azure Cosmos account.
+ * It returns a TableClient for the newly created table.
+ *
+ * The following sample creates a table with the name "myTable".
+ *
+ *
+ *
+ * TableClient tableClient = tableServiceClient.createTable("myTable");
+ *
+ * System.out.printf("Table with name '%s' was created.", tableClient.getTableName());
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link TableServiceAsyncClient asynchronous client}.
+ *
+ *
+ *
+ * Delete a Table
+ *
+ * The {@link #deleteTable(String) deleteTable} method can be used to delete a table within an Azure Storage or Azure Cosmos account.
+ *
+ * The following sample deletes the table with the name "myTable".
+ *
+ *
+ *
+ * tableServiceClient.deleteTable("myTable");
+ *
+ * System.out.printf("Table with name '%s' was deleted.", "myTable");
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link TableServiceAsyncClient asynchronous client}.
+ *
+ *
+ *
+ * Get a {@link TableClient}
+ *
+ * The {@link #getTableClient(String) getTableClient} method can be used to retrieve a {@link TableClient} for a table within an Azure Storage or Azure Cosmos account.
+ *
+ * The following sample gets a {@link TableClient} for the table with the name "myTable".
+ *
+ *
+ *
+ * TableClient tableClient = tableServiceClient.getTableClient("myTable");
+ *
+ * System.out.printf("Table with name '%s' was retrieved.", tableClient.getTableName());
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link TableServiceAsyncClient asynchronous client}.
+ *
+ *
+ *
+ * List Tables
+ *
+ * The {@link #listTables() listTables} method can be used to list all the tables in an Azure Storage or Azure Cosmos account.
+ *
+ * The following samples lists the tables in the Tables service account.
+ *
+ * Without filtering, returning all tables:
+ *
+ *
+ *
+ * PagedIterable<TableItem> tableItems = tableServiceClient.listTables();
+ *
+ * tableItems.forEach(tableItem ->
+ * System.out.printf("Retrieved table with name '%s'.%n", tableItem.getName()));
+ *
+ *
+ *
+ * With filtering:
+ *
+ *
+ *
+ * ListTablesOptions options = new ListTablesOptions().setFilter("TableName eq 'myTable'");
+ *
+ * PagedIterable<TableItem> retrievedTableItems = tableServiceClient.listTables(options, Duration.ofSeconds(5),
+ * new Context("key1", "value1"));
+ *
+ * retrievedTableItems.forEach(tableItem ->
+ * System.out.printf("Retrieved table with name '%s'.%n", tableItem.getName()));
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link TableServiceAsyncClient asynchronous client}.
+ *
+ *
+ *
+ * Get Table Properties
+ *
+ * The {@link #getProperties() getProperties} method can be used to get the properties of the account's Table service, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules.
+ * This operation is only supported on Azure Storage endpoints.
+ *
+ * The following sample gets the properties of the Tables service account.
+ *
+ *
+ *
+ * TableServiceProperties properties = tableServiceClient.getProperties();
+ *
+ * System.out.print("Retrieved service properties successfully.");
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link TableServiceAsyncClient asynchronous client}.
+ *
+ *
+ *
+ * Set Table Properties
+ *
+ * The {@link #setProperties(TableServiceProperties) setProperties} method can be used to set the properties of the account's Table service, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules.
+ * This operation is only supported on Azure Storage endpoints.
+ *
+ * The following sample sets the properties of the Tables service account.
+ *
+ *
+ *
+ * TableServiceProperties properties = new TableServiceProperties()
+ * .setHourMetrics(new TableServiceMetrics()
+ * .setVersion("1.0")
+ * .setEnabled(true)
+ * .setIncludeApis(true)
+ * .setRetentionPolicy(new TableServiceRetentionPolicy()
+ * .setEnabled(true)
+ * .setDaysToRetain(5)))
+ * .setLogging(new TableServiceLogging()
+ * .setAnalyticsVersion("1.0")
+ * .setReadLogged(true)
+ * .setRetentionPolicy(new TableServiceRetentionPolicy()
+ * .setEnabled(true)
+ * .setDaysToRetain(5)));
+ *
+ * tableServiceClient.setProperties(properties);
+ *
+ * System.out.printf("Set service properties successfully.");
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link TableServiceAsyncClient asynchronous client}.
+ *
+ *
+ *
+ * Get Table Statistics
+ *
+ * The {@link #getStatistics() getStatistics} method can be used to retrieve statistics related to replication for the account's Table service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the account.
+ * This operation is only supported on Azure Storage endpoints.
+ *
+ * The following sample gets the statistics of the Tables service account.
+ *
+ *
+ *
+ * TableServiceStatistics statistics = tableServiceClient.getStatistics();
+ *
+ * System.out.print("Retrieved service statistics successfully.");
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link TableServiceAsyncClient asynchronous client}.
*
* @see TableServiceClientBuilder
+ * @see com.azure.data.tables
*/
@ServiceClient(builder = TableServiceClientBuilder.class)
public final class TableServiceClient {
@@ -330,11 +502,9 @@ Response createTableIfNotExistsWithResponse(String tableName, Conte
* Deletes a table.
*
*
- * String tableName = "myTable";
+ * tableServiceClient.deleteTable("myTable");
*
- * tableServiceClient.deleteTable(tableName);
- *
- * System.out.printf("Table with name '%s' was deleted.", tableName);
+ * System.out.printf("Table with name '%s' was deleted.", "myTable");
*
*
*
@@ -355,13 +525,11 @@ public void deleteTable(String tableName) {
* Deletes a table. Prints out the details of the {@link Response HTTP response}.
*
*
- * String myTableName = "myTable";
- *
- * Response<Void> response = tableServiceClient.deleteTableWithResponse(myTableName, Duration.ofSeconds(5),
+ * Response<Void> response = tableServiceClient.deleteTableWithResponse("myTable", Duration.ofSeconds(5),
* new Context("key1", "value1"));
*
* System.out.printf("Response successful with status code: %d. Table with name '%s' was deleted.",
- * response.getStatusCode(), myTableName);
+ * response.getStatusCode(), "myTable");
*
*
*
@@ -594,7 +762,7 @@ Response getPropertiesWithResponse(Context context) {
*
* tableServiceClient.setProperties(properties);
*
- * System.out.print("Set service properties successfully.");
+ * System.out.printf("Set service properties successfully.");
*
*
*
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClientBuilder.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClientBuilder.java
index f5afa64e2364..9f8c5a785016 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClientBuilder.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClientBuilder.java
@@ -39,38 +39,126 @@
import static com.azure.data.tables.BuilderHelper.validateCredentials;
/**
- * This class provides a fluent builder API to help aid the configuration and instantiation of
+ * Provides a fluent builder API to help aid the configuration and instantiation of {@link TableServiceClient} and {@link TableServiceAsyncClient}.
+ *
+ * Overview
+ *
+ * This class provides a fluent builder API to help aid the configuration and instantiation of
* {@link TableServiceClient} and {@link TableServiceAsyncClient} objects. Call {@link #buildClient()} or
- * {@link #buildAsyncClient()}, respectively, to construct an instance of the desired client.
+ * {@link #buildAsyncClient()}, respectively, to construct an instance of the desired client.
+ *
+ *
+ * Getting Started
*
- * The minimal configuration options required by {@link TableServiceClientBuilder} to build a
- * {@link TableServiceClient} or {@link TableServiceAsyncClient} are an {@link String endpoint} and a form of
- * authentication, which can be set via: {@link TableServiceClientBuilder#connectionString(String)},
- * {@link TableServiceClientBuilder#credential(AzureSasCredential)},
- * {@link TableServiceClientBuilder#credential(AzureNamedKeyCredential)} or
- * {@link TableServiceClientBuilder#sasToken(String)}
+ * The minimal configuration options required by {@link TableServiceClientBuilder} to build a {@link TableServiceClient} or
+ * {@link TableServiceAsyncClient} are an {@link String endpoint} and a form of authentication,
+ * which can be set via: {@link TableServiceClientBuilder#connectionString(String)},
+ * {@link TableServiceClientBuilder#credential(AzureNamedKeyCredential)}, {@link TableServiceClientBuilder#credential(TokenCredential)}, {@link TableServiceClientBuilder#credential(AzureSasCredential)},
+ * or {@link TableServiceClientBuilder#sasToken(String)}
*
- * Samples to construct a sync client
- *
+ * To build a {@link TableServiceClient} or {@link TableServiceAsyncClient} instance, call {@link TableServiceClientBuilder#buildClient()} or {@link TableServiceClientBuilder#buildAsyncClient()},
+ * respectively.
+ *
+ * The following example shows how to build a {@link TableServiceClient}.
+ *
+ *
*
* TableServiceClient tableServiceClient = new TableServiceClientBuilder()
- * .endpoint("https://myvault.azure.net/")
- * .credential(new AzureNamedKeyCredential("name", "key"))
+ * .connectionString("connectionString")
* .buildClient();
*
- *
- * Samples to construct an async client
- *
+ *
+ *
+ * The following example shows how to build a {@link TableServiceAsyncClient}.
+ *
+ *
*
- * TableServiceAsyncClient tableServiceAsyncClient = new TableServiceClientBuilder()
- * .endpoint("https://myvault.azure.net/")
- * .credential(new AzureNamedKeyCredential("name", "key"))
+ * TableServiceAsyncClient tableServiceClient = new TableServiceClientBuilder()
+ * .connectionString("connectionString")
* .buildAsyncClient();
*
- *
+ *
+ *
+ *
+ *
+ * Authentication via Connection String
+ *
+ * To use a connection string to authorize the client, call the builder's {@link TableServiceClientBuilder#connectionString(String)} method with your connection string. When authenticating via a
+ * connection string, providing an endpoint is not required.
+ *
+ *
+ *
+ * TableServiceClient tableServiceClient = new TableServiceClientBuilder()
+ * .connectionString("connectionstring")
+ * .buildClient();
+ *
+ *
+ *
+ *
+ *
+ * Authentication via Shared Key
+ *
+ * To use shared key authentication, create an instance of AzureNamedKeyCredential and pass it to the builder's
+ * {@link TableServiceClientBuilder#credential(AzureNamedKeyCredential)} method. Pass the account URL to the builder's {@link TableServiceClientBuilder#endpoint(String)} method.
+ *
+ *
+ *
+ * TableServiceClient tableServiceClient = new TableServiceClientBuilder()
+ * .endpoint("endpoint")
+ * .credential(new AzureNamedKeyCredential("name", "key"))
+ * .buildClient();
+ *
+ *
+ *
+ *
+ *
+ * Authentication via Shared Access Signature (SAS)
+ *
+ * When authorizing a client utilizing a Shared Access Signature (SAS), you have the option of using AzureSasCredential or
+ * the SAS token directly. To use an AzureSasCredential, pass it to the builder's {@link TableServiceClientBuilder#credential(AzureSasCredential)} method. When authenticating with a SAS token, pass it to the
+ * builder's {@link TableServiceClientBuilder#sasToken(String)} method. Pass the account URL to the builder's {@link TableServiceClientBuilder#endpoint(String)} method.
+ *
+ * Using AzureSasCredential:
+ *
+ *
+ *
+ * TableServiceClient tableServiceClient = new TableServiceClientBuilder()
+ * .endpoint("endpoint")
+ * .credential(new AzureSasCredential("sasToken"))
+ * .buildClient();
+ *
+ *
+ *
+ * Using a SAS token:
+ *
+ *
+ *
+ * TableServiceClient tableServiceClient = new TableServiceClientBuilder()
+ * .endpoint("endpoint")
+ * .sasToken("sasToken")
+ * .buildClient();
+ *
+ *
+ *
+ *
+ *
+ * Authentication via Token Credential
+ *
+ * To use token credential authentication, create an instance of a credential class that implements TokenCredential and pass it to the
+ * builder's {@link TableServiceClientBuilder#credential(TokenCredential)} method. Pass the account URL to the builder's {@link TableServiceClientBuilder#endpoint(String)} method.
+ *
+ *
+ *
+ * TableServiceClient tableServiceClient = new TableServiceClientBuilder()
+ * .endpoint("endpoint")
+ * .credential(new DefaultAzureCredentialBuilder().build())
+ * .buildClient();
+ *
+ *
*
* @see TableServiceAsyncClient
* @see TableServiceClient
+ * @see com.azure.data.tables
*/
@ServiceClientBuilder(serviceClients = {TableServiceClient.class, TableServiceAsyncClient.class})
public final class TableServiceClientBuilder implements
@@ -201,7 +289,7 @@ private HttpPipeline prepareClient() {
namedKeyCredential != null ? namedKeyCredential : azureNamedKeyCredential, azureSasCredential,
tokenCredential, sasToken, endpoint, retryPolicy, retryOptions, httpLogOptions, clientOptions, httpClient,
perCallPolicies, perRetryPolicies, configuration, logger, enableTenantDiscovery);
-
+
return pipeline;
}
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/ListEntitiesOptions.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/ListEntitiesOptions.java
index 882d6a6ae409..f42d32d5be98 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/ListEntitiesOptions.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/ListEntitiesOptions.java
@@ -16,6 +16,14 @@ public final class ListEntitiesOptions {
private List select;
private String filter;
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Returns an empty instance of {@link ListEntitiesOptions}.
+ */
+ public ListEntitiesOptions() {
+
+ }
+
/**
* Gets the value of the `top` OData query option which limits the number of returned entities.
*
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/ListTablesOptions.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/ListTablesOptions.java
index fbbb8dcb87c2..227702e82c9e 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/ListTablesOptions.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/ListTablesOptions.java
@@ -13,6 +13,14 @@ public final class ListTablesOptions {
private Integer top;
private String filter;
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Returns an empty instance of {@link ListTablesOptions}.
+ */
+ public ListTablesOptions() {
+
+ }
+
/**
* Gets the value of the `top` OData query option which limits the number of returned entities.
*
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableAccessPolicies.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableAccessPolicies.java
index 0e96efcb441f..810f1bbd96e8 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableAccessPolicies.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableAccessPolicies.java
@@ -23,6 +23,7 @@ public TableAccessPolicies(List identifiers) {
}
/**
+ * Returns the {@link TableSignedIdentifier TableSignedIdentifiesrs} associated with the table
* @return the {@link TableSignedIdentifier TableSignedIdentifiers} associated with the table.
*/
public List getIdentifiers() {
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableAccessPolicy.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableAccessPolicy.java
index 03deba7e88ef..4a22cf82f37b 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableAccessPolicy.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableAccessPolicy.java
@@ -27,6 +27,13 @@ public final class TableAccessPolicy {
*/
private String permissions;
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Creates an instance of {@link TableAccessPolicy}.
+ */
+ public TableAccessPolicy() {
+ }
+
/**
* Get the {@link OffsetDateTime date-time} the policy is active.
*
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableEntity.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableEntity.java
index ba473b2bc6b2..5ad72b8f0a33 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableEntity.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableEntity.java
@@ -14,6 +14,7 @@
import java.util.Objects;
/**
+ * Overview
* An entity within a table.
*
* A {@code TableEntity} can be used directly when interacting with the Tables service, with methods on the
@@ -21,6 +22,80 @@
* return {@code TableEntity} instances. After creating an instance, call the {@link #addProperty(String, Object)} or
* {@link #setProperties(Map)} methods to add properties to the entity. When retrieving an entity from the service, call
* the {@link #getProperty(String)} or {@link #getProperties()} methods to access the entity's properties.
+ *
+ * Usage Code Samples
+ *
+ * The following samples provide examples of common operations preformed on a TableEntity. The samples use a subset of acceptable
+ * property values. For an exhaustive list, see the service documentation.
+ *
+ *
+ * Create a TableEntity
+ *
+ * The following sample shows the creation of a table entity.
+ *
+ *
+ *
+ * TableEntity entity = new TableEntity("partitionKey", "rowKey");
+ *
+ *
+ *
+ * Add properties to a TableEntity
+ *
+ * The following sample shows the addition of properties to a table entity.
+ *
+ *
+ *
+ * TableEntity entity = new TableEntity("partitionKey", "rowKey");
+ *
+ *
+ *
+ * Set properties from a TableEntity
+ *
+ * The following sample shows the setting of a table entity's properties.
+ *
+ *
+ *
+ * Map<String, Object> properties = new HashMap<>();
+ * properties.put("String", "StringValue");
+ * properties.put("Integer", 100);
+ * properties.put("Boolean", true);
+ * TableEntity entity = new TableEntity("partitionKey", "rowKey")
+ * .setProperties(properties);
+ *
+ *
+ *
+ * Get a property from a TableEntity
+ *
+ * The following sample shows the retrieval of a property from a table entity.
+ *
+ *
+ *
+ * TableEntity entity = new TableEntity("partitionKey", "rowKey")
+ * .addProperty("String", "StringValue")
+ * .addProperty("Integer", 100)
+ * .addProperty("Boolean", true);
+ *
+ * String stringValue = (String) entity.getProperty("String");
+ * int integerValue = (int) entity.getProperty("Integer");
+ * boolean booleanValue = (boolean) entity.getProperty("Boolean");
+ *
+ *
+ *
+ * Get properties from a TableEntity
+ *
+ * The following sample shows the retrieval of all properties from a table entity.
+ *
+ *
+ *
+ * TableEntity entity = new TableEntity("partitionKey", "rowKey")
+ * .addProperty("String", "StringValue")
+ * .addProperty("Integer", 100)
+ * .addProperty("Boolean", true);
+ *
+ * Map<String, Object> properties = entity.getProperties();
+ *
+ *
+ *
*/
@Fluent
public final class TableEntity {
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableErrorCode.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableErrorCode.java
index dafaf4680f0e..4349c5f6baf2 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableErrorCode.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableErrorCode.java
@@ -265,6 +265,14 @@ public final class TableErrorCode extends ExpandableStringEnum {
*/
public static final TableErrorCode FORBIDDEN = fromString("Forbidden");
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Creates an instance of {@link TableErrorCode}.
+ */
+ public TableErrorCode() {
+
+ }
+
/**
* Returns the {@code TableErrorCode} constant with the provided name, or {@code null} if no {@code TableErrorCode}
* has the provided name.
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceCorsRule.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceCorsRule.java
index 48674f55ab12..40bae043734e 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceCorsRule.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceCorsRule.java
@@ -42,6 +42,14 @@ public final class TableServiceCorsRule {
*/
private int maxAgeInSeconds;
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Creates an instance of {@link TableServiceCorsRule}.
+ */
+ public TableServiceCorsRule() {
+
+ }
+
/**
* Get the origin domains that are permitted to make a request against the service via CORS. The origin domain is
* the domain from which the request originates. Note that the origin must be an exact case-sensitive match with
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceGeoReplicationStatus.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceGeoReplicationStatus.java
index 7bbafe0ef469..339b73e1e93d 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceGeoReplicationStatus.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceGeoReplicationStatus.java
@@ -25,6 +25,16 @@ public final class TableServiceGeoReplicationStatus extends ExpandableStringEnum
*/
public static final TableServiceGeoReplicationStatus UNAVAILABLE = fromString("unavailable");
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Creates an instance of {@link TableServiceGeoReplicationStatus}.
+ * @deprecated Empty constructor. Use {@link TableServiceGeoReplicationStatus#fromString} to instantiate.
+ */
+ @Deprecated
+ public TableServiceGeoReplicationStatus() {
+
+ }
+
/**
* Creates or finds a {@link TableServiceGeoReplicationStatus} from its string representation.
*
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceLogging.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceLogging.java
index ca1b32db5698..a443c4db45a7 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceLogging.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceLogging.java
@@ -36,6 +36,14 @@ public final class TableServiceLogging {
*/
private TableServiceRetentionPolicy retentionPolicy;
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Creates a {@link TableServiceLogging}.
+ */
+ public TableServiceLogging() {
+
+ }
+
/**
* Get the version of Analytics to configure.
*
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceMetrics.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceMetrics.java
index 1648595c5065..01ab29dee482 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceMetrics.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceMetrics.java
@@ -30,6 +30,14 @@ public final class TableServiceMetrics {
*/
private TableServiceRetentionPolicy retentionPolicy;
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Creates a {@link TableServiceMetrics}.
+ */
+ public TableServiceMetrics() {
+
+ }
+
/**
* Get the version of Analytics to configure.
*
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceProperties.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceProperties.java
index 7d8616727dfd..1e6f0d9efea5 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceProperties.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceProperties.java
@@ -32,6 +32,14 @@ public final class TableServiceProperties {
*/
private List corsRules;
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Creates a {@link TableServiceProperties}.
+ */
+ public TableServiceProperties() {
+
+ }
+
/**
* Set the {@link TableServiceLogging Azure Analytics Logging settings}.
*
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceRetentionPolicy.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceRetentionPolicy.java
index 384f4a8497b0..29180896c75d 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceRetentionPolicy.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/models/TableServiceRetentionPolicy.java
@@ -21,6 +21,14 @@ public final class TableServiceRetentionPolicy {
*/
private Integer daysToRetain;
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Creates a {@link TableServiceRetentionPolicy}.
+ */
+ public TableServiceRetentionPolicy() {
+
+ }
+
/**
* Get a value that indicates whether a retention policy is enabled for the Table service.
*
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/package-info.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/package-info.java
index 42528acca50a..c25f6d40e09d 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/package-info.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/package-info.java
@@ -2,6 +2,266 @@
// Licensed under the MIT License.
/**
- * Package containing the classes for Tables Clients.
+ * Azure Tables is a NoSQL key-value storage service offered by Microsoft Azure, which provides a highly
+ * scalable and cost-effective solution for storing structured data. It is a fully managed service that is designed to
+ * handle large volumes of structured data in a distributed environment, with low latency and high availability.
+ * Azure Tables stores data in tables, which are schema-less and can contain any type of data. Each table can have
+ * a partition key and a row key, which together form a unique primary key that can be used to retrieve individual
+ * records. This enables fast, efficient querying of data, especially when combined with Azure's indexing and query
+ * features.
+ *
+ * The Azure Tables client library enables Java developers to easily interact with Azure Tables Storage Service
+ * from their Java applications. This library provides a set of APIs that abstract the low-level details of working with
+ * the Azure Tables Storage Service and allows developers to perform common operations such as creating tables,
+ * inserting, updating and deleting entities, querying data, and managing access control on tables and entities.
+ * The library supports both Azure Storage and Azure Cosmos tables. It offers both
+ * synchronous and asynchronous programming models. It also provides features such as retries, automatic
+ * pagination, and parallelism to enable efficient and reliable interactions with Azure Tables Storage Service.
+ *
+ * Getting Started
+ *
+ * Prerequisites
+ *
+ * The client library package requires the following:
+ *
+ *
+ * - Java 8 or later
+ * - An Azure subscription
+ * - An existing Azure Storage or Azure Cosmos account
+ *
+ *
+ *
+ *
+ * Authenticate a Client
+ *
+ * In order to build a valid table client or table service client, you will need to authenticate the client using an accepted method of authentication. The supported forms of authentication are:
+ *
+ *
+ * - Connection String
+ * - Shared Key
+ * - Shared Access Signature (SAS)
+ * - Token Credential
+ *
+ *
+ * See client builder class documentation {@link com.azure.data.tables.TableServiceClientBuilder TableServiceClientBuilder} and {@link com.azure.data.tables.TableClientBuilder TableClientBuilder}
+ * for examples of authenticating a client.
+ *
+ * For more information on authentication types, see the identity documentation.
+ *
+ * Table service clients utilize their authentication information to create table clients. Table clients created via a table service client will inherit the authentication information of the table
+ * service client.
+ *
+ *
+ *
+ * Overview
+ *
+ * The {@link com.azure.data.tables.TableServiceClient TableServiceClient} and {@link com.azure.data.tables.TableServiceAsyncClient TableServiceAsyncClient} provide access to the tables within an
+ * Azure Storage or Azure Cosmos account. A table service client can create, list, and delete tables. It also provides access to a table client that can be used to perform CRUD operations on entities
+ * within a table. You can instantiate a table service client using an instance of {@link com.azure.data.tables.TableServiceClientBuilder TableServiceClientBuilder}.
+ *
+ * The {@link com.azure.data.tables.TableClient TableClient} and {@link com.azure.data.tables.TableAsyncClient} provide access to a specific table within an Azure Storage or Azure Cosmos account.
+ * A table client can be used to perform CRUD and query operations on entities within a table. Table clients can also create* new tables and delete the table they reference from the Azure Storage or
+ * Cosmos acount. An instance of a table client can be returned via a table service client or can be instantiated using an instance of
+ * {@link com.azure.data.tables.TableClientBuilder TableClientBuilder}.
+ *
+ * * Tables created from a table client do not return a new TableClient instance. Table client instances cannot change the table they reference. To reference the newly created table, a new table
+ * client instance must be instantiated referencing the table.
+ *
+ * See methods in client level class below to explore all capabilities the library provides.
+ *
+ *
+ *
+ * Table Service Client Usage
+ *
+ * Create a {@link com.azure.data.tables.TableServiceClient TableServiceClient} using a {@link com.azure.data.tables.TableServiceClientBuilder TableServiceClientBuilder}
+ *
+ * The {@link com.azure.data.tables.TableServiceClient TableServiceClient} and {@link com.azure.data.tables.TableServiceAsyncClient TableServiceAsyncClient} both provide access to the tables within an
+ * Azure Storage or Azure Cosmos account. A table service client can create, list, and delete tables. It also provides access to a table client that can be used to perform CRUD operations on entities
+ * within a table. You can instantiate a table service client using an instance of {@link com.azure.data.tables.TableServiceClientBuilder TableServiceClientBuilder}.
+ *
+ * Here's an example of creating a synchronous table service client using the {@link com.azure.data.tables.TableServiceClientBuilder#buildClient()} TableServiceClientBuilder buildClient} method:
+ *
+ *
+ *
+ * TableServiceClient tableServiceClient = new TableServiceClientBuilder()
+ * .connectionString("connectionstring")
+ * .buildClient();
+ *
+ *
+ *
+ * Note: To create an asynchronous table service client, call {@link com.azure.data.tables.TableServiceClientBuilder#buildAsyncClient() buildAsyncClient()} instead of {@link com.azure.data.tables.TableServiceClientBuilder#buildClient() buildClient()}.
+ *
+ *
+ *
+ *
+ * Create a Table using {@link com.azure.data.tables.TableServiceClient TableServiceClient}
+ *
+ * The {@link com.azure.data.tables.TableServiceClient#createTable(java.lang.String) TableServiceClient createTable} method can be used to create an new table within your Azure Storage or Azure Cosmos account.
+ *
+ * The following example creates a table with the name "tableName".
+ *
+ *
+ *
+ * tableServiceClient.createTable("tableName");
+ *
+ *
+ *
+ * Note: For asynchronous sample, refer to {@link com.azure.data.tables.TableServiceAsyncClient TableServiceAsyncClient}
+ *
+ *
+ *
+ * List Tables using {@link com.azure.data.tables.TableServiceClient TableServiceClient}
+ *
+ * The {@link com.azure.data.tables.TableServiceClient#listTables() TableServiceClient listTables} method can be used to list the tables that are within an Azure Storage or Azure Cosmos account.
+ *
+ * The following example lists all the tables in the account without any filtering of Tables.
+ *
+ *
+ *
+ * tableServiceClient.listTables().forEach(table -> {
+ * String tableName = table.getName();
+ * System.out.println("Table name: " + tableName);
+ * });
+ *
+ *
+ *
+ * Note: For asynchronous sample, refer to {@link com.azure.data.tables.TableServiceAsyncClient TableServiceAsyncClient}
+ *
+ *
+ *
+ * Delete a Table using {@link com.azure.data.tables.TableServiceClient TableServiceClient}
+ *
+ * The {@link com.azure.data.tables.TableServiceClient#deleteTable(java.lang.String) TableServiceClient deleteTable} method can be used to delete a table that is within your Azure Storage or Azure Cosmos account.
+ *
+ * The following example deletes a table with the name "tableName".
+ *
+ *
+ *
+ * tableServiceClient.deleteTable("tableName");
+ *
+ *
+ *
+ * Note: For asynchronous sample, refer to {@link com.azure.data.tables.TableServiceAsyncClient TableServiceAsyncClient}
+ *
+ *
+ *
+ * Table Client Usage
+ *
+ * The {@link com.azure.data.tables.TableClient TableClient} and {@link com.azure.data.tables.TableAsyncClient} provide access to a specific table within an Azure Storage or Azure Cosmos account.
+ * A table client can be used to perform CRUD and query operations on entities within a table. Table clients can also create* new tables and delete the table they reference from the Azure Storage or
+ * Cosmos acount. An instance of a table client can be returned via a table service client or can be instantiated using an instance of
+ * {@link com.azure.data.tables.TableClientBuilder TableClientBuilder}.
+ *
+ * Retrieve a {@link com.azure.data.tables.TableClient TableClient} from a {@link com.azure.data.tables.TableServiceClient TableServiceClient}
+ *
+ * The {@link com.azure.data.tables.TableServiceClient#getTableClient(java.lang.String)} TableServiceClient getTableClient} method can be used to retrieve a TableClient for a specified table that is stored within your Azure Storage or Azure Cosmos account.
+ *
+ * The following example returns a table client for a table with the name "tableName".
+ *
+ *
+ *
+ * TableClient tableClient = tableServiceClient.getTableClient("tableName");
+ *
+ *
+ *
+ * Note: For asynchronous sample, refer to {@link com.azure.data.tables.TableServiceAsyncClient TableServiceAsyncClient}
+ *
+ *
+ *
+ * Create a {@link com.azure.data.tables.TableClient TableClient} using a {@link com.azure.data.tables.TableClientBuilder TableClientBuilder}
+ *
+ * The {@link com.azure.data.tables.TableClient TableClient} and {@link com.azure.data.tables.TableAsyncClient} provide access to a specific table within an Azure Storage or Azure Cosmos account.
+ * The {@link com.azure.data.tables.TableClientBuilder#buildClient() TableClientBuilder buildClient} method can be used to create a {@link com.azure.data.tables.TableClient TableClient}
+ *
+ * Here's an example of creating a TableClient using a builder:
+ *
+ *
+ *
+ * TableClient tableClient = new TableClientBuilder()
+ * .connectionString("connectionstring")
+ * .tableName("tableName")
+ * .buildClient();
+ *
+ *
+ *
+ * Note: To create an TableAsyncClient, call {@link com.azure.data.tables.TableClientBuilder#buildAsyncClient() buildAsyncClient()} instead of {@link com.azure.data.tables.TableClientBuilder#buildClient() buildClient()}.
+ *
+ *
+ *
+ * Create an Entity using {@link com.azure.data.tables.TableClient TableClient}
+ *
+ * The {@link com.azure.data.tables.TableClient#createEntity(com.azure.data.tables.models.TableEntity) TableClient createEntity} method can be used to create a table entity within a table in your Azure Storage or Azure Cosmos account.
+ *
+ * The following example creates an entity with a partition key of "partitionKey" and a row key of "rowKey".
+ *
+ *
+ *
+ * tableClient.createEntity(new TableEntity("partitionKey", "rowKey")
+ * .addProperty("property", "value"));
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link com.azure.data.tables.TableAsyncClient TableAsyncClient}
+ *
+ *
+ *
+ * Update an Entity using {@link com.azure.data.tables.TableClient TableClient}
+ *
+ * The {@link com.azure.data.tables.TableClient#updateEntity(com.azure.data.tables.models.TableEntity) TableClient updateEntity} method can be used to update a table entity within a table in your Azure Storage or Azure Cosmos account.
+ *
+ * The following example updates an entity with a partition key of "partitionKey" and a row key of "rowKey", adding an additional property with the name "newProperty" and the value "newValue".
+ *
+ *
+ *
+ * TableEntity entity = tableClient.getEntity("partitionKey", "rowKey");
+ * entity.addProperty("newProperty", "newValue");
+ * tableClient.updateEntity(entity);
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link com.azure.data.tables.TableAsyncClient TableAsyncClient}
+ *
+ *
+ *
+ * List Entities
+ *
+ * The {@link com.azure.data.tables.TableClient#listEntities() TableClient listEntities} method can be used to list the entities that are within a table in your Azure Storage or Azure Cosmos account.
+ *
+ * The following example lists all entities in a table without any filtering.
+ *
+ *
+ *
+ * tableClient.listEntities().forEach(entity -> {
+ * String partitionKey = entity.getPartitionKey();
+ * String rowKey = entity.getRowKey();
+ * System.out.println("Partition key: " + partitionKey + ", Row key: " + rowKey);
+ * });
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link com.azure.data.tables.TableAsyncClient TableAsyncClient}
+ *
+ *
+ *
+ * Delete an Entity
+ *
+ * The {@link com.azure.data.tables.TableClient#deleteEntity(com.azure.data.tables.models.TableEntity) TableClient deleteEntity} method can be used to delete an entity that is within a table in your Azure Storage or Azure Cosmos account.
+ *
+ * The following example deletes an entity with a partition key of "partitionKey" and a row key of "rowKey".
+ *
+ *
+ *
+ * tableClient.deleteEntity("partitionKey", "rowKey");
+ *
+ *
+ *
+ * Note: for asynchronous sample, refer to {@link com.azure.data.tables.TableAsyncClient TableAsyncClient}
+ *
+ * @see com.azure.data.tables.TableServiceClient
+ * @see com.azure.data.tables.TableServiceAsyncClient
+ * @see com.azure.data.tables.TableServiceClientBuilder
+ * @see com.azure.data.tables.TableClient
+ * @see com.azure.data.tables.TableAsyncClient
+ * @see com.azure.data.tables.TableClientBuilder
*/
package com.azure.data.tables;
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasPermission.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasPermission.java
index df00b94a058c..ff023d586798 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasPermission.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasPermission.java
@@ -35,6 +35,14 @@ public final class TableAccountSasPermission {
private boolean tagsPermission;
private boolean filterTagsPermission;
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Returns an instance of {@link TableAccountSasPermission} that has all fields set to false.
+ */
+ public TableAccountSasPermission() {
+
+ }
+
/**
* Creates an {@link TableAccountSasPermission} from the specified permissions string. This method will throw an
* {@link IllegalArgumentException} if it encounters a character that does not correspond to a valid permission.
@@ -304,6 +312,7 @@ public TableAccountSasPermission setProcessMessages(boolean hasProcessMessagesPe
}
/**
+ * Returns the tags permission status. Used to read or write the tags on a blob.
* @return The tags permission status. Used to read or write the tags on a blob.
*/
public boolean hasTagsPermission() {
@@ -325,6 +334,7 @@ public TableAccountSasPermission setTagsPermission(boolean tagsPermission) {
/**
+ * Returns the filter tags permission status. Used to filter blobs by their tags.
* @return The filter tags permission status. Used to filter blobs by their tags.
*/
public boolean hasFilterTagsPermission() {
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasResourceType.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasResourceType.java
index 0315ceb48f9f..6903b463fd1d 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasResourceType.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasResourceType.java
@@ -20,6 +20,14 @@ public final class TableAccountSasResourceType {
private boolean container;
private boolean object;
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Creates a {@link TableAccountSasResourceType} with all fields set to false.
+ */
+ public TableAccountSasResourceType() {
+
+ }
+
/**
* Creates an {@link TableAccountSasResourceType} from the specified resource types string. This method will throw an
* {@link IllegalArgumentException} if it encounters a character that does not correspond to a valid resource type.
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasService.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasService.java
index 606ac4119a07..e161b9c8c11d 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasService.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableAccountSasService.java
@@ -21,6 +21,14 @@ public final class TableAccountSasService {
private boolean queue;
private boolean table;
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Creates a {@link TableAccountSasService} with all fields set to false.
+ */
+ public TableAccountSasService() {
+
+ }
+
/**
* Creates an {@link TableAccountSasService} from the specified services string. This method will throw an
* {@link IllegalArgumentException} if it encounters a character that does not correspond to a valid service.
@@ -60,6 +68,7 @@ public static TableAccountSasService parse(String servicesString) {
}
/**
+ * Returns the access status for blob resources.
* @return The access status for blob resources.
*/
public boolean hasBlobAccess() {
@@ -80,6 +89,7 @@ public TableAccountSasService setBlobAccess(boolean blob) {
}
/**
+ * Returns the access status for file resources.
* @return The access status for file resources.
*/
public boolean hasFileAccess() {
@@ -100,6 +110,7 @@ public TableAccountSasService setFileAccess(boolean file) {
}
/**
+ * Returns the access status for queue resources.
* @return The access status for queue resources.
*/
public boolean hasQueueAccess() {
@@ -120,6 +131,7 @@ public TableAccountSasService setQueueAccess(boolean queue) {
}
/**
+ * Returns the access status for table resources.
* @return The access status for table resources.
*/
public boolean hasTableAccess() {
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasIpRange.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasIpRange.java
index 2c935b03aa31..27eeb0f12439 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasIpRange.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasIpRange.java
@@ -13,6 +13,14 @@ public final class TableSasIpRange {
private String ipMin;
private String ipMax;
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Creates an instance of {@link TableSasIpRange}.
+ */
+ public TableSasIpRange() {
+
+ }
+
/**
* Creates a {@link TableSasIpRange} from the specified string.
*
@@ -32,6 +40,7 @@ public static TableSasIpRange parse(String rangeStr) {
}
/**
+ * Returns the minimum IP address of the range.
* @return The minimum IP address of the range.
*/
public String getIpMin() {
@@ -51,6 +60,7 @@ public TableSasIpRange setIpMin(String ipMin) {
}
/**
+ * Returns the maximum IP address of the range.
* @return The maximum IP address of the range.
*/
public String getIpMax() {
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasPermission.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasPermission.java
index 54d17fda078b..877a441b191d 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasPermission.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasPermission.java
@@ -29,6 +29,14 @@ public final class TableSasPermission {
private boolean updatePermission;
private boolean deletePermission;
+ // empty constructor necessary due to Javadoc warnings
+ /**
+ * Creates an {@link TableSasPermission} with all fields set to false.
+ */
+ public TableSasPermission() {
+
+ }
+
/**
* Creates a {@link TableSasPermission} from the specified permissions string. This method will throw an
* {@link IllegalArgumentException} if it encounters a character that does not correspond to a valid permission.
diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasSignatureValues.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasSignatureValues.java
index 4d736c67a080..c4ac32ba305e 100644
--- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasSignatureValues.java
+++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/sas/TableSasSignatureValues.java
@@ -56,6 +56,8 @@ public TableSasSignatureValues(String identifier) {
}
/**
+ * Returns the version of the service this SAS will target. If not specified, it will default to the version
+ * targeted by the library.
* @return The version of the service this SAS will target. If not specified, it will default to the version
* targeted by the library.
*/
@@ -78,6 +80,7 @@ public TableSasSignatureValues setVersion(String version) {
}
/**
+ * Returns the {@link TableSasProtocol} which determines the protocols allowed by the SAS.
* @return The {@link TableSasProtocol} which determines the protocols allowed by the SAS.
*/
public TableSasProtocol getProtocol() {
@@ -98,6 +101,7 @@ public TableSasSignatureValues setProtocol(TableSasProtocol protocol) {
}
/**
+ * Returns when the SAS will take effect.
* @return When the SAS will take effect.
*/
public OffsetDateTime getStartTime() {
@@ -118,6 +122,7 @@ public TableSasSignatureValues setStartTime(OffsetDateTime startTime) {
}
/**
+ * Returns the time after which the SAS will no longer work.
* @return The time after which the SAS will no longer work.
*/
public OffsetDateTime getExpiryTime() {
@@ -138,6 +143,8 @@ public TableSasSignatureValues setExpiryTime(OffsetDateTime expiryTime) {
}
/**
+ * Returns the permissions string allowed by the SAS. Please refer to {@link TableSasPermission} for help
+ * determining the permissions allowed.
* @return The permissions string allowed by the SAS. Please refer to {@link TableSasPermission} for help
* determining the permissions allowed.
*/
@@ -164,6 +171,7 @@ public TableSasSignatureValues setPermissions(TableSasPermission permissions) {
}
/**
+ * Returns the {@link TableSasIpRange} which determines the IP ranges that are allowed to use the SAS.
* @return The {@link TableSasIpRange} which determines the IP ranges that are allowed to use the SAS.
*/
public TableSasIpRange getSasIpRange() {
@@ -187,9 +195,10 @@ public TableSasSignatureValues setSasIpRange(TableSasIpRange sasIpRange) {
}
/**
- * @return The name of the access policy on the table this SAS references if any. Please see
+ * Returns the name of the access policy on the table this SAS references if any. Please see
* here
* for more information.
+ * @return The name of the access policy on the table this SAS references if any.
*/
public String getIdentifier() {
return identifier;
diff --git a/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableAsyncClientJavaDocCodeSnippets.java b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableAsyncClientJavaDocCodeSnippets.java
index 3ec0dd33f16c..ef435496c09a 100644
--- a/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableAsyncClientJavaDocCodeSnippets.java
+++ b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableAsyncClientJavaDocCodeSnippets.java
@@ -41,6 +41,22 @@ public TableAsyncClient createAsyncClient() {
return tableAsyncClient;
}
+ /**
+ * Generates a code sample for creating a {@link TableAsyncClient} using a connection string.
+ *
+ * @return An instance of {@link TableAsyncClient}.
+ */
+ public TableAsyncClient createAsyncClientWithConnectionString() {
+ // BEGIN: com.azure.data.tables.tableAsyncClient.instantiation.connectionstring
+ TableAsyncClient tableAsyncClient = new TableClientBuilder()
+ .connectionString("connectionstring")
+ .tableName("myTable")
+ .buildAsyncClient();
+ // END: com.azure.data.tables.tableAsyncClient.instantiation.connectionstring
+
+ return tableAsyncClient;
+ }
+
/**
* Generates code samples for using {@link TableAsyncClient#createTable()} and
* {@link TableAsyncClient#createTableWithResponse()}.
@@ -94,31 +110,25 @@ public void createEntity() {
TableAsyncClient tableAsyncClient = createAsyncClient();
// BEGIN: com.azure.data.tables.tableAsyncClient.createEntity#TableEntity
- String partitionKey = "partitionKey";
- String rowKey = "rowKey";
-
- TableEntity tableEntity = new TableEntity(partitionKey, rowKey)
+ TableEntity tableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
tableAsyncClient.createEntity(tableEntity)
.contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(unused ->
- System.out.printf("Table entity with partition key '%s' and row key '%s' was created.", partitionKey,
- rowKey));
+ System.out.printf("Table entity with partition key '%s' and row key '%s' was created.", "partitionKey",
+ "rowKey"));
// END: com.azure.data.tables.tableAsyncClient.createEntity#TableEntity
// BEGIN: com.azure.data.tables.tableAsyncClient.createEntityWithResponse#TableEntity
- String myPartitionKey = "partitionKey";
- String myRowKey = "rowKey";
-
- TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
tableAsyncClient.createEntityWithResponse(myTableEntity)
.contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(response ->
System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and"
- + " row key '%s' was created.", response.getStatusCode(), myPartitionKey, myRowKey));
+ + " row key '%s' was created.", response.getStatusCode(), "partitionKey", "rowKey"));
// END: com.azure.data.tables.tableAsyncClient.createEntityWithResponse#TableEntity
}
@@ -130,31 +140,25 @@ public void upsertEntity() {
TableAsyncClient tableAsyncClient = createAsyncClient();
// BEGIN: com.azure.data.tables.tableAsyncClient.upsertEntity#TableEntity
- String partitionKey = "partitionKey";
- String rowKey = "rowKey";
-
- TableEntity tableEntity = new TableEntity(partitionKey, rowKey)
+ TableEntity tableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
tableAsyncClient.upsertEntity(tableEntity)
.contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(unused ->
System.out.printf("Table entity with partition key '%s' and row key '%s' was updated/created.",
- partitionKey, rowKey));
+ "partitionKey", "rowKey"));
// END: com.azure.data.tables.tableAsyncClient.upsertEntity#TableEntity
// BEGIN: com.azure.data.tables.tableAsyncClient.upsertEntityWithResponse#TableEntity-TableEntityUpdateMode
- String myPartitionKey = "partitionKey";
- String myRowKey = "rowKey";
-
- TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
tableAsyncClient.upsertEntityWithResponse(myTableEntity, TableEntityUpdateMode.REPLACE)
.contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(response ->
System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and"
- + " row key '%s' was updated/created.", response.getStatusCode(), partitionKey, rowKey));
+ + " row key '%s' was updated/created.", response.getStatusCode(), "partitionKey", "rowKey"));
// END: com.azure.data.tables.tableAsyncClient.upsertEntityWithResponse#TableEntity-TableEntityUpdateMode
}
@@ -167,45 +171,36 @@ public void updateEntity() {
TableAsyncClient tableAsyncClient = createAsyncClient();
// BEGIN: com.azure.data.tables.tableAsyncClient.updateEntity#TableEntity
- String partitionKey = "partitionKey";
- String rowKey = "rowKey";
-
- TableEntity tableEntity = new TableEntity(partitionKey, rowKey)
+ TableEntity tableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
tableAsyncClient.updateEntity(tableEntity)
.contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(unused ->
System.out.printf("Table entity with partition key '%s' and row key '%s' was updated/created.",
- partitionKey, rowKey));
+ "partitionKey", "rowKey"));
// END: com.azure.data.tables.tableAsyncClient.updateEntity#TableEntity
// BEGIN: com.azure.data.tables.tableAsyncClient.updateEntity#TableEntity-TableEntityUpdateMode
- String myPartitionKey = "partitionKey";
- String myRowKey = "rowKey";
-
- TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
tableAsyncClient.updateEntity(myTableEntity, TableEntityUpdateMode.REPLACE)
.contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(unused ->
System.out.printf("Table entity with partition key '%s' and row key '%s' was updated/created.",
- partitionKey, rowKey));
+ "partitionKey", "rowKey"));
// END: com.azure.data.tables.tableAsyncClient.updateEntity#TableEntity-TableEntityUpdateMode
// BEGIN: com.azure.data.tables.tableAsyncClient.updateEntityWithResponse#TableEntity-TableEntityUpdateMode-boolean
- String somePartitionKey = "partitionKey";
- String someRowKey = "rowKey";
-
- TableEntity someTableEntity = new TableEntity(somePartitionKey, someRowKey)
+ TableEntity someTableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
tableAsyncClient.updateEntityWithResponse(someTableEntity, TableEntityUpdateMode.REPLACE, true)
.contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(response ->
System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and"
- + " row key '%s' was updated.", response.getStatusCode(), partitionKey, rowKey));
+ + " row key '%s' was updated.", response.getStatusCode(), "partitionKey", "rowKey"));
// END: com.azure.data.tables.tableAsyncClient.updateEntityWithResponse#TableEntity-TableEntityUpdateMode-boolean
}
@@ -218,42 +213,33 @@ public void deleteEntity() {
TableAsyncClient tableAsyncClient = createAsyncClient();
// BEGIN: com.azure.data.tables.tableAsyncClient.deleteEntity#String-String
- String partitionKey = "partitionKey";
- String rowKey = "rowKey";
-
- tableAsyncClient.deleteEntity(partitionKey, rowKey)
+ tableAsyncClient.deleteEntity("partitionKey", "rowKey")
.contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(unused ->
- System.out.printf("Table entity with partition key '%s' and row key '%s' was deleted.", partitionKey,
- rowKey));
+ System.out.printf("Table entity with partition key '%s' and row key '%s' was deleted.", "partitionKey",
+ "rowKey"));
// END: com.azure.data.tables.tableAsyncClient.deleteEntity#String-String
// BEGIN: com.azure.data.tables.tableAsyncClient.deleteEntity#TableEntity
- String myPartitionKey = "partitionKey";
- String myRowKey = "rowKey";
-
- TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
tableAsyncClient.deleteEntity(myTableEntity)
.contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(unused ->
- System.out.printf("Table entity with partition key '%s' and row key '%s' was created.", partitionKey,
- rowKey));
+ System.out.printf("Table entity with partition key '%s' and row key '%s' was created.", "partitionKey",
+ "rowKey"));
// END: com.azure.data.tables.tableAsyncClient.deleteEntity#TableEntity
// BEGIN: com.azure.data.tables.tableAsyncClient.deleteEntityWithResponse#TableEntity
- String somePartitionKey = "partitionKey";
- String someRowKey = "rowKey";
-
- TableEntity someTableEntity = new TableEntity(somePartitionKey, someRowKey)
+ TableEntity someTableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
tableAsyncClient.deleteEntityWithResponse(someTableEntity, true)
.contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(response ->
System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and"
- + " row key '%s' was deleted.", response.getStatusCode(), somePartitionKey, someRowKey));
+ + " row key '%s' was deleted.", response.getStatusCode(), "partitionKey", "rowKey"));
// END: com.azure.data.tables.tableAsyncClient.deleteEntityWithResponse#TableEntity
}
@@ -266,7 +252,6 @@ public void listEntities() {
// BEGIN: com.azure.data.tables.tableAsyncClient.listEntities
tableAsyncClient.listEntities()
- .contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(tableEntity ->
System.out.printf("Retrieved entity with partition key '%s' and row key '%s'.%n",
tableEntity.getPartitionKey(), tableEntity.getRowKey()));
@@ -284,7 +269,6 @@ public void listEntities() {
.setSelect(propertiesToSelect);
tableAsyncClient.listEntities(listEntitiesOptions)
- .contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(tableEntity -> {
System.out.printf("Retrieved entity with partition key '%s', row key '%s' and properties:%n",
tableEntity.getPartitionKey(), tableEntity.getRowKey());
@@ -303,10 +287,7 @@ public void getEntity() {
TableAsyncClient tableAsyncClient = createAsyncClient();
// BEGIN: com.azure.data.tables.tableAsyncClient.getEntity#String-String
- String partitionKey = "partitionKey";
- String rowKey = "rowKey";
-
- tableAsyncClient.getEntity(partitionKey, rowKey)
+ tableAsyncClient.getEntity("partitionKey", "rowKey")
.contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(tableEntity ->
System.out.printf("Retrieved entity with partition key '%s' and row key '%s'.",
@@ -314,15 +295,12 @@ public void getEntity() {
// END: com.azure.data.tables.tableAsyncClient.getEntity#String-String
// BEGIN: com.azure.data.tables.tableAsyncClient.getEntityWithResponse#String-String-ListEntitiesOptions
- String myPartitionKey = "partitionKey";
- String myRowKey = "rowKey";
-
List propertiesToSelect = new ArrayList<>();
propertiesToSelect.add("name");
propertiesToSelect.add("lastname");
propertiesToSelect.add("age");
- tableAsyncClient.getEntityWithResponse(myPartitionKey, myRowKey, propertiesToSelect)
+ tableAsyncClient.getEntityWithResponse("partitionKey", "rowKey", propertiesToSelect)
.contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(response -> {
TableEntity tableEntity = response.getValue();
diff --git a/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableClientBuilderJavaDocSnippets.java b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableClientBuilderJavaDocSnippets.java
new file mode 100644
index 000000000000..7ef134f0c14a
--- /dev/null
+++ b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableClientBuilderJavaDocSnippets.java
@@ -0,0 +1,101 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+package com.azure.data.tables.codesnippets;
+
+import com.azure.core.credential.AzureNamedKeyCredential;
+import com.azure.core.credential.AzureSasCredential;
+import com.azure.data.tables.TableAsyncClient;
+import com.azure.data.tables.TableClient;
+import com.azure.data.tables.TableClientBuilder;
+import com.azure.identity.DefaultAzureCredentialBuilder;
+
+
+public class TableClientBuilderJavaDocSnippets {
+ /**
+ * Generates a code sample for using {@link TableClientBuilder#buildClient()} using a connection string.
+ */
+ public void buildClientWithConnectionString() {
+ // BEGIN: com.azure.data.tables.tableClientBuilder.connectionString#string
+ TableClient tableClient = new TableClientBuilder()
+ .connectionString("connectionString")
+ .tableName("tableName")
+ .buildClient();
+ // END: com.azure.data.tables.tableClientBuilder.connectionString#string
+ }
+
+ /**
+ * Generates a code sample for using {@link TableClientBuilder#buildClient()} using a SharedKeyCredential.
+ */
+ public void buildClientWithSharedKeyCredential() {
+ // BEGIN: com.azure.data.tables.tableClientBuilder.credential#sharedKeyCredential
+ TableClient tableClient = new TableClientBuilder()
+ .credential(new AzureNamedKeyCredential("name", "key"))
+ .tableName("tableName")
+ .endpoint("endpoint")
+ .buildClient();
+ // END: com.azure.data.tables.tableClientBuilder.credential#sharedKeyCredential
+ }
+
+ /**
+ * Generates a code sample for using {@link TableClientBuilder#buildClient()} using AzureSasCredential.
+ */
+ public void buildClientWithAzureSasCredential() {
+ // BEGIN: com.azure.data.tables.tableClientBuilder.credential#azureSasCredential
+ TableClient tableClient = new TableClientBuilder()
+ .credential(new AzureSasCredential("sasToken"))
+ .endpoint("endpoint")
+ .tableName("tableName")
+ .buildClient();
+ // END: com.azure.data.tables.tableClientBuilder.credential#azureSasCredential
+ }
+
+ /**
+ * Generates a code sample for using {@link TableClientBuilder#buildClient()} using a sas tokwn
+ */
+ public void buildClientWithSasToken() {
+ // BEGIN: com.azure.data.tables.tableClientBuilder.sasToken#string
+ TableClient tableClient = new TableClientBuilder()
+ .sasToken("sasToken")
+ .endpoint("endpoint")
+ .tableName("tableName")
+ .buildClient();
+ // END: com.azure.data.tables.tableClientBuilder.sasToken#string
+ }
+
+ /**
+ * Generates a code sample for using {@link TableClientBuilder#buildClient()} using a token credential.
+ */
+ public void buildClientWithTokenCredential() {
+ // BEGIN: com.azure.data.tables.tableClientBuilder.tokenCredential#tokenCredential
+ TableClient tableClient = new TableClientBuilder()
+ .endpoint("endpoint")
+ .credential(new DefaultAzureCredentialBuilder().build())
+ .tableName("tableName")
+ .buildClient();
+ // END: com.azure.data.tables.tableClientBuilder.tokenCredential#tokenCredential
+ }
+
+ /**
+ * Generates a code sample for using {@link TableClientBuilder#buildAsyncClient()} to build an asynchraonous client.
+ */
+ public void buildAsyncClient() {
+ // BEGIN: com.azure.data.tables.tableClientBuilder.buildAsyncClient
+ TableAsyncClient tableClient = new TableClientBuilder()
+ .connectionString("connectionString")
+ .tableName("tableName")
+ .buildAsyncClient();
+ // END: com.azure.data.tables.tableClientBuilder.buildAsyncClient
+ }
+
+ /**
+ * Generates a code sample for using {@link TableClientBuilder#buildClient()} to build a synchronous client.
+ */
+ public void buildSyncClient() {
+ // BEGIN: com.azure.data.tables.tableClientBuilder.buildClient
+ TableClient tableClient = new TableClientBuilder()
+ .connectionString("connectionString")
+ .tableName("tableName")
+ .buildClient();
+ // END: com.azure.data.tables.tableClientBuilder.buildClient
+ }
+}
diff --git a/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableClientJavaDocCodeSnippets.java b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableClientJavaDocCodeSnippets.java
index 7aa41edd50a4..9cd3361d99bb 100644
--- a/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableClientJavaDocCodeSnippets.java
+++ b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableClientJavaDocCodeSnippets.java
@@ -47,6 +47,23 @@ public TableClient createClient() {
return tableClient;
}
+ /**
+ * Generates a code sample for creating a {@link TableClient} using a connection string.
+ *
+ * @return An instance of {@link TableClient}.
+ */
+ public TableClient createClientWithConnectionString() {
+ // BEGIN: com.azure.data.tables.tableClient.connectionstring.instantiation
+ TableClient tableClient = new TableClientBuilder()
+ .connectionString("connectionstring")
+ .tableName("myTable")
+ .buildClient();
+ // END: com.azure.data.tables.tableClient.connectionstring.instantiation
+
+ return tableClient;
+ }
+
+
/**
* Generates code samples for using {@link TableClient#createTable()} and
* {@link TableClient#createTableWithResponse(Duration, Context)}.
@@ -98,29 +115,24 @@ public void createEntity() {
TableClient tableClient = createClient();
// BEGIN: com.azure.data.tables.tableClient.createEntity#TableEntity
- String partitionKey = "partitionKey";
- String rowKey = "rowKey";
-
- TableEntity tableEntity = new TableEntity(partitionKey, rowKey)
+ TableEntity tableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
tableClient.createEntity(tableEntity);
- System.out.printf("Table entity with partition key '%s' and row key: '%s' was created.", partitionKey, rowKey);
+ System.out.printf("Table entity with partition key '%s' and row key: '%s' was created.", "partitionKey", "rowKey");
// END: com.azure.data.tables.tableClient.createEntity#TableEntity
// BEGIN: com.azure.data.tables.tableClient.createEntityWithResponse#TableEntity-Duration-Context
- String myPartitionKey = "partitionKey";
- String myRowKey = "rowKey";
- TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
Response response = tableClient.createEntityWithResponse(myTableEntity, Duration.ofSeconds(5),
new Context("key1", "value1"));
System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and row key"
- + " '%s' was created.", response.getStatusCode(), myPartitionKey, myRowKey);
+ + " '%s' was created.", response.getStatusCode(), "partitionKey", "rowKey");
// END: com.azure.data.tables.tableClient.createEntityWithResponse#TableEntity-Duration-Context
}
@@ -132,30 +144,24 @@ public void upsertEntity() {
TableClient tableClient = createClient();
// BEGIN: com.azure.data.tables.tableClient.upsertEntity#TableEntity
- String partitionKey = "partitionKey";
- String rowKey = "rowKey";
-
- TableEntity tableEntity = new TableEntity(partitionKey, rowKey)
+ TableEntity tableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
tableClient.upsertEntity(tableEntity);
- System.out.printf("Table entity with partition key '%s' and row key: '%s' was updated/created.", partitionKey,
- rowKey);
+ System.out.printf("Table entity with partition key '%s' and row key: '%s' was updated/created.", "partitionKey",
+ "rowKey");
// END: com.azure.data.tables.tableClient.upsertEntity#TableEntity
// BEGIN: com.azure.data.tables.tableClient.upsertEntityWithResponse#TableEntity-TableEntityUpdateMode-Duration-Context
- String myPartitionKey = "partitionKey";
- String myRowKey = "rowKey";
-
- TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
Response response = tableClient.upsertEntityWithResponse(myTableEntity, TableEntityUpdateMode.REPLACE,
Duration.ofSeconds(5), new Context("key1", "value1"));
System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and row key"
- + " '%s' was updated/created.", response.getStatusCode(), partitionKey, rowKey);
+ + " '%s' was updated/created.", response.getStatusCode(), "partitionKey", "rowKey");
// END: com.azure.data.tables.tableClient.upsertEntityWithResponse#TableEntity-TableEntityUpdateMode-Duration-Context
}
@@ -168,43 +174,35 @@ public void updateEntity() {
TableClient tableClient = createClient();
// BEGIN: com.azure.data.tables.tableClient.updateEntity#TableEntity
- String partitionKey = "partitionKey";
- String rowKey = "rowKey";
-
- TableEntity tableEntity = new TableEntity(partitionKey, rowKey)
+ TableEntity tableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
tableClient.updateEntity(tableEntity);
- System.out.printf("Table entity with partition key '%s' and row key: '%s' was updated/created.", partitionKey,
- rowKey);
+ System.out.printf("Table entity with partition key '%s' and row key: '%s' was updated/created.", "partitionKey",
+ "rowKey");
// END: com.azure.data.tables.tableClient.updateEntity#TableEntity
// BEGIN: com.azure.data.tables.tableClient.updateEntity#TableEntity-TableEntityUpdateMode
- String myPartitionKey = "partitionKey";
- String myRowKey = "rowKey";
- TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ TableEntity myTableEntity = new TableEntity("paritionKey", "rowKey")
.addProperty("Property", "Value");
tableClient.updateEntity(myTableEntity, TableEntityUpdateMode.REPLACE);
- System.out.printf("Table entity with partition key '%s' and row key: '%s' was updated/created.", partitionKey,
- rowKey);
+ System.out.printf("Table entity with partition key '%s' and row key: '%s' was updated/created.", "partitionKey",
+ "rowKey");
// END: com.azure.data.tables.tableClient.updateEntity#TableEntity-TableEntityUpdateMode
// BEGIN: com.azure.data.tables.tableClient.updateEntityWithResponse#TableEntity-TableEntityUpdateMode-boolean-Duration-Context
- String somePartitionKey = "partitionKey";
- String someRowKey = "rowKey";
-
- TableEntity someTableEntity = new TableEntity(somePartitionKey, someRowKey)
+ TableEntity someTableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
Response response = tableClient.updateEntityWithResponse(someTableEntity, TableEntityUpdateMode.REPLACE,
true, Duration.ofSeconds(5), new Context("key1", "value1"));
System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and row key"
- + " '%s' was updated.", response.getStatusCode(), partitionKey, rowKey);
+ + " '%s' was updated.", response.getStatusCode(), "partitionKey", "rowKey");
// END: com.azure.data.tables.tableClient.updateEntityWithResponse#TableEntity-TableEntityUpdateMode-boolean-Duration-Context
}
@@ -217,38 +215,29 @@ public void deleteEntity() {
TableClient tableClient = createClient();
// BEGIN: com.azure.data.tables.tableClient.deleteEntity#String-String
- String partitionKey = "partitionKey";
- String rowKey = "rowKey";
-
- tableClient.deleteEntity(partitionKey, rowKey);
+ tableClient.deleteEntity("partitionKey", "rowKey");
- System.out.printf("Table entity with partition key '%s' and row key: '%s' was deleted.", partitionKey, rowKey);
+ System.out.printf("Table entity with partition key '%s' and row key: '%s' was deleted.", "partitionKey", "rowKey");
// END: com.azure.data.tables.tableClient.deleteEntity#String-String
// BEGIN: com.azure.data.tables.tableClient.deleteEntity#TableEntity
- String myPartitionKey = "partitionKey";
- String myRowKey = "rowKey";
-
- TableEntity myTableEntity = new TableEntity(myPartitionKey, myRowKey)
+ TableEntity myTableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
tableClient.deleteEntity(myTableEntity);
- System.out.printf("Table entity with partition key '%s' and row key: '%s' was created.", partitionKey, rowKey);
+ System.out.printf("Table entity with partition key '%s' and row key: '%s' was created.", "partitionKey", "rowKey");
// END: com.azure.data.tables.tableClient.deleteEntity#TableEntity
// BEGIN: com.azure.data.tables.tableClient.deleteEntityWithResponse#TableEntity-Duration-Context
- String somePartitionKey = "partitionKey";
- String someRowKey = "rowKey";
-
- TableEntity someTableEntity = new TableEntity(somePartitionKey, someRowKey)
+ TableEntity someTableEntity = new TableEntity("partitionKey", "rowKey")
.addProperty("Property", "Value");
Response response = tableClient.deleteEntityWithResponse(someTableEntity, true, Duration.ofSeconds(5),
new Context("key1", "value1"));
System.out.printf("Response successful with status code: %d. Table entity with partition key '%s' and row key"
- + " '%s' was deleted.", response.getStatusCode(), somePartitionKey, someRowKey);
+ + " '%s' was deleted.", response.getStatusCode(), "partitionKey", "rowKey");
// END: com.azure.data.tables.tableClient.deleteEntityWithResponse#TableEntity-Duration-Context
}
@@ -279,7 +268,7 @@ public void listEntities() {
.setSelect(propertiesToSelect);
PagedIterable myTableEntities = tableClient.listEntities(listEntitiesOptions,
- Duration.ofSeconds(5), new Context("key1", "value1"));
+ Duration.ofSeconds(5), null);
myTableEntities.forEach(tableEntity -> {
System.out.printf("Retrieved entity with partition key '%s', row key '%s' and properties:%n",
@@ -299,25 +288,19 @@ public void getEntity() {
TableClient tableClient = createClient();
// BEGIN: com.azure.data.tables.tableClient.getEntity#String-String
- String partitionKey = "partitionKey";
- String rowKey = "rowKey";
-
- TableEntity tableEntity = tableClient.getEntity(partitionKey, rowKey);
+ TableEntity tableEntity = tableClient.getEntity("partitionKey", "rowKey");
System.out.printf("Retrieved entity with partition key '%s' and row key '%s'.", tableEntity.getPartitionKey(),
tableEntity.getRowKey());
// END: com.azure.data.tables.tableClient.getEntity#String-String
// BEGIN: com.azure.data.tables.tableClient.getEntityWithResponse#String-String-ListEntitiesOptions-Duration-Context
- String myPartitionKey = "partitionKey";
- String myRowKey = "rowKey";
-
List propertiesToSelect = new ArrayList<>();
propertiesToSelect.add("name");
propertiesToSelect.add("lastname");
propertiesToSelect.add("age");
- Response response = tableClient.getEntityWithResponse(myPartitionKey, myRowKey, propertiesToSelect,
+ Response response = tableClient.getEntityWithResponse("partitionKey", "rowKey", propertiesToSelect,
Duration.ofSeconds(5), new Context("key1", "value1"));
TableEntity myTableEntity = response.getValue();
diff --git a/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableEntityJavaDocCodeSnippets.java b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableEntityJavaDocCodeSnippets.java
new file mode 100644
index 000000000000..4775849f18a0
--- /dev/null
+++ b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableEntityJavaDocCodeSnippets.java
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.data.tables.codesnippets;
+
+import com.azure.data.tables.models.TableEntity;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TableEntityJavaDocCodeSnippets {
+
+ public void createTableEntity() {
+ // BEGIN: com.azure.data.tables.models.TableEntity.create#string-string
+ TableEntity entity = new TableEntity("partitionKey", "rowKey");
+ // END: com.azure.data.tables.models.TableEntity.create#string-string
+ }
+
+ public void addProperties() {
+ // BEGIN: com.azure.data.tables.models.TableEntity.addProperty#string-object
+ TableEntity entity = new TableEntity("partitionKey", "rowKey")
+ .addProperty("String", "StringValue")
+ .addProperty("Integer", 100)
+ .addProperty("Boolean", true);
+ // END: com.azure.data.tables.models.TableEntity.addProperty#string-object
+ }
+
+ public void setPropertyMap() {
+ // BEGIN: com.azure.data.tables.models.TableEntity.setProperties#map
+ Map properties = new HashMap<>();
+ properties.put("String", "StringValue");
+ properties.put("Integer", 100);
+ properties.put("Boolean", true);
+ TableEntity entity = new TableEntity("partitionKey", "rowKey")
+ .setProperties(properties);
+ // END: com.azure.data.tables.models.TableEntity.setProperties#map
+ }
+
+ public void getProperty() {
+ // BEGIN: com.azure.data.tables.models.TableEntity.getProperty#string
+ TableEntity entity = new TableEntity("partitionKey", "rowKey")
+ .addProperty("String", "StringValue")
+ .addProperty("Integer", 100)
+ .addProperty("Boolean", true);
+
+ String stringValue = (String) entity.getProperty("String");
+ int integerValue = (int) entity.getProperty("Integer");
+ boolean booleanValue = (boolean) entity.getProperty("Boolean");
+ // END: com.azure.data.tables.models.TableEntity.getProperty#string
+ }
+
+ public void getAllProperties() {
+ // BEGIN: com.azure.data.tables.models.TableEntity.getProperties
+ TableEntity entity = new TableEntity("partitionKey", "rowKey")
+ .addProperty("String", "StringValue")
+ .addProperty("Integer", 100)
+ .addProperty("Boolean", true);
+
+ Map properties = entity.getProperties();
+ // END: com.azure.data.tables.models.TableEntity.getProperties
+ }
+
+}
diff --git a/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceAsyncClientJavaDocCodeSnippets.java b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceAsyncClientJavaDocCodeSnippets.java
index 4d24de740755..27785f05dbe0 100644
--- a/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceAsyncClientJavaDocCodeSnippets.java
+++ b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceAsyncClientJavaDocCodeSnippets.java
@@ -3,6 +3,7 @@
package com.azure.data.tables.codesnippets;
import com.azure.core.credential.AzureNamedKeyCredential;
+import com.azure.data.tables.TableAsyncClient;
import com.azure.data.tables.TableServiceAsyncClient;
import com.azure.data.tables.TableServiceClientBuilder;
import com.azure.data.tables.models.ListTablesOptions;
@@ -32,6 +33,21 @@ public TableServiceAsyncClient createAsyncClient() {
return tableServiceAsyncClient;
}
+ /**
+ * Generates a code sample for creating a {@link TableServiceAsyncClient} using a connection string.
+ *
+ * @return An instance of {@link TableServiceAsyncClient}.
+ */
+ public TableServiceAsyncClient createAsyncWithConnectionString() {
+ // BEGIN: com.azure.data.tables.tableServiceAsyncClient.instantiation.connectionstring
+ TableServiceAsyncClient tableServiceAsyncClient = new TableServiceClientBuilder()
+ .connectionString("connectionstring")
+ .buildAsyncClient();
+ // END: com.azure.data.tables.tableServiceAsyncClient.instantiation.connectionstring
+
+ return tableServiceAsyncClient;
+ }
+
/**
* Generates code samples for using {@link TableServiceAsyncClient#createTable(String)} and
* {@link TableServiceAsyncClient#createTableWithResponse(String)}.
@@ -55,6 +71,21 @@ public void createTable() {
// END: com.azure.data.tables.tableServiceAsyncClient.createTableWithResponse#String
}
+ /**
+ * Generates code samples for using {@link TableServiceAsyncClient#getTableClient(String)}
+ */
+ public void getTableClient() {
+ TableServiceAsyncClient tableServiceAsyncClient = createAsyncClient();
+
+ // BEGIN: com.azure.data.tables.tableServiceAsyncClient.getTableClient#String
+ TableAsyncClient tableAsyncClient = tableServiceAsyncClient.getTableClient("myTable");
+
+ System.out.printf("Table with name '%s' was retrieved.", tableAsyncClient.getTableName());
+ // END: com.azure.data.tables.tableServiceAsyncClient.getTableClient#String
+ }
+
+
+
/**
* Generates code samples for using {@link TableServiceAsyncClient#createTableIfNotExists(String)} and
* {@link TableServiceAsyncClient#createTableIfNotExistsWithResponse(String)}.
@@ -86,22 +117,18 @@ public void deleteTable() {
TableServiceAsyncClient tableServiceAsyncClient = createAsyncClient();
// BEGIN: com.azure.data.tables.tableServiceAsyncClient.deleteTable#String
- String tableName = "myTable";
-
- tableServiceAsyncClient.deleteTable(tableName)
+ tableServiceAsyncClient.deleteTable("myTable")
.contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(unused ->
- System.out.printf("Table with name '%s' was deleted.", tableName));
+ System.out.printf("Table with name '%s' was deleted.", "myTable"));
// END: com.azure.data.tables.tableServiceAsyncClient.deleteTable#String
// BEGIN: com.azure.data.tables.tableServiceAsyncClient.deleteTableWithResponse#String
- String myTableName = "myTable";
-
- tableServiceAsyncClient.deleteTableWithResponse(myTableName)
+ tableServiceAsyncClient.deleteTableWithResponse("myTable")
.contextWrite(Context.of("key1", "value1", "key2", "value2"))
.subscribe(response ->
System.out.printf("Response successful with status code: %d. Table with name '%s' was deleted.",
- response.getStatusCode(), myTableName));
+ response.getStatusCode(), "myTable"));
// END: com.azure.data.tables.tableServiceAsyncClient.deleteTableWithResponse#String
}
@@ -118,10 +145,8 @@ public void listTables() {
// END: com.azure.data.tables.tableServiceAsyncClient.listTables
// BEGIN: com.azure.data.tables.tableServiceAsyncClient.listTables#ListTablesOptions
- ListTablesOptions options = new ListTablesOptions().setFilter("TableName eq 'myTable'");
-
- tableServiceAsyncClient.listTables(options).subscribe(tableItem ->
- System.out.printf("Retrieved table with name '%s'.%n", tableItem.getName()));
+ tableServiceAsyncClient.listTables(new ListTablesOptions().setFilter("TableName eq 'myTable'")).
+ subscribe(tableItem -> System.out.printf("Retrieved table with name '%s'.%n", tableItem.getName()));
// END: com.azure.data.tables.tableServiceAsyncClient.listTables#ListTablesOptions
}
diff --git a/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceClientBuilderJavaDocCodeSnippets.java b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceClientBuilderJavaDocCodeSnippets.java
new file mode 100644
index 000000000000..2a9b9e07c123
--- /dev/null
+++ b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceClientBuilderJavaDocCodeSnippets.java
@@ -0,0 +1,94 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+package com.azure.data.tables.codesnippets;
+
+import com.azure.core.credential.AzureNamedKeyCredential;
+import com.azure.core.credential.AzureSasCredential;
+import com.azure.data.tables.TableServiceAsyncClient;
+import com.azure.data.tables.TableServiceClient;
+import com.azure.data.tables.TableServiceClientBuilder;
+import com.azure.identity.DefaultAzureCredentialBuilder;
+
+public class TableServiceClientBuilderJavaDocCodeSnippets {
+
+ /**
+ * Generates a code sample for using {@link TableServiceClientBuilder#buildClient()} using a connection string.
+ */
+ public void buildClientWithConnectionString() {
+ // BEGIN: com.azure.data.tables.tableServiceClientBuilder.connectionString#string
+ TableServiceClient tableServiceClient = new TableServiceClientBuilder()
+ .connectionString("connectionstring")
+ .buildClient();
+ // END: com.azure.data.tables.tableServiceClientBuilder.connectionString#string
+ }
+
+ /**
+ * Generates a code sample for using {@link TableServiceClientBuilder#buildClient()} using SharedKeyCredential.
+ */
+ public void buildClientWithSharedKeyCredential() {
+ // BEGIN: com.azure.data.tables.tableServiceClientBuilder.credential#sharedKeyCredential
+ TableServiceClient tableServiceClient = new TableServiceClientBuilder()
+ .endpoint("endpoint")
+ .credential(new AzureNamedKeyCredential("name", "key"))
+ .buildClient();
+ // END: com.azure.data.tables.tableServiceClientBuilder.credential#sharedKeyCredential
+ }
+
+ /**
+ * Generates a code sample for using {@link TableServiceClientBuilder#buildClient()} using AzureSasCredential.
+ */
+ public void buildClientWithAzureSasCredential() {
+ // BEGIN: com.azure.data.tables.tableServiceClientBuilder.credential#azureSasCredential
+ TableServiceClient tableServiceClient = new TableServiceClientBuilder()
+ .endpoint("endpoint")
+ .credential(new AzureSasCredential("sasToken"))
+ .buildClient();
+ // END: com.azure.data.tables.tableServiceClientBuilder.credential#azureSasCredential
+ }
+
+ /**
+ * Generates a code sample for using {@link TableServiceClientBuilder#buildClient()} using a SAS token.
+ */
+ public void buildClientWithSasToken() {
+ // BEGIN: com.azure.data.tables.tableServiceClientBuilder.sasToken#string
+ TableServiceClient tableServiceClient = new TableServiceClientBuilder()
+ .endpoint("endpoint")
+ .sasToken("sasToken")
+ .buildClient();
+ // END: com.azure.data.tables.tableServiceClientBuilder.sasToken#string
+ }
+
+ /**
+ * Generates a code sample for using {@link TableServiceClientBuilder#buildClient()} using a TokenCredential.
+ */
+ public void buildClientWithTokenCredential() {
+ // BEGIN: com.azure.data.tables.tableServiceClientBuilder.credential#tokenCredential
+ TableServiceClient tableServiceClient = new TableServiceClientBuilder()
+ .endpoint("endpoint")
+ .credential(new DefaultAzureCredentialBuilder().build())
+ .buildClient();
+ // END: com.azure.data.tables.tableServiceClientBuilder.credential#tokenCredential
+ }
+
+ /**
+ * Generates a code sample for using {@link TableServiceClientBuilder#buildClient()} to build a synchronous client.
+ */
+ public void buildSyncClient() {
+ // BEGIN: com.azure.data.tables.tableServiceClientBuilder.sync
+ TableServiceClient tableServiceClient = new TableServiceClientBuilder()
+ .connectionString("connectionString")
+ .buildClient();
+ // END: com.azure.data.tables.tableServiceClientBuilder.sync
+ }
+
+ /**
+ * Generates a code sample for using {@link TableServiceClientBuilder#buildAsyncClient()} to build an asynchronous client.
+ */
+ public void buildAsyncClient() {
+ // BEGIN: com.azure.data.tables.tableServiceClientBuilder.async
+ TableServiceAsyncClient tableServiceClient = new TableServiceClientBuilder()
+ .connectionString("connectionString")
+ .buildAsyncClient();
+ // END: com.azure.data.tables.tableServiceClientBuilder.async
+ }
+}
diff --git a/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceClientJavaDocCodeSnippets.java b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceClientJavaDocCodeSnippets.java
index a140b743bf39..7cfb3829f02b 100644
--- a/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceClientJavaDocCodeSnippets.java
+++ b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceClientJavaDocCodeSnippets.java
@@ -28,7 +28,7 @@ public class TableServiceClientJavaDocCodeSnippets {
*
* @return An instance of {@link TableServiceClient}.
*/
- public TableServiceClient createAsyncClient() {
+ public TableServiceClient createClient() {
// BEGIN: com.azure.data.tables.tableServiceClient.instantiation
TableServiceClient tableServiceClient = new TableServiceClientBuilder()
.endpoint("https://myvault.azure.net/")
@@ -39,12 +39,42 @@ public TableServiceClient createAsyncClient() {
return tableServiceClient;
}
+ /**
+ * Generates a code sample for creating a {@link TableServiceClient} using a connection string.
+ *
+ * @return An instance of {@link TableServiceClient}.
+ */
+ public TableServiceClient createClientWithConnectionString() {
+ // BEGIN: com.azure.data.tables.tableServiceClient.connectionstring.instantiation
+ TableServiceClient tableServiceClient = new TableServiceClientBuilder()
+ .connectionString("connectionstring")
+ .buildClient();
+ // END: com.azure.data.tables.tableServiceClient.connectionstring.instantiation
+
+ return tableServiceClient;
+ }
+
+ /**
+ * Generates code samples for using {@link TableServiceClient#getTableClient(String)}.
+ */
+ public void getTableClient() {
+ TableServiceClient tableServiceClient = createClient();
+
+ // BEGIN: com.azure.data.tables.tableServiceClient.getTableClient#String
+ TableClient tableClient = tableServiceClient.getTableClient("myTable");
+
+ System.out.printf("Table with name '%s' was retrieved.", tableClient.getTableName());
+ // END: com.azure.data.tables.tableServiceClient.getTableClient#String
+ }
+
+
+
/**
* Generates code samples for using {@link TableServiceClient#createTable(String)} and
* {@link TableServiceClient#createTableWithResponse(String, Duration, Context)}.
*/
public void createTable() {
- TableServiceClient tableServiceClient = createAsyncClient();
+ TableServiceClient tableServiceClient = createClient();
// BEGIN: com.azure.data.tables.tableServiceClient.createTable#String
TableClient tableClient = tableServiceClient.createTable("myTable");
@@ -66,7 +96,7 @@ public void createTable() {
* {@link TableServiceClient#createTableIfNotExistsWithResponse(String, Duration, Context)}.
*/
public void createTableIfNotExists() {
- TableServiceClient tableServiceClient = createAsyncClient();
+ TableServiceClient tableServiceClient = createClient();
// BEGIN: com.azure.data.tables.tableServiceClient.createTableIfNotExists#String
TableClient tableClient = tableServiceClient.createTableIfNotExists("myTable");
@@ -89,24 +119,20 @@ public void createTableIfNotExists() {
* {@link TableServiceClient#deleteTableWithResponse(String, Duration, Context)}.
*/
public void deleteTable() {
- TableServiceClient tableServiceClient = createAsyncClient();
+ TableServiceClient tableServiceClient = createClient();
// BEGIN: com.azure.data.tables.tableServiceClient.deleteTable#String
- String tableName = "myTable";
+ tableServiceClient.deleteTable("myTable");
- tableServiceClient.deleteTable(tableName);
-
- System.out.printf("Table with name '%s' was deleted.", tableName);
+ System.out.printf("Table with name '%s' was deleted.", "myTable");
// END: com.azure.data.tables.tableServiceClient.deleteTable#String
// BEGIN: com.azure.data.tables.tableServiceClient.deleteTableWithResponse#String-Duration-Context
- String myTableName = "myTable";
-
- Response response = tableServiceClient.deleteTableWithResponse(myTableName, Duration.ofSeconds(5),
+ Response response = tableServiceClient.deleteTableWithResponse("myTable", Duration.ofSeconds(5),
new Context("key1", "value1"));
System.out.printf("Response successful with status code: %d. Table with name '%s' was deleted.",
- response.getStatusCode(), myTableName);
+ response.getStatusCode(), "myTable");
// END: com.azure.data.tables.tableServiceClient.deleteTableWithResponse#String-Duration-Context
}
@@ -115,7 +141,7 @@ public void deleteTable() {
* {@link TableServiceClient#listTables(ListTablesOptions, Duration, Context)}.
*/
public void listTables() {
- TableServiceClient tableServiceClient = createAsyncClient();
+ TableServiceClient tableServiceClient = createClient();
// BEGIN: com.azure.data.tables.tableServiceClient.listTables
PagedIterable tableItems = tableServiceClient.listTables();
@@ -140,7 +166,7 @@ public void listTables() {
* {@link TableServiceClient#getPropertiesWithResponse(Duration, Context)}.
*/
public void getProperties() {
- TableServiceClient tableServiceClient = createAsyncClient();
+ TableServiceClient tableServiceClient = createClient();
// BEGIN: com.azure.data.tables.tableServiceClient.getProperties
TableServiceProperties properties = tableServiceClient.getProperties();
@@ -161,7 +187,7 @@ public void getProperties() {
* {@link TableServiceClient#setPropertiesWithResponse(TableServiceProperties, Duration, Context)}.
*/
public void setProperties() {
- TableServiceClient tableServiceClient = createAsyncClient();
+ TableServiceClient tableServiceClient = createClient();
// BEGIN: com.azure.data.tables.tableServiceClient.setProperties#TableServiceProperties
TableServiceProperties properties = new TableServiceProperties()
@@ -181,7 +207,7 @@ public void setProperties() {
tableServiceClient.setProperties(properties);
- System.out.print("Set service properties successfully.");
+ System.out.printf("Set service properties successfully.");
// END: com.azure.data.tables.tableServiceClient.setProperties#TableServiceProperties
// BEGIN: com.azure.data.tables.tableServiceClient.setPropertiesWithResponse#TableServiceProperties-Duration-Context
@@ -212,7 +238,7 @@ public void setProperties() {
* {@link TableServiceClient#getStatisticsWithResponse(Duration, Context)}.
*/
public void getStatistics() {
- TableServiceClient tableServiceClient = createAsyncClient();
+ TableServiceClient tableServiceClient = createClient();
// BEGIN: com.azure.data.tables.tableServiceClient.getStatistics
TableServiceStatistics statistics = tableServiceClient.getStatistics();
diff --git a/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TablesPackageInfoJavaDocCodeSnippets.java b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TablesPackageInfoJavaDocCodeSnippets.java
new file mode 100644
index 000000000000..5949491556a4
--- /dev/null
+++ b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TablesPackageInfoJavaDocCodeSnippets.java
@@ -0,0 +1,166 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+package com.azure.data.tables.codesnippets;
+
+import com.azure.data.tables.TableAsyncClient;
+import com.azure.data.tables.TableClient;
+import com.azure.data.tables.TableClientBuilder;
+import com.azure.data.tables.TableServiceAsyncClient;
+import com.azure.data.tables.TableServiceClient;
+import com.azure.data.tables.TableServiceClientBuilder;
+import com.azure.data.tables.models.TableEntity;
+
+public class TablesPackageInfoJavaDocCodeSnippets {
+ /**
+ * Generates code sample for creating a {@link TableServiceClient}.
+ * @return TablesServiceClient object.
+ */
+ public TableServiceClient createTableServiceClient() {
+ // BEGIN: com.azure.data.tables.TableServiceClient.instantiation.package
+ TableServiceClient tableServiceClient = new TableServiceClientBuilder()
+ .connectionString("connectionstring")
+ .buildClient();
+ // END: com.azure.data.tables.TableServiceClient.instantiation.package
+ return tableServiceClient;
+ }
+
+ /**
+ * Generates code sample for creating a {@link TableServiceAsyncClient}.
+ * @return TablesServiceAsyncClient object.
+ */
+ public TableServiceAsyncClient createTableServiceAsyncClient() {
+ // BEGIN: com.azure.data.tables.TableServiceAsyncClient.instantiation.package
+ TableServiceAsyncClient tableServiceAsyncClient = new TableServiceClientBuilder()
+ .connectionString("connectionstring")
+ .buildAsyncClient();
+ // END: com.azure.data.tables.TableServiceAsyncClient.instantiation.package
+ return tableServiceAsyncClient;
+ }
+
+ /**
+ * Generates code sample for creating a {@link TableClient} with {@link TableServiceClient}.
+ * @return TablesClient object.
+ */
+ public TableClient createTableClientFromServiceClient() {
+ TableServiceClient tableServiceClient = createTableServiceClient();
+ // BEGIN: com.azure.data.tables.TableClient.instantiationFromServiceClient.package
+ TableClient tableClient = tableServiceClient.getTableClient("tableName");
+ // END: com.azure.data.tables.TableClient.instantiationFromServiceClient.package
+ return tableClient;
+ }
+
+ /**
+ * Generates code sample for creating a {@link TableClient} with {@link TableClientBuilder}.
+ * @return TableClient object.
+ */
+ public TableClient createTableClientFromBuilder() {
+ // BEGIN: com.azure.data.tables.TableClient.instantiationFromBuilder.package
+ TableClient tableClient = new TableClientBuilder()
+ .connectionString("connectionstring")
+ .tableName("tableName")
+ .buildClient();
+ // END: com.azure.data.tables.TableClient.instantiationFromBuilder.package
+ return tableClient;
+ }
+
+ /**
+ * Generates code sample for creating a {@link TableAsyncClient} with {@link TableClientBuilder}.
+ * @return TableAsyncClient object.
+ */
+ public TableAsyncClient createTableAsyncClientFromBuilder() {
+ // BEGIN: com.azure.data.tables.TableClient.instantiationFromBuilder.package#async
+ TableAsyncClient tableClient = new TableClientBuilder()
+ .connectionString("connectionstring")
+ .tableName("tableName")
+ .buildAsyncClient();
+ // END: com.azure.data.tables.TableClient.instantiationFromBuilder.package#async
+ return tableClient;
+ }
+
+ /**
+ * Generates code sample for creating a {@link TableAsyncClient} with {@link TableServiceAsyncClient}.
+ * @return TableAsyncClient object.
+ */
+ public TableAsyncClient createTableAsyncClientFromServiceAsyncClient() {
+ TableServiceAsyncClient tableServiceAsyncClient = createTableServiceAsyncClient();
+ // BEGIN: com.azure.data.tables.TableAsyncClient.instantiationFromServiceAsyncClient.package
+ TableAsyncClient tableAsyncClient = tableServiceAsyncClient.getTableClient("tableName");
+ // END: com.azure.data.tables.TableAsyncClient.instantiationFromServiceAsyncClient.package
+ return tableAsyncClient;
+ }
+
+ //create a table using TableServiceClient
+ public void createTable() {
+ TableServiceClient tableServiceClient = createTableServiceClient();
+ // BEGIN: com.azure.data.tables.TableServiceClient.createTable.package#String
+ tableServiceClient.createTable("tableName");
+ // END: com.azure.data.tables.TableServiceClient.createTable.package#String
+ }
+
+ //list tables using TableServiceClient
+ public void listTables() {
+ TableServiceClient tableServiceClient = createTableServiceClient();
+ // BEGIN: com.azure.data.tables.TableServiceClient.listTables.package
+ tableServiceClient.listTables().forEach(table -> {
+ String tableName = table.getName();
+ System.out.println("Table name: " + tableName);
+ });
+ // END: com.azure.data.tables.TableServiceClient.listTables.package
+ }
+
+ //delete a table using TableServiceClient
+ public void deleteTable() {
+ TableServiceClient tableServiceClient = createTableServiceClient();
+ // BEGIN: com.azure.data.tables.TableServiceClient.deleteTable.package#String
+ tableServiceClient.deleteTable("tableName");
+ // END: com.azure.data.tables.TableServiceClient.deleteTable.package#String
+ }
+
+ //Return a TableClient from TableServiceClient
+ public TableClient getTableClient() {
+ TableServiceClient tableServiceClient = createTableServiceClient();
+ // BEGIN: com.azure.data.tables.TableServiceClient.getTableClient.package#String
+ TableClient tableClient = tableServiceClient.getTableClient("tableName");
+ // END: com.azure.data.tables.TableServiceClient.getTableClient.package#String
+ return tableClient;
+ }
+
+ //Create an Entity using TableClient
+ public void createEntity() {
+ TableClient tableClient = createTableClientFromBuilder();
+ // BEGIN: com.azure.data.tables.TableClient.createEntity.package#Map
+ tableClient.createEntity(new TableEntity("partitionKey", "rowKey")
+ .addProperty("property", "value"));
+ // END: com.azure.data.tables.TableClient.createEntity.package#Map
+ }
+
+ //Retrieve and update an entity using TableClient
+ public void updateEntity() {
+ TableClient tableClient = createTableClientFromBuilder();
+ // BEGIN: com.azure.data.tables.TableClient.updateEntity.package#TableEntity
+ TableEntity entity = tableClient.getEntity("partitionKey", "rowKey");
+ entity.addProperty("newProperty", "newValue");
+ tableClient.updateEntity(entity);
+ // END: com.azure.data.tables.TableClient.updateEntity.package#TableEntity
+ }
+
+ //List entities using TableClient
+ public void listEntities() {
+ TableClient tableClient = createTableClientFromBuilder();
+ // BEGIN: com.azure.data.tables.TableClient.listEntities.package
+ tableClient.listEntities().forEach(entity -> {
+ String partitionKey = entity.getPartitionKey();
+ String rowKey = entity.getRowKey();
+ System.out.println("Partition key: " + partitionKey + ", Row key: " + rowKey);
+ });
+ // END: com.azure.data.tables.TableClient.listEntities.package
+ }
+
+ //Delete an entity using TableClient
+ public void deleteEntity() {
+ TableClient tableClient = createTableClientFromBuilder();
+ // BEGIN: com.azure.data.tables.TableClient.deleteEntity.package#TableEntity
+ tableClient.deleteEntity("partitionKey", "rowKey");
+ // END: com.azure.data.tables.TableClient.deleteEntity.package#TableEntity
+ }
+}