Skip to content

Commit

Permalink
adding code snippets for BlobService Sync and Async clients
Browse files Browse the repository at this point in the history
  • Loading branch information
vhvb1989 committed Sep 7, 2019
1 parent f5720b7 commit 5ad65b4
Show file tree
Hide file tree
Showing 4 changed files with 589 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public final class BlobServiceAsyncClient {
* create a container. It simply constructs the URL to the container and offers access to methods relevant to
* containers.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getContainerAsyncClient#String}
*
* @param containerName The name of the container to point to.
* @return A {@link ContainerAsyncClient} object pointing to the specified container
*/
Expand All @@ -98,6 +102,10 @@ public ContainerAsyncClient getContainerAsyncClient(String containerName) {
* fails. For more information, see the
* <a href="https://docs.microsoft.com/rest/api/storageservices/create-container">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.createContainer#String}
*
* @param containerName Name of the container to create
* @return A {@link Mono} containing a {@link ContainerAsyncClient} used to interact with the container created.
*/
Expand All @@ -110,6 +118,10 @@ public Mono<ContainerAsyncClient> createContainer(String containerName) {
* fails. For more information, see the
* <a href="https://docs.microsoft.com/rest/api/storageservices/create-container">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.createContainerWithResponse#String-Metadata-PublicAccessType}
*
* @param containerName Name of the container to create
* @param metadata {@link Metadata}
* @param accessType Specifies how the data in this container is available to the public. See the
Expand All @@ -132,6 +144,9 @@ Mono<Response<ContainerAsyncClient>> createContainerWithResponse(String containe
* Deletes the specified container in the storage account. If the container doesn't exist the operation fails. For
* more information see the <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/delete-container">Azure
* Docs</a>.
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.deleteContainer#String}
*
* @param containerName Name of the container to delete
* @return A {@link Mono} containing containing status code and HTTP headers
Expand All @@ -145,6 +160,10 @@ public Mono<Void> deleteContainer(String containerName) {
* more information see the <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/delete-container">Azure
* Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.deleteContainerWithResponse#String-Context}
*
* @param containerName Name of the container to delete
* @return A {@link Mono} containing containing status code and HTTP headers
*/
Expand Down Expand Up @@ -174,6 +193,10 @@ public URL getAccountUrl() {
* Returns a reactive Publisher emitting all the containers in this account lazily as needed. For more information,
* see the <a href="https://docs.microsoft.com/rest/api/storageservices/list-containers2">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.listContainers}
*
* @return A reactive response emitting the list of containers.
*/
public PagedFlux<ContainerItem> listContainers() {
Expand All @@ -184,6 +207,10 @@ public PagedFlux<ContainerItem> listContainers() {
* Returns a reactive Publisher emitting all the containers in this account lazily as needed. For more information,
* see the <a href="https://docs.microsoft.com/rest/api/storageservices/list-containers2">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.listContainers#ListContainersOptions}
*
* @param options A {@link ListContainersOptions} which specifies what data should be returned by the service.
* @return A reactive response emitting the list of containers.
*/
Expand Down Expand Up @@ -251,6 +278,10 @@ private Mono<ServicesListContainersSegmentResponse> listContainersSegment(String
* Gets the properties of a storage account’s Blob service. For more information, see the
* <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-properties">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getProperties}
*
* @return A reactive response containing the storage account properties.
*/
public Mono<StorageServiceProperties> getProperties() {
Expand All @@ -261,6 +292,10 @@ public Mono<StorageServiceProperties> getProperties() {
* Gets the properties of a storage account’s Blob service. For more information, see the
* <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-properties">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getPropertiesWithResponse}
*
* @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the storage
* account properties.
*/
Expand All @@ -280,27 +315,34 @@ Mono<Response<StorageServiceProperties>> getPropertiesWithResponse(Context conte
* Note that setting the default service version has no effect when using this client because this client explicitly
* sets the version header on each request, overriding the default.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.setProperties#StorageServiceProperties}
*
* @param properties Configures the service.
* @return A {@link Mono} containing the storage account properties.
*/
public Mono<Void> setProperties(StorageServiceProperties properties) {
return setPropertiesWithReponse(properties).flatMap(FluxUtil::toMono);
return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono);
}

/**
* Sets properties for a storage account's Blob service endpoint. For more information, see the
* <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-service-properties">Azure Docs</a>.
* Note that setting the default service version has no effect when using this client because this client explicitly
* sets the version header on each request, overriding the default.
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#StorageServiceProperties}
*
* @param properties Configures the service.
* @return A {@link Mono} containing the storage account properties.
*/
public Mono<VoidResponse> setPropertiesWithReponse(StorageServiceProperties properties) {
return withContext(context -> setPropertiesWithReponse(properties, context));
public Mono<VoidResponse> setPropertiesWithResponse(StorageServiceProperties properties) {
return withContext(context -> setPropertiesWithResponse(properties, context));
}

Mono<VoidResponse> setPropertiesWithReponse(StorageServiceProperties properties, Context context) {
Mono<VoidResponse> setPropertiesWithResponse(StorageServiceProperties properties, Context context) {
return postProcessResponse(
this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context))
.map(VoidResponse::new);
Expand All @@ -310,6 +352,10 @@ Mono<VoidResponse> setPropertiesWithReponse(StorageServiceProperties properties,
* Gets a user delegation key for use with this account's blob storage. Note: This method call is only valid when
* using {@link TokenCredential} in this object's {@link HttpPipeline}.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getUserDelegationKey#OffsetDateTime-OffsetDateTime}
*
* @param start Start time for the key's validity. Null indicates immediate start.
* @param expiry Expiration of the key's validity.
* @return A {@link Mono} containing the user delegation key.
Expand All @@ -323,6 +369,10 @@ public Mono<UserDelegationKey> getUserDelegationKey(OffsetDateTime start, Offset
* Gets a user delegation key for use with this account's blob storage. Note: This method call is only valid when
* using {@link TokenCredential} in this object's {@link HttpPipeline}.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getUserDelegationKeyWithResponse#OffsetDateTime-OffsetDateTime}
*
* @param start Start time for the key's validity. Null indicates immediate start.
* @param expiry Expiration of the key's validity.
* @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} containing the user
Expand Down Expand Up @@ -354,6 +404,10 @@ Mono<Response<UserDelegationKey>> getUserDelegationKeyWithResponse(OffsetDateTim
* the
* <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-stats">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getStatistics}
*
* @return A {@link Mono} containing the storage account statistics.
*/
public Mono<StorageServiceStats> getStatistics() {
Expand All @@ -366,6 +420,10 @@ public Mono<StorageServiceStats> getStatistics() {
* the
* <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-stats">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getStatisticsWithResponse}
*
* @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} containing the storage
* account statistics.
*/
Expand All @@ -382,6 +440,9 @@ Mono<Response<StorageServiceStats>> getStatisticsWithResponse(Context context) {
/**
* Returns the sku name and account kind for the account. For more information, please see the
* <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/get-account-information">Azure Docs</a>.
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getAccountInfo}
*
* @return A {@link Mono} containing containing the storage account info.
*/
Expand All @@ -393,6 +454,10 @@ public Mono<StorageAccountInfo> getAccountInfo() {
* Returns the sku name and account kind for the account. For more information, please see the
* <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/get-account-information">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getAccountInfoWithResponse}
*
* @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} the storage account
* info.
*/
Expand Down
Loading

0 comments on commit 5ad65b4

Please sign in to comment.