diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml index d7496c3ed2e9..6a907a19a665 100644 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml @@ -34,9 +34,6 @@ - - - @@ -77,15 +74,6 @@ - - - - - - - - - @@ -146,29 +134,6 @@ the main ServiceBusClientBuilder. --> - - - - - - - - - - - - - - @@ -184,13 +149,6 @@ the main ServiceBusClientBuilder. --> - - - - - - - @@ -231,8 +189,6 @@ the main ServiceBusClientBuilder. --> - - @@ -246,9 +202,6 @@ the main ServiceBusClientBuilder. --> - - - - @@ -440,13 +392,6 @@ the main ServiceBusClientBuilder. --> - - - - - - diff --git a/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml b/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml index 2b1257ba70c1..d7b34475724b 100644 --- a/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml +++ b/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml @@ -164,10 +164,7 @@ - - - - + @@ -411,19 +408,6 @@ - - - - - - - - - - - - - @@ -482,24 +466,6 @@ - - - - - - - - - - - - - - - - - - @@ -541,8 +507,6 @@ - - - - - - - - @@ -596,48 +554,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1891,37 +1807,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerAsyncClient.java index 1d53e8fe0e45..753176857abc 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerAsyncClient.java @@ -427,8 +427,7 @@ Mono> createWithResponse(Map metadata, PublicAcce Context context) { context = context == null ? Context.NONE : context; return this.azureBlobStorage.getContainers().createNoCustomHeadersWithResponseAsync(containerName, null, - metadata, accessType, null, blobContainerEncryptionScope, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + metadata, accessType, null, blobContainerEncryptionScope, context); } /** @@ -576,8 +575,7 @@ Mono> deleteWithResponse(BlobRequestConditions requestConditions, return this.azureBlobStorage.getContainers().deleteNoCustomHeadersWithResponseAsync(containerName, null, requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), - requestConditions.getIfUnmodifiedSince(), null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + requestConditions.getIfUnmodifiedSince(), null, context); } /** @@ -718,7 +716,6 @@ Mono> getPropertiesWithResponse(String leaseId return this.azureBlobStorage.getContainers() .getPropertiesWithResponseAsync(containerName, null, leaseId, null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> { ContainersGetPropertiesHeaders hd = rb.getDeserializedHeaders(); BlobContainerProperties properties = new BlobContainerProperties(hd.getXMsMeta(), hd.getETag(), @@ -802,8 +799,7 @@ Mono> setMetadataWithResponse(Map metadata, } return this.azureBlobStorage.getContainers().setMetadataNoCustomHeadersWithResponseAsync(containerName, null, - requestConditions.getLeaseId(), metadata, requestConditions.getIfModifiedSince(), null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + requestConditions.getLeaseId(), metadata, requestConditions.getIfModifiedSince(), null, context); } /** @@ -871,7 +867,6 @@ Mono> getAccessPolicyWithResponse(String l context = context == null ? Context.NONE : context; return this.azureBlobStorage.getContainers().getAccessPolicyWithResponseAsync( containerName, null, leaseId, null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(response -> new SimpleResponse<>(response, new BlobContainerAccessPolicies(response.getDeserializedHeaders().getXMsBlobPublicAccess(), response.getValue().items()))); @@ -995,8 +990,7 @@ OffsetDateTime.now will only give back milliseconds (more precise fields are zer return this.azureBlobStorage.getContainers().setAccessPolicyNoCustomHeadersWithResponseAsync(containerName, null, requestConditions.getLeaseId(), accessType, requestConditions.getIfModifiedSince(), - requestConditions.getIfUnmodifiedSince(), null, identifiers, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + requestConditions.getIfUnmodifiedSince(), null, identifiers, context); } /** @@ -1203,8 +1197,7 @@ PagedFlux listBlobsFlatWithOptionalTimeout(ListBlobsOptions options, S return StorageImplUtils.applyOptionalTimeout( this.azureBlobStorage.getContainers().listBlobFlatSegmentWithResponseAsync(containerName, options.getPrefix(), marker, options.getMaxResultsPerPage(), include, null, null, Context.NONE), - timeout) - .onErrorMap(ModelHelper::mapToBlobStorageException); + timeout); } /** @@ -1378,8 +1371,7 @@ PagedFlux listBlobsHierarchyWithOptionalTimeout(String delimiter, List this.azureBlobStorage.getContainers().listBlobHierarchySegmentWithResponseAsync(containerName, delimiter, options.getPrefix(), marker, options.getMaxResultsPerPage(), include, null, null, Context.NONE), - timeout) - .onErrorMap(ModelHelper::mapToBlobStorageException); + timeout); } /** @@ -1462,7 +1454,6 @@ private Mono> findBlobsByTags( return StorageImplUtils.applyOptionalTimeout( this.azureBlobStorage.getContainers().filterBlobsWithResponseAsync(containerName, null, null, options.getQuery(), marker, options.getMaxResultsPerPage(), null, context), timeout) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(response -> { List value = response.getValue().getBlobs().stream() .map(ModelHelper::populateTaggedBlobItem) @@ -1529,7 +1520,6 @@ public Mono> getAccountInfoWithResponse() { Mono> getAccountInfoWithResponse(Context context) { context = context == null ? Context.NONE : context; return this.azureBlobStorage.getContainers().getAccountInfoWithResponseAsync(containerName, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> { ContainersGetAccountInfoHeaders hd = rb.getDeserializedHeaders(); return new SimpleResponse<>(rb, new StorageAccountInfo(hd.getXMsSkuName(), hd.getXMsAccountKind())); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index 729889954532..3842d2b3e621 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -539,8 +539,7 @@ private Mono> listBlobContainersSegment(String this.azureBlobStorage.getServices().listBlobContainersSegmentSinglePageAsync( options.getPrefix(), marker, options.getMaxResultsPerPage(), toIncludeTypes(options.getDetails()), - null, null, Context.NONE), timeout) - .onErrorMap(ModelHelper::mapToBlobStorageException); + null, null, Context.NONE), timeout); } /** @@ -614,7 +613,6 @@ private Mono> findBlobsByTags( return StorageImplUtils.applyOptionalTimeout( this.azureBlobStorage.getServices().filterBlobsWithResponseAsync(null, null, options.getQuery(), marker, options.getMaxResultsPerPage(), null, context), timeout) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(response -> { List value = response.getValue().getBlobs().stream() .map(ModelHelper::populateTaggedBlobItem) @@ -712,7 +710,6 @@ Mono> getPropertiesWithResponse(Context context) context = context == null ? Context.NONE : context; throwOnAnonymousAccess(); return this.azureBlobStorage.getServices().getPropertiesWithResponseAsync(null, null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> new SimpleResponse<>(rb, rb.getValue())); } @@ -859,8 +856,7 @@ Mono> setPropertiesWithResponse(BlobServiceProperties properties, context = context == null ? Context.NONE : context; return this.azureBlobStorage.getServices() - .setPropertiesNoCustomHeadersWithResponseAsync(finalProperties, null, null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + .setPropertiesNoCustomHeadersWithResponseAsync(finalProperties, null, null, context); } /** @@ -964,7 +960,6 @@ Mono> getUserDelegationKeyWithResponse(OffsetDateTim .setStart(start == null ? "" : Constants.ISO_8601_UTC_DATE_FORMATTER.format(start)) .setExpiry(Constants.ISO_8601_UTC_DATE_FORMATTER.format(expiry)), null, null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> new SimpleResponse<>(rb, rb.getValue())); } @@ -1022,7 +1017,6 @@ Mono> getStatisticsWithResponse(Context context) context = context == null ? Context.NONE : context; return this.azureBlobStorage.getServices().getStatisticsWithResponseAsync(null, null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> new SimpleResponse<>(rb, rb.getValue())); } @@ -1074,7 +1068,6 @@ public Mono> getAccountInfoWithResponse() { Mono> getAccountInfoWithResponse(Context context) { throwOnAnonymousAccess(); return this.azureBlobStorage.getServices().getAccountInfoWithResponseAsync(context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> { ServicesGetAccountInfoHeaders hd = rb.getDeserializedHeaders(); return new SimpleResponse<>(rb, new StorageAccountInfo(hd.getXMsSkuName(), hd.getXMsAccountKind(), @@ -1276,7 +1269,6 @@ Mono> undeleteBlobContainerWithResponse( context = context == null ? Context.NONE : context; return this.azureBlobStorage.getContainers().restoreWithResponseAsync(finalDestinationContainerName, null, null, options.getDeletedContainerName(), options.getDeletedContainerVersion(), context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(response -> new SimpleResponse<>(response, getBlobContainerAsyncClient(finalDestinationContainerName))); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java index 09a7e2b2d317..70bcd8fc25ce 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.blob.implementation; import com.azure.core.annotation.BodyParam; @@ -39,11 +38,13 @@ import java.util.Map; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import com.azure.storage.blob.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in AppendBlobs. */ public final class AppendBlobsImpl { + /** * The proxy service used to perform REST calls. */ @@ -56,7 +57,7 @@ public final class AppendBlobsImpl { /** * Initializes an instance of AppendBlobsImpl. - * + * * @param client the instance of the service client containing this operation class. */ AppendBlobsImpl(AzureBlobStorageImpl client) { @@ -72,6 +73,7 @@ public final class AppendBlobsImpl { @Host("{url}") @ServiceInterface(name = "AzureBlobStorageAppe") public interface AppendBlobsService { + @Put("/{containerName}/{blob}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -307,7 +309,7 @@ Mono> sealNoCustomHeaders(@HostParam("url") String url, /** * The Create Append Blob operation creates a new append blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -408,17 +410,19 @@ public Mono> createWithResponseAsyn = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return FluxUtil.withContext(context -> service.create(this.client.getUrl(), containerName, blob, blobType, - timeout, contentLength, contentType, contentEncoding, contentLanguage, contentMd5Converted, cacheControl, - metadata, leaseId, contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, - encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, blobTagsString, immutabilityPolicyExpiryConverted, - immutabilityPolicyMode, legalHold, accept, context)); + return FluxUtil + .withContext(context -> service.create(this.client.getUrl(), containerName, blob, blobType, timeout, + contentLength, contentType, contentEncoding, contentLanguage, contentMd5Converted, cacheControl, + metadata, leaseId, contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, + encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, blobTagsString, immutabilityPolicyExpiryConverted, + immutabilityPolicyMode, legalHold, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Create Append Blob operation creates a new append blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -524,12 +528,13 @@ public Mono> createWithResponseAsyn contentEncoding, contentLanguage, contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context); + blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Create Append Blob operation creates a new append blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -573,12 +578,13 @@ public Mono createAsync(String containerName, String blob, long contentLen return createWithResponseAsync(containerName, blob, contentLength, timeout, metadata, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, blobHttpHeaders, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Create Append Blob operation creates a new append blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -623,12 +629,13 @@ public Mono createAsync(String containerName, String blob, long contentLen return createWithResponseAsync(containerName, blob, contentLength, timeout, metadata, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, blobHttpHeaders, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Create Append Blob operation creates a new append blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -729,17 +736,19 @@ public Mono> createNoCustomHeadersWithResponseAsync(String contai = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return FluxUtil.withContext(context -> service.createNoCustomHeaders(this.client.getUrl(), containerName, blob, - blobType, timeout, contentLength, contentType, contentEncoding, contentLanguage, contentMd5Converted, - cacheControl, metadata, leaseId, contentDisposition, encryptionKey, encryptionKeySha256, - encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, this.client.getVersion(), requestId, blobTagsString, immutabilityPolicyExpiryConverted, - immutabilityPolicyMode, legalHold, accept, context)); + return FluxUtil + .withContext(context -> service.createNoCustomHeaders(this.client.getUrl(), containerName, blob, blobType, + timeout, contentLength, contentType, contentEncoding, contentLanguage, contentMd5Converted, + cacheControl, metadata, leaseId, contentDisposition, encryptionKey, encryptionKeySha256, + encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, this.client.getVersion(), requestId, blobTagsString, + immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Create Append Blob operation creates a new append blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -841,19 +850,21 @@ public Mono> createNoCustomHeadersWithResponseAsync(String contai = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return service.createNoCustomHeaders(this.client.getUrl(), containerName, blob, blobType, timeout, - contentLength, contentType, contentEncoding, contentLanguage, contentMd5Converted, cacheControl, metadata, - leaseId, contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, blobTagsString, immutabilityPolicyExpiryConverted, - immutabilityPolicyMode, legalHold, accept, context); + return service + .createNoCustomHeaders(this.client.getUrl(), containerName, blob, blobType, timeout, contentLength, + contentType, contentEncoding, contentLanguage, contentMd5Converted, cacheControl, metadata, leaseId, + contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, blobTagsString, immutabilityPolicyExpiryConverted, + immutabilityPolicyMode, legalHold, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is * supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -922,18 +933,20 @@ public Mono> appendBlockWithRe = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.appendBlock(this.client.getUrl(), containerName, blob, comp, - timeout, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, - maxSize, appendPosition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.appendBlock(this.client.getUrl(), containerName, blob, comp, timeout, + contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, maxSize, + appendPosition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is * supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1003,18 +1016,20 @@ public Mono> appendBlockWithRe = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.appendBlock(this.client.getUrl(), containerName, blob, comp, timeout, contentLength, - transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, maxSize, appendPosition, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, body, accept, - context); + return service + .appendBlock(this.client.getUrl(), containerName, blob, comp, timeout, contentLength, + transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, maxSize, appendPosition, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, body, + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is * supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1056,14 +1071,16 @@ public Mono appendBlockAsync(String containerName, String blob, long conte String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { return appendBlockWithResponseAsync(containerName, blob, contentLength, body, timeout, transactionalContentMD5, transactionalContentCrc64, leaseId, maxSize, appendPosition, ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam).flatMap(ignored -> Mono.empty()); + ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is * supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1107,14 +1124,16 @@ public Mono appendBlockAsync(String containerName, String blob, long conte Context context) { return appendBlockWithResponseAsync(containerName, blob, contentLength, body, timeout, transactionalContentMD5, transactionalContentCrc64, leaseId, maxSize, appendPosition, ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, context).flatMap(ignored -> Mono.empty()); + ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is * supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1183,18 +1202,20 @@ public Mono> appendBlockNoCustomHeadersWithResponseAsync(String c = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.appendBlockNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, timeout, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, - leaseId, maxSize, appendPosition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.appendBlockNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + timeout, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, + maxSize, appendPosition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is * supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1264,18 +1285,20 @@ public Mono> appendBlockNoCustomHeadersWithResponseAsync(String c = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.appendBlockNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, - contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, maxSize, - appendPosition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, body, accept, context); + return service + .appendBlockNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, contentLength, + transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, maxSize, appendPosition, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, body, + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is * supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1344,18 +1367,20 @@ public Mono> appendBlockWithRe = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.appendBlock(this.client.getUrl(), containerName, blob, comp, - timeout, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, - maxSize, appendPosition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.appendBlock(this.client.getUrl(), containerName, blob, comp, timeout, + contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, maxSize, + appendPosition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is * supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1425,18 +1450,20 @@ public Mono> appendBlockWithRe = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.appendBlock(this.client.getUrl(), containerName, blob, comp, timeout, contentLength, - transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, maxSize, appendPosition, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, body, accept, - context); + return service + .appendBlock(this.client.getUrl(), containerName, blob, comp, timeout, contentLength, + transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, maxSize, appendPosition, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, body, + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is * supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1478,14 +1505,16 @@ public Mono appendBlockAsync(String containerName, String blob, long conte String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { return appendBlockWithResponseAsync(containerName, blob, contentLength, body, timeout, transactionalContentMD5, transactionalContentCrc64, leaseId, maxSize, appendPosition, ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam).flatMap(ignored -> Mono.empty()); + ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is * supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1529,14 +1558,16 @@ public Mono appendBlockAsync(String containerName, String blob, long conte Context context) { return appendBlockWithResponseAsync(containerName, blob, contentLength, body, timeout, transactionalContentMD5, transactionalContentCrc64, leaseId, maxSize, appendPosition, ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, context).flatMap(ignored -> Mono.empty()); + ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is * supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1605,18 +1636,20 @@ public Mono> appendBlockNoCustomHeadersWithResponseAsync(String c = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.appendBlockNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, timeout, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, - leaseId, maxSize, appendPosition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.appendBlockNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + timeout, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, + maxSize, appendPosition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block * operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is * supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1686,18 +1719,20 @@ public Mono> appendBlockNoCustomHeadersWithResponseAsync(String c = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.appendBlockNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, - contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, maxSize, - appendPosition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, body, accept, context); + return service + .appendBlockNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, contentLength, + transactionalContentMD5Converted, transactionalContentCrc64Converted, leaseId, maxSize, appendPosition, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, body, + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Append Block operation commits a new block of data to the end of an existing append blob where the contents * are read from a source url. The Append Block operation is permitted only if the blob was created with * x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param sourceUrl Specify a URL to the copy source. @@ -1791,14 +1826,14 @@ public Mono> appendBloc encryptionScope, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, this.client.getVersion(), requestId, copySourceAuthorization, accept, - context)); + context)).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Append Block operation commits a new block of data to the end of an existing append blob where the contents * are read from a source url. The Append Block operation is permitted only if the blob was created with * x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param sourceUrl Specify a URL to the copy source. @@ -1892,14 +1927,15 @@ public Mono> appendBloc transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, - sourceIfNoneMatch, this.client.getVersion(), requestId, copySourceAuthorization, accept, context); + sourceIfNoneMatch, this.client.getVersion(), requestId, copySourceAuthorization, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Append Block operation commits a new block of data to the end of an existing append blob where the contents * are read from a source url. The Append Block operation is permitted only if the blob was created with * x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param sourceUrl Specify a URL to the copy source. @@ -1957,14 +1993,15 @@ public Mono appendBlockFromUrlAsync(String containerName, String blob, Str sourceContentMD5, sourceContentcrc64, timeout, transactionalContentMD5, leaseId, maxSize, appendPosition, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestId, copySourceAuthorization, cpkInfo, - encryptionScopeParam).flatMap(ignored -> Mono.empty()); + encryptionScopeParam).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Append Block operation commits a new block of data to the end of an existing append blob where the contents * are read from a source url. The Append Block operation is permitted only if the blob was created with * x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param sourceUrl Specify a URL to the copy source. @@ -2023,14 +2060,16 @@ public Mono appendBlockFromUrlAsync(String containerName, String blob, Str sourceContentMD5, sourceContentcrc64, timeout, transactionalContentMD5, leaseId, maxSize, appendPosition, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestId, copySourceAuthorization, cpkInfo, - encryptionScopeParam, context).flatMap(ignored -> Mono.empty()); + encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Append Block operation commits a new block of data to the end of an existing append blob where the contents * are read from a source url. The Append Block operation is permitted only if the blob was created with * x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param sourceUrl Specify a URL to the copy source. @@ -2117,20 +2156,22 @@ public Mono> appendBlockFromUrlNoCustomHeadersWithResponseAsync(S = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return FluxUtil.withContext(context -> service.appendBlockFromUrlNoCustomHeaders(this.client.getUrl(), - containerName, blob, comp, sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, - timeout, contentLength, transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, - encryptionAlgorithm, encryptionScope, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, - sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, this.client.getVersion(), requestId, - copySourceAuthorization, accept, context)); + return FluxUtil + .withContext(context -> service.appendBlockFromUrlNoCustomHeaders(this.client.getUrl(), containerName, blob, + comp, sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, + contentLength, transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, + encryptionAlgorithm, encryptionScope, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, + sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, this.client.getVersion(), requestId, + copySourceAuthorization, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Append Block operation commits a new block of data to the end of an existing append blob where the contents * are read from a source url. The Append Block operation is permitted only if the blob was created with * x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param sourceUrl Specify a URL to the copy source. @@ -2223,13 +2264,14 @@ public Mono> appendBlockFromUrlNoCustomHeadersWithResponseAsync(S transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, - sourceIfNoneMatch, this.client.getVersion(), requestId, copySourceAuthorization, accept, context); + sourceIfNoneMatch, this.client.getVersion(), requestId, copySourceAuthorization, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 * version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2263,15 +2305,17 @@ public Mono> sealWithResponseAsync(St = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.seal(this.client.getUrl(), containerName, blob, comp, timeout, - this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, appendPosition, accept, context)); + return FluxUtil + .withContext(context -> service.seal(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + ifMatch, ifNoneMatch, appendPosition, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 * version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2306,15 +2350,17 @@ public Mono> sealWithResponseAsync(St = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.seal(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), - requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, - appendPosition, accept, context); + return service + .seal(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), requestId, + leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, appendPosition, + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 * version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2343,13 +2389,15 @@ public Mono sealAsync(String containerName, String blob, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, Long appendPosition) { return sealWithResponseAsync(containerName, blob, timeout, requestId, leaseId, ifModifiedSince, - ifUnmodifiedSince, ifMatch, ifNoneMatch, appendPosition).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, ifMatch, ifNoneMatch, appendPosition) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 * version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2379,13 +2427,15 @@ public Mono sealAsync(String containerName, String blob, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, Long appendPosition, Context context) { return sealWithResponseAsync(containerName, blob, timeout, requestId, leaseId, ifModifiedSince, - ifUnmodifiedSince, ifMatch, ifNoneMatch, appendPosition, context).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, ifMatch, ifNoneMatch, appendPosition, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 * version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2419,15 +2469,17 @@ public Mono> sealNoCustomHeadersWithResponseAsync(String containe = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.sealNoCustomHeaders(this.client.getUrl(), containerName, blob, - comp, timeout, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, appendPosition, accept, context)); + return FluxUtil + .withContext(context -> service.sealNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + timeout, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, appendPosition, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 * version or later. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2462,8 +2514,10 @@ public Mono> sealNoCustomHeadersWithResponseAsync(String containe = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.sealNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, - this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, appendPosition, accept, context); + return service + .sealNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), + requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, + appendPosition, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java index a486f7542d11..c5770824b839 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.blob.implementation; import com.azure.core.annotation.BodyParam; @@ -71,11 +70,13 @@ import java.util.Map; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import com.azure.storage.blob.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in Blobs. */ public final class BlobsImpl { + /** * The proxy service used to perform REST calls. */ @@ -88,7 +89,7 @@ public final class BlobsImpl { /** * Initializes an instance of BlobsImpl. - * + * * @param client the instance of the service client containing this operation class. */ BlobsImpl(AzureBlobStorageImpl client) { @@ -103,6 +104,7 @@ public final class BlobsImpl { @Host("{url}") @ServiceInterface(name = "AzureBlobStorageBlob") public interface BlobsService { + @Get("/{containerName}/{blob}") @ExpectedResponses({ 200, 206 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -817,7 +819,7 @@ Mono> setTagsNoCustomHeaders(@HostParam("url") String url, /** * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can * also call Download to read a snapshot or version. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -876,16 +878,18 @@ public Mono>> downloadWithRe = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.download(this.client.getUrl(), containerName, blob, snapshot, - versionId, timeout, range, leaseId, rangeGetContentMD5, rangeGetContentCRC64, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.download(this.client.getUrl(), containerName, blob, snapshot, versionId, + timeout, range, leaseId, rangeGetContentMD5, rangeGetContentCRC64, encryptionKey, encryptionKeySha256, + encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can * also call Download to read a snapshot or version. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -945,16 +949,18 @@ public Mono>> downloadWithRe = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.download(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, range, leaseId, - rangeGetContentMD5, rangeGetContentCRC64, encryptionKey, encryptionKeySha256, encryptionAlgorithm, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context); + return service + .download(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, range, leaseId, + rangeGetContentMD5, rangeGetContentCRC64, encryptionKey, encryptionKeySha256, encryptionAlgorithm, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can * also call Download to read a snapshot or version. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -994,13 +1000,14 @@ public Flux downloadAsync(String containerName, String blob, String String ifTags, String requestId, CpkInfo cpkInfo) { return downloadWithResponseAsync(containerName, blob, snapshot, versionId, timeout, range, leaseId, rangeGetContentMD5, rangeGetContentCRC64, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, - requestId, cpkInfo).flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); + requestId, cpkInfo).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can * also call Download to read a snapshot or version. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1041,13 +1048,15 @@ public Flux downloadAsync(String containerName, String blob, String String ifTags, String requestId, CpkInfo cpkInfo, Context context) { return downloadWithResponseAsync(containerName, blob, snapshot, versionId, timeout, range, leaseId, rangeGetContentMD5, rangeGetContentCRC64, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, - requestId, cpkInfo, context).flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); + requestId, cpkInfo, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can * also call Download to read a snapshot or version. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1105,16 +1114,18 @@ public Mono downloadNoCustomHeadersWithResponseAsync(String cont = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.downloadNoCustomHeaders(this.client.getUrl(), containerName, - blob, snapshot, versionId, timeout, range, leaseId, rangeGetContentMD5, rangeGetContentCRC64, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.downloadNoCustomHeaders(this.client.getUrl(), containerName, blob, snapshot, + versionId, timeout, range, leaseId, rangeGetContentMD5, rangeGetContentCRC64, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can * also call Download to read a snapshot or version. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1173,16 +1184,18 @@ public Mono downloadNoCustomHeadersWithResponseAsync(String cont = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.downloadNoCustomHeaders(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, - range, leaseId, rangeGetContentMD5, rangeGetContentCRC64, encryptionKey, encryptionKeySha256, - encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context); + return service + .downloadNoCustomHeaders(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, range, + leaseId, rangeGetContentMD5, rangeGetContentCRC64, encryptionKey, encryptionKeySha256, + encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties * for the blob. It does not return the content of the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1235,16 +1248,18 @@ public Mono> getPropertiesWithResp = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.getProperties(this.client.getUrl(), containerName, blob, - snapshot, versionId, timeout, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getProperties(this.client.getUrl(), containerName, blob, snapshot, + versionId, timeout, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties * for the blob. It does not return the content of the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1298,16 +1313,18 @@ public Mono> getPropertiesWithResp = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getProperties(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, leaseId, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, - context); + return service + .getProperties(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, leaseId, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties * for the blob. It does not return the content of the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1341,13 +1358,14 @@ public Mono getPropertiesAsync(String containerName, String blob, String s String ifMatch, String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo) { return getPropertiesWithResponseAsync(containerName, blob, snapshot, versionId, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties * for the blob. It does not return the content of the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1382,13 +1400,14 @@ public Mono getPropertiesAsync(String containerName, String blob, String s String ifMatch, String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, Context context) { return getPropertiesWithResponseAsync(containerName, blob, snapshot, versionId, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties * for the blob. It does not return the content of the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1441,16 +1460,18 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), containerName, - blob, snapshot, versionId, timeout, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), containerName, blob, + snapshot, versionId, timeout, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties * for the blob. It does not return the content of the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1504,10 +1525,12 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getPropertiesNoCustomHeaders(this.client.getUrl(), containerName, blob, snapshot, versionId, - timeout, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, - context); + return service + .getPropertiesNoCustomHeaders(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, + leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -1526,7 +1549,7 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String * automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob * API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC * permissions. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1568,9 +1591,11 @@ public Mono> deleteWithResponseAsync(Stri = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.delete(this.client.getUrl(), containerName, blob, snapshot, - versionId, timeout, leaseId, deleteSnapshots, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, this.client.getVersion(), requestId, blobDeleteType, accept, context)); + return FluxUtil + .withContext(context -> service.delete(this.client.getUrl(), containerName, blob, snapshot, versionId, + timeout, leaseId, deleteSnapshots, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, this.client.getVersion(), requestId, blobDeleteType, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -1589,7 +1614,7 @@ public Mono> deleteWithResponseAsync(Stri * automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob * API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC * permissions. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1632,9 +1657,11 @@ public Mono> deleteWithResponseAsync(Stri = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.delete(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, leaseId, - deleteSnapshots, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, blobDeleteType, accept, context); + return service + .delete(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, leaseId, deleteSnapshots, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, blobDeleteType, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -1653,7 +1680,7 @@ public Mono> deleteWithResponseAsync(Stri * automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob * API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC * permissions. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1692,6 +1719,7 @@ public Mono deleteAsync(String containerName, String blob, String snapshot BlobDeleteType blobDeleteType) { return deleteWithResponseAsync(containerName, blob, snapshot, versionId, timeout, leaseId, deleteSnapshots, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobDeleteType) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } @@ -1711,7 +1739,7 @@ public Mono deleteAsync(String containerName, String blob, String snapshot * automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob * API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC * permissions. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1751,6 +1779,7 @@ public Mono deleteAsync(String containerName, String blob, String snapshot BlobDeleteType blobDeleteType, Context context) { return deleteWithResponseAsync(containerName, blob, snapshot, versionId, timeout, leaseId, deleteSnapshots, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobDeleteType, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } @@ -1770,7 +1799,7 @@ public Mono deleteAsync(String containerName, String blob, String snapshot * automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob * API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC * permissions. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1815,7 +1844,8 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String contai return FluxUtil .withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, leaseId, deleteSnapshots, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, blobDeleteType, accept, context)); + ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, blobDeleteType, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -1834,7 +1864,7 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String contai * automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob * API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC * permissions. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -1877,14 +1907,16 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String contai = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.deleteNoCustomHeaders(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, - leaseId, deleteSnapshots, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, - ifTags, this.client.getVersion(), requestId, blobDeleteType, accept, context); + return service + .deleteNoCustomHeaders(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, leaseId, + deleteSnapshots, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, blobDeleteType, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Undelete a blob that was previously soft deleted. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1902,13 +1934,15 @@ public Mono> undeleteWithResponseAsync( Integer timeout, String requestId) { final String comp = "undelete"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.undelete(this.client.getUrl(), containerName, blob, comp, - timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.undelete(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Undelete a blob that was previously soft deleted. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1927,13 +1961,15 @@ public Mono> undeleteWithResponseAsync( Integer timeout, String requestId, Context context) { final String comp = "undelete"; final String accept = "application/xml"; - return service.undelete(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), - requestId, accept, context); + return service + .undelete(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), requestId, + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Undelete a blob that was previously soft deleted. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1948,12 +1984,14 @@ public Mono> undeleteWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono undeleteAsync(String containerName, String blob, Integer timeout, String requestId) { - return undeleteWithResponseAsync(containerName, blob, timeout, requestId).flatMap(ignored -> Mono.empty()); + return undeleteWithResponseAsync(containerName, blob, timeout, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Undelete a blob that was previously soft deleted. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1971,12 +2009,13 @@ public Mono undeleteAsync(String containerName, String blob, Integer timeo public Mono undeleteAsync(String containerName, String blob, Integer timeout, String requestId, Context context) { return undeleteWithResponseAsync(containerName, blob, timeout, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * Undelete a blob that was previously soft deleted. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1994,13 +2033,15 @@ public Mono> undeleteNoCustomHeadersWithResponseAsync(String cont Integer timeout, String requestId) { final String comp = "undelete"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.undeleteNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.undeleteNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + timeout, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Undelete a blob that was previously soft deleted. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2019,13 +2060,15 @@ public Mono> undeleteNoCustomHeadersWithResponseAsync(String cont Integer timeout, String requestId, Context context) { final String comp = "undelete"; final String accept = "application/xml"; - return service.undeleteNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, - this.client.getVersion(), requestId, accept, context); + return service + .undeleteNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Sets the time a blob will expire and be deleted. - * + * * @param containerName The container name. * @param blob The blob name. * @param expiryOptions Required. Indicates mode of the expiry time. @@ -2045,13 +2088,15 @@ public Mono> setExpiryWithResponseAsyn BlobExpiryOptions expiryOptions, Integer timeout, String requestId, String expiresOn) { final String comp = "expiry"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setExpiry(this.client.getUrl(), containerName, blob, comp, - timeout, this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context)); + return FluxUtil + .withContext(context -> service.setExpiry(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Sets the time a blob will expire and be deleted. - * + * * @param containerName The container name. * @param blob The blob name. * @param expiryOptions Required. Indicates mode of the expiry time. @@ -2072,13 +2117,15 @@ public Mono> setExpiryWithResponseAsyn BlobExpiryOptions expiryOptions, Integer timeout, String requestId, String expiresOn, Context context) { final String comp = "expiry"; final String accept = "application/xml"; - return service.setExpiry(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), - requestId, expiryOptions, expiresOn, accept, context); + return service + .setExpiry(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), requestId, + expiryOptions, expiresOn, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Sets the time a blob will expire and be deleted. - * + * * @param containerName The container name. * @param blob The blob name. * @param expiryOptions Required. Indicates mode of the expiry time. @@ -2097,12 +2144,13 @@ public Mono> setExpiryWithResponseAsyn public Mono setExpiryAsync(String containerName, String blob, BlobExpiryOptions expiryOptions, Integer timeout, String requestId, String expiresOn) { return setExpiryWithResponseAsync(containerName, blob, expiryOptions, timeout, requestId, expiresOn) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * Sets the time a blob will expire and be deleted. - * + * * @param containerName The container name. * @param blob The blob name. * @param expiryOptions Required. Indicates mode of the expiry time. @@ -2122,12 +2170,13 @@ public Mono setExpiryAsync(String containerName, String blob, BlobExpiryOp public Mono setExpiryAsync(String containerName, String blob, BlobExpiryOptions expiryOptions, Integer timeout, String requestId, String expiresOn, Context context) { return setExpiryWithResponseAsync(containerName, blob, expiryOptions, timeout, requestId, expiresOn, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * Sets the time a blob will expire and be deleted. - * + * * @param containerName The container name. * @param blob The blob name. * @param expiryOptions Required. Indicates mode of the expiry time. @@ -2147,13 +2196,15 @@ public Mono> setExpiryNoCustomHeadersWithResponseAsync(String con BlobExpiryOptions expiryOptions, Integer timeout, String requestId, String expiresOn) { final String comp = "expiry"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setExpiryNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, timeout, this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context)); + return FluxUtil + .withContext(context -> service.setExpiryNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + timeout, this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Sets the time a blob will expire and be deleted. - * + * * @param containerName The container name. * @param blob The blob name. * @param expiryOptions Required. Indicates mode of the expiry time. @@ -2174,13 +2225,15 @@ public Mono> setExpiryNoCustomHeadersWithResponseAsync(String con BlobExpiryOptions expiryOptions, Integer timeout, String requestId, String expiresOn, Context context) { final String comp = "expiry"; final String accept = "application/xml"; - return service.setExpiryNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, - this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context); + return service + .setExpiryNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set HTTP Headers operation sets system properties on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2243,15 +2296,17 @@ public Mono> setHttpHeadersWithRe = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.setHttpHeaders(this.client.getUrl(), containerName, blob, comp, - timeout, cacheControl, contentType, contentMd5Converted, contentEncoding, contentLanguage, leaseId, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, contentDisposition, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.setHttpHeaders(this.client.getUrl(), containerName, blob, comp, timeout, + cacheControl, contentType, contentMd5Converted, contentEncoding, contentLanguage, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, contentDisposition, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set HTTP Headers operation sets system properties on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2316,15 +2371,17 @@ public Mono> setHttpHeadersWithRe = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setHttpHeaders(this.client.getUrl(), containerName, blob, comp, timeout, cacheControl, - contentType, contentMd5Converted, contentEncoding, contentLanguage, leaseId, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, contentDisposition, this.client.getVersion(), - requestId, accept, context); + return service + .setHttpHeaders(this.client.getUrl(), containerName, blob, comp, timeout, cacheControl, contentType, + contentMd5Converted, contentEncoding, contentLanguage, leaseId, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, contentDisposition, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set HTTP Headers operation sets system properties on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2352,12 +2409,13 @@ public Mono setHttpHeadersAsync(String containerName, String blob, Integer String ifTags, String requestId, BlobHttpHeaders blobHttpHeaders) { return setHttpHeadersWithResponseAsync(containerName, blob, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobHttpHeaders) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Set HTTP Headers operation sets system properties on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2386,12 +2444,13 @@ public Mono setHttpHeadersAsync(String containerName, String blob, Integer String ifTags, String requestId, BlobHttpHeaders blobHttpHeaders, Context context) { return setHttpHeadersWithResponseAsync(containerName, blob, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobHttpHeaders, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Set HTTP Headers operation sets system properties on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2454,15 +2513,17 @@ public Mono> setHttpHeadersNoCustomHeadersWithResponseAsync(Strin = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.setHttpHeadersNoCustomHeaders(this.client.getUrl(), - containerName, blob, comp, timeout, cacheControl, contentType, contentMd5Converted, contentEncoding, - contentLanguage, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, - ifTags, contentDisposition, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.setHttpHeadersNoCustomHeaders(this.client.getUrl(), containerName, blob, + comp, timeout, cacheControl, contentType, contentMd5Converted, contentEncoding, contentLanguage, + leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + contentDisposition, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set HTTP Headers operation sets system properties on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2527,15 +2588,17 @@ public Mono> setHttpHeadersNoCustomHeadersWithResponseAsync(Strin = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setHttpHeadersNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, - cacheControl, contentType, contentMd5Converted, contentEncoding, contentLanguage, leaseId, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, contentDisposition, - this.client.getVersion(), requestId, accept, context); + return service + .setHttpHeadersNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, cacheControl, + contentType, contentMd5Converted, contentEncoding, contentLanguage, leaseId, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, contentDisposition, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Immutability Policy operation sets the immutability policy on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2562,14 +2625,16 @@ public Mono> setImmutabili = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return FluxUtil.withContext(context -> service.setImmutabilityPolicy(this.client.getUrl(), containerName, blob, - comp, timeout, this.client.getVersion(), requestId, ifUnmodifiedSinceConverted, - immutabilityPolicyExpiryConverted, immutabilityPolicyMode, accept, context)); + return FluxUtil + .withContext(context -> service.setImmutabilityPolicy(this.client.getUrl(), containerName, blob, comp, + timeout, this.client.getVersion(), requestId, ifUnmodifiedSinceConverted, + immutabilityPolicyExpiryConverted, immutabilityPolicyMode, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Immutability Policy operation sets the immutability policy on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2597,14 +2662,16 @@ public Mono> setImmutabili = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return service.setImmutabilityPolicy(this.client.getUrl(), containerName, blob, comp, timeout, - this.client.getVersion(), requestId, ifUnmodifiedSinceConverted, immutabilityPolicyExpiryConverted, - immutabilityPolicyMode, accept, context); + return service + .setImmutabilityPolicy(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), + requestId, ifUnmodifiedSinceConverted, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Immutability Policy operation sets the immutability policy on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2626,12 +2693,14 @@ public Mono setImmutabilityPolicyAsync(String containerName, String blob, OffsetDateTime ifUnmodifiedSince, OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode) { return setImmutabilityPolicyWithResponseAsync(containerName, blob, timeout, requestId, ifUnmodifiedSince, - immutabilityPolicyExpiry, immutabilityPolicyMode).flatMap(ignored -> Mono.empty()); + immutabilityPolicyExpiry, immutabilityPolicyMode) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Set Immutability Policy operation sets the immutability policy on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2654,12 +2723,14 @@ public Mono setImmutabilityPolicyAsync(String containerName, String blob, OffsetDateTime ifUnmodifiedSince, OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Context context) { return setImmutabilityPolicyWithResponseAsync(containerName, blob, timeout, requestId, ifUnmodifiedSince, - immutabilityPolicyExpiry, immutabilityPolicyMode, context).flatMap(ignored -> Mono.empty()); + immutabilityPolicyExpiry, immutabilityPolicyMode, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Set Immutability Policy operation sets the immutability policy on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2686,14 +2757,16 @@ public Mono> setImmutabilityPolicyNoCustomHeadersWithResponseAsyn = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return FluxUtil.withContext(context -> service.setImmutabilityPolicyNoCustomHeaders(this.client.getUrl(), - containerName, blob, comp, timeout, this.client.getVersion(), requestId, ifUnmodifiedSinceConverted, - immutabilityPolicyExpiryConverted, immutabilityPolicyMode, accept, context)); + return FluxUtil + .withContext(context -> service.setImmutabilityPolicyNoCustomHeaders(this.client.getUrl(), containerName, + blob, comp, timeout, this.client.getVersion(), requestId, ifUnmodifiedSinceConverted, + immutabilityPolicyExpiryConverted, immutabilityPolicyMode, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Immutability Policy operation sets the immutability policy on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2721,14 +2794,16 @@ public Mono> setImmutabilityPolicyNoCustomHeadersWithResponseAsyn = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return service.setImmutabilityPolicyNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, - this.client.getVersion(), requestId, ifUnmodifiedSinceConverted, immutabilityPolicyExpiryConverted, - immutabilityPolicyMode, accept, context); + return service + .setImmutabilityPolicyNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, ifUnmodifiedSinceConverted, immutabilityPolicyExpiryConverted, + immutabilityPolicyMode, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Delete Immutability Policy operation deletes the immutability policy on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2746,13 +2821,15 @@ public Mono> deleteImmu String containerName, String blob, Integer timeout, String requestId) { final String comp = "immutabilityPolicies"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.deleteImmutabilityPolicy(this.client.getUrl(), containerName, - blob, comp, timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.deleteImmutabilityPolicy(this.client.getUrl(), containerName, blob, comp, + timeout, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Delete Immutability Policy operation deletes the immutability policy on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2771,13 +2848,15 @@ public Mono> deleteImmu String containerName, String blob, Integer timeout, String requestId, Context context) { final String comp = "immutabilityPolicies"; final String accept = "application/xml"; - return service.deleteImmutabilityPolicy(this.client.getUrl(), containerName, blob, comp, timeout, - this.client.getVersion(), requestId, accept, context); + return service + .deleteImmutabilityPolicy(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Delete Immutability Policy operation deletes the immutability policy on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2794,12 +2873,13 @@ public Mono> deleteImmu public Mono deleteImmutabilityPolicyAsync(String containerName, String blob, Integer timeout, String requestId) { return deleteImmutabilityPolicyWithResponseAsync(containerName, blob, timeout, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Delete Immutability Policy operation deletes the immutability policy on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2817,12 +2897,13 @@ public Mono deleteImmutabilityPolicyAsync(String containerName, String blo public Mono deleteImmutabilityPolicyAsync(String containerName, String blob, Integer timeout, String requestId, Context context) { return deleteImmutabilityPolicyWithResponseAsync(containerName, blob, timeout, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Delete Immutability Policy operation deletes the immutability policy on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2840,13 +2921,15 @@ public Mono> deleteImmutabilityPolicyNoCustomHeadersWithResponseA String blob, Integer timeout, String requestId) { final String comp = "immutabilityPolicies"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.deleteImmutabilityPolicyNoCustomHeaders(this.client.getUrl(), - containerName, blob, comp, timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.deleteImmutabilityPolicyNoCustomHeaders(this.client.getUrl(), containerName, + blob, comp, timeout, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Delete Immutability Policy operation deletes the immutability policy on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2865,13 +2948,15 @@ public Mono> deleteImmutabilityPolicyNoCustomHeadersWithResponseA String blob, Integer timeout, String requestId, Context context) { final String comp = "immutabilityPolicies"; final String accept = "application/xml"; - return service.deleteImmutabilityPolicyNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, - this.client.getVersion(), requestId, accept, context); + return service + .deleteImmutabilityPolicyNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Legal Hold operation sets a legal hold on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param legalHold Specified if a legal hold should be set on the blob. @@ -2890,13 +2975,15 @@ public Mono> setLegalHoldWithRespon String blob, boolean legalHold, Integer timeout, String requestId) { final String comp = "legalhold"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setLegalHold(this.client.getUrl(), containerName, blob, comp, - timeout, this.client.getVersion(), requestId, legalHold, accept, context)); + return FluxUtil + .withContext(context -> service.setLegalHold(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, legalHold, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Legal Hold operation sets a legal hold on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param legalHold Specified if a legal hold should be set on the blob. @@ -2916,13 +3003,15 @@ public Mono> setLegalHoldWithRespon String blob, boolean legalHold, Integer timeout, String requestId, Context context) { final String comp = "legalhold"; final String accept = "application/xml"; - return service.setLegalHold(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), - requestId, legalHold, accept, context); + return service + .setLegalHold(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), requestId, + legalHold, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Legal Hold operation sets a legal hold on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param legalHold Specified if a legal hold should be set on the blob. @@ -2940,12 +3029,13 @@ public Mono> setLegalHoldWithRespon public Mono setLegalHoldAsync(String containerName, String blob, boolean legalHold, Integer timeout, String requestId) { return setLegalHoldWithResponseAsync(containerName, blob, legalHold, timeout, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Set Legal Hold operation sets a legal hold on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param legalHold Specified if a legal hold should be set on the blob. @@ -2964,12 +3054,13 @@ public Mono setLegalHoldAsync(String containerName, String blob, boolean l public Mono setLegalHoldAsync(String containerName, String blob, boolean legalHold, Integer timeout, String requestId, Context context) { return setLegalHoldWithResponseAsync(containerName, blob, legalHold, timeout, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Set Legal Hold operation sets a legal hold on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param legalHold Specified if a legal hold should be set on the blob. @@ -2988,13 +3079,15 @@ public Mono> setLegalHoldNoCustomHeadersWithResponseAsync(String boolean legalHold, Integer timeout, String requestId) { final String comp = "legalhold"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setLegalHoldNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, timeout, this.client.getVersion(), requestId, legalHold, accept, context)); + return FluxUtil + .withContext(context -> service.setLegalHoldNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + timeout, this.client.getVersion(), requestId, legalHold, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Legal Hold operation sets a legal hold on the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param legalHold Specified if a legal hold should be set on the blob. @@ -3014,14 +3107,16 @@ public Mono> setLegalHoldNoCustomHeadersWithResponseAsync(String boolean legalHold, Integer timeout, String requestId, Context context) { final String comp = "legalhold"; final String accept = "application/xml"; - return service.setLegalHoldNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, - this.client.getVersion(), requestId, legalHold, accept, context); + return service + .setLegalHoldNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, legalHold, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value * pairs. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3081,16 +3176,18 @@ public Mono> setMetadataWithResponse = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.setMetadata(this.client.getUrl(), containerName, blob, comp, - timeout, metadata, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.setMetadata(this.client.getUrl(), containerName, blob, comp, timeout, + metadata, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value * pairs. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3151,16 +3248,18 @@ public Mono> setMetadataWithResponse = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setMetadata(this.client.getUrl(), containerName, blob, comp, timeout, metadata, leaseId, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, - context); + return service + .setMetadata(this.client.getUrl(), containerName, blob, comp, timeout, metadata, leaseId, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value * pairs. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3195,13 +3294,14 @@ public Mono setMetadataAsync(String containerName, String blob, Integer ti String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { return setMetadataWithResponseAsync(containerName, blob, timeout, metadata, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value * pairs. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3238,13 +3338,14 @@ public Mono setMetadataAsync(String containerName, String blob, Integer ti Context context) { return setMetadataWithResponseAsync(containerName, blob, timeout, metadata, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value * pairs. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3304,16 +3405,18 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String c = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.setMetadataNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, timeout, metadata, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, - encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.setMetadataNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + timeout, metadata, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value * pairs. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3374,15 +3477,17 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String c = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setMetadataNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, metadata, - leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, - context); + return service + .setMetadataNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, metadata, leaseId, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3419,14 +3524,16 @@ public Mono> acquireLeaseWithRespon = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.acquireLease(this.client.getUrl(), containerName, blob, comp, - action, timeout, duration, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.acquireLease(this.client.getUrl(), containerName, blob, comp, action, + timeout, duration, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3465,14 +3572,16 @@ public Mono> acquireLeaseWithRespon = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.acquireLease(this.client.getUrl(), containerName, blob, comp, action, timeout, duration, - proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context); + return service + .acquireLease(this.client.getUrl(), containerName, blob, comp, action, timeout, duration, proposedLeaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3503,12 +3612,14 @@ public Mono acquireLeaseAsync(String containerName, String blob, Integer t String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId) { return acquireLeaseWithResponseAsync(containerName, blob, timeout, duration, proposedLeaseId, ifModifiedSince, - ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3540,12 +3651,14 @@ public Mono acquireLeaseAsync(String containerName, String blob, Integer t String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, Context context) { return acquireLeaseWithResponseAsync(containerName, blob, timeout, duration, proposedLeaseId, ifModifiedSince, - ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, context).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3585,12 +3698,13 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String return FluxUtil .withContext(context -> service.acquireLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, action, timeout, duration, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)); + ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3629,14 +3743,16 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.acquireLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, action, timeout, - duration, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, - ifTags, this.client.getVersion(), requestId, accept, context); + return service + .acquireLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, action, timeout, duration, + proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -3668,14 +3784,16 @@ public Mono> releaseLeaseWithRespon = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.releaseLease(this.client.getUrl(), containerName, blob, comp, - action, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, - ifTags, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.releaseLease(this.client.getUrl(), containerName, blob, comp, action, + timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -3708,14 +3826,16 @@ public Mono> releaseLeaseWithRespon = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.releaseLease(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context); + return service + .releaseLease(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -3741,12 +3861,14 @@ public Mono releaseLeaseAsync(String containerName, String blob, String le OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId) { return releaseLeaseWithResponseAsync(containerName, blob, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, - ifMatch, ifNoneMatch, ifTags, requestId).flatMap(ignored -> Mono.empty()); + ifMatch, ifNoneMatch, ifTags, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -3773,12 +3895,14 @@ public Mono releaseLeaseAsync(String containerName, String blob, String le OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, Context context) { return releaseLeaseWithResponseAsync(containerName, blob, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, - ifMatch, ifNoneMatch, ifTags, requestId, context).flatMap(ignored -> Mono.empty()); + ifMatch, ifNoneMatch, ifTags, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -3810,14 +3934,16 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.releaseLeaseNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, action, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.releaseLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + action, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, + ifTags, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -3850,14 +3976,16 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.releaseLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, action, timeout, - leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context); + return service + .releaseLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -3889,14 +4017,16 @@ public Mono> renewLeaseWithResponseAs = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.renewLease(this.client.getUrl(), containerName, blob, comp, - action, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, - ifTags, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.renewLease(this.client.getUrl(), containerName, blob, comp, action, timeout, + leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -3929,14 +4059,16 @@ public Mono> renewLeaseWithResponseAs = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.renewLease(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context); + return service + .renewLease(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -3962,12 +4094,14 @@ public Mono renewLeaseAsync(String containerName, String blob, String leas OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId) { return renewLeaseWithResponseAsync(containerName, blob, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, - ifMatch, ifNoneMatch, ifTags, requestId).flatMap(ignored -> Mono.empty()); + ifMatch, ifNoneMatch, ifTags, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -3994,12 +4128,14 @@ public Mono renewLeaseAsync(String containerName, String blob, String leas OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, Context context) { return renewLeaseWithResponseAsync(containerName, blob, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, - ifMatch, ifNoneMatch, ifTags, requestId, context).flatMap(ignored -> Mono.empty()); + ifMatch, ifNoneMatch, ifTags, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -4031,14 +4167,16 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String co = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.renewLeaseNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, action, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.renewLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + action, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, + ifTags, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -4071,14 +4209,16 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String co = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.renewLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, action, timeout, - leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context); + return service + .renewLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -4113,14 +4253,16 @@ public Mono> changeLeaseWithResponse = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.changeLease(this.client.getUrl(), containerName, blob, comp, - action, timeout, leaseId, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.changeLease(this.client.getUrl(), containerName, blob, comp, action, + timeout, leaseId, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -4157,14 +4299,16 @@ public Mono> changeLeaseWithResponse = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.changeLease(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, - proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context); + return service + .changeLease(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, proposedLeaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -4193,12 +4337,14 @@ public Mono changeLeaseAsync(String containerName, String blob, String lea Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId) { return changeLeaseWithResponseAsync(containerName, blob, leaseId, proposedLeaseId, timeout, ifModifiedSince, - ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -4228,12 +4374,14 @@ public Mono changeLeaseAsync(String containerName, String blob, String lea Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, Context context) { return changeLeaseWithResponseAsync(containerName, blob, leaseId, proposedLeaseId, timeout, ifModifiedSince, - ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, context).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -4268,14 +4416,16 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String c = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.changeLeaseNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, action, timeout, leaseId, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.changeLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + action, timeout, leaseId, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param leaseId Specifies the current lease ID on the resource. @@ -4312,14 +4462,16 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String c = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.changeLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, action, timeout, - leaseId, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, - ifTags, this.client.getVersion(), requestId, accept, context); + return service + .changeLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, + proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4356,14 +4508,16 @@ public Mono> breakLeaseWithResponseAs = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.breakLease(this.client.getUrl(), containerName, blob, comp, - action, timeout, breakPeriod, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, - ifTags, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.breakLease(this.client.getUrl(), containerName, blob, comp, action, timeout, + breakPeriod, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4402,14 +4556,16 @@ public Mono> breakLeaseWithResponseAs = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.breakLease(this.client.getUrl(), containerName, blob, comp, action, timeout, breakPeriod, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context); + return service + .breakLease(this.client.getUrl(), containerName, blob, comp, action, timeout, breakPeriod, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4440,12 +4596,14 @@ public Mono breakLeaseAsync(String containerName, String blob, Integer tim OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId) { return breakLeaseWithResponseAsync(containerName, blob, timeout, breakPeriod, ifModifiedSince, - ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4477,12 +4635,14 @@ public Mono breakLeaseAsync(String containerName, String blob, Integer tim OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, Context context) { return breakLeaseWithResponseAsync(containerName, blob, timeout, breakPeriod, ifModifiedSince, - ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, context).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4519,14 +4679,16 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String co = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.breakLeaseNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, action, timeout, breakPeriod, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.breakLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + action, timeout, breakPeriod, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4564,14 +4726,16 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String co = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.breakLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, action, timeout, - breakPeriod, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context); + return service + .breakLeaseNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, action, timeout, breakPeriod, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Create Snapshot operation creates a read-only snapshot of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4631,15 +4795,17 @@ public Mono> createSnapshotWithRe = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.createSnapshot(this.client.getUrl(), containerName, blob, comp, - timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, leaseId, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.createSnapshot(this.client.getUrl(), containerName, blob, comp, timeout, + metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, leaseId, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Create Snapshot operation creates a read-only snapshot of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4700,15 +4866,17 @@ public Mono> createSnapshotWithRe = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.createSnapshot(this.client.getUrl(), containerName, blob, comp, timeout, metadata, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, leaseId, this.client.getVersion(), requestId, - accept, context); + return service + .createSnapshot(this.client.getUrl(), containerName, blob, comp, timeout, metadata, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, leaseId, this.client.getVersion(), requestId, + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Create Snapshot operation creates a read-only snapshot of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4744,12 +4912,13 @@ public Mono createSnapshotAsync(String containerName, String blob, Integer EncryptionScope encryptionScopeParam) { return createSnapshotWithResponseAsync(containerName, blob, timeout, metadata, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, leaseId, requestId, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Create Snapshot operation creates a read-only snapshot of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4786,12 +4955,13 @@ public Mono createSnapshotAsync(String containerName, String blob, Integer EncryptionScope encryptionScopeParam, Context context) { return createSnapshotWithResponseAsync(containerName, blob, timeout, metadata, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, leaseId, requestId, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Create Snapshot operation creates a read-only snapshot of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4851,15 +5021,17 @@ public Mono> createSnapshotNoCustomHeadersWithResponseAsync(Strin = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.createSnapshotNoCustomHeaders(this.client.getUrl(), - containerName, blob, comp, timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, - encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - leaseId, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.createSnapshotNoCustomHeaders(this.client.getUrl(), containerName, blob, + comp, timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, leaseId, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Create Snapshot operation creates a read-only snapshot of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4920,15 +5092,17 @@ public Mono> createSnapshotNoCustomHeadersWithResponseAsync(Strin = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.createSnapshotNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, metadata, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, leaseId, this.client.getVersion(), requestId, - accept, context); + return service + .createSnapshotNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, metadata, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, leaseId, this.client.getVersion(), requestId, + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Start Copy From URL operation copies a blob or an internet resource to a new blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -4996,12 +5170,13 @@ public Mono> startCopyFromURLWi metadata, tier, rehydratePriority, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, leaseId, this.client.getVersion(), requestId, blobTagsString, - sealBlob, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context)); + sealBlob, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Start Copy From URL operation copies a blob or an internet resource to a new blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -5066,16 +5241,18 @@ public Mono> startCopyFromURLWi = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return service.startCopyFromURL(this.client.getUrl(), containerName, blob, timeout, metadata, tier, - rehydratePriority, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, - sourceIfNoneMatch, sourceIfTags, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, - ifTags, copySource, leaseId, this.client.getVersion(), requestId, blobTagsString, sealBlob, - immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context); + return service + .startCopyFromURL(this.client.getUrl(), containerName, blob, timeout, metadata, tier, rehydratePriority, + sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, + sourceIfTags, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + copySource, leaseId, this.client.getVersion(), requestId, blobTagsString, sealBlob, + immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Start Copy From URL operation copies a blob or an internet resource to a new blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -5131,12 +5308,13 @@ public Mono startCopyFromURLAsync(String containerName, String blob, Strin rehydratePriority, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, leaseId, requestId, blobTagsString, sealBlob, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Start Copy From URL operation copies a blob or an internet resource to a new blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -5193,12 +5371,13 @@ public Mono startCopyFromURLAsync(String containerName, String blob, Strin rehydratePriority, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, leaseId, requestId, blobTagsString, sealBlob, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Start Copy From URL operation copies a blob or an internet resource to a new blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -5261,17 +5440,19 @@ public Mono> startCopyFromURLNoCustomHeadersWithResponseAsync(Str = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return FluxUtil.withContext( - context -> service.startCopyFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, timeout, - metadata, tier, rehydratePriority, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, - sourceIfMatch, sourceIfNoneMatch, sourceIfTags, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - ifMatch, ifNoneMatch, ifTags, copySource, leaseId, this.client.getVersion(), requestId, blobTagsString, - sealBlob, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context)); + return FluxUtil + .withContext(context -> service.startCopyFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, + timeout, metadata, tier, rehydratePriority, sourceIfModifiedSinceConverted, + sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, leaseId, + this.client.getVersion(), requestId, blobTagsString, sealBlob, immutabilityPolicyExpiryConverted, + immutabilityPolicyMode, legalHold, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Start Copy From URL operation copies a blob or an internet resource to a new blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -5336,17 +5517,19 @@ public Mono> startCopyFromURLNoCustomHeadersWithResponseAsync(Str = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return service.startCopyFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, timeout, metadata, - tier, rehydratePriority, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, - sourceIfNoneMatch, sourceIfTags, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, - ifTags, copySource, leaseId, this.client.getVersion(), requestId, blobTagsString, sealBlob, - immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context); + return service + .startCopyFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, timeout, metadata, tier, + rehydratePriority, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, + sourceIfNoneMatch, sourceIfTags, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, copySource, leaseId, this.client.getVersion(), requestId, blobTagsString, sealBlob, + immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response * until the copy is complete. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -5420,18 +5603,20 @@ public Mono> copyFromURLWithResponse String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return FluxUtil.withContext(context -> service.copyFromURL(this.client.getUrl(), containerName, blob, - xMsRequiresSync, timeout, metadata, tier, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, - sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, copySource, leaseId, this.client.getVersion(), requestId, sourceContentMD5Converted, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, - copySourceAuthorization, encryptionScope, copySourceTags, accept, context)); + return FluxUtil + .withContext(context -> service.copyFromURL(this.client.getUrl(), containerName, blob, xMsRequiresSync, + timeout, metadata, tier, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, + sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, copySource, leaseId, this.client.getVersion(), requestId, + sourceContentMD5Converted, blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, + legalHold, copySourceAuthorization, encryptionScope, copySourceTags, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response * until the copy is complete. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -5506,18 +5691,20 @@ public Mono> copyFromURLWithResponse String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return service.copyFromURL(this.client.getUrl(), containerName, blob, xMsRequiresSync, timeout, metadata, tier, - sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, leaseId, - this.client.getVersion(), requestId, sourceContentMD5Converted, blobTagsString, - immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, copySourceAuthorization, - encryptionScope, copySourceTags, accept, context); + return service + .copyFromURL(this.client.getUrl(), containerName, blob, xMsRequiresSync, timeout, metadata, tier, + sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, leaseId, + this.client.getVersion(), requestId, sourceContentMD5Converted, blobTagsString, + immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, copySourceAuthorization, + encryptionScope, copySourceTags, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response * until the copy is complete. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -5576,13 +5763,14 @@ public Mono copyFromURLAsync(String containerName, String blob, String cop sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, leaseId, requestId, sourceContentMD5, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, copySourceAuthorization, copySourceTags, - encryptionScopeParam).flatMap(ignored -> Mono.empty()); + encryptionScopeParam).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response * until the copy is complete. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -5643,13 +5831,15 @@ public Mono copyFromURLAsync(String containerName, String blob, String cop sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, leaseId, requestId, sourceContentMD5, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, copySourceAuthorization, copySourceTags, - encryptionScopeParam, context).flatMap(ignored -> Mono.empty()); + encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response * until the copy is complete. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -5723,19 +5913,21 @@ public Mono> copyFromURLNoCustomHeadersWithResponseAsync(String c String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return FluxUtil.withContext( - context -> service.copyFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, xMsRequiresSync, - timeout, metadata, tier, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, - sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, copySource, leaseId, this.client.getVersion(), requestId, - sourceContentMD5Converted, blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, - legalHold, copySourceAuthorization, encryptionScope, copySourceTags, accept, context)); + return FluxUtil + .withContext(context -> service.copyFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, + xMsRequiresSync, timeout, metadata, tier, sourceIfModifiedSinceConverted, + sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, leaseId, this.client.getVersion(), + requestId, sourceContentMD5Converted, blobTagsString, immutabilityPolicyExpiryConverted, + immutabilityPolicyMode, legalHold, copySourceAuthorization, encryptionScope, copySourceTags, accept, + context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response * until the copy is complete. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -5810,18 +6002,20 @@ public Mono> copyFromURLNoCustomHeadersWithResponseAsync(String c String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return service.copyFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, xMsRequiresSync, timeout, - metadata, tier, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, - sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - copySource, leaseId, this.client.getVersion(), requestId, sourceContentMD5Converted, blobTagsString, - immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, copySourceAuthorization, - encryptionScope, copySourceTags, accept, context); + return service + .copyFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, xMsRequiresSync, timeout, metadata, + tier, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, + sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + copySource, leaseId, this.client.getVersion(), requestId, sourceContentMD5Converted, blobTagsString, + immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, copySourceAuthorization, + encryptionScope, copySourceTags, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with * zero length and full metadata. - * + * * @param containerName The container name. * @param blob The blob name. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. @@ -5843,13 +6037,14 @@ public Mono> abortCopyFromURLWi final String copyActionAbortConstant = "abort"; final String accept = "application/xml"; return FluxUtil.withContext(context -> service.abortCopyFromURL(this.client.getUrl(), containerName, blob, comp, - copyActionAbortConstant, copyId, timeout, leaseId, this.client.getVersion(), requestId, accept, context)); + copyActionAbortConstant, copyId, timeout, leaseId, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with * zero length and full metadata. - * + * * @param containerName The container name. * @param blob The blob name. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. @@ -5872,14 +6067,16 @@ public Mono> abortCopyFromURLWi final String comp = "copy"; final String copyActionAbortConstant = "abort"; final String accept = "application/xml"; - return service.abortCopyFromURL(this.client.getUrl(), containerName, blob, comp, copyActionAbortConstant, - copyId, timeout, leaseId, this.client.getVersion(), requestId, accept, context); + return service + .abortCopyFromURL(this.client.getUrl(), containerName, blob, comp, copyActionAbortConstant, copyId, timeout, + leaseId, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with * zero length and full metadata. - * + * * @param containerName The container name. * @param blob The blob name. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. @@ -5898,13 +6095,14 @@ public Mono> abortCopyFromURLWi public Mono abortCopyFromURLAsync(String containerName, String blob, String copyId, Integer timeout, String leaseId, String requestId) { return abortCopyFromURLWithResponseAsync(containerName, blob, copyId, timeout, leaseId, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with * zero length and full metadata. - * + * * @param containerName The container name. * @param blob The blob name. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. @@ -5924,13 +6122,14 @@ public Mono abortCopyFromURLAsync(String containerName, String blob, Strin public Mono abortCopyFromURLAsync(String containerName, String blob, String copyId, Integer timeout, String leaseId, String requestId, Context context) { return abortCopyFromURLWithResponseAsync(containerName, blob, copyId, timeout, leaseId, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with * zero length and full metadata. - * + * * @param containerName The container name. * @param blob The blob name. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. @@ -5953,13 +6152,14 @@ public Mono> abortCopyFromURLNoCustomHeadersWithResponseAsync(Str final String accept = "application/xml"; return FluxUtil.withContext(context -> service.abortCopyFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, copyActionAbortConstant, copyId, timeout, leaseId, this.client.getVersion(), - requestId, accept, context)); + requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with * zero length and full metadata. - * + * * @param containerName The container name. * @param blob The blob name. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. @@ -5981,8 +6181,10 @@ public Mono> abortCopyFromURLNoCustomHeadersWithResponseAsync(Str final String comp = "copy"; final String copyActionAbortConstant = "abort"; final String accept = "application/xml"; - return service.abortCopyFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, - copyActionAbortConstant, copyId, timeout, leaseId, this.client.getVersion(), requestId, accept, context); + return service + .abortCopyFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, copyActionAbortConstant, + copyId, timeout, leaseId, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -5990,7 +6192,7 @@ public Mono> abortCopyFromURLNoCustomHeadersWithResponseAsync(Str * account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's * tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines * Hot/Cool/Archive storage type. This operation does not update the blob's ETag. - * + * * @param containerName The container name. * @param blob The blob name. * @param tier Indicates the tier to be set on the blob. @@ -6019,9 +6221,11 @@ public Mono> setTierWithResponseAsync(St String requestId, String leaseId, String ifTags) { final String comp = "tier"; final String accept = "application/xml"; - return FluxUtil.withContext( - context -> service.setTier(this.client.getUrl(), containerName, blob, comp, snapshot, versionId, timeout, - tier, rehydratePriority, this.client.getVersion(), requestId, leaseId, ifTags, accept, context)); + return FluxUtil + .withContext(context -> service.setTier(this.client.getUrl(), containerName, blob, comp, snapshot, + versionId, timeout, tier, rehydratePriority, this.client.getVersion(), requestId, leaseId, ifTags, + accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -6029,7 +6233,7 @@ public Mono> setTierWithResponseAsync(St * account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's * tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines * Hot/Cool/Archive storage type. This operation does not update the blob's ETag. - * + * * @param containerName The container name. * @param blob The blob name. * @param tier Indicates the tier to be set on the blob. @@ -6059,8 +6263,10 @@ public Mono> setTierWithResponseAsync(St String requestId, String leaseId, String ifTags, Context context) { final String comp = "tier"; final String accept = "application/xml"; - return service.setTier(this.client.getUrl(), containerName, blob, comp, snapshot, versionId, timeout, tier, - rehydratePriority, this.client.getVersion(), requestId, leaseId, ifTags, accept, context); + return service + .setTier(this.client.getUrl(), containerName, blob, comp, snapshot, versionId, timeout, tier, + rehydratePriority, this.client.getVersion(), requestId, leaseId, ifTags, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -6068,7 +6274,7 @@ public Mono> setTierWithResponseAsync(St * account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's * tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines * Hot/Cool/Archive storage type. This operation does not update the blob's ETag. - * + * * @param containerName The container name. * @param blob The blob name. * @param tier Indicates the tier to be set on the blob. @@ -6096,7 +6302,9 @@ public Mono setTierAsync(String containerName, String blob, AccessTier tie String versionId, Integer timeout, RehydratePriority rehydratePriority, String requestId, String leaseId, String ifTags) { return setTierWithResponseAsync(containerName, blob, tier, snapshot, versionId, timeout, rehydratePriority, - requestId, leaseId, ifTags).flatMap(ignored -> Mono.empty()); + requestId, leaseId, ifTags) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -6104,7 +6312,7 @@ public Mono setTierAsync(String containerName, String blob, AccessTier tie * account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's * tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines * Hot/Cool/Archive storage type. This operation does not update the blob's ETag. - * + * * @param containerName The container name. * @param blob The blob name. * @param tier Indicates the tier to be set on the blob. @@ -6133,7 +6341,9 @@ public Mono setTierAsync(String containerName, String blob, AccessTier tie String versionId, Integer timeout, RehydratePriority rehydratePriority, String requestId, String leaseId, String ifTags, Context context) { return setTierWithResponseAsync(containerName, blob, tier, snapshot, versionId, timeout, rehydratePriority, - requestId, leaseId, ifTags, context).flatMap(ignored -> Mono.empty()); + requestId, leaseId, ifTags, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -6141,7 +6351,7 @@ public Mono setTierAsync(String containerName, String blob, AccessTier tie * account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's * tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines * Hot/Cool/Archive storage type. This operation does not update the blob's ETag. - * + * * @param containerName The container name. * @param blob The blob name. * @param tier Indicates the tier to be set on the blob. @@ -6170,9 +6380,11 @@ public Mono> setTierNoCustomHeadersWithResponseAsync(String conta String requestId, String leaseId, String ifTags) { final String comp = "tier"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setTierNoCustomHeaders(this.client.getUrl(), containerName, blob, - comp, snapshot, versionId, timeout, tier, rehydratePriority, this.client.getVersion(), requestId, leaseId, - ifTags, accept, context)); + return FluxUtil + .withContext(context -> service.setTierNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + snapshot, versionId, timeout, tier, rehydratePriority, this.client.getVersion(), requestId, leaseId, + ifTags, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -6180,7 +6392,7 @@ public Mono> setTierNoCustomHeadersWithResponseAsync(String conta * account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's * tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines * Hot/Cool/Archive storage type. This operation does not update the blob's ETag. - * + * * @param containerName The container name. * @param blob The blob name. * @param tier Indicates the tier to be set on the blob. @@ -6210,13 +6422,15 @@ public Mono> setTierNoCustomHeadersWithResponseAsync(String conta String requestId, String leaseId, String ifTags, Context context) { final String comp = "tier"; final String accept = "application/xml"; - return service.setTierNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, snapshot, versionId, - timeout, tier, rehydratePriority, this.client.getVersion(), requestId, leaseId, ifTags, accept, context); + return service + .setTierNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, snapshot, versionId, timeout, tier, + rehydratePriority, this.client.getVersion(), requestId, leaseId, ifTags, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Returns the sku name and account kind. - * + * * @param containerName The container name. * @param blob The blob name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -6230,13 +6444,15 @@ public Mono> getAccountInfoWithRe final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getAccountInfo(this.client.getUrl(), containerName, blob, - restype, comp, this.client.getVersion(), accept, context)); + return FluxUtil + .withContext(context -> service.getAccountInfo(this.client.getUrl(), containerName, blob, restype, comp, + this.client.getVersion(), accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Returns the sku name and account kind. - * + * * @param containerName The container name. * @param blob The blob name. * @param context The context to associate with this operation. @@ -6251,13 +6467,15 @@ public Mono> getAccountInfoWithRe final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; - return service.getAccountInfo(this.client.getUrl(), containerName, blob, restype, comp, - this.client.getVersion(), accept, context); + return service + .getAccountInfo(this.client.getUrl(), containerName, blob, restype, comp, this.client.getVersion(), accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Returns the sku name and account kind. - * + * * @param containerName The container name. * @param blob The blob name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -6267,12 +6485,14 @@ public Mono> getAccountInfoWithRe */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccountInfoAsync(String containerName, String blob) { - return getAccountInfoWithResponseAsync(containerName, blob).flatMap(ignored -> Mono.empty()); + return getAccountInfoWithResponseAsync(containerName, blob) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Returns the sku name and account kind. - * + * * @param containerName The container name. * @param blob The blob name. * @param context The context to associate with this operation. @@ -6283,12 +6503,14 @@ public Mono getAccountInfoAsync(String containerName, String blob) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccountInfoAsync(String containerName, String blob, Context context) { - return getAccountInfoWithResponseAsync(containerName, blob, context).flatMap(ignored -> Mono.empty()); + return getAccountInfoWithResponseAsync(containerName, blob, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Returns the sku name and account kind. - * + * * @param containerName The container name. * @param blob The blob name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -6301,13 +6523,15 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Strin final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getAccountInfoNoCustomHeaders(this.client.getUrl(), - containerName, blob, restype, comp, this.client.getVersion(), accept, context)); + return FluxUtil + .withContext(context -> service.getAccountInfoNoCustomHeaders(this.client.getUrl(), containerName, blob, + restype, comp, this.client.getVersion(), accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Returns the sku name and account kind. - * + * * @param containerName The container name. * @param blob The blob name. * @param context The context to associate with this operation. @@ -6322,13 +6546,15 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Strin final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; - return service.getAccountInfoNoCustomHeaders(this.client.getUrl(), containerName, blob, restype, comp, - this.client.getVersion(), accept, context); + return service + .getAccountInfoNoCustomHeaders(this.client.getUrl(), containerName, blob, restype, comp, + this.client.getVersion(), accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Query operation enables users to select/project on blob data by providing simple query expressions. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -6381,15 +6607,17 @@ public Mono>> queryWithResponse = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.query(this.client.getUrl(), containerName, blob, comp, snapshot, - timeout, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, queryRequest, - accept, context)); + return FluxUtil + .withContext(context -> service.query(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, + leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + queryRequest, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Query operation enables users to select/project on blob data by providing simple query expressions. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -6443,14 +6671,16 @@ public Mono>> queryWithResponse = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.query(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, leaseId, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, this.client.getVersion(), requestId, queryRequest, accept, context); + return service + .query(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, leaseId, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, this.client.getVersion(), requestId, queryRequest, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Query operation enables users to select/project on blob data by providing simple query expressions. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -6483,12 +6713,13 @@ public Flux queryAsync(String containerName, String blob, String sna String ifNoneMatch, String ifTags, String requestId, QueryRequest queryRequest, CpkInfo cpkInfo) { return queryWithResponseAsync(containerName, blob, snapshot, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, queryRequest, cpkInfo) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * The Query operation enables users to select/project on blob data by providing simple query expressions. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -6523,12 +6754,13 @@ public Flux queryAsync(String containerName, String blob, String sna Context context) { return queryWithResponseAsync(containerName, blob, snapshot, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, queryRequest, cpkInfo, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * The Query operation enables users to select/project on blob data by providing simple query expressions. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -6581,15 +6813,17 @@ public Mono queryNoCustomHeadersWithResponseAsync(String contain = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.queryNoCustomHeaders(this.client.getUrl(), containerName, blob, - comp, snapshot, timeout, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, queryRequest, accept, context)); + return FluxUtil + .withContext(context -> service.queryNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + snapshot, timeout, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, queryRequest, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Query operation enables users to select/project on blob data by providing simple query expressions. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -6643,15 +6877,17 @@ public Mono queryNoCustomHeadersWithResponseAsync(String contain = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.queryNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, leaseId, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, queryRequest, - accept, context); + return service + .queryNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, leaseId, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + queryRequest, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Tags operation enables users to get the tags associated with a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6677,13 +6913,15 @@ public Mono> getTagsWithResponseAsyn Integer timeout, String requestId, String snapshot, String versionId, String ifTags, String leaseId) { final String comp = "tags"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getTags(this.client.getUrl(), containerName, blob, comp, timeout, - this.client.getVersion(), requestId, snapshot, versionId, ifTags, leaseId, accept, context)); + return FluxUtil + .withContext(context -> service.getTags(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, snapshot, versionId, ifTags, leaseId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Tags operation enables users to get the tags associated with a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6711,13 +6949,15 @@ public Mono> getTagsWithResponseAsyn Context context) { final String comp = "tags"; final String accept = "application/xml"; - return service.getTags(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), - requestId, snapshot, versionId, ifTags, leaseId, accept, context); + return service + .getTags(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), requestId, + snapshot, versionId, ifTags, leaseId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Tags operation enables users to get the tags associated with a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6742,12 +6982,13 @@ public Mono> getTagsWithResponseAsyn public Mono getTagsAsync(String containerName, String blob, Integer timeout, String requestId, String snapshot, String versionId, String ifTags, String leaseId) { return getTagsWithResponseAsync(containerName, blob, timeout, requestId, snapshot, versionId, ifTags, leaseId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * The Get Tags operation enables users to get the tags associated with a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6773,12 +7014,13 @@ public Mono getTagsAsync(String containerName, String blob, Integer ti public Mono getTagsAsync(String containerName, String blob, Integer timeout, String requestId, String snapshot, String versionId, String ifTags, String leaseId, Context context) { return getTagsWithResponseAsync(containerName, blob, timeout, requestId, snapshot, versionId, ifTags, leaseId, - context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * The Get Tags operation enables users to get the tags associated with a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6804,13 +7046,15 @@ public Mono> getTagsNoCustomHeadersWithResponseAsync(String c Integer timeout, String requestId, String snapshot, String versionId, String ifTags, String leaseId) { final String comp = "tags"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getTagsNoCustomHeaders(this.client.getUrl(), containerName, blob, - comp, timeout, this.client.getVersion(), requestId, snapshot, versionId, ifTags, leaseId, accept, context)); + return FluxUtil + .withContext(context -> service.getTagsNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + timeout, this.client.getVersion(), requestId, snapshot, versionId, ifTags, leaseId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Tags operation enables users to get the tags associated with a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6838,13 +7082,15 @@ public Mono> getTagsNoCustomHeadersWithResponseAsync(String c Context context) { final String comp = "tags"; final String accept = "application/xml"; - return service.getTagsNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, - this.client.getVersion(), requestId, snapshot, versionId, ifTags, leaseId, accept, context); + return service + .getTagsNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), + requestId, snapshot, versionId, ifTags, leaseId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Tags operation enables users to set tags on a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6872,14 +7118,16 @@ public Mono> setTagsWithResponseAsync(St final String accept = "application/xml"; String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return FluxUtil.withContext(context -> service.setTags(this.client.getUrl(), containerName, blob, comp, - this.client.getVersion(), timeout, versionId, transactionalContentMD5Converted, - transactionalContentCrc64Converted, requestId, ifTags, leaseId, tags, accept, context)); + return FluxUtil + .withContext(context -> service.setTags(this.client.getUrl(), containerName, blob, comp, + this.client.getVersion(), timeout, versionId, transactionalContentMD5Converted, + transactionalContentCrc64Converted, requestId, ifTags, leaseId, tags, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Tags operation enables users to set tags on a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6908,14 +7156,16 @@ public Mono> setTagsWithResponseAsync(St final String accept = "application/xml"; String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.setTags(this.client.getUrl(), containerName, blob, comp, this.client.getVersion(), timeout, - versionId, transactionalContentMD5Converted, transactionalContentCrc64Converted, requestId, ifTags, leaseId, - tags, accept, context); + return service + .setTags(this.client.getUrl(), containerName, blob, comp, this.client.getVersion(), timeout, versionId, + transactionalContentMD5Converted, transactionalContentCrc64Converted, requestId, ifTags, leaseId, tags, + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Tags operation enables users to set tags on a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6940,12 +7190,14 @@ public Mono setTagsAsync(String containerName, String blob, Integer timeou byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String requestId, String ifTags, String leaseId, BlobTags tags) { return setTagsWithResponseAsync(containerName, blob, timeout, versionId, transactionalContentMD5, - transactionalContentCrc64, requestId, ifTags, leaseId, tags).flatMap(ignored -> Mono.empty()); + transactionalContentCrc64, requestId, ifTags, leaseId, tags) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Set Tags operation enables users to set tags on a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6971,12 +7223,14 @@ public Mono setTagsAsync(String containerName, String blob, Integer timeou byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String requestId, String ifTags, String leaseId, BlobTags tags, Context context) { return setTagsWithResponseAsync(containerName, blob, timeout, versionId, transactionalContentMD5, - transactionalContentCrc64, requestId, ifTags, leaseId, tags, context).flatMap(ignored -> Mono.empty()); + transactionalContentCrc64, requestId, ifTags, leaseId, tags, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Set Tags operation enables users to set tags on a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -7004,14 +7258,16 @@ public Mono> setTagsNoCustomHeadersWithResponseAsync(String conta final String accept = "application/xml"; String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return FluxUtil.withContext(context -> service.setTagsNoCustomHeaders(this.client.getUrl(), containerName, blob, - comp, this.client.getVersion(), timeout, versionId, transactionalContentMD5Converted, - transactionalContentCrc64Converted, requestId, ifTags, leaseId, tags, accept, context)); + return FluxUtil + .withContext(context -> service.setTagsNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + this.client.getVersion(), timeout, versionId, transactionalContentMD5Converted, + transactionalContentCrc64Converted, requestId, ifTags, leaseId, tags, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Set Tags operation enables users to set tags on a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -7040,8 +7296,10 @@ public Mono> setTagsNoCustomHeadersWithResponseAsync(String conta final String accept = "application/xml"; String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.setTagsNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, this.client.getVersion(), - timeout, versionId, transactionalContentMD5Converted, transactionalContentCrc64Converted, requestId, ifTags, - leaseId, tags, accept, context); + return service + .setTagsNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, this.client.getVersion(), timeout, + versionId, transactionalContentMD5Converted, transactionalContentCrc64Converted, requestId, ifTags, + leaseId, tags, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java index 5ae070424204..43e1069e53a9 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.blob.implementation; import com.azure.core.annotation.BodyParam; @@ -47,11 +46,13 @@ import java.util.Map; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import com.azure.storage.blob.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in BlockBlobs. */ public final class BlockBlobsImpl { + /** * The proxy service used to perform REST calls. */ @@ -64,7 +65,7 @@ public final class BlockBlobsImpl { /** * Initializes an instance of BlockBlobsImpl. - * + * * @param client the instance of the service client containing this operation class. */ BlockBlobsImpl(AzureBlobStorageImpl client) { @@ -80,6 +81,7 @@ public final class BlockBlobsImpl { @Host("{url}") @ServiceInterface(name = "AzureBlobStorageBloc") public interface BlockBlobsService { + @Put("/{containerName}/{blob}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -482,7 +484,7 @@ Mono> getBlockListNoCustomHeaders(@HostParam("url") String u * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a * block blob, use the Put Block List operation. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -590,13 +592,15 @@ public Mono> uploadWithResponseAsync DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return FluxUtil.withContext(context -> service.upload(this.client.getUrl(), containerName, blob, blobType, - timeout, transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, - contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, - transactionalContentCrc64Converted, body, accept, context)); + return FluxUtil + .withContext(context -> service.upload(this.client.getUrl(), containerName, blob, blobType, timeout, + transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, + contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, + transactionalContentCrc64Converted, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -604,7 +608,7 @@ public Mono> uploadWithResponseAsync * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a * block blob, use the Put Block List operation. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -713,13 +717,14 @@ public Mono> uploadWithResponseAsync DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.upload(this.client.getUrl(), containerName, blob, blobType, timeout, - transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, - contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, - transactionalContentCrc64Converted, body, accept, context); + return service + .upload(this.client.getUrl(), containerName, blob, blobType, timeout, transactionalContentMD5Converted, + contentLength, contentType, contentEncoding, contentLanguage, contentMd5Converted, cacheControl, + metadata, leaseId, contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, + encryptionScope, tier, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, + ifTags, this.client.getVersion(), requestId, blobTagsString, immutabilityPolicyExpiryConverted, + immutabilityPolicyMode, legalHold, transactionalContentCrc64Converted, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -727,7 +732,7 @@ public Mono> uploadWithResponseAsync * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a * block blob, use the Put Block List operation. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -776,7 +781,9 @@ public Mono uploadAsync(String containerName, String blob, long contentLen return uploadWithResponseAsync(containerName, blob, contentLength, body, timeout, transactionalContentMD5, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, transactionalContentCrc64, - blobHttpHeaders, cpkInfo, encryptionScopeParam).flatMap(ignored -> Mono.empty()); + blobHttpHeaders, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -784,7 +791,7 @@ public Mono uploadAsync(String containerName, String blob, long contentLen * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a * block blob, use the Put Block List operation. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -834,7 +841,9 @@ public Mono uploadAsync(String containerName, String blob, long contentLen return uploadWithResponseAsync(containerName, blob, contentLength, body, timeout, transactionalContentMD5, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, transactionalContentCrc64, - blobHttpHeaders, cpkInfo, encryptionScopeParam, context).flatMap(ignored -> Mono.empty()); + blobHttpHeaders, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -842,7 +851,7 @@ public Mono uploadAsync(String containerName, String blob, long contentLen * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a * block blob, use the Put Block List operation. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -950,13 +959,15 @@ public Mono> uploadNoCustomHeadersWithResponseAsync(String contai DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return FluxUtil.withContext(context -> service.uploadNoCustomHeaders(this.client.getUrl(), containerName, blob, - blobType, timeout, transactionalContentMD5Converted, contentLength, contentType, contentEncoding, - contentLanguage, contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, - transactionalContentCrc64Converted, body, accept, context)); + return FluxUtil + .withContext(context -> service.uploadNoCustomHeaders(this.client.getUrl(), containerName, blob, blobType, + timeout, transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, + contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, + transactionalContentCrc64Converted, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -964,7 +975,7 @@ public Mono> uploadNoCustomHeadersWithResponseAsync(String contai * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a * block blob, use the Put Block List operation. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1073,13 +1084,15 @@ public Mono> uploadNoCustomHeadersWithResponseAsync(String contai DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.uploadNoCustomHeaders(this.client.getUrl(), containerName, blob, blobType, timeout, - transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, - contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, - transactionalContentCrc64Converted, body, accept, context); + return service + .uploadNoCustomHeaders(this.client.getUrl(), containerName, blob, blobType, timeout, + transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, + contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, + transactionalContentCrc64Converted, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -1087,7 +1100,7 @@ public Mono> uploadNoCustomHeadersWithResponseAsync(String contai * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a * block blob, use the Put Block List operation. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1195,13 +1208,15 @@ public Mono> uploadWithResponseAsync DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return FluxUtil.withContext(context -> service.upload(this.client.getUrl(), containerName, blob, blobType, - timeout, transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, - contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, - transactionalContentCrc64Converted, body, accept, context)); + return FluxUtil + .withContext(context -> service.upload(this.client.getUrl(), containerName, blob, blobType, timeout, + transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, + contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, + transactionalContentCrc64Converted, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -1209,7 +1224,7 @@ public Mono> uploadWithResponseAsync * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a * block blob, use the Put Block List operation. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1318,13 +1333,14 @@ public Mono> uploadWithResponseAsync DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.upload(this.client.getUrl(), containerName, blob, blobType, timeout, - transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, - contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, - transactionalContentCrc64Converted, body, accept, context); + return service + .upload(this.client.getUrl(), containerName, blob, blobType, timeout, transactionalContentMD5Converted, + contentLength, contentType, contentEncoding, contentLanguage, contentMd5Converted, cacheControl, + metadata, leaseId, contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, + encryptionScope, tier, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, + ifTags, this.client.getVersion(), requestId, blobTagsString, immutabilityPolicyExpiryConverted, + immutabilityPolicyMode, legalHold, transactionalContentCrc64Converted, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -1332,7 +1348,7 @@ public Mono> uploadWithResponseAsync * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a * block blob, use the Put Block List operation. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1381,7 +1397,9 @@ public Mono uploadAsync(String containerName, String blob, long contentLen return uploadWithResponseAsync(containerName, blob, contentLength, body, timeout, transactionalContentMD5, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, transactionalContentCrc64, - blobHttpHeaders, cpkInfo, encryptionScopeParam).flatMap(ignored -> Mono.empty()); + blobHttpHeaders, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -1389,7 +1407,7 @@ public Mono uploadAsync(String containerName, String blob, long contentLen * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a * block blob, use the Put Block List operation. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1439,7 +1457,9 @@ public Mono uploadAsync(String containerName, String blob, long contentLen return uploadWithResponseAsync(containerName, blob, contentLength, body, timeout, transactionalContentMD5, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, transactionalContentCrc64, - blobHttpHeaders, cpkInfo, encryptionScopeParam, context).flatMap(ignored -> Mono.empty()); + blobHttpHeaders, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -1447,7 +1467,7 @@ public Mono uploadAsync(String containerName, String blob, long contentLen * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a * block blob, use the Put Block List operation. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1555,13 +1575,15 @@ public Mono> uploadNoCustomHeadersWithResponseAsync(String contai DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return FluxUtil.withContext(context -> service.uploadNoCustomHeaders(this.client.getUrl(), containerName, blob, - blobType, timeout, transactionalContentMD5Converted, contentLength, contentType, contentEncoding, - contentLanguage, contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, - transactionalContentCrc64Converted, body, accept, context)); + return FluxUtil + .withContext(context -> service.uploadNoCustomHeaders(this.client.getUrl(), containerName, blob, blobType, + timeout, transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, + contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, + transactionalContentCrc64Converted, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -1569,7 +1591,7 @@ public Mono> uploadNoCustomHeadersWithResponseAsync(String contai * overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the * existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a * block blob, use the Put Block List operation. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1678,13 +1700,15 @@ public Mono> uploadNoCustomHeadersWithResponseAsync(String contai DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.uploadNoCustomHeaders(this.client.getUrl(), containerName, blob, blobType, timeout, - transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, - contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, - transactionalContentCrc64Converted, body, accept, context); + return service + .uploadNoCustomHeaders(this.client.getUrl(), containerName, blob, blobType, timeout, + transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, + contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, + transactionalContentCrc64Converted, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -1693,7 +1717,7 @@ public Mono> uploadNoCustomHeadersWithResponseAsync(String contai * from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial * updates to a block blob's contents using a source URL, use the Put Block from URL API in conjunction with Put * Block List. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1817,14 +1841,16 @@ public Mono> putBlobFromUrlW DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); - return FluxUtil.withContext(context -> service.putBlobFromUrl(this.client.getUrl(), containerName, blob, - blobType, timeout, transactionalContentMD5Converted, contentLength, contentType, contentEncoding, - contentLanguage, contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, - sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, this.client.getVersion(), - requestId, sourceContentMD5Converted, blobTagsString, copySource, copySourceBlobProperties, - copySourceAuthorization, copySourceTags, accept, context)); + return FluxUtil + .withContext(context -> service.putBlobFromUrl(this.client.getUrl(), containerName, blob, blobType, timeout, + transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, + contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, + sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, + this.client.getVersion(), requestId, sourceContentMD5Converted, blobTagsString, copySource, + copySourceBlobProperties, copySourceAuthorization, copySourceTags, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -1833,7 +1859,7 @@ public Mono> putBlobFromUrlW * from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial * updates to a block blob's contents using a source URL, use the Put Block from URL API in conjunction with Put * Block List. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1958,14 +1984,16 @@ public Mono> putBlobFromUrlW DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); - return service.putBlobFromUrl(this.client.getUrl(), containerName, blob, blobType, timeout, - transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, - contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, - sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, this.client.getVersion(), - requestId, sourceContentMD5Converted, blobTagsString, copySource, copySourceBlobProperties, - copySourceAuthorization, copySourceTags, accept, context); + return service + .putBlobFromUrl(this.client.getUrl(), containerName, blob, blobType, timeout, + transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, + contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, + sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, + this.client.getVersion(), requestId, sourceContentMD5Converted, blobTagsString, copySource, + copySourceBlobProperties, copySourceAuthorization, copySourceTags, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -1974,7 +2002,7 @@ public Mono> putBlobFromUrlW * from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial * updates to a block blob's contents using a source URL, use the Put Block from URL API in conjunction with Put * Block List. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -2038,7 +2066,9 @@ public Mono putBlobFromUrlAsync(String containerName, String blob, long co transactionalContentMD5, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, requestId, sourceContentMD5, blobTagsString, copySourceBlobProperties, copySourceAuthorization, - copySourceTags, blobHttpHeaders, cpkInfo, encryptionScopeParam).flatMap(ignored -> Mono.empty()); + copySourceTags, blobHttpHeaders, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -2047,7 +2077,7 @@ public Mono putBlobFromUrlAsync(String containerName, String blob, long co * from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial * updates to a block blob's contents using a source URL, use the Put Block from URL API in conjunction with Put * Block List. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -2112,7 +2142,9 @@ public Mono putBlobFromUrlAsync(String containerName, String blob, long co transactionalContentMD5, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, requestId, sourceContentMD5, blobTagsString, copySourceBlobProperties, copySourceAuthorization, - copySourceTags, blobHttpHeaders, cpkInfo, encryptionScopeParam, context).flatMap(ignored -> Mono.empty()); + copySourceTags, blobHttpHeaders, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -2121,7 +2153,7 @@ public Mono putBlobFromUrlAsync(String containerName, String blob, long co * from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial * updates to a block blob's contents using a source URL, use the Put Block from URL API in conjunction with Put * Block List. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -2244,14 +2276,16 @@ public Mono> putBlobFromUrlNoCustomHeadersWithResponseAsync(Strin DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); - return FluxUtil.withContext(context -> service.putBlobFromUrlNoCustomHeaders(this.client.getUrl(), - containerName, blob, blobType, timeout, transactionalContentMD5Converted, contentLength, contentType, - contentEncoding, contentLanguage, contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, - sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, this.client.getVersion(), - requestId, sourceContentMD5Converted, blobTagsString, copySource, copySourceBlobProperties, - copySourceAuthorization, copySourceTags, accept, context)); + return FluxUtil + .withContext(context -> service.putBlobFromUrlNoCustomHeaders(this.client.getUrl(), containerName, blob, + blobType, timeout, transactionalContentMD5Converted, contentLength, contentType, contentEncoding, + contentLanguage, contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, + sourceIfTags, this.client.getVersion(), requestId, sourceContentMD5Converted, blobTagsString, + copySource, copySourceBlobProperties, copySourceAuthorization, copySourceTags, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -2260,7 +2294,7 @@ public Mono> putBlobFromUrlNoCustomHeadersWithResponseAsync(Strin * from URL; the content of an existing blob is overwritten with the content of the new blob. To perform partial * updates to a block blob's contents using a source URL, use the Put Block from URL API in conjunction with Put * Block List. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -2384,19 +2418,21 @@ public Mono> putBlobFromUrlNoCustomHeadersWithResponseAsync(Strin DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); - return service.putBlobFromUrlNoCustomHeaders(this.client.getUrl(), containerName, blob, blobType, timeout, - transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, - contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, - sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, this.client.getVersion(), - requestId, sourceContentMD5Converted, blobTagsString, copySource, copySourceBlobProperties, - copySourceAuthorization, copySourceTags, accept, context); + return service + .putBlobFromUrlNoCustomHeaders(this.client.getUrl(), containerName, blob, blobType, timeout, + transactionalContentMD5Converted, contentLength, contentType, contentEncoding, contentLanguage, + contentMd5Converted, cacheControl, metadata, leaseId, contentDisposition, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, + sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, + this.client.getVersion(), requestId, sourceContentMD5Converted, blobTagsString, copySource, + copySourceBlobProperties, copySourceAuthorization, copySourceTags, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Stage Block operation creates a new block to be committed as part of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -2448,15 +2484,17 @@ public Mono> stageBlockWithRespo String encryptionScope = encryptionScopeInternal; String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return FluxUtil.withContext(context -> service.stageBlock(this.client.getUrl(), containerName, blob, comp, - blockId, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, - leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, this.client.getVersion(), - requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.stageBlock(this.client.getUrl(), containerName, blob, comp, blockId, + contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, leaseId, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, this.client.getVersion(), + requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Stage Block operation creates a new block to be committed as part of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -2509,15 +2547,17 @@ public Mono> stageBlockWithRespo String encryptionScope = encryptionScopeInternal; String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.stageBlock(this.client.getUrl(), containerName, blob, comp, blockId, contentLength, - transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, leaseId, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, this.client.getVersion(), requestId, body, - accept, context); + return service + .stageBlock(this.client.getUrl(), containerName, blob, comp, blockId, contentLength, + transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, leaseId, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, this.client.getVersion(), requestId, body, + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Stage Block operation creates a new block to be committed as part of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -2546,12 +2586,13 @@ public Mono stageBlockAsync(String containerName, String blob, String bloc String leaseId, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { return stageBlockWithResponseAsync(containerName, blob, blockId, contentLength, body, transactionalContentMD5, transactionalContentCrc64, timeout, leaseId, requestId, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Stage Block operation creates a new block to be committed as part of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -2581,12 +2622,13 @@ public Mono stageBlockAsync(String containerName, String blob, String bloc String leaseId, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { return stageBlockWithResponseAsync(containerName, blob, blockId, contentLength, body, transactionalContentMD5, transactionalContentCrc64, timeout, leaseId, requestId, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Stage Block operation creates a new block to be committed as part of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -2638,15 +2680,17 @@ public Mono> stageBlockNoCustomHeadersWithResponseAsync(String co String encryptionScope = encryptionScopeInternal; String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return FluxUtil.withContext(context -> service.stageBlockNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, blockId, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, - timeout, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.stageBlockNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + blockId, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, + leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Stage Block operation creates a new block to be committed as part of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -2699,15 +2743,17 @@ public Mono> stageBlockNoCustomHeadersWithResponseAsync(String co String encryptionScope = encryptionScopeInternal; String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.stageBlockNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, blockId, - contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, leaseId, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, this.client.getVersion(), - requestId, body, accept, context); + return service + .stageBlockNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, blockId, contentLength, + transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, leaseId, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, this.client.getVersion(), requestId, body, + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Stage Block operation creates a new block to be committed as part of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -2759,15 +2805,17 @@ public Mono> stageBlockWithRespo String encryptionScope = encryptionScopeInternal; String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return FluxUtil.withContext(context -> service.stageBlock(this.client.getUrl(), containerName, blob, comp, - blockId, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, - leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, this.client.getVersion(), - requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.stageBlock(this.client.getUrl(), containerName, blob, comp, blockId, + contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, leaseId, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, this.client.getVersion(), + requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Stage Block operation creates a new block to be committed as part of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -2820,15 +2868,17 @@ public Mono> stageBlockWithRespo String encryptionScope = encryptionScopeInternal; String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.stageBlock(this.client.getUrl(), containerName, blob, comp, blockId, contentLength, - transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, leaseId, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, this.client.getVersion(), requestId, body, - accept, context); + return service + .stageBlock(this.client.getUrl(), containerName, blob, comp, blockId, contentLength, + transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, leaseId, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, this.client.getVersion(), requestId, body, + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Stage Block operation creates a new block to be committed as part of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -2857,12 +2907,13 @@ public Mono stageBlockAsync(String containerName, String blob, String bloc String leaseId, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { return stageBlockWithResponseAsync(containerName, blob, blockId, contentLength, body, transactionalContentMD5, transactionalContentCrc64, timeout, leaseId, requestId, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Stage Block operation creates a new block to be committed as part of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -2892,12 +2943,13 @@ public Mono stageBlockAsync(String containerName, String blob, String bloc String leaseId, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { return stageBlockWithResponseAsync(containerName, blob, blockId, contentLength, body, transactionalContentMD5, transactionalContentCrc64, timeout, leaseId, requestId, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Stage Block operation creates a new block to be committed as part of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -2949,15 +3001,17 @@ public Mono> stageBlockNoCustomHeadersWithResponseAsync(String co String encryptionScope = encryptionScopeInternal; String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return FluxUtil.withContext(context -> service.stageBlockNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, blockId, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, - timeout, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.stageBlockNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + blockId, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, + leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Stage Block operation creates a new block to be committed as part of a blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -3010,16 +3064,18 @@ public Mono> stageBlockNoCustomHeadersWithResponseAsync(String co String encryptionScope = encryptionScopeInternal; String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.stageBlockNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, blockId, - contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, leaseId, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, this.client.getVersion(), - requestId, body, accept, context); + return service + .stageBlockNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, blockId, contentLength, + transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, leaseId, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, this.client.getVersion(), requestId, body, + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from * a URL. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -3087,17 +3143,19 @@ public Mono> stageBlockFr = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return FluxUtil.withContext(context -> service.stageBlockFromURL(this.client.getUrl(), containerName, blob, - comp, blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, - sourceContentcrc64Converted, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, - encryptionScope, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, - sourceIfNoneMatch, this.client.getVersion(), requestId, copySourceAuthorization, accept, context)); + return FluxUtil + .withContext(context -> service.stageBlockFromURL(this.client.getUrl(), containerName, blob, comp, blockId, + contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, + sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, + this.client.getVersion(), requestId, copySourceAuthorization, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from * a URL. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -3166,17 +3224,19 @@ public Mono> stageBlockFr = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.stageBlockFromURL(this.client.getUrl(), containerName, blob, comp, blockId, contentLength, - sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, sourceIfModifiedSinceConverted, - sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, this.client.getVersion(), requestId, - copySourceAuthorization, accept, context); + return service + .stageBlockFromURL(this.client.getUrl(), containerName, blob, comp, blockId, contentLength, sourceUrl, + sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, sourceIfModifiedSinceConverted, + sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, this.client.getVersion(), requestId, + copySourceAuthorization, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from * a URL. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -3218,13 +3278,14 @@ public Mono stageBlockFromURLAsync(String containerName, String blob, Stri return stageBlockFromURLWithResponseAsync(containerName, blob, blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5, sourceContentcrc64, timeout, leaseId, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestId, copySourceAuthorization, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from * a URL. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -3267,13 +3328,14 @@ public Mono stageBlockFromURLAsync(String containerName, String blob, Stri return stageBlockFromURLWithResponseAsync(containerName, blob, blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5, sourceContentcrc64, timeout, leaseId, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestId, copySourceAuthorization, cpkInfo, encryptionScopeParam, - context).flatMap(ignored -> Mono.empty()); + context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from * a URL. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -3344,13 +3406,14 @@ public Mono> stageBlockFromURLNoCustomHeadersWithResponseAsync(St containerName, blob, comp, blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, - sourceIfNoneMatch, this.client.getVersion(), requestId, copySourceAuthorization, accept, context)); + sourceIfNoneMatch, this.client.getVersion(), requestId, copySourceAuthorization, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from * a URL. - * + * * @param containerName The container name. * @param blob The blob name. * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less @@ -3418,11 +3481,13 @@ public Mono> stageBlockFromURLNoCustomHeadersWithResponseAsync(St = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.stageBlockFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, blockId, - contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, - sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, - this.client.getVersion(), requestId, copySourceAuthorization, accept, context); + return service + .stageBlockFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, blockId, contentLength, + sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, sourceIfModifiedSinceConverted, + sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, this.client.getVersion(), requestId, + copySourceAuthorization, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -3432,7 +3497,7 @@ public Mono> stageBlockFromURLNoCustomHeadersWithResponseAsync(St * committing the new and existing blocks together. You can do this by specifying whether to commit a block from the * committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the * block, whichever list it may belong to. - * + * * @param containerName The container name. * @param blob The blob name. * @param blocks Blob Blocks. @@ -3539,13 +3604,15 @@ public Mono> commitBlockLis = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return FluxUtil.withContext(context -> service.commitBlockList(this.client.getUrl(), containerName, blob, comp, - timeout, cacheControl, contentType, contentEncoding, contentLanguage, contentMd5Converted, - transactionalContentMD5Converted, transactionalContentCrc64Converted, metadata, leaseId, contentDisposition, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, blocks, accept, - context)); + return FluxUtil + .withContext(context -> service.commitBlockList(this.client.getUrl(), containerName, blob, comp, timeout, + cacheControl, contentType, contentEncoding, contentLanguage, contentMd5Converted, + transactionalContentMD5Converted, transactionalContentCrc64Converted, metadata, leaseId, + contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, blobTagsString, immutabilityPolicyExpiryConverted, + immutabilityPolicyMode, legalHold, blocks, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -3555,7 +3622,7 @@ public Mono> commitBlockLis * committing the new and existing blocks together. You can do this by specifying whether to commit a block from the * committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the * block, whichever list it may belong to. - * + * * @param containerName The container name. * @param blob The blob name. * @param blocks Blob Blocks. @@ -3663,13 +3730,15 @@ public Mono> commitBlockLis = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return service.commitBlockList(this.client.getUrl(), containerName, blob, comp, timeout, cacheControl, - contentType, contentEncoding, contentLanguage, contentMd5Converted, transactionalContentMD5Converted, - transactionalContentCrc64Converted, metadata, leaseId, contentDisposition, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, blocks, accept, - context); + return service + .commitBlockList(this.client.getUrl(), containerName, blob, comp, timeout, cacheControl, contentType, + contentEncoding, contentLanguage, contentMd5Converted, transactionalContentMD5Converted, + transactionalContentCrc64Converted, metadata, leaseId, contentDisposition, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, blocks, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -3679,7 +3748,7 @@ public Mono> commitBlockLis * committing the new and existing blocks together. You can do this by specifying whether to commit a block from the * committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the * block, whichever list it may belong to. - * + * * @param containerName The container name. * @param blob The blob name. * @param blocks Blob Blocks. @@ -3727,7 +3796,9 @@ public Mono commitBlockListAsync(String containerName, String blob, BlockL return commitBlockListWithResponseAsync(containerName, blob, blocks, timeout, transactionalContentMD5, transactionalContentCrc64, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, - blobHttpHeaders, cpkInfo, encryptionScopeParam).flatMap(ignored -> Mono.empty()); + blobHttpHeaders, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -3737,7 +3808,7 @@ public Mono commitBlockListAsync(String containerName, String blob, BlockL * committing the new and existing blocks together. You can do this by specifying whether to commit a block from the * committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the * block, whichever list it may belong to. - * + * * @param containerName The container name. * @param blob The blob name. * @param blocks Blob Blocks. @@ -3786,7 +3857,9 @@ public Mono commitBlockListAsync(String containerName, String blob, BlockL return commitBlockListWithResponseAsync(containerName, blob, blocks, timeout, transactionalContentMD5, transactionalContentCrc64, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, - blobHttpHeaders, cpkInfo, encryptionScopeParam, context).flatMap(ignored -> Mono.empty()); + blobHttpHeaders, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -3796,7 +3869,7 @@ public Mono commitBlockListAsync(String containerName, String blob, BlockL * committing the new and existing blocks together. You can do this by specifying whether to commit a block from the * committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the * block, whichever list it may belong to. - * + * * @param containerName The container name. * @param blob The blob name. * @param blocks Blob Blocks. @@ -3903,13 +3976,15 @@ public Mono> commitBlockListNoCustomHeadersWithResponseAsync(Stri = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return FluxUtil.withContext(context -> service.commitBlockListNoCustomHeaders(this.client.getUrl(), - containerName, blob, comp, timeout, cacheControl, contentType, contentEncoding, contentLanguage, - contentMd5Converted, transactionalContentMD5Converted, transactionalContentCrc64Converted, metadata, - leaseId, contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, blobTagsString, immutabilityPolicyExpiryConverted, - immutabilityPolicyMode, legalHold, blocks, accept, context)); + return FluxUtil + .withContext(context -> service.commitBlockListNoCustomHeaders(this.client.getUrl(), containerName, blob, + comp, timeout, cacheControl, contentType, contentEncoding, contentLanguage, contentMd5Converted, + transactionalContentMD5Converted, transactionalContentCrc64Converted, metadata, leaseId, + contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, blobTagsString, immutabilityPolicyExpiryConverted, + immutabilityPolicyMode, legalHold, blocks, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -3919,7 +3994,7 @@ public Mono> commitBlockListNoCustomHeadersWithResponseAsync(Stri * committing the new and existing blocks together. You can do this by specifying whether to commit a block from the * committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the * block, whichever list it may belong to. - * + * * @param containerName The container name. * @param blob The blob name. * @param blocks Blob Blocks. @@ -4027,18 +4102,20 @@ public Mono> commitBlockListNoCustomHeadersWithResponseAsync(Stri = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return service.commitBlockListNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, - cacheControl, contentType, contentEncoding, contentLanguage, contentMd5Converted, - transactionalContentMD5Converted, transactionalContentCrc64Converted, metadata, leaseId, contentDisposition, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, blocks, accept, - context); + return service + .commitBlockListNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, cacheControl, + contentType, contentEncoding, contentLanguage, contentMd5Converted, transactionalContentMD5Converted, + transactionalContentCrc64Converted, metadata, leaseId, contentDisposition, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, tier, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, blocks, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both @@ -4065,13 +4142,15 @@ public Mono> getBlockList String ifTags, String requestId) { final String comp = "blocklist"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getBlockList(this.client.getUrl(), containerName, blob, comp, - snapshot, listType, timeout, leaseId, ifTags, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getBlockList(this.client.getUrl(), containerName, blob, comp, snapshot, + listType, timeout, leaseId, ifTags, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both @@ -4099,13 +4178,15 @@ public Mono> getBlockList String ifTags, String requestId, Context context) { final String comp = "blocklist"; final String accept = "application/xml"; - return service.getBlockList(this.client.getUrl(), containerName, blob, comp, snapshot, listType, timeout, - leaseId, ifTags, this.client.getVersion(), requestId, accept, context); + return service + .getBlockList(this.client.getUrl(), containerName, blob, comp, snapshot, listType, timeout, leaseId, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both @@ -4130,12 +4211,13 @@ public Mono> getBlockList public Mono getBlockListAsync(String containerName, String blob, BlockListType listType, String snapshot, Integer timeout, String leaseId, String ifTags, String requestId) { return getBlockListWithResponseAsync(containerName, blob, listType, snapshot, timeout, leaseId, ifTags, - requestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + requestId).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both @@ -4161,12 +4243,13 @@ public Mono getBlockListAsync(String containerName, String blob, Bloc public Mono getBlockListAsync(String containerName, String blob, BlockListType listType, String snapshot, Integer timeout, String leaseId, String ifTags, String requestId, Context context) { return getBlockListWithResponseAsync(containerName, blob, listType, snapshot, timeout, leaseId, ifTags, - requestId, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + requestId, context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both @@ -4194,12 +4277,13 @@ public Mono> getBlockListNoCustomHeadersWithResponseAsync(St final String accept = "application/xml"; return FluxUtil .withContext(context -> service.getBlockListNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, - snapshot, listType, timeout, leaseId, ifTags, this.client.getVersion(), requestId, accept, context)); + snapshot, listType, timeout, leaseId, ifTags, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both @@ -4227,7 +4311,9 @@ public Mono> getBlockListNoCustomHeadersWithResponseAsync(St Context context) { final String comp = "blocklist"; final String accept = "application/xml"; - return service.getBlockListNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, snapshot, listType, - timeout, leaseId, ifTags, this.client.getVersion(), requestId, accept, context); + return service + .getBlockListNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, snapshot, listType, timeout, + leaseId, ifTags, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java index 804f32d8a8b9..ab18e0932842 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.blob.implementation; import com.azure.core.annotation.BodyParam; @@ -63,11 +62,13 @@ import java.util.stream.Collectors; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import com.azure.storage.blob.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in Containers. */ public final class ContainersImpl { + /** * The proxy service used to perform REST calls. */ @@ -80,7 +81,7 @@ public final class ContainersImpl { /** * Initializes an instance of ContainersImpl. - * + * * @param client the instance of the service client containing this operation class. */ ContainersImpl(AzureBlobStorageImpl client) { @@ -96,6 +97,7 @@ public final class ContainersImpl { @Host("{url}") @ServiceInterface(name = "AzureBlobStorageCont") public interface ContainersService { + @Put("/{containerName}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -526,7 +528,7 @@ Mono> getAccountInfoNoCustomHeaders(@HostParam("url") String url, /** * creates a new container under the specified account. If the container with the same name already exists, the * operation fails. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -563,15 +565,17 @@ public Mono> createWithResponseAsync = blobContainerEncryptionScope.isEncryptionScopeOverridePrevented(); } Boolean encryptionScopeOverridePrevented = encryptionScopeOverridePreventedInternal; - return FluxUtil.withContext(context -> service.create(this.client.getUrl(), containerName, restype, timeout, - metadata, access, this.client.getVersion(), requestId, defaultEncryptionScope, - encryptionScopeOverridePrevented, accept, context)); + return FluxUtil + .withContext(context -> service.create(this.client.getUrl(), containerName, restype, timeout, metadata, + access, this.client.getVersion(), requestId, defaultEncryptionScope, encryptionScopeOverridePrevented, + accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * creates a new container under the specified account. If the container with the same name already exists, the * operation fails. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -609,15 +613,16 @@ public Mono> createWithResponseAsync = blobContainerEncryptionScope.isEncryptionScopeOverridePrevented(); } Boolean encryptionScopeOverridePrevented = encryptionScopeOverridePreventedInternal; - return service.create(this.client.getUrl(), containerName, restype, timeout, metadata, access, - this.client.getVersion(), requestId, defaultEncryptionScope, encryptionScopeOverridePrevented, accept, - context); + return service + .create(this.client.getUrl(), containerName, restype, timeout, metadata, access, this.client.getVersion(), + requestId, defaultEncryptionScope, encryptionScopeOverridePrevented, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * creates a new container under the specified account. If the container with the same name already exists, the * operation fails. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -641,13 +646,15 @@ public Mono> createWithResponseAsync public Mono createAsync(String containerName, Integer timeout, Map metadata, PublicAccessType access, String requestId, BlobContainerEncryptionScope blobContainerEncryptionScope) { return createWithResponseAsync(containerName, timeout, metadata, access, requestId, - blobContainerEncryptionScope).flatMap(ignored -> Mono.empty()); + blobContainerEncryptionScope) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * creates a new container under the specified account. If the container with the same name already exists, the * operation fails. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -673,13 +680,15 @@ public Mono createAsync(String containerName, Integer timeout, Map Mono.empty()); + blobContainerEncryptionScope, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * creates a new container under the specified account. If the container with the same name already exists, the * operation fails. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -716,15 +725,17 @@ public Mono> createNoCustomHeadersWithResponseAsync(String contai = blobContainerEncryptionScope.isEncryptionScopeOverridePrevented(); } Boolean encryptionScopeOverridePrevented = encryptionScopeOverridePreventedInternal; - return FluxUtil.withContext(context -> service.createNoCustomHeaders(this.client.getUrl(), containerName, - restype, timeout, metadata, access, this.client.getVersion(), requestId, defaultEncryptionScope, - encryptionScopeOverridePrevented, accept, context)); + return FluxUtil + .withContext(context -> service.createNoCustomHeaders(this.client.getUrl(), containerName, restype, timeout, + metadata, access, this.client.getVersion(), requestId, defaultEncryptionScope, + encryptionScopeOverridePrevented, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * creates a new container under the specified account. If the container with the same name already exists, the * operation fails. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -762,15 +773,17 @@ public Mono> createNoCustomHeadersWithResponseAsync(String contai = blobContainerEncryptionScope.isEncryptionScopeOverridePrevented(); } Boolean encryptionScopeOverridePrevented = encryptionScopeOverridePreventedInternal; - return service.createNoCustomHeaders(this.client.getUrl(), containerName, restype, timeout, metadata, access, - this.client.getVersion(), requestId, defaultEncryptionScope, encryptionScopeOverridePrevented, accept, - context); + return service + .createNoCustomHeaders(this.client.getUrl(), containerName, restype, timeout, metadata, access, + this.client.getVersion(), requestId, defaultEncryptionScope, encryptionScopeOverridePrevented, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * returns all user-defined metadata and system properties for the specified container. The data returned does not * include the container's list of blobs. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -788,14 +801,16 @@ public Mono> getPropertiesWit Integer timeout, String leaseId, String requestId) { final String restype = "container"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getProperties(this.client.getUrl(), containerName, restype, - timeout, leaseId, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getProperties(this.client.getUrl(), containerName, restype, timeout, + leaseId, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * returns all user-defined metadata and system properties for the specified container. The data returned does not * include the container's list of blobs. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -814,14 +829,16 @@ public Mono> getPropertiesWit Integer timeout, String leaseId, String requestId, Context context) { final String restype = "container"; final String accept = "application/xml"; - return service.getProperties(this.client.getUrl(), containerName, restype, timeout, leaseId, - this.client.getVersion(), requestId, accept, context); + return service + .getProperties(this.client.getUrl(), containerName, restype, timeout, leaseId, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * returns all user-defined metadata and system properties for the specified container. The data returned does not * include the container's list of blobs. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -837,13 +854,14 @@ public Mono> getPropertiesWit @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesAsync(String containerName, Integer timeout, String leaseId, String requestId) { return getPropertiesWithResponseAsync(containerName, timeout, leaseId, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * returns all user-defined metadata and system properties for the specified container. The data returned does not * include the container's list of blobs. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -861,13 +879,14 @@ public Mono getPropertiesAsync(String containerName, Integer timeout, Stri public Mono getPropertiesAsync(String containerName, Integer timeout, String leaseId, String requestId, Context context) { return getPropertiesWithResponseAsync(containerName, timeout, leaseId, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * returns all user-defined metadata and system properties for the specified container. The data returned does not * include the container's list of blobs. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -885,14 +904,16 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String String leaseId, String requestId) { final String restype = "container"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), containerName, - restype, timeout, leaseId, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), containerName, restype, + timeout, leaseId, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * returns all user-defined metadata and system properties for the specified container. The data returned does not * include the container's list of blobs. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -911,14 +932,16 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String String leaseId, String requestId, Context context) { final String restype = "container"; final String accept = "application/xml"; - return service.getPropertiesNoCustomHeaders(this.client.getUrl(), containerName, restype, timeout, leaseId, - this.client.getVersion(), requestId, accept, context); + return service + .getPropertiesNoCustomHeaders(this.client.getUrl(), containerName, restype, timeout, leaseId, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * operation marks the specified container for deletion. The container and any blobs contained within it are later * deleted during garbage collection. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -947,13 +970,13 @@ public Mono> deleteWithResponseAsync = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); return FluxUtil.withContext(context -> service.delete(this.client.getUrl(), containerName, restype, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, - context)); + context)).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * operation marks the specified container for deletion. The container and any blobs contained within it are later * deleted during garbage collection. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -981,14 +1004,16 @@ public Mono> deleteWithResponseAsync = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.delete(this.client.getUrl(), containerName, restype, timeout, leaseId, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context); + return service + .delete(this.client.getUrl(), containerName, restype, timeout, leaseId, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * operation marks the specified container for deletion. The container and any blobs contained within it are later * deleted during garbage collection. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1009,13 +1034,14 @@ public Mono> deleteWithResponseAsync public Mono deleteAsync(String containerName, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { return deleteWithResponseAsync(containerName, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * operation marks the specified container for deletion. The container and any blobs contained within it are later * deleted during garbage collection. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1037,13 +1063,14 @@ public Mono deleteAsync(String containerName, Integer timeout, String leas public Mono deleteAsync(String containerName, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { return deleteWithResponseAsync(containerName, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, requestId, - context).flatMap(ignored -> Mono.empty()); + context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * operation marks the specified container for deletion. The container and any blobs contained within it are later * deleted during garbage collection. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1069,15 +1096,17 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String contai = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), containerName, - restype, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), - requestId, accept, context)); + return FluxUtil + .withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), containerName, restype, timeout, + leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, + accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * operation marks the specified container for deletion. The container and any blobs contained within it are later * deleted during garbage collection. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1106,12 +1135,13 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String contai DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); return service.deleteNoCustomHeaders(this.client.getUrl(), containerName, restype, timeout, leaseId, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context); + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * operation sets one or more user-defined name-value pairs for the specified container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1143,12 +1173,13 @@ public Mono> setMetadataWithRes = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); return FluxUtil .withContext(context -> service.setMetadata(this.client.getUrl(), containerName, restype, comp, timeout, - leaseId, metadata, ifModifiedSinceConverted, this.client.getVersion(), requestId, accept, context)); + leaseId, metadata, ifModifiedSinceConverted, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * operation sets one or more user-defined name-value pairs for the specified container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1179,13 +1210,15 @@ public Mono> setMetadataWithRes final String accept = "application/xml"; DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); - return service.setMetadata(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, metadata, - ifModifiedSinceConverted, this.client.getVersion(), requestId, accept, context); + return service + .setMetadata(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, metadata, + ifModifiedSinceConverted, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * operation sets one or more user-defined name-value pairs for the specified container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1210,12 +1243,13 @@ public Mono> setMetadataWithRes public Mono setMetadataAsync(String containerName, Integer timeout, String leaseId, Map metadata, OffsetDateTime ifModifiedSince, String requestId) { return setMetadataWithResponseAsync(containerName, timeout, leaseId, metadata, ifModifiedSince, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * operation sets one or more user-defined name-value pairs for the specified container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1241,12 +1275,13 @@ public Mono setMetadataAsync(String containerName, Integer timeout, String public Mono setMetadataAsync(String containerName, Integer timeout, String leaseId, Map metadata, OffsetDateTime ifModifiedSince, String requestId, Context context) { return setMetadataWithResponseAsync(containerName, timeout, leaseId, metadata, ifModifiedSince, requestId, - context).flatMap(ignored -> Mono.empty()); + context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * operation sets one or more user-defined name-value pairs for the specified container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1275,14 +1310,16 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String c final String accept = "application/xml"; DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); - return FluxUtil.withContext( - context -> service.setMetadataNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, - leaseId, metadata, ifModifiedSinceConverted, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.setMetadataNoCustomHeaders(this.client.getUrl(), containerName, restype, + comp, timeout, leaseId, metadata, ifModifiedSinceConverted, this.client.getVersion(), requestId, accept, + context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * operation sets one or more user-defined name-value pairs for the specified container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1313,14 +1350,16 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String c final String accept = "application/xml"; DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); - return service.setMetadataNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, - metadata, ifModifiedSinceConverted, this.client.getVersion(), requestId, accept, context); + return service + .setMetadataNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, metadata, + ifModifiedSinceConverted, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * gets the permissions for the specified container. The permissions indicate whether container data may be accessed * publicly. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1340,14 +1379,16 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String c final String restype = "container"; final String comp = "acl"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getAccessPolicy(this.client.getUrl(), containerName, restype, - comp, timeout, leaseId, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getAccessPolicy(this.client.getUrl(), containerName, restype, comp, timeout, + leaseId, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * gets the permissions for the specified container. The permissions indicate whether container data may be accessed * publicly. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1369,14 +1410,16 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String c final String restype = "container"; final String comp = "acl"; final String accept = "application/xml"; - return service.getAccessPolicy(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, - this.client.getVersion(), requestId, accept, context); + return service + .getAccessPolicy(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * gets the permissions for the specified container. The permissions indicate whether container data may be accessed * publicly. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1393,13 +1436,14 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String c public Mono getAccessPolicyAsync(String containerName, Integer timeout, String leaseId, String requestId) { return getAccessPolicyWithResponseAsync(containerName, timeout, leaseId, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * gets the permissions for the specified container. The permissions indicate whether container data may be accessed * publicly. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1417,13 +1461,14 @@ public Mono getAccessPolicyAsync(String containerNa public Mono getAccessPolicyAsync(String containerName, Integer timeout, String leaseId, String requestId, Context context) { return getAccessPolicyWithResponseAsync(containerName, timeout, leaseId, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * gets the permissions for the specified container. The permissions indicate whether container data may be accessed * publicly. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1443,14 +1488,16 @@ public Mono> getAccessPolicyNoCustomHeader final String restype = "container"; final String comp = "acl"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getAccessPolicyNoCustomHeaders(this.client.getUrl(), - containerName, restype, comp, timeout, leaseId, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getAccessPolicyNoCustomHeaders(this.client.getUrl(), containerName, restype, + comp, timeout, leaseId, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * gets the permissions for the specified container. The permissions indicate whether container data may be accessed * publicly. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1471,14 +1518,16 @@ public Mono> getAccessPolicyNoCustomHeader final String restype = "container"; final String comp = "acl"; final String accept = "application/xml"; - return service.getAccessPolicyNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, - leaseId, this.client.getVersion(), requestId, accept, context); + return service + .getAccessPolicyNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * sets the permissions for the specified container. The permissions indicate whether blobs in a container may be * accessed publicly. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1509,15 +1558,17 @@ public Mono> setAccessPolic DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); BlobSignedIdentifierWrapper containerAclConverted = new BlobSignedIdentifierWrapper(containerAcl); - return FluxUtil.withContext(context -> service.setAccessPolicy(this.client.getUrl(), containerName, restype, - comp, timeout, leaseId, access, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - this.client.getVersion(), requestId, containerAclConverted, accept, context)); + return FluxUtil + .withContext(context -> service.setAccessPolicy(this.client.getUrl(), containerName, restype, comp, timeout, + leaseId, access, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), + requestId, containerAclConverted, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * sets the permissions for the specified container. The permissions indicate whether blobs in a container may be * accessed publicly. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1549,15 +1600,17 @@ public Mono> setAccessPolic DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); BlobSignedIdentifierWrapper containerAclConverted = new BlobSignedIdentifierWrapper(containerAcl); - return service.setAccessPolicy(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, access, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, - containerAclConverted, accept, context); + return service + .setAccessPolicy(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, access, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, + containerAclConverted, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * sets the permissions for the specified container. The permissions indicate whether blobs in a container may be * accessed publicly. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1581,13 +1634,15 @@ public Mono setAccessPolicyAsync(String containerName, Integer timeout, St PublicAccessType access, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, List containerAcl) { return setAccessPolicyWithResponseAsync(containerName, timeout, leaseId, access, ifModifiedSince, - ifUnmodifiedSince, requestId, containerAcl).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, requestId, containerAcl) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * sets the permissions for the specified container. The permissions indicate whether blobs in a container may be * accessed publicly. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1612,13 +1667,15 @@ public Mono setAccessPolicyAsync(String containerName, Integer timeout, St PublicAccessType access, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, List containerAcl, Context context) { return setAccessPolicyWithResponseAsync(containerName, timeout, leaseId, access, ifModifiedSince, - ifUnmodifiedSince, requestId, containerAcl, context).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, requestId, containerAcl, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * sets the permissions for the specified container. The permissions indicate whether blobs in a container may be * accessed publicly. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1649,15 +1706,17 @@ public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync(Stri DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); BlobSignedIdentifierWrapper containerAclConverted = new BlobSignedIdentifierWrapper(containerAcl); - return FluxUtil.withContext(context -> service.setAccessPolicyNoCustomHeaders(this.client.getUrl(), - containerName, restype, comp, timeout, leaseId, access, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, containerAclConverted, accept, context)); + return FluxUtil + .withContext(context -> service.setAccessPolicyNoCustomHeaders(this.client.getUrl(), containerName, restype, + comp, timeout, leaseId, access, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + this.client.getVersion(), requestId, containerAclConverted, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * sets the permissions for the specified container. The permissions indicate whether blobs in a container may be * accessed publicly. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1689,14 +1748,16 @@ public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync(Stri DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); BlobSignedIdentifierWrapper containerAclConverted = new BlobSignedIdentifierWrapper(containerAcl); - return service.setAccessPolicyNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, - leaseId, access, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, - containerAclConverted, accept, context); + return service + .setAccessPolicyNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, + access, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, + containerAclConverted, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Restores a previously-deleted container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1720,12 +1781,13 @@ public Mono> restoreWithResponseAsy final String accept = "application/xml"; return FluxUtil .withContext(context -> service.restore(this.client.getUrl(), containerName, restype, comp, timeout, - this.client.getVersion(), requestId, deletedContainerName, deletedContainerVersion, accept, context)); + this.client.getVersion(), requestId, deletedContainerName, deletedContainerVersion, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Restores a previously-deleted container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1749,13 +1811,15 @@ public Mono> restoreWithResponseAsy final String restype = "container"; final String comp = "undelete"; final String accept = "application/xml"; - return service.restore(this.client.getUrl(), containerName, restype, comp, timeout, this.client.getVersion(), - requestId, deletedContainerName, deletedContainerVersion, accept, context); + return service + .restore(this.client.getUrl(), containerName, restype, comp, timeout, this.client.getVersion(), requestId, + deletedContainerName, deletedContainerVersion, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Restores a previously-deleted container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1775,12 +1839,14 @@ public Mono> restoreWithResponseAsy public Mono restoreAsync(String containerName, Integer timeout, String requestId, String deletedContainerName, String deletedContainerVersion) { return restoreWithResponseAsync(containerName, timeout, requestId, deletedContainerName, - deletedContainerVersion).flatMap(ignored -> Mono.empty()); + deletedContainerVersion) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Restores a previously-deleted container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1801,12 +1867,14 @@ public Mono restoreAsync(String containerName, Integer timeout, String req public Mono restoreAsync(String containerName, Integer timeout, String requestId, String deletedContainerName, String deletedContainerVersion, Context context) { return restoreWithResponseAsync(containerName, timeout, requestId, deletedContainerName, - deletedContainerVersion, context).flatMap(ignored -> Mono.empty()); + deletedContainerVersion, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Restores a previously-deleted container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1830,12 +1898,13 @@ public Mono> restoreNoCustomHeadersWithResponseAsync(String conta final String accept = "application/xml"; return FluxUtil.withContext( context -> service.restoreNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, - this.client.getVersion(), requestId, deletedContainerName, deletedContainerVersion, accept, context)); + this.client.getVersion(), requestId, deletedContainerName, deletedContainerVersion, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Restores a previously-deleted container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1858,13 +1927,15 @@ public Mono> restoreNoCustomHeadersWithResponseAsync(String conta final String restype = "container"; final String comp = "undelete"; final String accept = "application/xml"; - return service.restoreNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, - this.client.getVersion(), requestId, deletedContainerName, deletedContainerVersion, accept, context); + return service + .restoreNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, + this.client.getVersion(), requestId, deletedContainerName, deletedContainerVersion, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Renames an existing container. - * + * * @param containerName The container name. * @param sourceContainerName Required. Specifies the name of the container to rename. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1885,13 +1956,15 @@ public Mono> renameWithResponseAsync final String restype = "container"; final String comp = "rename"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.rename(this.client.getUrl(), containerName, restype, comp, - timeout, this.client.getVersion(), requestId, sourceContainerName, sourceLeaseId, accept, context)); + return FluxUtil + .withContext(context -> service.rename(this.client.getUrl(), containerName, restype, comp, timeout, + this.client.getVersion(), requestId, sourceContainerName, sourceLeaseId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Renames an existing container. - * + * * @param containerName The container name. * @param sourceContainerName Required. Specifies the name of the container to rename. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1913,13 +1986,15 @@ public Mono> renameWithResponseAsync final String restype = "container"; final String comp = "rename"; final String accept = "application/xml"; - return service.rename(this.client.getUrl(), containerName, restype, comp, timeout, this.client.getVersion(), - requestId, sourceContainerName, sourceLeaseId, accept, context); + return service + .rename(this.client.getUrl(), containerName, restype, comp, timeout, this.client.getVersion(), requestId, + sourceContainerName, sourceLeaseId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Renames an existing container. - * + * * @param containerName The container name. * @param sourceContainerName Required. Specifies the name of the container to rename. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1938,12 +2013,13 @@ public Mono> renameWithResponseAsync public Mono renameAsync(String containerName, String sourceContainerName, Integer timeout, String requestId, String sourceLeaseId) { return renameWithResponseAsync(containerName, sourceContainerName, timeout, requestId, sourceLeaseId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * Renames an existing container. - * + * * @param containerName The container name. * @param sourceContainerName Required. Specifies the name of the container to rename. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1963,12 +2039,13 @@ public Mono renameAsync(String containerName, String sourceContainerName, public Mono renameAsync(String containerName, String sourceContainerName, Integer timeout, String requestId, String sourceLeaseId, Context context) { return renameWithResponseAsync(containerName, sourceContainerName, timeout, requestId, sourceLeaseId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * Renames an existing container. - * + * * @param containerName The container name. * @param sourceContainerName Required. Specifies the name of the container to rename. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1991,12 +2068,13 @@ public Mono> renameNoCustomHeadersWithResponseAsync(String contai final String accept = "application/xml"; return FluxUtil .withContext(context -> service.renameNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, - timeout, this.client.getVersion(), requestId, sourceContainerName, sourceLeaseId, accept, context)); + timeout, this.client.getVersion(), requestId, sourceContainerName, sourceLeaseId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Renames an existing container. - * + * * @param containerName The container name. * @param sourceContainerName Required. Specifies the name of the container to rename. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2018,13 +2096,15 @@ public Mono> renameNoCustomHeadersWithResponseAsync(String contai final String restype = "container"; final String comp = "rename"; final String accept = "application/xml"; - return service.renameNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, - this.client.getVersion(), requestId, sourceContainerName, sourceLeaseId, accept, context); + return service + .renameNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, + this.client.getVersion(), requestId, sourceContainerName, sourceLeaseId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param containerName The container name. * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. @@ -2047,13 +2127,16 @@ public Mono>> submit final String restype = "container"; final String comp = "batch"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.submitBatch(this.client.getUrl(), containerName, restype, comp, - contentLength, multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext( + context -> service.submitBatch(this.client.getUrl(), containerName, restype, comp, contentLength, + multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param containerName The container name. * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. @@ -2077,13 +2160,15 @@ public Mono>> submit final String restype = "container"; final String comp = "batch"; final String accept = "application/xml"; - return service.submitBatch(this.client.getUrl(), containerName, restype, comp, contentLength, - multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context); + return service + .submitBatch(this.client.getUrl(), containerName, restype, comp, contentLength, multipartContentType, + timeout, this.client.getVersion(), requestId, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param containerName The container name. * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. @@ -2103,12 +2188,13 @@ public Mono>> submit public Flux submitBatchAsync(String containerName, long contentLength, String multipartContentType, Flux body, Integer timeout, String requestId) { return submitBatchWithResponseAsync(containerName, contentLength, multipartContentType, body, timeout, - requestId).flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); + requestId).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param containerName The container name. * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. @@ -2129,12 +2215,13 @@ public Flux submitBatchAsync(String containerName, long contentLengt public Flux submitBatchAsync(String containerName, long contentLength, String multipartContentType, Flux body, Integer timeout, String requestId, Context context) { return submitBatchWithResponseAsync(containerName, contentLength, multipartContentType, body, timeout, - requestId, context).flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); + requestId, context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param containerName The container name. * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. @@ -2158,12 +2245,12 @@ public Mono submitBatchNoCustomHeadersWithResponseAsync(String c final String accept = "application/xml"; return FluxUtil.withContext(context -> service.submitBatchNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, contentLength, multipartContentType, timeout, this.client.getVersion(), requestId, body, - accept, context)); + accept, context)).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param containerName The container name. * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. @@ -2186,13 +2273,15 @@ public Mono submitBatchNoCustomHeadersWithResponseAsync(String c final String restype = "container"; final String comp = "batch"; final String accept = "application/xml"; - return service.submitBatchNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, contentLength, - multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context); + return service + .submitBatchNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, contentLength, + multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param containerName The container name. * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. @@ -2215,13 +2304,16 @@ public Mono>> submit final String restype = "container"; final String comp = "batch"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.submitBatch(this.client.getUrl(), containerName, restype, comp, - contentLength, multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext( + context -> service.submitBatch(this.client.getUrl(), containerName, restype, comp, contentLength, + multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param containerName The container name. * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. @@ -2245,13 +2337,15 @@ public Mono>> submit final String restype = "container"; final String comp = "batch"; final String accept = "application/xml"; - return service.submitBatch(this.client.getUrl(), containerName, restype, comp, contentLength, - multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context); + return service + .submitBatch(this.client.getUrl(), containerName, restype, comp, contentLength, multipartContentType, + timeout, this.client.getVersion(), requestId, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param containerName The container name. * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. @@ -2271,12 +2365,13 @@ public Mono>> submit public Flux submitBatchAsync(String containerName, long contentLength, String multipartContentType, BinaryData body, Integer timeout, String requestId) { return submitBatchWithResponseAsync(containerName, contentLength, multipartContentType, body, timeout, - requestId).flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); + requestId).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param containerName The container name. * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. @@ -2297,12 +2392,13 @@ public Flux submitBatchAsync(String containerName, long contentLengt public Flux submitBatchAsync(String containerName, long contentLength, String multipartContentType, BinaryData body, Integer timeout, String requestId, Context context) { return submitBatchWithResponseAsync(containerName, contentLength, multipartContentType, body, timeout, - requestId, context).flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); + requestId, context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param containerName The container name. * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. @@ -2326,12 +2422,12 @@ public Mono submitBatchNoCustomHeadersWithResponseAsync(String c final String accept = "application/xml"; return FluxUtil.withContext(context -> service.submitBatchNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, contentLength, multipartContentType, timeout, this.client.getVersion(), requestId, body, - accept, context)); + accept, context)).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param containerName The container name. * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. @@ -2354,14 +2450,16 @@ public Mono submitBatchNoCustomHeadersWithResponseAsync(String c final String restype = "container"; final String comp = "batch"; final String accept = "application/xml"; - return service.submitBatchNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, contentLength, - multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context); + return service + .submitBatchNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, contentLength, + multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search * expression. Filter blobs searches within the given container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -2400,13 +2498,14 @@ public Mono> filte .collect(Collectors.joining(",")); return FluxUtil .withContext(context -> service.filterBlobs(this.client.getUrl(), containerName, restype, comp, timeout, - this.client.getVersion(), requestId, where, marker, maxresults, includeConverted, accept, context)); + this.client.getVersion(), requestId, where, marker, maxresults, includeConverted, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search * expression. Filter blobs searches within the given container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -2444,14 +2543,16 @@ public Mono> filte : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.filterBlobs(this.client.getUrl(), containerName, restype, comp, timeout, - this.client.getVersion(), requestId, where, marker, maxresults, includeConverted, accept, context); + return service + .filterBlobs(this.client.getUrl(), containerName, restype, comp, timeout, this.client.getVersion(), + requestId, where, marker, maxresults, includeConverted, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search * expression. Filter blobs searches within the given container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -2479,13 +2580,14 @@ public Mono> filte public Mono filterBlobsAsync(String containerName, Integer timeout, String requestId, String where, String marker, Integer maxresults, List include) { return filterBlobsWithResponseAsync(containerName, timeout, requestId, where, marker, maxresults, include) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search * expression. Filter blobs searches within the given container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -2514,13 +2616,14 @@ public Mono filterBlobsAsync(String containerName, Integer ti public Mono filterBlobsAsync(String containerName, Integer timeout, String requestId, String where, String marker, Integer maxresults, List include, Context context) { return filterBlobsWithResponseAsync(containerName, timeout, requestId, where, marker, maxresults, include, - context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search * expression. Filter blobs searches within the given container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -2559,13 +2662,14 @@ public Mono> filterBlobsNoCustomHeadersWithResponseA .collect(Collectors.joining(",")); return FluxUtil.withContext( context -> service.filterBlobsNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, - this.client.getVersion(), requestId, where, marker, maxresults, includeConverted, accept, context)); + this.client.getVersion(), requestId, where, marker, maxresults, includeConverted, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search * expression. Filter blobs searches within the given container. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -2603,14 +2707,16 @@ public Mono> filterBlobsNoCustomHeadersWithResponseA : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.filterBlobsNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, - this.client.getVersion(), requestId, where, marker, maxresults, includeConverted, accept, context); + return service + .filterBlobsNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, timeout, + this.client.getVersion(), requestId, where, marker, maxresults, includeConverted, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -2644,15 +2750,17 @@ public Mono> acquireLeaseWithR = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.acquireLease(this.client.getUrl(), containerName, comp, restype, - action, timeout, duration, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.acquireLease(this.client.getUrl(), containerName, comp, restype, action, + timeout, duration, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -2687,15 +2795,17 @@ public Mono> acquireLeaseWithR = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.acquireLease(this.client.getUrl(), containerName, comp, restype, action, timeout, duration, - proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, - accept, context); + return service + .acquireLease(this.client.getUrl(), containerName, comp, restype, action, timeout, duration, + proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -2721,13 +2831,15 @@ public Mono> acquireLeaseWithR public Mono acquireLeaseAsync(String containerName, Integer timeout, Integer duration, String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { return acquireLeaseWithResponseAsync(containerName, timeout, duration, proposedLeaseId, ifModifiedSince, - ifUnmodifiedSince, requestId).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -2754,13 +2866,15 @@ public Mono acquireLeaseAsync(String containerName, Integer timeout, Integ public Mono acquireLeaseAsync(String containerName, Integer timeout, Integer duration, String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { return acquireLeaseWithResponseAsync(containerName, timeout, duration, proposedLeaseId, ifModifiedSince, - ifUnmodifiedSince, requestId, context).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -2794,15 +2908,17 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.acquireLeaseNoCustomHeaders(this.client.getUrl(), containerName, - comp, restype, action, timeout, duration, proposedLeaseId, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.acquireLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, + restype, action, timeout, duration, proposedLeaseId, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -2837,15 +2953,17 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.acquireLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, restype, action, timeout, - duration, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), - requestId, accept, context); + return service + .acquireLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, restype, action, timeout, duration, + proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2874,15 +2992,17 @@ public Mono> releaseLeaseWithR = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.releaseLease(this.client.getUrl(), containerName, comp, restype, - action, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), - requestId, accept, context)); + return FluxUtil + .withContext(context -> service.releaseLease(this.client.getUrl(), containerName, comp, restype, action, + timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), + requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2913,13 +3033,14 @@ public Mono> releaseLeaseWithR DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); return service.releaseLease(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context); + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2940,13 +3061,14 @@ public Mono> releaseLeaseWithR public Mono releaseLeaseAsync(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { return releaseLeaseWithResponseAsync(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, - requestId).flatMap(ignored -> Mono.empty()); + requestId).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2968,13 +3090,14 @@ public Mono releaseLeaseAsync(String containerName, String leaseId, Intege public Mono releaseLeaseAsync(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { return releaseLeaseWithResponseAsync(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, - requestId, context).flatMap(ignored -> Mono.empty()); + requestId, context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3002,15 +3125,17 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.releaseLeaseNoCustomHeaders(this.client.getUrl(), containerName, - comp, restype, action, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.releaseLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, + restype, action, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3040,15 +3165,17 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.releaseLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, restype, action, timeout, - leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, - context); + return service + .releaseLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3077,15 +3204,17 @@ public Mono> renewLeaseWithRespo = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.renewLease(this.client.getUrl(), containerName, comp, restype, - action, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), - requestId, accept, context)); + return FluxUtil + .withContext(context -> service.renewLease(this.client.getUrl(), containerName, comp, restype, action, + timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), + requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3116,13 +3245,14 @@ public Mono> renewLeaseWithRespo DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); return service.renewLease(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context); + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3143,13 +3273,14 @@ public Mono> renewLeaseWithRespo public Mono renewLeaseAsync(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { return renewLeaseWithResponseAsync(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, - requestId).flatMap(ignored -> Mono.empty()); + requestId).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3171,13 +3302,14 @@ public Mono renewLeaseAsync(String containerName, String leaseId, Integer public Mono renewLeaseAsync(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { return renewLeaseWithResponseAsync(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, - requestId, context).flatMap(ignored -> Mono.empty()); + requestId, context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3205,15 +3337,17 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String co = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.renewLeaseNoCustomHeaders(this.client.getUrl(), containerName, - comp, restype, action, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.renewLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, + restype, action, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3243,15 +3377,17 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String co = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.renewLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, restype, action, timeout, - leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, - context); + return service + .renewLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -3285,15 +3421,17 @@ public Mono> breakLeaseWithRespo = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.breakLease(this.client.getUrl(), containerName, comp, restype, - action, timeout, breakPeriod, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.breakLease(this.client.getUrl(), containerName, comp, restype, action, + timeout, breakPeriod, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), + requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -3329,13 +3467,14 @@ public Mono> breakLeaseWithRespo DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); return service.breakLease(this.client.getUrl(), containerName, comp, restype, action, timeout, breakPeriod, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context); + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -3361,13 +3500,14 @@ public Mono> breakLeaseWithRespo public Mono breakLeaseAsync(String containerName, Integer timeout, Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { return breakLeaseWithResponseAsync(containerName, timeout, breakPeriod, ifModifiedSince, ifUnmodifiedSince, - requestId).flatMap(ignored -> Mono.empty()); + requestId).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -3394,13 +3534,14 @@ public Mono breakLeaseAsync(String containerName, Integer timeout, Integer public Mono breakLeaseAsync(String containerName, Integer timeout, Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { return breakLeaseWithResponseAsync(containerName, timeout, breakPeriod, ifModifiedSince, ifUnmodifiedSince, - requestId, context).flatMap(ignored -> Mono.empty()); + requestId, context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -3433,15 +3574,17 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String co = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.breakLeaseNoCustomHeaders(this.client.getUrl(), containerName, - comp, restype, action, timeout, breakPeriod, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.breakLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, + restype, action, timeout, breakPeriod, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -3476,15 +3619,17 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String co = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.breakLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, restype, action, timeout, - breakPeriod, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, - accept, context); + return service + .breakLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, restype, action, timeout, breakPeriod, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) @@ -3516,15 +3661,17 @@ public Mono> changeLeaseWithRes = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.changeLease(this.client.getUrl(), containerName, comp, restype, - action, timeout, leaseId, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.changeLease(this.client.getUrl(), containerName, comp, restype, action, + timeout, leaseId, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) @@ -3557,15 +3704,17 @@ public Mono> changeLeaseWithRes = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.changeLease(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, - proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, - accept, context); + return service + .changeLease(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, proposedLeaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) @@ -3589,13 +3738,15 @@ public Mono> changeLeaseWithRes public Mono changeLeaseAsync(String containerName, String leaseId, String proposedLeaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { return changeLeaseWithResponseAsync(containerName, leaseId, proposedLeaseId, timeout, ifModifiedSince, - ifUnmodifiedSince, requestId).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) @@ -3620,13 +3771,15 @@ public Mono changeLeaseAsync(String containerName, String leaseId, String public Mono changeLeaseAsync(String containerName, String leaseId, String proposedLeaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { return changeLeaseWithResponseAsync(containerName, leaseId, proposedLeaseId, timeout, ifModifiedSince, - ifUnmodifiedSince, requestId, context).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) @@ -3658,15 +3811,17 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String c = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.changeLeaseNoCustomHeaders(this.client.getUrl(), containerName, - comp, restype, action, timeout, leaseId, proposedLeaseId, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.changeLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, + restype, action, timeout, leaseId, proposedLeaseId, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 * seconds, or can be infinite. - * + * * @param containerName The container name. * @param leaseId Specifies the current lease ID on the resource. * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) @@ -3699,14 +3854,16 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String c = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.changeLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, restype, action, timeout, - leaseId, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), - requestId, accept, context); + return service + .changeLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, + proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param containerName The container name. * @param prefix Filters the results to return only containers whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of containers to be returned with the next @@ -3742,14 +3899,16 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String c : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return FluxUtil.withContext( - context -> service.listBlobFlatSegment(this.client.getUrl(), containerName, restype, comp, prefix, marker, - maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.listBlobFlatSegment(this.client.getUrl(), containerName, restype, comp, + prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, + context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param containerName The container name. * @param prefix Filters the results to return only containers whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of containers to be returned with the next @@ -3786,13 +3945,15 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String c : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.listBlobFlatSegment(this.client.getUrl(), containerName, restype, comp, prefix, marker, - maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, context); + return service + .listBlobFlatSegment(this.client.getUrl(), containerName, restype, comp, prefix, marker, maxresults, + includeConverted, timeout, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param containerName The container name. * @param prefix Filters the results to return only containers whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of containers to be returned with the next @@ -3820,12 +3981,13 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String c public Mono listBlobFlatSegmentAsync(String containerName, String prefix, String marker, Integer maxresults, List include, Integer timeout, String requestId) { return listBlobFlatSegmentWithResponseAsync(containerName, prefix, marker, maxresults, include, timeout, - requestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + requestId).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param containerName The container name. * @param prefix Filters the results to return only containers whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of containers to be returned with the next @@ -3855,12 +4017,13 @@ public Mono listBlobFlatSegmentAsync(String contai String marker, Integer maxresults, List include, Integer timeout, String requestId, Context context) { return listBlobFlatSegmentWithResponseAsync(containerName, prefix, marker, maxresults, include, timeout, - requestId, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + requestId, context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param containerName The container name. * @param prefix Filters the results to return only containers whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of containers to be returned with the next @@ -3896,14 +4059,16 @@ public Mono> listBlobFlatSegmentNoCustomH : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return FluxUtil.withContext(context -> service.listBlobFlatSegmentNoCustomHeaders(this.client.getUrl(), - containerName, restype, comp, prefix, marker, maxresults, includeConverted, timeout, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.listBlobFlatSegmentNoCustomHeaders(this.client.getUrl(), containerName, + restype, comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), + requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param containerName The container name. * @param prefix Filters the results to return only containers whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of containers to be returned with the next @@ -3940,13 +4105,15 @@ public Mono> listBlobFlatSegmentNoCustomH : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.listBlobFlatSegmentNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, prefix, - marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, context); + return service + .listBlobFlatSegmentNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, prefix, marker, + maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param containerName The container name. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -3985,14 +4152,16 @@ public Mono> listBlobFlatSegmentNoCustomH : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return FluxUtil.withContext(context -> service.listBlobHierarchySegment(this.client.getUrl(), containerName, - restype, comp, prefix, delimiter, marker, maxresults, includeConverted, timeout, this.client.getVersion(), - requestId, accept, context)); + return FluxUtil + .withContext(context -> service.listBlobHierarchySegment(this.client.getUrl(), containerName, restype, comp, + prefix, delimiter, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, + accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param containerName The container name. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -4033,13 +4202,15 @@ public Mono> listBlobFlatSegmentNoCustomH : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.listBlobHierarchySegment(this.client.getUrl(), containerName, restype, comp, prefix, delimiter, - marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, context); + return service + .listBlobHierarchySegment(this.client.getUrl(), containerName, restype, comp, prefix, delimiter, marker, + maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param containerName The container name. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -4071,12 +4242,13 @@ public Mono listBlobHierarchySegmentAsync(Str String prefix, String marker, Integer maxresults, List include, Integer timeout, String requestId) { return listBlobHierarchySegmentWithResponseAsync(containerName, delimiter, prefix, marker, maxresults, include, - timeout, requestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + timeout, requestId).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param containerName The container name. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -4109,12 +4281,14 @@ public Mono listBlobHierarchySegmentAsync(Str String prefix, String marker, Integer maxresults, List include, Integer timeout, String requestId, Context context) { return listBlobHierarchySegmentWithResponseAsync(containerName, delimiter, prefix, marker, maxresults, include, - timeout, requestId, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + timeout, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param containerName The container name. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -4153,14 +4327,16 @@ public Mono> listBlobHierarchySegmen : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return FluxUtil.withContext(context -> service.listBlobHierarchySegmentNoCustomHeaders(this.client.getUrl(), - containerName, restype, comp, prefix, delimiter, marker, maxresults, includeConverted, timeout, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.listBlobHierarchySegmentNoCustomHeaders(this.client.getUrl(), containerName, + restype, comp, prefix, delimiter, marker, maxresults, includeConverted, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param containerName The container name. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -4200,14 +4376,16 @@ public Mono> listBlobHierarchySegmen : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.listBlobHierarchySegmentNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, - prefix, delimiter, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, - accept, context); + return service + .listBlobHierarchySegmentNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, prefix, + delimiter, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Returns the sku name and account kind. - * + * * @param containerName The container name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. @@ -4220,13 +4398,15 @@ public Mono> listBlobHierarchySegmen final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getAccountInfo(this.client.getUrl(), containerName, restype, - comp, this.client.getVersion(), accept, context)); + return FluxUtil + .withContext(context -> service.getAccountInfo(this.client.getUrl(), containerName, restype, comp, + this.client.getVersion(), accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Returns the sku name and account kind. - * + * * @param containerName The container name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -4240,13 +4420,15 @@ public Mono> listBlobHierarchySegmen final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; - return service.getAccountInfo(this.client.getUrl(), containerName, restype, comp, this.client.getVersion(), - accept, context); + return service + .getAccountInfo(this.client.getUrl(), containerName, restype, comp, this.client.getVersion(), accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Returns the sku name and account kind. - * + * * @param containerName The container name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. @@ -4255,12 +4437,14 @@ public Mono> listBlobHierarchySegmen */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccountInfoAsync(String containerName) { - return getAccountInfoWithResponseAsync(containerName).flatMap(ignored -> Mono.empty()); + return getAccountInfoWithResponseAsync(containerName) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Returns the sku name and account kind. - * + * * @param containerName The container name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -4270,12 +4454,14 @@ public Mono getAccountInfoAsync(String containerName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccountInfoAsync(String containerName, Context context) { - return getAccountInfoWithResponseAsync(containerName, context).flatMap(ignored -> Mono.empty()); + return getAccountInfoWithResponseAsync(containerName, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Returns the sku name and account kind. - * + * * @param containerName The container name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. @@ -4287,13 +4473,15 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Strin final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getAccountInfoNoCustomHeaders(this.client.getUrl(), - containerName, restype, comp, this.client.getVersion(), accept, context)); + return FluxUtil + .withContext(context -> service.getAccountInfoNoCustomHeaders(this.client.getUrl(), containerName, restype, + comp, this.client.getVersion(), accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Returns the sku name and account kind. - * + * * @param containerName The container name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -4306,7 +4494,9 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Strin final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; - return service.getAccountInfoNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, - this.client.getVersion(), accept, context); + return service + .getAccountInfoNoCustomHeaders(this.client.getUrl(), containerName, restype, comp, this.client.getVersion(), + accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java index 5ffa8ef77ca6..f68cf7adea5a 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.blob.implementation; import com.azure.core.annotation.BodyParam; @@ -48,11 +47,13 @@ import java.util.Map; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import com.azure.storage.blob.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in PageBlobs. */ public final class PageBlobsImpl { + /** * The proxy service used to perform REST calls. */ @@ -65,7 +66,7 @@ public final class PageBlobsImpl { /** * Initializes an instance of PageBlobsImpl. - * + * * @param client the instance of the service client containing this operation class. */ PageBlobsImpl(AzureBlobStorageImpl client) { @@ -81,6 +82,7 @@ public final class PageBlobsImpl { @Host("{url}") @ServiceInterface(name = "AzureBlobStoragePage") public interface PageBlobsService { + @Put("/{containerName}/{blob}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -500,7 +502,7 @@ Mono> copyIncrementalNoCustomHeaders(@HostParam("url") String url /** * The Create operation creates a new page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -607,17 +609,19 @@ public Mono> createWithResponseAsync( = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return FluxUtil.withContext(context -> service.create(this.client.getUrl(), containerName, blob, blobType, - timeout, contentLength, tier, contentType, contentEncoding, contentLanguage, contentMd5Converted, - cacheControl, metadata, leaseId, contentDisposition, encryptionKey, encryptionKeySha256, - encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context)); + return FluxUtil + .withContext(context -> service.create(this.client.getUrl(), containerName, blob, blobType, timeout, + contentLength, tier, contentType, contentEncoding, contentLanguage, contentMd5Converted, cacheControl, + metadata, leaseId, contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, + encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, blobTagsString, + immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Create operation creates a new page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -725,17 +729,19 @@ public Mono> createWithResponseAsync( = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return service.create(this.client.getUrl(), containerName, blob, blobType, timeout, contentLength, tier, - contentType, contentEncoding, contentLanguage, contentMd5Converted, cacheControl, metadata, leaseId, - contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, blobContentLength, - blobSequenceNumber, this.client.getVersion(), requestId, blobTagsString, immutabilityPolicyExpiryConverted, - immutabilityPolicyMode, legalHold, accept, context); + return service + .create(this.client.getUrl(), containerName, blob, blobType, timeout, contentLength, tier, contentType, + contentEncoding, contentLanguage, contentMd5Converted, cacheControl, metadata, leaseId, + contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, blobContentLength, + blobSequenceNumber, this.client.getVersion(), requestId, blobTagsString, + immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Create operation creates a new page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -785,12 +791,13 @@ public Mono createAsync(String containerName, String blob, long contentLen return createWithResponseAsync(containerName, blob, contentLength, blobContentLength, timeout, tier, metadata, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, blobSequenceNumber, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, blobHttpHeaders, cpkInfo, - encryptionScopeParam).flatMap(ignored -> Mono.empty()); + encryptionScopeParam).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Create operation creates a new page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -841,12 +848,14 @@ public Mono createAsync(String containerName, String blob, long contentLen return createWithResponseAsync(containerName, blob, contentLength, blobContentLength, timeout, tier, metadata, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, blobSequenceNumber, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, blobHttpHeaders, cpkInfo, - encryptionScopeParam, context).flatMap(ignored -> Mono.empty()); + encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Create operation creates a new page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -953,17 +962,19 @@ public Mono> createNoCustomHeadersWithResponseAsync(String contai = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return FluxUtil.withContext(context -> service.createNoCustomHeaders(this.client.getUrl(), containerName, blob, - blobType, timeout, contentLength, tier, contentType, contentEncoding, contentLanguage, contentMd5Converted, - cacheControl, metadata, leaseId, contentDisposition, encryptionKey, encryptionKeySha256, - encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, - blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context)); + return FluxUtil + .withContext(context -> service.createNoCustomHeaders(this.client.getUrl(), containerName, blob, blobType, + timeout, contentLength, tier, contentType, contentEncoding, contentLanguage, contentMd5Converted, + cacheControl, metadata, leaseId, contentDisposition, encryptionKey, encryptionKeySha256, + encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, + blobTagsString, immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Create operation creates a new page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1071,17 +1082,19 @@ public Mono> createNoCustomHeadersWithResponseAsync(String contai = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 immutabilityPolicyExpiryConverted = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); - return service.createNoCustomHeaders(this.client.getUrl(), containerName, blob, blobType, timeout, - contentLength, tier, contentType, contentEncoding, contentLanguage, contentMd5Converted, cacheControl, - metadata, leaseId, contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, - encryptionScope, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, blobTagsString, - immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context); + return service + .createNoCustomHeaders(this.client.getUrl(), containerName, blob, blobType, timeout, contentLength, tier, + contentType, contentEncoding, contentLanguage, contentMd5Converted, cacheControl, metadata, leaseId, + contentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, blobContentLength, + blobSequenceNumber, this.client.getVersion(), requestId, blobTagsString, + immutabilityPolicyExpiryConverted, immutabilityPolicyMode, legalHold, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Upload Pages operation writes a range of pages to a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1151,17 +1164,19 @@ public Mono> uploadPagesWithResp = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.uploadPages(this.client.getUrl(), containerName, blob, comp, - pageWrite, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, - range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.uploadPages(this.client.getUrl(), containerName, blob, comp, pageWrite, + contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, range, + leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Upload Pages operation writes a range of pages to a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1236,12 +1251,13 @@ public Mono> uploadPagesWithResp transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, body, accept, context); + ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Upload Pages operation writes a range of pages to a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1284,12 +1300,14 @@ public Mono uploadPagesAsync(String containerName, String blob, long conte return uploadPagesWithResponseAsync(containerName, blob, contentLength, body, transactionalContentMD5, transactionalContentCrc64, timeout, range, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, - ifTags, requestId, cpkInfo, encryptionScopeParam).flatMap(ignored -> Mono.empty()); + ifTags, requestId, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Upload Pages operation writes a range of pages to a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1333,12 +1351,14 @@ public Mono uploadPagesAsync(String containerName, String blob, long conte return uploadPagesWithResponseAsync(containerName, blob, contentLength, body, transactionalContentMD5, transactionalContentCrc64, timeout, range, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, - ifTags, requestId, cpkInfo, encryptionScopeParam, context).flatMap(ignored -> Mono.empty()); + ifTags, requestId, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Upload Pages operation writes a range of pages to a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1408,17 +1428,19 @@ public Mono> uploadPagesNoCustomHeadersWithResponseAsync(String c = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.uploadPagesNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, pageWrite, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, - timeout, range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.uploadPagesNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + pageWrite, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, + range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Upload Pages operation writes a range of pages to a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1489,17 +1511,19 @@ public Mono> uploadPagesNoCustomHeadersWithResponseAsync(String c = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.uploadPagesNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, pageWrite, - contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, range, - leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, body, accept, context); + return service + .uploadPagesNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, pageWrite, contentLength, + transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, range, leaseId, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Upload Pages operation writes a range of pages to a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1569,17 +1593,19 @@ public Mono> uploadPagesWithResp = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.uploadPages(this.client.getUrl(), containerName, blob, comp, - pageWrite, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, - range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.uploadPages(this.client.getUrl(), containerName, blob, comp, pageWrite, + contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, range, + leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Upload Pages operation writes a range of pages to a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1654,12 +1680,13 @@ public Mono> uploadPagesWithResp transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, body, accept, context); + ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Upload Pages operation writes a range of pages to a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1702,12 +1729,14 @@ public Mono uploadPagesAsync(String containerName, String blob, long conte return uploadPagesWithResponseAsync(containerName, blob, contentLength, body, transactionalContentMD5, transactionalContentCrc64, timeout, range, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, - ifTags, requestId, cpkInfo, encryptionScopeParam).flatMap(ignored -> Mono.empty()); + ifTags, requestId, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Upload Pages operation writes a range of pages to a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1751,12 +1780,14 @@ public Mono uploadPagesAsync(String containerName, String blob, long conte return uploadPagesWithResponseAsync(containerName, blob, contentLength, body, transactionalContentMD5, transactionalContentCrc64, timeout, range, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, - ifTags, requestId, cpkInfo, encryptionScopeParam, context).flatMap(ignored -> Mono.empty()); + ifTags, requestId, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Upload Pages operation writes a range of pages to a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1826,17 +1857,19 @@ public Mono> uploadPagesNoCustomHeadersWithResponseAsync(String c = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.uploadPagesNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, pageWrite, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, - timeout, range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.uploadPagesNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + pageWrite, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, + range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Upload Pages operation writes a range of pages to a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1907,17 +1940,19 @@ public Mono> uploadPagesNoCustomHeadersWithResponseAsync(String c = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.uploadPagesNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, pageWrite, - contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, range, - leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, body, accept, context); + return service + .uploadPagesNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, pageWrite, contentLength, + transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, range, leaseId, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Clear Pages operation clears a set of pages from a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -1981,16 +2016,18 @@ public Mono> clearPagesWithRespon = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.clearPages(this.client.getUrl(), containerName, blob, comp, - pageWrite, contentLength, timeout, range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, - encryptionScope, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.clearPages(this.client.getUrl(), containerName, blob, comp, pageWrite, + contentLength, timeout, range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, + encryptionScope, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Clear Pages operation clears a set of pages from a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -2055,16 +2092,18 @@ public Mono> clearPagesWithRespon = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.clearPages(this.client.getUrl(), containerName, blob, comp, pageWrite, contentLength, timeout, - range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context); + return service + .clearPages(this.client.getUrl(), containerName, blob, comp, pageWrite, contentLength, timeout, range, + leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Clear Pages operation clears a set of pages from a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -2103,12 +2142,13 @@ public Mono clearPagesAsync(String containerName, String blob, long conten return clearPagesWithResponseAsync(containerName, blob, contentLength, timeout, range, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Clear Pages operation clears a set of pages from a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -2149,12 +2189,13 @@ public Mono clearPagesAsync(String containerName, String blob, long conten return clearPagesWithResponseAsync(containerName, blob, contentLength, timeout, range, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Clear Pages operation clears a set of pages from a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -2218,16 +2259,18 @@ public Mono> clearPagesNoCustomHeadersWithResponseAsync(String co = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.clearPagesNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, pageWrite, contentLength, timeout, range, leaseId, encryptionKey, encryptionKeySha256, - encryptionAlgorithm, encryptionScope, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, - ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.clearPagesNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + pageWrite, contentLength, timeout, range, leaseId, encryptionKey, encryptionKeySha256, + encryptionAlgorithm, encryptionScope, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, + ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, + ifTags, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Clear Pages operation clears a set of pages from a page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param contentLength The length of the request. @@ -2292,16 +2335,18 @@ public Mono> clearPagesNoCustomHeadersWithResponseAsync(String co = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.clearPagesNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, pageWrite, - contentLength, timeout, range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, - encryptionScope, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, accept, context); + return service + .clearPagesNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, pageWrite, contentLength, + timeout, range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. - * + * * @param containerName The container name. * @param blob The blob name. * @param sourceUrl Specify a URL to the copy source. @@ -2389,18 +2434,20 @@ public Mono> uploadPagesF = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return FluxUtil.withContext(context -> service.uploadPagesFromURL(this.client.getUrl(), containerName, blob, - comp, pageWrite, sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, - contentLength, timeout, range, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, - this.client.getVersion(), requestId, copySourceAuthorization, accept, context)); + return FluxUtil + .withContext(context -> service.uploadPagesFromURL(this.client.getUrl(), containerName, blob, comp, + pageWrite, sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, + contentLength, timeout, range, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, + this.client.getVersion(), requestId, copySourceAuthorization, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. - * + * * @param containerName The container name. * @param blob The blob name. * @param sourceUrl Specify a URL to the copy source. @@ -2489,18 +2536,20 @@ public Mono> uploadPagesF = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.uploadPagesFromURL(this.client.getUrl(), containerName, blob, comp, pageWrite, sourceUrl, - sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, contentLength, timeout, range, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, - ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, - this.client.getVersion(), requestId, copySourceAuthorization, accept, context); + return service + .uploadPagesFromURL(this.client.getUrl(), containerName, blob, comp, pageWrite, sourceUrl, sourceRange, + sourceContentMD5Converted, sourceContentcrc64Converted, contentLength, timeout, range, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, ifSequenceNumberLessThanOrEqualTo, + ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, + sourceIfMatch, sourceIfNoneMatch, this.client.getVersion(), requestId, copySourceAuthorization, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. - * + * * @param containerName The container name. * @param blob The blob name. * @param sourceUrl Specify a URL to the copy source. @@ -2558,12 +2607,14 @@ public Mono uploadPagesFromURLAsync(String containerName, String blob, Str sourceContentMD5, sourceContentcrc64, timeout, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestId, - copySourceAuthorization, cpkInfo, encryptionScopeParam).flatMap(ignored -> Mono.empty()); + copySourceAuthorization, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. - * + * * @param containerName The container name. * @param blob The blob name. * @param sourceUrl Specify a URL to the copy source. @@ -2622,12 +2673,14 @@ public Mono uploadPagesFromURLAsync(String containerName, String blob, Str sourceContentMD5, sourceContentcrc64, timeout, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestId, - copySourceAuthorization, cpkInfo, encryptionScopeParam, context).flatMap(ignored -> Mono.empty()); + copySourceAuthorization, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. - * + * * @param containerName The container name. * @param blob The blob name. * @param sourceUrl Specify a URL to the copy source. @@ -2715,18 +2768,20 @@ public Mono> uploadPagesFromURLNoCustomHeadersWithResponseAsync(S = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return FluxUtil.withContext(context -> service.uploadPagesFromURLNoCustomHeaders(this.client.getUrl(), - containerName, blob, comp, pageWrite, sourceUrl, sourceRange, sourceContentMD5Converted, - sourceContentcrc64Converted, contentLength, timeout, range, encryptionKey, encryptionKeySha256, - encryptionAlgorithm, encryptionScope, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, - ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, - this.client.getVersion(), requestId, copySourceAuthorization, accept, context)); + return FluxUtil + .withContext(context -> service.uploadPagesFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, + comp, pageWrite, sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, + contentLength, timeout, range, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, + this.client.getVersion(), requestId, copySourceAuthorization, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. - * + * * @param containerName The container name. * @param blob The blob name. * @param sourceUrl Specify a URL to the copy source. @@ -2815,19 +2870,21 @@ public Mono> uploadPagesFromURLNoCustomHeadersWithResponseAsync(S = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.uploadPagesFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, pageWrite, - sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, contentLength, timeout, - range, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, - ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, - this.client.getVersion(), requestId, copySourceAuthorization, accept, context); + return service + .uploadPagesFromURLNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, pageWrite, sourceUrl, + sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, contentLength, timeout, range, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, + this.client.getVersion(), requestId, copySourceAuthorization, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a * page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -2874,15 +2931,17 @@ public Mono> getPageRanges = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.getPageRanges(this.client.getUrl(), containerName, blob, comp, - snapshot, timeout, range, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, this.client.getVersion(), requestId, marker, maxresults, accept, context)); + return FluxUtil + .withContext(context -> service.getPageRanges(this.client.getUrl(), containerName, blob, comp, snapshot, + timeout, range, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, + ifTags, this.client.getVersion(), requestId, marker, maxresults, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a * page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -2930,15 +2989,17 @@ public Mono> getPageRanges = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getPageRanges(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, range, leaseId, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, marker, maxresults, accept, context); + return service + .getPageRanges(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, range, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, marker, maxresults, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a * page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -2980,13 +3041,14 @@ public Mono getPageRangesAsync(String containerName, String blob, Stri String ifNoneMatch, String ifTags, String requestId, String marker, Integer maxresults) { return getPageRangesWithResponseAsync(containerName, blob, snapshot, timeout, range, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, marker, maxresults) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a * page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -3029,13 +3091,14 @@ public Mono getPageRangesAsync(String containerName, String blob, Stri String ifNoneMatch, String ifTags, String requestId, String marker, Integer maxresults, Context context) { return getPageRangesWithResponseAsync(containerName, blob, snapshot, timeout, range, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, marker, maxresults, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a * page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -3082,15 +3145,17 @@ public Mono> getPageRangesNoCustomHeadersWithResponseAsync(St = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.getPageRangesNoCustomHeaders(this.client.getUrl(), containerName, - blob, comp, snapshot, timeout, range, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, marker, maxresults, accept, context)); + return FluxUtil + .withContext(context -> service.getPageRangesNoCustomHeaders(this.client.getUrl(), containerName, blob, + comp, snapshot, timeout, range, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, this.client.getVersion(), requestId, marker, maxresults, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a * page blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -3138,15 +3203,17 @@ public Mono> getPageRangesNoCustomHeadersWithResponseAsync(St = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getPageRangesNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, - range, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, marker, maxresults, accept, context); + return service + .getPageRangesNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, range, + leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, marker, maxresults, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were * changed between target blob and previous snapshot or version. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -3202,16 +3269,18 @@ public Mono> getPageRa = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.getPageRangesDiff(this.client.getUrl(), containerName, blob, - comp, snapshot, timeout, prevsnapshot, prevSnapshotUrl, range, leaseId, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, marker, - maxresults, accept, context)); + return FluxUtil + .withContext(context -> service.getPageRangesDiff(this.client.getUrl(), containerName, blob, comp, snapshot, + timeout, prevsnapshot, prevSnapshotUrl, range, leaseId, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, marker, + maxresults, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were * changed between target blob and previous snapshot or version. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -3268,15 +3337,17 @@ public Mono> getPageRa = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getPageRangesDiff(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, - prevsnapshot, prevSnapshotUrl, range, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, marker, maxresults, accept, context); + return service + .getPageRangesDiff(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, prevsnapshot, + prevSnapshotUrl, range, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, this.client.getVersion(), requestId, marker, maxresults, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were * changed between target blob and previous snapshot or version. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -3327,13 +3398,14 @@ public Mono getPageRangesDiffAsync(String containerName, String blob, String marker, Integer maxresults) { return getPageRangesDiffWithResponseAsync(containerName, blob, snapshot, timeout, prevsnapshot, prevSnapshotUrl, range, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, marker, - maxresults).flatMap(res -> Mono.justOrEmpty(res.getValue())); + maxresults).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * [Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were * changed between target blob and previous snapshot or version. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -3385,13 +3457,14 @@ public Mono getPageRangesDiffAsync(String containerName, String blob, String marker, Integer maxresults, Context context) { return getPageRangesDiffWithResponseAsync(containerName, blob, snapshot, timeout, prevsnapshot, prevSnapshotUrl, range, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, marker, - maxresults, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + maxresults, context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * [Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were * changed between target blob and previous snapshot or version. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -3446,16 +3519,18 @@ public Mono> getPageRangesDiffNoCustomHeadersWithResponseAsyn = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.getPageRangesDiffNoCustomHeaders(this.client.getUrl(), - containerName, blob, comp, snapshot, timeout, prevsnapshot, prevSnapshotUrl, range, leaseId, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - this.client.getVersion(), requestId, marker, maxresults, accept, context)); + return FluxUtil + .withContext(context -> service.getPageRangesDiffNoCustomHeaders(this.client.getUrl(), containerName, blob, + comp, snapshot, timeout, prevsnapshot, prevSnapshotUrl, range, leaseId, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, marker, + maxresults, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * [Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were * changed between target blob and previous snapshot or version. - * + * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob @@ -3511,15 +3586,16 @@ public Mono> getPageRangesDiffNoCustomHeadersWithResponseAsyn = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getPageRangesDiffNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, snapshot, - timeout, prevsnapshot, prevSnapshotUrl, range, leaseId, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, marker, - maxresults, accept, context); + return service + .getPageRangesDiffNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, + prevsnapshot, prevSnapshotUrl, range, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, marker, maxresults, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Resize the Blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size @@ -3575,15 +3651,17 @@ public Mono> resizeWithResponseAsync( = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.resize(this.client.getUrl(), containerName, blob, comp, timeout, - leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, blobContentLength, this.client.getVersion(), - requestId, accept, context)); + return FluxUtil + .withContext(context -> service.resize(this.client.getUrl(), containerName, blob, comp, timeout, leaseId, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, blobContentLength, this.client.getVersion(), + requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Resize the Blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size @@ -3640,15 +3718,17 @@ public Mono> resizeWithResponseAsync( = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.resize(this.client.getUrl(), containerName, blob, comp, timeout, leaseId, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, blobContentLength, this.client.getVersion(), - requestId, accept, context); + return service + .resize(this.client.getUrl(), containerName, blob, comp, timeout, leaseId, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, blobContentLength, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Resize the Blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size @@ -3679,12 +3759,13 @@ public Mono resizeAsync(String containerName, String blob, long blobConten String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { return resizeWithResponseAsync(containerName, blob, blobContentLength, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * Resize the Blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size @@ -3717,12 +3798,13 @@ public Mono resizeAsync(String containerName, String blob, long blobConten Context context) { return resizeWithResponseAsync(containerName, blob, blobContentLength, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * Resize the Blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size @@ -3778,15 +3860,17 @@ public Mono> resizeNoCustomHeadersWithResponseAsync(String contai = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.resizeNoCustomHeaders(this.client.getUrl(), containerName, blob, - comp, timeout, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, blobContentLength, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.resizeNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, + timeout, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, blobContentLength, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Resize the Blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size @@ -3843,15 +3927,17 @@ public Mono> resizeNoCustomHeadersWithResponseAsync(String contai = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.resizeNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, leaseId, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, blobContentLength, this.client.getVersion(), - requestId, accept, context); + return service + .resizeNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, leaseId, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, blobContentLength, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Update the sequence number of the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param sequenceNumberAction Required if the x-ms-blob-sequence-number header is set for the request. This @@ -3888,14 +3974,16 @@ public Mono> updateSequ = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.updateSequenceNumber(this.client.getUrl(), containerName, blob, - comp, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - sequenceNumberAction, blobSequenceNumber, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.updateSequenceNumber(this.client.getUrl(), containerName, blob, comp, + timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + sequenceNumberAction, blobSequenceNumber, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Update the sequence number of the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param sequenceNumberAction Required if the x-ms-blob-sequence-number header is set for the request. This @@ -3933,14 +4021,16 @@ public Mono> updateSequ = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.updateSequenceNumber(this.client.getUrl(), containerName, blob, comp, timeout, leaseId, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, sequenceNumberAction, - blobSequenceNumber, this.client.getVersion(), requestId, accept, context); + return service + .updateSequenceNumber(this.client.getUrl(), containerName, blob, comp, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + sequenceNumberAction, blobSequenceNumber, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Update the sequence number of the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param sequenceNumberAction Required if the x-ms-blob-sequence-number header is set for the request. This @@ -3973,12 +4063,13 @@ public Mono updateSequenceNumberAsync(String containerName, String blob, String requestId) { return updateSequenceNumberWithResponseAsync(containerName, blob, sequenceNumberAction, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, blobSequenceNumber, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * Update the sequence number of the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param sequenceNumberAction Required if the x-ms-blob-sequence-number header is set for the request. This @@ -4012,12 +4103,13 @@ public Mono updateSequenceNumberAsync(String containerName, String blob, String requestId, Context context) { return updateSequenceNumberWithResponseAsync(containerName, blob, sequenceNumberAction, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, blobSequenceNumber, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * Update the sequence number of the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param sequenceNumberAction Required if the x-ms-blob-sequence-number header is set for the request. This @@ -4054,15 +4146,17 @@ public Mono> updateSequenceNumberNoCustomHeadersWithResponseAsync = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext( - context -> service.updateSequenceNumberNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, - timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - sequenceNumberAction, blobSequenceNumber, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.updateSequenceNumberNoCustomHeaders(this.client.getUrl(), containerName, + blob, comp, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, sequenceNumberAction, blobSequenceNumber, this.client.getVersion(), requestId, + accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Update the sequence number of the blob. - * + * * @param containerName The container name. * @param blob The blob name. * @param sequenceNumberAction Required if the x-ms-blob-sequence-number header is set for the request. This @@ -4100,9 +4194,11 @@ public Mono> updateSequenceNumberNoCustomHeadersWithResponseAsync = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.updateSequenceNumberNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, - leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - sequenceNumberAction, blobSequenceNumber, this.client.getVersion(), requestId, accept, context); + return service + .updateSequenceNumberNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + sequenceNumberAction, blobSequenceNumber, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -4110,7 +4206,7 @@ public Mono> updateSequenceNumberNoCustomHeadersWithResponseAsync * is copied such that only the differential changes between the previously copied snapshot are transferred to the * destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as * usual. This API is supported since REST version 2016-05-31. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -4143,9 +4239,11 @@ public Mono> copyIncremental = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.copyIncremental(this.client.getUrl(), containerName, blob, comp, - timeout, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.copyIncremental(this.client.getUrl(), containerName, blob, comp, timeout, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -4153,7 +4251,7 @@ public Mono> copyIncremental * is copied such that only the differential changes between the previously copied snapshot are transferred to the * destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as * usual. This API is supported since REST version 2016-05-31. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -4188,9 +4286,11 @@ public Mono> copyIncremental = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.copyIncremental(this.client.getUrl(), containerName, blob, comp, timeout, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, - this.client.getVersion(), requestId, accept, context); + return service + .copyIncremental(this.client.getUrl(), containerName, blob, comp, timeout, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -4198,7 +4298,7 @@ public Mono> copyIncremental * is copied such that only the differential changes between the previously copied snapshot are transferred to the * destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as * usual. This API is supported since REST version 2016-05-31. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -4226,7 +4326,9 @@ public Mono copyIncrementalAsync(String containerName, String blob, String OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId) { return copyIncrementalWithResponseAsync(containerName, blob, copySource, timeout, ifModifiedSince, - ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -4234,7 +4336,7 @@ public Mono copyIncrementalAsync(String containerName, String blob, String * is copied such that only the differential changes between the previously copied snapshot are transferred to the * destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as * usual. This API is supported since REST version 2016-05-31. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -4263,7 +4365,9 @@ public Mono copyIncrementalAsync(String containerName, String blob, String OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, Context context) { return copyIncrementalWithResponseAsync(containerName, blob, copySource, timeout, ifModifiedSince, - ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, context).flatMap(ignored -> Mono.empty()); + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -4271,7 +4375,7 @@ public Mono copyIncrementalAsync(String containerName, String blob, String * is copied such that only the differential changes between the previously copied snapshot are transferred to the * destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as * usual. This API is supported since REST version 2016-05-31. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -4304,9 +4408,11 @@ public Mono> copyIncrementalNoCustomHeadersWithResponseAsync(Stri = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.copyIncrementalNoCustomHeaders(this.client.getUrl(), - containerName, blob, comp, timeout, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, - ifNoneMatch, ifTags, copySource, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.copyIncrementalNoCustomHeaders(this.client.getUrl(), containerName, blob, + comp, timeout, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + copySource, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -4314,7 +4420,7 @@ public Mono> copyIncrementalNoCustomHeadersWithResponseAsync(Stri * is copied such that only the differential changes between the previously copied snapshot are transferred to the * destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as * usual. This API is supported since REST version 2016-05-31. - * + * * @param containerName The container name. * @param blob The blob name. * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in @@ -4348,8 +4454,10 @@ public Mono> copyIncrementalNoCustomHeadersWithResponseAsync(Stri = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.copyIncrementalNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, - this.client.getVersion(), requestId, accept, context); + return service + .copyIncrementalNoCustomHeaders(this.client.getUrl(), containerName, blob, comp, timeout, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index 470a7da71b0a..c249cabb2bff 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.blob.implementation; import com.azure.core.annotation.BodyParam; @@ -53,11 +52,13 @@ import java.util.stream.Collectors; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import com.azure.storage.blob.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in Services. */ public final class ServicesImpl { + /** * The proxy service used to perform REST calls. */ @@ -70,7 +71,7 @@ public final class ServicesImpl { /** * Initializes an instance of ServicesImpl. - * + * * @param client the instance of the service client containing this operation class. */ ServicesImpl(AzureBlobStorageImpl client) { @@ -85,6 +86,7 @@ public final class ServicesImpl { @Host("{url}") @ServiceInterface(name = "AzureBlobStorageServ") public interface ServicesService { + @Put("/") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -270,7 +272,7 @@ Mono> listBlobContainersSegmentNextNoCustomHeade /** * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param blobServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -288,14 +290,16 @@ Mono> listBlobContainersSegmentNextNoCustomHeade final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setProperties(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, blobServiceProperties, accept, context)); + return FluxUtil + .withContext(context -> service.setProperties(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, blobServiceProperties, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param blobServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -314,14 +318,16 @@ public Mono> setPropertiesWithR final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.setProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, - blobServiceProperties, accept, context); + return service + .setProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, + blobServiceProperties, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param blobServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -337,13 +343,14 @@ public Mono> setPropertiesWithR public Mono setPropertiesAsync(BlobServiceProperties blobServiceProperties, Integer timeout, String requestId) { return setPropertiesWithResponseAsync(blobServiceProperties, timeout, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param blobServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -360,13 +367,14 @@ public Mono setPropertiesAsync(BlobServiceProperties blobServiceProperties public Mono setPropertiesAsync(BlobServiceProperties blobServiceProperties, Integer timeout, String requestId, Context context) { return setPropertiesWithResponseAsync(blobServiceProperties, timeout, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } /** * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param blobServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -384,14 +392,16 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, - timeout, this.client.getVersion(), requestId, blobServiceProperties, accept, context)); + return FluxUtil + .withContext(context -> service.setPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, blobServiceProperties, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param blobServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -410,14 +420,16 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.setPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, blobServiceProperties, accept, context); + return service + .setPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + requestId, blobServiceProperties, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -435,14 +447,16 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getProperties(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getProperties(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -461,14 +475,16 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.getProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, - accept, context); + return service + .getProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -482,13 +498,15 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesAsync(Integer timeout, String requestId) { - return getPropertiesWithResponseAsync(timeout, requestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + return getPropertiesWithResponseAsync(timeout, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -504,13 +522,14 @@ public Mono getPropertiesAsync(Integer timeout, String re @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesAsync(Integer timeout, String requestId, Context context) { return getPropertiesWithResponseAsync(timeout, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -528,14 +547,16 @@ public Mono> getPropertiesNoCustomHeadersWithRes final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, - timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -554,14 +575,16 @@ public Mono> getPropertiesNoCustomHeadersWithRes final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.getPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, accept, context); + return service + .getPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -578,14 +601,16 @@ public Mono> getPropertiesNoCustomHeadersWithRes final String restype = "service"; final String comp = "stats"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getStatistics(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getStatistics(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -603,14 +628,16 @@ public Mono> getPropertiesNoCustomHeadersWithRes final String restype = "service"; final String comp = "stats"; final String accept = "application/xml"; - return service.getStatistics(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, - accept, context); + return service + .getStatistics(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -623,13 +650,15 @@ public Mono> getPropertiesNoCustomHeadersWithRes */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getStatisticsAsync(Integer timeout, String requestId) { - return getStatisticsWithResponseAsync(timeout, requestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + return getStatisticsWithResponseAsync(timeout, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -644,13 +673,14 @@ public Mono getStatisticsAsync(Integer timeout, String re @ServiceMethod(returns = ReturnType.SINGLE) public Mono getStatisticsAsync(Integer timeout, String requestId, Context context) { return getStatisticsWithResponseAsync(timeout, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -667,14 +697,16 @@ public Mono> getStatisticsNoCustomHeadersWithRes final String restype = "service"; final String comp = "stats"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getStatisticsNoCustomHeaders(this.client.getUrl(), restype, comp, - timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getStatisticsNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -692,13 +724,15 @@ public Mono> getStatisticsNoCustomHeadersWithRes final String restype = "service"; final String comp = "stats"; final String accept = "application/xml"; - return service.getStatisticsNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, accept, context); + return service + .getStatisticsNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The List Containers Segment operation returns a list of the containers under the specified account. - * + * * @param prefix Filters the results to return only containers whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of containers to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -737,13 +771,14 @@ public Mono> listBlobContainersSegmentSinglePag .withContext(context -> service.listBlobContainersSegment(this.client.getUrl(), comp, prefix, marker, maxresults, listBlobContainersIncludeTypeConverted, timeout, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); } /** * The List Containers Segment operation returns a list of the containers under the specified account. - * + * * @param prefix Filters the results to return only containers whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of containers to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -782,13 +817,14 @@ public Mono> listBlobContainersSegmentSinglePag return service .listBlobContainersSegment(this.client.getUrl(), comp, prefix, marker, maxresults, listBlobContainersIncludeTypeConverted, timeout, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); } /** * The List Containers Segment operation returns a list of the containers under the specified account. - * + * * @param prefix Filters the results to return only containers whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of containers to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -822,7 +858,7 @@ public PagedFlux listBlobContainersSegmentAsync(String prefix /** * The List Containers Segment operation returns a list of the containers under the specified account. - * + * * @param prefix Filters the results to return only containers whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of containers to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -859,7 +895,7 @@ public PagedFlux listBlobContainersSegmentAsync(String prefix /** * The List Containers Segment operation returns a list of the containers under the specified account. - * + * * @param prefix Filters the results to return only containers whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of containers to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -898,13 +934,14 @@ public Mono> listBlobContainersSegmentNoCustomH .withContext(context -> service.listBlobContainersSegmentNoCustomHeaders(this.client.getUrl(), comp, prefix, marker, maxresults, listBlobContainersIncludeTypeConverted, timeout, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), null)); } /** * The List Containers Segment operation returns a list of the containers under the specified account. - * + * * @param prefix Filters the results to return only containers whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of containers to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -943,13 +980,14 @@ public Mono> listBlobContainersSegmentNoCustomH return service .listBlobContainersSegmentNoCustomHeaders(this.client.getUrl(), comp, prefix, marker, maxresults, listBlobContainersIncludeTypeConverted, timeout, this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), null)); } /** * The List Containers Segment operation returns a list of the containers under the specified account. - * + * * @param prefix Filters the results to return only containers whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of containers to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -985,7 +1023,7 @@ public PagedFlux listBlobContainersSegmentNoCustomHeadersAsyn /** * The List Containers Segment operation returns a list of the containers under the specified account. - * + * * @param prefix Filters the results to return only containers whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of containers to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1023,7 +1061,7 @@ public PagedFlux listBlobContainersSegmentNoCustomHeadersAsyn /** * Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token * authentication. - * + * * @param keyInfo Key information. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1041,14 +1079,16 @@ public PagedFlux listBlobContainersSegmentNoCustomHeadersAsyn final String restype = "service"; final String comp = "userdelegationkey"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getUserDelegationKey(this.client.getUrl(), restype, comp, - timeout, this.client.getVersion(), requestId, keyInfo, accept, context)); + return FluxUtil + .withContext(context -> service.getUserDelegationKey(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, keyInfo, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token * authentication. - * + * * @param keyInfo Key information. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1067,14 +1107,16 @@ public PagedFlux listBlobContainersSegmentNoCustomHeadersAsyn final String restype = "service"; final String comp = "userdelegationkey"; final String accept = "application/xml"; - return service.getUserDelegationKey(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - requestId, keyInfo, accept, context); + return service + .getUserDelegationKey(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, + keyInfo, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token * authentication. - * + * * @param keyInfo Key information. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1089,13 +1131,14 @@ public PagedFlux listBlobContainersSegmentNoCustomHeadersAsyn @ServiceMethod(returns = ReturnType.SINGLE) public Mono getUserDelegationKeyAsync(KeyInfo keyInfo, Integer timeout, String requestId) { return getUserDelegationKeyWithResponseAsync(keyInfo, timeout, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token * authentication. - * + * * @param keyInfo Key information. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1112,13 +1155,14 @@ public Mono getUserDelegationKeyAsync(KeyInfo keyInfo, Intege public Mono getUserDelegationKeyAsync(KeyInfo keyInfo, Integer timeout, String requestId, Context context) { return getUserDelegationKeyWithResponseAsync(keyInfo, timeout, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token * authentication. - * + * * @param keyInfo Key information. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1136,14 +1180,16 @@ public Mono> getUserDelegationKeyNoCustomHeadersWith final String restype = "service"; final String comp = "userdelegationkey"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getUserDelegationKeyNoCustomHeaders(this.client.getUrl(), - restype, comp, timeout, this.client.getVersion(), requestId, keyInfo, accept, context)); + return FluxUtil + .withContext(context -> service.getUserDelegationKeyNoCustomHeaders(this.client.getUrl(), restype, comp, + timeout, this.client.getVersion(), requestId, keyInfo, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token * authentication. - * + * * @param keyInfo Key information. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -1162,13 +1208,15 @@ public Mono> getUserDelegationKeyNoCustomHeadersWith final String restype = "service"; final String comp = "userdelegationkey"; final String accept = "application/xml"; - return service.getUserDelegationKeyNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, keyInfo, accept, context); + return service + .getUserDelegationKeyNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + requestId, keyInfo, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Returns the sku name and account kind. - * + * * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link ResponseBase} on successful completion of {@link Mono}. @@ -1178,13 +1226,15 @@ public Mono> getAccountInfoWit final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getAccountInfo(this.client.getUrl(), restype, comp, - this.client.getVersion(), accept, context)); + return FluxUtil + .withContext(context -> service.getAccountInfo(this.client.getUrl(), restype, comp, + this.client.getVersion(), accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Returns the sku name and account kind. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. @@ -1196,24 +1246,27 @@ public Mono> getAccountInfoWit final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; - return service.getAccountInfo(this.client.getUrl(), restype, comp, this.client.getVersion(), accept, context); + return service.getAccountInfo(this.client.getUrl(), restype, comp, this.client.getVersion(), accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Returns the sku name and account kind. - * + * * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccountInfoAsync() { - return getAccountInfoWithResponseAsync().flatMap(ignored -> Mono.empty()); + return getAccountInfoWithResponseAsync() + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Returns the sku name and account kind. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. @@ -1222,12 +1275,14 @@ public Mono getAccountInfoAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccountInfoAsync(Context context) { - return getAccountInfoWithResponseAsync(context).flatMap(ignored -> Mono.empty()); + return getAccountInfoWithResponseAsync(context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Returns the sku name and account kind. - * + * * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. @@ -1237,13 +1292,15 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync() { final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getAccountInfoNoCustomHeaders(this.client.getUrl(), restype, - comp, this.client.getVersion(), accept, context)); + return FluxUtil + .withContext(context -> service.getAccountInfoNoCustomHeaders(this.client.getUrl(), restype, comp, + this.client.getVersion(), accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Returns the sku name and account kind. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. @@ -1255,13 +1312,15 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Conte final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; - return service.getAccountInfoNoCustomHeaders(this.client.getUrl(), restype, comp, this.client.getVersion(), - accept, context); + return service + .getAccountInfoNoCustomHeaders(this.client.getUrl(), restype, comp, this.client.getVersion(), accept, + context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. * Example header value: multipart/mixed; boundary=batch_<GUID>. @@ -1281,13 +1340,15 @@ public Mono>> submitBa long contentLength, String multipartContentType, Flux body, Integer timeout, String requestId) { final String comp = "batch"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.submitBatch(this.client.getUrl(), comp, contentLength, - multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.submitBatch(this.client.getUrl(), comp, contentLength, multipartContentType, + timeout, this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. * Example header value: multipart/mixed; boundary=batch_<GUID>. @@ -1309,13 +1370,15 @@ public Mono>> submitBa Context context) { final String comp = "batch"; final String accept = "application/xml"; - return service.submitBatch(this.client.getUrl(), comp, contentLength, multipartContentType, timeout, - this.client.getVersion(), requestId, body, accept, context); + return service + .submitBatch(this.client.getUrl(), comp, contentLength, multipartContentType, timeout, + this.client.getVersion(), requestId, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. * Example header value: multipart/mixed; boundary=batch_<GUID>. @@ -1334,12 +1397,13 @@ public Mono>> submitBa public Flux submitBatchAsync(long contentLength, String multipartContentType, Flux body, Integer timeout, String requestId) { return submitBatchWithResponseAsync(contentLength, multipartContentType, body, timeout, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. * Example header value: multipart/mixed; boundary=batch_<GUID>. @@ -1359,12 +1423,13 @@ public Flux submitBatchAsync(long contentLength, String multipartCon public Flux submitBatchAsync(long contentLength, String multipartContentType, Flux body, Integer timeout, String requestId, Context context) { return submitBatchWithResponseAsync(contentLength, multipartContentType, body, timeout, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. * Example header value: multipart/mixed; boundary=batch_<GUID>. @@ -1384,13 +1449,15 @@ public Mono submitBatchNoCustomHeadersWithResponseAsync(long con String multipartContentType, Flux body, Integer timeout, String requestId) { final String comp = "batch"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.submitBatchNoCustomHeaders(this.client.getUrl(), comp, - contentLength, multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.submitBatchNoCustomHeaders(this.client.getUrl(), comp, contentLength, + multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. * Example header value: multipart/mixed; boundary=batch_<GUID>. @@ -1411,13 +1478,15 @@ public Mono submitBatchNoCustomHeadersWithResponseAsync(long con String multipartContentType, Flux body, Integer timeout, String requestId, Context context) { final String comp = "batch"; final String accept = "application/xml"; - return service.submitBatchNoCustomHeaders(this.client.getUrl(), comp, contentLength, multipartContentType, - timeout, this.client.getVersion(), requestId, body, accept, context); + return service + .submitBatchNoCustomHeaders(this.client.getUrl(), comp, contentLength, multipartContentType, timeout, + this.client.getVersion(), requestId, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. * Example header value: multipart/mixed; boundary=batch_<GUID>. @@ -1437,13 +1506,15 @@ public Mono>> submitBa long contentLength, String multipartContentType, BinaryData body, Integer timeout, String requestId) { final String comp = "batch"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.submitBatch(this.client.getUrl(), comp, contentLength, - multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.submitBatch(this.client.getUrl(), comp, contentLength, multipartContentType, + timeout, this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. * Example header value: multipart/mixed; boundary=batch_<GUID>. @@ -1465,13 +1536,15 @@ public Mono>> submitBa Context context) { final String comp = "batch"; final String accept = "application/xml"; - return service.submitBatch(this.client.getUrl(), comp, contentLength, multipartContentType, timeout, - this.client.getVersion(), requestId, body, accept, context); + return service + .submitBatch(this.client.getUrl(), comp, contentLength, multipartContentType, timeout, + this.client.getVersion(), requestId, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. * Example header value: multipart/mixed; boundary=batch_<GUID>. @@ -1490,12 +1563,13 @@ public Mono>> submitBa public Flux submitBatchAsync(long contentLength, String multipartContentType, BinaryData body, Integer timeout, String requestId) { return submitBatchWithResponseAsync(contentLength, multipartContentType, body, timeout, requestId) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. * Example header value: multipart/mixed; boundary=batch_<GUID>. @@ -1515,12 +1589,13 @@ public Flux submitBatchAsync(long contentLength, String multipartCon public Flux submitBatchAsync(long contentLength, String multipartContentType, BinaryData body, Integer timeout, String requestId, Context context) { return submitBatchWithResponseAsync(contentLength, multipartContentType, body, timeout, requestId, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. * Example header value: multipart/mixed; boundary=batch_<GUID>. @@ -1540,13 +1615,15 @@ public Mono submitBatchNoCustomHeadersWithResponseAsync(long con String multipartContentType, BinaryData body, Integer timeout, String requestId) { final String comp = "batch"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.submitBatchNoCustomHeaders(this.client.getUrl(), comp, - contentLength, multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context)); + return FluxUtil + .withContext(context -> service.submitBatchNoCustomHeaders(this.client.getUrl(), comp, contentLength, + multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. - * + * * @param contentLength The length of the request. * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. * Example header value: multipart/mixed; boundary=batch_<GUID>. @@ -1567,15 +1644,17 @@ public Mono submitBatchNoCustomHeadersWithResponseAsync(long con String multipartContentType, BinaryData body, Integer timeout, String requestId, Context context) { final String comp = "batch"; final String accept = "application/xml"; - return service.submitBatchNoCustomHeaders(this.client.getUrl(), comp, contentLength, multipartContentType, - timeout, this.client.getVersion(), requestId, body, accept, context); + return service + .submitBatchNoCustomHeaders(this.client.getUrl(), comp, contentLength, multipartContentType, timeout, + this.client.getVersion(), requestId, body, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search * expression. Filter blobs searches across all containers within a storage account but can be scoped within the * expression to a single container. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -1610,15 +1689,17 @@ public Mono> filterB : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return FluxUtil.withContext(context -> service.filterBlobs(this.client.getUrl(), comp, timeout, - this.client.getVersion(), requestId, where, marker, maxresults, includeConverted, accept, context)); + return FluxUtil + .withContext(context -> service.filterBlobs(this.client.getUrl(), comp, timeout, this.client.getVersion(), + requestId, where, marker, maxresults, includeConverted, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search * expression. Filter blobs searches across all containers within a storage account but can be scoped within the * expression to a single container. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -1654,15 +1735,17 @@ public Mono> filterB : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.filterBlobs(this.client.getUrl(), comp, timeout, this.client.getVersion(), requestId, where, - marker, maxresults, includeConverted, accept, context); + return service + .filterBlobs(this.client.getUrl(), comp, timeout, this.client.getVersion(), requestId, where, marker, + maxresults, includeConverted, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search * expression. Filter blobs searches across all containers within a storage account but can be scoped within the * expression to a single container. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -1689,6 +1772,7 @@ public Mono> filterB public Mono filterBlobsAsync(Integer timeout, String requestId, String where, String marker, Integer maxresults, List include) { return filterBlobsWithResponseAsync(timeout, requestId, where, marker, maxresults, include) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } @@ -1696,7 +1780,7 @@ public Mono filterBlobsAsync(Integer timeout, String requestI * The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search * expression. Filter blobs searches across all containers within a storage account but can be scoped within the * expression to a single container. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -1724,6 +1808,7 @@ public Mono filterBlobsAsync(Integer timeout, String requestI public Mono filterBlobsAsync(Integer timeout, String requestId, String where, String marker, Integer maxresults, List include, Context context) { return filterBlobsWithResponseAsync(timeout, requestId, where, marker, maxresults, include, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } @@ -1731,7 +1816,7 @@ public Mono filterBlobsAsync(Integer timeout, String requestI * The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search * expression. Filter blobs searches across all containers within a storage account but can be scoped within the * expression to a single container. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -1765,15 +1850,17 @@ public Mono> filterBlobsNoCustomHeadersWithResponseA : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return FluxUtil.withContext(context -> service.filterBlobsNoCustomHeaders(this.client.getUrl(), comp, timeout, - this.client.getVersion(), requestId, where, marker, maxresults, includeConverted, accept, context)); + return FluxUtil + .withContext(context -> service.filterBlobsNoCustomHeaders(this.client.getUrl(), comp, timeout, + this.client.getVersion(), requestId, where, marker, maxresults, includeConverted, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search * expression. Filter blobs searches across all containers within a storage account but can be scoped within the * expression to a single container. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -1809,15 +1896,17 @@ public Mono> filterBlobsNoCustomHeadersWithResponseA : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.filterBlobsNoCustomHeaders(this.client.getUrl(), comp, timeout, this.client.getVersion(), - requestId, where, marker, maxresults, includeConverted, accept, context); + return service + .filterBlobsNoCustomHeaders(this.client.getUrl(), comp, timeout, this.client.getVersion(), requestId, where, + marker, maxresults, includeConverted, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1833,15 +1922,16 @@ public Mono> listBlobContainersSegmentNextSingl return FluxUtil .withContext(context -> service.listBlobContainersSegmentNext(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1858,15 +1948,16 @@ public Mono> listBlobContainersSegmentNextSingl return service .listBlobContainersSegmentNext(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1882,15 +1973,16 @@ public Mono> listBlobContainersSegmentNextSingl return FluxUtil .withContext(context -> service.listBlobContainersSegmentNextNoCustomHeaders(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, accept, context)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), null)); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1907,6 +1999,7 @@ public Mono> listBlobContainersSegmentNextNoCus return service .listBlobContainersSegmentNextNoCustomHeaders(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, accept, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), null)); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobStorageError.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobStorageError.java index 2b39250728ff..9ae705adf845 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobStorageError.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobStorageError.java @@ -70,7 +70,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { */ public static BlobStorageError fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - // Buffer the next JSON object as ResponseError can take two forms: + // Buffer the next JSON object as BlobStorageError can take two forms: // // - A BlobStorageError object // - A BlobStorageError object wrapped in an "error" node. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/ModelHelper.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/ModelHelper.java index 79419e3c67d1..1e6d4e950840 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/ModelHelper.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/ModelHelper.java @@ -479,14 +479,8 @@ public static long getBlobLength(BlobDownloadHeaders headers) { * @param internal The internal exception. * @return The public exception. */ - public static Throwable mapToBlobStorageException(Throwable internal) { - if (internal instanceof BlobStorageExceptionInternal) { - BlobStorageExceptionInternal internalException = (BlobStorageExceptionInternal) internal; - return new BlobStorageException(internalException.getMessage(), internalException.getResponse(), - internalException.getValue()); - } - - return internal; + public static BlobStorageException mapToBlobStorageException(BlobStorageExceptionInternal internal) { + return new BlobStorageException(internal.getMessage(), internal.getResponse(), internal.getValue()); } private ModelHelper() { diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/AppendBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/AppendBlobAsyncClient.java index 21627137d816..c448b13923a4 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/AppendBlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/AppendBlobAsyncClient.java @@ -22,7 +22,6 @@ import com.azure.storage.blob.implementation.models.AppendBlobsAppendBlockHeaders; import com.azure.storage.blob.implementation.models.AppendBlobsCreateHeaders; import com.azure.storage.blob.implementation.models.EncryptionScope; -import com.azure.storage.blob.implementation.util.ModelHelper; import com.azure.storage.blob.models.AppendBlobItem; import com.azure.storage.blob.models.AppendBlobRequestConditions; import com.azure.storage.blob.models.BlobHttpHeaders; @@ -32,12 +31,13 @@ import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.CustomerProvidedKey; +import com.azure.storage.blob.options.AppendBlobAppendBlockFromUrlOptions; import com.azure.storage.blob.options.AppendBlobCreateOptions; import com.azure.storage.blob.options.AppendBlobSealOptions; -import com.azure.storage.blob.options.AppendBlobAppendBlockFromUrlOptions; import com.azure.storage.common.implementation.Constants; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; + import java.net.MalformedURLException; import java.net.URL; import java.nio.ByteBuffer; @@ -294,7 +294,6 @@ Mono> createWithResponse(AppendBlobCreateOptions option tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), options.hasLegalHold(), options.getHeaders(), getCustomerProvidedKey(), encryptionScope, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> { AppendBlobsCreateHeaders hd = rb.getDeserializedHeaders(); AppendBlobItem item = new AppendBlobItem(hd.getETag(), hd.getLastModified(), hd.getContentMD5(), @@ -475,7 +474,6 @@ Mono> appendBlockWithResponse(Flux data, lo appendBlobRequestConditions.getIfMatch(), appendBlobRequestConditions.getIfNoneMatch(), appendBlobRequestConditions.getTagsConditions(), null, getCustomerProvidedKey(), encryptionScope, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> { AppendBlobsAppendBlockHeaders hd = rb.getDeserializedHeaders(); AppendBlobItem item = new AppendBlobItem(hd.getETag(), hd.getLastModified(), hd.getContentMD5(), @@ -611,7 +609,6 @@ Mono> appendBlockFromUrlWithResponse(AppendBlobAppendBl sourceRequestConditions.getIfUnmodifiedSince(), sourceRequestConditions.getIfMatch(), sourceRequestConditions.getIfNoneMatch(), null, sourceAuth, getCustomerProvidedKey(), encryptionScope, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> { AppendBlobsAppendBlockFromUrlHeaders hd = rb.getDeserializedHeaders(); AppendBlobItem item = new AppendBlobItem(hd.getETag(), hd.getLastModified(), hd.getContentMD5(), @@ -676,8 +673,7 @@ Mono> sealWithResponse(AppendBlobSealOptions options, Context con return this.azureBlobStorage.getAppendBlobs().sealNoCustomHeadersWithResponseAsync(containerName, blobName, null, null, requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), - requestConditions.getIfNoneMatch(), requestConditions.getAppendPosition(), context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + requestConditions.getIfNoneMatch(), requestConditions.getAppendPosition(), context); } /** diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java index 2723d5c1c685..a9d489c13feb 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java @@ -766,7 +766,6 @@ private Mono onStart(String sourceUrl, Map metadat destinationRequestConditions.getTagsConditions(), destinationRequestConditions.getLeaseId(), null, tagsToString(tags), sealBlob, immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), legalHold, context)) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(response -> { final BlobsStartCopyFromURLHeaders headers = response.getDeserializedHeaders(); @@ -897,8 +896,7 @@ public Mono> abortCopyFromUrlWithResponse(String copyId, String l Mono> abortCopyFromUrlWithResponse(String copyId, String leaseId, Context context) { return this.azureBlobStorage.getBlobs().abortCopyFromURLNoCustomHeadersWithResponseAsync( - containerName, blobName, copyId, null, leaseId, null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + containerName, blobName, copyId, null, leaseId, null, context); } /** @@ -1038,7 +1036,6 @@ Mono> copyFromUrlWithResponse(BlobCopyFromUrlOptions options, C destRequestConditions.getLeaseId(), null, null, tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), options.hasLegalHold(), sourceAuth, options.getCopySourceTagsMode(), this.encryptionScope, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsCopyId())); } @@ -1335,8 +1332,7 @@ private Mono downloadRange(BlobRange range, BlobRequestCondition versionId, null, range.toHeaderValue(), requestConditions.getLeaseId(), getMD5, null, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), eTag, requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, - customerProvidedKey, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + customerProvidedKey, context); } /** @@ -1685,8 +1681,7 @@ Mono> deleteWithResponse(DeleteSnapshotsOptionType deleteBlobSnap snapshot, versionId, null, requestConditions.getLeaseId(), deleteBlobSnapshotOptions, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), - null, null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + null, null, context); } /** @@ -1833,7 +1828,6 @@ Mono> getPropertiesWithResponse(BlobRequestConditions r requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, customerProvidedKey, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> new SimpleResponse<>(rb, BlobPropertiesConstructorProxy .create(new BlobPropertiesInternalGetProperties(rb.getDeserializedHeaders())))); } @@ -1842,8 +1836,7 @@ Mono> getPropertiesWithResponseNoHeaders(Context context) { context = context == null ? Context.NONE : context; return this.azureBlobStorage.getBlobs().getPropertiesNoCustomHeadersWithResponseAsync(containerName, blobName, - snapshot, versionId, null, null, null, null, null, null, null, null, customerProvidedKey, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + snapshot, versionId, null, null, null, null, null, null, null, null, customerProvidedKey, context); } /** @@ -1914,8 +1907,7 @@ Mono> setHttpHeadersWithResponse(BlobHttpHeaders headers, BlobReq return this.azureBlobStorage.getBlobs().setHttpHeadersNoCustomHeadersWithResponseAsync(containerName, blobName, null, requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), - requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, headers, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, headers, context); } /** @@ -1984,8 +1976,7 @@ Mono> setMetadataWithResponse(Map metadata, BlobR null, metadata, requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, customerProvidedKey, - encryptionScope, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + encryptionScope, context); } /** @@ -2043,7 +2034,6 @@ Mono>> getTagsWithResponse(BlobGetTagsOptions optio ? new BlobRequestConditions() : options.getRequestConditions(); return this.azureBlobStorage.getBlobs().getTagsWithResponseAsync(containerName, blobName, null, null, snapshot, versionId, requestConditions.getTagsConditions(), requestConditions.getLeaseId(), context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(response -> { Map tags = new HashMap<>(); for (BlobTag tag : response.getValue().getBlobTagSet()) { @@ -2122,8 +2112,7 @@ Mono> setTagsWithResponse(BlobSetTagsOptions options, Context con BlobTags t = new BlobTags().setBlobTagSet(tagList); return this.azureBlobStorage.getBlobs().setTagsNoCustomHeadersWithResponseAsync(containerName, blobName, null, versionId, null, null, null, requestConditions.getTagsConditions(), requestConditions.getLeaseId(), t, - context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + context); } /** @@ -2193,7 +2182,6 @@ Mono> createSnapshotWithResponse(Map new SimpleResponse<>(rb, this.getSnapshotClient(rb.getDeserializedHeaders().getXMsSnapshot()))); } @@ -2298,8 +2286,7 @@ Mono> setTierWithResponse(BlobSetAccessTierOptions options, Conte return this.azureBlobStorage.getBlobs().setTierNoCustomHeadersWithResponseAsync(containerName, blobName, options.getTier(), snapshot, versionId, null, options.getPriority(), null, options.getLeaseId(), - options.getTagsConditions(), context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + options.getTagsConditions(), context); } /** @@ -2351,8 +2338,7 @@ public Mono> undeleteWithResponse() { Mono> undeleteWithResponse(Context context) { return this.azureBlobStorage.getBlobs().undeleteNoCustomHeadersWithResponseAsync(containerName, blobName, null, - null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + null, context); } /** @@ -2405,7 +2391,6 @@ public Mono> getAccountInfoWithResponse() { Mono> getAccountInfoWithResponse(Context context) { return this.azureBlobStorage.getBlobs().getAccountInfoWithResponseAsync(containerName, blobName, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> { BlobsGetAccountInfoHeaders hd = rb.getDeserializedHeaders(); return new SimpleResponse<>(rb, new StorageAccountInfo(hd.getXMsSkuName(), hd.getXMsAccountKind())); @@ -2683,7 +2668,6 @@ Mono queryWithResponse(BlobQueryOptions queryOptions, Co requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, qr, getCustomerProvidedKey(), context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(response -> new BlobQueryAsyncResponse(response.getRequest(), response.getStatusCode(), response.getHeaders(), /* Parse the avro reactive stream. */ @@ -2775,7 +2759,6 @@ Mono> setImmutabilityPolicyWithResponse( return this.azureBlobStorage.getBlobs().setImmutabilityPolicyWithResponseAsync(containerName, blobName, null, null, finalRequestConditions.getIfUnmodifiedSince(), finalImmutabilityPolicy.getExpiryTime(), finalImmutabilityPolicy.getPolicyMode(), context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(response -> { BlobsSetImmutabilityPolicyHeaders headers = response.getDeserializedHeaders(); BlobImmutabilityPolicy responsePolicy = new BlobImmutabilityPolicy() @@ -2834,8 +2817,7 @@ public Mono> deleteImmutabilityPolicyWithResponse() { Mono> deleteImmutabilityPolicyWithResponse(Context context) { context = context == null ? Context.NONE : context; return this.azureBlobStorage.getBlobs() - .deleteImmutabilityPolicyNoCustomHeadersWithResponseAsync(containerName, blobName, null, null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + .deleteImmutabilityPolicyNoCustomHeadersWithResponseAsync(containerName, blobName, null, null, context); } /** @@ -2890,7 +2872,6 @@ Mono> setLegalHoldWithResponse(boolean legalHold, context = context == null ? Context.NONE : context; return this.azureBlobStorage.getBlobs().setLegalHoldWithResponseAsync(containerName, blobName, legalHold, null, null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(response -> new SimpleResponse<>(response, new InternalBlobLegalHoldResult(response.getDeserializedHeaders().isXMsLegalHold()))); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobLeaseAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobLeaseAsyncClient.java index 67874c1057b5..978be71bba68 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobLeaseAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobLeaseAsyncClient.java @@ -205,15 +205,12 @@ Mono> acquireLeaseWithResponse(BlobAcquireLeaseOptions options, response = this.client.getBlobs().acquireLeaseWithResponseAsync(containerName, blobName, null, options.getDuration(), this.leaseId, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), - requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, - context) - .onErrorMap(ModelHelper::mapToBlobStorageException) + requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, context) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsLeaseId())); } else { response = this.client.getContainers().acquireLeaseWithResponseAsync(containerName, null, options.getDuration(), this.leaseId, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsLeaseId())); } @@ -306,15 +303,11 @@ Mono> renewLeaseWithResponse(BlobRenewLeaseOptions options, Con response = this.client.getBlobs().renewLeaseWithResponseAsync(containerName, blobName, this.leaseId, null, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), - requestConditions.getTagsConditions(), null, - context) - .onErrorMap(ModelHelper::mapToBlobStorageException) + requestConditions.getTagsConditions(), null, context) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsLeaseId())); } else { response = this.client.getContainers().renewLeaseWithResponseAsync(containerName, this.leaseId, null, - requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), - null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) + requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), null, context) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsLeaseId())); } @@ -406,12 +399,10 @@ Mono> releaseLeaseWithResponse(BlobReleaseLeaseOptions options, C return this.client.getBlobs().releaseLeaseNoCustomHeadersWithResponseAsync(containerName, blobName, this.leaseId, null, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), - requestConditions.getTagsConditions(), null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + requestConditions.getTagsConditions(), null, context); } else { return this.client.getContainers().releaseLeaseNoCustomHeadersWithResponseAsync(containerName, this.leaseId, - null, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + null, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), null, context); } } @@ -517,15 +508,12 @@ Mono> breakLeaseWithResponse(BlobBreakLeaseOptions options, Co return this.client.getBlobs().breakLeaseWithResponseAsync(containerName, blobName, null, breakPeriod, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), - requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, - context) - .onErrorMap(ModelHelper::mapToBlobStorageException) + requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, context) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsLeaseTime())); } else { return this.client.getContainers().breakLeaseWithResponseAsync(containerName, null, breakPeriod, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsLeaseTime())); } } @@ -618,16 +606,12 @@ Mono> changeLeaseWithResponse(BlobChangeLeaseOptions options, C response = this.client.getBlobs().changeLeaseWithResponseAsync(containerName, blobName, this.leaseId, options.getProposedId(), null, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), - requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, - context) - .onErrorMap(ModelHelper::mapToBlobStorageException) + requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, context) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsLeaseId())); } else { response = this.client.getContainers().changeLeaseWithResponseAsync(containerName, this.leaseId, options.getProposedId(), null, requestConditions.getIfModifiedSince(), - requestConditions.getIfUnmodifiedSince(), null, - context) - .onErrorMap(ModelHelper::mapToBlobStorageException) + requestConditions.getIfUnmodifiedSince(), null, context) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsLeaseId())); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobAsyncClient.java index 22c3c46ca4ab..25e5a953c667 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobAsyncClient.java @@ -19,7 +19,6 @@ import com.azure.storage.blob.implementation.models.BlockBlobsPutBlobFromUrlHeaders; import com.azure.storage.blob.implementation.models.BlockBlobsUploadHeaders; import com.azure.storage.blob.implementation.models.EncryptionScope; -import com.azure.storage.blob.implementation.util.ModelHelper; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobImmutabilityPolicy; @@ -438,7 +437,6 @@ Mono> uploadWithResponse(BlockBlobSimpleUploadOptions op tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), options.isLegalHold(), null, options.getHeaders(), getCustomerProvidedKey(), encryptionScope, finalContext) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> { BlockBlobsUploadHeaders hd = rb.getDeserializedHeaders(); BlockBlobItem item = new BlockBlobItem(hd.getETag(), hd.getLastModified(), hd.getContentMD5(), @@ -590,9 +588,7 @@ Mono> uploadFromUrlWithResponse(BlobUploadFromUrlOptions sourceRequestConditions.getTagsConditions(), null, options.getContentMd5(), tagsToString(options.getTags()), options.isCopySourceBlobProperties(), sourceAuth, options.getCopySourceTagsMode(), options.getHeaders(), - getCustomerProvidedKey(), encryptionScope, - context) - .onErrorMap(ModelHelper::mapToBlobStorageException) + getCustomerProvidedKey(), encryptionScope, context) .map(rb -> { BlockBlobsPutBlobFromUrlHeaders hd = rb.getDeserializedHeaders(); BlockBlobItem item = new BlockBlobItem(hd.getETag(), hd.getLastModified(), hd.getContentMD5(), @@ -761,8 +757,7 @@ Mono> stageBlockWithResponse(String base64BlockId, BinaryData dat context = context == null ? Context.NONE : context; return this.azureBlobStorage.getBlockBlobs().stageBlockNoCustomHeadersWithResponseAsync(containerName, blobName, base64BlockId, data.getLength(), data, contentMd5, null, null, leaseId, null, getCustomerProvidedKey(), - encryptionScope, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + encryptionScope, context); } /** @@ -888,8 +883,7 @@ Mono> stageBlockFromUrlWithResponse(BlockBlobStageBlockFromUrlOpt options.getSourceContentMd5(), null, null, options.getLeaseId(), sourceRequestConditions.getIfModifiedSince(), sourceRequestConditions.getIfUnmodifiedSince(), sourceRequestConditions.getIfMatch(), sourceRequestConditions.getIfNoneMatch(), null, sourceAuth, - getCustomerProvidedKey(), encryptionScope, context) - .onErrorMap(ModelHelper::mapToBlobStorageException); + getCustomerProvidedKey(), encryptionScope, context); } /** @@ -993,7 +987,6 @@ Mono> listBlocksWithResponse(BlockBlobListBlocksOptions opti return this.azureBlobStorage.getBlockBlobs().getBlockListWithResponseAsync( containerName, blobName, options.getType(), getSnapshotId(), null, options.getLeaseId(), options.getIfTagsMatch(), null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(response -> new SimpleResponse<>(response, response.getValue())); } @@ -1158,9 +1151,7 @@ Mono> commitBlockListWithResponse(BlockBlobCommitBlockLi requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), - options.isLegalHold(), options.getHeaders(), getCustomerProvidedKey(), - encryptionScope, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) + options.isLegalHold(), options.getHeaders(), getCustomerProvidedKey(), encryptionScope, context) .map(rb -> { BlockBlobsCommitBlockListHeaders hd = rb.getDeserializedHeaders(); BlockBlobItem item = new BlockBlobItem(hd.getETag(), hd.getLastModified(), hd.getContentMD5(), diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobAsyncClient.java index 46321992d4e4..dd92e87a943f 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobAsyncClient.java @@ -341,9 +341,7 @@ Mono> createWithResponse(PageBlobCreateOptions options, C requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), options.getSequenceNumber(), null, tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), options.isLegalHold(), - options.getHeaders(), getCustomerProvidedKey(), encryptionScope, - context) - .onErrorMap(ModelHelper::mapToBlobStorageException) + options.getHeaders(), getCustomerProvidedKey(), encryptionScope, context) .map(rb -> { PageBlobsCreateHeaders hd = rb.getDeserializedHeaders(); PageBlobItem item = new PageBlobItem(hd.getETag(), hd.getLastModified(), hd.getContentMD5(), @@ -542,9 +540,7 @@ Mono> uploadPagesWithResponse(PageRange pageRange, Flux { PageBlobsUploadPagesHeaders hd = rb.getDeserializedHeaders(); PageBlobItem item = new PageBlobItem(hd.getETag(), hd.getLastModified(), hd.getContentMD5(), @@ -724,7 +720,6 @@ Mono> uploadPagesFromUrlWithResponse(PageBlobUploadPagesF sourceRequestConditions.getIfUnmodifiedSince(), sourceRequestConditions.getIfMatch(), sourceRequestConditions.getIfNoneMatch(), null, sourceAuth, getCustomerProvidedKey(), encryptionScope, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> { PageBlobsUploadPagesFromURLHeaders hd = rb.getDeserializedHeaders(); PageBlobItem item = new PageBlobItem(hd.getETag(), hd.getLastModified(), hd.getContentMD5(), @@ -819,7 +814,6 @@ Mono> clearPagesWithResponse(PageRange pageRange, pageBlobRequestConditions.getIfUnmodifiedSince(), pageBlobRequestConditions.getIfMatch(), pageBlobRequestConditions.getIfNoneMatch(), pageBlobRequestConditions.getTagsConditions(), null, getCustomerProvidedKey(), encryptionScope, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> { PageBlobsClearPagesHeaders hd = rb.getDeserializedHeaders(); PageBlobItem item = new PageBlobItem(hd.getETag(), hd.getLastModified(), hd.getContentMD5(), @@ -906,9 +900,7 @@ Mono> getPageRangesWithResponse(BlobRange blobRange, BlobRequ getSnapshotId(), null, blobRange.toHeaderValue(), requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), - requestConditions.getTagsConditions(), null, null, null, - context) - .onErrorMap(ModelHelper::mapToBlobStorageException) + requestConditions.getTagsConditions(), null, null, null, context) .map(response -> new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), response.getValue())); } @@ -1023,8 +1015,7 @@ private Mono> getPageRange requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, marker, options.getMaxResultsPerPage(), context), - timeout) - .onErrorMap(ModelHelper::mapToBlobStorageException); + timeout); } private static PageRangeItem toPageBlobRange(PageRange range) { @@ -1280,9 +1271,7 @@ Mono> getPageRangesDiffWithResponse(BlobRange blobRange, Stri getSnapshotId(), null, prevSnapshot, prevSnapshotUrl, blobRange.toHeaderValue(), requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), - requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, null, null, - context) - .onErrorMap(ModelHelper::mapToBlobStorageException) + requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, null, null, context) .map(response -> new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), response.getValue())); } @@ -1345,10 +1334,8 @@ private Mono> getPageR options.getRange().toHeaderValue(), requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), - requestConditions.getTagsConditions(), null, marker, options.getMaxResultsPerPage(), - context), - timeout) - .onErrorMap(ModelHelper::mapToBlobStorageException); + requestConditions.getTagsConditions(), null, marker, options.getMaxResultsPerPage(), context), + timeout); } /** @@ -1421,9 +1408,7 @@ Mono> resizeWithResponse(long size, BlobRequestConditions requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, - getCustomerProvidedKey(), encryptionScope, - context) - .onErrorMap(ModelHelper::mapToBlobStorageException) + getCustomerProvidedKey(), encryptionScope, context) .map(rb -> { PageBlobsResizeHeaders hd = rb.getDeserializedHeaders(); PageBlobItem item = new PageBlobItem(hd.getETag(), hd.getLastModified(), null, null, null, null, @@ -1508,9 +1493,7 @@ Mono> updateSequenceNumberWithResponse(SequenceNumberActi return this.azureBlobStorage.getPageBlobs().updateSequenceNumberWithResponseAsync(containerName, blobName, action, null, requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), - requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), sequenceNumber, null, - context) - .onErrorMap(ModelHelper::mapToBlobStorageException) + requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), sequenceNumber, null, context) .map(rb -> { PageBlobsUpdateSequenceNumberHeaders hd = rb.getDeserializedHeaders(); PageBlobItem item = new PageBlobItem(hd.getETag(), hd.getLastModified(), null, null, null, null, @@ -1703,7 +1686,6 @@ Mono> copyIncrementalWithResponse(PageBlobCopyIncrement modifiedRequestConditions.getIfUnmodifiedSince(), modifiedRequestConditions.getIfMatch(), modifiedRequestConditions.getIfNoneMatch(), modifiedRequestConditions.getTagsConditions(), null, context) - .onErrorMap(ModelHelper::mapToBlobStorageException) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsCopyStatus())); } } diff --git a/sdk/storage/azure-storage-blob/swagger/src/main/java/BlobStorageCustomization.java b/sdk/storage/azure-storage-blob/swagger/src/main/java/BlobStorageCustomization.java index f4e696142b16..5c3cd0b277ec 100644 --- a/sdk/storage/azure-storage-blob/swagger/src/main/java/BlobStorageCustomization.java +++ b/sdk/storage/azure-storage-blob/swagger/src/main/java/BlobStorageCustomization.java @@ -6,13 +6,25 @@ import com.azure.autorest.customization.JavadocCustomization; import com.azure.autorest.customization.LibraryCustomization; import com.azure.autorest.customization.PackageCustomization; +import com.github.javaparser.ParseProblemException; import com.github.javaparser.StaticJavaParser; import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; -import com.github.javaparser.ast.expr.MemberValuePair; -import com.github.javaparser.ast.expr.StringLiteralExpr; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.expr.MethodCallExpr; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.CatchClause; +import com.github.javaparser.ast.stmt.ReturnStmt; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.stmt.TryStmt; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.ast.type.Type; import org.slf4j.Logger; +import java.util.Arrays; +import java.util.List; + /** * Customization class for Blob Storage. */ @@ -100,22 +112,20 @@ public void customize(LibraryCustomization customization, Logger logger) { .setDeprecated("Please use {@link BlobErrorCode#INCREMENTAL_COPY_OF_EARLIER_VERSION_SNAPSHOT_NOT_ALLOWED}"); //QueryFormat - ClassCustomization queryFormat = implementationModels.getClass("QueryFormat"); - customizeQueryFormat(queryFormat); + customizeQueryFormat(implementationModels.getClass("QueryFormat")); //BlobHierarchyListSegment - ClassCustomization blobHierarchyListSegment = implementationModels.getClass("BlobHierarchyListSegment"); - customizeBlobHierarchyListSegment(blobHierarchyListSegment); + customizeBlobHierarchyListSegment(implementationModels.getClass("BlobHierarchyListSegment")); //BlobFlatListSegment - ClassCustomization blobFlatListSegment = implementationModels.getClass("BlobFlatListSegment"); - customizeBlobFlatListSegment(blobFlatListSegment); + customizeBlobFlatListSegment(implementationModels.getClass("BlobFlatListSegment")); //BlobSignedIdentifierWrapper - ClassCustomization blobSignedIdentifierWrapper = implementationModels.getClass("BlobSignedIdentifierWrapper"); - customizeBlobSignedIdentifierWrapper(blobSignedIdentifierWrapper); + customizeBlobSignedIdentifierWrapper(implementationModels.getClass("BlobSignedIdentifierWrapper")); + updateImplToMapInternalException(customization.getPackage("com.azure.storage.blob.implementation")); } + private static void customizeQueryFormat(ClassCustomization classCustomization) { String fileContent = classCustomization.getEditor().getFileContent(classCustomization.getFileName()); fileContent = fileContent.replace("xmlWriter.nullElement(\"ParquetTextConfiguration\", this.parquetTextConfiguration);", @@ -241,4 +251,110 @@ private static void customizeBlobSignedIdentifierWrapper(ClassCustomization clas "instance of it, or null if it was pointing to XML null."); javadocfromXmlWithRoot.addThrows("XMLStreamException", "If an error occurs while reading the BlobSignedIdentifierWrapper."); } + + /** + * Customizes the implementation classes that will perform calls to the service. The following logic is used: + *

+ * - Check for the return of the method not equaling to PagedFlux, PagedIterable, PollerFlux, or SyncPoller. Those + * types wrap other APIs and those APIs being update is the correct change. + * - For asynchronous methods, add a call to + * {@code .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException)} to handle + * mapping BlobStorageExceptionInternal to BlobStorageException. + * - For synchronous methods, wrap the return statement in a try-catch block that catches + * BlobStorageExceptionInternal and rethrows {@code ModelHelper.mapToBlobStorageException(e)}. Or, for void methods + * wrap the last statement. + * + * @param implPackage The implementation package. + */ + private static void updateImplToMapInternalException(PackageCustomization implPackage) { + List implsToUpdate = Arrays.asList("AppendBlobsImpl", "BlobsImpl", "BlockBlobsImpl", "ContainersImpl", + "PageBlobsImpl", "ServicesImpl"); + for (String implToUpdate : implsToUpdate) { + implPackage.getClass(implToUpdate).customizeAst(ast -> { + ast.addImport("com.azure.storage.blob.implementation.util.ModelHelper"); + ast.addImport("com.azure.storage.blob.models.BlobStorageException"); + ast.addImport("com.azure.storage.blob.implementation.models.BlobStorageExceptionInternal"); + ast.getClassByName(implToUpdate).ifPresent(clazz -> { + clazz.getFields(); + + clazz.getMethods().forEach(methodDeclaration -> { + Type returnType = methodDeclaration.getType(); + // The way code generation works we only need to update the methods that have a class return type. + // As non-class return types, such as "void", call into the Response methods. + if (!returnType.isClassOrInterfaceType()) { + return; + } + + ClassOrInterfaceType returnTypeClass = returnType.asClassOrInterfaceType(); + String returnTypeName = returnTypeClass.getNameAsString(); + if (returnTypeName.equals("PagedFlux") || returnTypeName.equals("PagedIterable") + || returnTypeName.equals("PollerFlux") || returnTypeName.equals("SyncPoller")) { + return; + } + + if (returnTypeName.equals("Mono") || returnTypeName.equals("Flux")) { + addErrorMappingToAsyncMethod(methodDeclaration); + } else { + addErrorMappingToSyncMethod(methodDeclaration); + } + }); + }); + }); + } + } + + private static void addErrorMappingToAsyncMethod(MethodDeclaration method) { + BlockStmt body = method.getBody().get(); + + // Bit of hack to insert the 'onErrorMap' in the right location. + // Unfortunately, 'onErrorMap' returns which for some calls breaks typing, such as Void -> Object or + // PagedResponse -> PagedResponseBase. So, 'onErrorMap' needs to be inserted after the first method call. + // To do this, we track the first found '(' and the associated closing ')' to insert 'onErrorMap' after the ')'. + // So, 'service.methodCall(parameters).map()' becomes 'service.methodCall(parameters).onErrorMap().map()'. + String originalReturnStatement = body.getStatement(body.getStatements().size() - 1).asReturnStmt() + .getExpression().get().toString(); + int insertionPoint = findAsyncOnErrorMapInsertionPoint(originalReturnStatement); + String newReturnStatement = "return " + originalReturnStatement.substring(0, insertionPoint) + + ".onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException)" + + originalReturnStatement.substring(insertionPoint) + ";"; + try { + Statement newReturn = StaticJavaParser.parseStatement(newReturnStatement); + body.getStatements().set(body.getStatements().size() - 1, newReturn); + } catch (ParseProblemException ex) { + throw new RuntimeException("Failed to parse: " + newReturnStatement, ex); + } + } + + private static int findAsyncOnErrorMapInsertionPoint(String returnStatement) { + int openParenthesis = 0; + int closeParenthesis = 0; + for (int i = 0; i < returnStatement.length(); i++) { + char c = returnStatement.charAt(i); + if (c == '(') { + openParenthesis++; + } else if (c == ')') { + closeParenthesis++; + if (openParenthesis == closeParenthesis) { + return i + 1; + } + } + } + return -1; + } + + private static void addErrorMappingToSyncMethod(MethodDeclaration method) { + BlockStmt body = method.getBody().get(); + + // Turn the last statement into a BlockStmt that will be used as the try block. + BlockStmt tryBlock = new BlockStmt(new NodeList<>(body.getStatement(body.getStatements().size() - 1))); + BlockStmt catchBlock = new BlockStmt(new NodeList<>(StaticJavaParser.parseStatement( + "throw ModelHelper.mapToBlobStorageException(internalException);"))); + Parameter catchParameter = new Parameter().setType("BlobStorageExceptionInternal") + .setName("internalException"); + CatchClause catchClause = new CatchClause(catchParameter, catchBlock); + TryStmt tryCatchMap = new TryStmt(tryBlock, new NodeList<>(catchClause), null); + + // Replace the last statement with the try-catch block. + body.getStatements().set(body.getStatements().size() - 1, tryCatchMap); + } } diff --git a/sdk/storage/azure-storage-file-datalake/checkstyle-suppressions.xml b/sdk/storage/azure-storage-file-datalake/checkstyle-suppressions.xml index 424f4847030b..980882cadcf3 100644 --- a/sdk/storage/azure-storage-file-datalake/checkstyle-suppressions.xml +++ b/sdk/storage/azure-storage-file-datalake/checkstyle-suppressions.xml @@ -24,4 +24,12 @@ + + + + + + + + diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeDirectoryAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeDirectoryAsyncClient.java index 06f25edfe533..9584a4728b3f 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeDirectoryAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeDirectoryAsyncClient.java @@ -29,7 +29,6 @@ import com.azure.storage.file.datalake.implementation.models.PathList; import com.azure.storage.file.datalake.implementation.models.PathResourceType; import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; -import com.azure.storage.file.datalake.implementation.util.ModelHelper; import com.azure.storage.file.datalake.implementation.util.TransformUtils; import com.azure.storage.file.datalake.models.CustomerProvidedKey; import com.azure.storage.file.datalake.models.DataLakeRequestConditions; @@ -1287,8 +1286,7 @@ private Mono> listPathsSegme return StorageImplUtils.applyOptionalTimeout( this.fileSystemDataLakeStorage.getFileSystems().listPathsWithResponseAsync( recursive, null, null, marker, getDirectoryPath(), maxResults, userPrincipleNameReturned, - Context.NONE), timeout) - .onErrorMap(ModelHelper::mapToDataLakeStorageException); + Context.NONE), timeout); } /** diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeDirectoryClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeDirectoryClient.java index 5fb2a3917ddb..789b24893042 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeDirectoryClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeDirectoryClient.java @@ -44,8 +44,6 @@ import java.util.function.BiFunction; import java.util.stream.Collectors; -import static com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils.wrapServiceCallWithExceptionMapping; - /** * This class provides a client that contains directory operations for Azure Storage Data Lake. Operations provided by * this client include creating a directory, deleting a directory, renaming a directory, setting metadata and @@ -1154,9 +1152,9 @@ public PagedIterable listPaths(boolean recursive, boolean userPrincipl Duration timeout) { BiFunction> retriever = (marker, pageSize) -> { Callable> operation - = wrapServiceCallWithExceptionMapping(() -> this.fileSystemDataLakeStorage.getFileSystems() + = () -> this.fileSystemDataLakeStorage.getFileSystems() .listPathsWithResponse(recursive, null, null, marker, getDirectoryPath(), - pageSize == null ? maxResults : pageSize, userPrincipleNameReturned, Context.NONE)); + pageSize == null ? maxResults : pageSize, userPrincipleNameReturned, Context.NONE); ResponseBase response = StorageImplUtils.sendRequest(operation, timeout, DataLakeStorageException.class); diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java index 1a1f6a336af1..c73e200219ac 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java @@ -1178,8 +1178,7 @@ Mono> appendWithResponse(Flux data, long fileOffset, return this.dataLakeStorage.getPaths().appendDataNoCustomHeadersWithResponseAsync( data, fileOffset, null, length, null, appendOptions.getLeaseAction(), leaseDuration, appendOptions.getProposedLeaseId(), null, appendOptions.isFlush(), headers, leaseAccessConditions, - getCpkInfo(), context) - .onErrorMap(ModelHelper::mapToDataLakeStorageException); + getCpkInfo(), context); } /** @@ -1368,7 +1367,6 @@ Mono> flushWithResponse(long position, DataLakeFileFlushOptio return this.dataLakeStorage.getPaths().flushDataWithResponseAsync(null, position, flushOptions.isUncommittedDataRetained(), flushOptions.isClose(), (long) 0, flushOptions.getLeaseAction(), leaseDuration, flushOptions.getProposedLeaseId(), null, httpHeaders, lac, mac, getCpkInfo(), context) - .onErrorMap(ModelHelper::mapToDataLakeStorageException) .map(response -> new SimpleResponse<>(response, new PathInfo(response.getDeserializedHeaders().getETag(), response.getDeserializedHeaders().getLastModified(), response.getDeserializedHeaders().isXMsRequestServerEncrypted() != null, @@ -1849,8 +1847,7 @@ Mono> scheduleDeletionWithResponse(FileScheduleDeletionOptions op pathExpiryOptions = PathExpiryOptions.NEVER_EXPIRE; } return this.blobDataLakeStorage.getPaths() - .setExpiryNoCustomHeadersWithResponseAsync(pathExpiryOptions, null, null, expiresOn, context) - .onErrorMap(ModelHelper::mapToDataLakeStorageException); + .setExpiryNoCustomHeadersWithResponseAsync(pathExpiryOptions, null, null, expiresOn, context); } } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java index 6814d1c8254c..b18497d32f5d 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileClient.java @@ -76,8 +76,6 @@ import java.util.Set; import java.util.concurrent.Callable; -import static com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils.wrapServiceCallWithExceptionMapping; - /** * This class provides a client that contains file operations for Azure Storage Data Lake. Operations provided by * this client include creating a file, deleting a file, renaming a file, setting metadata and @@ -1686,9 +1684,8 @@ public Response scheduleDeletionWithResponse(FileScheduleDeletionOptions o expiresOn = null; } - Callable> operation = wrapServiceCallWithExceptionMapping(() -> - this.blobDataLakeStorage.getPaths().setExpiryWithResponse(pathExpiryOptions, null, null, expiresOn, - finalContext)); + Callable> operation = () -> this.blobDataLakeStorage.getPaths() + .setExpiryWithResponse(pathExpiryOptions, null, null, expiresOn, finalContext); ResponseBase response = StorageImplUtils.sendRequest(operation, timeout, DataLakeStorageException.class); diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java index b0f83bae862e..81894e82ec06 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemAsyncClient.java @@ -38,7 +38,6 @@ import com.azure.storage.file.datalake.implementation.models.PathResourceType; import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; import com.azure.storage.file.datalake.implementation.util.DataLakeSasImplUtil; -import com.azure.storage.file.datalake.implementation.util.ModelHelper; import com.azure.storage.file.datalake.implementation.util.TransformUtils; import com.azure.storage.file.datalake.models.DataLakeRequestConditions; import com.azure.storage.file.datalake.models.DataLakeSignedIdentifier; @@ -779,9 +778,8 @@ private Mono> listPathsSegme return StorageImplUtils.applyOptionalTimeout( this.azureDataLakeStorage.getFileSystems().listPathsWithResponseAsync(options.isRecursive(), null, null, - marker, options.getPath(), options.getMaxResults(), - options.isUserPrincipalNameReturned(), Context.NONE), timeout) - .onErrorMap(ModelHelper::mapToDataLakeStorageException); + marker, options.getPath(), options.getMaxResults(), options.isUserPrincipalNameReturned(), + Context.NONE), timeout); } /** @@ -870,10 +868,8 @@ private Mono> listDeletedPaths(String marker, Int context = context == null ? Context.NONE : context; return StorageImplUtils.applyOptionalTimeout( - this.blobDataLakeStorageFs.getFileSystems().listBlobHierarchySegmentWithResponseAsync( - prefix, null, marker, maxResults, - null, ListBlobsShowOnly.DELETED, null, null, context), timeout) - .onErrorMap(ModelHelper::mapToDataLakeStorageException); + this.blobDataLakeStorageFs.getFileSystems().listBlobHierarchySegmentWithResponseAsync(prefix, null, marker, + maxResults, null, ListBlobsShowOnly.DELETED, null, null, context), timeout); } /** @@ -1673,7 +1669,6 @@ Mono> undeletePathWithResponse(String deletedP // Initial rest call return blobDataLakeStoragePath.getPaths().undeleteWithResponseAsync(null, String.format("?%s=%s", Constants.UrlConstants.DELETIONID_QUERY_PARAMETER, deletionId), null, context) - .onErrorMap(ModelHelper::mapToDataLakeStorageException) .onErrorMap(DataLakeImplUtils::transformBlobStorageException) // Construct the new client and final response from the undelete + getProperties responses .map(response -> { diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java index 562a04eb215f..c166385ae15f 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileSystemClient.java @@ -64,8 +64,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import static com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils.wrapServiceCallWithExceptionMapping; - /** * Client to a file system. It may only be instantiated through a {@link DataLakeFileSystemClientBuilder} or via the * method {@link DataLakeServiceClient#getFileSystemClient(String)}. This class does not hold any state about a @@ -725,9 +723,8 @@ public PagedIterable listPaths(ListPathsOptions options, Duration time BiFunction> pageRetriever = (continuation, pageSize) -> { Callable> operation - = wrapServiceCallWithExceptionMapping(() -> this.azureDataLakeStorage.getFileSystems() - .listPathsWithResponse(recursive, null, null, continuation, path, - pageSize == null ? maxResults : pageSize, upn, Context.NONE)); + = () -> this.azureDataLakeStorage.getFileSystems().listPathsWithResponse(recursive, null, null, + continuation, path, pageSize == null ? maxResults : pageSize, upn, Context.NONE); ResponseBase response = StorageImplUtils.sendRequest(operation, timeout, DataLakeStorageException.class); @@ -799,10 +796,9 @@ public PagedIterable listDeletedPaths() { public PagedIterable listDeletedPaths(String prefix, Duration timeout, Context context) { BiFunction> retriever = (marker, pageSize) -> { - Callable> operation = - wrapServiceCallWithExceptionMapping(() -> this.blobDataLakeStorageFs.getFileSystems() - .listBlobHierarchySegmentWithResponse(prefix, null, marker, pageSize, null, - ListBlobsShowOnly.DELETED, null, null, context)); + Callable> operation + = () -> this.blobDataLakeStorageFs.getFileSystems().listBlobHierarchySegmentWithResponse(prefix, null, + marker, pageSize, null, ListBlobsShowOnly.DELETED, null, null, context); ResponseBase response = StorageImplUtils.sendRequest(operation, timeout, DataLakeStorageException.class); @@ -1566,11 +1562,9 @@ public Response undeletePathWithResponse(String deletedPath, .buildClient(); // Initial rest call - Callable> operation = wrapServiceCallWithExceptionMapping(() -> - blobDataLakeStoragePath.getPaths() - .undeleteWithResponse(null, - String.format("?%s=%s", Constants.UrlConstants.DELETIONID_QUERY_PARAMETER, deletionId), null, - finalContext)); + Callable> operation = () -> blobDataLakeStoragePath.getPaths() + .undeleteWithResponse(null, "?" + Constants.UrlConstants.DELETIONID_QUERY_PARAMETER + "=" + deletionId, + null, finalContext); ResponseBase response = StorageImplUtils.sendRequest(operation, timeout, DataLakeStorageException.class); diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathAsyncClient.java index ae65b5303514..2705209971aa 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathAsyncClient.java @@ -468,7 +468,6 @@ Mono> createWithResponse(DataLakePathCreateOptions options, C options.getProposedLeaseId(), leaseDuration, expiryOptions, expiresOnString, options.getEncryptionContext(), options.getPathHttpHeaders(), lac, mac, null, customerProvidedKey, context) - .onErrorMap(ModelHelper::mapToDataLakeStorageException) .map(response -> new SimpleResponse<>(response, new PathInfo( response.getDeserializedHeaders().getETag(), response.getDeserializedHeaders().getLastModified(), @@ -552,7 +551,6 @@ Mono> createIfNotExistsWithResponse(DataLakePathCreateOptions options.setRequestConditions(new DataLakeRequestConditions() .setIfNoneMatch(Constants.HeaderConstants.ETAG_WILDCARD)); return createWithResponse(options, context) - .onErrorMap(ModelHelper::mapToDataLakeStorageException) .onErrorResume(t -> t instanceof DataLakeStorageException && ((DataLakeStorageException) t).getStatusCode() == 409, t -> { @@ -592,7 +590,6 @@ Mono> deleteWithResponse(Boolean recursive, DataLakeRequestCondit Context finalContext = context == null ? Context.NONE : context; return this.dataLakeStorage.getPaths() .deleteNoCustomHeadersWithResponseAsync(null, null, recursive, null, paginated, lac, mac, context) - .onErrorMap(ModelHelper::mapToDataLakeStorageException) .expand(resp -> { String continuation = resp.getHeaders().getValue(Transforms.X_MS_CONTINUATION); if (continuation != null && !continuation.isEmpty()) { @@ -675,7 +672,6 @@ Mono> deleteIfExistsWithResponse(DataLakePathDeleteOptions opt try { options = options == null ? new DataLakePathDeleteOptions() : options; return deleteWithResponse(options.getIsRecursive(), options.getRequestConditions(), context) - .onErrorMap(ModelHelper::mapToDataLakeStorageException) .map(response -> (Response) new SimpleResponse<>(response, true)) .onErrorResume(t -> t instanceof DataLakeStorageException && ((DataLakeStorageException) t).getStatusCode() == 404, @@ -1108,7 +1104,6 @@ Mono> setAccessControlWithResponse(List new SimpleResponse<>(response, new PathInfo(response.getDeserializedHeaders().getETag(), response.getDeserializedHeaders().getLastModified()))); } @@ -1400,9 +1395,8 @@ Mono> setAccessControlRecursiveWithResponse( AtomicInteger failureCount = new AtomicInteger(0); AtomicInteger batchesCount = new AtomicInteger(0); - return this.dataLakeStorage.getPaths().setAccessControlRecursiveWithResponseAsync(mode, null, - continuationToken, continueOnFailure, batchSize, accessControlList, null, contextFinal) - .onErrorMap(ModelHelper::mapToDataLakeStorageException) + return this.dataLakeStorage.getPaths().setAccessControlRecursiveWithResponseAsync(mode, null, continuationToken, + continueOnFailure, batchSize, accessControlList, null, contextFinal) .onErrorMap(e -> { if (e instanceof DataLakeStorageException) { return LOGGER.logExceptionAsError(ModelHelper.changeAclRequestFailed((DataLakeStorageException) e, @@ -1515,8 +1509,7 @@ Determine if we are finished either because there is no new continuation (failur // If we're not finished, issue another request return this.dataLakeStorage.getPaths().setAccessControlRecursiveWithResponseAsync(mode, null, - effectiveNextToken, continueOnFailure, batchSize, accessControlStr, null, context) - .onErrorMap(ModelHelper::mapToDataLakeStorageException) + effectiveNextToken, continueOnFailure, batchSize, accessControlStr, null, context) .onErrorMap(e -> { if (e instanceof DataLakeStorageException) { return LOGGER.logExceptionAsError(ModelHelper.changeAclRequestFailed((DataLakeStorageException) e, @@ -1605,7 +1598,6 @@ Mono> getAccessControlWithResponse(boolean userPrinc context = context == null ? Context.NONE : context; return this.dataLakeStorage.getPaths().getPropertiesWithResponseAsync(null, null, PathGetPropertiesAction.GET_ACCESS_CONTROL, userPrincipalNameReturned, lac, mac, context) - .onErrorMap(ModelHelper::mapToDataLakeStorageException) .map(response -> new SimpleResponse<>(response, new PathAccessControl( PathAccessControlEntry.parseList(response.getDeserializedHeaders().getXMsAcl()), PathPermissions.parseSymbolic(response.getDeserializedHeaders().getXMsPermissions()), @@ -1671,9 +1663,7 @@ Mono> renameWithResponse(String destinationFil null /* properties */, null /* permissions */, null /* umask */, null /* owner */, null /* group */, null /* acl */, null /* proposedLeaseId */, null /* leaseDuration */, null /* expiryOptions */, null /* expiresOn */, null /* encryptionContext */, - null /* pathHttpHeaders */, destLac, destMac, sourceConditions, null /* cpkInfo */, - context) - .onErrorMap(ModelHelper::mapToDataLakeStorageException) + null /* pathHttpHeaders */, destLac, destMac, sourceConditions, null /* cpkInfo */, context) .map(response -> new SimpleResponse<>(response, dataLakePathAsyncClient)); } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathClient.java index e6a8f35e1159..6f8bf4e8e6c9 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakePathClient.java @@ -72,7 +72,6 @@ import java.util.function.Consumer; import static com.azure.storage.common.implementation.StorageImplUtils.sendRequest; -import static com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils.wrapServiceCallWithExceptionMapping; /** * This class provides a client that contains all operations that apply to any path object. @@ -435,13 +434,13 @@ public Response createWithResponse(DataLakePathCreateOptions options, Context finalContext = context == null ? Context.NONE : context; - Callable> operation = wrapServiceCallWithExceptionMapping(() -> - this.dataLakeStorage.getPaths().createWithResponse(null, null, pathResourceType, null, null, null, - finalOptions.getSourceLeaseId(), ModelHelper.buildMetadataString(finalOptions.getMetadata()), - finalOptions.getPermissions(), finalOptions.getUmask(), finalOptions.getOwner(), - finalOptions.getGroup(), acl, finalOptions.getProposedLeaseId(), leaseDuration, expiryOptions, - finalExpiresOnString, finalOptions.getEncryptionContext(), finalOptions.getPathHttpHeaders(), lac, mac, - null, customerProvidedKey, finalContext)); + Callable> operation = () -> this.dataLakeStorage.getPaths() + .createWithResponse(null, null, pathResourceType, null, null, null, finalOptions.getSourceLeaseId(), + ModelHelper.buildMetadataString(finalOptions.getMetadata()), finalOptions.getPermissions(), + finalOptions.getUmask(), finalOptions.getOwner(), finalOptions.getGroup(), acl, + finalOptions.getProposedLeaseId(), leaseDuration, expiryOptions, finalExpiresOnString, + finalOptions.getEncryptionContext(), finalOptions.getPathHttpHeaders(), lac, mac, null, + customerProvidedKey, finalContext); ResponseBase response = sendRequest(operation, timeout, DataLakeStorageException.class); @@ -638,7 +637,7 @@ Response deleteWithResponse(Boolean recursive, DataLakeRequestConditions r Context finalContext = context == null ? Context.NONE : context; - Callable> operation = wrapServiceCallWithExceptionMapping(() -> { + Callable> operation = () -> { String continuation = null; ResponseBase lastResponse; do { @@ -648,7 +647,7 @@ Response deleteWithResponse(Boolean recursive, DataLakeRequestConditions r } while (continuation != null && !continuation.isEmpty()); return lastResponse; - }); + }; ResponseBase response = sendRequest(operation, timeout, DataLakeStorageException.class); return new SimpleResponse<>(response, null); @@ -865,10 +864,9 @@ Response setAccessControlWithResponse(List acc Context finalContext = context == null ? Context.NONE : context; - Callable> operation - = wrapServiceCallWithExceptionMapping(() -> this.dataLakeStorage.getPaths() + Callable> operation = () -> this.dataLakeStorage.getPaths() .setAccessControlWithResponse(null, owner, group, permissionsString, accessControlListString, null, lac, - mac, finalContext)); + mac, finalContext); ResponseBase response = sendRequest(operation, timeout, DataLakeStorageException.class); @@ -1370,9 +1368,9 @@ public Response getAccessControlWithResponse(boolean userPrin .setIfUnmodifiedSince(requestConditions.getIfUnmodifiedSince()); Context finalContext = context == null ? Context.NONE : context; - Callable> operation = - wrapServiceCallWithExceptionMapping(() -> this.dataLakeStorage.getPaths().getPropertiesWithResponse(null, - null, PathGetPropertiesAction.GET_ACCESS_CONTROL, userPrincipalNameReturned, lac, mac, finalContext)); + Callable> operation = () -> this.dataLakeStorage.getPaths() + .getPropertiesWithResponse(null, null, PathGetPropertiesAction.GET_ACCESS_CONTROL, + userPrincipalNameReturned, lac, mac, finalContext); ResponseBase response = sendRequest(operation, timeout, DataLakeStorageException.class); @@ -1419,14 +1417,13 @@ Response renameWithResponseWithTimeout(String destinationFil } String finalRenameSource = signature != null ? renameSource + "?" + signature : renameSource; - Callable> operation = wrapServiceCallWithExceptionMapping(() -> - dataLakePathClient.dataLakeStorage.getPaths().createWithResponse(null /* request id */, null /* timeout */, - null /* pathResourceType */, null /* continuation */, PathRenameMode.LEGACY, finalRenameSource, + Callable> operation = () -> dataLakePathClient.dataLakeStorage.getPaths() + .createWithResponse(null /* request id */, null /* timeout */, null /* pathResourceType */, + null /* continuation */, PathRenameMode.LEGACY, finalRenameSource, finalSourceRequestConditions.getLeaseId(), null /* properties */, null /* permissions */, null /* umask */, null /* owner */, null /* group */, null /* acl */, null /* proposedLeaseId */, - null /* leaseDuration */, null /* expiryOptions */, null /* expiresOn */, - null /* encryptionContext */, null /* pathHttpHeaders */, destLac, destMac, sourceConditions, - null /* cpkInfo */, finalContext)); + null /* leaseDuration */, null /* expiryOptions */, null /* expiresOn */, null /* encryptionContext */, + null /* pathHttpHeaders */, destLac, destMac, sourceConditions, null /* cpkInfo */, finalContext); ResponseBase response = sendRequest(operation, timeout, DataLakeStorageException.class); diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/FileSystemsImpl.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/FileSystemsImpl.java index 60671f979fad..156ce359dfd7 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/FileSystemsImpl.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/FileSystemsImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.file.datalake.implementation; import com.azure.core.annotation.Delete; @@ -42,11 +41,13 @@ import java.util.Objects; import java.util.stream.Collectors; import reactor.core.publisher.Mono; +import com.azure.storage.file.datalake.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in FileSystems. */ public final class FileSystemsImpl { + /** * The proxy service used to perform REST calls. */ @@ -59,7 +60,7 @@ public final class FileSystemsImpl { /** * Initializes an instance of FileSystemsImpl. - * + * * @param client the instance of the service client containing this operation class. */ FileSystemsImpl(AzureDataLakeStorageRestAPIImpl client) { @@ -75,6 +76,7 @@ public final class FileSystemsImpl { @Host("{url}") @ServiceInterface(name = "AzureDataLakeStorage") public interface FileSystemsService { + @Put("/{filesystem}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(DataLakeStorageExceptionInternal.class) @@ -328,10 +330,10 @@ Response listBlobHierarchySegmentNoCustomHead /** * Create FileSystem - * + * * Create a FileSystem rooted at the specified location. If the FileSystem already exists, the operation fails. This * operation does not support conditional HTTP requests. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -352,16 +354,18 @@ Response listBlobHierarchySegmentNoCustomHead public Mono> createWithResponseAsync(String requestId, Integer timeout, String properties) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.create(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), properties, accept, context)); + return FluxUtil + .withContext(context -> service.create(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), properties, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Create FileSystem - * + * * Create a FileSystem rooted at the specified location. If the FileSystem already exists, the operation fails. This * operation does not support conditional HTTP requests. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -383,16 +387,18 @@ public Mono> createWithResponseAsyn public Mono> createWithResponseAsync(String requestId, Integer timeout, String properties, Context context) { final String accept = "application/json"; - return service.create(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), requestId, - timeout, this.client.getVersion(), properties, accept, context); + return service + .create(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), requestId, timeout, + this.client.getVersion(), properties, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Create FileSystem - * + * * Create a FileSystem rooted at the specified location. If the FileSystem already exists, the operation fails. This * operation does not support conditional HTTP requests. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -411,15 +417,17 @@ public Mono> createWithResponseAsyn */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createAsync(String requestId, Integer timeout, String properties) { - return createWithResponseAsync(requestId, timeout, properties).flatMap(ignored -> Mono.empty()); + return createWithResponseAsync(requestId, timeout, properties) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Create FileSystem - * + * * Create a FileSystem rooted at the specified location. If the FileSystem already exists, the operation fails. This * operation does not support conditional HTTP requests. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -439,15 +447,17 @@ public Mono createAsync(String requestId, Integer timeout, String properti */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createAsync(String requestId, Integer timeout, String properties, Context context) { - return createWithResponseAsync(requestId, timeout, properties, context).flatMap(ignored -> Mono.empty()); + return createWithResponseAsync(requestId, timeout, properties, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Create FileSystem - * + * * Create a FileSystem rooted at the specified location. If the FileSystem already exists, the operation fails. This * operation does not support conditional HTTP requests. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -470,15 +480,16 @@ public Mono> createNoCustomHeadersWithResponseAsync(String reques final String accept = "application/json"; return FluxUtil .withContext(context -> service.createNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), properties, accept, context)); + this.client.getResource(), requestId, timeout, this.client.getVersion(), properties, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Create FileSystem - * + * * Create a FileSystem rooted at the specified location. If the FileSystem already exists, the operation fails. This * operation does not support conditional HTTP requests. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -500,16 +511,18 @@ public Mono> createNoCustomHeadersWithResponseAsync(String reques public Mono> createNoCustomHeadersWithResponseAsync(String requestId, Integer timeout, String properties, Context context) { final String accept = "application/json"; - return service.createNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), properties, accept, context); + return service + .createNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), + requestId, timeout, this.client.getVersion(), properties, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Create FileSystem - * + * * Create a FileSystem rooted at the specified location. If the FileSystem already exists, the operation fails. This * operation does not support conditional HTTP requests. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -531,16 +544,20 @@ public Mono> createNoCustomHeadersWithResponseAsync(String reques public ResponseBase createWithResponse(String requestId, Integer timeout, String properties, Context context) { final String accept = "application/json"; - return service.createSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), - requestId, timeout, this.client.getVersion(), properties, accept, context); + try { + return service.createSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), + requestId, timeout, this.client.getVersion(), properties, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Create FileSystem - * + * * Create a FileSystem rooted at the specified location. If the FileSystem already exists, the operation fails. This * operation does not support conditional HTTP requests. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -563,10 +580,10 @@ public void create(String requestId, Integer timeout, String properties) { /** * Create FileSystem - * + * * Create a FileSystem rooted at the specified location. If the FileSystem already exists, the operation fails. This * operation does not support conditional HTTP requests. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -588,17 +605,21 @@ public void create(String requestId, Integer timeout, String properties) { public Response createNoCustomHeadersWithResponse(String requestId, Integer timeout, String properties, Context context) { final String accept = "application/json"; - return service.createNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), properties, accept, context); + try { + return service.createNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), properties, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Set FileSystem Properties - * + * * Set properties for the FileSystem. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -634,18 +655,20 @@ public Mono> setPropertiesWi = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.setProperties(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), properties, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context)); + return FluxUtil + .withContext(context -> service.setProperties(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), properties, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set FileSystem Properties - * + * * Set properties for the FileSystem. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -682,18 +705,20 @@ public Mono> setPropertiesWi = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setProperties(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), - requestId, timeout, this.client.getVersion(), properties, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, accept, context); + return service + .setProperties(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), requestId, + timeout, this.client.getVersion(), properties, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set FileSystem Properties - * + * * Set properties for the FileSystem. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -715,16 +740,17 @@ public Mono> setPropertiesWi public Mono setPropertiesAsync(String requestId, Integer timeout, String properties, ModifiedAccessConditions modifiedAccessConditions) { return setPropertiesWithResponseAsync(requestId, timeout, properties, modifiedAccessConditions) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .flatMap(ignored -> Mono.empty()); } /** * Set FileSystem Properties - * + * * Set properties for the FileSystem. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -747,16 +773,17 @@ public Mono setPropertiesAsync(String requestId, Integer timeout, String p public Mono setPropertiesAsync(String requestId, Integer timeout, String properties, ModifiedAccessConditions modifiedAccessConditions, Context context) { return setPropertiesWithResponseAsync(requestId, timeout, properties, modifiedAccessConditions, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .flatMap(ignored -> Mono.empty()); } /** * Set FileSystem Properties - * + * * Set properties for the FileSystem. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -792,18 +819,20 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync(String = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.setPropertiesNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getResource(), requestId, timeout, this.client.getVersion(), - properties, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context)); + return FluxUtil + .withContext(context -> service.setPropertiesNoCustomHeaders(this.client.getUrl(), + this.client.getFileSystem(), this.client.getResource(), requestId, timeout, this.client.getVersion(), + properties, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set FileSystem Properties - * + * * Set properties for the FileSystem. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -840,18 +869,20 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync(String = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setPropertiesNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), properties, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context); + return service + .setPropertiesNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), + requestId, timeout, this.client.getVersion(), properties, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set FileSystem Properties - * + * * Set properties for the FileSystem. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -888,18 +919,22 @@ public ResponseBase setPropertiesWithResp = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setPropertiesSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), - requestId, timeout, this.client.getVersion(), properties, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, accept, context); + try { + return service.setPropertiesSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), properties, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Set FileSystem Properties - * + * * Set properties for the FileSystem. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -924,11 +959,11 @@ public void setProperties(String requestId, Integer timeout, String properties, /** * Set FileSystem Properties - * + * * Set properties for the FileSystem. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -965,16 +1000,20 @@ public Response setPropertiesNoCustomHeadersWithResponse(String requestId, = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setPropertiesNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), properties, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context); + try { + return service.setPropertiesNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), properties, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Get FileSystem Properties. - * + * * All system and user-defined filesystem properties are specified in the response headers. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -989,15 +1028,17 @@ public Response setPropertiesNoCustomHeadersWithResponse(String requestId, public Mono> getPropertiesWithResponseAsync(String requestId, Integer timeout) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getProperties(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), accept, context)); + return FluxUtil + .withContext(context -> service.getProperties(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Get FileSystem Properties. - * + * * All system and user-defined filesystem properties are specified in the response headers. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1013,15 +1054,17 @@ public Mono> getPropertiesWi public Mono> getPropertiesWithResponseAsync(String requestId, Integer timeout, Context context) { final String accept = "application/json"; - return service.getProperties(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), - requestId, timeout, this.client.getVersion(), accept, context); + return service + .getProperties(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), requestId, + timeout, this.client.getVersion(), accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Get FileSystem Properties. - * + * * All system and user-defined filesystem properties are specified in the response headers. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1034,14 +1077,16 @@ public Mono> getPropertiesWi */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesAsync(String requestId, Integer timeout) { - return getPropertiesWithResponseAsync(requestId, timeout).flatMap(ignored -> Mono.empty()); + return getPropertiesWithResponseAsync(requestId, timeout) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Get FileSystem Properties. - * + * * All system and user-defined filesystem properties are specified in the response headers. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1055,14 +1100,16 @@ public Mono getPropertiesAsync(String requestId, Integer timeout) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesAsync(String requestId, Integer timeout, Context context) { - return getPropertiesWithResponseAsync(requestId, timeout, context).flatMap(ignored -> Mono.empty()); + return getPropertiesWithResponseAsync(requestId, timeout, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Get FileSystem Properties. - * + * * All system and user-defined filesystem properties are specified in the response headers. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1076,16 +1123,18 @@ public Mono getPropertiesAsync(String requestId, Integer timeout, Context @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String requestId, Integer timeout) { final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), accept, context)); + return FluxUtil + .withContext( + context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Get FileSystem Properties. - * + * * All system and user-defined filesystem properties are specified in the response headers. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1101,15 +1150,17 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String requestId, Integer timeout, Context context) { final String accept = "application/json"; - return service.getPropertiesNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), accept, context); + return service + .getPropertiesNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), + requestId, timeout, this.client.getVersion(), accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Get FileSystem Properties. - * + * * All system and user-defined filesystem properties are specified in the response headers. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1125,15 +1176,19 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String public ResponseBase getPropertiesWithResponse(String requestId, Integer timeout, Context context) { final String accept = "application/json"; - return service.getPropertiesSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), - requestId, timeout, this.client.getVersion(), accept, context); + try { + return service.getPropertiesSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Get FileSystem Properties. - * + * * All system and user-defined filesystem properties are specified in the response headers. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1150,9 +1205,9 @@ public void getProperties(String requestId, Integer timeout) { /** * Get FileSystem Properties. - * + * * All system and user-defined filesystem properties are specified in the response headers. - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1167,13 +1222,17 @@ public void getProperties(String requestId, Integer timeout) { @ServiceMethod(returns = ReturnType.SINGLE) public Response getPropertiesNoCustomHeadersWithResponse(String requestId, Integer timeout, Context context) { final String accept = "application/json"; - return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), accept, context); + try { + return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Delete FileSystem - * + * * Marks the FileSystem for deletion. When a FileSystem is deleted, a FileSystem with the same identifier cannot be * created for at least 30 seconds. While the filesystem is being deleted, attempts to create a filesystem with the * same identifier will fail with status code 409 (Conflict), with the service returning additional error @@ -1182,7 +1241,7 @@ public Response getPropertiesNoCustomHeadersWithResponse(String requestId, * being deleted. This operation supports conditional HTTP requests. For more information, see [Specifying * Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1212,14 +1271,16 @@ public Mono> deleteWithResponseAsyn = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.delete(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, accept, context)); + return FluxUtil + .withContext(context -> service.delete(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Delete FileSystem - * + * * Marks the FileSystem for deletion. When a FileSystem is deleted, a FileSystem with the same identifier cannot be * created for at least 30 seconds. While the filesystem is being deleted, attempts to create a filesystem with the * same identifier will fail with status code 409 (Conflict), with the service returning additional error @@ -1228,7 +1289,7 @@ public Mono> deleteWithResponseAsyn * being deleted. This operation supports conditional HTTP requests. For more information, see [Specifying * Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1259,13 +1320,15 @@ public Mono> deleteWithResponseAsyn = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.delete(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), requestId, - timeout, this.client.getVersion(), ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context); + return service + .delete(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), requestId, timeout, + this.client.getVersion(), ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Delete FileSystem - * + * * Marks the FileSystem for deletion. When a FileSystem is deleted, a FileSystem with the same identifier cannot be * created for at least 30 seconds. While the filesystem is being deleted, attempts to create a filesystem with the * same identifier will fail with status code 409 (Conflict), with the service returning additional error @@ -1274,7 +1337,7 @@ public Mono> deleteWithResponseAsyn * being deleted. This operation supports conditional HTTP requests. For more information, see [Specifying * Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1289,12 +1352,14 @@ public Mono> deleteWithResponseAsyn @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteAsync(String requestId, Integer timeout, ModifiedAccessConditions modifiedAccessConditions) { - return deleteWithResponseAsync(requestId, timeout, modifiedAccessConditions).flatMap(ignored -> Mono.empty()); + return deleteWithResponseAsync(requestId, timeout, modifiedAccessConditions) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Delete FileSystem - * + * * Marks the FileSystem for deletion. When a FileSystem is deleted, a FileSystem with the same identifier cannot be * created for at least 30 seconds. While the filesystem is being deleted, attempts to create a filesystem with the * same identifier will fail with status code 409 (Conflict), with the service returning additional error @@ -1303,7 +1368,7 @@ public Mono deleteAsync(String requestId, Integer timeout, * being deleted. This operation supports conditional HTTP requests. For more information, see [Specifying * Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1320,12 +1385,13 @@ public Mono deleteAsync(String requestId, Integer timeout, public Mono deleteAsync(String requestId, Integer timeout, ModifiedAccessConditions modifiedAccessConditions, Context context) { return deleteWithResponseAsync(requestId, timeout, modifiedAccessConditions, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .flatMap(ignored -> Mono.empty()); } /** * Delete FileSystem - * + * * Marks the FileSystem for deletion. When a FileSystem is deleted, a FileSystem with the same identifier cannot be * created for at least 30 seconds. While the filesystem is being deleted, attempts to create a filesystem with the * same identifier will fail with status code 409 (Conflict), with the service returning additional error @@ -1334,7 +1400,7 @@ public Mono deleteAsync(String requestId, Integer timeout, ModifiedAccessC * being deleted. This operation supports conditional HTTP requests. For more information, see [Specifying * Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1364,14 +1430,16 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String reques = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getResource(), requestId, timeout, this.client.getVersion(), - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context)); + return FluxUtil + .withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Delete FileSystem - * + * * Marks the FileSystem for deletion. When a FileSystem is deleted, a FileSystem with the same identifier cannot be * created for at least 30 seconds. While the filesystem is being deleted, attempts to create a filesystem with the * same identifier will fail with status code 409 (Conflict), with the service returning additional error @@ -1380,7 +1448,7 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String reques * being deleted. This operation supports conditional HTTP requests. For more information, see [Specifying * Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1411,14 +1479,16 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String reques = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.deleteNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, accept, context); + return service + .deleteNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), + requestId, timeout, this.client.getVersion(), ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Delete FileSystem - * + * * Marks the FileSystem for deletion. When a FileSystem is deleted, a FileSystem with the same identifier cannot be * created for at least 30 seconds. While the filesystem is being deleted, attempts to create a filesystem with the * same identifier will fail with status code 409 (Conflict), with the service returning additional error @@ -1427,7 +1497,7 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String reques * being deleted. This operation supports conditional HTTP requests. For more information, see [Specifying * Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1458,14 +1528,18 @@ public ResponseBase deleteWithResponse(String re = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.deleteSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), - requestId, timeout, this.client.getVersion(), ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, - context); + try { + return service.deleteSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), + requestId, timeout, this.client.getVersion(), ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Delete FileSystem - * + * * Marks the FileSystem for deletion. When a FileSystem is deleted, a FileSystem with the same identifier cannot be * created for at least 30 seconds. While the filesystem is being deleted, attempts to create a filesystem with the * same identifier will fail with status code 409 (Conflict), with the service returning additional error @@ -1474,7 +1548,7 @@ public ResponseBase deleteWithResponse(String re * being deleted. This operation supports conditional HTTP requests. For more information, see [Specifying * Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1492,7 +1566,7 @@ public void delete(String requestId, Integer timeout, ModifiedAccessConditions m /** * Delete FileSystem - * + * * Marks the FileSystem for deletion. When a FileSystem is deleted, a FileSystem with the same identifier cannot be * created for at least 30 seconds. While the filesystem is being deleted, attempts to create a filesystem with the * same identifier will fail with status code 409 (Conflict), with the service returning additional error @@ -1501,7 +1575,7 @@ public void delete(String requestId, Integer timeout, ModifiedAccessConditions m * being deleted. This operation supports conditional HTTP requests. For more information, see [Specifying * Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1532,16 +1606,20 @@ public Response deleteNoCustomHeadersWithResponse(String requestId, Intege = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.deleteNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, accept, context); + try { + return service.deleteNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * List Paths - * + * * List FileSystem paths and their properties. - * + * * @param recursive Required. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1570,16 +1648,18 @@ public Response deleteNoCustomHeadersWithResponse(String requestId, Intege public Mono> listPathsWithResponseAsync(boolean recursive, String requestId, Integer timeout, String continuation, String path, Integer maxResults, Boolean upn) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listPaths(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), continuation, path, recursive, - maxResults, upn, accept, context)); + return FluxUtil + .withContext(context -> service.listPaths(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), continuation, path, recursive, + maxResults, upn, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * List Paths - * + * * List FileSystem paths and their properties. - * + * * @param recursive Required. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1610,16 +1690,17 @@ public Mono> listPathsWithRe String requestId, Integer timeout, String continuation, String path, Integer maxResults, Boolean upn, Context context) { final String accept = "application/json"; - return service.listPaths(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), - requestId, timeout, this.client.getVersion(), continuation, path, recursive, maxResults, upn, accept, - context); + return service + .listPaths(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), requestId, timeout, + this.client.getVersion(), continuation, path, recursive, maxResults, upn, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * List Paths - * + * * List FileSystem paths and their properties. - * + * * @param recursive Required. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1648,14 +1729,15 @@ public Mono> listPathsWithRe public Mono listPathsAsync(boolean recursive, String requestId, Integer timeout, String continuation, String path, Integer maxResults, Boolean upn) { return listPathsWithResponseAsync(recursive, requestId, timeout, continuation, path, maxResults, upn) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * List Paths - * + * * List FileSystem paths and their properties. - * + * * @param recursive Required. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1685,14 +1767,15 @@ public Mono listPathsAsync(boolean recursive, String requestId, Intege public Mono listPathsAsync(boolean recursive, String requestId, Integer timeout, String continuation, String path, Integer maxResults, Boolean upn, Context context) { return listPathsWithResponseAsync(recursive, requestId, timeout, continuation, path, maxResults, upn, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * List Paths - * + * * List FileSystem paths and their properties. - * + * * @param recursive Required. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1721,16 +1804,18 @@ public Mono listPathsAsync(boolean recursive, String requestId, Intege public Mono> listPathsNoCustomHeadersWithResponseAsync(boolean recursive, String requestId, Integer timeout, String continuation, String path, Integer maxResults, Boolean upn) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listPathsNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getResource(), requestId, timeout, this.client.getVersion(), - continuation, path, recursive, maxResults, upn, accept, context)); + return FluxUtil + .withContext(context -> service.listPathsNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), continuation, path, recursive, + maxResults, upn, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * List Paths - * + * * List FileSystem paths and their properties. - * + * * @param recursive Required. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1760,16 +1845,18 @@ public Mono> listPathsNoCustomHeadersWithResponseAsync(boolea public Mono> listPathsNoCustomHeadersWithResponseAsync(boolean recursive, String requestId, Integer timeout, String continuation, String path, Integer maxResults, Boolean upn, Context context) { final String accept = "application/json"; - return service.listPathsNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), continuation, path, recursive, - maxResults, upn, accept, context); + return service + .listPathsNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), + requestId, timeout, this.client.getVersion(), continuation, path, recursive, maxResults, upn, accept, + context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * List Paths - * + * * List FileSystem paths and their properties. - * + * * @param recursive Required. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1800,16 +1887,20 @@ public ResponseBase listPathsWithResponse String requestId, Integer timeout, String continuation, String path, Integer maxResults, Boolean upn, Context context) { final String accept = "application/json"; - return service.listPathsSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), - requestId, timeout, this.client.getVersion(), continuation, path, recursive, maxResults, upn, accept, - context); + try { + return service.listPathsSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getResource(), + requestId, timeout, this.client.getVersion(), continuation, path, recursive, maxResults, upn, accept, + context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * List Paths - * + * * List FileSystem paths and their properties. - * + * * @param recursive Required. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1837,15 +1928,19 @@ public ResponseBase listPathsWithResponse @ServiceMethod(returns = ReturnType.SINGLE) public PathList listPaths(boolean recursive, String requestId, Integer timeout, String continuation, String path, Integer maxResults, Boolean upn) { - return listPathsWithResponse(recursive, requestId, timeout, continuation, path, maxResults, upn, Context.NONE) - .getValue(); + try { + return listPathsWithResponse(recursive, requestId, timeout, continuation, path, maxResults, upn, + Context.NONE).getValue(); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * List Paths - * + * * List FileSystem paths and their properties. - * + * * @param recursive Required. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1875,14 +1970,18 @@ public PathList listPaths(boolean recursive, String requestId, Integer timeout, public Response listPathsNoCustomHeadersWithResponse(boolean recursive, String requestId, Integer timeout, String continuation, String path, Integer maxResults, Boolean upn, Context context) { final String accept = "application/json"; - return service.listPathsNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getResource(), requestId, timeout, this.client.getVersion(), continuation, path, recursive, - maxResults, upn, accept, context); + try { + return service.listPathsNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getResource(), requestId, timeout, this.client.getVersion(), continuation, path, recursive, + maxResults, upn, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -1918,14 +2017,16 @@ public Response listPathsNoCustomHeadersWithResponse(boolean recursive : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return FluxUtil.withContext(context -> service.listBlobHierarchySegment(this.client.getUrl(), - this.client.getFileSystem(), restype, comp, prefix, delimiter, marker, maxResults, includeConverted, - showonly, timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.listBlobHierarchySegment(this.client.getUrl(), this.client.getFileSystem(), + restype, comp, prefix, delimiter, marker, maxResults, includeConverted, showonly, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -1963,14 +2064,16 @@ public Response listPathsNoCustomHeadersWithResponse(boolean recursive : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.listBlobHierarchySegment(this.client.getUrl(), this.client.getFileSystem(), restype, comp, - prefix, delimiter, marker, maxResults, includeConverted, showonly, timeout, this.client.getVersion(), - requestId, accept, context); + return service + .listBlobHierarchySegment(this.client.getUrl(), this.client.getFileSystem(), restype, comp, prefix, + delimiter, marker, maxResults, includeConverted, showonly, timeout, this.client.getVersion(), requestId, + accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -1999,12 +2102,14 @@ public Mono listBlobHierarchySegmentAsync(Str String marker, Integer maxResults, List include, ListBlobsShowOnly showonly, Integer timeout, String requestId) { return listBlobHierarchySegmentWithResponseAsync(prefix, delimiter, marker, maxResults, include, showonly, - timeout, requestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + timeout, requestId) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -2034,12 +2139,14 @@ public Mono listBlobHierarchySegmentAsync(Str String marker, Integer maxResults, List include, ListBlobsShowOnly showonly, Integer timeout, String requestId, Context context) { return listBlobHierarchySegmentWithResponseAsync(prefix, delimiter, marker, maxResults, include, showonly, - timeout, requestId, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + timeout, requestId, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -2075,14 +2182,16 @@ public Mono> listBlobHierarchySegmen : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return FluxUtil.withContext(context -> service.listBlobHierarchySegmentNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), restype, comp, prefix, delimiter, marker, maxResults, includeConverted, - showonly, timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.listBlobHierarchySegmentNoCustomHeaders(this.client.getUrl(), + this.client.getFileSystem(), restype, comp, prefix, delimiter, marker, maxResults, includeConverted, + showonly, timeout, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -2119,14 +2228,16 @@ public Mono> listBlobHierarchySegmen : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.listBlobHierarchySegmentNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), - restype, comp, prefix, delimiter, marker, maxResults, includeConverted, showonly, timeout, - this.client.getVersion(), requestId, accept, context); + return service + .listBlobHierarchySegmentNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), restype, comp, + prefix, delimiter, marker, maxResults, includeConverted, showonly, timeout, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -2164,14 +2275,18 @@ public Mono> listBlobHierarchySegmen : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.listBlobHierarchySegmentSync(this.client.getUrl(), this.client.getFileSystem(), restype, comp, - prefix, delimiter, marker, maxResults, includeConverted, showonly, timeout, this.client.getVersion(), - requestId, accept, context); + try { + return service.listBlobHierarchySegmentSync(this.client.getUrl(), this.client.getFileSystem(), restype, + comp, prefix, delimiter, marker, maxResults, includeConverted, showonly, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -2199,13 +2314,17 @@ public Mono> listBlobHierarchySegmen public ListBlobsHierarchySegmentResponse listBlobHierarchySegment(String prefix, String delimiter, String marker, Integer maxResults, List include, ListBlobsShowOnly showonly, Integer timeout, String requestId) { - return listBlobHierarchySegmentWithResponse(prefix, delimiter, marker, maxResults, include, showonly, timeout, - requestId, Context.NONE).getValue(); + try { + return listBlobHierarchySegmentWithResponse(prefix, delimiter, marker, maxResults, include, showonly, + timeout, requestId, Context.NONE).getValue(); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * The List Blobs operation returns a list of the blobs under the specified container. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the * response body that acts as a placeholder for all blobs whose names begin with the same substring up to the @@ -2242,8 +2361,12 @@ public Response listBlobHierarchySegmentNoCus : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.listBlobHierarchySegmentNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - restype, comp, prefix, delimiter, marker, maxResults, includeConverted, showonly, timeout, - this.client.getVersion(), requestId, accept, context); + try { + return service.listBlobHierarchySegmentNoCustomHeadersSync(this.client.getUrl(), + this.client.getFileSystem(), restype, comp, prefix, delimiter, marker, maxResults, includeConverted, + showonly, timeout, this.client.getVersion(), requestId, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/PathsImpl.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/PathsImpl.java index a93b48b5fcdd..364b39ddcf40 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/PathsImpl.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/PathsImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.file.datalake.implementation; import com.azure.core.annotation.BodyParam; @@ -63,11 +62,13 @@ import java.time.OffsetDateTime; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import com.azure.storage.file.datalake.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in Paths. */ public final class PathsImpl { + /** * The proxy service used to perform REST calls. */ @@ -80,7 +81,7 @@ public final class PathsImpl { /** * Initializes an instance of PathsImpl. - * + * * @param client the instance of the service client containing this operation class. */ PathsImpl(AzureDataLakeStorageRestAPIImpl client) { @@ -95,6 +96,7 @@ public final class PathsImpl { @Host("{url}") @ServiceInterface(name = "AzureDataLakeStorage") public interface PathsService { + @Put("/{filesystem}/{path}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(DataLakeStorageExceptionInternal.class) @@ -1030,13 +1032,13 @@ Response undeleteNoCustomHeadersSync(@HostParam("url") String url, /** * Create File | Create Directory | Rename File | Rename Directory - * + * * Create or rename a file or directory. By default, the destination is overwritten and if the destination already * exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more * information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). * To fail if the destination already exists, use a conditional request with If-None-Match: "*". - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1196,24 +1198,26 @@ public Mono> createWithResponseAsync(Stri = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return FluxUtil.withContext(context -> service.create(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), requestId, timeout, this.client.getVersion(), resource, continuation, mode, - cacheControl, contentEncoding, contentLanguage, contentDisposition, contentType, renameSource, leaseId, - sourceLeaseId, properties, permissions, umask, ifMatch, ifNoneMatch, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfModifiedSinceConverted, - sourceIfUnmodifiedSinceConverted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, owner, group, - acl, proposedLeaseId, leaseDuration, expiryOptions, expiresOn, encryptionContext, accept, context)); + return FluxUtil + .withContext(context -> service.create(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), resource, continuation, mode, + cacheControl, contentEncoding, contentLanguage, contentDisposition, contentType, renameSource, leaseId, + sourceLeaseId, properties, permissions, umask, ifMatch, ifNoneMatch, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfModifiedSinceConverted, + sourceIfUnmodifiedSinceConverted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, owner, group, + acl, proposedLeaseId, leaseDuration, expiryOptions, expiresOn, encryptionContext, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Create File | Create Directory | Rename File | Rename Directory - * + * * Create or rename a file or directory. By default, the destination is overwritten and if the destination already * exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more * information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). * To fail if the destination already exists, use a conditional request with If-None-Match: "*". - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1374,24 +1378,26 @@ public Mono> createWithResponseAsync(Stri = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.create(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, - timeout, this.client.getVersion(), resource, continuation, mode, cacheControl, contentEncoding, - contentLanguage, contentDisposition, contentType, renameSource, leaseId, sourceLeaseId, properties, - permissions, umask, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - sourceIfMatch, sourceIfNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, owner, group, acl, proposedLeaseId, leaseDuration, - expiryOptions, expiresOn, encryptionContext, accept, context); + return service + .create(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, timeout, + this.client.getVersion(), resource, continuation, mode, cacheControl, contentEncoding, contentLanguage, + contentDisposition, contentType, renameSource, leaseId, sourceLeaseId, properties, permissions, umask, + ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, sourceIfMatch, + sourceIfNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, owner, group, acl, proposedLeaseId, leaseDuration, + expiryOptions, expiresOn, encryptionContext, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Create File | Create Directory | Rename File | Rename Directory - * + * * Create or rename a file or directory. By default, the destination is overwritten and if the destination already * exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more * information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). * To fail if the destination already exists, use a conditional request with If-None-Match: "*". - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1459,18 +1465,20 @@ public Mono createAsync(String requestId, Integer timeout, PathResourceTyp return createWithResponseAsync(requestId, timeout, resource, continuation, mode, renameSource, sourceLeaseId, properties, permissions, umask, owner, group, acl, proposedLeaseId, leaseDuration, expiryOptions, expiresOn, encryptionContext, pathHttpHeaders, leaseAccessConditions, modifiedAccessConditions, - sourceModifiedAccessConditions, cpkInfo).flatMap(ignored -> Mono.empty()); + sourceModifiedAccessConditions, cpkInfo) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Create File | Create Directory | Rename File | Rename Directory - * + * * Create or rename a file or directory. By default, the destination is overwritten and if the destination already * exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more * information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). * To fail if the destination already exists, use a conditional request with If-None-Match: "*". - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1539,18 +1547,20 @@ public Mono createAsync(String requestId, Integer timeout, PathResourceTyp return createWithResponseAsync(requestId, timeout, resource, continuation, mode, renameSource, sourceLeaseId, properties, permissions, umask, owner, group, acl, proposedLeaseId, leaseDuration, expiryOptions, expiresOn, encryptionContext, pathHttpHeaders, leaseAccessConditions, modifiedAccessConditions, - sourceModifiedAccessConditions, cpkInfo, context).flatMap(ignored -> Mono.empty()); + sourceModifiedAccessConditions, cpkInfo, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Create File | Create Directory | Rename File | Rename Directory - * + * * Create or rename a file or directory. By default, the destination is overwritten and if the destination already * exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more * information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). * To fail if the destination already exists, use a conditional request with If-None-Match: "*". - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1717,18 +1727,19 @@ public Mono> createNoCustomHeadersWithResponseAsync(String reques sourceLeaseId, properties, permissions, umask, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, owner, group, - acl, proposedLeaseId, leaseDuration, expiryOptions, expiresOn, encryptionContext, accept, context)); + acl, proposedLeaseId, leaseDuration, expiryOptions, expiresOn, encryptionContext, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Create File | Create Directory | Rename File | Rename Directory - * + * * Create or rename a file or directory. By default, the destination is overwritten and if the destination already * exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more * information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). * To fail if the destination already exists, use a conditional request with If-None-Match: "*". - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1889,24 +1900,26 @@ public Mono> createNoCustomHeadersWithResponseAsync(String reques = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.createNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), - requestId, timeout, this.client.getVersion(), resource, continuation, mode, cacheControl, contentEncoding, - contentLanguage, contentDisposition, contentType, renameSource, leaseId, sourceLeaseId, properties, - permissions, umask, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - sourceIfMatch, sourceIfNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, owner, group, acl, proposedLeaseId, leaseDuration, - expiryOptions, expiresOn, encryptionContext, accept, context); + return service + .createNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, + timeout, this.client.getVersion(), resource, continuation, mode, cacheControl, contentEncoding, + contentLanguage, contentDisposition, contentType, renameSource, leaseId, sourceLeaseId, properties, + permissions, umask, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + sourceIfMatch, sourceIfNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, owner, group, acl, proposedLeaseId, + leaseDuration, expiryOptions, expiresOn, encryptionContext, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Create File | Create Directory | Rename File | Rename Directory - * + * * Create or rename a file or directory. By default, the destination is overwritten and if the destination already * exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more * information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). * To fail if the destination already exists, use a conditional request with If-None-Match: "*". - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2067,24 +2080,28 @@ public ResponseBase createWithResponse(String requestI = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.createSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, - timeout, this.client.getVersion(), resource, continuation, mode, cacheControl, contentEncoding, - contentLanguage, contentDisposition, contentType, renameSource, leaseId, sourceLeaseId, properties, - permissions, umask, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - sourceIfMatch, sourceIfNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, owner, group, acl, proposedLeaseId, leaseDuration, - expiryOptions, expiresOn, encryptionContext, accept, context); + try { + return service.createSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), + requestId, timeout, this.client.getVersion(), resource, continuation, mode, cacheControl, + contentEncoding, contentLanguage, contentDisposition, contentType, renameSource, leaseId, sourceLeaseId, + properties, permissions, umask, ifMatch, ifNoneMatch, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfModifiedSinceConverted, + sourceIfUnmodifiedSinceConverted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, owner, group, + acl, proposedLeaseId, leaseDuration, expiryOptions, expiresOn, encryptionContext, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Create File | Create Directory | Rename File | Rename Directory - * + * * Create or rename a file or directory. By default, the destination is overwritten and if the destination already * exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more * information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). * To fail if the destination already exists, use a conditional request with If-None-Match: "*". - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2156,13 +2173,13 @@ public void create(String requestId, Integer timeout, PathResourceType resource, /** * Create File | Create Directory | Rename File | Rename Directory - * + * * Create or rename a file or directory. By default, the destination is overwritten and if the destination already * exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more * information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). * To fail if the destination already exists, use a conditional request with If-None-Match: "*". - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2323,24 +2340,28 @@ public Response createNoCustomHeadersWithResponse(String requestId, Intege = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.createNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), requestId, timeout, this.client.getVersion(), resource, continuation, mode, - cacheControl, contentEncoding, contentLanguage, contentDisposition, contentType, renameSource, leaseId, - sourceLeaseId, properties, permissions, umask, ifMatch, ifNoneMatch, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfModifiedSinceConverted, - sourceIfUnmodifiedSinceConverted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, owner, group, - acl, proposedLeaseId, leaseDuration, expiryOptions, expiresOn, encryptionContext, accept, context); + try { + return service.createNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), resource, continuation, mode, + cacheControl, contentEncoding, contentLanguage, contentDisposition, contentType, renameSource, leaseId, + sourceLeaseId, properties, permissions, umask, ifMatch, ifNoneMatch, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, sourceIfModifiedSinceConverted, + sourceIfUnmodifiedSinceConverted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, owner, group, + acl, proposedLeaseId, leaseDuration, expiryOptions, expiresOn, encryptionContext, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -2478,23 +2499,25 @@ public Mono> = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.update(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), requestId, timeout, this.client.getVersion(), action, maxRecords, continuation, mode, - forceFlag, position, retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, - cacheControl, contentType, contentDisposition, contentEncoding, contentLanguage, properties, owner, group, - permissions, acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, body, accept, - context)); + return FluxUtil + .withContext(context -> service.update(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), action, maxRecords, continuation, + mode, forceFlag, position, retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, + cacheControl, contentType, contentDisposition, contentEncoding, contentLanguage, properties, owner, + group, permissions, acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + body, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -2633,22 +2656,24 @@ public Mono> = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.update(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, - timeout, this.client.getVersion(), action, maxRecords, continuation, mode, forceFlag, position, - retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, cacheControl, contentType, - contentDisposition, contentEncoding, contentLanguage, properties, owner, group, permissions, acl, ifMatch, - ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, body, accept, context); + return service + .update(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, timeout, + this.client.getVersion(), action, maxRecords, continuation, mode, forceFlag, position, + retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, cacheControl, contentType, + contentDisposition, contentEncoding, contentLanguage, properties, owner, group, permissions, acl, + ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, body, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -2728,18 +2753,19 @@ public Mono updateAsync(PathUpdateAction acti return updateWithResponseAsync(action, mode, body, requestId, timeout, maxRecords, continuation, forceFlag, position, retainUncommittedData, close, contentLength, properties, owner, group, permissions, acl, pathHttpHeaders, leaseAccessConditions, modifiedAccessConditions) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -2820,18 +2846,19 @@ public Mono updateAsync(PathUpdateAction acti return updateWithResponseAsync(action, mode, body, requestId, timeout, maxRecords, continuation, forceFlag, position, retainUncommittedData, close, contentLength, properties, owner, group, permissions, acl, pathHttpHeaders, leaseAccessConditions, modifiedAccessConditions, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -2969,23 +2996,25 @@ public Mono> updateNoCustomHeadersWi = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.updateNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), requestId, timeout, this.client.getVersion(), action, - maxRecords, continuation, mode, forceFlag, position, retainUncommittedData, close, contentLength, - contentMd5Converted, leaseId, cacheControl, contentType, contentDisposition, contentEncoding, - contentLanguage, properties, owner, group, permissions, acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, body, accept, context)); + return FluxUtil + .withContext(context -> service.updateNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), action, maxRecords, continuation, + mode, forceFlag, position, retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, + cacheControl, contentType, contentDisposition, contentEncoding, contentLanguage, properties, owner, + group, permissions, acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + body, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -3124,22 +3153,24 @@ public Mono> updateNoCustomHeadersWi = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.updateNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), - requestId, timeout, this.client.getVersion(), action, maxRecords, continuation, mode, forceFlag, position, - retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, cacheControl, contentType, - contentDisposition, contentEncoding, contentLanguage, properties, owner, group, permissions, acl, ifMatch, - ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, body, accept, context); + return service + .updateNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, + timeout, this.client.getVersion(), action, maxRecords, continuation, mode, forceFlag, position, + retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, cacheControl, contentType, + contentDisposition, contentEncoding, contentLanguage, properties, owner, group, permissions, acl, + ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, body, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -3277,23 +3308,25 @@ public Mono> = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.update(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), requestId, timeout, this.client.getVersion(), action, maxRecords, continuation, mode, - forceFlag, position, retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, - cacheControl, contentType, contentDisposition, contentEncoding, contentLanguage, properties, owner, group, - permissions, acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, body, accept, - context)); + return FluxUtil + .withContext(context -> service.update(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), action, maxRecords, continuation, + mode, forceFlag, position, retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, + cacheControl, contentType, contentDisposition, contentEncoding, contentLanguage, properties, owner, + group, permissions, acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + body, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -3432,22 +3465,24 @@ public Mono> = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.update(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, - timeout, this.client.getVersion(), action, maxRecords, continuation, mode, forceFlag, position, - retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, cacheControl, contentType, - contentDisposition, contentEncoding, contentLanguage, properties, owner, group, permissions, acl, ifMatch, - ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, body, accept, context); + return service + .update(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, timeout, + this.client.getVersion(), action, maxRecords, continuation, mode, forceFlag, position, + retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, cacheControl, contentType, + contentDisposition, contentEncoding, contentLanguage, properties, owner, group, permissions, acl, + ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, body, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -3527,18 +3562,19 @@ public Mono updateAsync(PathUpdateAction acti return updateWithResponseAsync(action, mode, body, requestId, timeout, maxRecords, continuation, forceFlag, position, retainUncommittedData, close, contentLength, properties, owner, group, permissions, acl, pathHttpHeaders, leaseAccessConditions, modifiedAccessConditions) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -3619,18 +3655,19 @@ public Mono updateAsync(PathUpdateAction acti return updateWithResponseAsync(action, mode, body, requestId, timeout, maxRecords, continuation, forceFlag, position, retainUncommittedData, close, contentLength, properties, owner, group, permissions, acl, pathHttpHeaders, leaseAccessConditions, modifiedAccessConditions, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -3768,23 +3805,25 @@ public Mono> updateNoCustomHeadersWi = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.updateNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), requestId, timeout, this.client.getVersion(), action, - maxRecords, continuation, mode, forceFlag, position, retainUncommittedData, close, contentLength, - contentMd5Converted, leaseId, cacheControl, contentType, contentDisposition, contentEncoding, - contentLanguage, properties, owner, group, permissions, acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, body, accept, context)); + return FluxUtil + .withContext(context -> service.updateNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), action, maxRecords, continuation, + mode, forceFlag, position, retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, + cacheControl, contentType, contentDisposition, contentEncoding, contentLanguage, properties, owner, + group, permissions, acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + body, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -3923,22 +3962,24 @@ public Mono> updateNoCustomHeadersWi = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.updateNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), - requestId, timeout, this.client.getVersion(), action, maxRecords, continuation, mode, forceFlag, position, - retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, cacheControl, contentType, - contentDisposition, contentEncoding, contentLanguage, properties, owner, group, permissions, acl, ifMatch, - ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, body, accept, context); + return service + .updateNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, + timeout, this.client.getVersion(), action, maxRecords, continuation, mode, forceFlag, position, + retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, cacheControl, contentType, + contentDisposition, contentEncoding, contentLanguage, properties, owner, group, permissions, acl, + ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, body, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -4077,22 +4118,27 @@ public ResponseBase updat = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.updateSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, - timeout, this.client.getVersion(), action, maxRecords, continuation, mode, forceFlag, position, - retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, cacheControl, contentType, - contentDisposition, contentEncoding, contentLanguage, properties, owner, group, permissions, acl, ifMatch, - ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, body, accept, context); + try { + return service.updateSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), + requestId, timeout, this.client.getVersion(), action, maxRecords, continuation, mode, forceFlag, + position, retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, cacheControl, + contentType, contentDisposition, contentEncoding, contentLanguage, properties, owner, group, + permissions, acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, body, + accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -4168,20 +4214,24 @@ public SetAccessControlRecursiveResponse update(PathUpdateAction action, PathSet Long position, Boolean retainUncommittedData, Boolean close, Long contentLength, String properties, String owner, String group, String permissions, String acl, PathHttpHeaders pathHttpHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions) { - return updateWithResponse(action, mode, body, requestId, timeout, maxRecords, continuation, forceFlag, position, - retainUncommittedData, close, contentLength, properties, owner, group, permissions, acl, pathHttpHeaders, - leaseAccessConditions, modifiedAccessConditions, Context.NONE).getValue(); + try { + return updateWithResponse(action, mode, body, requestId, timeout, maxRecords, continuation, forceFlag, + position, retainUncommittedData, close, contentLength, properties, owner, group, permissions, acl, + pathHttpHeaders, leaseAccessConditions, modifiedAccessConditions, Context.NONE).getValue(); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Append Data | Flush Data | Set Properties | Set Access Control - * + * * Uploads data to be appended to a file, flushes (writes) previously uploaded data to a file, sets properties for a * file or directory, or sets access control for a file or directory. Data can only be appended to a file. * Concurrent writes to the same file using multiple clients are not supported. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param action The action must be "append" to upload data to be appended to a file, "flush" to flush previously * uploaded data to a file, "setProperties" to set the properties of a file or directory, "setAccessControl" to set * the owner, group, permissions, or access control list for a file or directory, or "setAccessControlRecursive" to @@ -4320,21 +4370,25 @@ public Response updateNoCustomHeadersWithResp = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.updateNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), requestId, timeout, this.client.getVersion(), action, maxRecords, continuation, mode, - forceFlag, position, retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, - cacheControl, contentType, contentDisposition, contentEncoding, contentLanguage, properties, owner, group, - permissions, acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, body, accept, - context); + try { + return service.updateNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), action, maxRecords, continuation, + mode, forceFlag, position, retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, + cacheControl, contentType, contentDisposition, contentEncoding, contentLanguage, properties, owner, + group, permissions, acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + body, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Lease Path - * + * * Create and manage a lease to restrict write and delete access to the path. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param xMsLeaseAction There are five lease actions: "acquire", "break", "change", "renew", and "release". Use * "acquire" and specify the "x-ms-proposed-lease-id" and "x-ms-lease-duration" to acquire a new lease. Use "break" * to break an existing lease. When a lease is broken, the lease break period is allowed to elapse, during which @@ -4394,19 +4448,21 @@ public Mono> leaseWithResponseAsync(PathLe = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.lease(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), requestId, timeout, this.client.getVersion(), xMsLeaseAction, - this.client.getXMsLeaseDuration(), xMsLeaseBreakPeriod, leaseId, proposedLeaseId, ifMatch, ifNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context)); + return FluxUtil + .withContext(context -> service.lease(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), xMsLeaseAction, + this.client.getXMsLeaseDuration(), xMsLeaseBreakPeriod, leaseId, proposedLeaseId, ifMatch, ifNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Lease Path - * + * * Create and manage a lease to restrict write and delete access to the path. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param xMsLeaseAction There are five lease actions: "acquire", "break", "change", "renew", and "release". Use * "acquire" and specify the "x-ms-proposed-lease-id" and "x-ms-lease-duration" to acquire a new lease. Use "break" * to break an existing lease. When a lease is broken, the lease break period is allowed to elapse, during which @@ -4468,19 +4524,21 @@ public Mono> leaseWithResponseAsync(PathLe = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.lease(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, - timeout, this.client.getVersion(), xMsLeaseAction, this.client.getXMsLeaseDuration(), xMsLeaseBreakPeriod, - leaseId, proposedLeaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - accept, context); + return service + .lease(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, timeout, + this.client.getVersion(), xMsLeaseAction, this.client.getXMsLeaseDuration(), xMsLeaseBreakPeriod, + leaseId, proposedLeaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Lease Path - * + * * Create and manage a lease to restrict write and delete access to the path. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param xMsLeaseAction There are five lease actions: "acquire", "break", "change", "renew", and "release". Use * "acquire" and specify the "x-ms-proposed-lease-id" and "x-ms-lease-duration" to acquire a new lease. Use "break" * to break an existing lease. When a lease is broken, the lease break period is allowed to elapse, during which @@ -4511,16 +4569,18 @@ public Mono leaseAsync(PathLeaseAction xMsLeaseAction, String requestId, I Integer xMsLeaseBreakPeriod, String proposedLeaseId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions) { return leaseWithResponseAsync(xMsLeaseAction, requestId, timeout, xMsLeaseBreakPeriod, proposedLeaseId, - leaseAccessConditions, modifiedAccessConditions).flatMap(ignored -> Mono.empty()); + leaseAccessConditions, modifiedAccessConditions) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Lease Path - * + * * Create and manage a lease to restrict write and delete access to the path. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param xMsLeaseAction There are five lease actions: "acquire", "break", "change", "renew", and "release". Use * "acquire" and specify the "x-ms-proposed-lease-id" and "x-ms-lease-duration" to acquire a new lease. Use "break" * to break an existing lease. When a lease is broken, the lease break period is allowed to elapse, during which @@ -4552,16 +4612,18 @@ public Mono leaseAsync(PathLeaseAction xMsLeaseAction, String requestId, I Integer xMsLeaseBreakPeriod, String proposedLeaseId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { return leaseWithResponseAsync(xMsLeaseAction, requestId, timeout, xMsLeaseBreakPeriod, proposedLeaseId, - leaseAccessConditions, modifiedAccessConditions, context).flatMap(ignored -> Mono.empty()); + leaseAccessConditions, modifiedAccessConditions, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Lease Path - * + * * Create and manage a lease to restrict write and delete access to the path. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param xMsLeaseAction There are five lease actions: "acquire", "break", "change", "renew", and "release". Use * "acquire" and specify the "x-ms-proposed-lease-id" and "x-ms-lease-duration" to acquire a new lease. Use "break" * to break an existing lease. When a lease is broken, the lease break period is allowed to elapse, during which @@ -4621,19 +4683,21 @@ public Mono> leaseNoCustomHeadersWithResponseAsync(PathLeaseActio = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.leaseNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), requestId, timeout, this.client.getVersion(), - xMsLeaseAction, this.client.getXMsLeaseDuration(), xMsLeaseBreakPeriod, leaseId, proposedLeaseId, ifMatch, - ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context)); + return FluxUtil + .withContext(context -> service.leaseNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), xMsLeaseAction, + this.client.getXMsLeaseDuration(), xMsLeaseBreakPeriod, leaseId, proposedLeaseId, ifMatch, ifNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Lease Path - * + * * Create and manage a lease to restrict write and delete access to the path. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param xMsLeaseAction There are five lease actions: "acquire", "break", "change", "renew", and "release". Use * "acquire" and specify the "x-ms-proposed-lease-id" and "x-ms-lease-duration" to acquire a new lease. Use "break" * to break an existing lease. When a lease is broken, the lease break period is allowed to elapse, during which @@ -4695,19 +4759,21 @@ public Mono> leaseNoCustomHeadersWithResponseAsync(PathLeaseActio = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.leaseNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), - requestId, timeout, this.client.getVersion(), xMsLeaseAction, this.client.getXMsLeaseDuration(), - xMsLeaseBreakPeriod, leaseId, proposedLeaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, accept, context); + return service + .leaseNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, + timeout, this.client.getVersion(), xMsLeaseAction, this.client.getXMsLeaseDuration(), + xMsLeaseBreakPeriod, leaseId, proposedLeaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Lease Path - * + * * Create and manage a lease to restrict write and delete access to the path. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param xMsLeaseAction There are five lease actions: "acquire", "break", "change", "renew", and "release". Use * "acquire" and specify the "x-ms-proposed-lease-id" and "x-ms-lease-duration" to acquire a new lease. Use "break" * to break an existing lease. When a lease is broken, the lease break period is allowed to elapse, during which @@ -4769,19 +4835,23 @@ public ResponseBase leaseWithResponse(PathLeaseAction x = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.leaseSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, - timeout, this.client.getVersion(), xMsLeaseAction, this.client.getXMsLeaseDuration(), xMsLeaseBreakPeriod, - leaseId, proposedLeaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - accept, context); + try { + return service.leaseSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), + requestId, timeout, this.client.getVersion(), xMsLeaseAction, this.client.getXMsLeaseDuration(), + xMsLeaseBreakPeriod, leaseId, proposedLeaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Lease Path - * + * * Create and manage a lease to restrict write and delete access to the path. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param xMsLeaseAction There are five lease actions: "acquire", "break", "change", "renew", and "release". Use * "acquire" and specify the "x-ms-proposed-lease-id" and "x-ms-lease-duration" to acquire a new lease. Use "break" * to break an existing lease. When a lease is broken, the lease break period is allowed to elapse, during which @@ -4816,11 +4886,11 @@ public void lease(PathLeaseAction xMsLeaseAction, String requestId, Integer time /** * Lease Path - * + * * Create and manage a lease to restrict write and delete access to the path. This operation supports conditional * HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param xMsLeaseAction There are five lease actions: "acquire", "break", "change", "renew", and "release". Use * "acquire" and specify the "x-ms-proposed-lease-id" and "x-ms-lease-duration" to acquire a new lease. Use "break" * to break an existing lease. When a lease is broken, the lease break period is allowed to elapse, during which @@ -4882,19 +4952,23 @@ public Response leaseNoCustomHeadersWithResponse(PathLeaseAction xMsLeaseA = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.leaseNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), requestId, timeout, this.client.getVersion(), xMsLeaseAction, - this.client.getXMsLeaseDuration(), xMsLeaseBreakPeriod, leaseId, proposedLeaseId, ifMatch, ifNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context); + try { + return service.leaseNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), xMsLeaseAction, + this.client.getXMsLeaseDuration(), xMsLeaseBreakPeriod, leaseId, proposedLeaseId, ifMatch, ifNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Read File - * + * * Read the contents of a file. For read operations, range requests are supported. This operation supports * conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4963,19 +5037,21 @@ public Mono>> readWithResponseAs = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.read(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), requestId, timeout, this.client.getVersion(), range, leaseId, xMsRangeGetContentMd5, - ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, encryptionKey, - encryptionKeySha256, encryptionAlgorithm, accept, context)); + return FluxUtil + .withContext(context -> service.read(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), range, leaseId, + xMsRangeGetContentMd5, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Read File - * + * * Read the contents of a file. For read operations, range requests are supported. This operation supports * conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5045,19 +5121,21 @@ public Mono>> readWithResponseAs = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.read(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, - timeout, this.client.getVersion(), range, leaseId, xMsRangeGetContentMd5, ifMatch, ifNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, encryptionKey, encryptionKeySha256, - encryptionAlgorithm, accept, context); + return service + .read(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, timeout, + this.client.getVersion(), range, leaseId, xMsRangeGetContentMd5, ifMatch, ifNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, encryptionKey, encryptionKeySha256, + encryptionAlgorithm, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Read File - * + * * Read the contents of a file. For read operations, range requests are supported. This operation supports * conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5082,16 +5160,18 @@ public Flux readAsync(String requestId, Integer timeout, String rang LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, CpkInfo cpkInfo) { return readWithResponseAsync(requestId, timeout, range, xMsRangeGetContentMd5, leaseAccessConditions, - modifiedAccessConditions, cpkInfo).flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); + modifiedAccessConditions, cpkInfo) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * Read File - * + * * Read the contents of a file. For read operations, range requests are supported. This operation supports * conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5118,16 +5198,17 @@ public Flux readAsync(String requestId, Integer timeout, String rang Context context) { return readWithResponseAsync(requestId, timeout, range, xMsRangeGetContentMd5, leaseAccessConditions, modifiedAccessConditions, cpkInfo, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * Read File - * + * * Read the contents of a file. For read operations, range requests are supported. This operation supports * conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5196,19 +5277,21 @@ public Mono readNoCustomHeadersWithResponseAsync(String requestI = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.readNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), requestId, timeout, this.client.getVersion(), range, - leaseId, xMsRangeGetContentMd5, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - encryptionKey, encryptionKeySha256, encryptionAlgorithm, accept, context)); + return FluxUtil + .withContext(context -> service.readNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), range, leaseId, + xMsRangeGetContentMd5, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Read File - * + * * Read the contents of a file. For read operations, range requests are supported. This operation supports * conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5278,19 +5361,21 @@ public Mono readNoCustomHeadersWithResponseAsync(String requestI = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.readNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), - requestId, timeout, this.client.getVersion(), range, leaseId, xMsRangeGetContentMd5, ifMatch, ifNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, encryptionKey, encryptionKeySha256, - encryptionAlgorithm, accept, context); + return service + .readNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, + timeout, this.client.getVersion(), range, leaseId, xMsRangeGetContentMd5, ifMatch, ifNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, encryptionKey, encryptionKeySha256, + encryptionAlgorithm, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Read File - * + * * Read the contents of a file. For read operations, range requests are supported. This operation supports * conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5360,19 +5445,23 @@ public ResponseBase readWithResponse(String reque = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.readSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, - timeout, this.client.getVersion(), range, leaseId, xMsRangeGetContentMd5, ifMatch, ifNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, encryptionKey, encryptionKeySha256, - encryptionAlgorithm, accept, context); + try { + return service.readSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, + timeout, this.client.getVersion(), range, leaseId, xMsRangeGetContentMd5, ifMatch, ifNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, encryptionKey, encryptionKeySha256, + encryptionAlgorithm, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Read File - * + * * Read the contents of a file. For read operations, range requests are supported. This operation supports * conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5396,17 +5485,21 @@ public ResponseBase readWithResponse(String reque public InputStream read(String requestId, Integer timeout, String range, Boolean xMsRangeGetContentMd5, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, CpkInfo cpkInfo) { - return readWithResponse(requestId, timeout, range, xMsRangeGetContentMd5, leaseAccessConditions, - modifiedAccessConditions, cpkInfo, Context.NONE).getValue(); + try { + return readWithResponse(requestId, timeout, range, xMsRangeGetContentMd5, leaseAccessConditions, + modifiedAccessConditions, cpkInfo, Context.NONE).getValue(); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Read File - * + * * Read the contents of a file. For read operations, range requests are supported. This operation supports * conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5476,20 +5569,24 @@ public Response readNoCustomHeadersWithResponse(String requestId, I = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.readNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), - requestId, timeout, this.client.getVersion(), range, leaseId, xMsRangeGetContentMd5, ifMatch, ifNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, encryptionKey, encryptionKeySha256, - encryptionAlgorithm, accept, context); + try { + return service.readNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), range, leaseId, + xMsRangeGetContentMd5, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Get Properties | Get Status | Get Access Control List - * + * * Get Properties returns all system and user defined properties for a path. Get Status returns all system defined * properties for a path. Get Access Control List returns the access control list for a path. This operation * supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5545,19 +5642,21 @@ public Mono> getPropertiesWithResp = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.getProperties(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), requestId, timeout, this.client.getVersion(), action, upn, leaseId, ifMatch, - ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context)); + return FluxUtil + .withContext(context -> service.getProperties(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), action, upn, leaseId, ifMatch, + ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Get Properties | Get Status | Get Access Control List - * + * * Get Properties returns all system and user defined properties for a path. Get Status returns all system defined * properties for a path. Get Access Control List returns the access control list for a path. This operation * supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5614,19 +5713,21 @@ public Mono> getPropertiesWithResp = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getProperties(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), - requestId, timeout, this.client.getVersion(), action, upn, leaseId, ifMatch, ifNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context); + return service + .getProperties(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, timeout, + this.client.getVersion(), action, upn, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Get Properties | Get Status | Get Access Control List - * + * * Get Properties returns all system and user defined properties for a path. Get Status returns all system defined * properties for a path. Get Access Control List returns the access control list for a path. This operation * supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5652,17 +5753,19 @@ public Mono> getPropertiesWithResp public Mono getPropertiesAsync(String requestId, Integer timeout, PathGetPropertiesAction action, Boolean upn, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions) { return getPropertiesWithResponseAsync(requestId, timeout, action, upn, leaseAccessConditions, - modifiedAccessConditions).flatMap(ignored -> Mono.empty()); + modifiedAccessConditions) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Get Properties | Get Status | Get Access Control List - * + * * Get Properties returns all system and user defined properties for a path. Get Status returns all system defined * properties for a path. Get Access Control List returns the access control list for a path. This operation * supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5690,17 +5793,19 @@ public Mono getPropertiesAsync(String requestId, Integer timeout, PathGetP LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { return getPropertiesWithResponseAsync(requestId, timeout, action, upn, leaseAccessConditions, - modifiedAccessConditions, context).flatMap(ignored -> Mono.empty()); + modifiedAccessConditions, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Get Properties | Get Status | Get Access Control List - * + * * Get Properties returns all system and user defined properties for a path. Get Status returns all system defined * properties for a path. Get Access Control List returns the access control list for a path. This operation * supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5756,19 +5861,22 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), requestId, timeout, this.client.getVersion(), action, - upn, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context)); + return FluxUtil + .withContext( + context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), action, upn, leaseId, ifMatch, + ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Get Properties | Get Status | Get Access Control List - * + * * Get Properties returns all system and user defined properties for a path. Get Status returns all system defined * properties for a path. Get Access Control List returns the access control list for a path. This operation * supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5825,19 +5933,21 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getPropertiesNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), requestId, timeout, this.client.getVersion(), action, upn, leaseId, ifMatch, - ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context); + return service + .getPropertiesNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), + requestId, timeout, this.client.getVersion(), action, upn, leaseId, ifMatch, ifNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Get Properties | Get Status | Get Access Control List - * + * * Get Properties returns all system and user defined properties for a path. Get Status returns all system defined * properties for a path. Get Access Control List returns the access control list for a path. This operation * supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5893,19 +6003,23 @@ public ResponseBase getPropertiesWithResponse(S = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getPropertiesSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), - requestId, timeout, this.client.getVersion(), action, upn, leaseId, ifMatch, ifNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context); + try { + return service.getPropertiesSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), + requestId, timeout, this.client.getVersion(), action, upn, leaseId, ifMatch, ifNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Get Properties | Get Status | Get Access Control List - * + * * Get Properties returns all system and user defined properties for a path. Get Status returns all system defined * properties for a path. Get Access Control List returns the access control list for a path. This operation * supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5934,12 +6048,12 @@ public void getProperties(String requestId, Integer timeout, PathGetPropertiesAc /** * Get Properties | Get Status | Get Access Control List - * + * * Get Properties returns all system and user defined properties for a path. Get Status returns all system defined * properties for a path. Get Access Control List returns the access control list for a path. This operation * supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -5995,18 +6109,22 @@ public Response getPropertiesNoCustomHeadersWithResponse(String requestId, = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), requestId, timeout, this.client.getVersion(), action, upn, leaseId, ifMatch, - ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context); + try { + return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), action, upn, leaseId, ifMatch, + ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Delete File | Delete Directory - * + * * Delete the file or directory. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6062,18 +6180,20 @@ public Mono> deleteWithResponseAsync(Stri = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.delete(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), requestId, timeout, this.client.getVersion(), recursive, continuation, leaseId, - ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, paginated, accept, context)); + return FluxUtil + .withContext(context -> service.delete(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), recursive, continuation, leaseId, + ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, paginated, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Delete File | Delete Directory - * + * * Delete the file or directory. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6130,18 +6250,20 @@ public Mono> deleteWithResponseAsync(Stri = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.delete(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, - timeout, this.client.getVersion(), recursive, continuation, leaseId, ifMatch, ifNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, paginated, accept, context); + return service + .delete(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, timeout, + this.client.getVersion(), recursive, continuation, leaseId, ifMatch, ifNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, paginated, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Delete File | Delete Directory - * + * * Delete the file or directory. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6168,16 +6290,18 @@ public Mono deleteAsync(String requestId, Integer timeout, Boolean recursi Boolean paginated, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions) { return deleteWithResponseAsync(requestId, timeout, recursive, continuation, paginated, leaseAccessConditions, - modifiedAccessConditions).flatMap(ignored -> Mono.empty()); + modifiedAccessConditions) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Delete File | Delete Directory - * + * * Delete the file or directory. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6205,16 +6329,18 @@ public Mono deleteAsync(String requestId, Integer timeout, Boolean recursi Boolean paginated, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { return deleteWithResponseAsync(requestId, timeout, recursive, continuation, paginated, leaseAccessConditions, - modifiedAccessConditions, context).flatMap(ignored -> Mono.empty()); + modifiedAccessConditions, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Delete File | Delete Directory - * + * * Delete the file or directory. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6270,19 +6396,20 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String reques = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), requestId, timeout, this.client.getVersion(), recursive, - continuation, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, - paginated, accept, context)); + return FluxUtil + .withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), recursive, continuation, leaseId, + ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, paginated, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Delete File | Delete Directory - * + * * Delete the file or directory. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6339,18 +6466,20 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String reques = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.deleteNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), - requestId, timeout, this.client.getVersion(), recursive, continuation, leaseId, ifMatch, ifNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, paginated, accept, context); + return service + .deleteNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, + timeout, this.client.getVersion(), recursive, continuation, leaseId, ifMatch, ifNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, paginated, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Delete File | Delete Directory - * + * * Delete the file or directory. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6407,18 +6536,22 @@ public ResponseBase deleteWithResponse(String requestI = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.deleteSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), requestId, - timeout, this.client.getVersion(), recursive, continuation, leaseId, ifMatch, ifNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, paginated, accept, context); + try { + return service.deleteSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), + requestId, timeout, this.client.getVersion(), recursive, continuation, leaseId, ifMatch, ifNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, paginated, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Delete File | Delete Directory - * + * * Delete the file or directory. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6448,11 +6581,11 @@ public void delete(String requestId, Integer timeout, Boolean recursive, String /** * Delete File | Delete Directory - * + * * Delete the file or directory. This operation supports conditional HTTP requests. For more information, see * [Specifying Conditional Headers for Blob Service * Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). - * + * * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -6509,14 +6642,18 @@ public Response deleteNoCustomHeadersWithResponse(String requestId, Intege = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.deleteNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), requestId, timeout, this.client.getVersion(), recursive, continuation, leaseId, - ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, paginated, accept, context); + try { + return service.deleteNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), requestId, timeout, this.client.getVersion(), recursive, continuation, leaseId, + ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, paginated, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -6573,15 +6710,17 @@ public Mono> setAccessControlWi = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.setAccessControl(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), action, timeout, leaseId, owner, group, permissions, - acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, requestId, - this.client.getVersion(), accept, context)); + return FluxUtil + .withContext(context -> service.setAccessControl(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), action, timeout, leaseId, owner, group, permissions, acl, ifMatch, ifNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), accept, + context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -6640,14 +6779,16 @@ public Mono> setAccessControlWi = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setAccessControl(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), - action, timeout, leaseId, owner, group, permissions, acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), accept, context); + return service + .setAccessControl(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), action, timeout, + leaseId, owner, group, permissions, acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -6674,12 +6815,14 @@ public Mono setAccessControlAsync(Integer timeout, String owner, String gr String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions) { return setAccessControlWithResponseAsync(timeout, owner, group, permissions, acl, requestId, - leaseAccessConditions, modifiedAccessConditions).flatMap(ignored -> Mono.empty()); + leaseAccessConditions, modifiedAccessConditions) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -6707,12 +6850,14 @@ public Mono setAccessControlAsync(Integer timeout, String owner, String gr String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { return setAccessControlWithResponseAsync(timeout, owner, group, permissions, acl, requestId, - leaseAccessConditions, modifiedAccessConditions, context).flatMap(ignored -> Mono.empty()); + leaseAccessConditions, modifiedAccessConditions, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -6769,15 +6914,17 @@ public Mono> setAccessControlNoCustomHeadersWithResponseAsync(Int = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.setAccessControlNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), action, timeout, leaseId, owner, group, permissions, - acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, requestId, - this.client.getVersion(), accept, context)); + return FluxUtil + .withContext(context -> service.setAccessControlNoCustomHeaders(this.client.getUrl(), + this.client.getFileSystem(), this.client.getPath(), action, timeout, leaseId, owner, group, permissions, + acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, requestId, + this.client.getVersion(), accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -6837,12 +6984,13 @@ public Mono> setAccessControlNoCustomHeadersWithResponseAsync(Int = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); return service.setAccessControlNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), action, timeout, leaseId, owner, group, permissions, acl, ifMatch, ifNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), accept, context); + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -6900,14 +7048,19 @@ public ResponseBase setAccessControlWithResp = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setAccessControlSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), - action, timeout, leaseId, owner, group, permissions, acl, ifMatch, ifNoneMatch, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), accept, context); + try { + return service.setAccessControlSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), action, timeout, leaseId, owner, group, permissions, acl, ifMatch, ifNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), accept, + context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -6938,7 +7091,7 @@ public void setAccessControl(Integer timeout, String owner, String group, String /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -6996,14 +7149,19 @@ public Response setAccessControlNoCustomHeadersWithResponse(Integer timeou = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setAccessControlNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), action, timeout, leaseId, owner, group, permissions, acl, ifMatch, ifNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), accept, context); + try { + return service.setAccessControlNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), action, timeout, leaseId, owner, group, permissions, acl, ifMatch, ifNoneMatch, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), accept, + context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Set the access control list for a path and sub-paths. - * + * * @param mode Mode "set" sets POSIX access control rights on files and directories, "modify" modifies one or more * POSIX access control rights that pre-exist on files and directories, "remove" removes one or more POSIX access * control rights that were present earlier on files and directories. @@ -7036,14 +7194,16 @@ public Response setAccessControlNoCustomHeadersWithResponse(Integer timeou String continuation, Boolean forceFlag, Integer maxRecords, String acl, String requestId) { final String action = "setAccessControlRecursive"; final String accept = "application/json"; - return FluxUtil.withContext(context -> service.setAccessControlRecursive(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), action, timeout, continuation, mode, forceFlag, - maxRecords, acl, requestId, this.client.getVersion(), accept, context)); + return FluxUtil + .withContext(context -> service.setAccessControlRecursive(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), action, timeout, continuation, mode, forceFlag, maxRecords, acl, requestId, + this.client.getVersion(), accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set the access control list for a path and sub-paths. - * + * * @param mode Mode "set" sets POSIX access control rights on files and directories, "modify" modifies one or more * POSIX access control rights that pre-exist on files and directories, "remove" removes one or more POSIX access * control rights that were present earlier on files and directories. @@ -7077,14 +7237,16 @@ public Response setAccessControlNoCustomHeadersWithResponse(Integer timeou String continuation, Boolean forceFlag, Integer maxRecords, String acl, String requestId, Context context) { final String action = "setAccessControlRecursive"; final String accept = "application/json"; - return service.setAccessControlRecursive(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), action, timeout, continuation, mode, forceFlag, maxRecords, acl, requestId, - this.client.getVersion(), accept, context); + return service + .setAccessControlRecursive(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), action, + timeout, continuation, mode, forceFlag, maxRecords, acl, requestId, this.client.getVersion(), accept, + context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set the access control list for a path and sub-paths. - * + * * @param mode Mode "set" sets POSIX access control rights on files and directories, "modify" modifies one or more * POSIX access control rights that pre-exist on files and directories, "remove" removes one or more POSIX access * control rights that were present earlier on files and directories. @@ -7116,12 +7278,13 @@ public Mono setAccessControlRecursiveAsync( PathSetAccessControlRecursiveMode mode, Integer timeout, String continuation, Boolean forceFlag, Integer maxRecords, String acl, String requestId) { return setAccessControlRecursiveWithResponseAsync(mode, timeout, continuation, forceFlag, maxRecords, acl, - requestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + requestId).onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Set the access control list for a path and sub-paths. - * + * * @param mode Mode "set" sets POSIX access control rights on files and directories, "modify" modifies one or more * POSIX access control rights that pre-exist on files and directories, "remove" removes one or more POSIX access * control rights that were present earlier on files and directories. @@ -7154,12 +7317,14 @@ public Mono setAccessControlRecursiveAsync( PathSetAccessControlRecursiveMode mode, Integer timeout, String continuation, Boolean forceFlag, Integer maxRecords, String acl, String requestId, Context context) { return setAccessControlRecursiveWithResponseAsync(mode, timeout, continuation, forceFlag, maxRecords, acl, - requestId, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + requestId, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Set the access control list for a path and sub-paths. - * + * * @param mode Mode "set" sets POSIX access control rights on files and directories, "modify" modifies one or more * POSIX access control rights that pre-exist on files and directories, "remove" removes one or more POSIX access * control rights that were present earlier on files and directories. @@ -7192,14 +7357,16 @@ public Mono> setAccessControlRecursi Integer maxRecords, String acl, String requestId) { final String action = "setAccessControlRecursive"; final String accept = "application/json"; - return FluxUtil.withContext(context -> service.setAccessControlRecursiveNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), action, timeout, continuation, mode, forceFlag, - maxRecords, acl, requestId, this.client.getVersion(), accept, context)); + return FluxUtil + .withContext(context -> service.setAccessControlRecursiveNoCustomHeaders(this.client.getUrl(), + this.client.getFileSystem(), this.client.getPath(), action, timeout, continuation, mode, forceFlag, + maxRecords, acl, requestId, this.client.getVersion(), accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set the access control list for a path and sub-paths. - * + * * @param mode Mode "set" sets POSIX access control rights on files and directories, "modify" modifies one or more * POSIX access control rights that pre-exist on files and directories, "remove" removes one or more POSIX access * control rights that were present earlier on files and directories. @@ -7233,14 +7400,16 @@ public Mono> setAccessControlRecursi Integer maxRecords, String acl, String requestId, Context context) { final String action = "setAccessControlRecursive"; final String accept = "application/json"; - return service.setAccessControlRecursiveNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), action, timeout, continuation, mode, forceFlag, maxRecords, acl, requestId, - this.client.getVersion(), accept, context); + return service + .setAccessControlRecursiveNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), action, timeout, continuation, mode, forceFlag, maxRecords, acl, requestId, + this.client.getVersion(), accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set the access control list for a path and sub-paths. - * + * * @param mode Mode "set" sets POSIX access control rights on files and directories, "modify" modifies one or more * POSIX access control rights that pre-exist on files and directories, "remove" removes one or more POSIX access * control rights that were present earlier on files and directories. @@ -7274,14 +7443,18 @@ public Mono> setAccessControlRecursi String continuation, Boolean forceFlag, Integer maxRecords, String acl, String requestId, Context context) { final String action = "setAccessControlRecursive"; final String accept = "application/json"; - return service.setAccessControlRecursiveSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), action, timeout, continuation, mode, forceFlag, maxRecords, acl, requestId, - this.client.getVersion(), accept, context); + try { + return service.setAccessControlRecursiveSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), action, timeout, continuation, mode, forceFlag, maxRecords, acl, requestId, + this.client.getVersion(), accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Set the access control list for a path and sub-paths. - * + * * @param mode Mode "set" sets POSIX access control rights on files and directories, "modify" modifies one or more * POSIX access control rights that pre-exist on files and directories, "remove" removes one or more POSIX access * control rights that were present earlier on files and directories. @@ -7311,13 +7484,17 @@ public Mono> setAccessControlRecursi @ServiceMethod(returns = ReturnType.SINGLE) public SetAccessControlRecursiveResponse setAccessControlRecursive(PathSetAccessControlRecursiveMode mode, Integer timeout, String continuation, Boolean forceFlag, Integer maxRecords, String acl, String requestId) { - return setAccessControlRecursiveWithResponse(mode, timeout, continuation, forceFlag, maxRecords, acl, requestId, - Context.NONE).getValue(); + try { + return setAccessControlRecursiveWithResponse(mode, timeout, continuation, forceFlag, maxRecords, acl, + requestId, Context.NONE).getValue(); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Set the access control list for a path and sub-paths. - * + * * @param mode Mode "set" sets POSIX access control rights on files and directories, "modify" modifies one or more * POSIX access control rights that pre-exist on files and directories, "remove" removes one or more POSIX access * control rights that were present earlier on files and directories. @@ -7351,14 +7528,18 @@ public Response setAccessControlRecursiveNoCu Integer maxRecords, String acl, String requestId, Context context) { final String action = "setAccessControlRecursive"; final String accept = "application/json"; - return service.setAccessControlRecursiveNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), action, timeout, continuation, mode, forceFlag, maxRecords, acl, requestId, - this.client.getVersion(), accept, context); + try { + return service.setAccessControlRecursiveNoCustomHeadersSync(this.client.getUrl(), + this.client.getFileSystem(), this.client.getPath(), action, timeout, continuation, mode, forceFlag, + maxRecords, acl, requestId, this.client.getVersion(), accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -7484,17 +7665,19 @@ public Mono> flushDataWithResponseAsyn = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.flushData(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), action, timeout, position, retainUncommittedData, close, contentLength, - contentMd5Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, cacheControl, contentType, - contentDisposition, contentEncoding, contentLanguage, ifMatch, ifNoneMatch, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), encryptionKey, encryptionKeySha256, - encryptionAlgorithm, accept, context)); + return FluxUtil + .withContext(context -> service.flushData(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), action, timeout, position, retainUncommittedData, close, contentLength, + contentMd5Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, cacheControl, contentType, + contentDisposition, contentEncoding, contentLanguage, ifMatch, ifNoneMatch, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), encryptionKey, encryptionKeySha256, + encryptionAlgorithm, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -7621,16 +7804,18 @@ public Mono> flushDataWithResponseAsyn = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.flushData(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), action, - timeout, position, retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, leaseAction, - leaseDuration, proposedLeaseId, cacheControl, contentType, contentDisposition, contentEncoding, - contentLanguage, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, requestId, - this.client.getVersion(), encryptionKey, encryptionKeySha256, encryptionAlgorithm, accept, context); + return service + .flushData(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), action, timeout, + position, retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, leaseAction, + leaseDuration, proposedLeaseId, cacheControl, contentType, contentDisposition, contentEncoding, + contentLanguage, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, requestId, + this.client.getVersion(), encryptionKey, encryptionKeySha256, encryptionAlgorithm, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -7680,12 +7865,13 @@ public Mono flushDataAsync(Integer timeout, Long position, Boolean retainU ModifiedAccessConditions modifiedAccessConditions, CpkInfo cpkInfo) { return flushDataWithResponseAsync(timeout, position, retainUncommittedData, close, contentLength, leaseAction, leaseDuration, proposedLeaseId, requestId, pathHttpHeaders, leaseAccessConditions, modifiedAccessConditions, - cpkInfo).flatMap(ignored -> Mono.empty()); + cpkInfo).onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -7736,12 +7922,14 @@ public Mono flushDataAsync(Integer timeout, Long position, Boolean retainU ModifiedAccessConditions modifiedAccessConditions, CpkInfo cpkInfo, Context context) { return flushDataWithResponseAsync(timeout, position, retainUncommittedData, close, contentLength, leaseAction, leaseDuration, proposedLeaseId, requestId, pathHttpHeaders, leaseAccessConditions, modifiedAccessConditions, - cpkInfo, context).flatMap(ignored -> Mono.empty()); + cpkInfo, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -7867,17 +8055,19 @@ public Mono> flushDataNoCustomHeadersWithResponseAsync(Integer ti = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return FluxUtil.withContext(context -> service.flushDataNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), action, timeout, position, retainUncommittedData, close, - contentLength, contentMd5Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, cacheControl, - contentType, contentDisposition, contentEncoding, contentLanguage, ifMatch, ifNoneMatch, - ifModifiedSinceConverted, ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), encryptionKey, - encryptionKeySha256, encryptionAlgorithm, accept, context)); + return FluxUtil + .withContext(context -> service.flushDataNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), action, timeout, position, retainUncommittedData, close, contentLength, + contentMd5Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, cacheControl, contentType, + contentDisposition, contentEncoding, contentLanguage, ifMatch, ifNoneMatch, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), encryptionKey, encryptionKeySha256, + encryptionAlgorithm, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -8004,17 +8194,19 @@ public Mono> flushDataNoCustomHeadersWithResponseAsync(Integer ti = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.flushDataNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), action, timeout, position, retainUncommittedData, close, contentLength, - contentMd5Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, cacheControl, contentType, - contentDisposition, contentEncoding, contentLanguage, ifMatch, ifNoneMatch, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), encryptionKey, encryptionKeySha256, - encryptionAlgorithm, accept, context); + return service + .flushDataNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), action, + timeout, position, retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, + leaseAction, leaseDuration, proposedLeaseId, cacheControl, contentType, contentDisposition, + contentEncoding, contentLanguage, ifMatch, ifNoneMatch, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), encryptionKey, encryptionKeySha256, + encryptionAlgorithm, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -8141,16 +8333,21 @@ public ResponseBase flushDataWithResponse(Integer t = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.flushDataSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), action, - timeout, position, retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, leaseAction, - leaseDuration, proposedLeaseId, cacheControl, contentType, contentDisposition, contentEncoding, - contentLanguage, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, requestId, - this.client.getVersion(), encryptionKey, encryptionKeySha256, encryptionAlgorithm, accept, context); + try { + return service.flushDataSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), + action, timeout, position, retainUncommittedData, close, contentLength, contentMd5Converted, leaseId, + leaseAction, leaseDuration, proposedLeaseId, cacheControl, contentType, contentDisposition, + contentEncoding, contentLanguage, ifMatch, ifNoneMatch, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), encryptionKey, encryptionKeySha256, + encryptionAlgorithm, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -8204,7 +8401,7 @@ public void flushData(Integer timeout, Long position, Boolean retainUncommittedD /** * Set the owner, group, permissions, or access control list for a path. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -8331,17 +8528,21 @@ public Response flushDataNoCustomHeadersWithResponse(Integer timeout, Long = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.flushDataNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), action, timeout, position, retainUncommittedData, close, contentLength, - contentMd5Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, cacheControl, contentType, - contentDisposition, contentEncoding, contentLanguage, ifMatch, ifNoneMatch, ifModifiedSinceConverted, - ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), encryptionKey, encryptionKeySha256, - encryptionAlgorithm, accept, context); + try { + return service.flushDataNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), action, timeout, position, retainUncommittedData, close, contentLength, + contentMd5Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, cacheControl, contentType, + contentDisposition, contentEncoding, contentLanguage, ifMatch, ifNoneMatch, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, requestId, this.client.getVersion(), encryptionKey, encryptionKeySha256, + encryptionAlgorithm, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Append data to the file. - * + * * @param body Initial data. * @param position This parameter allows the caller to upload data in parallel and control the order in which it is * appended to the file. It is required when uploading data to be appended to the file and when flushing previously @@ -8408,16 +8609,18 @@ public Mono> appendDataWithResponseAs EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; String transactionalContentHashConverted = Base64Util.encodeToString(transactionalContentHash); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return FluxUtil.withContext(context -> service.appendData(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), action, position, timeout, contentLength, transactionalContentHashConverted, - transactionalContentCrc64Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, requestId, - this.client.getVersion(), encryptionKey, encryptionKeySha256, encryptionAlgorithm, flush, body, accept, - context)); + return FluxUtil + .withContext(context -> service.appendData(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), action, position, timeout, contentLength, transactionalContentHashConverted, + transactionalContentCrc64Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, requestId, + this.client.getVersion(), encryptionKey, encryptionKeySha256, encryptionAlgorithm, flush, body, accept, + context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append data to the file. - * + * * @param body Initial data. * @param position This parameter allows the caller to upload data in parallel and control the order in which it is * appended to the file. It is required when uploading data to be appended to the file and when flushing previously @@ -8485,15 +8688,17 @@ public Mono> appendDataWithResponseAs EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; String transactionalContentHashConverted = Base64Util.encodeToString(transactionalContentHash); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.appendData(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), action, - position, timeout, contentLength, transactionalContentHashConverted, transactionalContentCrc64Converted, - leaseId, leaseAction, leaseDuration, proposedLeaseId, requestId, this.client.getVersion(), encryptionKey, - encryptionKeySha256, encryptionAlgorithm, flush, body, accept, context); + return service + .appendData(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), action, position, + timeout, contentLength, transactionalContentHashConverted, transactionalContentCrc64Converted, leaseId, + leaseAction, leaseDuration, proposedLeaseId, requestId, this.client.getVersion(), encryptionKey, + encryptionKeySha256, encryptionAlgorithm, flush, body, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append data to the file. - * + * * @param body Initial data. * @param position This parameter allows the caller to upload data in parallel and control the order in which it is * appended to the file. It is required when uploading data to be appended to the file and when flushing previously @@ -8533,12 +8738,13 @@ public Mono appendDataAsync(Flux body, Long position, Integer CpkInfo cpkInfo) { return appendDataWithResponseAsync(body, position, timeout, contentLength, transactionalContentCrc64, leaseAction, leaseDuration, proposedLeaseId, requestId, flush, pathHttpHeaders, leaseAccessConditions, - cpkInfo).flatMap(ignored -> Mono.empty()); + cpkInfo).onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Append data to the file. - * + * * @param body Initial data. * @param position This parameter allows the caller to upload data in parallel and control the order in which it is * appended to the file. It is required when uploading data to be appended to the file and when flushing previously @@ -8579,12 +8785,14 @@ public Mono appendDataAsync(Flux body, Long position, Integer CpkInfo cpkInfo, Context context) { return appendDataWithResponseAsync(body, position, timeout, contentLength, transactionalContentCrc64, leaseAction, leaseDuration, proposedLeaseId, requestId, flush, pathHttpHeaders, leaseAccessConditions, - cpkInfo, context).flatMap(ignored -> Mono.empty()); + cpkInfo, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Append data to the file. - * + * * @param body Initial data. * @param position This parameter allows the caller to upload data in parallel and control the order in which it is * appended to the file. It is required when uploading data to be appended to the file and when flushing previously @@ -8651,16 +8859,18 @@ public Mono> appendDataNoCustomHeadersWithResponseAsync(Flux service.appendDataNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), action, position, timeout, contentLength, - transactionalContentHashConverted, transactionalContentCrc64Converted, leaseId, leaseAction, leaseDuration, - proposedLeaseId, requestId, this.client.getVersion(), encryptionKey, encryptionKeySha256, - encryptionAlgorithm, flush, body, accept, context)); + return FluxUtil + .withContext(context -> service.appendDataNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), action, position, timeout, contentLength, transactionalContentHashConverted, + transactionalContentCrc64Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, requestId, + this.client.getVersion(), encryptionKey, encryptionKeySha256, encryptionAlgorithm, flush, body, accept, + context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append data to the file. - * + * * @param body Initial data. * @param position This parameter allows the caller to upload data in parallel and control the order in which it is * appended to the file. It is required when uploading data to be appended to the file and when flushing previously @@ -8728,16 +8938,17 @@ public Mono> appendDataNoCustomHeadersWithResponseAsync(Flux> appendDataWithResponseAs EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; String transactionalContentHashConverted = Base64Util.encodeToString(transactionalContentHash); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return FluxUtil.withContext(context -> service.appendData(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), action, position, timeout, contentLength, transactionalContentHashConverted, - transactionalContentCrc64Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, requestId, - this.client.getVersion(), encryptionKey, encryptionKeySha256, encryptionAlgorithm, flush, body, accept, - context)); + return FluxUtil + .withContext(context -> service.appendData(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), action, position, timeout, contentLength, transactionalContentHashConverted, + transactionalContentCrc64Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, requestId, + this.client.getVersion(), encryptionKey, encryptionKeySha256, encryptionAlgorithm, flush, body, accept, + context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append data to the file. - * + * * @param body Initial data. * @param position This parameter allows the caller to upload data in parallel and control the order in which it is * appended to the file. It is required when uploading data to be appended to the file and when flushing previously @@ -8881,15 +9094,17 @@ public Mono> appendDataWithResponseAs EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; String transactionalContentHashConverted = Base64Util.encodeToString(transactionalContentHash); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.appendData(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), action, - position, timeout, contentLength, transactionalContentHashConverted, transactionalContentCrc64Converted, - leaseId, leaseAction, leaseDuration, proposedLeaseId, requestId, this.client.getVersion(), encryptionKey, - encryptionKeySha256, encryptionAlgorithm, flush, body, accept, context); + return service + .appendData(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), action, position, + timeout, contentLength, transactionalContentHashConverted, transactionalContentCrc64Converted, leaseId, + leaseAction, leaseDuration, proposedLeaseId, requestId, this.client.getVersion(), encryptionKey, + encryptionKeySha256, encryptionAlgorithm, flush, body, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append data to the file. - * + * * @param body Initial data. * @param position This parameter allows the caller to upload data in parallel and control the order in which it is * appended to the file. It is required when uploading data to be appended to the file and when flushing previously @@ -8929,12 +9144,13 @@ public Mono appendDataAsync(BinaryData body, Long position, Integer timeou CpkInfo cpkInfo) { return appendDataWithResponseAsync(body, position, timeout, contentLength, transactionalContentCrc64, leaseAction, leaseDuration, proposedLeaseId, requestId, flush, pathHttpHeaders, leaseAccessConditions, - cpkInfo).flatMap(ignored -> Mono.empty()); + cpkInfo).onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Append data to the file. - * + * * @param body Initial data. * @param position This parameter allows the caller to upload data in parallel and control the order in which it is * appended to the file. It is required when uploading data to be appended to the file and when flushing previously @@ -8975,12 +9191,14 @@ public Mono appendDataAsync(BinaryData body, Long position, Integer timeou CpkInfo cpkInfo, Context context) { return appendDataWithResponseAsync(body, position, timeout, contentLength, transactionalContentCrc64, leaseAction, leaseDuration, proposedLeaseId, requestId, flush, pathHttpHeaders, leaseAccessConditions, - cpkInfo, context).flatMap(ignored -> Mono.empty()); + cpkInfo, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Append data to the file. - * + * * @param body Initial data. * @param position This parameter allows the caller to upload data in parallel and control the order in which it is * appended to the file. It is required when uploading data to be appended to the file and when flushing previously @@ -9047,16 +9265,18 @@ public Mono> appendDataNoCustomHeadersWithResponseAsync(BinaryDat EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; String transactionalContentHashConverted = Base64Util.encodeToString(transactionalContentHash); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return FluxUtil.withContext(context -> service.appendDataNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), action, position, timeout, contentLength, - transactionalContentHashConverted, transactionalContentCrc64Converted, leaseId, leaseAction, leaseDuration, - proposedLeaseId, requestId, this.client.getVersion(), encryptionKey, encryptionKeySha256, - encryptionAlgorithm, flush, body, accept, context)); + return FluxUtil + .withContext(context -> service.appendDataNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), action, position, timeout, contentLength, transactionalContentHashConverted, + transactionalContentCrc64Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, requestId, + this.client.getVersion(), encryptionKey, encryptionKeySha256, encryptionAlgorithm, flush, body, accept, + context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append data to the file. - * + * * @param body Initial data. * @param position This parameter allows the caller to upload data in parallel and control the order in which it is * appended to the file. It is required when uploading data to be appended to the file and when flushing previously @@ -9124,16 +9344,17 @@ public Mono> appendDataNoCustomHeadersWithResponseAsync(BinaryDat EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; String transactionalContentHashConverted = Base64Util.encodeToString(transactionalContentHash); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.appendDataNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), action, position, timeout, contentLength, transactionalContentHashConverted, - transactionalContentCrc64Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, requestId, - this.client.getVersion(), encryptionKey, encryptionKeySha256, encryptionAlgorithm, flush, body, accept, - context); + return service + .appendDataNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), action, + position, timeout, contentLength, transactionalContentHashConverted, transactionalContentCrc64Converted, + leaseId, leaseAction, leaseDuration, proposedLeaseId, requestId, this.client.getVersion(), + encryptionKey, encryptionKeySha256, encryptionAlgorithm, flush, body, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Append data to the file. - * + * * @param body Initial data. * @param position This parameter allows the caller to upload data in parallel and control the order in which it is * appended to the file. It is required when uploading data to be appended to the file and when flushing previously @@ -9201,15 +9422,20 @@ public ResponseBase appendDataWithResponse(BinaryD EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; String transactionalContentHashConverted = Base64Util.encodeToString(transactionalContentHash); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.appendDataSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), action, - position, timeout, contentLength, transactionalContentHashConverted, transactionalContentCrc64Converted, - leaseId, leaseAction, leaseDuration, proposedLeaseId, requestId, this.client.getVersion(), encryptionKey, - encryptionKeySha256, encryptionAlgorithm, flush, body, accept, context); + try { + return service.appendDataSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), + action, position, timeout, contentLength, transactionalContentHashConverted, + transactionalContentCrc64Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, requestId, + this.client.getVersion(), encryptionKey, encryptionKeySha256, encryptionAlgorithm, flush, body, accept, + context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Append data to the file. - * + * * @param body Initial data. * @param position This parameter allows the caller to upload data in parallel and control the order in which it is * appended to the file. It is required when uploading data to be appended to the file and when flushing previously @@ -9253,7 +9479,7 @@ public void appendData(BinaryData body, Long position, Integer timeout, Long con /** * Append data to the file. - * + * * @param body Initial data. * @param position This parameter allows the caller to upload data in parallel and control the order in which it is * appended to the file. It is required when uploading data to be appended to the file and when flushing previously @@ -9321,16 +9547,20 @@ public Response appendDataNoCustomHeadersWithResponse(BinaryData body, Lon EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; String transactionalContentHashConverted = Base64Util.encodeToString(transactionalContentHash); String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); - return service.appendDataNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), action, position, timeout, contentLength, transactionalContentHashConverted, - transactionalContentCrc64Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, requestId, - this.client.getVersion(), encryptionKey, encryptionKeySha256, encryptionAlgorithm, flush, body, accept, - context); + try { + return service.appendDataNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), action, position, timeout, contentLength, transactionalContentHashConverted, + transactionalContentCrc64Converted, leaseId, leaseAction, leaseDuration, proposedLeaseId, requestId, + this.client.getVersion(), encryptionKey, encryptionKeySha256, encryptionAlgorithm, flush, body, accept, + context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Sets the time a blob will expire and be deleted. - * + * * @param expiryOptions Required. Indicates mode of the expiry time. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -9348,14 +9578,16 @@ public Mono> setExpiryWithResponseAsyn Integer timeout, String requestId, String expiresOn) { final String comp = "expiry"; final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.setExpiry(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), comp, - timeout, this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context)); + return FluxUtil + .withContext( + context -> service.setExpiry(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), + comp, timeout, this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Sets the time a blob will expire and be deleted. - * + * * @param expiryOptions Required. Indicates mode of the expiry time. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -9374,13 +9606,15 @@ public Mono> setExpiryWithResponseAsyn Integer timeout, String requestId, String expiresOn, Context context) { final String comp = "expiry"; final String accept = "application/json"; - return service.setExpiry(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), comp, - timeout, this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context); + return service + .setExpiry(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), comp, timeout, + this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Sets the time a blob will expire and be deleted. - * + * * @param expiryOptions Required. Indicates mode of the expiry time. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -9397,12 +9631,13 @@ public Mono> setExpiryWithResponseAsyn public Mono setExpiryAsync(PathExpiryOptions expiryOptions, Integer timeout, String requestId, String expiresOn) { return setExpiryWithResponseAsync(expiryOptions, timeout, requestId, expiresOn) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .flatMap(ignored -> Mono.empty()); } /** * Sets the time a blob will expire and be deleted. - * + * * @param expiryOptions Required. Indicates mode of the expiry time. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -9420,12 +9655,13 @@ public Mono setExpiryAsync(PathExpiryOptions expiryOptions, Integer timeou public Mono setExpiryAsync(PathExpiryOptions expiryOptions, Integer timeout, String requestId, String expiresOn, Context context) { return setExpiryWithResponseAsync(expiryOptions, timeout, requestId, expiresOn, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .flatMap(ignored -> Mono.empty()); } /** * Sets the time a blob will expire and be deleted. - * + * * @param expiryOptions Required. Indicates mode of the expiry time. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -9443,14 +9679,16 @@ public Mono> setExpiryNoCustomHeadersWithResponseAsync(PathExpiry Integer timeout, String requestId, String expiresOn) { final String comp = "expiry"; final String accept = "application/json"; - return FluxUtil.withContext(context -> service.setExpiryNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), comp, timeout, this.client.getVersion(), requestId, - expiryOptions, expiresOn, accept, context)); + return FluxUtil + .withContext(context -> service.setExpiryNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), comp, timeout, this.client.getVersion(), requestId, expiryOptions, expiresOn, + accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Sets the time a blob will expire and be deleted. - * + * * @param expiryOptions Required. Indicates mode of the expiry time. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -9469,14 +9707,15 @@ public Mono> setExpiryNoCustomHeadersWithResponseAsync(PathExpiry Integer timeout, String requestId, String expiresOn, Context context) { final String comp = "expiry"; final String accept = "application/json"; - return service.setExpiryNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), comp, timeout, this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, - context); + return service + .setExpiryNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), comp, + timeout, this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Sets the time a blob will expire and be deleted. - * + * * @param expiryOptions Required. Indicates mode of the expiry time. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -9495,13 +9734,17 @@ public ResponseBase setExpiryWithResponse(PathExpir Integer timeout, String requestId, String expiresOn, Context context) { final String comp = "expiry"; final String accept = "application/json"; - return service.setExpirySync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), comp, - timeout, this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context); + try { + return service.setExpirySync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), comp, + timeout, this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Sets the time a blob will expire and be deleted. - * + * * @param expiryOptions Required. Indicates mode of the expiry time. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -9520,7 +9763,7 @@ public void setExpiry(PathExpiryOptions expiryOptions, Integer timeout, String r /** * Sets the time a blob will expire and be deleted. - * + * * @param expiryOptions Required. Indicates mode of the expiry time. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting @@ -9539,14 +9782,18 @@ public Response setExpiryNoCustomHeadersWithResponse(PathExpiryOptions exp String requestId, String expiresOn, Context context) { final String comp = "expiry"; final String accept = "application/json"; - return service.setExpiryNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), comp, timeout, this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, - context); + try { + return service.setExpiryNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), comp, timeout, this.client.getVersion(), requestId, expiryOptions, expiresOn, + accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Undelete a path that was previously soft deleted. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -9564,14 +9811,16 @@ public Mono> undeleteWithResponseAsync( String undeleteSource, String requestId) { final String comp = "undelete"; final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.undelete(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), comp, - timeout, undeleteSource, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext( + context -> service.undelete(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), + comp, timeout, undeleteSource, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Undelete a path that was previously soft deleted. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -9590,13 +9839,15 @@ public Mono> undeleteWithResponseAsync( String undeleteSource, String requestId, Context context) { final String comp = "undelete"; final String accept = "application/json"; - return service.undelete(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), comp, timeout, - undeleteSource, this.client.getVersion(), requestId, accept, context); + return service + .undelete(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), comp, timeout, + undeleteSource, this.client.getVersion(), requestId, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Undelete a path that was previously soft deleted. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -9611,12 +9862,14 @@ public Mono> undeleteWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono undeleteAsync(Integer timeout, String undeleteSource, String requestId) { - return undeleteWithResponseAsync(timeout, undeleteSource, requestId).flatMap(ignored -> Mono.empty()); + return undeleteWithResponseAsync(timeout, undeleteSource, requestId) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Undelete a path that was previously soft deleted. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -9632,12 +9885,14 @@ public Mono undeleteAsync(Integer timeout, String undeleteSource, String r */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono undeleteAsync(Integer timeout, String undeleteSource, String requestId, Context context) { - return undeleteWithResponseAsync(timeout, undeleteSource, requestId, context).flatMap(ignored -> Mono.empty()); + return undeleteWithResponseAsync(timeout, undeleteSource, requestId, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Undelete a path that was previously soft deleted. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -9655,14 +9910,16 @@ public Mono> undeleteNoCustomHeadersWithResponseAsync(Integer tim String requestId) { final String comp = "undelete"; final String accept = "application/json"; - return FluxUtil.withContext(context -> service.undeleteNoCustomHeaders(this.client.getUrl(), - this.client.getFileSystem(), this.client.getPath(), comp, timeout, undeleteSource, this.client.getVersion(), - requestId, accept, context)); + return FluxUtil + .withContext(context -> service.undeleteNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), comp, timeout, undeleteSource, this.client.getVersion(), requestId, accept, + context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Undelete a path that was previously soft deleted. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -9681,13 +9938,15 @@ public Mono> undeleteNoCustomHeadersWithResponseAsync(Integer tim String requestId, Context context) { final String comp = "undelete"; final String accept = "application/json"; - return service.undeleteNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), - comp, timeout, undeleteSource, this.client.getVersion(), requestId, accept, context); + return service + .undeleteNoCustomHeaders(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), comp, + timeout, undeleteSource, this.client.getVersion(), requestId, accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException); } /** * Undelete a path that was previously soft deleted. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -9706,13 +9965,17 @@ public ResponseBase undeleteWithResponse(Integer tim String requestId, Context context) { final String comp = "undelete"; final String accept = "application/json"; - return service.undeleteSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), comp, - timeout, undeleteSource, this.client.getVersion(), requestId, accept, context); + try { + return service.undeleteSync(this.client.getUrl(), this.client.getFileSystem(), this.client.getPath(), comp, + timeout, undeleteSource, this.client.getVersion(), requestId, accept, context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * Undelete a path that was previously soft deleted. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -9731,7 +9994,7 @@ public void undelete(Integer timeout, String undeleteSource, String requestId) { /** * Undelete a path that was previously soft deleted. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. @@ -9750,7 +10013,12 @@ public Response undeleteNoCustomHeadersWithResponse(Integer timeout, Strin Context context) { final String comp = "undelete"; final String accept = "application/json"; - return service.undeleteNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), - this.client.getPath(), comp, timeout, undeleteSource, this.client.getVersion(), requestId, accept, context); + try { + return service.undeleteNoCustomHeadersSync(this.client.getUrl(), this.client.getFileSystem(), + this.client.getPath(), comp, timeout, undeleteSource, this.client.getVersion(), requestId, accept, + context); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/ServicesImpl.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/ServicesImpl.java index aaf199beb2e1..f22d6462d40f 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/ServicesImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.file.datalake.implementation; import com.azure.core.annotation.ExpectedResponses; @@ -28,11 +27,13 @@ import com.azure.storage.file.datalake.implementation.models.FileSystemList; import com.azure.storage.file.datalake.implementation.models.ServicesListFileSystemsHeaders; import reactor.core.publisher.Mono; +import com.azure.storage.file.datalake.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in Services. */ public final class ServicesImpl { + /** * The proxy service used to perform REST calls. */ @@ -45,7 +46,7 @@ public final class ServicesImpl { /** * Initializes an instance of ServicesImpl. - * + * * @param client the instance of the service client containing this operation class. */ ServicesImpl(AzureDataLakeStorageRestAPIImpl client) { @@ -60,6 +61,7 @@ public final class ServicesImpl { @Host("{url}") @ServiceInterface(name = "AzureDataLakeStorage") public interface ServicesService { + @Get("/") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(DataLakeStorageExceptionInternal.class) @@ -99,9 +101,9 @@ Response listFileSystemsNoCustomHeadersSync(@HostParam("url") St /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -127,15 +129,16 @@ public Mono> listFileSystemsSinglePageAsync(String pre return FluxUtil .withContext(context -> service.listFileSystems(this.client.getUrl(), resource, prefix, continuation, maxResults, requestId, timeout, this.client.getVersion(), accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getFilesystems(), null, res.getDeserializedHeaders())); } /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -162,15 +165,16 @@ public Mono> listFileSystemsSinglePageAsync(String pre return service .listFileSystems(this.client.getUrl(), resource, prefix, continuation, maxResults, requestId, timeout, this.client.getVersion(), accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getFilesystems(), null, res.getDeserializedHeaders())); } /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -197,9 +201,9 @@ public PagedFlux listFileSystemsAsync(String prefix, String continua /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -227,9 +231,9 @@ public PagedFlux listFileSystemsAsync(String prefix, String continua /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -255,15 +259,16 @@ public Mono> listFileSystemsNoCustomHeadersSinglePageA return FluxUtil .withContext(context -> service.listFileSystemsNoCustomHeaders(this.client.getUrl(), resource, prefix, continuation, maxResults, requestId, timeout, this.client.getVersion(), accept, context)) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getFilesystems(), null, null)); } /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -290,15 +295,16 @@ public Mono> listFileSystemsNoCustomHeadersSinglePageA return service .listFileSystemsNoCustomHeaders(this.client.getUrl(), resource, prefix, continuation, maxResults, requestId, timeout, this.client.getVersion(), accept, context) + .onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getFilesystems(), null, null)); } /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -325,9 +331,9 @@ public PagedFlux listFileSystemsNoCustomHeadersAsync(String prefix, /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -355,9 +361,9 @@ public PagedFlux listFileSystemsNoCustomHeadersAsync(String prefix, /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -383,15 +389,19 @@ public PagedResponse listFileSystemsSinglePage(String prefix, String ResponseBase res = service.listFileSystemsSync(this.client.getUrl(), resource, prefix, continuation, maxResults, requestId, timeout, this.client.getVersion(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getFilesystems(), null, res.getDeserializedHeaders()); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getFilesystems(), null, res.getDeserializedHeaders()); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -418,15 +428,19 @@ public PagedResponse listFileSystemsSinglePage(String prefix, String ResponseBase res = service.listFileSystemsSync(this.client.getUrl(), resource, prefix, continuation, maxResults, requestId, timeout, this.client.getVersion(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getFilesystems(), null, res.getDeserializedHeaders()); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getFilesystems(), null, res.getDeserializedHeaders()); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -453,9 +467,9 @@ public PagedIterable listFileSystems(String prefix, String continuat /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -483,9 +497,9 @@ public PagedIterable listFileSystems(String prefix, String continuat /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -510,15 +524,19 @@ public PagedResponse listFileSystemsNoCustomHeadersSinglePage(String final String accept = "application/json"; Response res = service.listFileSystemsNoCustomHeadersSync(this.client.getUrl(), resource, prefix, continuation, maxResults, requestId, timeout, this.client.getVersion(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getFilesystems(), null, null); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getFilesystems(), null, null); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -544,15 +562,19 @@ public PagedResponse listFileSystemsNoCustomHeadersSinglePage(String final String accept = "application/json"; Response res = service.listFileSystemsNoCustomHeadersSync(this.client.getUrl(), resource, prefix, continuation, maxResults, requestId, timeout, this.client.getVersion(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getFilesystems(), null, null); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getFilesystems(), null, null); + } catch (DataLakeStorageExceptionInternal internalException) { + throw ModelHelper.mapToDataLakeStorageException(internalException); + } } /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned @@ -579,9 +601,9 @@ public PagedIterable listFileSystemsNoCustomHeaders(String prefix, S /** * List FileSystems - * + * * List filesystems and their properties in given account. - * + * * @param prefix Filters results to filesystems within the specified prefix. * @param continuation Optional. When deleting a directory, the number of paths that are deleted with each * invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java index 155b0e25bfdb..91dd6be1332c 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/DataLakeImplUtils.java @@ -5,12 +5,10 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.models.BlobStorageException; -import com.azure.storage.file.datalake.implementation.models.DataLakeStorageExceptionInternal; import com.azure.storage.file.datalake.models.DataLakeStorageException; import reactor.core.Exceptions; import java.util.List; -import java.util.concurrent.Callable; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -57,13 +55,4 @@ public static T returnOrConvertException(Supplier supplier, ClientLogger } } - public static Callable wrapServiceCallWithExceptionMapping(Supplier serviceCall) { - return () -> { - try { - return serviceCall.get(); - } catch (DataLakeStorageExceptionInternal internal) { - throw (DataLakeStorageException) ModelHelper.mapToDataLakeStorageException(internal); - } - }; - } } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/ModelHelper.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/ModelHelper.java index c4042c44331a..74b16d85dfba 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/ModelHelper.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/ModelHelper.java @@ -197,13 +197,7 @@ public static String buildMetadataString(Map metadata) { * @param internal The internal exception. * @return The public exception. */ - public static Throwable mapToDataLakeStorageException(Throwable internal) { - if (internal instanceof DataLakeStorageExceptionInternal) { - DataLakeStorageExceptionInternal internalException = (DataLakeStorageExceptionInternal) internal; - return new DataLakeStorageException(internalException.getMessage(), internalException.getResponse(), - internalException.getValue()); - } - - return internal; + public static DataLakeStorageException mapToDataLakeStorageException(DataLakeStorageExceptionInternal internal) { + return new DataLakeStorageException(internal.getMessage(), internal.getResponse(), internal.getValue()); } } diff --git a/sdk/storage/azure-storage-file-datalake/swagger/src/main/java/DataLakeStorageCustomization.java b/sdk/storage/azure-storage-file-datalake/swagger/src/main/java/DataLakeStorageCustomization.java index de49dd7aa246..8502908cd9f5 100644 --- a/sdk/storage/azure-storage-file-datalake/swagger/src/main/java/DataLakeStorageCustomization.java +++ b/sdk/storage/azure-storage-file-datalake/swagger/src/main/java/DataLakeStorageCustomization.java @@ -6,11 +6,23 @@ import com.azure.autorest.customization.LibraryCustomization; import com.azure.autorest.customization.PackageCustomization; import com.azure.autorest.customization.JavadocCustomization; +import com.github.javaparser.ParseProblemException; import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.CatchClause; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.stmt.TryStmt; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.ast.type.Type; import org.slf4j.Logger; +import java.util.Arrays; +import java.util.List; + /** * Customization class for File DataLake Storage. */ @@ -165,6 +177,8 @@ public void customize(LibraryCustomization customization, Logger logger) { JavadocCustomization setActiveJavadoc = path.getMethod("fromJson").getJavadoc(); setActiveJavadoc.addThrows("IllegalStateException", "If a token is not an allowed type."); + + updateImplToMapInternalException(customization.getPackage("com.azure.storage.file.datalake.implementation")); } private static void replaceMethodToJson(ClassOrInterfaceDeclaration clazz, String newBody) { @@ -186,4 +200,109 @@ private static void replaceMethodFromXml(ClassOrInterfaceDeclaration clazz, Stri MethodDeclaration method = clazz.getMethodsBySignature("fromXml", "XmlReader", "String").get(0); method.setBody(StaticJavaParser.parseBlock(newBody)); } + + /** + * Customizes the implementation classes that will perform calls to the service. The following logic is used: + *

+ * - Check for the return of the method not equaling to PagedFlux, PagedIterable, PollerFlux, or SyncPoller. Those + * types wrap other APIs and those APIs being update is the correct change. + * - For asynchronous methods, add a call to + * {@code .onErrorMap(DataLakeStorageException.class, ModelHelper::mapToDataLakeStorageException)} to + * handle mapping DataLakeStorageExceptionInternal to DataLakeStorageException. + * - For synchronous methods, wrap the return statement in a try-catch block that catches + * DataLakeStorageExceptionInternal and rethrows {@code ModelHelper.mapToDataLakeStorageException(e)}. Or, for void + * methods wrap the last statement. + * + * @param implPackage The implementation package. + */ + private static void updateImplToMapInternalException(PackageCustomization implPackage) { + List implsToUpdate = Arrays.asList("FileSystemsImpl", "PathsImpl", "ServicesImpl"); + for (String implToUpdate : implsToUpdate) { + implPackage.getClass(implToUpdate).customizeAst(ast -> { + ast.addImport("com.azure.storage.file.datalake.implementation.util.ModelHelper"); + ast.addImport("com.azure.storage.file.datalake.models.DataLakeStorageException"); + ast.addImport("com.azure.storage.file.datalake.implementation.models.DataLakeStorageExceptionInternal"); + ast.getClassByName(implToUpdate).ifPresent(clazz -> { + clazz.getFields(); + + clazz.getMethods().forEach(methodDeclaration -> { + Type returnType = methodDeclaration.getType(); + // The way code generation works we only need to update the methods that have a class return type. + // As non-class return types, such as "void", call into the Response methods. + if (!returnType.isClassOrInterfaceType()) { + return; + } + + ClassOrInterfaceType returnTypeClass = returnType.asClassOrInterfaceType(); + String returnTypeName = returnTypeClass.getNameAsString(); + if (returnTypeName.equals("PagedFlux") || returnTypeName.equals("PagedIterable") + || returnTypeName.equals("PollerFlux") || returnTypeName.equals("SyncPoller")) { + return; + } + + if (returnTypeName.equals("Mono") || returnTypeName.equals("Flux")) { + addErrorMappingToAsyncMethod(methodDeclaration); + } else { + addErrorMappingToSyncMethod(methodDeclaration); + } + }); + }); + }); + } + } + + private static void addErrorMappingToAsyncMethod(MethodDeclaration method) { + BlockStmt body = method.getBody().get(); + + // Bit of hack to insert the 'onErrorMap' in the right location. + // Unfortunately, 'onErrorMap' returns which for some calls breaks typing, such as Void -> Object or + // PagedResponse -> PagedResponseBase. So, 'onErrorMap' needs to be inserted after the first method call. + // To do this, we track the first found '(' and the associated closing ')' to insert 'onErrorMap' after the ')'. + // So, 'service.methodCall(parameters).map()' becomes 'service.methodCall(parameters).onErrorMap().map()'. + String originalReturnStatement = body.getStatement(body.getStatements().size() - 1).asReturnStmt() + .getExpression().get().toString(); + int insertionPoint = findAsyncOnErrorMapInsertionPoint(originalReturnStatement); + String newReturnStatement = "return " + originalReturnStatement.substring(0, insertionPoint) + + ".onErrorMap(DataLakeStorageExceptionInternal.class, ModelHelper::mapToDataLakeStorageException)" + + originalReturnStatement.substring(insertionPoint) + ";"; + try { + Statement newReturn = StaticJavaParser.parseStatement(newReturnStatement); + body.getStatements().set(body.getStatements().size() - 1, newReturn); + } catch (ParseProblemException ex) { + throw new RuntimeException("Failed to parse: " + newReturnStatement, ex); + } + } + + private static int findAsyncOnErrorMapInsertionPoint(String returnStatement) { + int openParenthesis = 0; + int closeParenthesis = 0; + for (int i = 0; i < returnStatement.length(); i++) { + char c = returnStatement.charAt(i); + if (c == '(') { + openParenthesis++; + } else if (c == ')') { + closeParenthesis++; + if (openParenthesis == closeParenthesis) { + return i + 1; + } + } + } + return -1; + } + + private static void addErrorMappingToSyncMethod(MethodDeclaration method) { + BlockStmt body = method.getBody().get(); + + // Turn the last statement into a BlockStmt that will be used as the try block. + BlockStmt tryBlock = new BlockStmt(new NodeList<>(body.getStatement(body.getStatements().size() - 1))); + BlockStmt catchBlock = new BlockStmt(new NodeList<>(StaticJavaParser.parseStatement( + "throw ModelHelper.mapToDataLakeStorageException(internalException);"))); + Parameter catchParameter = new Parameter().setType("DataLakeStorageExceptionInternal") + .setName("internalException"); + CatchClause catchClause = new CatchClause(catchParameter, catchBlock); + TryStmt tryCatchMap = new TryStmt(tryBlock, new NodeList<>(catchClause), null); + + // Replace the last statement with the try-catch block. + body.getStatements().set(body.getStatements().size() - 1, tryCatchMap); + } } diff --git a/sdk/storage/azure-storage-file-share/checkstyle-suppressions.xml b/sdk/storage/azure-storage-file-share/checkstyle-suppressions.xml index 536c2cb61b0b..92c75cee61fa 100644 --- a/sdk/storage/azure-storage-file-share/checkstyle-suppressions.xml +++ b/sdk/storage/azure-storage-file-share/checkstyle-suppressions.xml @@ -18,4 +18,14 @@ + + + + + + + + + + diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java index ed9cae6362f8..dd4868aee881 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java @@ -376,7 +376,6 @@ Mono> createWithResponse(ShareCreateOptions options, Context options.getAccessTier(), enabledProtocol, options.getRootSquash(), options.isSnapshotVirtualDirectoryAccessEnabled(), options.isPaidBurstingEnabled(), options.getPaidBurstingMaxBandwidthMibps(), options.getPaidBurstingMaxIops(), context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(ModelHelper::mapToShareInfoResponse); } @@ -526,7 +525,6 @@ public Mono> createSnapshotWithResponse(Map> createSnapshotWithResponse(Map metadata, Context context) { context = context == null ? Context.NONE : context; return azureFileStorageClient.getShares().createSnapshotWithResponseAsync(shareName, null, metadata, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(ModelHelper::mapCreateSnapshotResponse); } @@ -628,8 +626,7 @@ Mono> deleteWithResponse(ShareDeleteOptions options, Context cont context = context == null ? Context.NONE : context; return azureFileStorageClient.getShares().deleteNoCustomHeadersWithResponseAsync(shareName, snapshot, null, ModelHelper.toDeleteSnapshotsOptionType(options.getDeleteSnapshotsOptions()), - requestConditions.getLeaseId(), context) - .onErrorMap(ModelHelper::mapToShareStorageException); + requestConditions.getLeaseId(), context); } /** @@ -810,7 +807,6 @@ Mono> getPropertiesWithResponse(ShareGetPropertiesOpti context = context == null ? Context.NONE : context; return azureFileStorageClient.getShares() .getPropertiesWithResponseAsync(shareName, snapshot, null, requestConditions.getLeaseId(), context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(ModelHelper::mapGetPropertiesResponse); } @@ -945,7 +941,6 @@ Mono> setPropertiesWithResponse(ShareSetPropertiesOptions op options.getQuotaInGb(), options.getAccessTier(), requestConditions.getLeaseId(), options.getRootSquash(), options.isSnapshotVirtualDirectoryAccessEnabled(), options.isPaidBurstingEnabled(), options.getPaidBurstingMaxBandwidthMibps(), options.getPaidBurstingMaxIops(), context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(ModelHelper::mapToShareInfoResponse); } @@ -1070,7 +1065,6 @@ Mono> setMetadataWithResponse(ShareSetMetadataOptions option context = context == null ? Context.NONE : context; return azureFileStorageClient.getShares().setMetadataNoCustomHeadersWithResponseAsync(shareName, null, options.getMetadata(), requestConditions.getLeaseId(), context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(ModelHelper::mapToShareInfoResponse); } @@ -1135,7 +1129,6 @@ public PagedFlux getAccessPolicy(ShareGetAccessPolicyOpti marker -> this.azureFileStorageClient.getShares() .getAccessPolicyWithResponseAsync(shareName, null, requestConditions.getLeaseId(), Context.NONE) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), @@ -1266,7 +1259,6 @@ Mono> setAccessPolicyWithResponse(ShareSetAccessPolicyOption return azureFileStorageClient.getShares().setAccessPolicyNoCustomHeadersWithResponseAsync(shareName, null, requestConditions.getLeaseId(), permissions, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(ModelHelper::mapToShareInfoResponse); } @@ -1358,7 +1350,6 @@ Mono> getStatisticsWithResponse(ShareGetStatisticsOpti context = context == null ? Context.NONE : context; return azureFileStorageClient.getShares().getStatisticsNoCustomHeadersWithResponseAsync(shareName, null, requestConditions.getLeaseId(), context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(ModelHelper::mapGetStatisticsResponse); } @@ -2144,10 +2135,10 @@ public Mono> createPermissionWithResponse(ShareFilePermission f Mono> createPermissionWithResponse(String filePermission, FilePermissionFormat filePermissionFormat, Context context) { // NOTE: Should we check for null or empty? - SharePermission sharePermission = new SharePermission().setPermission(filePermission).setFormat(filePermissionFormat); + SharePermission sharePermission = new SharePermission().setPermission(filePermission) + .setFormat(filePermissionFormat); return azureFileStorageClient.getShares() .createPermissionWithResponseAsync(shareName, sharePermission, null, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> new SimpleResponse<>(response, response.getDeserializedHeaders().getXMsFilePermissionKey())); } @@ -2255,7 +2246,6 @@ Mono> getPermissionWithResponse(String filePermissionKey, FileP Context context) { return azureFileStorageClient.getShares() .getPermissionWithResponseAsync(shareName, filePermissionKey, filePermissionFormat, null, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> new SimpleResponse<>(response, response.getValue().getPermission())); } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java index 7fc1a899dcc0..e61fa58dcf0e 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java @@ -64,8 +64,6 @@ import java.util.function.Supplier; import static com.azure.storage.common.implementation.StorageImplUtils.sendRequest; -import static com.azure.storage.file.share.implementation.util.ModelHelper.wrapServiceCallWithExceptionMapping; -import static com.azure.storage.file.share.implementation.util.ModelHelper.wrapTimeoutServiceCallWithExceptionMapping; /** * This class provides a client that contains all the operations for interacting with a share in Azure Storage Share. @@ -364,11 +362,11 @@ public Response createWithResponse(ShareCreateOptions options, Durati String enabledProtocol = finalOptions.getProtocols() == null ? null : finalOptions.getProtocols().toString(); String finalEnabledProtocol = "".equals(enabledProtocol) ? null : enabledProtocol; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> azureFileStorageClient.getShares() + Callable> operation = () -> azureFileStorageClient.getShares() .createNoCustomHeadersWithResponse(shareName, null, finalOptions.getMetadata(), finalOptions.getQuotaInGb(), finalOptions.getAccessTier(), finalEnabledProtocol, finalOptions.getRootSquash(), finalOptions.isSnapshotVirtualDirectoryAccessEnabled(), finalOptions.isPaidBurstingEnabled(), - finalOptions.getPaidBurstingMaxBandwidthMibps(), finalOptions.getPaidBurstingMaxIops(), finalContext)); + finalOptions.getPaidBurstingMaxBandwidthMibps(), finalOptions.getPaidBurstingMaxIops(), finalContext); return ModelHelper.mapToShareInfoResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -503,9 +501,8 @@ public ShareSnapshotInfo createSnapshot() { public Response createSnapshotWithResponse(Map metadata, Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> - this.azureFileStorageClient.getShares().createSnapshotWithResponse(shareName, null, metadata, - finalContext)); + Callable> operation = () -> azureFileStorageClient.getShares() + .createSnapshotWithResponse(shareName, null, metadata, finalContext); return ModelHelper.mapCreateSnapshotResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -597,10 +594,10 @@ public Response deleteWithResponse(ShareDeleteOptions options, Duration ti ShareRequestConditions requestConditions = finalOptions.getRequestConditions() == null ? new ShareRequestConditions() : finalOptions.getRequestConditions(); - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> - this.azureFileStorageClient.getShares().deleteNoCustomHeadersWithResponse(shareName, snapshot, null, + Callable> operation = () -> this.azureFileStorageClient.getShares() + .deleteNoCustomHeadersWithResponse(shareName, snapshot, null, ModelHelper.toDeleteSnapshotsOptionType(finalOptions.getDeleteSnapshotsOptions()), - requestConditions.getLeaseId(), finalContext)); + requestConditions.getLeaseId(), finalContext); return sendRequest(operation, timeout, ShareStorageException.class); } @@ -764,9 +761,8 @@ public Response getPropertiesWithResponse(ShareGetPropertiesOpt Context finalContext = context == null ? Context.NONE : context; ShareRequestConditions requestConditions = options.getRequestConditions() == null ? new ShareRequestConditions() : options.getRequestConditions(); - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> - this.azureFileStorageClient.getShares() - .getPropertiesWithResponse(shareName, snapshot, null, requestConditions.getLeaseId(), finalContext)); + Callable> operation = () -> azureFileStorageClient.getShares() + .getPropertiesWithResponse(shareName, snapshot, null, requestConditions.getLeaseId(), finalContext); return ModelHelper.mapGetPropertiesResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -891,12 +887,11 @@ public Response setPropertiesWithResponse(ShareSetPropertiesOptions o ? new ShareRequestConditions() : options.getRequestConditions(); Context finalContext = context == null ? Context.NONE : context; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> - this.azureFileStorageClient.getShares().setPropertiesNoCustomHeadersWithResponse(shareName, null, - options.getQuotaInGb(), options.getAccessTier(), requestConditions.getLeaseId(), - options.getRootSquash(), options.isSnapshotVirtualDirectoryAccessEnabled(), - options.isPaidBurstingEnabled(), options.getPaidBurstingMaxBandwidthMibps(), - options.getPaidBurstingMaxIops(), finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getShares() + .setPropertiesNoCustomHeadersWithResponse(shareName, null, options.getQuotaInGb(), options.getAccessTier(), + requestConditions.getLeaseId(), options.getRootSquash(), + options.isSnapshotVirtualDirectoryAccessEnabled(), options.isPaidBurstingEnabled(), + options.getPaidBurstingMaxBandwidthMibps(), options.getPaidBurstingMaxIops(), finalContext); return ModelHelper.mapToShareInfoResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -1012,9 +1007,9 @@ public Response setMetadataWithResponse(ShareSetMetadataOptions optio ? new ShareRequestConditions() : options.getRequestConditions(); Context finalContext = context == null ? Context.NONE : context; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getShares().setMetadataNoCustomHeadersWithResponse(shareName, null, - options.getMetadata(), requestConditions.getLeaseId(), finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getShares() + .setMetadataNoCustomHeadersWithResponse(shareName, null, options.getMetadata(), + requestConditions.getLeaseId(), finalContext); return ModelHelper.mapToShareInfoResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -1077,9 +1072,9 @@ public PagedIterable getAccessPolicy(ShareGetAccessPolicy ShareRequestConditions requestConditions = finalOptions.getRequestConditions() == null ? new ShareRequestConditions() : finalOptions.getRequestConditions(); - ResponseBase responseBase = - wrapServiceCallWithExceptionMapping(() -> this.azureFileStorageClient.getShares() - .getAccessPolicyWithResponse(shareName, null, requestConditions.getLeaseId(), Context.NONE)); + ResponseBase responseBase + = this.azureFileStorageClient.getShares().getAccessPolicyWithResponse(shareName, null, + requestConditions.getLeaseId(), Context.NONE); Supplier> response = () -> new PagedResponseBase<>( responseBase.getRequest(), @@ -1212,9 +1207,9 @@ public Response setAccessPolicyWithResponse(ShareSetAccessPolicyOptio ModelHelper.truncateAccessPolicyPermissionsToSeconds(options.getPermissions()); Context finalContext = context == null ? Context.NONE : context; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> - this.azureFileStorageClient.getShares().setAccessPolicyNoCustomHeadersWithResponse(shareName, null, - requestConditions.getLeaseId(), permissions, finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getShares() + .setAccessPolicyNoCustomHeadersWithResponse(shareName, null, requestConditions.getLeaseId(), permissions, + finalContext); return ModelHelper.mapToShareInfoResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -1306,9 +1301,8 @@ public Response getStatisticsWithResponse(ShareGetStatisticsOpt ? new ShareRequestConditions() : options.getRequestConditions(); Context finalContext = context == null ? Context.NONE : context; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> - this.azureFileStorageClient.getShares().getStatisticsNoCustomHeadersWithResponse(shareName, null, - requestConditions.getLeaseId(), finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getShares() + .getStatisticsNoCustomHeadersWithResponse(shareName, null, requestConditions.getLeaseId(), finalContext); return ModelHelper.mapGetStatisticsResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -1976,9 +1970,8 @@ public String createPermission(ShareFilePermission filePermission) { public Response createPermissionWithResponse(String filePermission, Context context) { Context finalContext = context == null ? Context.NONE : context; SharePermission sharePermission = new SharePermission().setPermission(filePermission); - ResponseBase response = wrapServiceCallWithExceptionMapping(() -> - this.azureFileStorageClient.getShares().createPermissionWithResponse(shareName, sharePermission, null, - finalContext)); + ResponseBase response = this.azureFileStorageClient.getShares() + .createPermissionWithResponse(shareName, sharePermission, null, finalContext); return new SimpleResponse<>(response, response.getDeserializedHeaders().getXMsFilePermissionKey()); } @@ -2007,9 +2000,8 @@ public Response createPermissionWithResponse(ShareFilePermission filePer Context finalContext = context == null ? Context.NONE : context; SharePermission sharePermission = new SharePermission().setPermission(filePermission.getPermission()) .setFormat(filePermission.getPermissionFormat()); - ResponseBase response = wrapServiceCallWithExceptionMapping(() -> - this.azureFileStorageClient.getShares().createPermissionWithResponse(shareName, sharePermission, null, - finalContext)); + ResponseBase response = this.azureFileStorageClient.getShares() + .createPermissionWithResponse(shareName, sharePermission, null, finalContext); return new SimpleResponse<>(response, response.getDeserializedHeaders().getXMsFilePermissionKey()); } @@ -2078,9 +2070,8 @@ public String getPermission(String filePermissionKey, FilePermissionFormat fileP @ServiceMethod(returns = ReturnType.SINGLE) public Response getPermissionWithResponse(String filePermissionKey, Context context) { Context finalContext = context == null ? Context.NONE : context; - ResponseBase response = wrapServiceCallWithExceptionMapping(() -> - this.azureFileStorageClient.getShares().getPermissionWithResponse(shareName, filePermissionKey, null, null, - finalContext)); + ResponseBase response = this.azureFileStorageClient.getShares() + .getPermissionWithResponse(shareName, filePermissionKey, null, null, finalContext); return new SimpleResponse<>(response, response.getValue().getPermission()); } @@ -2110,9 +2101,8 @@ public Response getPermissionWithResponse(String filePermissionKey, Cont @ServiceMethod(returns = ReturnType.SINGLE) public Response getPermissionWithResponse(String filePermissionKey, FilePermissionFormat filePermissionFormat, Context context) { Context finalContext = context == null ? Context.NONE : context; - ResponseBase response = wrapServiceCallWithExceptionMapping(() -> - this.azureFileStorageClient.getShares().getPermissionWithResponse(shareName, filePermissionKey, - filePermissionFormat, null, finalContext)); + ResponseBase response = this.azureFileStorageClient.getShares() + .getPermissionWithResponse(shareName, filePermissionKey, filePermissionFormat, null, finalContext); return new SimpleResponse<>(response, response.getValue().getPermission()); } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareDirectoryAsyncClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareDirectoryAsyncClient.java index e012dc83fe09..476467fa2f2a 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareDirectoryAsyncClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareDirectoryAsyncClient.java @@ -25,12 +25,12 @@ import com.azure.storage.file.share.implementation.AzureFileStorageImpl; import com.azure.storage.file.share.implementation.models.CopyFileSmbInfo; import com.azure.storage.file.share.implementation.models.DestinationLeaseAccessConditions; -import com.azure.storage.file.share.models.FilePermissionFormat; import com.azure.storage.file.share.implementation.models.ListFilesIncludeType; import com.azure.storage.file.share.implementation.models.SourceLeaseAccessConditions; import com.azure.storage.file.share.implementation.util.ModelHelper; import com.azure.storage.file.share.implementation.util.ShareSasImplUtil; import com.azure.storage.file.share.models.CloseHandlesInfo; +import com.azure.storage.file.share.models.FilePermissionFormat; import com.azure.storage.file.share.models.HandleItem; import com.azure.storage.file.share.models.NtfsFileAttributes; import com.azure.storage.file.share.models.ShareDirectoryInfo; @@ -378,7 +378,6 @@ Mono> createWithResponse(FileSmbProperties smbPrope return azureFileStorageClient.getDirectories() .createWithResponseAsync(shareName, directoryPath, fileAttributes, null, metadata, filePermission, filePermissionFormat, filePermissionKey, fileCreationTime, fileLastWriteTime, fileChangeTime, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(ModelHelper::mapShareDirectoryInfo); } @@ -533,8 +532,7 @@ public Mono> deleteWithResponse() { Mono> deleteWithResponse(Context context) { context = context == null ? Context.NONE : context; return azureFileStorageClient.getDirectories() - .deleteNoCustomHeadersWithResponseAsync(shareName, directoryPath, null, context) - .onErrorMap(ModelHelper::mapToShareStorageException); + .deleteNoCustomHeadersWithResponseAsync(shareName, directoryPath, null, context); } /** @@ -673,7 +671,6 @@ Mono> getPropertiesWithResponse(Context conte context = context == null ? Context.NONE : context; return azureFileStorageClient.getDirectories() .getPropertiesWithResponseAsync(shareName, directoryPath, snapshot, null, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(ModelHelper::mapShareDirectoryPropertiesResponse); } @@ -797,7 +794,6 @@ Mono> setPropertiesWithResponse(FileSmbProperties s return azureFileStorageClient.getDirectories() .setPropertiesWithResponseAsync(shareName, directoryPath, fileAttributes, null, filePermission, filePermissionFormat, filePermissionKey, fileCreationTime, fileLastWriteTime, fileChangeTime, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(ModelHelper::mapSetPropertiesResponse); } @@ -888,7 +884,6 @@ Mono> setMetadataWithResponse(Map listFilesAndDirectoriesWithOptionalTimeout( modifiedOptions.getPrefix(), snapshot, marker, pageSize == null ? modifiedOptions.getMaxResultsPerPage() : pageSize, null, finalIncludeTypes, modifiedOptions.includeExtendedInfo(), context), timeout) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), ModelHelper.convertResponseAndGetNumOfResults(response), response.getValue().getNextMarker(), null)); @@ -1065,7 +1059,6 @@ PagedFlux listHandlesWithOptionalTimeout(Integer maxResultPerPage, b marker -> StorageImplUtils.applyOptionalTimeout(this.azureFileStorageClient.getDirectories() .listHandlesWithResponseAsync(shareName, directoryPath, marker, maxResultPerPage, null, snapshot, recursive, context), timeout) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), @@ -1138,7 +1131,6 @@ public Mono> forceCloseHandleWithResponse(String hand Mono> forceCloseHandleWithResponse(String handleId, Context context) { return this.azureFileStorageClient.getDirectories().forceCloseHandlesWithResponseAsync(shareName, directoryPath, handleId, null, null, snapshot, false, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> new SimpleResponse<>(response, new CloseHandlesInfo(response.getDeserializedHeaders().getXMsNumberOfHandlesClosed(), response.getDeserializedHeaders().getXMsNumberOfHandlesFailed()))); @@ -1183,7 +1175,6 @@ PagedFlux forceCloseAllHandlesWithTimeout(boolean recursive, D marker -> StorageImplUtils.applyOptionalTimeout(this.azureFileStorageClient.getDirectories() .forceCloseHandlesWithResponseAsync(shareName, directoryPath, "*", null, marker, snapshot, recursive, context), timeout) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), @@ -1306,7 +1297,6 @@ Mono> renameWithResponse(ShareFileRenameOpti null /* timeout */, options.getReplaceIfExists(), options.isIgnoreReadOnly(), options.getFilePermission(), options.getFilePermissionFormat(), filePermissionKey, options.getMetadata(), sourceConditions, destinationConditions, smbInfo, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> new SimpleResponse<>(response, destinationDirectoryClient)); } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareDirectoryClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareDirectoryClient.java index 70dc18a709c6..fd97bb0f30f1 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareDirectoryClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareDirectoryClient.java @@ -67,7 +67,6 @@ import java.util.function.Function; import static com.azure.storage.common.implementation.StorageImplUtils.sendRequest; -import static com.azure.storage.file.share.implementation.util.ModelHelper.wrapTimeoutServiceCallWithExceptionMapping; /** * This class provides a client that contains all the operations for interacting with directory in Azure Storage File @@ -358,11 +357,10 @@ public Response createWithResponse(ShareDirectoryCreateOptio String fileLastWriteTime = properties.setFileLastWriteTime(FileConstants.FILE_TIME_NOW); String fileChangeTime = properties.getFileChangeTimeString(); - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getDirectories() - .createWithResponse(shareName, directoryPath, fileAttributes, null, finalOptions.getMetadata(), - finalFilePermission, finalOptions.getFilePermissionFormat(), filePermissionKey, fileCreationTime, - fileLastWriteTime, fileChangeTime, finalContext)); + Callable> operation = () -> azureFileStorageClient.getDirectories() + .createWithResponse(shareName, directoryPath, fileAttributes, null, finalOptions.getMetadata(), + finalFilePermission, finalOptions.getFilePermissionFormat(), filePermissionKey, fileCreationTime, + fileLastWriteTime, fileChangeTime, finalContext); return ModelHelper.mapShareDirectoryInfo(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -497,9 +495,8 @@ public void delete() { @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getDirectories().deleteNoCustomHeadersWithResponse(shareName, - directoryPath, null, finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getDirectories() + .deleteNoCustomHeadersWithResponse(shareName, directoryPath, null, finalContext); return sendRequest(operation, timeout, ShareStorageException.class); } @@ -626,8 +623,8 @@ public ShareDirectoryProperties getProperties() { public Response getPropertiesWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; Callable> operation - = wrapTimeoutServiceCallWithExceptionMapping(() -> this.azureFileStorageClient.getDirectories() - .getPropertiesWithResponse(shareName, directoryPath, snapshot, null, finalContext)); + = () -> this.azureFileStorageClient.getDirectories().getPropertiesWithResponse(shareName, directoryPath, + snapshot, null, finalContext); return ModelHelper.mapShareDirectoryPropertiesResponse(sendRequest(operation, timeout, ShareStorageException.class)); @@ -706,9 +703,9 @@ public Response setPropertiesWithResponse(FileSmbProperties String fileLastWriteTime = smbProperties.setFileLastWriteTime(FileConstants.PRESERVE); String fileChangeTime = smbProperties.getFileChangeTimeString(); Callable> operation - = wrapTimeoutServiceCallWithExceptionMapping(() -> this.azureFileStorageClient.getDirectories() - .setPropertiesWithResponse(shareName, directoryPath, fileAttributes, null, finalFilePermission, null, - filePermissionKey, fileCreationTime, fileLastWriteTime, fileChangeTime, finalContext)); + = () -> this.azureFileStorageClient.getDirectories().setPropertiesWithResponse(shareName, directoryPath, + fileAttributes, null, finalFilePermission, null, filePermissionKey, fileCreationTime, fileLastWriteTime, + fileChangeTime, finalContext); return ModelHelper.mapSetPropertiesResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -760,10 +757,9 @@ public Response setPropertiesWithResponse(ShareDirectorySetP String fileLastWriteTime = smbProperties.setFileLastWriteTime(FileConstants.PRESERVE); String fileChangeTime = smbProperties.getFileChangeTimeString(); Callable> operation - = wrapTimeoutServiceCallWithExceptionMapping(() -> this.azureFileStorageClient.getDirectories() - .setPropertiesWithResponse(shareName, directoryPath, fileAttributes, null, finalFilePermission, - options.getFilePermissions().getPermissionFormat(), filePermissionKey, fileCreationTime, - fileLastWriteTime, fileChangeTime, finalContext)); + = () -> this.azureFileStorageClient.getDirectories().setPropertiesWithResponse(shareName, directoryPath, + fileAttributes, null, finalFilePermission, options.getFilePermissions().getPermissionFormat(), + filePermissionKey, fileCreationTime, fileLastWriteTime, fileChangeTime, finalContext); return ModelHelper.mapSetPropertiesResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -851,8 +847,8 @@ public Response setMetadataWithResponse(Map> operation - = wrapTimeoutServiceCallWithExceptionMapping(() -> this.azureFileStorageClient.getDirectories() - .setMetadataWithResponse(shareName, directoryPath, null, metadata, finalContext)); + = () -> this.azureFileStorageClient.getDirectories().setMetadataWithResponse(shareName, directoryPath, null, + metadata, finalContext); return ModelHelper.setShareDirectoryMetadataResponse(sendRequest(operation, timeout, ShareStorageException.class)); @@ -982,11 +978,11 @@ public PagedIterable listFilesAndDirectories(ShareListFilesAndDir BiFunction> retriever = (marker, pageSize) -> { Callable> operation - = wrapTimeoutServiceCallWithExceptionMapping(() -> this.azureFileStorageClient.getDirectories() + = () -> this.azureFileStorageClient.getDirectories() .listFilesAndDirectoriesSegmentNoCustomHeadersWithResponse(shareName, directoryPath, modifiedOptions.getPrefix(), snapshot, marker, pageSize == null ? modifiedOptions.getMaxResultsPerPage() : pageSize, null, finalIncludeTypes, - modifiedOptions.includeExtendedInfo(), finalContext)); + modifiedOptions.includeExtendedInfo(), finalContext); Response response = sendRequest(operation, timeout, ShareStorageException.class); @@ -1035,10 +1031,9 @@ PagedIterable listHandlesWithOptionalTimeout(Integer maxResultPerPag Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; Function> retriever = (marker) -> { - Callable> operation = - wrapTimeoutServiceCallWithExceptionMapping(() -> this.azureFileStorageClient.getDirectories() - .listHandlesWithResponse(shareName, directoryPath, marker, maxResultPerPage, null, snapshot, - recursive, finalContext)); + Callable> operation + = () -> this.azureFileStorageClient.getDirectories().listHandlesWithResponse(shareName, directoryPath, + marker, maxResultPerPage, null, snapshot, recursive, finalContext); ResponseBase response = sendRequest(operation, timeout, ShareStorageException.class); @@ -1112,9 +1107,8 @@ public Response forceCloseHandleWithResponse(String handleId, Context finalContext = context == null ? Context.NONE : context; Callable> operation - = wrapTimeoutServiceCallWithExceptionMapping(() -> this.azureFileStorageClient.getDirectories() - .forceCloseHandlesWithResponse(shareName, directoryPath, handleId, null, null, snapshot, false, - finalContext)); + = () -> this.azureFileStorageClient.getDirectories().forceCloseHandlesWithResponse(shareName, directoryPath, + handleId, null, null, snapshot, false, finalContext); ResponseBase response = sendRequest(operation, timeout, ShareStorageException.class); @@ -1156,9 +1150,8 @@ public CloseHandlesInfo forceCloseAllHandles(boolean recursive, Duration timeout Function> retriever = (marker) -> { Callable> operation = - wrapTimeoutServiceCallWithExceptionMapping(() -> this.azureFileStorageClient.getDirectories() - .forceCloseHandlesWithResponse(shareName, directoryPath, "*", null, marker, snapshot, - recursive, finalContext)); + () -> this.azureFileStorageClient.getDirectories().forceCloseHandlesWithResponse(shareName, + directoryPath, "*", null, marker, snapshot, recursive, finalContext); ResponseBase response = sendRequest(operation, timeout, ShareStorageException.class); @@ -1280,12 +1273,12 @@ public Response renameWithResponse(ShareFileRenameOptions String renameSource = this.sasToken != null ? this.getDirectoryUrl() + "?" + this.sasToken.getSignature() : this.getDirectoryUrl(); - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> destinationDirectoryClient.azureFileStorageClient.getDirectories().renameNoCustomHeadersWithResponse( - destinationDirectoryClient.getShareName(), destinationDirectoryClient.getDirectoryPath(), renameSource, - null /* timeout */, options.getReplaceIfExists(), options.isIgnoreReadOnly(), - options.getFilePermission(), options.getFilePermissionFormat(), filePermissionKey, - options.getMetadata(), sourceConditions, destinationConditions, smbInfo, finalContext)); + Callable> operation = () -> destinationDirectoryClient.azureFileStorageClient.getDirectories() + .renameNoCustomHeadersWithResponse(destinationDirectoryClient.getShareName(), + destinationDirectoryClient.getDirectoryPath(), renameSource, null /* timeout */, + options.getReplaceIfExists(), options.isIgnoreReadOnly(), options.getFilePermission(), + options.getFilePermissionFormat(), filePermissionKey, options.getMetadata(), sourceConditions, + destinationConditions, smbInfo, finalContext); return new SimpleResponse<>(sendRequest(operation, timeout, ShareStorageException.class), destinationDirectoryClient); diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileAsyncClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileAsyncClient.java index 837170108041..dfbed517c091 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileAsyncClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileAsyncClient.java @@ -37,7 +37,6 @@ import com.azure.storage.file.share.implementation.AzureFileStorageImpl; import com.azure.storage.file.share.implementation.models.CopyFileSmbInfo; import com.azure.storage.file.share.implementation.models.DestinationLeaseAccessConditions; -import com.azure.storage.file.share.models.FilePermissionFormat; import com.azure.storage.file.share.implementation.models.FilesDownloadHeaders; import com.azure.storage.file.share.implementation.models.FilesStartCopyHeaders; import com.azure.storage.file.share.implementation.models.ShareFileRangeWriteType; @@ -48,6 +47,7 @@ import com.azure.storage.file.share.models.CopyStatusType; import com.azure.storage.file.share.models.CopyableFileSmbPropertiesList; import com.azure.storage.file.share.models.DownloadRetryOptions; +import com.azure.storage.file.share.models.FilePermissionFormat; import com.azure.storage.file.share.models.HandleItem; import com.azure.storage.file.share.models.NtfsFileAttributes; import com.azure.storage.file.share.models.PermissionCopyModeType; @@ -487,7 +487,6 @@ Mono> createWithResponse(long maxSize, ShareFileHttpHead .createWithResponseAsync(shareName, filePath, maxSize, fileAttributes, null, metadata, filePermission, filePermissionFormat, filePermissionKey, fileCreationTime, fileLastWriteTime, fileChangeTime, requestConditions.getLeaseId(), httpHeaders, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(ModelHelper::createFileInfoResponse); } @@ -710,7 +709,6 @@ public PollerFlux beginCopy(String sourceUrl, ShareFile .startCopyWithResponseAsync(shareName, filePath, copySource, null, options.getMetadata(), options.getFilePermission(), tempSmbProperties.getFilePermissionKey(), finalRequestConditions.getLeaseId(), copyFileSmbInfo, context)) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> { final FilesStartCopyHeaders headers = response.getDeserializedHeaders(); copyId.set(headers.getXMsCopyId()); @@ -861,8 +859,7 @@ Mono> abortCopyWithResponse(String copyId, ShareRequestConditions Context context) { requestConditions = requestConditions == null ? new ShareRequestConditions() : requestConditions; return azureFileStorageClient.getFiles().abortCopyNoCustomHeadersWithResponseAsync(shareName, filePath, copyId, - null, requestConditions.getLeaseId(), context) - .onErrorMap(ModelHelper::mapToShareStorageException); + null, requestConditions.getLeaseId(), context); } /** @@ -1237,8 +1234,7 @@ private Mono>> downloadRange Boolean rangeGetContentMD5, ShareRequestConditions requestConditions, Context context) { String rangeString = range == null ? null : range.toHeaderValue(); return azureFileStorageClient.getFiles().downloadWithResponseAsync(shareName, filePath, null, - rangeString, rangeGetContentMD5, requestConditions.getLeaseId(), context) - .onErrorMap(ModelHelper::mapToShareStorageException); + rangeString, rangeGetContentMD5, requestConditions.getLeaseId(), context); } /** @@ -1332,8 +1328,7 @@ public Mono> deleteWithResponse(ShareRequestConditions requestCon Mono> deleteWithResponse(ShareRequestConditions requestConditions, Context context) { requestConditions = requestConditions == null ? new ShareRequestConditions() : requestConditions; return azureFileStorageClient.getFiles() - .deleteNoCustomHeadersWithResponseAsync(shareName, filePath, null, requestConditions.getLeaseId(), context) - .onErrorMap(ModelHelper::mapToShareStorageException); + .deleteNoCustomHeadersWithResponseAsync(shareName, filePath, null, requestConditions.getLeaseId(), context); } /** @@ -1512,8 +1507,8 @@ Mono> getPropertiesWithResponse(ShareRequestCondit requestConditions = requestConditions == null ? new ShareRequestConditions() : requestConditions; context = context == null ? Context.NONE : context; return azureFileStorageClient.getFiles() - .getPropertiesWithResponseAsync(shareName, filePath, snapshot, null, requestConditions.getLeaseId(), context) - .onErrorMap(ModelHelper::mapToShareStorageException) + .getPropertiesWithResponseAsync(shareName, filePath, snapshot, null, requestConditions.getLeaseId(), + context) .map(ModelHelper::getPropertiesResponse); } @@ -1779,7 +1774,6 @@ Mono> setPropertiesWithResponse(long newFileSize, ShareF .setHttpHeadersWithResponseAsync(shareName, filePath, fileAttributes, null, newFileSize, filePermission, filePermissionFormat, filePermissionKey, fileCreationTime, fileLastWriteTime, fileChangeTime, requestConditions.getLeaseId(), httpHeaders, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(ModelHelper::setPropertiesResponse); } @@ -1913,9 +1907,8 @@ Mono> setMetadataWithResponse(Map> uploadRangeWithResponse(ShareFileUploadRange return azureFileStorageClient.getFiles() .uploadRangeWithResponseAsync(shareName, filePath, range.toString(), ShareFileRangeWriteType.UPDATE, - options.getLength(), null, null, requestConditions.getLeaseId(), options.getLastWrittenMode(), data, context) - .onErrorMap(ModelHelper::mapToShareStorageException) + options.getLength(), null, null, requestConditions.getLeaseId(), options.getLastWrittenMode(), data, + context) .map(ModelHelper::uploadRangeHeadersToShareFileInfo); } @@ -2463,7 +2456,6 @@ Mono> uploadRangeFromUrlWithResponse( .uploadRangeFromURLWithResponseAsync(shareName, filePath, destinationRange.toString(), copySource, 0, null, sourceRange.toString(), null, modifiedRequestConditions.getLeaseId(), sourceAuth, options.getLastWrittenMode(), null, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(ModelHelper::mapUploadRangeFromUrlResponse); } @@ -2575,7 +2567,6 @@ Mono> clearRangeWithResponse(long length, long off return azureFileStorageClient.getFiles() .uploadRangeWithResponseAsync(shareName, filePath, range.toString(), ShareFileRangeWriteType.CLEAR, 0L, null, null, requestConditions.getLeaseId(), null, (Flux) null, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(ModelHelper::transformUploadResponse); } @@ -2850,7 +2841,6 @@ Mono> listRangesWithResponse(ShareFileRange range, return this.azureFileStorageClient.getFiles().getRangeListWithResponseAsync(shareName, filePath, snapshot, previousSnapshot, null, rangeString, finalRequestConditions.getLeaseId(), supportRename, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> new SimpleResponse<>(response, response.getValue())); } @@ -2912,7 +2902,6 @@ PagedFlux listHandlesWithOptionalTimeout(Integer maxResultsPerPage, marker -> StorageImplUtils.applyOptionalTimeout(this.azureFileStorageClient.getFiles() .listHandlesWithResponseAsync(shareName, filePath, marker, maxResultsPerPage, null, snapshot, context), timeout) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), @@ -2986,7 +2975,6 @@ Mono> forceCloseHandleWithResponse(String handleId, C context = context == null ? Context.NONE : context; return azureFileStorageClient.getFiles() .forceCloseHandlesWithResponseAsync(shareName, filePath, handleId, null, null, snapshot, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> new SimpleResponse<>(response, new CloseHandlesInfo(response.getDeserializedHeaders().getXMsNumberOfHandlesClosed(), response.getDeserializedHeaders().getXMsNumberOfHandlesFailed()))); @@ -3027,9 +3015,7 @@ public Mono forceCloseAllHandles() { PagedFlux forceCloseAllHandlesWithOptionalTimeout(Duration timeout, Context context) { Function>> retriever = marker -> StorageImplUtils.applyOptionalTimeout(this.azureFileStorageClient.getFiles() - .forceCloseHandlesWithResponseAsync(shareName, filePath, "*", null, marker, - snapshot, context), timeout) - .onErrorMap(ModelHelper::mapToShareStorageException) + .forceCloseHandlesWithResponseAsync(shareName, filePath, "*", null, marker, snapshot, context), timeout) .map(response -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), @@ -3158,7 +3144,6 @@ Mono> renameWithResponse(ShareFileRenameOptions o null /* timeout */, options.getReplaceIfExists(), options.isIgnoreReadOnly(), options.getFilePermission(), options.getFilePermissionFormat(), filePermissionKey, options.getMetadata(), sourceConditions, destinationConditions, smbInfo, headers, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> new SimpleResponse<>(response, destinationFileClient)); } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileClient.java index d985c81cc937..2d6bb083e0a3 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileClient.java @@ -8,7 +8,6 @@ import com.azure.core.annotation.ServiceMethod; import com.azure.core.credential.AzureSasCredential; import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpResponse; import com.azure.core.http.rest.PagedIterable; @@ -28,6 +27,7 @@ import com.azure.storage.common.ParallelTransferOptions; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.Utility; +import com.azure.storage.common.implementation.Constants; import com.azure.storage.common.implementation.SasImplUtils; import com.azure.storage.common.implementation.StorageImplUtils; import com.azure.storage.common.implementation.StorageSeekableByteChannel; @@ -101,8 +101,6 @@ import java.util.stream.Collectors; import static com.azure.storage.common.implementation.StorageImplUtils.sendRequest; -import static com.azure.storage.file.share.implementation.util.ModelHelper.wrapServiceCallWithExceptionMapping; -import static com.azure.storage.file.share.implementation.util.ModelHelper.wrapTimeoutServiceCallWithExceptionMapping; /** * This class provides a client that contains all the operations for interacting files under Azure Storage File Service. @@ -477,10 +475,10 @@ public Response createWithResponse(long maxSize, ShareFileHttpHea String fileCreationTime = smbProperties.setFileCreationTime(FileConstants.FILE_TIME_NOW); String fileLastWriteTime = smbProperties.setFileLastWriteTime(FileConstants.FILE_TIME_NOW); String fileChangeTime = smbProperties.getFileChangeTimeString(); - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> - this.azureFileStorageClient.getFiles().createWithResponse(shareName, filePath, maxSize, fileAttributes, - null, metadata, finalFilePermission, null, filePermissionKey, fileCreationTime, - fileLastWriteTime, fileChangeTime, finalRequestConditions.getLeaseId(), httpHeaders, finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getFiles() + .createWithResponse(shareName, filePath, maxSize, fileAttributes, null, metadata, finalFilePermission, null, + filePermissionKey, fileCreationTime, fileLastWriteTime, fileChangeTime, + finalRequestConditions.getLeaseId(), httpHeaders, finalContext); return ModelHelper.createFileInfoResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -551,12 +549,11 @@ public Response createWithResponse(ShareFileCreateOptions options String fileCreationTime = smbProperties.setFileCreationTime(FileConstants.FILE_TIME_NOW); String fileLastWriteTime = smbProperties.setFileLastWriteTime(FileConstants.FILE_TIME_NOW); String fileChangeTime = smbProperties.getFileChangeTimeString(); - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> - this.azureFileStorageClient.getFiles().createWithResponse(shareName, filePath, options.getSize(), - fileAttributes, null, options.getMetadata(), finalFilePermission, - options.getFilePermissionFormat(), filePermissionKey, fileCreationTime, - fileLastWriteTime, fileChangeTime, finalRequestConditions.getLeaseId(), options.getShareFileHttpHeaders(), - finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getFiles() + .createWithResponse(shareName, filePath, options.getSize(), fileAttributes, null, options.getMetadata(), + finalFilePermission, options.getFilePermissionFormat(), filePermissionKey, fileCreationTime, + fileLastWriteTime, fileChangeTime, finalRequestConditions.getLeaseId(), + options.getShareFileHttpHeaders(), finalContext); return ModelHelper.createFileInfoResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -768,10 +765,10 @@ public SyncPoller beginCopy(String sourceUrl, ShareFile Function, PollResponse> syncActivationOperation = (pollingContext) -> { - ResponseBase response = wrapServiceCallWithExceptionMapping( - () -> azureFileStorageClient.getFiles().startCopyWithResponse(shareName, filePath, copySource, null, - options.getMetadata(), options.getFilePermission(), tempSmbProperties.getFilePermissionKey(), - finalRequestConditions.getLeaseId(), copyFileSmbInfo, null)); + ResponseBase response = azureFileStorageClient.getFiles() + .startCopyWithResponse(shareName, filePath, copySource, null, options.getMetadata(), + options.getFilePermission(), tempSmbProperties.getFilePermissionKey(), + finalRequestConditions.getLeaseId(), copyFileSmbInfo, null); FilesStartCopyHeaders headers = response.getDeserializedHeaders(); copyId.set(headers.getXMsCopyId()); @@ -782,7 +779,7 @@ public SyncPoller beginCopy(String sourceUrl, ShareFile headers.getXMsCopyStatus(), headers.getETag(), headers.getLastModified(), - response.getHeaders().getValue(HttpHeaderName.fromString("x-ms-error-code")))); + response.getHeaders().getValue(Constants.HeaderConstants.ERROR_CODE_HEADER_NAME))); }; Function, PollResponse> pollOperation = (pollingContext) -> @@ -921,9 +918,9 @@ public Response abortCopyWithResponse(String copyId, ShareRequestCondition Context finalContext = context == null ? Context.NONE : context; ShareRequestConditions finalRequestConditions = requestConditions == null ? new ShareRequestConditions() : requestConditions; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getFiles().abortCopyNoCustomHeadersWithResponse(shareName, filePath, - copyId, null, finalRequestConditions.getLeaseId(), finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getFiles() + .abortCopyNoCustomHeadersWithResponse(shareName, filePath, copyId, null, + finalRequestConditions.getLeaseId(), finalContext); return sendRequest(operation, timeout, ShareStorageException.class); } @@ -1293,9 +1290,9 @@ public Response deleteWithResponse(ShareRequestConditions requestCondition Context finalContext = context == null ? Context.NONE : context; ShareRequestConditions finalRequestConditions = requestConditions == null ? new ShareRequestConditions() : requestConditions; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getFiles().deleteNoCustomHeadersWithResponse(shareName, filePath, null, - finalRequestConditions.getLeaseId(), finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getFiles() + .deleteNoCustomHeadersWithResponse(shareName, filePath, null, finalRequestConditions.getLeaseId(), + finalContext); return sendRequest(operation, timeout, ShareStorageException.class); } @@ -1459,9 +1456,9 @@ public Response getPropertiesWithResponse(ShareRequestCondi Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; ShareRequestConditions finalRequestConditions = requestConditions == null ? new ShareRequestConditions() : requestConditions; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getFiles().getPropertiesWithResponse(shareName, filePath, snapshot, - null, finalRequestConditions.getLeaseId(), finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getFiles() + .getPropertiesWithResponse(shareName, filePath, snapshot, null, finalRequestConditions.getLeaseId(), + finalContext); return ModelHelper.getPropertiesResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -1658,10 +1655,10 @@ public Response setPropertiesWithResponse(long newFileSize, Share String fileCreationTime = smbProperties.setFileCreationTime(FileConstants.PRESERVE); String fileLastWriteTime = smbProperties.setFileLastWriteTime(FileConstants.PRESERVE); String fileChangeTime = smbProperties.getFileChangeTimeString(); - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getFiles().setHttpHeadersWithResponse(shareName, filePath, fileAttributes, - null, newFileSize, finalFilePermission, null, filePermissionKey, fileCreationTime, fileLastWriteTime, - fileChangeTime, finalRequestConditions.getLeaseId(), httpHeaders, finalContext)); + Callable> operation = () -> azureFileStorageClient.getFiles() + .setHttpHeadersWithResponse(shareName, filePath, fileAttributes, null, newFileSize, finalFilePermission, + null, filePermissionKey, fileCreationTime, fileLastWriteTime, fileChangeTime, + finalRequestConditions.getLeaseId(), httpHeaders, finalContext); return ModelHelper.setPropertiesResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -1729,11 +1726,11 @@ public Response setPropertiesWithResponse(ShareFileSetPropertiesO String fileCreationTime = smbProperties.setFileCreationTime(FileConstants.PRESERVE); String fileLastWriteTime = smbProperties.setFileLastWriteTime(FileConstants.PRESERVE); String fileChangeTime = smbProperties.getFileChangeTimeString(); - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getFiles().setHttpHeadersWithResponse(shareName, filePath, fileAttributes, - null, options.getSizeInBytes(), finalFilePermission, options.getFilePermissions().getPermissionFormat(), - filePermissionKey, fileCreationTime, fileLastWriteTime, fileChangeTime, finalRequestConditions.getLeaseId(), - options.getHttpHeaders(), finalContext)); + Callable> operation = () -> azureFileStorageClient.getFiles() + .setHttpHeadersWithResponse(shareName, filePath, fileAttributes, null, options.getSizeInBytes(), + finalFilePermission, options.getFilePermissions().getPermissionFormat(), filePermissionKey, + fileCreationTime, fileLastWriteTime, fileChangeTime, finalRequestConditions.getLeaseId(), + options.getHttpHeaders(), finalContext); return ModelHelper.setPropertiesResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -1866,9 +1863,9 @@ public Response setMetadataWithResponse(Map> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getFiles().setMetadataWithResponse(shareName, filePath, null, metadata, - finalRequestConditions.getLeaseId(), finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getFiles() + .setMetadataWithResponse(shareName, filePath, null, metadata, finalRequestConditions.getLeaseId(), + finalContext); return ModelHelper.setMetadataResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -2279,11 +2276,10 @@ public Response uploadRangeFromUrlWithResponse( ? null : options.getSourceAuthorization().toString(); String copySource = Utility.encodeUrlPath(options.getSourceUrl()); - Callable> operation - = wrapTimeoutServiceCallWithExceptionMapping(() -> this.azureFileStorageClient.getFiles() - .uploadRangeFromURLWithResponse(shareName, filePath, destinationRange.toString(), copySource, 0, - null, sourceRange.toString(), null, finalRequestConditions.getLeaseId(), sourceAuth, - options.getLastWrittenMode(), null, finalContext)); + Callable> operation = () -> azureFileStorageClient.getFiles() + .uploadRangeFromURLWithResponse(shareName, filePath, destinationRange.toString(), copySource, 0, null, + sourceRange.toString(), null, finalRequestConditions.getLeaseId(), sourceAuth, + options.getLastWrittenMode(), null, finalContext); return ModelHelper.mapUploadRangeFromUrlResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -2385,10 +2381,9 @@ public Response clearRangeWithResponse(long length, long of ? new ShareRequestConditions() : requestConditions; ShareFileRange range = new ShareFileRange(offset, offset + length - 1); Context finalContext = context == null ? Context.NONE : context; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getFiles().uploadRangeWithResponse(shareName, filePath, range.toString(), - ShareFileRangeWriteType.CLEAR, 0L, null, null, finalRequestConditions.getLeaseId(), null, null, - finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getFiles() + .uploadRangeWithResponse(shareName, filePath, range.toString(), ShareFileRangeWriteType.CLEAR, 0L, null, + null, finalRequestConditions.getLeaseId(), null, null, finalContext); return ModelHelper.transformUploadResponse(sendRequest(operation, timeout, ShareStorageException.class)); } @@ -2538,10 +2533,9 @@ public PagedIterable listRanges(ShareFileRange range, ShareReque String rangeString = range == null ? null : range.toString(); try { - Callable> operation = - wrapTimeoutServiceCallWithExceptionMapping(() -> this.azureFileStorageClient.getFiles() - .getRangeListWithResponse(shareName, filePath, snapshot, null, null, rangeString, - finalRequestConditions.getLeaseId(), null, finalContext)); + Callable> operation + = () -> this.azureFileStorageClient.getFiles().getRangeListWithResponse(shareName, filePath, snapshot, + null, null, rangeString, finalRequestConditions.getLeaseId(), null, finalContext); ResponseBase response = sendRequest(operation, timeout, ShareStorageException.class); @@ -2630,10 +2624,9 @@ public Response listRangesDiffWithResponse(ShareFileListRang ShareRequestConditions requestConditions = options.getRequestConditions() == null ? new ShareRequestConditions() : options.getRequestConditions(); String rangeString = options.getRange() == null ? null : options.getRange().toString(); - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getFiles().getRangeListNoCustomHeadersWithResponse(shareName, filePath, - snapshot, options.getPreviousSnapshot(), null, rangeString, requestConditions.getLeaseId(), - options.isRenameIncluded(), finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getFiles() + .getRangeListNoCustomHeadersWithResponse(shareName, filePath, snapshot, options.getPreviousSnapshot(), null, + rangeString, requestConditions.getLeaseId(), options.isRenameIncluded(), finalContext); return sendRequest(operation, timeout, ShareStorageException.class); } @@ -2693,8 +2686,8 @@ public PagedIterable listHandles(Integer maxResultsPerPage, Duration Context finalContext = context == null ? Context.NONE : context; try { Callable> operation - = wrapTimeoutServiceCallWithExceptionMapping(() -> this.azureFileStorageClient.getFiles() - .listHandlesWithResponse(shareName, filePath, null, maxResultsPerPage, null, snapshot, finalContext)); + = () -> this.azureFileStorageClient.getFiles().listHandlesWithResponse(shareName, filePath, null, + maxResultsPerPage, null, snapshot, finalContext); ResponseBase response = sendRequest(operation, timeout, ShareStorageException.class); @@ -2770,9 +2763,8 @@ public CloseHandlesInfo forceCloseHandle(String handleId) { @ServiceMethod(returns = ReturnType.SINGLE) public Response forceCloseHandleWithResponse(String handleId, Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getFiles().forceCloseHandlesWithResponse(shareName, filePath, handleId, - null, null, snapshot, finalContext)); + Callable> operation = () -> azureFileStorageClient.getFiles() + .forceCloseHandlesWithResponse(shareName, filePath, handleId, null, null, snapshot, finalContext); ResponseBase response = sendRequest(operation, timeout, ShareStorageException.class); @@ -2810,8 +2802,8 @@ public CloseHandlesInfo forceCloseAllHandles(Duration timeout, Context context) Context finalContext = context == null ? Context.NONE : context; try { Callable> operation - = wrapTimeoutServiceCallWithExceptionMapping(() -> this.azureFileStorageClient.getFiles() - .forceCloseHandlesWithResponse(shareName, filePath, "*", null, null, snapshot, finalContext)); + = () -> this.azureFileStorageClient.getFiles().forceCloseHandlesWithResponse(shareName, filePath, "*", + null, null, snapshot, finalContext); ResponseBase response = sendRequest(operation, timeout, ShareStorageException.class); @@ -2938,12 +2930,12 @@ public Response renameWithResponse(ShareFileRenameOptions optio String finalRenameSource = this.sasToken != null ? renameSource + "?" + this.sasToken.getSignature() : renameSource; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> destinationFileClient.azureFileStorageClient.getFiles().renameNoCustomHeadersWithResponse( - destinationFileClient.getShareName(), destinationFileClient.getFilePath(), finalRenameSource, - null /* timeout */, options.getReplaceIfExists(), options.isIgnoreReadOnly(), - options.getFilePermission(), options.getFilePermissionFormat(), finalFilePermissionKey, - options.getMetadata(), sourceConditions, destinationConditions, finalSmbInfo, headers, finalContext)); + Callable> operation = () -> destinationFileClient.azureFileStorageClient.getFiles() + .renameNoCustomHeadersWithResponse(destinationFileClient.getShareName(), + destinationFileClient.getFilePath(), finalRenameSource, null, options.getReplaceIfExists(), + options.isIgnoreReadOnly(), options.getFilePermission(), options.getFilePermissionFormat(), + finalFilePermissionKey, options.getMetadata(), sourceConditions, destinationConditions, finalSmbInfo, + headers, finalContext); return new SimpleResponse<>(sendRequest(operation, timeout, ShareStorageException.class), destinationFileClient); diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceAsyncClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceAsyncClient.java index 5958dfe4a8c8..758bffbab9d1 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceAsyncClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceAsyncClient.java @@ -252,9 +252,8 @@ PagedFlux listSharesWithOptionalTimeout(String marker, ListSharesOpti BiFunction>> retriever = (nextMarker, pageSize) -> StorageImplUtils.applyOptionalTimeout(this.azureFileStorageClient.getServices() - .listSharesSegmentSinglePageAsync( - prefix, nextMarker, pageSize == null ? maxResultsPerPage : pageSize, include, null, context) - .onErrorMap(ModelHelper::mapToShareStorageException) + .listSharesSegmentSinglePageAsync(prefix, nextMarker, + pageSize == null ? maxResultsPerPage : pageSize, include, null, context) .map(response -> { List value = response.getValue() == null ? Collections.emptyList() @@ -336,7 +335,6 @@ public Mono> getPropertiesWithResponse() { Mono> getPropertiesWithResponse(Context context) { context = context == null ? Context.NONE : context; return azureFileStorageClient.getServices().getPropertiesWithResponseAsync(null, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> new SimpleResponse<>(response, response.getValue())); } @@ -458,8 +456,7 @@ public Mono> setPropertiesWithResponse(ShareServiceProperties pro Mono> setPropertiesWithResponse(ShareServiceProperties properties, Context context) { context = context == null ? Context.NONE : context; return azureFileStorageClient.getServices() - .setPropertiesNoCustomHeadersWithResponseAsync(properties, null, context) - .onErrorMap(ModelHelper::mapToShareStorageException); + .setPropertiesNoCustomHeadersWithResponseAsync(properties, null, context); } /** @@ -660,8 +657,7 @@ Mono> deleteShareWithResponse(String shareName, String snapshot, } context = context == null ? Context.NONE : context; return azureFileStorageClient.getShares() - .deleteNoCustomHeadersWithResponseAsync(shareName, snapshot, null, deleteSnapshots, null, context) - .onErrorMap(ModelHelper::mapToShareStorageException); + .deleteNoCustomHeadersWithResponseAsync(shareName, snapshot, null, deleteSnapshots, null, context); } /** @@ -858,7 +854,6 @@ Mono> undeleteShareWithResponse( String deletedShareName, String deletedShareVersion, Context context) { return this.azureFileStorageClient.getShares().restoreWithResponseAsync( deletedShareName, null, null, deletedShareName, deletedShareVersion, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(response -> new SimpleResponse<>(response, getShareAsyncClient(deletedShareName))); } } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceClient.java index f09d0d5fcb88..52c19c25ca89 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceClient.java @@ -43,7 +43,6 @@ import java.util.stream.Collectors; import static com.azure.storage.common.implementation.StorageImplUtils.sendRequest; -import static com.azure.storage.file.share.implementation.util.ModelHelper.wrapTimeoutServiceCallWithExceptionMapping; /** * This class provides a shareServiceAsyncClient that contains all the operations for interacting with a file account in @@ -219,9 +218,9 @@ public PagedIterable listShares(ListSharesOptions options, Duration t BiFunction> retriever = (nextMarker, pageSize) -> { - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getServices().listSharesSegmentNoCustomHeadersSinglePage(prefix, - nextMarker, pageSize == null ? maxResultsPerPage : pageSize, include, null, finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getServices() + .listSharesSegmentNoCustomHeadersSinglePage(prefix, nextMarker, + pageSize == null ? maxResultsPerPage : pageSize, include, null, finalContext); PagedResponse response = sendRequest(operation, timeout, ShareStorageException.class); @@ -295,9 +294,8 @@ public ShareServiceProperties getProperties() { @ServiceMethod(returns = ReturnType.SINGLE) public Response getPropertiesWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getServices().getPropertiesNoCustomHeadersWithResponse(null, - finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getServices() + .getPropertiesNoCustomHeadersWithResponse(null, finalContext); Response response = sendRequest(operation, timeout, ShareStorageException.class); return new SimpleResponse<>(response, response.getValue()); @@ -429,9 +427,8 @@ public void setProperties(ShareServiceProperties properties) { public Response setPropertiesWithResponse(ShareServiceProperties properties, Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getServices().setPropertiesNoCustomHeadersWithResponse(properties, null, - finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getServices() + .setPropertiesNoCustomHeadersWithResponse(properties, null, finalContext); return sendRequest(operation, timeout, ShareStorageException.class); } @@ -598,9 +595,8 @@ public Response deleteShareWithResponse(String shareName, String snapshot, Context finalContext = context == null ? Context.NONE : context; DeleteSnapshotsOptionType deleteSnapshots = CoreUtils.isNullOrEmpty(snapshot) ? DeleteSnapshotsOptionType.INCLUDE : null; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getShares().deleteNoCustomHeadersWithResponse(shareName, snapshot, null, - deleteSnapshots, null, finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getShares() + .deleteNoCustomHeadersWithResponse(shareName, snapshot, null, deleteSnapshots, null, finalContext); return sendRequest(operation, timeout, ShareStorageException.class); } @@ -793,9 +789,9 @@ public ShareClient undeleteShare(String deletedShareName, String deletedShareVer public Response undeleteShareWithResponse(String deletedShareName, String deletedShareVersion, Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( - () -> this.azureFileStorageClient.getShares().restoreNoCustomHeadersWithResponse(deletedShareName, null, - null, deletedShareName, deletedShareVersion, finalContext)); + Callable> operation = () -> this.azureFileStorageClient.getShares() + .restoreNoCustomHeadersWithResponse(deletedShareName, null, null, deletedShareName, deletedShareVersion, + finalContext); return new SimpleResponse<>(sendRequest(operation, timeout, ShareStorageException.class), getShareClient(deletedShareName)); diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/DirectoriesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/DirectoriesImpl.java index 419bb52ac882..c1a25b74d2e3 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/DirectoriesImpl.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/DirectoriesImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.file.share.implementation; import com.azure.core.annotation.Delete; @@ -45,11 +44,13 @@ import java.util.Objects; import java.util.stream.Collectors; import reactor.core.publisher.Mono; +import com.azure.storage.file.share.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in Directories. */ public final class DirectoriesImpl { + /** * The proxy service used to perform REST calls. */ @@ -62,7 +63,7 @@ public final class DirectoriesImpl { /** * Initializes an instance of DirectoriesImpl. - * + * * @param client the instance of the service client containing this operation class. */ DirectoriesImpl(AzureFileStorageImpl client) { @@ -78,6 +79,7 @@ public final class DirectoriesImpl { @Host("{url}") @ServiceInterface(name = "AzureFileStorageDire") public interface DirectoriesService { + @Put("/{shareName}/{directory}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(ShareStorageExceptionInternal.class) @@ -616,7 +618,7 @@ Response renameNoCustomHeadersSync(@HostParam("url") String url, @PathPara /** * Creates a new directory under the specified share or parent directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -651,15 +653,17 @@ public Mono> createWithResponseAsyn String fileLastWriteTime, String fileChangeTime) { final String restype = "directory"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.create(this.client.getUrl(), shareName, directory, restype, - this.client.isAllowTrailingDot(), timeout, metadata, this.client.getVersion(), filePermission, - filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, - fileChangeTime, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.create(this.client.getUrl(), shareName, directory, restype, + this.client.isAllowTrailingDot(), timeout, metadata, this.client.getVersion(), filePermission, + filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, + fileChangeTime, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a new directory under the specified share or parent directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -695,15 +699,17 @@ public Mono> createWithResponseAsyn String fileLastWriteTime, String fileChangeTime, Context context) { final String restype = "directory"; final String accept = "application/xml"; - return service.create(this.client.getUrl(), shareName, directory, restype, this.client.isAllowTrailingDot(), - timeout, metadata, this.client.getVersion(), filePermission, filePermissionFormat, filePermissionKey, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, this.client.getFileRequestIntent(), - accept, context); + return service + .create(this.client.getUrl(), shareName, directory, restype, this.client.isAllowTrailingDot(), timeout, + metadata, this.client.getVersion(), filePermission, filePermissionFormat, filePermissionKey, + fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, this.client.getFileRequestIntent(), + accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a new directory under the specified share or parent directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -737,12 +743,13 @@ public Mono createAsync(String shareName, String directory, String fileAtt String filePermissionKey, String fileCreationTime, String fileLastWriteTime, String fileChangeTime) { return createWithResponseAsync(shareName, directory, fileAttributes, timeout, metadata, filePermission, filePermissionFormat, filePermissionKey, fileCreationTime, fileLastWriteTime, fileChangeTime) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Creates a new directory under the specified share or parent directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -778,12 +785,13 @@ public Mono createAsync(String shareName, String directory, String fileAtt Context context) { return createWithResponseAsync(shareName, directory, fileAttributes, timeout, metadata, filePermission, filePermissionFormat, filePermissionKey, fileCreationTime, fileLastWriteTime, fileChangeTime, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Creates a new directory under the specified share or parent directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -818,15 +826,17 @@ public Mono> createNoCustomHeadersWithResponseAsync(String shareN String fileLastWriteTime, String fileChangeTime) { final String restype = "directory"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.createNoCustomHeaders(this.client.getUrl(), shareName, directory, - restype, this.client.isAllowTrailingDot(), timeout, metadata, this.client.getVersion(), filePermission, - filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, - fileChangeTime, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.createNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, + this.client.isAllowTrailingDot(), timeout, metadata, this.client.getVersion(), filePermission, + filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, + fileChangeTime, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a new directory under the specified share or parent directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -862,15 +872,17 @@ public Mono> createNoCustomHeadersWithResponseAsync(String shareN String fileLastWriteTime, String fileChangeTime, Context context) { final String restype = "directory"; final String accept = "application/xml"; - return service.createNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, - this.client.isAllowTrailingDot(), timeout, metadata, this.client.getVersion(), filePermission, - filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, - fileChangeTime, this.client.getFileRequestIntent(), accept, context); + return service + .createNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, + this.client.isAllowTrailingDot(), timeout, metadata, this.client.getVersion(), filePermission, + filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, + fileChangeTime, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a new directory under the specified share or parent directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -906,15 +918,19 @@ public ResponseBase createWithResponse(String sh String fileLastWriteTime, String fileChangeTime, Context context) { final String restype = "directory"; final String accept = "application/xml"; - return service.createSync(this.client.getUrl(), shareName, directory, restype, this.client.isAllowTrailingDot(), - timeout, metadata, this.client.getVersion(), filePermission, filePermissionFormat, filePermissionKey, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, this.client.getFileRequestIntent(), - accept, context); + try { + return service.createSync(this.client.getUrl(), shareName, directory, restype, + this.client.isAllowTrailingDot(), timeout, metadata, this.client.getVersion(), filePermission, + filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, + fileChangeTime, this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Creates a new directory under the specified share or parent directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -951,7 +967,7 @@ public void create(String shareName, String directory, String fileAttributes, In /** * Creates a new directory under the specified share or parent directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -987,16 +1003,20 @@ public Response createNoCustomHeadersWithResponse(String shareName, String Context context) { final String restype = "directory"; final String accept = "application/xml"; - return service.createNoCustomHeadersSync(this.client.getUrl(), shareName, directory, restype, - this.client.isAllowTrailingDot(), timeout, metadata, this.client.getVersion(), filePermission, - filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, - fileChangeTime, this.client.getFileRequestIntent(), accept, context); + try { + return service.createNoCustomHeadersSync(this.client.getUrl(), shareName, directory, restype, + this.client.isAllowTrailingDot(), timeout, metadata, this.client.getVersion(), filePermission, + filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, + fileChangeTime, this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns all system properties for the specified directory, and can also be used to check the existence of a * directory. The data returned does not include the files in the directory or any subdirectories. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -1014,15 +1034,17 @@ public Mono> getPropertiesWi String directory, String sharesnapshot, Integer timeout) { final String restype = "directory"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getProperties(this.client.getUrl(), shareName, directory, - restype, this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.getProperties(this.client.getUrl(), shareName, directory, restype, + this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns all system properties for the specified directory, and can also be used to check the existence of a * directory. The data returned does not include the files in the directory or any subdirectories. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -1041,15 +1063,16 @@ public Mono> getPropertiesWi String directory, String sharesnapshot, Integer timeout, Context context) { final String restype = "directory"; final String accept = "application/xml"; - return service.getProperties(this.client.getUrl(), shareName, directory, restype, - this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context); + return service + .getProperties(this.client.getUrl(), shareName, directory, restype, this.client.isAllowTrailingDot(), + sharesnapshot, timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns all system properties for the specified directory, and can also be used to check the existence of a * directory. The data returned does not include the files in the directory or any subdirectories. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -1065,13 +1088,14 @@ public Mono> getPropertiesWi @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesAsync(String shareName, String directory, String sharesnapshot, Integer timeout) { return getPropertiesWithResponseAsync(shareName, directory, sharesnapshot, timeout) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Returns all system properties for the specified directory, and can also be used to check the existence of a * directory. The data returned does not include the files in the directory or any subdirectories. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -1089,13 +1113,14 @@ public Mono getPropertiesAsync(String shareName, String directory, String public Mono getPropertiesAsync(String shareName, String directory, String sharesnapshot, Integer timeout, Context context) { return getPropertiesWithResponseAsync(shareName, directory, sharesnapshot, timeout, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Returns all system properties for the specified directory, and can also be used to check the existence of a * directory. The data returned does not include the files in the directory or any subdirectories. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -1113,15 +1138,17 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String String sharesnapshot, Integer timeout) { final String restype = "directory"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), shareName, - directory, restype, this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), shareName, directory, + restype, this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns all system properties for the specified directory, and can also be used to check the existence of a * directory. The data returned does not include the files in the directory or any subdirectories. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -1140,15 +1167,17 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String String sharesnapshot, Integer timeout, Context context) { final String restype = "directory"; final String accept = "application/xml"; - return service.getPropertiesNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, - this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context); + return service + .getPropertiesNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, + this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns all system properties for the specified directory, and can also be used to check the existence of a * directory. The data returned does not include the files in the directory or any subdirectories. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -1167,15 +1196,19 @@ public ResponseBase getPropertiesWithResp String directory, String sharesnapshot, Integer timeout, Context context) { final String restype = "directory"; final String accept = "application/xml"; - return service.getPropertiesSync(this.client.getUrl(), shareName, directory, restype, - this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.getPropertiesSync(this.client.getUrl(), shareName, directory, restype, + this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns all system properties for the specified directory, and can also be used to check the existence of a * directory. The data returned does not include the files in the directory or any subdirectories. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -1195,7 +1228,7 @@ public void getProperties(String shareName, String directory, String sharesnapsh /** * Returns all system properties for the specified directory, and can also be used to check the existence of a * directory. The data returned does not include the files in the directory or any subdirectories. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -1214,14 +1247,18 @@ public Response getPropertiesNoCustomHeadersWithResponse(String shareName, String sharesnapshot, Integer timeout, Context context) { final String restype = "directory"; final String accept = "application/xml"; - return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), shareName, directory, restype, - this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), shareName, directory, restype, + this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1237,14 +1274,16 @@ public Mono> deleteWithResponseAsyn String directory, Integer timeout) { final String restype = "directory"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.delete(this.client.getUrl(), shareName, directory, restype, - this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), this.client.getFileRequestIntent(), - accept, context)); + return FluxUtil + .withContext(context -> service.delete(this.client.getUrl(), shareName, directory, restype, + this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), this.client.getFileRequestIntent(), + accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1261,13 +1300,15 @@ public Mono> deleteWithResponseAsyn String directory, Integer timeout, Context context) { final String restype = "directory"; final String accept = "application/xml"; - return service.delete(this.client.getUrl(), shareName, directory, restype, this.client.isAllowTrailingDot(), - timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); + return service + .delete(this.client.getUrl(), shareName, directory, restype, this.client.isAllowTrailingDot(), timeout, + this.client.getVersion(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1280,12 +1321,14 @@ public Mono> deleteWithResponseAsyn */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteAsync(String shareName, String directory, Integer timeout) { - return deleteWithResponseAsync(shareName, directory, timeout).flatMap(ignored -> Mono.empty()); + return deleteWithResponseAsync(shareName, directory, timeout) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1299,12 +1342,14 @@ public Mono deleteAsync(String shareName, String directory, Integer timeou */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteAsync(String shareName, String directory, Integer timeout, Context context) { - return deleteWithResponseAsync(shareName, directory, timeout, context).flatMap(ignored -> Mono.empty()); + return deleteWithResponseAsync(shareName, directory, timeout, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1320,14 +1365,16 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String shareN Integer timeout) { final String restype = "directory"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), shareName, directory, - restype, this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, + this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), this.client.getFileRequestIntent(), + accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1344,14 +1391,16 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String shareN Integer timeout, Context context) { final String restype = "directory"; final String accept = "application/xml"; - return service.deleteNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, - this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), this.client.getFileRequestIntent(), - accept, context); + return service + .deleteNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, + this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), this.client.getFileRequestIntent(), + accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1368,13 +1417,18 @@ public ResponseBase deleteWithResponse(String sh Integer timeout, Context context) { final String restype = "directory"; final String accept = "application/xml"; - return service.deleteSync(this.client.getUrl(), shareName, directory, restype, this.client.isAllowTrailingDot(), - timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); + try { + return service.deleteSync(this.client.getUrl(), shareName, directory, restype, + this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), this.client.getFileRequestIntent(), + accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1391,7 +1445,7 @@ public void delete(String shareName, String directory, Integer timeout) { /** * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1408,14 +1462,18 @@ public Response deleteNoCustomHeadersWithResponse(String shareName, String Context context) { final String restype = "directory"; final String accept = "application/xml"; - return service.deleteNoCustomHeadersSync(this.client.getUrl(), shareName, directory, restype, - this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), this.client.getFileRequestIntent(), - accept, context); + try { + return service.deleteNoCustomHeadersSync(this.client.getUrl(), shareName, directory, restype, + this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), this.client.getFileRequestIntent(), + accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Sets properties on the directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -1450,15 +1508,17 @@ public Mono> setPropertiesWi final String restype = "directory"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setProperties(this.client.getUrl(), shareName, directory, - restype, comp, timeout, this.client.getVersion(), filePermission, filePermissionFormat, filePermissionKey, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.setProperties(this.client.getUrl(), shareName, directory, restype, comp, + timeout, this.client.getVersion(), filePermission, filePermissionFormat, filePermissionKey, + fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets properties on the directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -1494,15 +1554,17 @@ public Mono> setPropertiesWi final String restype = "directory"; final String comp = "properties"; final String accept = "application/xml"; - return service.setProperties(this.client.getUrl(), shareName, directory, restype, comp, timeout, - this.client.getVersion(), filePermission, filePermissionFormat, filePermissionKey, fileAttributes, - fileCreationTime, fileLastWriteTime, fileChangeTime, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .setProperties(this.client.getUrl(), shareName, directory, restype, comp, timeout, this.client.getVersion(), + filePermission, filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, + fileLastWriteTime, fileChangeTime, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), + accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets properties on the directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -1535,12 +1597,13 @@ public Mono setPropertiesAsync(String shareName, String directory, String String fileCreationTime, String fileLastWriteTime, String fileChangeTime) { return setPropertiesWithResponseAsync(shareName, directory, fileAttributes, timeout, filePermission, filePermissionFormat, filePermissionKey, fileCreationTime, fileLastWriteTime, fileChangeTime) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Sets properties on the directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -1574,12 +1637,13 @@ public Mono setPropertiesAsync(String shareName, String directory, String String fileCreationTime, String fileLastWriteTime, String fileChangeTime, Context context) { return setPropertiesWithResponseAsync(shareName, directory, fileAttributes, timeout, filePermission, filePermissionFormat, filePermissionKey, fileCreationTime, fileLastWriteTime, fileChangeTime, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Sets properties on the directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -1613,15 +1677,17 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync(String final String restype = "directory"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setPropertiesNoCustomHeaders(this.client.getUrl(), shareName, - directory, restype, comp, timeout, this.client.getVersion(), filePermission, filePermissionFormat, - filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.setPropertiesNoCustomHeaders(this.client.getUrl(), shareName, directory, + restype, comp, timeout, this.client.getVersion(), filePermission, filePermissionFormat, + filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets properties on the directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -1657,15 +1723,17 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync(String final String restype = "directory"; final String comp = "properties"; final String accept = "application/xml"; - return service.setPropertiesNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, comp, timeout, - this.client.getVersion(), filePermission, filePermissionFormat, filePermissionKey, fileAttributes, - fileCreationTime, fileLastWriteTime, fileChangeTime, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .setPropertiesNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, comp, timeout, + this.client.getVersion(), filePermission, filePermissionFormat, filePermissionKey, fileAttributes, + fileCreationTime, fileLastWriteTime, fileChangeTime, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets properties on the directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -1701,15 +1769,19 @@ public ResponseBase setPropertiesWithResp final String restype = "directory"; final String comp = "properties"; final String accept = "application/xml"; - return service.setPropertiesSync(this.client.getUrl(), shareName, directory, restype, comp, timeout, - this.client.getVersion(), filePermission, filePermissionFormat, filePermissionKey, fileAttributes, - fileCreationTime, fileLastWriteTime, fileChangeTime, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.setPropertiesSync(this.client.getUrl(), shareName, directory, restype, comp, timeout, + this.client.getVersion(), filePermission, filePermissionFormat, filePermissionKey, fileAttributes, + fileCreationTime, fileLastWriteTime, fileChangeTime, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Sets properties on the directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -1745,7 +1817,7 @@ public void setProperties(String shareName, String directory, String fileAttribu /** * Sets properties on the directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -1781,15 +1853,19 @@ public Response setPropertiesNoCustomHeadersWithResponse(String shareName, final String restype = "directory"; final String comp = "properties"; final String accept = "application/xml"; - return service.setPropertiesNoCustomHeadersSync(this.client.getUrl(), shareName, directory, restype, comp, - timeout, this.client.getVersion(), filePermission, filePermissionFormat, filePermissionKey, fileAttributes, - fileCreationTime, fileLastWriteTime, fileChangeTime, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.setPropertiesNoCustomHeadersSync(this.client.getUrl(), shareName, directory, restype, comp, + timeout, this.client.getVersion(), filePermission, filePermissionFormat, filePermissionKey, + fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Updates user defined metadata for the specified directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1807,14 +1883,16 @@ public Mono> setMetadataWithRe final String restype = "directory"; final String comp = "metadata"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setMetadata(this.client.getUrl(), shareName, directory, restype, - comp, timeout, metadata, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.setMetadata(this.client.getUrl(), shareName, directory, restype, comp, + timeout, metadata, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Updates user defined metadata for the specified directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1833,14 +1911,16 @@ public Mono> setMetadataWithRe final String restype = "directory"; final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadata(this.client.getUrl(), shareName, directory, restype, comp, timeout, metadata, - this.client.getVersion(), this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, - context); + return service + .setMetadata(this.client.getUrl(), shareName, directory, restype, comp, timeout, metadata, + this.client.getVersion(), this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, + context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Updates user defined metadata for the specified directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1855,12 +1935,14 @@ public Mono> setMetadataWithRe @ServiceMethod(returns = ReturnType.SINGLE) public Mono setMetadataAsync(String shareName, String directory, Integer timeout, Map metadata) { - return setMetadataWithResponseAsync(shareName, directory, timeout, metadata).flatMap(ignored -> Mono.empty()); + return setMetadataWithResponseAsync(shareName, directory, timeout, metadata) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Updates user defined metadata for the specified directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1877,12 +1959,13 @@ public Mono setMetadataAsync(String shareName, String directory, Integer t public Mono setMetadataAsync(String shareName, String directory, Integer timeout, Map metadata, Context context) { return setMetadataWithResponseAsync(shareName, directory, timeout, metadata, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Updates user defined metadata for the specified directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1900,14 +1983,16 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String s final String restype = "directory"; final String comp = "metadata"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setMetadataNoCustomHeaders(this.client.getUrl(), shareName, - directory, restype, comp, timeout, metadata, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.setMetadataNoCustomHeaders(this.client.getUrl(), shareName, directory, + restype, comp, timeout, metadata, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Updates user defined metadata for the specified directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1926,14 +2011,16 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String s final String restype = "directory"; final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadataNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, comp, timeout, - metadata, this.client.getVersion(), this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), - accept, context); + return service + .setMetadataNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, comp, timeout, metadata, + this.client.getVersion(), this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, + context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Updates user defined metadata for the specified directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1952,14 +2039,18 @@ public ResponseBase setMetadataWithResponse final String restype = "directory"; final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadataSync(this.client.getUrl(), shareName, directory, restype, comp, timeout, metadata, - this.client.getVersion(), this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, - context); + try { + return service.setMetadataSync(this.client.getUrl(), shareName, directory, restype, comp, timeout, metadata, + this.client.getVersion(), this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, + context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Updates user defined metadata for the specified directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1977,7 +2068,7 @@ public void setMetadata(String shareName, String directory, Integer timeout, Map /** * Updates user defined metadata for the specified directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1996,15 +2087,19 @@ public Response setMetadataNoCustomHeadersWithResponse(String shareName, S final String restype = "directory"; final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadataNoCustomHeadersSync(this.client.getUrl(), shareName, directory, restype, comp, - timeout, metadata, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.setMetadataNoCustomHeadersSync(this.client.getUrl(), shareName, directory, restype, comp, + timeout, metadata, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns a list of files or directories under the specified share or directory. It lists the contents only for a * single level of the directory hierarchy. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param prefix Filters the results to return only entries whose name begins with the specified prefix. @@ -2040,16 +2135,18 @@ public Response setMetadataNoCustomHeadersWithResponse(String shareName, S : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return FluxUtil.withContext(context -> service.listFilesAndDirectoriesSegment(this.client.getUrl(), shareName, - directory, restype, comp, prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), - includeConverted, includeExtendedInfo, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), - accept, context)); + return FluxUtil + .withContext(context -> service.listFilesAndDirectoriesSegment(this.client.getUrl(), shareName, directory, + restype, comp, prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), + includeConverted, includeExtendedInfo, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns a list of files or directories under the specified share or directory. It lists the contents only for a * single level of the directory hierarchy. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param prefix Filters the results to return only entries whose name begins with the specified prefix. @@ -2088,13 +2185,14 @@ public Response setMetadataNoCustomHeadersWithResponse(String shareName, S .collect(Collectors.joining(",")); return service.listFilesAndDirectoriesSegment(this.client.getUrl(), shareName, directory, restype, comp, prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), includeConverted, includeExtendedInfo, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context); + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns a list of files or directories under the specified share or directory. It lists the contents only for a * single level of the directory hierarchy. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param prefix Filters the results to return only entries whose name begins with the specified prefix. @@ -2121,13 +2219,15 @@ public Mono listFilesAndDirectoriesSegme String directory, String prefix, String sharesnapshot, String marker, Integer maxresults, Integer timeout, List include, Boolean includeExtendedInfo) { return listFilesAndDirectoriesSegmentWithResponseAsync(shareName, directory, prefix, sharesnapshot, marker, - maxresults, timeout, include, includeExtendedInfo).flatMap(res -> Mono.justOrEmpty(res.getValue())); + maxresults, timeout, include, includeExtendedInfo) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Returns a list of files or directories under the specified share or directory. It lists the contents only for a * single level of the directory hierarchy. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param prefix Filters the results to return only entries whose name begins with the specified prefix. @@ -2156,13 +2256,14 @@ public Mono listFilesAndDirectoriesSegme List include, Boolean includeExtendedInfo, Context context) { return listFilesAndDirectoriesSegmentWithResponseAsync(shareName, directory, prefix, sharesnapshot, marker, maxresults, timeout, include, includeExtendedInfo, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Returns a list of files or directories under the specified share or directory. It lists the contents only for a * single level of the directory hierarchy. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param prefix Filters the results to return only entries whose name begins with the specified prefix. @@ -2202,13 +2303,14 @@ public Mono listFilesAndDirectoriesSegme .withContext(context -> service.listFilesAndDirectoriesSegmentNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, comp, prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), includeConverted, includeExtendedInfo, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context)); + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns a list of files or directories under the specified share or directory. It lists the contents only for a * single level of the directory hierarchy. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param prefix Filters the results to return only entries whose name begins with the specified prefix. @@ -2245,16 +2347,18 @@ public Mono listFilesAndDirectoriesSegme : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.listFilesAndDirectoriesSegmentNoCustomHeaders(this.client.getUrl(), shareName, directory, - restype, comp, prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), - includeConverted, includeExtendedInfo, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), - accept, context); + return service + .listFilesAndDirectoriesSegmentNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, comp, + prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), includeConverted, + includeExtendedInfo, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, + context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns a list of files or directories under the specified share or directory. It lists the contents only for a * single level of the directory hierarchy. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param prefix Filters the results to return only entries whose name begins with the specified prefix. @@ -2290,15 +2394,20 @@ public Mono listFilesAndDirectoriesSegme : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.listFilesAndDirectoriesSegmentSync(this.client.getUrl(), shareName, directory, restype, comp, - prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), includeConverted, - includeExtendedInfo, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context); + try { + return service.listFilesAndDirectoriesSegmentSync(this.client.getUrl(), shareName, directory, restype, comp, + prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), includeConverted, + includeExtendedInfo, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, + context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns a list of files or directories under the specified share or directory. It lists the contents only for a * single level of the directory hierarchy. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param prefix Filters the results to return only entries whose name begins with the specified prefix. @@ -2324,14 +2433,18 @@ public Mono listFilesAndDirectoriesSegme public ListFilesAndDirectoriesSegmentResponse listFilesAndDirectoriesSegment(String shareName, String directory, String prefix, String sharesnapshot, String marker, Integer maxresults, Integer timeout, List include, Boolean includeExtendedInfo) { - return listFilesAndDirectoriesSegmentWithResponse(shareName, directory, prefix, sharesnapshot, marker, - maxresults, timeout, include, includeExtendedInfo, Context.NONE).getValue(); + try { + return listFilesAndDirectoriesSegmentWithResponse(shareName, directory, prefix, sharesnapshot, marker, + maxresults, timeout, include, includeExtendedInfo, Context.NONE).getValue(); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns a list of files or directories under the specified share or directory. It lists the contents only for a * single level of the directory hierarchy. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param prefix Filters the results to return only entries whose name begins with the specified prefix. @@ -2366,15 +2479,19 @@ public Response listFilesAndDirectoriesS : include.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return service.listFilesAndDirectoriesSegmentNoCustomHeadersSync(this.client.getUrl(), shareName, directory, - restype, comp, prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), - includeConverted, includeExtendedInfo, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), - accept, context); + try { + return service.listFilesAndDirectoriesSegmentNoCustomHeadersSync(this.client.getUrl(), shareName, directory, + restype, comp, prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), + includeConverted, includeExtendedInfo, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Lists handles for directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -2401,14 +2518,16 @@ public Mono> li Boolean recursive) { final String comp = "listhandles"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.listHandles(this.client.getUrl(), shareName, directory, comp, - marker, maxresults, timeout, sharesnapshot, recursive, this.client.getVersion(), - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.listHandles(this.client.getUrl(), shareName, directory, comp, marker, + maxresults, timeout, sharesnapshot, recursive, this.client.getVersion(), + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Lists handles for directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -2436,14 +2555,16 @@ public Mono> li Boolean recursive, Context context) { final String comp = "listhandles"; final String accept = "application/xml"; - return service.listHandles(this.client.getUrl(), shareName, directory, comp, marker, maxresults, timeout, - sharesnapshot, recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .listHandles(this.client.getUrl(), shareName, directory, comp, marker, maxresults, timeout, sharesnapshot, + recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Lists handles for directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -2468,12 +2589,13 @@ public Mono> li public Mono listHandlesAsync(String shareName, String directory, String marker, Integer maxresults, Integer timeout, String sharesnapshot, Boolean recursive) { return listHandlesWithResponseAsync(shareName, directory, marker, maxresults, timeout, sharesnapshot, recursive) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Lists handles for directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -2499,12 +2621,13 @@ public Mono listHandlesAsync(String shareName, String direc public Mono listHandlesAsync(String shareName, String directory, String marker, Integer maxresults, Integer timeout, String sharesnapshot, Boolean recursive, Context context) { return listHandlesWithResponseAsync(shareName, directory, marker, maxresults, timeout, sharesnapshot, recursive, - context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + context).onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Lists handles for directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -2530,14 +2653,16 @@ public Mono> listHandlesNoCustomHeadersWithRespons String directory, String marker, Integer maxresults, Integer timeout, String sharesnapshot, Boolean recursive) { final String comp = "listhandles"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.listHandlesNoCustomHeaders(this.client.getUrl(), shareName, - directory, comp, marker, maxresults, timeout, sharesnapshot, recursive, this.client.getVersion(), - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.listHandlesNoCustomHeaders(this.client.getUrl(), shareName, directory, comp, + marker, maxresults, timeout, sharesnapshot, recursive, this.client.getVersion(), + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Lists handles for directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -2565,14 +2690,16 @@ public Mono> listHandlesNoCustomHeadersWithRespons Context context) { final String comp = "listhandles"; final String accept = "application/xml"; - return service.listHandlesNoCustomHeaders(this.client.getUrl(), shareName, directory, comp, marker, maxresults, - timeout, sharesnapshot, recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .listHandlesNoCustomHeaders(this.client.getUrl(), shareName, directory, comp, marker, maxresults, timeout, + sharesnapshot, recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Lists handles for directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -2600,14 +2727,18 @@ public ResponseBase listHand Context context) { final String comp = "listhandles"; final String accept = "application/xml"; - return service.listHandlesSync(this.client.getUrl(), shareName, directory, comp, marker, maxresults, timeout, - sharesnapshot, recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.listHandlesSync(this.client.getUrl(), shareName, directory, comp, marker, maxresults, + timeout, sharesnapshot, recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Lists handles for directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -2631,13 +2762,17 @@ public ResponseBase listHand @ServiceMethod(returns = ReturnType.SINGLE) public ListHandlesResponse listHandles(String shareName, String directory, String marker, Integer maxresults, Integer timeout, String sharesnapshot, Boolean recursive) { - return listHandlesWithResponse(shareName, directory, marker, maxresults, timeout, sharesnapshot, recursive, - Context.NONE).getValue(); + try { + return listHandlesWithResponse(shareName, directory, marker, maxresults, timeout, sharesnapshot, recursive, + Context.NONE).getValue(); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Lists handles for directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -2664,14 +2799,18 @@ public Response listHandlesNoCustomHeadersWithResponse(Stri String marker, Integer maxresults, Integer timeout, String sharesnapshot, Boolean recursive, Context context) { final String comp = "listhandles"; final String accept = "application/xml"; - return service.listHandlesNoCustomHeadersSync(this.client.getUrl(), shareName, directory, comp, marker, - maxresults, timeout, sharesnapshot, recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.listHandlesNoCustomHeadersSync(this.client.getUrl(), shareName, directory, comp, marker, + maxresults, timeout, sharesnapshot, recursive, this.client.getVersion(), + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Closes all handles open for given directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -2698,14 +2837,16 @@ public Mono> forceCloseH Boolean recursive) { final String comp = "forceclosehandles"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.forceCloseHandles(this.client.getUrl(), shareName, directory, - comp, timeout, marker, sharesnapshot, handleId, recursive, this.client.getVersion(), - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.forceCloseHandles(this.client.getUrl(), shareName, directory, comp, timeout, + marker, sharesnapshot, handleId, recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Closes all handles open for given directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -2733,14 +2874,16 @@ public Mono> forceCloseH Boolean recursive, Context context) { final String comp = "forceclosehandles"; final String accept = "application/xml"; - return service.forceCloseHandles(this.client.getUrl(), shareName, directory, comp, timeout, marker, - sharesnapshot, handleId, recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .forceCloseHandles(this.client.getUrl(), shareName, directory, comp, timeout, marker, sharesnapshot, + handleId, recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Closes all handles open for given directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -2765,12 +2908,13 @@ public Mono> forceCloseH public Mono forceCloseHandlesAsync(String shareName, String directory, String handleId, Integer timeout, String marker, String sharesnapshot, Boolean recursive) { return forceCloseHandlesWithResponseAsync(shareName, directory, handleId, timeout, marker, sharesnapshot, - recursive).flatMap(ignored -> Mono.empty()); + recursive).onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Closes all handles open for given directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -2796,12 +2940,13 @@ public Mono forceCloseHandlesAsync(String shareName, String directory, Str public Mono forceCloseHandlesAsync(String shareName, String directory, String handleId, Integer timeout, String marker, String sharesnapshot, Boolean recursive, Context context) { return forceCloseHandlesWithResponseAsync(shareName, directory, handleId, timeout, marker, sharesnapshot, - recursive, context).flatMap(ignored -> Mono.empty()); + recursive, context).onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Closes all handles open for given directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -2827,14 +2972,16 @@ public Mono> forceCloseHandlesNoCustomHeadersWithResponseAsync(St String handleId, Integer timeout, String marker, String sharesnapshot, Boolean recursive) { final String comp = "forceclosehandles"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.forceCloseHandlesNoCustomHeaders(this.client.getUrl(), shareName, - directory, comp, timeout, marker, sharesnapshot, handleId, recursive, this.client.getVersion(), - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.forceCloseHandlesNoCustomHeaders(this.client.getUrl(), shareName, directory, + comp, timeout, marker, sharesnapshot, handleId, recursive, this.client.getVersion(), + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Closes all handles open for given directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -2861,14 +3008,16 @@ public Mono> forceCloseHandlesNoCustomHeadersWithResponseAsync(St String handleId, Integer timeout, String marker, String sharesnapshot, Boolean recursive, Context context) { final String comp = "forceclosehandles"; final String accept = "application/xml"; - return service.forceCloseHandlesNoCustomHeaders(this.client.getUrl(), shareName, directory, comp, timeout, - marker, sharesnapshot, handleId, recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .forceCloseHandlesNoCustomHeaders(this.client.getUrl(), shareName, directory, comp, timeout, marker, + sharesnapshot, handleId, recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Closes all handles open for given directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -2896,14 +3045,18 @@ public ResponseBase forceCloseHandles Context context) { final String comp = "forceclosehandles"; final String accept = "application/xml"; - return service.forceCloseHandlesSync(this.client.getUrl(), shareName, directory, comp, timeout, marker, - sharesnapshot, handleId, recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.forceCloseHandlesSync(this.client.getUrl(), shareName, directory, comp, timeout, marker, + sharesnapshot, handleId, recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Closes all handles open for given directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -2932,7 +3085,7 @@ public void forceCloseHandles(String shareName, String directory, String handleI /** * Closes all handles open for given directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -2959,14 +3112,18 @@ public Response forceCloseHandlesNoCustomHeadersWithResponse(String shareN String handleId, Integer timeout, String marker, String sharesnapshot, Boolean recursive, Context context) { final String comp = "forceclosehandles"; final String accept = "application/xml"; - return service.forceCloseHandlesNoCustomHeadersSync(this.client.getUrl(), shareName, directory, comp, timeout, - marker, sharesnapshot, handleId, recursive, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.forceCloseHandlesNoCustomHeadersSync(this.client.getUrl(), shareName, directory, comp, + timeout, marker, sharesnapshot, handleId, recursive, this.client.getVersion(), + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Renames a directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -3040,16 +3197,18 @@ public Mono> renameWithResponseAsyn fileChangeTimeInternal = copyFileSmbInfo.getFileChangeTime(); } String fileChangeTime = fileChangeTimeInternal; - return FluxUtil.withContext(context -> service.rename(this.client.getUrl(), shareName, directory, restype, comp, - timeout, this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, - destinationLeaseId, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, - filePermissionFormat, filePermissionKey, metadata, this.client.isAllowTrailingDot(), - this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.rename(this.client.getUrl(), shareName, directory, restype, comp, timeout, + this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, + destinationLeaseId, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, + filePermissionFormat, filePermissionKey, metadata, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Renames a directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -3125,16 +3284,18 @@ public Mono> renameWithResponseAsyn fileChangeTimeInternal = copyFileSmbInfo.getFileChangeTime(); } String fileChangeTime = fileChangeTimeInternal; - return service.rename(this.client.getUrl(), shareName, directory, restype, comp, timeout, - this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, destinationLeaseId, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, filePermissionFormat, - filePermissionKey, metadata, this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .rename(this.client.getUrl(), shareName, directory, restype, comp, timeout, this.client.getVersion(), + renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, destinationLeaseId, fileAttributes, + fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, filePermissionFormat, + filePermissionKey, metadata, this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Renames a directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -3177,12 +3338,14 @@ public Mono renameAsync(String shareName, String directory, String renameS DestinationLeaseAccessConditions destinationLeaseAccessConditions, CopyFileSmbInfo copyFileSmbInfo) { return renameWithResponseAsync(shareName, directory, renameSource, timeout, replaceIfExists, ignoreReadOnly, filePermission, filePermissionFormat, filePermissionKey, metadata, sourceLeaseAccessConditions, - destinationLeaseAccessConditions, copyFileSmbInfo).flatMap(ignored -> Mono.empty()); + destinationLeaseAccessConditions, copyFileSmbInfo) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Renames a directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -3227,12 +3390,14 @@ public Mono renameAsync(String shareName, String directory, String renameS Context context) { return renameWithResponseAsync(shareName, directory, renameSource, timeout, replaceIfExists, ignoreReadOnly, filePermission, filePermissionFormat, filePermissionKey, metadata, sourceLeaseAccessConditions, - destinationLeaseAccessConditions, copyFileSmbInfo, context).flatMap(ignored -> Mono.empty()); + destinationLeaseAccessConditions, copyFileSmbInfo, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Renames a directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -3306,16 +3471,18 @@ public Mono> renameNoCustomHeadersWithResponseAsync(String shareN fileChangeTimeInternal = copyFileSmbInfo.getFileChangeTime(); } String fileChangeTime = fileChangeTimeInternal; - return FluxUtil.withContext(context -> service.renameNoCustomHeaders(this.client.getUrl(), shareName, directory, - restype, comp, timeout, this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, - sourceLeaseId, destinationLeaseId, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, - filePermission, filePermissionFormat, filePermissionKey, metadata, this.client.isAllowTrailingDot(), - this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.renameNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, + comp, timeout, this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, + destinationLeaseId, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, + filePermissionFormat, filePermissionKey, metadata, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Renames a directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -3391,16 +3558,18 @@ public Mono> renameNoCustomHeadersWithResponseAsync(String shareN fileChangeTimeInternal = copyFileSmbInfo.getFileChangeTime(); } String fileChangeTime = fileChangeTimeInternal; - return service.renameNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, comp, timeout, - this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, destinationLeaseId, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, filePermissionFormat, - filePermissionKey, metadata, this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .renameNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, comp, timeout, + this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, + destinationLeaseId, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, + filePermissionFormat, filePermissionKey, metadata, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Renames a directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -3476,16 +3645,20 @@ public ResponseBase renameWithResponse(String sh fileChangeTimeInternal = copyFileSmbInfo.getFileChangeTime(); } String fileChangeTime = fileChangeTimeInternal; - return service.renameSync(this.client.getUrl(), shareName, directory, restype, comp, timeout, - this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, destinationLeaseId, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, filePermissionFormat, - filePermissionKey, metadata, this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.renameSync(this.client.getUrl(), shareName, directory, restype, comp, timeout, + this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, + destinationLeaseId, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, + filePermissionFormat, filePermissionKey, metadata, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Renames a directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -3532,7 +3705,7 @@ public void rename(String shareName, String directory, String renameSource, Inte /** * Renames a directory. - * + * * @param shareName The name of the target share. * @param directory The path of the target directory. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -3608,10 +3781,14 @@ public Response renameNoCustomHeadersWithResponse(String shareName, String fileChangeTimeInternal = copyFileSmbInfo.getFileChangeTime(); } String fileChangeTime = fileChangeTimeInternal; - return service.renameNoCustomHeadersSync(this.client.getUrl(), shareName, directory, restype, comp, timeout, - this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, destinationLeaseId, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, filePermissionFormat, - filePermissionKey, metadata, this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.renameNoCustomHeadersSync(this.client.getUrl(), shareName, directory, restype, comp, timeout, + this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, + destinationLeaseId, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, + filePermissionFormat, filePermissionKey, metadata, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/FilesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/FilesImpl.java index 28a5606f1834..3038b587104b 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/FilesImpl.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/FilesImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.file.share.implementation; import com.azure.core.annotation.BodyParam; @@ -63,11 +62,13 @@ import java.util.Map; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import com.azure.storage.file.share.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in Files. */ public final class FilesImpl { + /** * The proxy service used to perform REST calls. */ @@ -80,7 +81,7 @@ public final class FilesImpl { /** * Initializes an instance of FilesImpl. - * + * * @param client the instance of the service client containing this operation class. */ FilesImpl(AzureFileStorageImpl client) { @@ -95,6 +96,7 @@ public final class FilesImpl { @Host("{url}") @ServiceInterface(name = "AzureFileStorageFile") public interface FilesService { + @Put("/{shareName}/{fileName}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(ShareStorageExceptionInternal.class) @@ -1220,7 +1222,7 @@ Response renameNoCustomHeadersSync(@HostParam("url") String url, @PathPara /** * Creates a new file or replaces a file. Note it only initializes the file with no content. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileContentLength Specifies the maximum size for the file, up to 4 TB. @@ -1290,16 +1292,19 @@ public Mono> createWithResponseAsync(Stri } String contentDisposition = contentDispositionInternal; String contentMd5Converted = Base64Util.encodeToString(contentMd5); - return FluxUtil.withContext(context -> service.create(this.client.getUrl(), shareName, fileName, - this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), fileContentLength, fileTypeConstant, - contentType, contentEncoding, contentLanguage, cacheControl, contentMd5Converted, contentDisposition, - metadata, filePermission, filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, - fileLastWriteTime, fileChangeTime, leaseId, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext( + context -> service.create(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), + timeout, this.client.getVersion(), fileContentLength, fileTypeConstant, contentType, + contentEncoding, contentLanguage, cacheControl, contentMd5Converted, contentDisposition, metadata, + filePermission, filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, + fileLastWriteTime, fileChangeTime, leaseId, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a new file or replaces a file. Note it only initializes the file with no content. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileContentLength Specifies the maximum size for the file, up to 4 TB. @@ -1370,16 +1375,18 @@ public Mono> createWithResponseAsync(Stri } String contentDisposition = contentDispositionInternal; String contentMd5Converted = Base64Util.encodeToString(contentMd5); - return service.create(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), timeout, - this.client.getVersion(), fileContentLength, fileTypeConstant, contentType, contentEncoding, - contentLanguage, cacheControl, contentMd5Converted, contentDisposition, metadata, filePermission, - filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, - fileChangeTime, leaseId, this.client.getFileRequestIntent(), accept, context); + return service + .create(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), timeout, + this.client.getVersion(), fileContentLength, fileTypeConstant, contentType, contentEncoding, + contentLanguage, cacheControl, contentMd5Converted, contentDisposition, metadata, filePermission, + filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, + fileChangeTime, leaseId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a new file or replaces a file. Note it only initializes the file with no content. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileContentLength Specifies the maximum size for the file, up to 4 TB. @@ -1417,12 +1424,14 @@ public Mono createAsync(String shareName, String fileName, long fileConten String leaseId, ShareFileHttpHeaders shareFileHttpHeaders) { return createWithResponseAsync(shareName, fileName, fileContentLength, fileAttributes, timeout, metadata, filePermission, filePermissionFormat, filePermissionKey, fileCreationTime, fileLastWriteTime, - fileChangeTime, leaseId, shareFileHttpHeaders).flatMap(ignored -> Mono.empty()); + fileChangeTime, leaseId, shareFileHttpHeaders) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Creates a new file or replaces a file. Note it only initializes the file with no content. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileContentLength Specifies the maximum size for the file, up to 4 TB. @@ -1461,12 +1470,14 @@ public Mono createAsync(String shareName, String fileName, long fileConten String leaseId, ShareFileHttpHeaders shareFileHttpHeaders, Context context) { return createWithResponseAsync(shareName, fileName, fileContentLength, fileAttributes, timeout, metadata, filePermission, filePermissionFormat, filePermissionKey, fileCreationTime, fileLastWriteTime, - fileChangeTime, leaseId, shareFileHttpHeaders, context).flatMap(ignored -> Mono.empty()); + fileChangeTime, leaseId, shareFileHttpHeaders, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Creates a new file or replaces a file. Note it only initializes the file with no content. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileContentLength Specifies the maximum size for the file, up to 4 TB. @@ -1540,12 +1551,13 @@ public Mono> createNoCustomHeadersWithResponseAsync(String shareN this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), fileContentLength, fileTypeConstant, contentType, contentEncoding, contentLanguage, cacheControl, contentMd5Converted, contentDisposition, metadata, filePermission, filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, - fileLastWriteTime, fileChangeTime, leaseId, this.client.getFileRequestIntent(), accept, context)); + fileLastWriteTime, fileChangeTime, leaseId, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a new file or replaces a file. Note it only initializes the file with no content. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileContentLength Specifies the maximum size for the file, up to 4 TB. @@ -1616,16 +1628,18 @@ public Mono> createNoCustomHeadersWithResponseAsync(String shareN } String contentDisposition = contentDispositionInternal; String contentMd5Converted = Base64Util.encodeToString(contentMd5); - return service.createNoCustomHeaders(this.client.getUrl(), shareName, fileName, - this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), fileContentLength, fileTypeConstant, - contentType, contentEncoding, contentLanguage, cacheControl, contentMd5Converted, contentDisposition, - metadata, filePermission, filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, - fileLastWriteTime, fileChangeTime, leaseId, this.client.getFileRequestIntent(), accept, context); + return service + .createNoCustomHeaders(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), timeout, + this.client.getVersion(), fileContentLength, fileTypeConstant, contentType, contentEncoding, + contentLanguage, cacheControl, contentMd5Converted, contentDisposition, metadata, filePermission, + filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, + fileChangeTime, leaseId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a new file or replaces a file. Note it only initializes the file with no content. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileContentLength Specifies the maximum size for the file, up to 4 TB. @@ -1696,16 +1710,20 @@ public ResponseBase createWithResponse(String shareNam } String contentDisposition = contentDispositionInternal; String contentMd5Converted = Base64Util.encodeToString(contentMd5); - return service.createSync(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), timeout, - this.client.getVersion(), fileContentLength, fileTypeConstant, contentType, contentEncoding, - contentLanguage, cacheControl, contentMd5Converted, contentDisposition, metadata, filePermission, - filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, - fileChangeTime, leaseId, this.client.getFileRequestIntent(), accept, context); + try { + return service.createSync(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), + timeout, this.client.getVersion(), fileContentLength, fileTypeConstant, contentType, contentEncoding, + contentLanguage, cacheControl, contentMd5Converted, contentDisposition, metadata, filePermission, + filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, + fileChangeTime, leaseId, this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Creates a new file or replaces a file. Note it only initializes the file with no content. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileContentLength Specifies the maximum size for the file, up to 4 TB. @@ -1747,7 +1765,7 @@ public void create(String shareName, String fileName, long fileContentLength, St /** * Creates a new file or replaces a file. Note it only initializes the file with no content. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileContentLength Specifies the maximum size for the file, up to 4 TB. @@ -1818,16 +1836,21 @@ public Response createNoCustomHeadersWithResponse(String shareName, String } String contentDisposition = contentDispositionInternal; String contentMd5Converted = Base64Util.encodeToString(contentMd5); - return service.createNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, - this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), fileContentLength, fileTypeConstant, - contentType, contentEncoding, contentLanguage, cacheControl, contentMd5Converted, contentDisposition, - metadata, filePermission, filePermissionFormat, filePermissionKey, fileAttributes, fileCreationTime, - fileLastWriteTime, fileChangeTime, leaseId, this.client.getFileRequestIntent(), accept, context); + try { + return service.createNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, + this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), fileContentLength, + fileTypeConstant, contentType, contentEncoding, contentLanguage, cacheControl, contentMd5Converted, + contentDisposition, metadata, filePermission, filePermissionFormat, filePermissionKey, fileAttributes, + fileCreationTime, fileLastWriteTime, fileChangeTime, leaseId, this.client.getFileRequestIntent(), + accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Reads or downloads a file from the system, including its metadata and properties. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1846,14 +1869,16 @@ public Response createNoCustomHeadersWithResponse(String shareName, String public Mono>> downloadWithResponseAsync(String shareName, String fileName, Integer timeout, String range, Boolean rangeGetContentMD5, String leaseId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.download(this.client.getUrl(), shareName, fileName, - this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), range, rangeGetContentMD5, leaseId, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.download(this.client.getUrl(), shareName, fileName, + this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), range, rangeGetContentMD5, leaseId, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Reads or downloads a file from the system, including its metadata and properties. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1873,14 +1898,16 @@ public Mono>> downloadWithRe public Mono>> downloadWithResponseAsync(String shareName, String fileName, Integer timeout, String range, Boolean rangeGetContentMD5, String leaseId, Context context) { final String accept = "application/xml"; - return service.download(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), timeout, - this.client.getVersion(), range, rangeGetContentMD5, leaseId, this.client.getFileRequestIntent(), accept, - context); + return service + .download(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), timeout, + this.client.getVersion(), range, rangeGetContentMD5, leaseId, this.client.getFileRequestIntent(), + accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Reads or downloads a file from the system, including its metadata and properties. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1899,12 +1926,13 @@ public Mono>> downloadWithRe public Flux downloadAsync(String shareName, String fileName, Integer timeout, String range, Boolean rangeGetContentMD5, String leaseId) { return downloadWithResponseAsync(shareName, fileName, timeout, range, rangeGetContentMD5, leaseId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * Reads or downloads a file from the system, including its metadata and properties. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1924,12 +1952,13 @@ public Flux downloadAsync(String shareName, String fileName, Integer public Flux downloadAsync(String shareName, String fileName, Integer timeout, String range, Boolean rangeGetContentMD5, String leaseId, Context context) { return downloadWithResponseAsync(shareName, fileName, timeout, range, rangeGetContentMD5, leaseId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); } /** * Reads or downloads a file from the system, including its metadata and properties. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1948,14 +1977,16 @@ public Flux downloadAsync(String shareName, String fileName, Integer public Mono downloadNoCustomHeadersWithResponseAsync(String shareName, String fileName, Integer timeout, String range, Boolean rangeGetContentMD5, String leaseId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.downloadNoCustomHeaders(this.client.getUrl(), shareName, - fileName, this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), range, rangeGetContentMD5, - leaseId, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.downloadNoCustomHeaders(this.client.getUrl(), shareName, fileName, + this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), range, rangeGetContentMD5, leaseId, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Reads or downloads a file from the system, including its metadata and properties. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1975,14 +2006,16 @@ public Mono downloadNoCustomHeadersWithResponseAsync(String shar public Mono downloadNoCustomHeadersWithResponseAsync(String shareName, String fileName, Integer timeout, String range, Boolean rangeGetContentMD5, String leaseId, Context context) { final String accept = "application/xml"; - return service.downloadNoCustomHeaders(this.client.getUrl(), shareName, fileName, - this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), range, rangeGetContentMD5, leaseId, - this.client.getFileRequestIntent(), accept, context); + return service + .downloadNoCustomHeaders(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), + timeout, this.client.getVersion(), range, rangeGetContentMD5, leaseId, + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Reads or downloads a file from the system, including its metadata and properties. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2002,14 +2035,18 @@ public Mono downloadNoCustomHeadersWithResponseAsync(String shar public ResponseBase downloadWithResponse(String shareName, String fileName, Integer timeout, String range, Boolean rangeGetContentMD5, String leaseId, Context context) { final String accept = "application/xml"; - return service.downloadSync(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), - timeout, this.client.getVersion(), range, rangeGetContentMD5, leaseId, this.client.getFileRequestIntent(), - accept, context); + try { + return service.downloadSync(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), + timeout, this.client.getVersion(), range, rangeGetContentMD5, leaseId, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Reads or downloads a file from the system, including its metadata and properties. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2027,13 +2064,17 @@ public ResponseBase downloadWithResponse(Stri @ServiceMethod(returns = ReturnType.SINGLE) public InputStream download(String shareName, String fileName, Integer timeout, String range, Boolean rangeGetContentMD5, String leaseId) { - return downloadWithResponse(shareName, fileName, timeout, range, rangeGetContentMD5, leaseId, Context.NONE) - .getValue(); + try { + return downloadWithResponse(shareName, fileName, timeout, range, rangeGetContentMD5, leaseId, Context.NONE) + .getValue(); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Reads or downloads a file from the system, including its metadata and properties. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2053,15 +2094,19 @@ public InputStream download(String shareName, String fileName, Integer timeout, public Response downloadNoCustomHeadersWithResponse(String shareName, String fileName, Integer timeout, String range, Boolean rangeGetContentMD5, String leaseId, Context context) { final String accept = "application/xml"; - return service.downloadNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, - this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), range, rangeGetContentMD5, leaseId, - this.client.getFileRequestIntent(), accept, context); + try { + return service.downloadNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, + this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), range, rangeGetContentMD5, leaseId, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not * return the content of the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -2079,15 +2124,17 @@ public Response downloadNoCustomHeadersWithResponse(String shareNam public Mono> getPropertiesWithResponseAsync(String shareName, String fileName, String sharesnapshot, Integer timeout, String leaseId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getProperties(this.client.getUrl(), shareName, fileName, - this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.getProperties(this.client.getUrl(), shareName, fileName, + this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not * return the content of the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -2106,15 +2153,16 @@ public Mono> getPropertiesWithResp public Mono> getPropertiesWithResponseAsync(String shareName, String fileName, String sharesnapshot, Integer timeout, String leaseId, Context context) { final String accept = "application/xml"; - return service.getProperties(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), - sharesnapshot, timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, - context); + return service + .getProperties(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), sharesnapshot, + timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not * return the content of the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -2132,13 +2180,14 @@ public Mono> getPropertiesWithResp public Mono getPropertiesAsync(String shareName, String fileName, String sharesnapshot, Integer timeout, String leaseId) { return getPropertiesWithResponseAsync(shareName, fileName, sharesnapshot, timeout, leaseId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not * return the content of the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -2157,13 +2206,14 @@ public Mono getPropertiesAsync(String shareName, String fileName, String s public Mono getPropertiesAsync(String shareName, String fileName, String sharesnapshot, Integer timeout, String leaseId, Context context) { return getPropertiesWithResponseAsync(shareName, fileName, sharesnapshot, timeout, leaseId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not * return the content of the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -2181,15 +2231,17 @@ public Mono getPropertiesAsync(String shareName, String fileName, String s public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String shareName, String fileName, String sharesnapshot, Integer timeout, String leaseId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), shareName, - fileName, this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), shareName, fileName, + this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not * return the content of the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -2208,15 +2260,17 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String shareName, String fileName, String sharesnapshot, Integer timeout, String leaseId, Context context) { final String accept = "application/xml"; - return service.getPropertiesNoCustomHeaders(this.client.getUrl(), shareName, fileName, - this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context); + return service + .getPropertiesNoCustomHeaders(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), + sharesnapshot, timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, + context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not * return the content of the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -2235,15 +2289,19 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String public ResponseBase getPropertiesWithResponse(String shareName, String fileName, String sharesnapshot, Integer timeout, String leaseId, Context context) { final String accept = "application/xml"; - return service.getPropertiesSync(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), - sharesnapshot, timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, - context); + try { + return service.getPropertiesSync(this.client.getUrl(), shareName, fileName, + this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not * return the content of the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -2265,7 +2323,7 @@ public void getProperties(String shareName, String fileName, String sharesnapsho /** * Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not * return the content of the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -2284,14 +2342,18 @@ public void getProperties(String shareName, String fileName, String sharesnapsho public Response getPropertiesNoCustomHeadersWithResponse(String shareName, String fileName, String sharesnapshot, Integer timeout, String leaseId, Context context) { final String accept = "application/xml"; - return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, - this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context); + try { + return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, + this.client.isAllowTrailingDot(), sharesnapshot, timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * removes the file from the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2307,14 +2369,16 @@ public Response getPropertiesNoCustomHeadersWithResponse(String shareName, public Mono> deleteWithResponseAsync(String shareName, String fileName, Integer timeout, String leaseId) { final String accept = "application/xml"; - return FluxUtil.withContext( - context -> service.delete(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), - timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext( + context -> service.delete(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), + timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * removes the file from the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2331,13 +2395,15 @@ public Mono> deleteWithResponseAsync(Stri public Mono> deleteWithResponseAsync(String shareName, String fileName, Integer timeout, String leaseId, Context context) { final String accept = "application/xml"; - return service.delete(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + return service + .delete(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), timeout, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * removes the file from the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2351,12 +2417,14 @@ public Mono> deleteWithResponseAsync(Stri */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteAsync(String shareName, String fileName, Integer timeout, String leaseId) { - return deleteWithResponseAsync(shareName, fileName, timeout, leaseId).flatMap(ignored -> Mono.empty()); + return deleteWithResponseAsync(shareName, fileName, timeout, leaseId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * removes the file from the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2371,12 +2439,14 @@ public Mono deleteAsync(String shareName, String fileName, Integer timeout */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteAsync(String shareName, String fileName, Integer timeout, String leaseId, Context context) { - return deleteWithResponseAsync(shareName, fileName, timeout, leaseId, context).flatMap(ignored -> Mono.empty()); + return deleteWithResponseAsync(shareName, fileName, timeout, leaseId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * removes the file from the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2392,14 +2462,16 @@ public Mono deleteAsync(String shareName, String fileName, Integer timeout public Mono> deleteNoCustomHeadersWithResponseAsync(String shareName, String fileName, Integer timeout, String leaseId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), shareName, fileName, - this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), shareName, fileName, + this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * removes the file from the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2416,14 +2488,15 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String shareN public Mono> deleteNoCustomHeadersWithResponseAsync(String shareName, String fileName, Integer timeout, String leaseId, Context context) { final String accept = "application/xml"; - return service.deleteNoCustomHeaders(this.client.getUrl(), shareName, fileName, - this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context); + return service + .deleteNoCustomHeaders(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), timeout, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * removes the file from the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2440,13 +2513,17 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String shareN public ResponseBase deleteWithResponse(String shareName, String fileName, Integer timeout, String leaseId, Context context) { final String accept = "application/xml"; - return service.deleteSync(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + try { + return service.deleteSync(this.client.getUrl(), shareName, fileName, this.client.isAllowTrailingDot(), + timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * removes the file from the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2464,7 +2541,7 @@ public void delete(String shareName, String fileName, Integer timeout, String le /** * removes the file from the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2481,14 +2558,18 @@ public void delete(String shareName, String fileName, Integer timeout, String le public Response deleteNoCustomHeadersWithResponse(String shareName, String fileName, Integer timeout, String leaseId, Context context) { final String accept = "application/xml"; - return service.deleteNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, - this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context); + try { + return service.deleteNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, + this.client.isAllowTrailingDot(), timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Sets HTTP headers on the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -2557,16 +2638,18 @@ public Mono> setHttpHeadersWithRe } String contentDisposition = contentDispositionInternal; String contentMd5Converted = Base64Util.encodeToString(contentMd5); - return FluxUtil.withContext(context -> service.setHttpHeaders(this.client.getUrl(), shareName, fileName, comp, - timeout, this.client.getVersion(), fileContentLength, contentType, contentEncoding, contentLanguage, - cacheControl, contentMd5Converted, contentDisposition, filePermission, filePermissionFormat, - filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, leaseId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.setHttpHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, + this.client.getVersion(), fileContentLength, contentType, contentEncoding, contentLanguage, + cacheControl, contentMd5Converted, contentDisposition, filePermission, filePermissionFormat, + filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, leaseId, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets HTTP headers on the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -2637,16 +2720,18 @@ public Mono> setHttpHeadersWithRe } String contentDisposition = contentDispositionInternal; String contentMd5Converted = Base64Util.encodeToString(contentMd5); - return service.setHttpHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, - this.client.getVersion(), fileContentLength, contentType, contentEncoding, contentLanguage, cacheControl, - contentMd5Converted, contentDisposition, filePermission, filePermissionFormat, filePermissionKey, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, leaseId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context); + return service + .setHttpHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, this.client.getVersion(), + fileContentLength, contentType, contentEncoding, contentLanguage, cacheControl, contentMd5Converted, + contentDisposition, filePermission, filePermissionFormat, filePermissionKey, fileAttributes, + fileCreationTime, fileLastWriteTime, fileChangeTime, leaseId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets HTTP headers on the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -2684,12 +2769,14 @@ public Mono setHttpHeadersAsync(String shareName, String fileName, String String leaseId, ShareFileHttpHeaders shareFileHttpHeaders) { return setHttpHeadersWithResponseAsync(shareName, fileName, fileAttributes, timeout, fileContentLength, filePermission, filePermissionFormat, filePermissionKey, fileCreationTime, fileLastWriteTime, - fileChangeTime, leaseId, shareFileHttpHeaders).flatMap(ignored -> Mono.empty()); + fileChangeTime, leaseId, shareFileHttpHeaders) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Sets HTTP headers on the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -2728,12 +2815,14 @@ public Mono setHttpHeadersAsync(String shareName, String fileName, String String leaseId, ShareFileHttpHeaders shareFileHttpHeaders, Context context) { return setHttpHeadersWithResponseAsync(shareName, fileName, fileAttributes, timeout, fileContentLength, filePermission, filePermissionFormat, filePermissionKey, fileCreationTime, fileLastWriteTime, - fileChangeTime, leaseId, shareFileHttpHeaders, context).flatMap(ignored -> Mono.empty()); + fileChangeTime, leaseId, shareFileHttpHeaders, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Sets HTTP headers on the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -2802,17 +2891,19 @@ public Mono> setHttpHeadersNoCustomHeadersWithResponseAsync(Strin } String contentDisposition = contentDispositionInternal; String contentMd5Converted = Base64Util.encodeToString(contentMd5); - return FluxUtil.withContext( - context -> service.setHttpHeadersNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, - this.client.getVersion(), fileContentLength, contentType, contentEncoding, contentLanguage, - cacheControl, contentMd5Converted, contentDisposition, filePermission, filePermissionFormat, - filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, leaseId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext( + context -> service.setHttpHeadersNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, + timeout, this.client.getVersion(), fileContentLength, contentType, contentEncoding, contentLanguage, + cacheControl, contentMd5Converted, contentDisposition, filePermission, filePermissionFormat, + filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, leaseId, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets HTTP headers on the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -2883,16 +2974,18 @@ public Mono> setHttpHeadersNoCustomHeadersWithResponseAsync(Strin } String contentDisposition = contentDispositionInternal; String contentMd5Converted = Base64Util.encodeToString(contentMd5); - return service.setHttpHeadersNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, - this.client.getVersion(), fileContentLength, contentType, contentEncoding, contentLanguage, cacheControl, - contentMd5Converted, contentDisposition, filePermission, filePermissionFormat, filePermissionKey, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, leaseId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context); + return service + .setHttpHeadersNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, + this.client.getVersion(), fileContentLength, contentType, contentEncoding, contentLanguage, + cacheControl, contentMd5Converted, contentDisposition, filePermission, filePermissionFormat, + filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, leaseId, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets HTTP headers on the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -2963,16 +3056,20 @@ public ResponseBase setHttpHeadersWithResponse } String contentDisposition = contentDispositionInternal; String contentMd5Converted = Base64Util.encodeToString(contentMd5); - return service.setHttpHeadersSync(this.client.getUrl(), shareName, fileName, comp, timeout, - this.client.getVersion(), fileContentLength, contentType, contentEncoding, contentLanguage, cacheControl, - contentMd5Converted, contentDisposition, filePermission, filePermissionFormat, filePermissionKey, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, leaseId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context); + try { + return service.setHttpHeadersSync(this.client.getUrl(), shareName, fileName, comp, timeout, + this.client.getVersion(), fileContentLength, contentType, contentEncoding, contentLanguage, + cacheControl, contentMd5Converted, contentDisposition, filePermission, filePermissionFormat, + filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, leaseId, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Sets HTTP headers on the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -3014,7 +3111,7 @@ public void setHttpHeaders(String shareName, String fileName, String fileAttribu /** * Sets HTTP headers on the file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file @@ -3085,16 +3182,20 @@ public Response setHttpHeadersNoCustomHeadersWithResponse(String shareName } String contentDisposition = contentDispositionInternal; String contentMd5Converted = Base64Util.encodeToString(contentMd5); - return service.setHttpHeadersNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, timeout, - this.client.getVersion(), fileContentLength, contentType, contentEncoding, contentLanguage, cacheControl, - contentMd5Converted, contentDisposition, filePermission, filePermissionFormat, filePermissionKey, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, leaseId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context); + try { + return service.setHttpHeadersNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, timeout, + this.client.getVersion(), fileContentLength, contentType, contentEncoding, contentLanguage, + cacheControl, contentMd5Converted, contentDisposition, filePermission, filePermissionFormat, + filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, leaseId, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3130,15 +3231,17 @@ public Mono> uploadRangeWithResponse final String comp = "range"; final String accept = "application/xml"; String contentMD5Converted = Base64Util.encodeToString(contentMD5); - return FluxUtil.withContext(context -> service.uploadRange(this.client.getUrl(), shareName, fileName, comp, - timeout, range, fileRangeWrite, contentLength, contentMD5Converted, this.client.getVersion(), leaseId, - fileLastWrittenMode, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, - accept, context)); + return FluxUtil + .withContext(context -> service.uploadRange(this.client.getUrl(), shareName, fileName, comp, timeout, range, + fileRangeWrite, contentLength, contentMD5Converted, this.client.getVersion(), leaseId, + fileLastWrittenMode, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, + accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3176,14 +3279,16 @@ public Mono> uploadRangeWithResponse final String comp = "range"; final String accept = "application/xml"; String contentMD5Converted = Base64Util.encodeToString(contentMD5); - return service.uploadRange(this.client.getUrl(), shareName, fileName, comp, timeout, range, fileRangeWrite, - contentLength, contentMD5Converted, this.client.getVersion(), leaseId, fileLastWrittenMode, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, accept, context); + return service + .uploadRange(this.client.getUrl(), shareName, fileName, comp, timeout, range, fileRangeWrite, contentLength, + contentMD5Converted, this.client.getVersion(), leaseId, fileLastWrittenMode, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3217,12 +3322,14 @@ public Mono uploadRangeAsync(String shareName, String fileName, String ran ShareFileRangeWriteType fileRangeWrite, long contentLength, Integer timeout, byte[] contentMD5, String leaseId, FileLastWrittenMode fileLastWrittenMode, Flux optionalbody) { return uploadRangeWithResponseAsync(shareName, fileName, range, fileRangeWrite, contentLength, timeout, - contentMD5, leaseId, fileLastWrittenMode, optionalbody).flatMap(ignored -> Mono.empty()); + contentMD5, leaseId, fileLastWrittenMode, optionalbody) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3257,12 +3364,14 @@ public Mono uploadRangeAsync(String shareName, String fileName, String ran ShareFileRangeWriteType fileRangeWrite, long contentLength, Integer timeout, byte[] contentMD5, String leaseId, FileLastWrittenMode fileLastWrittenMode, Flux optionalbody, Context context) { return uploadRangeWithResponseAsync(shareName, fileName, range, fileRangeWrite, contentLength, timeout, - contentMD5, leaseId, fileLastWrittenMode, optionalbody, context).flatMap(ignored -> Mono.empty()); + contentMD5, leaseId, fileLastWrittenMode, optionalbody, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3298,15 +3407,17 @@ public Mono> uploadRangeNoCustomHeadersWithResponseAsync(String s final String comp = "range"; final String accept = "application/xml"; String contentMD5Converted = Base64Util.encodeToString(contentMD5); - return FluxUtil.withContext(context -> service.uploadRangeNoCustomHeaders(this.client.getUrl(), shareName, - fileName, comp, timeout, range, fileRangeWrite, contentLength, contentMD5Converted, - this.client.getVersion(), leaseId, fileLastWrittenMode, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), optionalbody, accept, context)); + return FluxUtil + .withContext(context -> service.uploadRangeNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, + timeout, range, fileRangeWrite, contentLength, contentMD5Converted, this.client.getVersion(), leaseId, + fileLastWrittenMode, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, + accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3343,14 +3454,16 @@ public Mono> uploadRangeNoCustomHeadersWithResponseAsync(String s final String comp = "range"; final String accept = "application/xml"; String contentMD5Converted = Base64Util.encodeToString(contentMD5); - return service.uploadRangeNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, range, - fileRangeWrite, contentLength, contentMD5Converted, this.client.getVersion(), leaseId, fileLastWrittenMode, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, accept, context); + return service + .uploadRangeNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, range, fileRangeWrite, + contentLength, contentMD5Converted, this.client.getVersion(), leaseId, fileLastWrittenMode, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3386,15 +3499,17 @@ public Mono> uploadRangeWithResponse final String comp = "range"; final String accept = "application/xml"; String contentMD5Converted = Base64Util.encodeToString(contentMD5); - return FluxUtil.withContext(context -> service.uploadRange(this.client.getUrl(), shareName, fileName, comp, - timeout, range, fileRangeWrite, contentLength, contentMD5Converted, this.client.getVersion(), leaseId, - fileLastWrittenMode, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, - accept, context)); + return FluxUtil + .withContext(context -> service.uploadRange(this.client.getUrl(), shareName, fileName, comp, timeout, range, + fileRangeWrite, contentLength, contentMD5Converted, this.client.getVersion(), leaseId, + fileLastWrittenMode, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, + accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3432,14 +3547,16 @@ public Mono> uploadRangeWithResponse final String comp = "range"; final String accept = "application/xml"; String contentMD5Converted = Base64Util.encodeToString(contentMD5); - return service.uploadRange(this.client.getUrl(), shareName, fileName, comp, timeout, range, fileRangeWrite, - contentLength, contentMD5Converted, this.client.getVersion(), leaseId, fileLastWrittenMode, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, accept, context); + return service + .uploadRange(this.client.getUrl(), shareName, fileName, comp, timeout, range, fileRangeWrite, contentLength, + contentMD5Converted, this.client.getVersion(), leaseId, fileLastWrittenMode, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3473,12 +3590,14 @@ public Mono uploadRangeAsync(String shareName, String fileName, String ran ShareFileRangeWriteType fileRangeWrite, long contentLength, Integer timeout, byte[] contentMD5, String leaseId, FileLastWrittenMode fileLastWrittenMode, BinaryData optionalbody) { return uploadRangeWithResponseAsync(shareName, fileName, range, fileRangeWrite, contentLength, timeout, - contentMD5, leaseId, fileLastWrittenMode, optionalbody).flatMap(ignored -> Mono.empty()); + contentMD5, leaseId, fileLastWrittenMode, optionalbody) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3513,12 +3632,14 @@ public Mono uploadRangeAsync(String shareName, String fileName, String ran ShareFileRangeWriteType fileRangeWrite, long contentLength, Integer timeout, byte[] contentMD5, String leaseId, FileLastWrittenMode fileLastWrittenMode, BinaryData optionalbody, Context context) { return uploadRangeWithResponseAsync(shareName, fileName, range, fileRangeWrite, contentLength, timeout, - contentMD5, leaseId, fileLastWrittenMode, optionalbody, context).flatMap(ignored -> Mono.empty()); + contentMD5, leaseId, fileLastWrittenMode, optionalbody, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3554,15 +3675,17 @@ public Mono> uploadRangeNoCustomHeadersWithResponseAsync(String s final String comp = "range"; final String accept = "application/xml"; String contentMD5Converted = Base64Util.encodeToString(contentMD5); - return FluxUtil.withContext(context -> service.uploadRangeNoCustomHeaders(this.client.getUrl(), shareName, - fileName, comp, timeout, range, fileRangeWrite, contentLength, contentMD5Converted, - this.client.getVersion(), leaseId, fileLastWrittenMode, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), optionalbody, accept, context)); + return FluxUtil + .withContext(context -> service.uploadRangeNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, + timeout, range, fileRangeWrite, contentLength, contentMD5Converted, this.client.getVersion(), leaseId, + fileLastWrittenMode, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, + accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3599,14 +3722,16 @@ public Mono> uploadRangeNoCustomHeadersWithResponseAsync(String s final String comp = "range"; final String accept = "application/xml"; String contentMD5Converted = Base64Util.encodeToString(contentMD5); - return service.uploadRangeNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, range, - fileRangeWrite, contentLength, contentMD5Converted, this.client.getVersion(), leaseId, fileLastWrittenMode, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, accept, context); + return service + .uploadRangeNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, range, fileRangeWrite, + contentLength, contentMD5Converted, this.client.getVersion(), leaseId, fileLastWrittenMode, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3643,14 +3768,19 @@ public ResponseBase uploadRangeWithResponse(Strin final String comp = "range"; final String accept = "application/xml"; String contentMD5Converted = Base64Util.encodeToString(contentMD5); - return service.uploadRangeSync(this.client.getUrl(), shareName, fileName, comp, timeout, range, fileRangeWrite, - contentLength, contentMD5Converted, this.client.getVersion(), leaseId, fileLastWrittenMode, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, accept, context); + try { + return service.uploadRangeSync(this.client.getUrl(), shareName, fileName, comp, timeout, range, + fileRangeWrite, contentLength, contentMD5Converted, this.client.getVersion(), leaseId, + fileLastWrittenMode, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, + accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3688,7 +3818,7 @@ public void uploadRange(String shareName, String fileName, String range, ShareFi /** * Upload a range of bytes to a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. @@ -3725,14 +3855,19 @@ public Response uploadRangeNoCustomHeadersWithResponse(String shareName, S final String comp = "range"; final String accept = "application/xml"; String contentMD5Converted = Base64Util.encodeToString(contentMD5); - return service.uploadRangeNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, timeout, range, - fileRangeWrite, contentLength, contentMD5Converted, this.client.getVersion(), leaseId, fileLastWrittenMode, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, accept, context); + try { + return service.uploadRangeNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, timeout, + range, fileRangeWrite, contentLength, contentMD5Converted, this.client.getVersion(), leaseId, + fileLastWrittenMode, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), optionalbody, + accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Updates user-defined metadata for the specified file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3750,14 +3885,16 @@ public Mono> setMetadataWithResponse String fileName, Integer timeout, Map metadata, String leaseId) { final String comp = "metadata"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setMetadata(this.client.getUrl(), shareName, fileName, comp, - timeout, metadata, this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.setMetadata(this.client.getUrl(), shareName, fileName, comp, timeout, + metadata, this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Updates user-defined metadata for the specified file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3776,14 +3913,15 @@ public Mono> setMetadataWithResponse String fileName, Integer timeout, Map metadata, String leaseId, Context context) { final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadata(this.client.getUrl(), shareName, fileName, comp, timeout, metadata, - this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), - accept, context); + return service + .setMetadata(this.client.getUrl(), shareName, fileName, comp, timeout, metadata, this.client.getVersion(), + leaseId, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Updates user-defined metadata for the specified file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3800,12 +3938,13 @@ public Mono> setMetadataWithResponse public Mono setMetadataAsync(String shareName, String fileName, Integer timeout, Map metadata, String leaseId) { return setMetadataWithResponseAsync(shareName, fileName, timeout, metadata, leaseId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Updates user-defined metadata for the specified file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3823,12 +3962,13 @@ public Mono setMetadataAsync(String shareName, String fileName, Integer ti public Mono setMetadataAsync(String shareName, String fileName, Integer timeout, Map metadata, String leaseId, Context context) { return setMetadataWithResponseAsync(shareName, fileName, timeout, metadata, leaseId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Updates user-defined metadata for the specified file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3846,14 +3986,16 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String s Integer timeout, Map metadata, String leaseId) { final String comp = "metadata"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setMetadataNoCustomHeaders(this.client.getUrl(), shareName, - fileName, comp, timeout, metadata, this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.setMetadataNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, + timeout, metadata, this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Updates user-defined metadata for the specified file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3872,14 +4014,16 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String s Integer timeout, Map metadata, String leaseId, Context context) { final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadataNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, metadata, - this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), - accept, context); + return service + .setMetadataNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, metadata, + this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), + accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Updates user-defined metadata for the specified file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3898,14 +4042,18 @@ public ResponseBase setMetadataWithResponse(Strin Integer timeout, Map metadata, String leaseId, Context context) { final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadataSync(this.client.getUrl(), shareName, fileName, comp, timeout, metadata, - this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), - accept, context); + try { + return service.setMetadataSync(this.client.getUrl(), shareName, fileName, comp, timeout, metadata, + this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), + accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Updates user-defined metadata for the specified file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3925,7 +4073,7 @@ public void setMetadata(String shareName, String fileName, Integer timeout, Map< /** * Updates user-defined metadata for the specified file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3944,14 +4092,18 @@ public Response setMetadataNoCustomHeadersWithResponse(String shareName, S Map metadata, String leaseId, Context context) { final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadataNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, timeout, - metadata, this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.setMetadataNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, timeout, + metadata, this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3976,14 +4128,16 @@ public Mono> acquireLeaseWithRespon final String comp = "lease"; final String action = "acquire"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.acquireLease(this.client.getUrl(), shareName, fileName, comp, - action, timeout, duration, proposedLeaseId, this.client.getVersion(), requestId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.acquireLease(this.client.getUrl(), shareName, fileName, comp, action, + timeout, duration, proposedLeaseId, this.client.getVersion(), requestId, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4009,14 +4163,16 @@ public Mono> acquireLeaseWithRespon final String comp = "lease"; final String action = "acquire"; final String accept = "application/xml"; - return service.acquireLease(this.client.getUrl(), shareName, fileName, comp, action, timeout, duration, - proposedLeaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .acquireLease(this.client.getUrl(), shareName, fileName, comp, action, timeout, duration, proposedLeaseId, + this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4039,12 +4195,13 @@ public Mono> acquireLeaseWithRespon public Mono acquireLeaseAsync(String shareName, String fileName, Integer timeout, Integer duration, String proposedLeaseId, String requestId) { return acquireLeaseWithResponseAsync(shareName, fileName, timeout, duration, proposedLeaseId, requestId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4068,12 +4225,13 @@ public Mono acquireLeaseAsync(String shareName, String fileName, Integer t public Mono acquireLeaseAsync(String shareName, String fileName, Integer timeout, Integer duration, String proposedLeaseId, String requestId, Context context) { return acquireLeaseWithResponseAsync(shareName, fileName, timeout, duration, proposedLeaseId, requestId, - context).flatMap(ignored -> Mono.empty()); + context).onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4098,14 +4256,16 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String final String comp = "lease"; final String action = "acquire"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.acquireLeaseNoCustomHeaders(this.client.getUrl(), shareName, - fileName, comp, action, timeout, duration, proposedLeaseId, this.client.getVersion(), requestId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.acquireLeaseNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, + action, timeout, duration, proposedLeaseId, this.client.getVersion(), requestId, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4131,14 +4291,16 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String final String comp = "lease"; final String action = "acquire"; final String accept = "application/xml"; - return service.acquireLeaseNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, action, timeout, - duration, proposedLeaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .acquireLeaseNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, action, timeout, duration, + proposedLeaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4164,14 +4326,18 @@ public ResponseBase acquireLeaseWithResponse(Str final String comp = "lease"; final String action = "acquire"; final String accept = "application/xml"; - return service.acquireLeaseSync(this.client.getUrl(), shareName, fileName, comp, action, timeout, duration, - proposedLeaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.acquireLeaseSync(this.client.getUrl(), shareName, fileName, comp, action, timeout, duration, + proposedLeaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4197,7 +4363,7 @@ public void acquireLease(String shareName, String fileName, Integer timeout, Int /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4223,14 +4389,18 @@ public Response acquireLeaseNoCustomHeadersWithResponse(String shareName, final String comp = "lease"; final String action = "acquire"; final String accept = "application/xml"; - return service.acquireLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, action, timeout, - duration, proposedLeaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.acquireLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, action, + timeout, duration, proposedLeaseId, this.client.getVersion(), requestId, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4250,14 +4420,16 @@ public Mono> releaseLeaseWithRespon final String comp = "lease"; final String action = "release"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.releaseLease(this.client.getUrl(), shareName, fileName, comp, - action, timeout, leaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.releaseLease(this.client.getUrl(), shareName, fileName, comp, action, + timeout, leaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4278,14 +4450,16 @@ public Mono> releaseLeaseWithRespon final String comp = "lease"; final String action = "release"; final String accept = "application/xml"; - return service.releaseLease(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, - this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), - accept, context); + return service + .releaseLease(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, + this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4303,12 +4477,13 @@ public Mono> releaseLeaseWithRespon public Mono releaseLeaseAsync(String shareName, String fileName, String leaseId, Integer timeout, String requestId) { return releaseLeaseWithResponseAsync(shareName, fileName, leaseId, timeout, requestId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4327,12 +4502,13 @@ public Mono releaseLeaseAsync(String shareName, String fileName, String le public Mono releaseLeaseAsync(String shareName, String fileName, String leaseId, Integer timeout, String requestId, Context context) { return releaseLeaseWithResponseAsync(shareName, fileName, leaseId, timeout, requestId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4352,14 +4528,16 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String final String comp = "lease"; final String action = "release"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.releaseLeaseNoCustomHeaders(this.client.getUrl(), shareName, - fileName, comp, action, timeout, leaseId, this.client.getVersion(), requestId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.releaseLeaseNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, + action, timeout, leaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4380,14 +4558,16 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String final String comp = "lease"; final String action = "release"; final String accept = "application/xml"; - return service.releaseLeaseNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, action, timeout, - leaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .releaseLeaseNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, + this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4408,14 +4588,18 @@ public ResponseBase releaseLeaseWithResponse(Str final String comp = "lease"; final String action = "release"; final String accept = "application/xml"; - return service.releaseLeaseSync(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, - this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), - accept, context); + try { + return service.releaseLeaseSync(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, + this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4435,7 +4619,7 @@ public void releaseLease(String shareName, String fileName, String leaseId, Inte /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4456,14 +4640,18 @@ public Response releaseLeaseNoCustomHeadersWithResponse(String shareName, final String comp = "lease"; final String action = "release"; final String accept = "application/xml"; - return service.releaseLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, action, timeout, - leaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.releaseLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, action, + timeout, leaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4486,14 +4674,16 @@ public Mono> changeLeaseWithResponse final String comp = "lease"; final String action = "change"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.changeLease(this.client.getUrl(), shareName, fileName, comp, - action, timeout, leaseId, proposedLeaseId, this.client.getVersion(), requestId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.changeLease(this.client.getUrl(), shareName, fileName, comp, action, + timeout, leaseId, proposedLeaseId, this.client.getVersion(), requestId, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4517,14 +4707,16 @@ public Mono> changeLeaseWithResponse final String comp = "lease"; final String action = "change"; final String accept = "application/xml"; - return service.changeLease(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, - proposedLeaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .changeLease(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, proposedLeaseId, + this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4545,12 +4737,13 @@ public Mono> changeLeaseWithResponse public Mono changeLeaseAsync(String shareName, String fileName, String leaseId, Integer timeout, String proposedLeaseId, String requestId) { return changeLeaseWithResponseAsync(shareName, fileName, leaseId, timeout, proposedLeaseId, requestId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4572,12 +4765,13 @@ public Mono changeLeaseAsync(String shareName, String fileName, String lea public Mono changeLeaseAsync(String shareName, String fileName, String leaseId, Integer timeout, String proposedLeaseId, String requestId, Context context) { return changeLeaseWithResponseAsync(shareName, fileName, leaseId, timeout, proposedLeaseId, requestId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4600,14 +4794,16 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String s final String comp = "lease"; final String action = "change"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.changeLeaseNoCustomHeaders(this.client.getUrl(), shareName, - fileName, comp, action, timeout, leaseId, proposedLeaseId, this.client.getVersion(), requestId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.changeLeaseNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, + action, timeout, leaseId, proposedLeaseId, this.client.getVersion(), requestId, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4631,14 +4827,16 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String s final String comp = "lease"; final String action = "change"; final String accept = "application/xml"; - return service.changeLeaseNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, action, timeout, - leaseId, proposedLeaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .changeLeaseNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, + proposedLeaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4662,14 +4860,18 @@ public ResponseBase changeLeaseWithResponse(Strin final String comp = "lease"; final String action = "change"; final String accept = "application/xml"; - return service.changeLeaseSync(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, - proposedLeaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.changeLeaseSync(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, + proposedLeaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4693,7 +4895,7 @@ public void changeLease(String shareName, String fileName, String leaseId, Integ /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param leaseId Specifies the current lease ID on the resource. @@ -4717,14 +4919,18 @@ public Response changeLeaseNoCustomHeadersWithResponse(String shareName, S final String comp = "lease"; final String action = "change"; final String accept = "application/xml"; - return service.changeLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, action, timeout, - leaseId, proposedLeaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.changeLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, action, + timeout, leaseId, proposedLeaseId, this.client.getVersion(), requestId, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4744,14 +4950,16 @@ public Mono> breakLeaseWithResponseAs final String comp = "lease"; final String action = "break"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.breakLease(this.client.getUrl(), shareName, fileName, comp, - action, timeout, leaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.breakLease(this.client.getUrl(), shareName, fileName, comp, action, timeout, + leaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4772,14 +4980,16 @@ public Mono> breakLeaseWithResponseAs final String comp = "lease"; final String action = "break"; final String accept = "application/xml"; - return service.breakLease(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, - this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), - accept, context); + return service + .breakLease(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, + this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4797,12 +5007,13 @@ public Mono> breakLeaseWithResponseAs public Mono breakLeaseAsync(String shareName, String fileName, Integer timeout, String leaseId, String requestId) { return breakLeaseWithResponseAsync(shareName, fileName, timeout, leaseId, requestId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4821,12 +5032,13 @@ public Mono breakLeaseAsync(String shareName, String fileName, Integer tim public Mono breakLeaseAsync(String shareName, String fileName, Integer timeout, String leaseId, String requestId, Context context) { return breakLeaseWithResponseAsync(shareName, fileName, timeout, leaseId, requestId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4846,14 +5058,16 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String sh final String comp = "lease"; final String action = "break"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.breakLeaseNoCustomHeaders(this.client.getUrl(), shareName, - fileName, comp, action, timeout, leaseId, this.client.getVersion(), requestId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.breakLeaseNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, + action, timeout, leaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4874,14 +5088,16 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String sh final String comp = "lease"; final String action = "break"; final String accept = "application/xml"; - return service.breakLeaseNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, action, timeout, - leaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .breakLeaseNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, + this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4902,14 +5118,18 @@ public ResponseBase breakLeaseWithResponse(String final String comp = "lease"; final String action = "break"; final String accept = "application/xml"; - return service.breakLeaseSync(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, - this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), - accept, context); + try { + return service.breakLeaseSync(this.client.getUrl(), shareName, fileName, comp, action, timeout, leaseId, + this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4929,7 +5149,7 @@ public void breakLease(String shareName, String fileName, Integer timeout, Strin /** * [Update] The Lease File operation establishes and manages a lock on a file for write and delete operations. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -4950,14 +5170,18 @@ public Response breakLeaseNoCustomHeadersWithResponse(String shareName, St final String comp = "lease"; final String action = "break"; final String accept = "application/xml"; - return service.breakLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, action, timeout, - leaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.breakLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, action, + timeout, leaseId, this.client.getVersion(), requestId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Upload a range of bytes to a file where the contents are read from a URL. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Writes data to the specified byte range in the file. @@ -5011,12 +5235,13 @@ public Mono> uploadRangeFromU range, copySource, sourceRange, fileRangeWriteFromUrl, contentLength, sourceContentCrc64Converted, sourceIfMatchCrc64Converted, sourceIfNoneMatchCrc64Converted, this.client.getVersion(), leaseId, copySourceAuthorization, fileLastWrittenMode, this.client.isAllowTrailingDot(), - this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Upload a range of bytes to a file where the contents are read from a URL. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Writes data to the specified byte range in the file. @@ -5067,16 +5292,18 @@ public Mono> uploadRangeFromU String sourceContentCrc64Converted = Base64Util.encodeToString(sourceContentCrc64); String sourceIfMatchCrc64Converted = Base64Util.encodeToString(sourceIfMatchCrc64); String sourceIfNoneMatchCrc64Converted = Base64Util.encodeToString(sourceIfNoneMatchCrc64); - return service.uploadRangeFromURL(this.client.getUrl(), shareName, fileName, comp, timeout, range, copySource, - sourceRange, fileRangeWriteFromUrl, contentLength, sourceContentCrc64Converted, sourceIfMatchCrc64Converted, - sourceIfNoneMatchCrc64Converted, this.client.getVersion(), leaseId, copySourceAuthorization, - fileLastWrittenMode, this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .uploadRangeFromURL(this.client.getUrl(), shareName, fileName, comp, timeout, range, copySource, + sourceRange, fileRangeWriteFromUrl, contentLength, sourceContentCrc64Converted, + sourceIfMatchCrc64Converted, sourceIfNoneMatchCrc64Converted, this.client.getVersion(), leaseId, + copySourceAuthorization, fileLastWrittenMode, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Upload a range of bytes to a file where the contents are read from a URL. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Writes data to the specified byte range in the file. @@ -5111,12 +5338,14 @@ public Mono uploadRangeFromURLAsync(String shareName, String fileName, Str SourceModifiedAccessConditions sourceModifiedAccessConditions) { return uploadRangeFromURLWithResponseAsync(shareName, fileName, range, copySource, contentLength, timeout, sourceRange, sourceContentCrc64, leaseId, copySourceAuthorization, fileLastWrittenMode, - sourceModifiedAccessConditions).flatMap(ignored -> Mono.empty()); + sourceModifiedAccessConditions) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Upload a range of bytes to a file where the contents are read from a URL. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Writes data to the specified byte range in the file. @@ -5152,12 +5381,14 @@ public Mono uploadRangeFromURLAsync(String shareName, String fileName, Str SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { return uploadRangeFromURLWithResponseAsync(shareName, fileName, range, copySource, contentLength, timeout, sourceRange, sourceContentCrc64, leaseId, copySourceAuthorization, fileLastWrittenMode, - sourceModifiedAccessConditions, context).flatMap(ignored -> Mono.empty()); + sourceModifiedAccessConditions, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Upload a range of bytes to a file where the contents are read from a URL. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Writes data to the specified byte range in the file. @@ -5206,17 +5437,19 @@ public Mono> uploadRangeFromURLNoCustomHeadersWithResponseAsync(S String sourceContentCrc64Converted = Base64Util.encodeToString(sourceContentCrc64); String sourceIfMatchCrc64Converted = Base64Util.encodeToString(sourceIfMatchCrc64); String sourceIfNoneMatchCrc64Converted = Base64Util.encodeToString(sourceIfNoneMatchCrc64); - return FluxUtil.withContext(context -> service.uploadRangeFromURLNoCustomHeaders(this.client.getUrl(), - shareName, fileName, comp, timeout, range, copySource, sourceRange, fileRangeWriteFromUrl, contentLength, - sourceContentCrc64Converted, sourceIfMatchCrc64Converted, sourceIfNoneMatchCrc64Converted, - this.client.getVersion(), leaseId, copySourceAuthorization, fileLastWrittenMode, - this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.uploadRangeFromURLNoCustomHeaders(this.client.getUrl(), shareName, fileName, + comp, timeout, range, copySource, sourceRange, fileRangeWriteFromUrl, contentLength, + sourceContentCrc64Converted, sourceIfMatchCrc64Converted, sourceIfNoneMatchCrc64Converted, + this.client.getVersion(), leaseId, copySourceAuthorization, fileLastWrittenMode, + this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Upload a range of bytes to a file where the contents are read from a URL. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Writes data to the specified byte range in the file. @@ -5267,16 +5500,18 @@ public Mono> uploadRangeFromURLNoCustomHeadersWithResponseAsync(S String sourceContentCrc64Converted = Base64Util.encodeToString(sourceContentCrc64); String sourceIfMatchCrc64Converted = Base64Util.encodeToString(sourceIfMatchCrc64); String sourceIfNoneMatchCrc64Converted = Base64Util.encodeToString(sourceIfNoneMatchCrc64); - return service.uploadRangeFromURLNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, - range, copySource, sourceRange, fileRangeWriteFromUrl, contentLength, sourceContentCrc64Converted, - sourceIfMatchCrc64Converted, sourceIfNoneMatchCrc64Converted, this.client.getVersion(), leaseId, - copySourceAuthorization, fileLastWrittenMode, this.client.isAllowTrailingDot(), - this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context); + return service + .uploadRangeFromURLNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, range, + copySource, sourceRange, fileRangeWriteFromUrl, contentLength, sourceContentCrc64Converted, + sourceIfMatchCrc64Converted, sourceIfNoneMatchCrc64Converted, this.client.getVersion(), leaseId, + copySourceAuthorization, fileLastWrittenMode, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Upload a range of bytes to a file where the contents are read from a URL. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Writes data to the specified byte range in the file. @@ -5327,16 +5562,20 @@ public ResponseBase uploadRangeFromURLWith String sourceContentCrc64Converted = Base64Util.encodeToString(sourceContentCrc64); String sourceIfMatchCrc64Converted = Base64Util.encodeToString(sourceIfMatchCrc64); String sourceIfNoneMatchCrc64Converted = Base64Util.encodeToString(sourceIfNoneMatchCrc64); - return service.uploadRangeFromURLSync(this.client.getUrl(), shareName, fileName, comp, timeout, range, - copySource, sourceRange, fileRangeWriteFromUrl, contentLength, sourceContentCrc64Converted, - sourceIfMatchCrc64Converted, sourceIfNoneMatchCrc64Converted, this.client.getVersion(), leaseId, - copySourceAuthorization, fileLastWrittenMode, this.client.isAllowTrailingDot(), - this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context); + try { + return service.uploadRangeFromURLSync(this.client.getUrl(), shareName, fileName, comp, timeout, range, + copySource, sourceRange, fileRangeWriteFromUrl, contentLength, sourceContentCrc64Converted, + sourceIfMatchCrc64Converted, sourceIfNoneMatchCrc64Converted, this.client.getVersion(), leaseId, + copySourceAuthorization, fileLastWrittenMode, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Upload a range of bytes to a file where the contents are read from a URL. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Writes data to the specified byte range in the file. @@ -5375,7 +5614,7 @@ public void uploadRangeFromURL(String shareName, String fileName, String range, /** * Upload a range of bytes to a file where the contents are read from a URL. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param range Writes data to the specified byte range in the file. @@ -5425,16 +5664,21 @@ public Response uploadRangeFromURLNoCustomHeadersWithResponse(String share String sourceContentCrc64Converted = Base64Util.encodeToString(sourceContentCrc64); String sourceIfMatchCrc64Converted = Base64Util.encodeToString(sourceIfMatchCrc64); String sourceIfNoneMatchCrc64Converted = Base64Util.encodeToString(sourceIfNoneMatchCrc64); - return service.uploadRangeFromURLNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, timeout, - range, copySource, sourceRange, fileRangeWriteFromUrl, contentLength, sourceContentCrc64Converted, - sourceIfMatchCrc64Converted, sourceIfNoneMatchCrc64Converted, this.client.getVersion(), leaseId, - copySourceAuthorization, fileLastWrittenMode, this.client.isAllowTrailingDot(), - this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context); + try { + return service.uploadRangeFromURLNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, + timeout, range, copySource, sourceRange, fileRangeWriteFromUrl, contentLength, + sourceContentCrc64Converted, sourceIfMatchCrc64Converted, sourceIfNoneMatchCrc64Converted, + this.client.getVersion(), leaseId, copySourceAuthorization, fileLastWrittenMode, + this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns the list of valid ranges for a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -5462,14 +5706,16 @@ public Mono> getRange String range, String leaseId, Boolean supportRename) { final String comp = "rangelist"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getRangeList(this.client.getUrl(), shareName, fileName, comp, - sharesnapshot, prevsharesnapshot, timeout, this.client.getVersion(), range, leaseId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), supportRename, accept, context)); + return FluxUtil + .withContext(context -> service.getRangeList(this.client.getUrl(), shareName, fileName, comp, sharesnapshot, + prevsharesnapshot, timeout, this.client.getVersion(), range, leaseId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), supportRename, accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns the list of valid ranges for a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -5498,14 +5744,16 @@ public Mono> getRange String range, String leaseId, Boolean supportRename, Context context) { final String comp = "rangelist"; final String accept = "application/xml"; - return service.getRangeList(this.client.getUrl(), shareName, fileName, comp, sharesnapshot, prevsharesnapshot, - timeout, this.client.getVersion(), range, leaseId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), supportRename, accept, context); + return service + .getRangeList(this.client.getUrl(), shareName, fileName, comp, sharesnapshot, prevsharesnapshot, timeout, + this.client.getVersion(), range, leaseId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), supportRename, accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns the list of valid ranges for a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -5531,12 +5779,14 @@ public Mono> getRange public Mono getRangeListAsync(String shareName, String fileName, String sharesnapshot, String prevsharesnapshot, Integer timeout, String range, String leaseId, Boolean supportRename) { return getRangeListWithResponseAsync(shareName, fileName, sharesnapshot, prevsharesnapshot, timeout, range, - leaseId, supportRename).flatMap(res -> Mono.justOrEmpty(res.getValue())); + leaseId, supportRename) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Returns the list of valid ranges for a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -5564,12 +5814,14 @@ public Mono getRangeListAsync(String shareName, String fileN String prevsharesnapshot, Integer timeout, String range, String leaseId, Boolean supportRename, Context context) { return getRangeListWithResponseAsync(shareName, fileName, sharesnapshot, prevsharesnapshot, timeout, range, - leaseId, supportRename, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + leaseId, supportRename, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Returns the list of valid ranges for a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -5597,14 +5849,16 @@ public Mono> getRangeListNoCustomHeadersWithRespons Boolean supportRename) { final String comp = "rangelist"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getRangeListNoCustomHeaders(this.client.getUrl(), shareName, - fileName, comp, sharesnapshot, prevsharesnapshot, timeout, this.client.getVersion(), range, leaseId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), supportRename, accept, context)); + return FluxUtil + .withContext(context -> service.getRangeListNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, + sharesnapshot, prevsharesnapshot, timeout, this.client.getVersion(), range, leaseId, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), supportRename, accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns the list of valid ranges for a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -5633,14 +5887,16 @@ public Mono> getRangeListNoCustomHeadersWithRespons Boolean supportRename, Context context) { final String comp = "rangelist"; final String accept = "application/xml"; - return service.getRangeListNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, sharesnapshot, - prevsharesnapshot, timeout, this.client.getVersion(), range, leaseId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), supportRename, accept, context); + return service + .getRangeListNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, sharesnapshot, + prevsharesnapshot, timeout, this.client.getVersion(), range, leaseId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), supportRename, accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns the list of valid ranges for a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -5669,14 +5925,18 @@ public ResponseBase getRangeListWi Boolean supportRename, Context context) { final String comp = "rangelist"; final String accept = "application/xml"; - return service.getRangeListSync(this.client.getUrl(), shareName, fileName, comp, sharesnapshot, - prevsharesnapshot, timeout, this.client.getVersion(), range, leaseId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), supportRename, accept, context); + try { + return service.getRangeListSync(this.client.getUrl(), shareName, fileName, comp, sharesnapshot, + prevsharesnapshot, timeout, this.client.getVersion(), range, leaseId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), supportRename, accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns the list of valid ranges for a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -5701,13 +5961,17 @@ public ResponseBase getRangeListWi @ServiceMethod(returns = ReturnType.SINGLE) public ShareFileRangeList getRangeList(String shareName, String fileName, String sharesnapshot, String prevsharesnapshot, Integer timeout, String range, String leaseId, Boolean supportRename) { - return getRangeListWithResponse(shareName, fileName, sharesnapshot, prevsharesnapshot, timeout, range, leaseId, - supportRename, Context.NONE).getValue(); + try { + return getRangeListWithResponse(shareName, fileName, sharesnapshot, prevsharesnapshot, timeout, range, + leaseId, supportRename, Context.NONE).getValue(); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns the list of valid ranges for a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share @@ -5736,14 +6000,18 @@ public Response getRangeListNoCustomHeadersWithResponse(Stri Boolean supportRename, Context context) { final String comp = "rangelist"; final String accept = "application/xml"; - return service.getRangeListNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, sharesnapshot, - prevsharesnapshot, timeout, this.client.getVersion(), range, leaseId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), supportRename, accept, context); + try { + return service.getRangeListNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, + sharesnapshot, prevsharesnapshot, timeout, this.client.getVersion(), range, leaseId, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), supportRename, accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Copies a blob or file to a destination file within the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another @@ -5809,16 +6077,18 @@ public Mono> startCopyWithResponseAsyn setArchiveAttributeInternal = copyFileSmbInfo.isSetArchiveAttribute(); } Boolean setArchiveAttribute = setArchiveAttributeInternal; - return FluxUtil.withContext(context -> service.startCopy(this.client.getUrl(), shareName, fileName, timeout, - this.client.getVersion(), metadata, copySource, filePermission, filePermissionKey, filePermissionCopyMode, - ignoreReadOnly, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, setArchiveAttribute, - leaseId, this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.startCopy(this.client.getUrl(), shareName, fileName, timeout, + this.client.getVersion(), metadata, copySource, filePermission, filePermissionKey, + filePermissionCopyMode, ignoreReadOnly, fileAttributes, fileCreationTime, fileLastWriteTime, + fileChangeTime, setArchiveAttribute, leaseId, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Copies a blob or file to a destination file within the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another @@ -5885,16 +6155,18 @@ public Mono> startCopyWithResponseAsyn setArchiveAttributeInternal = copyFileSmbInfo.isSetArchiveAttribute(); } Boolean setArchiveAttribute = setArchiveAttributeInternal; - return service.startCopy(this.client.getUrl(), shareName, fileName, timeout, this.client.getVersion(), metadata, - copySource, filePermission, filePermissionKey, filePermissionCopyMode, ignoreReadOnly, fileAttributes, - fileCreationTime, fileLastWriteTime, fileChangeTime, setArchiveAttribute, leaseId, - this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .startCopy(this.client.getUrl(), shareName, fileName, timeout, this.client.getVersion(), metadata, + copySource, filePermission, filePermissionKey, filePermissionCopyMode, ignoreReadOnly, fileAttributes, + fileCreationTime, fileLastWriteTime, fileChangeTime, setArchiveAttribute, leaseId, + this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Copies a blob or file to a destination file within the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another @@ -5925,12 +6197,14 @@ public Mono startCopyAsync(String shareName, String fileName, String copyS Map metadata, String filePermission, String filePermissionKey, String leaseId, CopyFileSmbInfo copyFileSmbInfo) { return startCopyWithResponseAsync(shareName, fileName, copySource, timeout, metadata, filePermission, - filePermissionKey, leaseId, copyFileSmbInfo).flatMap(ignored -> Mono.empty()); + filePermissionKey, leaseId, copyFileSmbInfo) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Copies a blob or file to a destination file within the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another @@ -5962,12 +6236,14 @@ public Mono startCopyAsync(String shareName, String fileName, String copyS Map metadata, String filePermission, String filePermissionKey, String leaseId, CopyFileSmbInfo copyFileSmbInfo, Context context) { return startCopyWithResponseAsync(shareName, fileName, copySource, timeout, metadata, filePermission, - filePermissionKey, leaseId, copyFileSmbInfo, context).flatMap(ignored -> Mono.empty()); + filePermissionKey, leaseId, copyFileSmbInfo, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Copies a blob or file to a destination file within the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another @@ -6033,16 +6309,18 @@ public Mono> startCopyNoCustomHeadersWithResponseAsync(String sha setArchiveAttributeInternal = copyFileSmbInfo.isSetArchiveAttribute(); } Boolean setArchiveAttribute = setArchiveAttributeInternal; - return FluxUtil.withContext(context -> service.startCopyNoCustomHeaders(this.client.getUrl(), shareName, - fileName, timeout, this.client.getVersion(), metadata, copySource, filePermission, filePermissionKey, - filePermissionCopyMode, ignoreReadOnly, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, - setArchiveAttribute, leaseId, this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.startCopyNoCustomHeaders(this.client.getUrl(), shareName, fileName, timeout, + this.client.getVersion(), metadata, copySource, filePermission, filePermissionKey, + filePermissionCopyMode, ignoreReadOnly, fileAttributes, fileCreationTime, fileLastWriteTime, + fileChangeTime, setArchiveAttribute, leaseId, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Copies a blob or file to a destination file within the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another @@ -6109,16 +6387,18 @@ public Mono> startCopyNoCustomHeadersWithResponseAsync(String sha setArchiveAttributeInternal = copyFileSmbInfo.isSetArchiveAttribute(); } Boolean setArchiveAttribute = setArchiveAttributeInternal; - return service.startCopyNoCustomHeaders(this.client.getUrl(), shareName, fileName, timeout, - this.client.getVersion(), metadata, copySource, filePermission, filePermissionKey, filePermissionCopyMode, - ignoreReadOnly, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, setArchiveAttribute, - leaseId, this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .startCopyNoCustomHeaders(this.client.getUrl(), shareName, fileName, timeout, this.client.getVersion(), + metadata, copySource, filePermission, filePermissionKey, filePermissionCopyMode, ignoreReadOnly, + fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, setArchiveAttribute, leaseId, + this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Copies a blob or file to a destination file within the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another @@ -6185,16 +6465,20 @@ public ResponseBase startCopyWithResponse(String sh setArchiveAttributeInternal = copyFileSmbInfo.isSetArchiveAttribute(); } Boolean setArchiveAttribute = setArchiveAttributeInternal; - return service.startCopySync(this.client.getUrl(), shareName, fileName, timeout, this.client.getVersion(), - metadata, copySource, filePermission, filePermissionKey, filePermissionCopyMode, ignoreReadOnly, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, setArchiveAttribute, leaseId, - this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.startCopySync(this.client.getUrl(), shareName, fileName, timeout, this.client.getVersion(), + metadata, copySource, filePermission, filePermissionKey, filePermissionCopyMode, ignoreReadOnly, + fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, setArchiveAttribute, leaseId, + this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Copies a blob or file to a destination file within the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another @@ -6229,7 +6513,7 @@ public void startCopy(String shareName, String fileName, String copySource, Inte /** * Copies a blob or file to a destination file within the storage account. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another @@ -6296,16 +6580,20 @@ public Response startCopyNoCustomHeadersWithResponse(String shareName, Str setArchiveAttributeInternal = copyFileSmbInfo.isSetArchiveAttribute(); } Boolean setArchiveAttribute = setArchiveAttributeInternal; - return service.startCopyNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, timeout, - this.client.getVersion(), metadata, copySource, filePermission, filePermissionKey, filePermissionCopyMode, - ignoreReadOnly, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, setArchiveAttribute, - leaseId, this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.startCopyNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, timeout, + this.client.getVersion(), metadata, copySource, filePermission, filePermissionKey, + filePermissionCopyMode, ignoreReadOnly, fileAttributes, fileCreationTime, fileLastWriteTime, + fileChangeTime, setArchiveAttribute, leaseId, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy File operation. @@ -6324,14 +6612,16 @@ public Mono> abortCopyWithResponseAsyn final String comp = "copy"; final String copyActionAbortConstant = "abort"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.abortCopy(this.client.getUrl(), shareName, fileName, comp, - copyId, timeout, copyActionAbortConstant, this.client.getVersion(), leaseId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.abortCopy(this.client.getUrl(), shareName, fileName, comp, copyId, timeout, + copyActionAbortConstant, this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy File operation. @@ -6351,14 +6641,16 @@ public Mono> abortCopyWithResponseAsyn final String comp = "copy"; final String copyActionAbortConstant = "abort"; final String accept = "application/xml"; - return service.abortCopy(this.client.getUrl(), shareName, fileName, comp, copyId, timeout, - copyActionAbortConstant, this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .abortCopy(this.client.getUrl(), shareName, fileName, comp, copyId, timeout, copyActionAbortConstant, + this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), + accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy File operation. @@ -6375,12 +6667,13 @@ public Mono> abortCopyWithResponseAsyn public Mono abortCopyAsync(String shareName, String fileName, String copyId, Integer timeout, String leaseId) { return abortCopyWithResponseAsync(shareName, fileName, copyId, timeout, leaseId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy File operation. @@ -6398,12 +6691,13 @@ public Mono abortCopyAsync(String shareName, String fileName, String copyI public Mono abortCopyAsync(String shareName, String fileName, String copyId, Integer timeout, String leaseId, Context context) { return abortCopyWithResponseAsync(shareName, fileName, copyId, timeout, leaseId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy File operation. @@ -6422,14 +6716,16 @@ public Mono> abortCopyNoCustomHeadersWithResponseAsync(String sha final String comp = "copy"; final String copyActionAbortConstant = "abort"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.abortCopyNoCustomHeaders(this.client.getUrl(), shareName, - fileName, comp, copyId, timeout, copyActionAbortConstant, this.client.getVersion(), leaseId, - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.abortCopyNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, + copyId, timeout, copyActionAbortConstant, this.client.getVersion(), leaseId, + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy File operation. @@ -6449,14 +6745,16 @@ public Mono> abortCopyNoCustomHeadersWithResponseAsync(String sha final String comp = "copy"; final String copyActionAbortConstant = "abort"; final String accept = "application/xml"; - return service.abortCopyNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, copyId, timeout, - copyActionAbortConstant, this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .abortCopyNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, copyId, timeout, + copyActionAbortConstant, this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy File operation. @@ -6476,14 +6774,18 @@ public ResponseBase abortCopyWithResponse(String sh final String comp = "copy"; final String copyActionAbortConstant = "abort"; final String accept = "application/xml"; - return service.abortCopySync(this.client.getUrl(), shareName, fileName, comp, copyId, timeout, - copyActionAbortConstant, this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.abortCopySync(this.client.getUrl(), shareName, fileName, comp, copyId, timeout, + copyActionAbortConstant, this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy File operation. @@ -6502,7 +6804,7 @@ public void abortCopy(String shareName, String fileName, String copyId, Integer /** * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy File operation. @@ -6522,14 +6824,18 @@ public Response abortCopyNoCustomHeadersWithResponse(String shareName, Str final String comp = "copy"; final String copyActionAbortConstant = "abort"; final String accept = "application/xml"; - return service.abortCopyNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, copyId, timeout, - copyActionAbortConstant, this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.abortCopyNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, copyId, + timeout, copyActionAbortConstant, this.client.getVersion(), leaseId, this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Lists handles for file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -6553,14 +6859,16 @@ public Mono> listHand String shareName, String fileName, String marker, Integer maxresults, Integer timeout, String sharesnapshot) { final String comp = "listhandles"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.listHandles(this.client.getUrl(), shareName, fileName, comp, - marker, maxresults, timeout, sharesnapshot, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.listHandles(this.client.getUrl(), shareName, fileName, comp, marker, + maxresults, timeout, sharesnapshot, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Lists handles for file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -6586,14 +6894,16 @@ public Mono> listHand Context context) { final String comp = "listhandles"; final String accept = "application/xml"; - return service.listHandles(this.client.getUrl(), shareName, fileName, comp, marker, maxresults, timeout, - sharesnapshot, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .listHandles(this.client.getUrl(), shareName, fileName, comp, marker, maxresults, timeout, sharesnapshot, + this.client.getVersion(), this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, + context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Lists handles for file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -6616,12 +6926,13 @@ public Mono> listHand public Mono listHandlesAsync(String shareName, String fileName, String marker, Integer maxresults, Integer timeout, String sharesnapshot) { return listHandlesWithResponseAsync(shareName, fileName, marker, maxresults, timeout, sharesnapshot) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Lists handles for file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -6645,12 +6956,13 @@ public Mono listHandlesAsync(String shareName, String fileN public Mono listHandlesAsync(String shareName, String fileName, String marker, Integer maxresults, Integer timeout, String sharesnapshot, Context context) { return listHandlesWithResponseAsync(shareName, fileName, marker, maxresults, timeout, sharesnapshot, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Lists handles for file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -6674,14 +6986,16 @@ public Mono> listHandlesNoCustomHeadersWithRespons String fileName, String marker, Integer maxresults, Integer timeout, String sharesnapshot) { final String comp = "listhandles"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.listHandlesNoCustomHeaders(this.client.getUrl(), shareName, - fileName, comp, marker, maxresults, timeout, sharesnapshot, this.client.getVersion(), - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.listHandlesNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, + marker, maxresults, timeout, sharesnapshot, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Lists handles for file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -6706,14 +7020,16 @@ public Mono> listHandlesNoCustomHeadersWithRespons String fileName, String marker, Integer maxresults, Integer timeout, String sharesnapshot, Context context) { final String comp = "listhandles"; final String accept = "application/xml"; - return service.listHandlesNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, marker, maxresults, - timeout, sharesnapshot, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .listHandlesNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, marker, maxresults, timeout, + sharesnapshot, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Lists handles for file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -6738,14 +7054,18 @@ public ResponseBase listHandlesWit String fileName, String marker, Integer maxresults, Integer timeout, String sharesnapshot, Context context) { final String comp = "listhandles"; final String accept = "application/xml"; - return service.listHandlesSync(this.client.getUrl(), shareName, fileName, comp, marker, maxresults, timeout, - sharesnapshot, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.listHandlesSync(this.client.getUrl(), shareName, fileName, comp, marker, maxresults, timeout, + sharesnapshot, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Lists handles for file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -6767,13 +7087,17 @@ public ResponseBase listHandlesWit @ServiceMethod(returns = ReturnType.SINGLE) public ListHandlesResponse listHandles(String shareName, String fileName, String marker, Integer maxresults, Integer timeout, String sharesnapshot) { - return listHandlesWithResponse(shareName, fileName, marker, maxresults, timeout, sharesnapshot, Context.NONE) - .getValue(); + try { + return listHandlesWithResponse(shareName, fileName, marker, maxresults, timeout, sharesnapshot, + Context.NONE).getValue(); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Lists handles for file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. @@ -6798,14 +7122,18 @@ public Response listHandlesNoCustomHeadersWithResponse(Stri String marker, Integer maxresults, Integer timeout, String sharesnapshot, Context context) { final String comp = "listhandles"; final String accept = "application/xml"; - return service.listHandlesNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, marker, - maxresults, timeout, sharesnapshot, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.listHandlesNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, marker, + maxresults, timeout, sharesnapshot, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Closes all handles open for given file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -6829,14 +7157,16 @@ public Mono> forceCloseHandles String fileName, String handleId, Integer timeout, String marker, String sharesnapshot) { final String comp = "forceclosehandles"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.forceCloseHandles(this.client.getUrl(), shareName, fileName, - comp, timeout, marker, sharesnapshot, handleId, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.forceCloseHandles(this.client.getUrl(), shareName, fileName, comp, timeout, + marker, sharesnapshot, handleId, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Closes all handles open for given file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -6861,14 +7191,16 @@ public Mono> forceCloseHandles String fileName, String handleId, Integer timeout, String marker, String sharesnapshot, Context context) { final String comp = "forceclosehandles"; final String accept = "application/xml"; - return service.forceCloseHandles(this.client.getUrl(), shareName, fileName, comp, timeout, marker, - sharesnapshot, handleId, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .forceCloseHandles(this.client.getUrl(), shareName, fileName, comp, timeout, marker, sharesnapshot, + handleId, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Closes all handles open for given file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -6891,12 +7223,13 @@ public Mono> forceCloseHandles public Mono forceCloseHandlesAsync(String shareName, String fileName, String handleId, Integer timeout, String marker, String sharesnapshot) { return forceCloseHandlesWithResponseAsync(shareName, fileName, handleId, timeout, marker, sharesnapshot) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Closes all handles open for given file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -6920,12 +7253,13 @@ public Mono forceCloseHandlesAsync(String shareName, String fileName, Stri public Mono forceCloseHandlesAsync(String shareName, String fileName, String handleId, Integer timeout, String marker, String sharesnapshot, Context context) { return forceCloseHandlesWithResponseAsync(shareName, fileName, handleId, timeout, marker, sharesnapshot, - context).flatMap(ignored -> Mono.empty()); + context).onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Closes all handles open for given file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -6949,14 +7283,16 @@ public Mono> forceCloseHandlesNoCustomHeadersWithResponseAsync(St String handleId, Integer timeout, String marker, String sharesnapshot) { final String comp = "forceclosehandles"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.forceCloseHandlesNoCustomHeaders(this.client.getUrl(), shareName, - fileName, comp, timeout, marker, sharesnapshot, handleId, this.client.getVersion(), - this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.forceCloseHandlesNoCustomHeaders(this.client.getUrl(), shareName, fileName, + comp, timeout, marker, sharesnapshot, handleId, this.client.getVersion(), + this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Closes all handles open for given file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -6981,14 +7317,16 @@ public Mono> forceCloseHandlesNoCustomHeadersWithResponseAsync(St String handleId, Integer timeout, String marker, String sharesnapshot, Context context) { final String comp = "forceclosehandles"; final String accept = "application/xml"; - return service.forceCloseHandlesNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, - marker, sharesnapshot, handleId, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + return service + .forceCloseHandlesNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, marker, + sharesnapshot, handleId, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Closes all handles open for given file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -7013,14 +7351,18 @@ public ResponseBase forceCloseHandlesWithRe String fileName, String handleId, Integer timeout, String marker, String sharesnapshot, Context context) { final String comp = "forceclosehandles"; final String accept = "application/xml"; - return service.forceCloseHandlesSync(this.client.getUrl(), shareName, fileName, comp, timeout, marker, - sharesnapshot, handleId, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.forceCloseHandlesSync(this.client.getUrl(), shareName, fileName, comp, timeout, marker, + sharesnapshot, handleId, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Closes all handles open for given file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -7046,7 +7388,7 @@ public void forceCloseHandles(String shareName, String fileName, String handleId /** * Closes all handles open for given file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterisk (‘*’) is a wildcard @@ -7071,14 +7413,18 @@ public Response forceCloseHandlesNoCustomHeadersWithResponse(String shareN String handleId, Integer timeout, String marker, String sharesnapshot, Context context) { final String comp = "forceclosehandles"; final String accept = "application/xml"; - return service.forceCloseHandlesNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, timeout, - marker, sharesnapshot, handleId, this.client.getVersion(), this.client.isAllowTrailingDot(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.forceCloseHandlesNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, + timeout, marker, sharesnapshot, handleId, this.client.getVersion(), this.client.isAllowTrailingDot(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Renames a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -7158,16 +7504,18 @@ public Mono> renameWithResponseAsync(Stri contentTypeInternal = shareFileHttpHeaders.getContentType(); } String contentType = contentTypeInternal; - return FluxUtil.withContext(context -> service.rename(this.client.getUrl(), shareName, fileName, comp, timeout, - this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, destinationLeaseId, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, filePermissionFormat, - filePermissionKey, metadata, contentType, this.client.isAllowTrailingDot(), - this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.rename(this.client.getUrl(), shareName, fileName, comp, timeout, + this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, + destinationLeaseId, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, + filePermissionFormat, filePermissionKey, metadata, contentType, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Renames a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -7248,16 +7596,18 @@ public Mono> renameWithResponseAsync(Stri contentTypeInternal = shareFileHttpHeaders.getContentType(); } String contentType = contentTypeInternal; - return service.rename(this.client.getUrl(), shareName, fileName, comp, timeout, this.client.getVersion(), - renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, destinationLeaseId, fileAttributes, - fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, filePermissionFormat, - filePermissionKey, metadata, contentType, this.client.isAllowTrailingDot(), - this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context); + return service + .rename(this.client.getUrl(), shareName, fileName, comp, timeout, this.client.getVersion(), renameSource, + replaceIfExists, ignoreReadOnly, sourceLeaseId, destinationLeaseId, fileAttributes, fileCreationTime, + fileLastWriteTime, fileChangeTime, filePermission, filePermissionFormat, filePermissionKey, metadata, + contentType, this.client.isAllowTrailingDot(), this.client.isAllowSourceTrailingDot(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Renames a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -7302,12 +7652,14 @@ public Mono renameAsync(String shareName, String fileName, String renameSo ShareFileHttpHeaders shareFileHttpHeaders) { return renameWithResponseAsync(shareName, fileName, renameSource, timeout, replaceIfExists, ignoreReadOnly, filePermission, filePermissionFormat, filePermissionKey, metadata, sourceLeaseAccessConditions, - destinationLeaseAccessConditions, copyFileSmbInfo, shareFileHttpHeaders).flatMap(ignored -> Mono.empty()); + destinationLeaseAccessConditions, copyFileSmbInfo, shareFileHttpHeaders) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Renames a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -7354,12 +7706,13 @@ public Mono renameAsync(String shareName, String fileName, String renameSo return renameWithResponseAsync(shareName, fileName, renameSource, timeout, replaceIfExists, ignoreReadOnly, filePermission, filePermissionFormat, filePermissionKey, metadata, sourceLeaseAccessConditions, destinationLeaseAccessConditions, copyFileSmbInfo, shareFileHttpHeaders, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Renames a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -7439,16 +7792,18 @@ public Mono> renameNoCustomHeadersWithResponseAsync(String shareN contentTypeInternal = shareFileHttpHeaders.getContentType(); } String contentType = contentTypeInternal; - return FluxUtil.withContext(context -> service.renameNoCustomHeaders(this.client.getUrl(), shareName, fileName, - comp, timeout, this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, - destinationLeaseId, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, - filePermissionFormat, filePermissionKey, metadata, contentType, this.client.isAllowTrailingDot(), - this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.renameNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, + timeout, this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, + destinationLeaseId, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, + filePermissionFormat, filePermissionKey, metadata, contentType, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Renames a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -7529,16 +7884,18 @@ public Mono> renameNoCustomHeadersWithResponseAsync(String shareN contentTypeInternal = shareFileHttpHeaders.getContentType(); } String contentType = contentTypeInternal; - return service.renameNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, - this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, destinationLeaseId, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, filePermissionFormat, - filePermissionKey, metadata, contentType, this.client.isAllowTrailingDot(), - this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context); + return service + .renameNoCustomHeaders(this.client.getUrl(), shareName, fileName, comp, timeout, this.client.getVersion(), + renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, destinationLeaseId, fileAttributes, + fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, filePermissionFormat, + filePermissionKey, metadata, contentType, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Renames a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -7619,16 +7976,20 @@ public ResponseBase renameWithResponse(String shareNam contentTypeInternal = shareFileHttpHeaders.getContentType(); } String contentType = contentTypeInternal; - return service.renameSync(this.client.getUrl(), shareName, fileName, comp, timeout, this.client.getVersion(), - renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, destinationLeaseId, fileAttributes, - fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, filePermissionFormat, - filePermissionKey, metadata, contentType, this.client.isAllowTrailingDot(), - this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context); + try { + return service.renameSync(this.client.getUrl(), shareName, fileName, comp, timeout, + this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, + destinationLeaseId, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, + filePermissionFormat, filePermissionKey, metadata, contentType, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Renames a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -7676,7 +8037,7 @@ public void rename(String shareName, String fileName, String renameSource, Integ /** * Renames a file. - * + * * @param shareName The name of the target share. * @param fileName The path of the target file. * @param renameSource Required. Specifies the URI-style path of the source file, up to 2 KB in length. @@ -7757,10 +8118,14 @@ public Response renameNoCustomHeadersWithResponse(String shareName, String contentTypeInternal = shareFileHttpHeaders.getContentType(); } String contentType = contentTypeInternal; - return service.renameNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, timeout, - this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, destinationLeaseId, - fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, filePermissionFormat, - filePermissionKey, metadata, contentType, this.client.isAllowTrailingDot(), - this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context); + try { + return service.renameNoCustomHeadersSync(this.client.getUrl(), shareName, fileName, comp, timeout, + this.client.getVersion(), renameSource, replaceIfExists, ignoreReadOnly, sourceLeaseId, + destinationLeaseId, fileAttributes, fileCreationTime, fileLastWriteTime, fileChangeTime, filePermission, + filePermissionFormat, filePermissionKey, metadata, contentType, this.client.isAllowTrailingDot(), + this.client.isAllowSourceTrailingDot(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java index ee0672054ca1..9f331cdc0b3a 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.file.share.implementation; import com.azure.core.annotation.BodyParam; @@ -40,11 +39,13 @@ import java.util.Objects; import java.util.stream.Collectors; import reactor.core.publisher.Mono; +import com.azure.storage.file.share.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in Services. */ public final class ServicesImpl { + /** * The proxy service used to perform REST calls. */ @@ -57,7 +58,7 @@ public final class ServicesImpl { /** * Initializes an instance of ServicesImpl. - * + * * @param client the instance of the service client containing this operation class. */ ServicesImpl(AzureFileStorageImpl client) { @@ -72,6 +73,7 @@ public final class ServicesImpl { @Host("{url}") @ServiceInterface(name = "AzureFileStorageServ") public interface ServicesService { + @Put("/") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(ShareStorageExceptionInternal.class) @@ -230,7 +232,7 @@ Response listSharesSegmentNextNoCustomHeadersSync( /** * Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics * and CORS (Cross-Origin Resource Sharing) rules. - * + * * @param shareServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -246,14 +248,16 @@ Response listSharesSegmentNextNoCustomHeadersSync( final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setProperties(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), this.client.getFileRequestIntent(), shareServiceProperties, accept, context)); + return FluxUtil + .withContext(context -> service.setProperties(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), this.client.getFileRequestIntent(), shareServiceProperties, accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics * and CORS (Cross-Origin Resource Sharing) rules. - * + * * @param shareServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -270,14 +274,16 @@ public Mono> setPropertiesWithR final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.setProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), shareServiceProperties, accept, context); + return service + .setProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), shareServiceProperties, accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics * and CORS (Cross-Origin Resource Sharing) rules. - * + * * @param shareServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -289,13 +295,15 @@ public Mono> setPropertiesWithR */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono setPropertiesAsync(ShareServiceProperties shareServiceProperties, Integer timeout) { - return setPropertiesWithResponseAsync(shareServiceProperties, timeout).flatMap(ignored -> Mono.empty()); + return setPropertiesWithResponseAsync(shareServiceProperties, timeout) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics * and CORS (Cross-Origin Resource Sharing) rules. - * + * * @param shareServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -310,13 +318,14 @@ public Mono setPropertiesAsync(ShareServiceProperties shareServiceProperti public Mono setPropertiesAsync(ShareServiceProperties shareServiceProperties, Integer timeout, Context context) { return setPropertiesWithResponseAsync(shareServiceProperties, timeout, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics * and CORS (Cross-Origin Resource Sharing) rules. - * + * * @param shareServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -334,13 +343,14 @@ public Mono setPropertiesAsync(ShareServiceProperties shareServiceProperti final String accept = "application/xml"; return FluxUtil .withContext(context -> service.setPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), this.client.getFileRequestIntent(), shareServiceProperties, accept, context)); + this.client.getVersion(), this.client.getFileRequestIntent(), shareServiceProperties, accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics * and CORS (Cross-Origin Resource Sharing) rules. - * + * * @param shareServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -357,14 +367,16 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.setPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), this.client.getFileRequestIntent(), shareServiceProperties, accept, context); + return service + .setPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), shareServiceProperties, accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics * and CORS (Cross-Origin Resource Sharing) rules. - * + * * @param shareServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -381,14 +393,18 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.setPropertiesSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), shareServiceProperties, accept, context); + try { + return service.setPropertiesSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), shareServiceProperties, accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics * and CORS (Cross-Origin Resource Sharing) rules. - * + * * @param shareServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -405,7 +421,7 @@ public void setProperties(ShareServiceProperties shareServiceProperties, Integer /** * Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics * and CORS (Cross-Origin Resource Sharing) rules. - * + * * @param shareServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -422,14 +438,18 @@ public Response setPropertiesNoCustomHeadersWithResponse(ShareServicePrope final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.setPropertiesNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), this.client.getFileRequestIntent(), shareServiceProperties, accept, context); + try { + return service.setPropertiesNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), this.client.getFileRequestIntent(), shareServiceProperties, accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Gets the properties of a storage account's File service, including properties for Storage Analytics metrics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting * Timeouts for File Service Operations.</a>. @@ -446,14 +466,16 @@ public Response setPropertiesNoCustomHeadersWithResponse(ShareServicePrope final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getProperties(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.getProperties(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Gets the properties of a storage account's File service, including properties for Storage Analytics metrics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting * Timeouts for File Service Operations.</a>. @@ -471,14 +493,16 @@ public Response setPropertiesNoCustomHeadersWithResponse(ShareServicePrope final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.getProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context); + return service + .getProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Gets the properties of a storage account's File service, including properties for Storage Analytics metrics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting * Timeouts for File Service Operations.</a>. @@ -490,13 +514,15 @@ public Response setPropertiesNoCustomHeadersWithResponse(ShareServicePrope */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesAsync(Integer timeout) { - return getPropertiesWithResponseAsync(timeout).flatMap(res -> Mono.justOrEmpty(res.getValue())); + return getPropertiesWithResponseAsync(timeout) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Gets the properties of a storage account's File service, including properties for Storage Analytics metrics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting * Timeouts for File Service Operations.</a>. @@ -509,13 +535,15 @@ public Mono getPropertiesAsync(Integer timeout) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesAsync(Integer timeout, Context context) { - return getPropertiesWithResponseAsync(timeout, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + return getPropertiesWithResponseAsync(timeout, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Gets the properties of a storage account's File service, including properties for Storage Analytics metrics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting * Timeouts for File Service Operations.</a>. @@ -531,14 +559,16 @@ public Mono> getPropertiesNoCustomHeadersWithRe final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, - timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Gets the properties of a storage account's File service, including properties for Storage Analytics metrics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting * Timeouts for File Service Operations.</a>. @@ -556,14 +586,16 @@ public Mono> getPropertiesNoCustomHeadersWithRe final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.getPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); + return service + .getPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Gets the properties of a storage account's File service, including properties for Storage Analytics metrics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting * Timeouts for File Service Operations.</a>. @@ -580,14 +612,18 @@ public ResponseBase getPro final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.getPropertiesSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.getPropertiesSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Gets the properties of a storage account's File service, including properties for Storage Analytics metrics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting * Timeouts for File Service Operations.</a>. @@ -599,13 +635,17 @@ public ResponseBase getPro */ @ServiceMethod(returns = ReturnType.SINGLE) public ShareServiceProperties getProperties(Integer timeout) { - return getPropertiesWithResponse(timeout, Context.NONE).getValue(); + try { + return getPropertiesWithResponse(timeout, Context.NONE).getValue(); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Gets the properties of a storage account's File service, including properties for Storage Analytics metrics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting * Timeouts for File Service Operations.</a>. @@ -621,13 +661,17 @@ public Response getPropertiesNoCustomHeadersWithResponse final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); + try { + return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -658,13 +702,14 @@ public Mono> listSharesSegmentSinglePageAsync(S .withContext(context -> service.listSharesSegment(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getShareItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); } /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -695,13 +740,14 @@ public Mono> listSharesSegmentSinglePageAsync(S return service .listSharesSegment(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getShareItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); } /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -727,7 +773,7 @@ public PagedFlux listSharesSegmentAsync(String prefix, String /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -755,7 +801,7 @@ public PagedFlux listSharesSegmentAsync(String prefix, String /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -786,13 +832,14 @@ public Mono> listSharesSegmentNoCustomHeadersSi .withContext(context -> service.listSharesSegmentNoCustomHeaders(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getShareItems(), res.getValue().getNextMarker(), null)); } /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -823,13 +870,14 @@ public Mono> listSharesSegmentNoCustomHeadersSi return service .listSharesSegmentNoCustomHeaders(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getShareItems(), res.getValue().getNextMarker(), null)); } /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -856,7 +904,7 @@ public PagedFlux listSharesSegmentNoCustomHeadersAsync(String /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -883,7 +931,7 @@ public PagedFlux listSharesSegmentNoCustomHeadersAsync(String /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -913,13 +961,17 @@ public PagedResponse listSharesSegmentSinglePage(String prefi ResponseBase res = service.listSharesSegmentSync(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getShareItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getShareItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -950,13 +1002,17 @@ public PagedResponse listSharesSegmentSinglePage(String prefi ResponseBase res = service.listSharesSegmentSync(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getShareItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getShareItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -983,7 +1039,7 @@ public PagedIterable listSharesSegment(String prefix, String /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -1011,7 +1067,7 @@ public PagedIterable listSharesSegment(String prefix, String /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -1041,13 +1097,17 @@ public PagedResponse listSharesSegmentNoCustomHeadersSinglePa Response res = service.listSharesSegmentNoCustomHeadersSync(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getShareItems(), res.getValue().getNextMarker(), null); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getShareItems(), res.getValue().getNextMarker(), null); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -1078,13 +1138,17 @@ public PagedResponse listSharesSegmentNoCustomHeadersSinglePa Response res = service.listSharesSegmentNoCustomHeadersSync(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getShareItems(), res.getValue().getNextMarker(), null); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getShareItems(), res.getValue().getNextMarker(), null); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -1110,7 +1174,7 @@ public PagedIterable listSharesSegmentNoCustomHeaders(String /** * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * + * * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. * The operation returns a marker value within the response body if the list returned was not complete. The marker @@ -1138,9 +1202,9 @@ public PagedIterable listSharesSegmentNoCustomHeaders(String /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageExceptionInternal thrown if the request is rejected by server. @@ -1153,15 +1217,16 @@ public Mono> listSharesSegmentNextSinglePageAsy return FluxUtil .withContext(context -> service.listSharesSegmentNext(nextLink, this.client.getUrl(), this.client.getVersion(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getShareItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1176,15 +1241,16 @@ public Mono> listSharesSegmentNextSinglePageAsy return service .listSharesSegmentNext(nextLink, this.client.getUrl(), this.client.getVersion(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getShareItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageExceptionInternal thrown if the request is rejected by server. @@ -1197,15 +1263,16 @@ public Mono> listSharesSegmentNextNoCustomHeade return FluxUtil .withContext(context -> service.listSharesSegmentNextNoCustomHeaders(nextLink, this.client.getUrl(), this.client.getVersion(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getShareItems(), res.getValue().getNextMarker(), null)); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1220,15 +1287,16 @@ public Mono> listSharesSegmentNextNoCustomHeade return service .listSharesSegmentNextNoCustomHeaders(nextLink, this.client.getUrl(), this.client.getVersion(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getShareItems(), res.getValue().getNextMarker(), null)); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageExceptionInternal thrown if the request is rejected by server. @@ -1241,15 +1309,19 @@ public PagedResponse listSharesSegmentNextSinglePage(String n ResponseBase res = service.listSharesSegmentNextSync(nextLink, this.client.getUrl(), this.client.getVersion(), this.client.getFileRequestIntent(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getShareItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getShareItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1263,15 +1335,19 @@ public PagedResponse listSharesSegmentNextSinglePage(String n ResponseBase res = service.listSharesSegmentNextSync(nextLink, this.client.getUrl(), this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getShareItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getShareItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageExceptionInternal thrown if the request is rejected by server. @@ -1283,15 +1359,19 @@ public PagedResponse listSharesSegmentNextNoCustomHeadersSing final String accept = "application/xml"; Response res = service.listSharesSegmentNextNoCustomHeadersSync(nextLink, this.client.getUrl(), this.client.getVersion(), this.client.getFileRequestIntent(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getShareItems(), res.getValue().getNextMarker(), null); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getShareItems(), res.getValue().getNextMarker(), null); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1305,7 +1385,11 @@ public PagedResponse listSharesSegmentNextNoCustomHeadersSing final String accept = "application/xml"; Response res = service.listSharesSegmentNextNoCustomHeadersSync(nextLink, this.client.getUrl(), this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getShareItems(), res.getValue().getNextMarker(), null); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getShareItems(), res.getValue().getNextMarker(), null); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java index a34f029be45d..4d4aaabea588 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.file.share.implementation; import com.azure.core.annotation.BodyParam; @@ -53,11 +52,13 @@ import java.util.List; import java.util.Map; import reactor.core.publisher.Mono; +import com.azure.storage.file.share.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in Shares. */ public final class SharesImpl { + /** * The proxy service used to perform REST calls. */ @@ -70,7 +71,7 @@ public final class SharesImpl { /** * Initializes an instance of SharesImpl. - * + * * @param client the instance of the service client containing this operation class. */ SharesImpl(AzureFileStorageImpl client) { @@ -85,6 +86,7 @@ public final class SharesImpl { @Host("{url}") @ServiceInterface(name = "AzureFileStorageShar") public interface SharesService { + @Put("/{shareName}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(ShareStorageExceptionInternal.class) @@ -890,7 +892,7 @@ Response restoreNoCustomHeadersSync(@HostParam("url") String url, /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -919,16 +921,18 @@ public Mono> createWithResponseAsync(Str Long paidBurstingMaxBandwidthMibps, Long paidBurstingMaxIops) { final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.create(this.client.getUrl(), shareName, restype, timeout, - metadata, quota, accessTier, this.client.getVersion(), enabledProtocols, rootSquash, - enableSnapshotVirtualDirectoryAccess, paidBurstingEnabled, paidBurstingMaxBandwidthMibps, - paidBurstingMaxIops, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.create(this.client.getUrl(), shareName, restype, timeout, metadata, quota, + accessTier, this.client.getVersion(), enabledProtocols, rootSquash, + enableSnapshotVirtualDirectoryAccess, paidBurstingEnabled, paidBurstingMaxBandwidthMibps, + paidBurstingMaxIops, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -958,16 +962,18 @@ public Mono> createWithResponseAsync(Str Long paidBurstingMaxBandwidthMibps, Long paidBurstingMaxIops, Context context) { final String restype = "share"; final String accept = "application/xml"; - return service.create(this.client.getUrl(), shareName, restype, timeout, metadata, quota, accessTier, - this.client.getVersion(), enabledProtocols, rootSquash, enableSnapshotVirtualDirectoryAccess, - paidBurstingEnabled, paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, this.client.getFileRequestIntent(), - accept, context); + return service + .create(this.client.getUrl(), shareName, restype, timeout, metadata, quota, accessTier, + this.client.getVersion(), enabledProtocols, rootSquash, enableSnapshotVirtualDirectoryAccess, + paidBurstingEnabled, paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -996,13 +1002,15 @@ public Mono createAsync(String shareName, Integer timeout, Map Mono.empty()); + paidBurstingMaxIops) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1032,13 +1040,15 @@ public Mono createAsync(String shareName, Integer timeout, Map Mono.empty()); + paidBurstingMaxIops, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1067,16 +1077,18 @@ public Mono> createNoCustomHeadersWithResponseAsync(String shareN Long paidBurstingMaxBandwidthMibps, Long paidBurstingMaxIops) { final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.createNoCustomHeaders(this.client.getUrl(), shareName, restype, - timeout, metadata, quota, accessTier, this.client.getVersion(), enabledProtocols, rootSquash, - enableSnapshotVirtualDirectoryAccess, paidBurstingEnabled, paidBurstingMaxBandwidthMibps, - paidBurstingMaxIops, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.createNoCustomHeaders(this.client.getUrl(), shareName, restype, timeout, + metadata, quota, accessTier, this.client.getVersion(), enabledProtocols, rootSquash, + enableSnapshotVirtualDirectoryAccess, paidBurstingEnabled, paidBurstingMaxBandwidthMibps, + paidBurstingMaxIops, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1106,16 +1118,18 @@ public Mono> createNoCustomHeadersWithResponseAsync(String shareN Long paidBurstingMaxBandwidthMibps, Long paidBurstingMaxIops, Context context) { final String restype = "share"; final String accept = "application/xml"; - return service.createNoCustomHeaders(this.client.getUrl(), shareName, restype, timeout, metadata, quota, - accessTier, this.client.getVersion(), enabledProtocols, rootSquash, enableSnapshotVirtualDirectoryAccess, - paidBurstingEnabled, paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, this.client.getFileRequestIntent(), - accept, context); + return service + .createNoCustomHeaders(this.client.getUrl(), shareName, restype, timeout, metadata, quota, accessTier, + this.client.getVersion(), enabledProtocols, rootSquash, enableSnapshotVirtualDirectoryAccess, + paidBurstingEnabled, paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1145,16 +1159,20 @@ public ResponseBase createWithResponse(String shareNa Long paidBurstingMaxBandwidthMibps, Long paidBurstingMaxIops, Context context) { final String restype = "share"; final String accept = "application/xml"; - return service.createSync(this.client.getUrl(), shareName, restype, timeout, metadata, quota, accessTier, - this.client.getVersion(), enabledProtocols, rootSquash, enableSnapshotVirtualDirectoryAccess, - paidBurstingEnabled, paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, this.client.getFileRequestIntent(), - accept, context); + try { + return service.createSync(this.client.getUrl(), shareName, restype, timeout, metadata, quota, accessTier, + this.client.getVersion(), enabledProtocols, rootSquash, enableSnapshotVirtualDirectoryAccess, + paidBurstingEnabled, paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1188,7 +1206,7 @@ public void create(String shareName, Integer timeout, Map metada /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1218,16 +1236,20 @@ public Response createNoCustomHeadersWithResponse(String shareName, Intege Long paidBurstingMaxBandwidthMibps, Long paidBurstingMaxIops, Context context) { final String restype = "share"; final String accept = "application/xml"; - return service.createNoCustomHeadersSync(this.client.getUrl(), shareName, restype, timeout, metadata, quota, - accessTier, this.client.getVersion(), enabledProtocols, rootSquash, enableSnapshotVirtualDirectoryAccess, - paidBurstingEnabled, paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, this.client.getFileRequestIntent(), - accept, context); + try { + return service.createNoCustomHeadersSync(this.client.getUrl(), shareName, restype, timeout, metadata, quota, + accessTier, this.client.getVersion(), enabledProtocols, rootSquash, + enableSnapshotVirtualDirectoryAccess, paidBurstingEnabled, paidBurstingMaxBandwidthMibps, + paidBurstingMaxIops, this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1247,13 +1269,14 @@ public Mono> getPropertiesWithRes final String accept = "application/xml"; return FluxUtil .withContext(context -> service.getProperties(this.client.getUrl(), shareName, restype, sharesnapshot, - timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)); + timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1272,14 +1295,16 @@ public Mono> getPropertiesWithRes String sharesnapshot, Integer timeout, String leaseId, Context context) { final String restype = "share"; final String accept = "application/xml"; - return service.getProperties(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + return service + .getProperties(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, this.client.getVersion(), + leaseId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1295,13 +1320,14 @@ public Mono> getPropertiesWithRes @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesAsync(String shareName, String sharesnapshot, Integer timeout, String leaseId) { return getPropertiesWithResponseAsync(shareName, sharesnapshot, timeout, leaseId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1319,13 +1345,14 @@ public Mono getPropertiesAsync(String shareName, String sharesnapshot, Int public Mono getPropertiesAsync(String shareName, String sharesnapshot, Integer timeout, String leaseId, Context context) { return getPropertiesWithResponseAsync(shareName, sharesnapshot, timeout, leaseId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1343,15 +1370,17 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String Integer timeout, String leaseId) { final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext( - context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), shareName, restype, sharesnapshot, - timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext( + context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), shareName, restype, sharesnapshot, + timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1370,14 +1399,16 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String Integer timeout, String leaseId, Context context) { final String restype = "share"; final String accept = "application/xml"; - return service.getPropertiesNoCustomHeaders(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + return service + .getPropertiesNoCustomHeaders(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1396,14 +1427,18 @@ public ResponseBase getPropertiesWithResponse( String sharesnapshot, Integer timeout, String leaseId, Context context) { final String restype = "share"; final String accept = "application/xml"; - return service.getPropertiesSync(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + try { + return service.getPropertiesSync(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1423,7 +1458,7 @@ public void getProperties(String shareName, String sharesnapshot, Integer timeou /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1442,14 +1477,18 @@ public Response getPropertiesNoCustomHeadersWithResponse(String shareName, Integer timeout, String leaseId, Context context) { final String restype = "share"; final String accept = "application/xml"; - return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), shareName, restype, sharesnapshot, - timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + try { + return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), shareName, restype, sharesnapshot, + timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1470,13 +1509,13 @@ public Mono> deleteWithResponseAsync(Str final String accept = "application/xml"; return FluxUtil.withContext(context -> service.delete(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, this.client.getVersion(), deleteSnapshots, leaseId, this.client.getFileRequestIntent(), accept, - context)); + context)).onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1496,14 +1535,16 @@ public Mono> deleteWithResponseAsync(Str Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, String leaseId, Context context) { final String restype = "share"; final String accept = "application/xml"; - return service.delete(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, - this.client.getVersion(), deleteSnapshots, leaseId, this.client.getFileRequestIntent(), accept, context); + return service + .delete(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, this.client.getVersion(), + deleteSnapshots, leaseId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1521,13 +1562,14 @@ public Mono> deleteWithResponseAsync(Str public Mono deleteAsync(String shareName, String sharesnapshot, Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, String leaseId) { return deleteWithResponseAsync(shareName, sharesnapshot, timeout, deleteSnapshots, leaseId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1546,13 +1588,14 @@ public Mono deleteAsync(String shareName, String sharesnapshot, Integer ti public Mono deleteAsync(String shareName, String sharesnapshot, Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, String leaseId, Context context) { return deleteWithResponseAsync(shareName, sharesnapshot, timeout, deleteSnapshots, leaseId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1571,15 +1614,17 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String shareN Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, String leaseId) { final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), shareName, restype, - sharesnapshot, timeout, this.client.getVersion(), deleteSnapshots, leaseId, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), shareName, restype, + sharesnapshot, timeout, this.client.getVersion(), deleteSnapshots, leaseId, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1599,14 +1644,16 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String shareN Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, String leaseId, Context context) { final String restype = "share"; final String accept = "application/xml"; - return service.deleteNoCustomHeaders(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, - this.client.getVersion(), deleteSnapshots, leaseId, this.client.getFileRequestIntent(), accept, context); + return service + .deleteNoCustomHeaders(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, + this.client.getVersion(), deleteSnapshots, leaseId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1626,14 +1673,19 @@ public ResponseBase deleteWithResponse(String shareNa Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, String leaseId, Context context) { final String restype = "share"; final String accept = "application/xml"; - return service.deleteSync(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, - this.client.getVersion(), deleteSnapshots, leaseId, this.client.getFileRequestIntent(), accept, context); + try { + return service.deleteSync(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, + this.client.getVersion(), deleteSnapshots, leaseId, this.client.getFileRequestIntent(), accept, + context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1655,7 +1707,7 @@ public void delete(String shareName, String sharesnapshot, Integer timeout, /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1675,14 +1727,19 @@ public Response deleteNoCustomHeadersWithResponse(String shareName, String DeleteSnapshotsOptionType deleteSnapshots, String leaseId, Context context) { final String restype = "share"; final String accept = "application/xml"; - return service.deleteNoCustomHeadersSync(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, - this.client.getVersion(), deleteSnapshots, leaseId, this.client.getFileRequestIntent(), accept, context); + try { + return service.deleteNoCustomHeadersSync(this.client.getUrl(), shareName, restype, sharesnapshot, timeout, + this.client.getVersion(), deleteSnapshots, leaseId, this.client.getFileRequestIntent(), accept, + context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1709,15 +1766,17 @@ public Mono> acquireLeaseWithRespo final String action = "acquire"; final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.acquireLease(this.client.getUrl(), shareName, comp, action, - restype, timeout, duration, proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.acquireLease(this.client.getUrl(), shareName, comp, action, restype, + timeout, duration, proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1746,15 +1805,16 @@ public Mono> acquireLeaseWithRespo final String action = "acquire"; final String restype = "share"; final String accept = "application/xml"; - return service.acquireLease(this.client.getUrl(), shareName, comp, action, restype, timeout, duration, - proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), - accept, context); + return service + .acquireLease(this.client.getUrl(), shareName, comp, action, restype, timeout, duration, proposedLeaseId, + this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1778,13 +1838,14 @@ public Mono> acquireLeaseWithRespo public Mono acquireLeaseAsync(String shareName, Integer timeout, Integer duration, String proposedLeaseId, String sharesnapshot, String requestId) { return acquireLeaseWithResponseAsync(shareName, timeout, duration, proposedLeaseId, sharesnapshot, requestId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1809,13 +1870,14 @@ public Mono acquireLeaseAsync(String shareName, Integer timeout, Integer d public Mono acquireLeaseAsync(String shareName, Integer timeout, Integer duration, String proposedLeaseId, String sharesnapshot, String requestId, Context context) { return acquireLeaseWithResponseAsync(shareName, timeout, duration, proposedLeaseId, sharesnapshot, requestId, - context).flatMap(ignored -> Mono.empty()); + context).onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1842,15 +1904,17 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String final String action = "acquire"; final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.acquireLeaseNoCustomHeaders(this.client.getUrl(), shareName, - comp, action, restype, timeout, duration, proposedLeaseId, this.client.getVersion(), sharesnapshot, - requestId, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.acquireLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, + restype, timeout, duration, proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1878,15 +1942,17 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String final String action = "acquire"; final String restype = "share"; final String accept = "application/xml"; - return service.acquireLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, restype, timeout, - duration, proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context); + return service + .acquireLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, restype, timeout, duration, + proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), + accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1914,15 +1980,19 @@ public ResponseBase acquireLeaseWithResponse(St final String action = "acquire"; final String restype = "share"; final String accept = "application/xml"; - return service.acquireLeaseSync(this.client.getUrl(), shareName, comp, action, restype, timeout, duration, - proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), - accept, context); + try { + return service.acquireLeaseSync(this.client.getUrl(), shareName, comp, action, restype, timeout, duration, + proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), + accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1950,7 +2020,7 @@ public void acquireLease(String shareName, Integer timeout, Integer duration, St /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1978,15 +2048,19 @@ public Response acquireLeaseNoCustomHeadersWithResponse(String shareName, final String action = "acquire"; final String restype = "share"; final String accept = "application/xml"; - return service.acquireLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, comp, action, restype, timeout, - duration, proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context); + try { + return service.acquireLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, comp, action, restype, + timeout, duration, proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2008,15 +2082,17 @@ public Mono> releaseLeaseWithRespo final String action = "release"; final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.releaseLease(this.client.getUrl(), shareName, comp, action, - restype, timeout, leaseId, this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.releaseLease(this.client.getUrl(), shareName, comp, action, restype, + timeout, leaseId, this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2039,14 +2115,16 @@ public Mono> releaseLeaseWithRespo final String action = "release"; final String restype = "share"; final String accept = "application/xml"; - return service.releaseLease(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, - this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, context); + return service + .releaseLease(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, + this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2065,13 +2143,14 @@ public Mono> releaseLeaseWithRespo public Mono releaseLeaseAsync(String shareName, String leaseId, Integer timeout, String sharesnapshot, String requestId) { return releaseLeaseWithResponseAsync(shareName, leaseId, timeout, sharesnapshot, requestId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2091,13 +2170,14 @@ public Mono releaseLeaseAsync(String shareName, String leaseId, Integer ti public Mono releaseLeaseAsync(String shareName, String leaseId, Integer timeout, String sharesnapshot, String requestId, Context context) { return releaseLeaseWithResponseAsync(shareName, leaseId, timeout, sharesnapshot, requestId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2119,15 +2199,17 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String final String action = "release"; final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.releaseLeaseNoCustomHeaders(this.client.getUrl(), shareName, - comp, action, restype, timeout, leaseId, this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.releaseLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, + restype, timeout, leaseId, this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2150,15 +2232,16 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String final String action = "release"; final String restype = "share"; final String accept = "application/xml"; - return service.releaseLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, restype, timeout, - leaseId, this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, - context); + return service + .releaseLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, + this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2181,14 +2264,19 @@ public ResponseBase releaseLeaseWithResponse(St final String action = "release"; final String restype = "share"; final String accept = "application/xml"; - return service.releaseLeaseSync(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, - this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, context); + try { + return service.releaseLeaseSync(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, + this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, + context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2211,7 +2299,7 @@ public void releaseLease(String shareName, String leaseId, Integer timeout, Stri /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2234,15 +2322,19 @@ public Response releaseLeaseNoCustomHeadersWithResponse(String shareName, final String action = "release"; final String restype = "share"; final String accept = "application/xml"; - return service.releaseLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, comp, action, restype, timeout, - leaseId, this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, - context); + try { + return service.releaseLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, comp, action, restype, + timeout, leaseId, this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2267,15 +2359,17 @@ public Mono> changeLeaseWithRespons final String action = "change"; final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.changeLease(this.client.getUrl(), shareName, comp, action, - restype, timeout, leaseId, proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.changeLease(this.client.getUrl(), shareName, comp, action, restype, timeout, + leaseId, proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2302,15 +2396,16 @@ public Mono> changeLeaseWithRespons final String action = "change"; final String restype = "share"; final String accept = "application/xml"; - return service.changeLease(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, - proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), - accept, context); + return service + .changeLease(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, proposedLeaseId, + this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2332,13 +2427,14 @@ public Mono> changeLeaseWithRespons public Mono changeLeaseAsync(String shareName, String leaseId, Integer timeout, String proposedLeaseId, String sharesnapshot, String requestId) { return changeLeaseWithResponseAsync(shareName, leaseId, timeout, proposedLeaseId, sharesnapshot, requestId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2361,13 +2457,14 @@ public Mono changeLeaseAsync(String shareName, String leaseId, Integer tim public Mono changeLeaseAsync(String shareName, String leaseId, Integer timeout, String proposedLeaseId, String sharesnapshot, String requestId, Context context) { return changeLeaseWithResponseAsync(shareName, leaseId, timeout, proposedLeaseId, sharesnapshot, requestId, - context).flatMap(ignored -> Mono.empty()); + context).onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2392,15 +2489,17 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String s final String action = "change"; final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.changeLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, - action, restype, timeout, leaseId, proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.changeLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, + restype, timeout, leaseId, proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2426,15 +2525,17 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String s final String action = "change"; final String restype = "share"; final String accept = "application/xml"; - return service.changeLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, restype, timeout, - leaseId, proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context); + return service + .changeLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, + proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), + accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2460,15 +2561,19 @@ public ResponseBase changeLeaseWithResponse(Stri final String action = "change"; final String restype = "share"; final String accept = "application/xml"; - return service.changeLeaseSync(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, - proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), - accept, context); + try { + return service.changeLeaseSync(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, + proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), + accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2494,7 +2599,7 @@ public void changeLease(String shareName, String leaseId, Integer timeout, Strin /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2520,15 +2625,19 @@ public Response changeLeaseNoCustomHeadersWithResponse(String shareName, S final String action = "change"; final String restype = "share"; final String accept = "application/xml"; - return service.changeLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, comp, action, restype, timeout, - leaseId, proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context); + try { + return service.changeLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, comp, action, restype, + timeout, leaseId, proposedLeaseId, this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2552,13 +2661,14 @@ public Mono> renewLeaseWithResponseA final String accept = "application/xml"; return FluxUtil.withContext(context -> service.renewLease(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2581,14 +2691,16 @@ public Mono> renewLeaseWithResponseA final String action = "renew"; final String restype = "share"; final String accept = "application/xml"; - return service.renewLease(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, - this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, context); + return service + .renewLease(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, + this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2607,13 +2719,14 @@ public Mono> renewLeaseWithResponseA public Mono renewLeaseAsync(String shareName, String leaseId, Integer timeout, String sharesnapshot, String requestId) { return renewLeaseWithResponseAsync(shareName, leaseId, timeout, sharesnapshot, requestId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2633,13 +2746,14 @@ public Mono renewLeaseAsync(String shareName, String leaseId, Integer time public Mono renewLeaseAsync(String shareName, String leaseId, Integer timeout, String sharesnapshot, String requestId, Context context) { return renewLeaseWithResponseAsync(shareName, leaseId, timeout, sharesnapshot, requestId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2661,15 +2775,17 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String sh final String action = "renew"; final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.renewLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, - action, restype, timeout, leaseId, this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.renewLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, + restype, timeout, leaseId, this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2692,15 +2808,16 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String sh final String action = "renew"; final String restype = "share"; final String accept = "application/xml"; - return service.renewLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, restype, timeout, - leaseId, this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, - context); + return service + .renewLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, + this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2723,14 +2840,19 @@ public ResponseBase renewLeaseWithResponse(String final String action = "renew"; final String restype = "share"; final String accept = "application/xml"; - return service.renewLeaseSync(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, - this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, context); + try { + return service.renewLeaseSync(this.client.getUrl(), shareName, comp, action, restype, timeout, leaseId, + this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, + context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2752,7 +2874,7 @@ public void renewLease(String shareName, String leaseId, Integer timeout, String /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2775,15 +2897,19 @@ public Response renewLeaseNoCustomHeadersWithResponse(String shareName, St final String action = "renew"; final String restype = "share"; final String accept = "application/xml"; - return service.renewLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, comp, action, restype, timeout, - leaseId, this.client.getVersion(), sharesnapshot, requestId, this.client.getFileRequestIntent(), accept, - context); + try { + return service.renewLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, comp, action, restype, + timeout, leaseId, this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2811,15 +2937,17 @@ public Mono> breakLeaseWithResponseA final String action = "break"; final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.breakLease(this.client.getUrl(), shareName, comp, action, - restype, timeout, breakPeriod, leaseId, this.client.getVersion(), requestId, sharesnapshot, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.breakLease(this.client.getUrl(), shareName, comp, action, restype, timeout, + breakPeriod, leaseId, this.client.getVersion(), requestId, sharesnapshot, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2848,14 +2976,16 @@ public Mono> breakLeaseWithResponseA final String action = "break"; final String restype = "share"; final String accept = "application/xml"; - return service.breakLease(this.client.getUrl(), shareName, comp, action, restype, timeout, breakPeriod, leaseId, - this.client.getVersion(), requestId, sharesnapshot, this.client.getFileRequestIntent(), accept, context); + return service + .breakLease(this.client.getUrl(), shareName, comp, action, restype, timeout, breakPeriod, leaseId, + this.client.getVersion(), requestId, sharesnapshot, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2880,13 +3010,14 @@ public Mono> breakLeaseWithResponseA public Mono breakLeaseAsync(String shareName, Integer timeout, Integer breakPeriod, String leaseId, String requestId, String sharesnapshot) { return breakLeaseWithResponseAsync(shareName, timeout, breakPeriod, leaseId, requestId, sharesnapshot) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2912,13 +3043,14 @@ public Mono breakLeaseAsync(String shareName, Integer timeout, Integer bre public Mono breakLeaseAsync(String shareName, Integer timeout, Integer breakPeriod, String leaseId, String requestId, String sharesnapshot, Context context) { return breakLeaseWithResponseAsync(shareName, timeout, breakPeriod, leaseId, requestId, sharesnapshot, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2946,15 +3078,17 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String sh final String action = "break"; final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.breakLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, - action, restype, timeout, breakPeriod, leaseId, this.client.getVersion(), requestId, sharesnapshot, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.breakLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, + restype, timeout, breakPeriod, leaseId, this.client.getVersion(), requestId, sharesnapshot, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2983,15 +3117,17 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String sh final String action = "break"; final String restype = "share"; final String accept = "application/xml"; - return service.breakLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, restype, timeout, - breakPeriod, leaseId, this.client.getVersion(), requestId, sharesnapshot, - this.client.getFileRequestIntent(), accept, context); + return service + .breakLeaseNoCustomHeaders(this.client.getUrl(), shareName, comp, action, restype, timeout, breakPeriod, + leaseId, this.client.getVersion(), requestId, sharesnapshot, this.client.getFileRequestIntent(), accept, + context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3020,15 +3156,19 @@ public ResponseBase breakLeaseWithResponse(String final String action = "break"; final String restype = "share"; final String accept = "application/xml"; - return service.breakLeaseSync(this.client.getUrl(), shareName, comp, action, restype, timeout, breakPeriod, - leaseId, this.client.getVersion(), requestId, sharesnapshot, this.client.getFileRequestIntent(), accept, - context); + try { + return service.breakLeaseSync(this.client.getUrl(), shareName, comp, action, restype, timeout, breakPeriod, + leaseId, this.client.getVersion(), requestId, sharesnapshot, this.client.getFileRequestIntent(), accept, + context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3057,7 +3197,7 @@ public void breakLease(String shareName, Integer timeout, Integer breakPeriod, S /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3086,14 +3226,18 @@ public Response breakLeaseNoCustomHeadersWithResponse(String shareName, In final String action = "break"; final String restype = "share"; final String accept = "application/xml"; - return service.breakLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, comp, action, restype, timeout, - breakPeriod, leaseId, this.client.getVersion(), requestId, sharesnapshot, - this.client.getFileRequestIntent(), accept, context); + try { + return service.breakLeaseNoCustomHeadersSync(this.client.getUrl(), shareName, comp, action, restype, + timeout, breakPeriod, leaseId, this.client.getVersion(), requestId, sharesnapshot, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Creates a read-only snapshot of a share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3110,13 +3254,15 @@ public Mono> createSnapshotWithR final String restype = "share"; final String comp = "snapshot"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.createSnapshot(this.client.getUrl(), shareName, restype, comp, - timeout, metadata, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.createSnapshot(this.client.getUrl(), shareName, restype, comp, timeout, + metadata, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a read-only snapshot of a share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3134,13 +3280,15 @@ public Mono> createSnapshotWithR final String restype = "share"; final String comp = "snapshot"; final String accept = "application/xml"; - return service.createSnapshot(this.client.getUrl(), shareName, restype, comp, timeout, metadata, - this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); + return service + .createSnapshot(this.client.getUrl(), shareName, restype, comp, timeout, metadata, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a read-only snapshot of a share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3153,12 +3301,14 @@ public Mono> createSnapshotWithR */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createSnapshotAsync(String shareName, Integer timeout, Map metadata) { - return createSnapshotWithResponseAsync(shareName, timeout, metadata).flatMap(ignored -> Mono.empty()); + return createSnapshotWithResponseAsync(shareName, timeout, metadata) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Creates a read-only snapshot of a share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3173,12 +3323,14 @@ public Mono createSnapshotAsync(String shareName, Integer timeout, Map createSnapshotAsync(String shareName, Integer timeout, Map metadata, Context context) { - return createSnapshotWithResponseAsync(shareName, timeout, metadata, context).flatMap(ignored -> Mono.empty()); + return createSnapshotWithResponseAsync(shareName, timeout, metadata, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Creates a read-only snapshot of a share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3195,14 +3347,15 @@ public Mono> createSnapshotNoCustomHeadersWithResponseAsync(Strin final String restype = "share"; final String comp = "snapshot"; final String accept = "application/xml"; - return FluxUtil.withContext( - context -> service.createSnapshotNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, - metadata, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.createSnapshotNoCustomHeaders(this.client.getUrl(), shareName, restype, + comp, timeout, metadata, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a read-only snapshot of a share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3220,13 +3373,15 @@ public Mono> createSnapshotNoCustomHeadersWithResponseAsync(Strin final String restype = "share"; final String comp = "snapshot"; final String accept = "application/xml"; - return service.createSnapshotNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, metadata, - this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); + return service + .createSnapshotNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, metadata, + this.client.getVersion(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Creates a read-only snapshot of a share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3244,13 +3399,17 @@ public ResponseBase createSnapshotWithRespons final String restype = "share"; final String comp = "snapshot"; final String accept = "application/xml"; - return service.createSnapshotSync(this.client.getUrl(), shareName, restype, comp, timeout, metadata, - this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); + try { + return service.createSnapshotSync(this.client.getUrl(), shareName, restype, comp, timeout, metadata, + this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Creates a read-only snapshot of a share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3267,7 +3426,7 @@ public void createSnapshot(String shareName, Integer timeout, Map createSnapshotNoCustomHeadersWithResponse(String shareName final String restype = "share"; final String comp = "snapshot"; final String accept = "application/xml"; - return service.createSnapshotNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, - metadata, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); + try { + return service.createSnapshotNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, + metadata, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3308,13 +3471,15 @@ public Mono> createPermissionW final String restype = "share"; final String comp = "filepermission"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.createPermission(this.client.getUrl(), shareName, restype, comp, - timeout, this.client.getVersion(), this.client.getFileRequestIntent(), sharePermission, accept, context)); + return FluxUtil + .withContext(context -> service.createPermission(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), this.client.getFileRequestIntent(), sharePermission, accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3332,13 +3497,15 @@ public Mono> createPermissionW final String restype = "share"; final String comp = "filepermission"; final String accept = "application/xml"; - return service.createPermission(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), this.client.getFileRequestIntent(), sharePermission, accept, context); + return service + .createPermission(this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), sharePermission, accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3351,12 +3518,14 @@ public Mono> createPermissionW */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createPermissionAsync(String shareName, SharePermission sharePermission, Integer timeout) { - return createPermissionWithResponseAsync(shareName, sharePermission, timeout).flatMap(ignored -> Mono.empty()); + return createPermissionWithResponseAsync(shareName, sharePermission, timeout) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3372,12 +3541,13 @@ public Mono createPermissionAsync(String shareName, SharePermission shareP public Mono createPermissionAsync(String shareName, SharePermission sharePermission, Integer timeout, Context context) { return createPermissionWithResponseAsync(shareName, sharePermission, timeout, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3396,12 +3566,13 @@ public Mono> createPermissionNoCustomHeadersWithResponseAsync(Str final String accept = "application/xml"; return FluxUtil.withContext( context -> service.createPermissionNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), this.client.getFileRequestIntent(), sharePermission, accept, context)); + this.client.getVersion(), this.client.getFileRequestIntent(), sharePermission, accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3419,13 +3590,15 @@ public Mono> createPermissionNoCustomHeadersWithResponseAsync(Str final String restype = "share"; final String comp = "filepermission"; final String accept = "application/xml"; - return service.createPermissionNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), this.client.getFileRequestIntent(), sharePermission, accept, context); + return service + .createPermissionNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), this.client.getFileRequestIntent(), sharePermission, accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3443,13 +3616,17 @@ public ResponseBase createPermissionWithRes final String restype = "share"; final String comp = "filepermission"; final String accept = "application/xml"; - return service.createPermissionSync(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), this.client.getFileRequestIntent(), sharePermission, accept, context); + try { + return service.createPermissionSync(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), this.client.getFileRequestIntent(), sharePermission, accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3466,7 +3643,7 @@ public void createPermission(String shareName, SharePermission sharePermission, /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3484,13 +3661,17 @@ public Response createPermissionNoCustomHeadersWithResponse(String shareNa final String restype = "share"; final String comp = "filepermission"; final String accept = "application/xml"; - return service.createPermissionNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), this.client.getFileRequestIntent(), sharePermission, accept, context); + try { + return service.createPermissionNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), this.client.getFileRequestIntent(), sharePermission, accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param filePermissionFormat Optional. Available for version 2023-06-01 and later. Specifies the format in which @@ -3513,14 +3694,16 @@ public Mono> getPermis final String restype = "share"; final String comp = "filepermission"; final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getPermission(this.client.getUrl(), shareName, restype, comp, - filePermissionKey, filePermissionFormat, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.getPermission(this.client.getUrl(), shareName, restype, comp, + filePermissionKey, filePermissionFormat, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param filePermissionFormat Optional. Available for version 2023-06-01 and later. Specifies the format in which @@ -3545,14 +3728,15 @@ public Mono> getPermis final String restype = "share"; final String comp = "filepermission"; final String accept = "application/json"; - return service.getPermission(this.client.getUrl(), shareName, restype, comp, filePermissionKey, - filePermissionFormat, timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, - context); + return service + .getPermission(this.client.getUrl(), shareName, restype, comp, filePermissionKey, filePermissionFormat, + timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param filePermissionFormat Optional. Available for version 2023-06-01 and later. Specifies the format in which @@ -3572,12 +3756,13 @@ public Mono> getPermis public Mono getPermissionAsync(String shareName, String filePermissionKey, FilePermissionFormat filePermissionFormat, Integer timeout) { return getPermissionWithResponseAsync(shareName, filePermissionKey, filePermissionFormat, timeout) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param filePermissionFormat Optional. Available for version 2023-06-01 and later. Specifies the format in which @@ -3598,12 +3783,13 @@ public Mono getPermissionAsync(String shareName, String filePer public Mono getPermissionAsync(String shareName, String filePermissionKey, FilePermissionFormat filePermissionFormat, Integer timeout, Context context) { return getPermissionWithResponseAsync(shareName, filePermissionKey, filePermissionFormat, timeout, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param filePermissionFormat Optional. Available for version 2023-06-01 and later. Specifies the format in which @@ -3626,14 +3812,16 @@ public Mono> getPermissionNoCustomHeadersWithResponseA final String restype = "share"; final String comp = "filepermission"; final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getPermissionNoCustomHeaders(this.client.getUrl(), shareName, - restype, comp, filePermissionKey, filePermissionFormat, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.getPermissionNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, + filePermissionKey, filePermissionFormat, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param filePermissionFormat Optional. Available for version 2023-06-01 and later. Specifies the format in which @@ -3657,14 +3845,16 @@ public Mono> getPermissionNoCustomHeadersWithResponseA final String restype = "share"; final String comp = "filepermission"; final String accept = "application/json"; - return service.getPermissionNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, filePermissionKey, - filePermissionFormat, timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, - context); + return service + .getPermissionNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, filePermissionKey, + filePermissionFormat, timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, + context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param filePermissionFormat Optional. Available for version 2023-06-01 and later. Specifies the format in which @@ -3687,14 +3877,18 @@ public ResponseBase getPermissionWi final String restype = "share"; final String comp = "filepermission"; final String accept = "application/json"; - return service.getPermissionSync(this.client.getUrl(), shareName, restype, comp, filePermissionKey, - filePermissionFormat, timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, - context); + try { + return service.getPermissionSync(this.client.getUrl(), shareName, restype, comp, filePermissionKey, + filePermissionFormat, timeout, this.client.getVersion(), this.client.getFileRequestIntent(), accept, + context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param filePermissionFormat Optional. Available for version 2023-06-01 and later. Specifies the format in which @@ -3713,13 +3907,17 @@ public ResponseBase getPermissionWi @ServiceMethod(returns = ReturnType.SINGLE) public SharePermission getPermission(String shareName, String filePermissionKey, FilePermissionFormat filePermissionFormat, Integer timeout) { - return getPermissionWithResponse(shareName, filePermissionKey, filePermissionFormat, timeout, Context.NONE) - .getValue(); + try { + return getPermissionWithResponse(shareName, filePermissionKey, filePermissionFormat, timeout, Context.NONE) + .getValue(); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param filePermissionFormat Optional. Available for version 2023-06-01 and later. Specifies the format in which @@ -3742,14 +3940,18 @@ public Response getPermissionNoCustomHeadersWithResponse(String final String restype = "share"; final String comp = "filepermission"; final String accept = "application/json"; - return service.getPermissionNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, - filePermissionKey, filePermissionFormat, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context); + try { + return service.getPermissionNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, + filePermissionKey, filePermissionFormat, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3778,15 +3980,17 @@ public Mono> setPropertiesWithRes final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setProperties(this.client.getUrl(), shareName, restype, comp, - timeout, this.client.getVersion(), quota, accessTier, leaseId, rootSquash, - enableSnapshotVirtualDirectoryAccess, paidBurstingEnabled, paidBurstingMaxBandwidthMibps, - paidBurstingMaxIops, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.setProperties(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), quota, accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, + paidBurstingEnabled, paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3816,14 +4020,16 @@ public Mono> setPropertiesWithRes final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; - return service.setProperties(this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), - quota, accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, paidBurstingEnabled, - paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, this.client.getFileRequestIntent(), accept, context); + return service + .setProperties(this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), quota, + accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, paidBurstingEnabled, + paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3850,12 +4056,14 @@ public Mono setPropertiesAsync(String shareName, Integer timeout, Integer Boolean paidBurstingEnabled, Long paidBurstingMaxBandwidthMibps, Long paidBurstingMaxIops) { return setPropertiesWithResponseAsync(shareName, timeout, quota, accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, paidBurstingEnabled, paidBurstingMaxBandwidthMibps, - paidBurstingMaxIops).flatMap(ignored -> Mono.empty()); + paidBurstingMaxIops) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3883,12 +4091,14 @@ public Mono setPropertiesAsync(String shareName, Integer timeout, Integer Boolean paidBurstingEnabled, Long paidBurstingMaxBandwidthMibps, Long paidBurstingMaxIops, Context context) { return setPropertiesWithResponseAsync(shareName, timeout, quota, accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, paidBurstingEnabled, paidBurstingMaxBandwidthMibps, - paidBurstingMaxIops, context).flatMap(ignored -> Mono.empty()); + paidBurstingMaxIops, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3917,15 +4127,17 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync(String final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setPropertiesNoCustomHeaders(this.client.getUrl(), shareName, - restype, comp, timeout, this.client.getVersion(), quota, accessTier, leaseId, rootSquash, - enableSnapshotVirtualDirectoryAccess, paidBurstingEnabled, paidBurstingMaxBandwidthMibps, - paidBurstingMaxIops, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.setPropertiesNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, + timeout, this.client.getVersion(), quota, accessTier, leaseId, rootSquash, + enableSnapshotVirtualDirectoryAccess, paidBurstingEnabled, paidBurstingMaxBandwidthMibps, + paidBurstingMaxIops, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3955,15 +4167,17 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync(String final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; - return service.setPropertiesNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), quota, accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, - paidBurstingEnabled, paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, this.client.getFileRequestIntent(), - accept, context); + return service + .setPropertiesNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), quota, accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, + paidBurstingEnabled, paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3993,15 +4207,19 @@ public ResponseBase setPropertiesWithResponse( final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; - return service.setPropertiesSync(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), quota, accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, - paidBurstingEnabled, paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, this.client.getFileRequestIntent(), - accept, context); + try { + return service.setPropertiesSync(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), quota, accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, + paidBurstingEnabled, paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4032,7 +4250,7 @@ public void setProperties(String shareName, Integer timeout, Integer quota, Shar /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4062,15 +4280,19 @@ public Response setPropertiesNoCustomHeadersWithResponse(String shareName, final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; - return service.setPropertiesNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), quota, accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, - paidBurstingEnabled, paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, this.client.getFileRequestIntent(), - accept, context); + try { + return service.setPropertiesNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), quota, accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, + paidBurstingEnabled, paidBurstingMaxBandwidthMibps, paidBurstingMaxIops, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4088,13 +4310,15 @@ public Mono> setMetadataWithRespons final String restype = "share"; final String comp = "metadata"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setMetadata(this.client.getUrl(), shareName, restype, comp, - timeout, metadata, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.setMetadata(this.client.getUrl(), shareName, restype, comp, timeout, + metadata, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4113,13 +4337,15 @@ public Mono> setMetadataWithRespons final String restype = "share"; final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadata(this.client.getUrl(), shareName, restype, comp, timeout, metadata, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + return service + .setMetadata(this.client.getUrl(), shareName, restype, comp, timeout, metadata, this.client.getVersion(), + leaseId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4134,12 +4360,14 @@ public Mono> setMetadataWithRespons @ServiceMethod(returns = ReturnType.SINGLE) public Mono setMetadataAsync(String shareName, Integer timeout, Map metadata, String leaseId) { - return setMetadataWithResponseAsync(shareName, timeout, metadata, leaseId).flatMap(ignored -> Mono.empty()); + return setMetadataWithResponseAsync(shareName, timeout, metadata, leaseId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4156,12 +4384,13 @@ public Mono setMetadataAsync(String shareName, Integer timeout, Map setMetadataAsync(String shareName, Integer timeout, Map metadata, String leaseId, Context context) { return setMetadataWithResponseAsync(shareName, timeout, metadata, leaseId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4179,14 +4408,16 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String s final String restype = "share"; final String comp = "metadata"; final String accept = "application/xml"; - return FluxUtil.withContext( - context -> service.setMetadataNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, - metadata, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext( + context -> service.setMetadataNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, + metadata, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4205,13 +4436,15 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String s final String restype = "share"; final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadataNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, metadata, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + return service + .setMetadataNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, metadata, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4230,13 +4463,17 @@ public ResponseBase setMetadataWithResponse(Stri final String restype = "share"; final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadataSync(this.client.getUrl(), shareName, restype, comp, timeout, metadata, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + try { + return service.setMetadataSync(this.client.getUrl(), shareName, restype, comp, timeout, metadata, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4254,7 +4491,7 @@ public void setMetadata(String shareName, Integer timeout, Map m /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4273,13 +4510,17 @@ public Response setMetadataNoCustomHeadersWithResponse(String shareName, I final String restype = "share"; final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadataNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, metadata, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + try { + return service.setMetadataNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, + metadata, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4297,13 +4538,15 @@ public Response setMetadataNoCustomHeadersWithResponse(String shareName, I final String restype = "share"; final String comp = "acl"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getAccessPolicy(this.client.getUrl(), shareName, restype, comp, - timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.getAccessPolicy(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4322,13 +4565,15 @@ public Response setMetadataNoCustomHeadersWithResponse(String shareName, I final String restype = "share"; final String comp = "acl"; final String accept = "application/xml"; - return service.getAccessPolicy(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + return service + .getAccessPolicy(this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4342,12 +4587,13 @@ public Response setMetadataNoCustomHeadersWithResponse(String shareName, I @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccessPolicyAsync(String shareName, Integer timeout, String leaseId) { return getAccessPolicyWithResponseAsync(shareName, timeout, leaseId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4363,12 +4609,13 @@ public Mono getAccessPolicyAsync(String shareName, public Mono getAccessPolicyAsync(String shareName, Integer timeout, String leaseId, Context context) { return getAccessPolicyWithResponseAsync(shareName, timeout, leaseId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4387,12 +4634,13 @@ public Mono getAccessPolicyAsync(String shareName, final String accept = "application/xml"; return FluxUtil .withContext(context -> service.getAccessPolicyNoCustomHeaders(this.client.getUrl(), shareName, restype, - comp, timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)); + comp, timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4410,13 +4658,15 @@ public Mono> getAccessPolicyNoCustomHeade final String restype = "share"; final String comp = "acl"; final String accept = "application/xml"; - return service.getAccessPolicyNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + return service + .getAccessPolicyNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4434,13 +4684,17 @@ public Mono> getAccessPolicyNoCustomHeade final String restype = "share"; final String comp = "acl"; final String accept = "application/xml"; - return service.getAccessPolicySync(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + try { + return service.getAccessPolicySync(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4453,12 +4707,16 @@ public Mono> getAccessPolicyNoCustomHeade */ @ServiceMethod(returns = ReturnType.SINGLE) public ShareSignedIdentifierWrapper getAccessPolicy(String shareName, Integer timeout, String leaseId) { - return getAccessPolicyWithResponse(shareName, timeout, leaseId, Context.NONE).getValue(); + try { + return getAccessPolicyWithResponse(shareName, timeout, leaseId, Context.NONE).getValue(); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4476,13 +4734,17 @@ public Response getAccessPolicyNoCustomHeadersWith final String restype = "share"; final String comp = "acl"; final String accept = "application/xml"; - return service.getAccessPolicyNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + try { + return service.getAccessPolicyNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4503,12 +4765,12 @@ public Mono> setAccessPolicyWit ShareSignedIdentifierWrapper shareAclConverted = new ShareSignedIdentifierWrapper(shareAcl); return FluxUtil.withContext(context -> service.setAccessPolicy(this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), shareAclConverted, accept, - context)); + context)).onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4528,13 +4790,15 @@ public Mono> setAccessPolicyWit final String comp = "acl"; final String accept = "application/xml"; ShareSignedIdentifierWrapper shareAclConverted = new ShareSignedIdentifierWrapper(shareAcl); - return service.setAccessPolicy(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), shareAclConverted, accept, context); + return service + .setAccessPolicy(this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), shareAclConverted, accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4549,12 +4813,14 @@ public Mono> setAccessPolicyWit @ServiceMethod(returns = ReturnType.SINGLE) public Mono setAccessPolicyAsync(String shareName, Integer timeout, String leaseId, List shareAcl) { - return setAccessPolicyWithResponseAsync(shareName, timeout, leaseId, shareAcl).flatMap(ignored -> Mono.empty()); + return setAccessPolicyWithResponseAsync(shareName, timeout, leaseId, shareAcl) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4571,12 +4837,13 @@ public Mono setAccessPolicyAsync(String shareName, Integer timeout, String public Mono setAccessPolicyAsync(String shareName, Integer timeout, String leaseId, List shareAcl, Context context) { return setAccessPolicyWithResponseAsync(shareName, timeout, leaseId, shareAcl, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4595,14 +4862,16 @@ public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync(Stri final String comp = "acl"; final String accept = "application/xml"; ShareSignedIdentifierWrapper shareAclConverted = new ShareSignedIdentifierWrapper(shareAcl); - return FluxUtil.withContext(context -> service.setAccessPolicyNoCustomHeaders(this.client.getUrl(), shareName, - restype, comp, timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), - shareAclConverted, accept, context)); + return FluxUtil + .withContext(context -> service.setAccessPolicyNoCustomHeaders(this.client.getUrl(), shareName, restype, + comp, timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), shareAclConverted, + accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4623,12 +4892,13 @@ public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync(Stri final String accept = "application/xml"; ShareSignedIdentifierWrapper shareAclConverted = new ShareSignedIdentifierWrapper(shareAcl); return service.setAccessPolicyNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), shareAclConverted, accept, context); + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), shareAclConverted, accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4648,13 +4918,18 @@ public ResponseBase setAccessPolicyWithRespo final String comp = "acl"; final String accept = "application/xml"; ShareSignedIdentifierWrapper shareAclConverted = new ShareSignedIdentifierWrapper(shareAcl); - return service.setAccessPolicySync(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), shareAclConverted, accept, context); + try { + return service.setAccessPolicySync(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), shareAclConverted, accept, + context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4673,7 +4948,7 @@ public void setAccessPolicy(String shareName, Integer timeout, String leaseId, /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4693,13 +4968,18 @@ public Response setAccessPolicyNoCustomHeadersWithResponse(String shareNam final String comp = "acl"; final String accept = "application/xml"; ShareSignedIdentifierWrapper shareAclConverted = new ShareSignedIdentifierWrapper(shareAcl); - return service.setAccessPolicyNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), shareAclConverted, accept, context); + try { + return service.setAccessPolicyNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), shareAclConverted, accept, + context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4716,13 +4996,15 @@ public Mono> getStatisticsW final String restype = "share"; final String comp = "stats"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getStatistics(this.client.getUrl(), shareName, restype, comp, - timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.getStatistics(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4740,13 +5022,15 @@ public Mono> getStatisticsW final String restype = "share"; final String comp = "stats"; final String accept = "application/xml"; - return service.getStatistics(this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), - leaseId, this.client.getFileRequestIntent(), accept, context); + return service + .getStatistics(this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4760,12 +5044,13 @@ public Mono> getStatisticsW @ServiceMethod(returns = ReturnType.SINGLE) public Mono getStatisticsAsync(String shareName, Integer timeout, String leaseId) { return getStatisticsWithResponseAsync(shareName, timeout, leaseId) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4780,12 +5065,13 @@ public Mono getStatisticsAsync(String shareName, Integer timeout, St @ServiceMethod(returns = ReturnType.SINGLE) public Mono getStatisticsAsync(String shareName, Integer timeout, String leaseId, Context context) { return getStatisticsWithResponseAsync(shareName, timeout, leaseId, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4804,12 +5090,13 @@ public Mono> getStatisticsNoCustomHeadersWithResponseAsync( final String accept = "application/xml"; return FluxUtil .withContext(context -> service.getStatisticsNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, - timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)); + timeout, this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4827,13 +5114,15 @@ public Mono> getStatisticsNoCustomHeadersWithResponseAsync( final String restype = "share"; final String comp = "stats"; final String accept = "application/xml"; - return service.getStatisticsNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + return service + .getStatisticsNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4851,13 +5140,17 @@ public ResponseBase getStatisticsWithRes final String restype = "share"; final String comp = "stats"; final String accept = "application/xml"; - return service.getStatisticsSync(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + try { + return service.getStatisticsSync(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4870,12 +5163,16 @@ public ResponseBase getStatisticsWithRes */ @ServiceMethod(returns = ReturnType.SINGLE) public ShareStats getStatistics(String shareName, Integer timeout, String leaseId) { - return getStatisticsWithResponse(shareName, timeout, leaseId, Context.NONE).getValue(); + try { + return getStatisticsWithResponse(shareName, timeout, leaseId, Context.NONE).getValue(); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4893,13 +5190,17 @@ public Response getStatisticsNoCustomHeadersWithResponse(String shar final String restype = "share"; final String comp = "stats"; final String accept = "application/xml"; - return service.getStatisticsNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + try { + return service.getStatisticsNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), leaseId, this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4919,14 +5220,16 @@ public Mono> restoreWithResponseAsync(S final String restype = "share"; final String comp = "undelete"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.restore(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), requestId, deletedShareName, deletedShareVersion, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.restore(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), requestId, deletedShareName, deletedShareVersion, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4947,13 +5250,15 @@ public Mono> restoreWithResponseAsync(S final String restype = "share"; final String comp = "undelete"; final String accept = "application/xml"; - return service.restore(this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), - requestId, deletedShareName, deletedShareVersion, this.client.getFileRequestIntent(), accept, context); + return service + .restore(this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), requestId, + deletedShareName, deletedShareVersion, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4971,12 +5276,13 @@ public Mono> restoreWithResponseAsync(S public Mono restoreAsync(String shareName, Integer timeout, String requestId, String deletedShareName, String deletedShareVersion) { return restoreWithResponseAsync(shareName, timeout, requestId, deletedShareName, deletedShareVersion) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4995,12 +5301,13 @@ public Mono restoreAsync(String shareName, Integer timeout, String request public Mono restoreAsync(String shareName, Integer timeout, String requestId, String deletedShareName, String deletedShareVersion, Context context) { return restoreWithResponseAsync(shareName, timeout, requestId, deletedShareName, deletedShareVersion, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException) .flatMap(ignored -> Mono.empty()); } /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -5020,14 +5327,16 @@ public Mono> restoreNoCustomHeadersWithResponseAsync(String share final String restype = "share"; final String comp = "undelete"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.restoreNoCustomHeaders(this.client.getUrl(), shareName, restype, - comp, timeout, this.client.getVersion(), requestId, deletedShareName, deletedShareVersion, - this.client.getFileRequestIntent(), accept, context)); + return FluxUtil + .withContext(context -> service.restoreNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, + timeout, this.client.getVersion(), requestId, deletedShareName, deletedShareVersion, + this.client.getFileRequestIntent(), accept, context)) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -5048,14 +5357,15 @@ public Mono> restoreNoCustomHeadersWithResponseAsync(String share final String restype = "share"; final String comp = "undelete"; final String accept = "application/xml"; - return service.restoreNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), requestId, deletedShareName, deletedShareVersion, - this.client.getFileRequestIntent(), accept, context); + return service + .restoreNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), + requestId, deletedShareName, deletedShareVersion, this.client.getFileRequestIntent(), accept, context) + .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException); } /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -5076,13 +5386,18 @@ public ResponseBase restoreWithResponse(String share final String restype = "share"; final String comp = "undelete"; final String accept = "application/xml"; - return service.restoreSync(this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), - requestId, deletedShareName, deletedShareVersion, this.client.getFileRequestIntent(), accept, context); + try { + return service.restoreSync(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), requestId, deletedShareName, deletedShareVersion, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -5103,7 +5418,7 @@ public void restore(String shareName, Integer timeout, String requestId, String /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -5124,8 +5439,12 @@ public Response restoreNoCustomHeadersWithResponse(String shareName, Integ final String restype = "share"; final String comp = "undelete"; final String accept = "application/xml"; - return service.restoreNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), requestId, deletedShareName, deletedShareVersion, - this.client.getFileRequestIntent(), accept, context); + try { + return service.restoreNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), requestId, deletedShareName, deletedShareVersion, + this.client.getFileRequestIntent(), accept, context); + } catch (ShareStorageExceptionInternal internalException) { + throw ModelHelper.mapToShareStorageException(internalException); + } } } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/util/ModelHelper.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/util/ModelHelper.java index 4829b84aa75a..5279f7c6cad5 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/util/ModelHelper.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/util/ModelHelper.java @@ -83,8 +83,6 @@ import java.util.Map; import java.util.Set; import java.util.TreeSet; -import java.util.concurrent.Callable; -import java.util.function.Supplier; import static com.azure.core.http.HttpHeaderName.LAST_MODIFIED; @@ -632,31 +630,7 @@ public static LongRunningOperationStatus mapStatusToLongRunningOperationStatus(C * @param internal The internal exception. * @return The public exception. */ - public static Throwable mapToShareStorageException(Throwable internal) { - if (internal instanceof ShareStorageExceptionInternal) { - ShareStorageExceptionInternal internalException = (ShareStorageExceptionInternal) internal; - return new ShareStorageException(internalException.getMessage(), internalException.getResponse(), - internalException.getValue()); - } - - return internal; - } - - public static Callable wrapTimeoutServiceCallWithExceptionMapping(Supplier serviceCall) { - return () -> { - try { - return serviceCall.get(); - } catch (ShareStorageExceptionInternal internal) { - throw (ShareStorageException) mapToShareStorageException(internal); - } - }; - } - - public static T wrapServiceCallWithExceptionMapping(Supplier serviceCall) { - try { - return serviceCall.get(); - } catch (ShareStorageExceptionInternal internal) { - throw (ShareStorageException) mapToShareStorageException(internal); - } + public static ShareStorageException mapToShareStorageException(ShareStorageExceptionInternal internal) { + return new ShareStorageException(internal.getMessage(), internal.getResponse(), internal.getValue()); } } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/specialized/ShareLeaseAsyncClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/specialized/ShareLeaseAsyncClient.java index d6060c98ffe7..7d6b96b2f8d3 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/specialized/ShareLeaseAsyncClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/specialized/ShareLeaseAsyncClient.java @@ -14,7 +14,6 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.storage.file.share.ShareFileAsyncClient; import com.azure.storage.file.share.implementation.AzureFileStorageImpl; -import com.azure.storage.file.share.implementation.util.ModelHelper; import com.azure.storage.file.share.models.ShareTokenIntent; import com.azure.storage.file.share.options.ShareAcquireLeaseOptions; import com.azure.storage.file.share.options.ShareBreakLeaseOptions; @@ -178,13 +177,11 @@ Mono> acquireLeaseWithResponse(ShareAcquireLeaseOptions options Mono> response; if (this.isShareFile) { response = this.client.getFiles().acquireLeaseWithResponseAsync(shareName, resourcePath, null, - options.getDuration(), this.leaseId, null, context) - .onErrorMap(ModelHelper::mapToShareStorageException) + options.getDuration(), this.leaseId, null, context) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsLeaseId())); } else { - response = this.client.getShares().acquireLeaseWithResponseAsync(shareName, null, - options.getDuration(), this.leaseId, shareSnapshot, null, context) - .onErrorMap(ModelHelper::mapToShareStorageException) + response = this.client.getShares().acquireLeaseWithResponseAsync(shareName, null, options.getDuration(), + this.leaseId, shareSnapshot, null, context) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsLeaseId())); } @@ -237,12 +234,10 @@ Mono> releaseLeaseWithResponse(Context context) { context = context == null ? Context.NONE : context; if (this.isShareFile) { return this.client.getFiles().releaseLeaseNoCustomHeadersWithResponseAsync(shareName, resourcePath, - this.leaseId, null, null, context) - .onErrorMap(ModelHelper::mapToShareStorageException); + this.leaseId, null, null, context); } else { return this.client.getShares().releaseLeaseNoCustomHeadersWithResponseAsync(shareName, this.leaseId, null, - shareSnapshot, null, context) - .onErrorMap(ModelHelper::mapToShareStorageException); + shareSnapshot, null, context); } } @@ -319,12 +314,10 @@ Mono> breakLeaseWithResponse(ShareBreakLeaseOptions options, Cont : Math.toIntExact(options.getBreakPeriod().getSeconds()); if (this.isShareFile) { return this.client.getFiles() - .breakLeaseNoCustomHeadersWithResponseAsync(shareName, resourcePath, null, null, null, context) - .onErrorMap(ModelHelper::mapToShareStorageException); + .breakLeaseNoCustomHeadersWithResponseAsync(shareName, resourcePath, null, null, null, context); } else { return this.client.getShares().breakLeaseNoCustomHeadersWithResponseAsync(shareName, null, breakPeriod, - null, null, shareSnapshot, context) - .onErrorMap(ModelHelper::mapToShareStorageException); + null, null, shareSnapshot, context); } } @@ -376,14 +369,12 @@ Mono> changeLeaseWithResponse(String proposedId, Context contex Mono> response; if (this.isShareFile) { - response = this.client.getFiles().changeLeaseWithResponseAsync(shareName, resourcePath, this.leaseId, null, proposedId, - null, context) - .onErrorMap(ModelHelper::mapToShareStorageException) + response = this.client.getFiles().changeLeaseWithResponseAsync(shareName, resourcePath, this.leaseId, null, + proposedId, null, context) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsLeaseId())); } else { - response = this.client.getShares().changeLeaseWithResponseAsync(shareName, this.leaseId, null, proposedId, shareSnapshot, - null, context) - .onErrorMap(ModelHelper::mapToShareStorageException) + response = this.client.getShares().changeLeaseWithResponseAsync(shareName, this.leaseId, null, proposedId, + shareSnapshot, null, context) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsLeaseId())); } @@ -442,7 +433,6 @@ Mono> renewLeaseWithResponse(Context context) { } else { response = this.client.getShares().renewLeaseWithResponseAsync(shareName, this.leaseId, null, shareSnapshot, null, context) - .onErrorMap(ModelHelper::mapToShareStorageException) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsLeaseId())); } diff --git a/sdk/storage/azure-storage-file-share/swagger/src/main/java/ShareStorageCustomization.java b/sdk/storage/azure-storage-file-share/swagger/src/main/java/ShareStorageCustomization.java index 8caf44fde6a9..1749da82eb18 100644 --- a/sdk/storage/azure-storage-file-share/swagger/src/main/java/ShareStorageCustomization.java +++ b/sdk/storage/azure-storage-file-share/swagger/src/main/java/ShareStorageCustomization.java @@ -5,10 +5,23 @@ import com.azure.autorest.customization.Customization; import com.azure.autorest.customization.LibraryCustomization; import com.azure.autorest.customization.PackageCustomization; +import com.github.javaparser.ParseProblemException; import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.CatchClause; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.stmt.TryStmt; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.ast.type.Type; import org.slf4j.Logger; +import java.util.Arrays; +import java.util.List; + /** * Customization class for File Share Storage. */ @@ -28,6 +41,8 @@ public void customize(LibraryCustomization customization, Logger logger) { customizeFilesAndDirectoriesListSegment( customization.getPackage("com.azure.storage.file.share.implementation.models") .getClass("FilesAndDirectoriesListSegment")); + + updateImplToMapInternalException(customization.getPackage("com.azure.storage.file.share.implementation")); } // ShareFileRangeList has special serialization behaviors which Swagger cannot define correctly. It has a single @@ -147,4 +162,109 @@ private static void customizeFilesAndDirectoriesListSegment(ClassCustomization c ))); }); } + + /** + * Customizes the implementation classes that will perform calls to the service. The following logic is used: + *

+ * - Check for the return of the method not equaling to PagedFlux, PagedIterable, PollerFlux, or SyncPoller. Those + * types wrap other APIs and those APIs being update is the correct change. + * - For asynchronous methods, add a call to + * {@code .onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException)} to handle + * mapping ShareStorageExceptionInternal to ShareStorageException. + * - For synchronous methods, wrap the return statement in a try-catch block that catches + * ShareStorageExceptionInternal and rethrows {@code ModelHelper.mapToShareStorageException(e)}. Or, for void + * methods wrap the last statement. + * + * @param implPackage The implementation package. + */ + private static void updateImplToMapInternalException(PackageCustomization implPackage) { + List implsToUpdate = Arrays.asList("DirectoriesImpl", "FilesImpl", "ServicesImpl", "SharesImpl"); + for (String implToUpdate : implsToUpdate) { + implPackage.getClass(implToUpdate).customizeAst(ast -> { + ast.addImport("com.azure.storage.file.share.implementation.util.ModelHelper"); + ast.addImport("com.azure.storage.file.share.models.ShareStorageException"); + ast.addImport("com.azure.storage.file.share.implementation.models.ShareStorageExceptionInternal"); + ast.getClassByName(implToUpdate).ifPresent(clazz -> { + clazz.getFields(); + + clazz.getMethods().forEach(methodDeclaration -> { + Type returnType = methodDeclaration.getType(); + // The way code generation works we only need to update the methods that have a class return type. + // As non-class return types, such as "void", call into the Response methods. + if (!returnType.isClassOrInterfaceType()) { + return; + } + + ClassOrInterfaceType returnTypeClass = returnType.asClassOrInterfaceType(); + String returnTypeName = returnTypeClass.getNameAsString(); + if (returnTypeName.equals("PagedFlux") || returnTypeName.equals("PagedIterable") + || returnTypeName.equals("PollerFlux") || returnTypeName.equals("SyncPoller")) { + return; + } + + if (returnTypeName.equals("Mono") || returnTypeName.equals("Flux")) { + addErrorMappingToAsyncMethod(methodDeclaration); + } else { + addErrorMappingToSyncMethod(methodDeclaration); + } + }); + }); + }); + } + } + + private static void addErrorMappingToAsyncMethod(MethodDeclaration method) { + BlockStmt body = method.getBody().get(); + + // Bit of hack to insert the 'onErrorMap' in the right location. + // Unfortunately, 'onErrorMap' returns which for some calls breaks typing, such as Void -> Object or + // PagedResponse -> PagedResponseBase. So, 'onErrorMap' needs to be inserted after the first method call. + // To do this, we track the first found '(' and the associated closing ')' to insert 'onErrorMap' after the ')'. + // So, 'service.methodCall(parameters).map()' becomes 'service.methodCall(parameters).onErrorMap().map()'. + String originalReturnStatement = body.getStatement(body.getStatements().size() - 1).asReturnStmt() + .getExpression().get().toString(); + int insertionPoint = findAsyncOnErrorMapInsertionPoint(originalReturnStatement); + String newReturnStatement = "return " + originalReturnStatement.substring(0, insertionPoint) + + ".onErrorMap(ShareStorageExceptionInternal.class, ModelHelper::mapToShareStorageException)" + + originalReturnStatement.substring(insertionPoint) + ";"; + try { + Statement newReturn = StaticJavaParser.parseStatement(newReturnStatement); + body.getStatements().set(body.getStatements().size() - 1, newReturn); + } catch (ParseProblemException ex) { + throw new RuntimeException("Failed to parse: " + newReturnStatement, ex); + } + } + + private static int findAsyncOnErrorMapInsertionPoint(String returnStatement) { + int openParenthesis = 0; + int closeParenthesis = 0; + for (int i = 0; i < returnStatement.length(); i++) { + char c = returnStatement.charAt(i); + if (c == '(') { + openParenthesis++; + } else if (c == ')') { + closeParenthesis++; + if (openParenthesis == closeParenthesis) { + return i + 1; + } + } + } + return -1; + } + + private static void addErrorMappingToSyncMethod(MethodDeclaration method) { + BlockStmt body = method.getBody().get(); + + // Turn the last statement into a BlockStmt that will be used as the try block. + BlockStmt tryBlock = new BlockStmt(new NodeList<>(body.getStatement(body.getStatements().size() - 1))); + BlockStmt catchBlock = new BlockStmt(new NodeList<>(StaticJavaParser.parseStatement( + "throw ModelHelper.mapToShareStorageException(internalException);"))); + Parameter catchParameter = new Parameter().setType("ShareStorageExceptionInternal") + .setName("internalException"); + CatchClause catchClause = new CatchClause(catchParameter, catchBlock); + TryStmt tryCatchMap = new TryStmt(tryBlock, new NodeList<>(catchClause), null); + + // Replace the last statement with the try-catch block. + body.getStatements().set(body.getStatements().size() - 1, tryCatchMap); + } } diff --git a/sdk/storage/azure-storage-queue/checkstyle-suppressions.xml b/sdk/storage/azure-storage-queue/checkstyle-suppressions.xml index fe84424cf134..87a5600d9177 100644 --- a/sdk/storage/azure-storage-queue/checkstyle-suppressions.xml +++ b/sdk/storage/azure-storage-queue/checkstyle-suppressions.xml @@ -21,4 +21,14 @@ + + + + + + + + + + diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java index 65a895878a66..92b862392665 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java @@ -225,8 +225,7 @@ public Mono> createWithResponse(Map metadata) { Mono> createWithResponse(Map metadata, Context context) { context = context == null ? Context.NONE : context; - return client.getQueues().createNoCustomHeadersWithResponseAsync(queueName, null, metadata, null, context) - .onErrorMap(ModelHelper::mapToQueueStorageException); + return client.getQueues().createNoCustomHeadersWithResponseAsync(queueName, null, metadata, null, context); } /** @@ -362,8 +361,7 @@ public Mono> deleteWithResponse() { Mono> deleteWithResponse(Context context) { context = context == null ? Context.NONE : context; - return client.getQueues().deleteNoCustomHeadersWithResponseAsync(queueName, null, null, context) - .onErrorMap(ModelHelper::mapToQueueStorageException); + return client.getQueues().deleteNoCustomHeadersWithResponseAsync(queueName, null, null, context); } /** @@ -497,7 +495,6 @@ public Mono> getPropertiesWithResponse() { try { return withContext(context -> client.getQueues().getPropertiesWithResponseAsync(queueName, null, null, context) - .onErrorMap(ModelHelper::mapToQueueStorageException) .map(response -> new SimpleResponse<>(response, ModelHelper.transformQueueProperties(response.getDeserializedHeaders())))); } catch (RuntimeException ex) { @@ -580,8 +577,7 @@ public Mono setMetadata(Map metadata) { public Mono> setMetadataWithResponse(Map metadata) { try { return withContext(context -> client.getQueues() - .setMetadataNoCustomHeadersWithResponseAsync(queueName, null, metadata, null, context)) - .onErrorMap(ModelHelper::mapToQueueStorageException); + .setMetadataNoCustomHeadersWithResponseAsync(queueName, null, metadata, null, context)); } catch (RuntimeException ex) { return monoError(LOGGER, ex); } @@ -613,7 +609,6 @@ public PagedFlux getAccessPolicy() { try { Function>> retriever = marker -> this.client.getQueues() .getAccessPolicyWithResponseAsync(queueName, null, null, Context.NONE) - .onErrorMap(ModelHelper::mapToQueueStorageException) .map(response -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), response.getValue().items(), null, response.getDeserializedHeaders())); @@ -716,8 +711,7 @@ Mono> setAccessPolicyWithResponse(Iterable .collect(Collectors.toList()); return client.getQueues() - .setAccessPolicyNoCustomHeadersWithResponseAsync(queueName, null, null, permissionsList, context) - .onErrorMap(ModelHelper::mapToQueueStorageException); + .setAccessPolicyNoCustomHeadersWithResponseAsync(queueName, null, null, permissionsList, context); } /** @@ -770,8 +764,7 @@ public Mono clearMessages() { public Mono> clearMessagesWithResponse() { try { return withContext(context -> client.getMessages() - .clearNoCustomHeadersWithResponseAsync(queueName, null, null, context)) - .onErrorMap(ModelHelper::mapToQueueStorageException); + .clearNoCustomHeadersWithResponseAsync(queueName, null, null, context)); } catch (RuntimeException ex) { return monoError(LOGGER, ex); } @@ -956,7 +949,6 @@ public Mono> sendMessageWithResponse(BinaryData mess QueueMessage queueMessage = new QueueMessage().setMessageText(messageText); return client.getMessages().enqueueWithResponseAsync(queueName, queueMessage, visibilityTimeoutInSeconds, timeToLiveInSeconds, null, null, context) - .onErrorMap(ModelHelper::mapToQueueStorageException) .map(response -> new SimpleResponse<>(response, response.getValue().items().get(0))); })); } catch (RuntimeException ex) { @@ -1073,7 +1065,6 @@ public PagedFlux receiveMessages(Integer maxMessages, Duration Function>> retriever = marker -> withContext(context -> this.client.getMessages().dequeueWithResponseAsync(queueName, maxMessages, visibilityTimeoutInSeconds, null, null, context)) - .onErrorMap(ModelHelper::mapToQueueStorageException) .flatMap(this::transformMessagesDequeueResponse); return new PagedFlux<>(() -> retriever.apply(null), retriever); @@ -1183,7 +1174,6 @@ public PagedFlux peekMessages(Integer maxMessages) { try { Function>> retriever = marker -> withContext(context -> this.client.getMessages().peekWithResponseAsync(queueName, maxMessages, null, null, context) - .onErrorMap(ModelHelper::mapToQueueStorageException) .flatMap(this::transformMessagesPeekResponse)); return new PagedFlux<>(() -> retriever.apply(null), retriever); @@ -1328,7 +1318,6 @@ public Mono> updateMessageWithResponse(String mess try { return withContext(context -> client.getMessageIds().updateWithResponseAsync(queueName, messageId, popReceipt, (int) visTimeout.getSeconds(), null, null, message, context) - .onErrorMap(ModelHelper::mapToQueueStorageException) .map(response -> new SimpleResponse<>(response, new UpdateMessageResult( response.getDeserializedHeaders().getXMsPopreceipt(), response.getDeserializedHeaders().getXMsTimeNextVisible())))); @@ -1413,8 +1402,7 @@ public Mono deleteMessage(String messageId, String popReceipt) { public Mono> deleteMessageWithResponse(String messageId, String popReceipt) { try { return withContext(context -> client.getMessageIds() - .deleteNoCustomHeadersWithResponseAsync(queueName, messageId, popReceipt, null, null, context)) - .onErrorMap(ModelHelper::mapToQueueStorageException); + .deleteNoCustomHeadersWithResponseAsync(queueName, messageId, popReceipt, null, null, context)); } catch (RuntimeException ex) { return monoError(LOGGER, ex); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java index d3e2d63caab9..051ce2538f3b 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java @@ -58,7 +58,6 @@ import java.util.stream.Collectors; import static com.azure.storage.common.implementation.StorageImplUtils.submitThreadPool; -import static com.azure.storage.queue.implementation.util.ModelHelper.wrapCallWithExceptionMapping; /** * This class provides a client that contains all the operations for interacting with a queue in Azure Storage Queue. @@ -214,9 +213,8 @@ public void create() { public Response createWithResponse(Map metadata, Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; try { - Supplier> operation = wrapCallWithExceptionMapping( - () -> this.azureQueueStorage.getQueues().createNoCustomHeadersWithResponse(queueName, null, metadata, - null, finalContext)); + Supplier> operation = () -> this.azureQueueStorage.getQueues() + .createNoCustomHeadersWithResponse(queueName, null, metadata, null, finalContext); return submitThreadPool(operation, LOGGER, timeout); } catch (RuntimeException e) { @@ -283,9 +281,8 @@ public Response createIfNotExistsWithResponse(Map metad Context context) { Context finalContext = context == null ? Context.NONE : context; try { - Supplier> operation = wrapCallWithExceptionMapping( - () -> this.azureQueueStorage.getQueues().createNoCustomHeadersWithResponse(queueName, null, metadata, - null, finalContext)); + Supplier> operation = () -> this.azureQueueStorage.getQueues() + .createNoCustomHeadersWithResponse(queueName, null, metadata, null, finalContext); Response response = submitThreadPool(operation, LOGGER, timeout); return new SimpleResponse<>(response, true); } catch (QueueStorageException e) { @@ -349,9 +346,8 @@ public void delete() { @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation = wrapCallWithExceptionMapping( - () -> this.azureQueueStorage.getQueues().deleteNoCustomHeadersWithResponse(queueName, null, null, - finalContext)); + Supplier> operation = () -> this.azureQueueStorage.getQueues() + .deleteNoCustomHeadersWithResponse(queueName, null, null, finalContext); return submitThreadPool(operation, LOGGER, timeout); } @@ -410,8 +406,8 @@ public boolean deleteIfExists() { public Response deleteIfExistsWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; try { - Supplier> operation = wrapCallWithExceptionMapping(() -> this.azureQueueStorage.getQueues() - .deleteNoCustomHeadersWithResponse(queueName, null, null, finalContext)); + Supplier> operation = () -> this.azureQueueStorage.getQueues() + .deleteNoCustomHeadersWithResponse(queueName, null, null, finalContext); Response response = submitThreadPool(operation, LOGGER, timeout); return new SimpleResponse<>(response, true); @@ -482,8 +478,8 @@ public QueueProperties getProperties() { @ServiceMethod(returns = ReturnType.SINGLE) public Response getPropertiesWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation = wrapCallWithExceptionMapping( - () -> this.azureQueueStorage.getQueues().getPropertiesWithResponse(queueName, null, null, finalContext)); + Supplier> operation = () -> this.azureQueueStorage.getQueues() + .getPropertiesWithResponse(queueName, null, null, finalContext); ResponseBase response = submitThreadPool(operation, LOGGER, timeout); return new SimpleResponse<>(response, ModelHelper.transformQueueProperties(response.getDeserializedHeaders())); @@ -566,8 +562,8 @@ public void setMetadata(Map metadata) { @ServiceMethod(returns = ReturnType.SINGLE) public Response setMetadataWithResponse(Map metadata, Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation = wrapCallWithExceptionMapping(() -> this.azureQueueStorage.getQueues() - .setMetadataNoCustomHeadersWithResponse(queueName, null, metadata, null, finalContext)); + Supplier> operation = () -> this.azureQueueStorage.getQueues() + .setMetadataNoCustomHeadersWithResponse(queueName, null, metadata, null, finalContext); return submitThreadPool(operation, LOGGER, timeout); } @@ -596,9 +592,8 @@ public Response setMetadataWithResponse(Map metadata, Dura */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable getAccessPolicy() { - ResponseBase responseBase = - wrapCallWithExceptionMapping(() -> azureQueueStorage.getQueues().getAccessPolicyWithResponse(queueName, - null, null, Context.NONE)).get(); + ResponseBase responseBase + = azureQueueStorage.getQueues().getAccessPolicyWithResponse(queueName, null, null, Context.NONE); Supplier> response = () -> new PagedResponseBase<>( responseBase.getRequest(), responseBase.getStatusCode(), responseBase.getHeaders(), @@ -672,8 +667,8 @@ public void setAccessPolicy(List permissions) { public Response setAccessPolicyWithResponse(List permissions, Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation = wrapCallWithExceptionMapping(() -> this.azureQueueStorage.getQueues() - .setAccessPolicyNoCustomHeadersWithResponse(queueName, null, null, permissions, finalContext)); + Supplier> operation = () -> this.azureQueueStorage.getQueues() + .setAccessPolicyNoCustomHeadersWithResponse(queueName, null, null, permissions, finalContext); return submitThreadPool(operation, LOGGER, timeout); } @@ -729,8 +724,8 @@ public void clearMessages() { @ServiceMethod(returns = ReturnType.SINGLE) public Response clearMessagesWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation = wrapCallWithExceptionMapping(() -> - this.azureQueueStorage.getMessages().clearNoCustomHeadersWithResponse(queueName, null, null, finalContext)); + Supplier> operation = () -> this.azureQueueStorage.getMessages() + .clearNoCustomHeadersWithResponse(queueName, null, null, finalContext); return submitThreadPool(operation, LOGGER, timeout); } @@ -904,8 +899,8 @@ public Response sendMessageWithResponse(BinaryData message, D QueueMessage queueMessage = new QueueMessage().setMessageText(finalMessage); Supplier> operation - = wrapCallWithExceptionMapping(() -> this.azureQueueStorage.getMessages().enqueueWithResponse(queueName, - queueMessage, visibilityTimeoutInSeconds, timeToLiveInSeconds, null, null, finalContext)); + = () -> this.azureQueueStorage.getMessages().enqueueWithResponse(queueName, queueMessage, + visibilityTimeoutInSeconds, timeToLiveInSeconds, null, null, finalContext); ResponseBase response = submitThreadPool(operation, LOGGER, timeout); @@ -1025,8 +1020,8 @@ PagedIterable receiveMessagesWithOptionalTimeout(Integer maxMe Context finalContext = context == null ? Context.NONE : context; Integer visibilityTimeoutInSeconds = (visibilityTimeout == null) ? null : (int) visibilityTimeout.getSeconds(); Supplier> operation - = wrapCallWithExceptionMapping(() -> this.azureQueueStorage.getMessages() - .dequeueWithResponse(queueName, maxMessages, visibilityTimeoutInSeconds, null, null, finalContext)); + = () -> this.azureQueueStorage.getMessages().dequeueWithResponse(queueName, maxMessages, + visibilityTimeoutInSeconds, null, null, finalContext); ResponseBase response = submitThreadPool(operation, LOGGER, timeout); @@ -1152,8 +1147,8 @@ public PagedIterable peekMessages(Integer maxMessages, Durati PagedIterable peekMessagesWithOptionalTimeout(Integer maxMessages, Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; Supplier> operation - = wrapCallWithExceptionMapping(() -> this.azureQueueStorage.getMessages() - .peekWithResponse(queueName, maxMessages, null, null, finalContext)); + = () -> this.azureQueueStorage.getMessages().peekWithResponse(queueName, maxMessages, null, null, + finalContext); ResponseBase response = submitThreadPool(operation, LOGGER, timeout); @@ -1289,9 +1284,9 @@ public Response updateMessageWithResponse(String messageId, } Context finalContext = context == null ? Context.NONE : context; Duration finalVisibilityTimeout = visibilityTimeout == null ? Duration.ZERO : visibilityTimeout; - Supplier> operation = wrapCallWithExceptionMapping( - () -> this.azureQueueStorage.getMessageIds().updateWithResponse(queueName, messageId, popReceipt, - (int) finalVisibilityTimeout.getSeconds(), null, null, message, finalContext)); + Supplier> operation = () -> this.azureQueueStorage.getMessageIds() + .updateWithResponse(queueName, messageId, popReceipt, (int) finalVisibilityTimeout.getSeconds(), null, null, + message, finalContext); ResponseBase response = submitThreadPool(operation, LOGGER, timeout); @@ -1361,8 +1356,8 @@ public void deleteMessage(String messageId, String popReceipt) { public Response deleteMessageWithResponse(String messageId, String popReceipt, Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation = wrapCallWithExceptionMapping(() -> this.azureQueueStorage.getMessageIds() - .deleteNoCustomHeadersWithResponse(queueName, messageId, popReceipt, null, null, finalContext)); + Supplier> operation = () -> this.azureQueueStorage.getMessageIds() + .deleteNoCustomHeadersWithResponse(queueName, messageId, popReceipt, null, null, finalContext); return submitThreadPool(operation, LOGGER, timeout); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java index 8cb2e020ff82..a02afa61e12e 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java @@ -19,7 +19,6 @@ import com.azure.storage.common.implementation.StorageImplUtils; import com.azure.storage.common.sas.AccountSasSignatureValues; import com.azure.storage.queue.implementation.AzureQueueStorageImpl; -import com.azure.storage.queue.implementation.util.ModelHelper; import com.azure.storage.queue.models.QueueCorsRule; import com.azure.storage.queue.models.QueueItem; import com.azure.storage.queue.models.QueueMessageDecodingError; @@ -344,10 +343,8 @@ PagedFlux listQueuesWithOptionalTimeout(String marker, QueuesSegmentO BiFunction>> retriever = (nextMarker, pageSize) -> StorageImplUtils.applyOptionalTimeout(this.client.getServices() - .listQueuesSegmentSinglePageAsync(prefix, nextMarker, - pageSize == null ? maxResultsPerPage : pageSize, include, - null, null, context), timeout) - .onErrorMap(ModelHelper::mapToQueueStorageException); + .listQueuesSegmentSinglePageAsync(prefix, nextMarker, pageSize == null ? maxResultsPerPage : pageSize, + include, null, null, context), timeout); return new PagedFlux<>(pageSize -> retriever.apply(marker, pageSize), retriever); } @@ -418,7 +415,6 @@ public Mono> getPropertiesWithResponse() { Mono> getPropertiesWithResponse(Context context) { context = context == null ? Context.NONE : context; return client.getServices().getPropertiesWithResponseAsync(null, null, context) - .onErrorMap(ModelHelper::mapToQueueStorageException) .map(response -> new SimpleResponse<>(response, response.getValue())); } @@ -542,8 +538,7 @@ public Mono> setPropertiesWithResponse(QueueServiceProperties pro Mono> setPropertiesWithResponse(QueueServiceProperties properties, Context context) { context = context == null ? Context.NONE : context; - return client.getServices().setPropertiesNoCustomHeadersWithResponseAsync(properties, null, null, context) - .onErrorMap(ModelHelper::mapToQueueStorageException); + return client.getServices().setPropertiesNoCustomHeadersWithResponseAsync(properties, null, null, context); } /** @@ -608,7 +603,6 @@ public Mono> getStatisticsWithResponse() { Mono> getStatisticsWithResponse(Context context) { context = context == null ? Context.NONE : context; return client.getServices().getStatisticsWithResponseAsync(null, null, context) - .onErrorMap(ModelHelper::mapToQueueStorageException) .map(response -> new SimpleResponse<>(response, response.getValue())); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java index 2cb239443b5c..9c559e20bd48 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java @@ -24,9 +24,10 @@ import com.azure.storage.queue.models.QueueMessageDecodingError; import com.azure.storage.queue.models.QueueServiceProperties; import com.azure.storage.queue.models.QueueServiceStatistics; -import com.azure.storage.queue.models.QueuesSegmentOptions; import com.azure.storage.queue.models.QueueStorageException; +import com.azure.storage.queue.models.QueuesSegmentOptions; import reactor.core.publisher.Mono; + import java.time.Duration; import java.util.ArrayList; import java.util.List; @@ -38,7 +39,6 @@ import java.util.function.Supplier; import static com.azure.storage.common.implementation.StorageImplUtils.submitThreadPool; -import static com.azure.storage.queue.implementation.util.ModelHelper.wrapCallWithExceptionMapping; /** * This class provides a client that contains all the operations for interacting with a queue account in Azure Storage. @@ -325,9 +325,9 @@ public PagedIterable listQueues(QueuesSegmentOptions options, Duratio } } BiFunction> retriever = (nextMarker, pageSize) -> { - Supplier> operation = wrapCallWithExceptionMapping(() -> - this.azureQueueStorage.getServices().listQueuesSegmentSinglePage(prefix, nextMarker, - pageSize == null ? maxResultsPerPage : pageSize, include, null, null, finalContext)); + Supplier> operation = () -> this.azureQueueStorage.getServices() + .listQueuesSegmentSinglePage(prefix, nextMarker, pageSize == null ? maxResultsPerPage : pageSize, + include, null, null, finalContext); return submitThreadPool(operation, LOGGER, timeout); @@ -393,8 +393,8 @@ public QueueServiceProperties getProperties() { @ServiceMethod(returns = ReturnType.SINGLE) public Response getPropertiesWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation = wrapCallWithExceptionMapping( - () -> this.azureQueueStorage.getServices().getPropertiesWithResponse(null, null, finalContext)); + Supplier> operation = () -> this.azureQueueStorage.getServices() + .getPropertiesWithResponse(null, null, finalContext); return submitThreadPool(operation, LOGGER, timeout); } @@ -527,8 +527,8 @@ public void setProperties(QueueServiceProperties properties) { public Response setPropertiesWithResponse(QueueServiceProperties properties, Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; - Supplier> operation = wrapCallWithExceptionMapping(() -> this.azureQueueStorage.getServices() - .setPropertiesNoCustomHeadersWithResponse(properties, null, null, finalContext)); + Supplier> operation = () -> this.azureQueueStorage.getServices() + .setPropertiesNoCustomHeadersWithResponse(properties, null, null, finalContext); return submitThreadPool(operation, LOGGER, timeout); } @@ -587,8 +587,7 @@ public QueueServiceStatistics getStatistics() { public Response getStatisticsWithResponse(Duration timeout, Context context) { Context finalContext = context == null ? Context.NONE : context; Supplier> operation - = wrapCallWithExceptionMapping(() -> this.azureQueueStorage.getServices() - .getStatisticsWithResponse(null, null, finalContext)); + = () -> this.azureQueueStorage.getServices().getStatisticsWithResponse(null, null, finalContext); return submitThreadPool(operation, LOGGER, timeout); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java index 0ec2e43734f2..05bc00466a87 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.queue.implementation; import com.azure.core.annotation.BodyParam; @@ -27,11 +26,13 @@ import com.azure.storage.queue.implementation.models.QueueMessage; import com.azure.storage.queue.implementation.models.QueueStorageExceptionInternal; import reactor.core.publisher.Mono; +import com.azure.storage.queue.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in MessageIds. */ public final class MessageIdsImpl { + /** * The proxy service used to perform REST calls. */ @@ -44,7 +45,7 @@ public final class MessageIdsImpl { /** * Initializes an instance of MessageIdsImpl. - * + * * @param client the instance of the service client containing this operation class. */ MessageIdsImpl(AzureQueueStorageImpl client) { @@ -60,6 +61,7 @@ public final class MessageIdsImpl { @Host("{url}") @ServiceInterface(name = "AzureQueueStorageMes") public interface MessageIdsService { + @Put("/{queueName}/messages/{messageid}") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) @@ -145,7 +147,7 @@ Response deleteNoCustomHeadersSync(@HostParam("url") String url, @PathPara * operation updates the visibility timeout of a message. You can also use this operation to update the contents of * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the * encoded message can be up to 64KB in size. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -169,8 +171,10 @@ Response deleteNoCustomHeadersSync(@HostParam("url") String url, @PathPara public Mono> updateWithResponseAsync(String queueName, String messageid, String popReceipt, int visibilitytimeout, Integer timeout, String requestId, QueueMessage queueMessage) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.update(this.client.getUrl(), queueName, messageid, popReceipt, - visibilitytimeout, timeout, this.client.getVersion(), requestId, queueMessage, accept, context)); + return FluxUtil + .withContext(context -> service.update(this.client.getUrl(), queueName, messageid, popReceipt, + visibilitytimeout, timeout, this.client.getVersion(), requestId, queueMessage, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** @@ -178,7 +182,7 @@ public Mono> updateWithResponseAsync * operation updates the visibility timeout of a message. You can also use this operation to update the contents of * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the * encoded message can be up to 64KB in size. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -204,8 +208,10 @@ public Mono> updateWithResponseAsync String popReceipt, int visibilitytimeout, Integer timeout, String requestId, QueueMessage queueMessage, Context context) { final String accept = "application/xml"; - return service.update(this.client.getUrl(), queueName, messageid, popReceipt, visibilitytimeout, timeout, - this.client.getVersion(), requestId, queueMessage, accept, context); + return service + .update(this.client.getUrl(), queueName, messageid, popReceipt, visibilitytimeout, timeout, + this.client.getVersion(), requestId, queueMessage, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** @@ -213,7 +219,7 @@ public Mono> updateWithResponseAsync * operation updates the visibility timeout of a message. You can also use this operation to update the contents of * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the * encoded message can be up to 64KB in size. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -237,7 +243,8 @@ public Mono> updateWithResponseAsync public Mono updateAsync(String queueName, String messageid, String popReceipt, int visibilitytimeout, Integer timeout, String requestId, QueueMessage queueMessage) { return updateWithResponseAsync(queueName, messageid, popReceipt, visibilitytimeout, timeout, requestId, - queueMessage).flatMap(ignored -> Mono.empty()); + queueMessage).onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -245,7 +252,7 @@ public Mono updateAsync(String queueName, String messageid, String popRece * operation updates the visibility timeout of a message. You can also use this operation to update the contents of * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the * encoded message can be up to 64KB in size. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -270,7 +277,9 @@ public Mono updateAsync(String queueName, String messageid, String popRece public Mono updateAsync(String queueName, String messageid, String popReceipt, int visibilitytimeout, Integer timeout, String requestId, QueueMessage queueMessage, Context context) { return updateWithResponseAsync(queueName, messageid, popReceipt, visibilitytimeout, timeout, requestId, - queueMessage, context).flatMap(ignored -> Mono.empty()); + queueMessage, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -278,7 +287,7 @@ public Mono updateAsync(String queueName, String messageid, String popRece * operation updates the visibility timeout of a message. You can also use this operation to update the contents of * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the * encoded message can be up to 64KB in size. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -302,9 +311,11 @@ public Mono updateAsync(String queueName, String messageid, String popRece public Mono> updateNoCustomHeadersWithResponseAsync(String queueName, String messageid, String popReceipt, int visibilitytimeout, Integer timeout, String requestId, QueueMessage queueMessage) { final String accept = "application/xml"; - return FluxUtil.withContext( - context -> service.updateNoCustomHeaders(this.client.getUrl(), queueName, messageid, popReceipt, - visibilitytimeout, timeout, this.client.getVersion(), requestId, queueMessage, accept, context)); + return FluxUtil + .withContext( + context -> service.updateNoCustomHeaders(this.client.getUrl(), queueName, messageid, popReceipt, + visibilitytimeout, timeout, this.client.getVersion(), requestId, queueMessage, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** @@ -312,7 +323,7 @@ public Mono> updateNoCustomHeadersWithResponseAsync(String queueN * operation updates the visibility timeout of a message. You can also use this operation to update the contents of * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the * encoded message can be up to 64KB in size. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -338,8 +349,10 @@ public Mono> updateNoCustomHeadersWithResponseAsync(String queueN String popReceipt, int visibilitytimeout, Integer timeout, String requestId, QueueMessage queueMessage, Context context) { final String accept = "application/xml"; - return service.updateNoCustomHeaders(this.client.getUrl(), queueName, messageid, popReceipt, visibilitytimeout, - timeout, this.client.getVersion(), requestId, queueMessage, accept, context); + return service + .updateNoCustomHeaders(this.client.getUrl(), queueName, messageid, popReceipt, visibilitytimeout, timeout, + this.client.getVersion(), requestId, queueMessage, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** @@ -347,7 +360,7 @@ public Mono> updateNoCustomHeadersWithResponseAsync(String queueN * operation updates the visibility timeout of a message. You can also use this operation to update the contents of * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the * encoded message can be up to 64KB in size. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -373,8 +386,12 @@ public ResponseBase updateWithResponse(String que String popReceipt, int visibilitytimeout, Integer timeout, String requestId, QueueMessage queueMessage, Context context) { final String accept = "application/xml"; - return service.updateSync(this.client.getUrl(), queueName, messageid, popReceipt, visibilitytimeout, timeout, - this.client.getVersion(), requestId, queueMessage, accept, context); + try { + return service.updateSync(this.client.getUrl(), queueName, messageid, popReceipt, visibilitytimeout, + timeout, this.client.getVersion(), requestId, queueMessage, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** @@ -382,7 +399,7 @@ public ResponseBase updateWithResponse(String que * operation updates the visibility timeout of a message. You can also use this operation to update the contents of * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the * encoded message can be up to 64KB in size. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -413,7 +430,7 @@ public void update(String queueName, String messageid, String popReceipt, int vi * operation updates the visibility timeout of a message. You can also use this operation to update the contents of * a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the * encoded message can be up to 64KB in size. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -438,13 +455,17 @@ public void update(String queueName, String messageid, String popReceipt, int vi public Response updateNoCustomHeadersWithResponse(String queueName, String messageid, String popReceipt, int visibilitytimeout, Integer timeout, String requestId, QueueMessage queueMessage, Context context) { final String accept = "application/xml"; - return service.updateNoCustomHeadersSync(this.client.getUrl(), queueName, messageid, popReceipt, - visibilitytimeout, timeout, this.client.getVersion(), requestId, queueMessage, accept, context); + try { + return service.updateNoCustomHeadersSync(this.client.getUrl(), queueName, messageid, popReceipt, + visibilitytimeout, timeout, this.client.getVersion(), requestId, queueMessage, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * The Delete operation deletes the specified message. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -463,13 +484,15 @@ public Response updateNoCustomHeadersWithResponse(String queueName, String public Mono> deleteWithResponseAsync(String queueName, String messageid, String popReceipt, Integer timeout, String requestId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.delete(this.client.getUrl(), queueName, messageid, popReceipt, - timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.delete(this.client.getUrl(), queueName, messageid, popReceipt, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Delete operation deletes the specified message. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -489,13 +512,15 @@ public Mono> deleteWithResponseAsync public Mono> deleteWithResponseAsync(String queueName, String messageid, String popReceipt, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.delete(this.client.getUrl(), queueName, messageid, popReceipt, timeout, this.client.getVersion(), - requestId, accept, context); + return service + .delete(this.client.getUrl(), queueName, messageid, popReceipt, timeout, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Delete operation deletes the specified message. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -514,12 +539,13 @@ public Mono> deleteWithResponseAsync public Mono deleteAsync(String queueName, String messageid, String popReceipt, Integer timeout, String requestId) { return deleteWithResponseAsync(queueName, messageid, popReceipt, timeout, requestId) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Delete operation deletes the specified message. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -539,12 +565,13 @@ public Mono deleteAsync(String queueName, String messageid, String popRece public Mono deleteAsync(String queueName, String messageid, String popReceipt, Integer timeout, String requestId, Context context) { return deleteWithResponseAsync(queueName, messageid, popReceipt, timeout, requestId, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(ignored -> Mono.empty()); } /** * The Delete operation deletes the specified message. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -563,13 +590,15 @@ public Mono deleteAsync(String queueName, String messageid, String popRece public Mono> deleteNoCustomHeadersWithResponseAsync(String queueName, String messageid, String popReceipt, Integer timeout, String requestId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), queueName, messageid, - popReceipt, timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), queueName, messageid, + popReceipt, timeout, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Delete operation deletes the specified message. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -589,13 +618,15 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String queueN public Mono> deleteNoCustomHeadersWithResponseAsync(String queueName, String messageid, String popReceipt, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.deleteNoCustomHeaders(this.client.getUrl(), queueName, messageid, popReceipt, timeout, - this.client.getVersion(), requestId, accept, context); + return service + .deleteNoCustomHeaders(this.client.getUrl(), queueName, messageid, popReceipt, timeout, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Delete operation deletes the specified message. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -615,13 +646,17 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String queueN public ResponseBase deleteWithResponse(String queueName, String messageid, String popReceipt, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.deleteSync(this.client.getUrl(), queueName, messageid, popReceipt, timeout, - this.client.getVersion(), requestId, accept, context); + try { + return service.deleteSync(this.client.getUrl(), queueName, messageid, popReceipt, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * The Delete operation deletes the specified message. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -642,7 +677,7 @@ public void delete(String queueName, String messageid, String popReceipt, Intege /** * The Delete operation deletes the specified message. - * + * * @param queueName The queue name. * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get @@ -662,7 +697,11 @@ public void delete(String queueName, String messageid, String popReceipt, Intege public Response deleteNoCustomHeadersWithResponse(String queueName, String messageid, String popReceipt, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.deleteNoCustomHeadersSync(this.client.getUrl(), queueName, messageid, popReceipt, timeout, - this.client.getVersion(), requestId, accept, context); + try { + return service.deleteNoCustomHeadersSync(this.client.getUrl(), queueName, messageid, popReceipt, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java index 2324fe016023..5cc9dcc60141 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.queue.implementation; import com.azure.core.annotation.BodyParam; @@ -33,11 +32,13 @@ import com.azure.storage.queue.implementation.models.QueueStorageExceptionInternal; import com.azure.storage.queue.implementation.models.SendMessageResultWrapper; import reactor.core.publisher.Mono; +import com.azure.storage.queue.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in Messages. */ public final class MessagesImpl { + /** * The proxy service used to perform REST calls. */ @@ -50,7 +51,7 @@ public final class MessagesImpl { /** * Initializes an instance of MessagesImpl. - * + * * @param client the instance of the service client containing this operation class. */ MessagesImpl(AzureQueueStorageImpl client) { @@ -65,6 +66,7 @@ public final class MessagesImpl { @Host("{url}") @ServiceInterface(name = "AzureQueueStorageMes") public interface MessagesService { + @Get("/{queueName}/messages") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) @@ -213,7 +215,7 @@ Response peekNoCustomHeadersSync(@HostParam("u /** * The Dequeue operation retrieves one or more messages from the front of the queue. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -237,13 +239,15 @@ Response peekNoCustomHeadersSync(@HostParam("u public Mono> dequeueWithResponseAsync( String queueName, Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.dequeue(this.client.getUrl(), queueName, numberOfMessages, - visibilitytimeout, timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.dequeue(this.client.getUrl(), queueName, numberOfMessages, + visibilitytimeout, timeout, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Dequeue operation retrieves one or more messages from the front of the queue. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -269,13 +273,15 @@ public Mono dequeueAsync(String queueName, Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId) { return dequeueWithResponseAsync(queueName, numberOfMessages, visibilitytimeout, timeout, requestId) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * The Dequeue operation retrieves one or more messages from the front of the queue. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -327,12 +334,13 @@ public Mono dequeueAsync(String queueName, Inte public Mono dequeueAsync(String queueName, Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId, Context context) { return dequeueWithResponseAsync(queueName, numberOfMessages, visibilitytimeout, timeout, requestId, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * The Dequeue operation retrieves one or more messages from the front of the queue. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -356,13 +364,15 @@ public Mono dequeueAsync(String queueName, Inte public Mono> dequeueNoCustomHeadersWithResponseAsync(String queueName, Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.dequeueNoCustomHeaders(this.client.getUrl(), queueName, - numberOfMessages, visibilitytimeout, timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.dequeueNoCustomHeaders(this.client.getUrl(), queueName, numberOfMessages, + visibilitytimeout, timeout, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Dequeue operation retrieves one or more messages from the front of the queue. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -387,13 +397,15 @@ public Mono> dequeueNoCustomHeadersWit public Mono> dequeueNoCustomHeadersWithResponseAsync(String queueName, Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.dequeueNoCustomHeaders(this.client.getUrl(), queueName, numberOfMessages, visibilitytimeout, - timeout, this.client.getVersion(), requestId, accept, context); + return service + .dequeueNoCustomHeaders(this.client.getUrl(), queueName, numberOfMessages, visibilitytimeout, timeout, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Dequeue operation retrieves one or more messages from the front of the queue. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -417,13 +429,17 @@ public Mono> dequeueNoCustomHeadersWit public ResponseBase dequeueWithResponse(String queueName, Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.dequeueSync(this.client.getUrl(), queueName, numberOfMessages, visibilitytimeout, timeout, - this.client.getVersion(), requestId, accept, context); + try { + return service.dequeueSync(this.client.getUrl(), queueName, numberOfMessages, visibilitytimeout, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * The Dequeue operation retrieves one or more messages from the front of the queue. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -445,13 +461,17 @@ public ResponseBase deq @ServiceMethod(returns = ReturnType.SINGLE) public QueueMessageItemInternalWrapper dequeue(String queueName, Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId) { - return dequeueWithResponse(queueName, numberOfMessages, visibilitytimeout, timeout, requestId, Context.NONE) - .getValue(); + try { + return dequeueWithResponse(queueName, numberOfMessages, visibilitytimeout, timeout, requestId, Context.NONE) + .getValue(); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * The Dequeue operation retrieves one or more messages from the front of the queue. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -475,13 +495,17 @@ public QueueMessageItemInternalWrapper dequeue(String queueName, Integer numberO public Response dequeueNoCustomHeadersWithResponse(String queueName, Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.dequeueNoCustomHeadersSync(this.client.getUrl(), queueName, numberOfMessages, visibilitytimeout, - timeout, this.client.getVersion(), requestId, accept, context); + try { + return service.dequeueNoCustomHeadersSync(this.client.getUrl(), queueName, numberOfMessages, + visibilitytimeout, timeout, this.client.getVersion(), requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * The Clear operation deletes all messages from the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -497,13 +521,15 @@ public Response dequeueNoCustomHeadersWithRespo public Mono> clearWithResponseAsync(String queueName, Integer timeout, String requestId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.clear(this.client.getUrl(), queueName, timeout, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.clear(this.client.getUrl(), queueName, timeout, this.client.getVersion(), + requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Clear operation deletes all messages from the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -520,13 +546,14 @@ public Mono> clearWithResponseAsync(Str public Mono> clearWithResponseAsync(String queueName, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.clear(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, accept, - context); + return service + .clear(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Clear operation deletes all messages from the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -540,12 +567,14 @@ public Mono> clearWithResponseAsync(Str */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono clearAsync(String queueName, Integer timeout, String requestId) { - return clearWithResponseAsync(queueName, timeout, requestId).flatMap(ignored -> Mono.empty()); + return clearWithResponseAsync(queueName, timeout, requestId) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Clear operation deletes all messages from the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -560,12 +589,14 @@ public Mono clearAsync(String queueName, Integer timeout, String requestId */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono clearAsync(String queueName, Integer timeout, String requestId, Context context) { - return clearWithResponseAsync(queueName, timeout, requestId, context).flatMap(ignored -> Mono.empty()); + return clearWithResponseAsync(queueName, timeout, requestId, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) + .flatMap(ignored -> Mono.empty()); } /** * The Clear operation deletes all messages from the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -581,13 +612,15 @@ public Mono clearAsync(String queueName, Integer timeout, String requestId public Mono> clearNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, String requestId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.clearNoCustomHeaders(this.client.getUrl(), queueName, timeout, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.clearNoCustomHeaders(this.client.getUrl(), queueName, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Clear operation deletes all messages from the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -604,13 +637,15 @@ public Mono> clearNoCustomHeadersWithResponseAsync(String queueNa public Mono> clearNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.clearNoCustomHeaders(this.client.getUrl(), queueName, timeout, this.client.getVersion(), - requestId, accept, context); + return service + .clearNoCustomHeaders(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Clear operation deletes all messages from the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -627,13 +662,17 @@ public Mono> clearNoCustomHeadersWithResponseAsync(String queueNa public ResponseBase clearWithResponse(String queueName, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.clearSync(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, accept, - context); + try { + return service.clearSync(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, + accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * The Clear operation deletes all messages from the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -651,7 +690,7 @@ public void clear(String queueName, Integer timeout, String requestId) { /** * The Clear operation deletes all messages from the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -668,8 +707,12 @@ public void clear(String queueName, Integer timeout, String requestId) { public Response clearNoCustomHeadersWithResponse(String queueName, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.clearNoCustomHeadersSync(this.client.getUrl(), queueName, timeout, this.client.getVersion(), - requestId, accept, context); + try { + return service.clearNoCustomHeadersSync(this.client.getUrl(), queueName, timeout, this.client.getVersion(), + requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** @@ -677,7 +720,7 @@ public Response clearNoCustomHeadersWithResponse(String queueName, Integer * specified to make the message invisible until the visibility timeout expires. A message must be in a format that * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * + * * @param queueName The queue name. * @param queueMessage A Message object which can be stored in a Queue. * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or @@ -705,8 +748,10 @@ public Mono> enqu String queueName, QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, String requestId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.enqueue(this.client.getUrl(), queueName, visibilitytimeout, - messageTimeToLive, timeout, this.client.getVersion(), requestId, queueMessage, accept, context)); + return FluxUtil + .withContext(context -> service.enqueue(this.client.getUrl(), queueName, visibilitytimeout, + messageTimeToLive, timeout, this.client.getVersion(), requestId, queueMessage, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** @@ -714,7 +759,7 @@ public Mono> enqu * specified to make the message invisible until the visibility timeout expires. A message must be in a format that * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * + * * @param queueName The queue name. * @param queueMessage A Message object which can be stored in a Queue. * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or @@ -743,8 +788,10 @@ public Mono> enqu String queueName, QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.enqueue(this.client.getUrl(), queueName, visibilitytimeout, messageTimeToLive, timeout, - this.client.getVersion(), requestId, queueMessage, accept, context); + return service + .enqueue(this.client.getUrl(), queueName, visibilitytimeout, messageTimeToLive, timeout, + this.client.getVersion(), requestId, queueMessage, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** @@ -752,7 +799,7 @@ public Mono> enqu * specified to make the message invisible until the visibility timeout expires. A message must be in a format that * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * + * * @param queueName The queue name. * @param queueMessage A Message object which can be stored in a Queue. * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or @@ -778,7 +825,8 @@ public Mono> enqu public Mono enqueueAsync(String queueName, QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, String requestId) { return enqueueWithResponseAsync(queueName, queueMessage, visibilitytimeout, messageTimeToLive, timeout, - requestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + requestId).onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -786,7 +834,7 @@ public Mono enqueueAsync(String queueName, QueueMessag * specified to make the message invisible until the visibility timeout expires. A message must be in a format that * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * + * * @param queueName The queue name. * @param queueMessage A Message object which can be stored in a Queue. * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or @@ -813,7 +861,8 @@ public Mono enqueueAsync(String queueName, QueueMessag public Mono enqueueAsync(String queueName, QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, String requestId, Context context) { return enqueueWithResponseAsync(queueName, queueMessage, visibilitytimeout, messageTimeToLive, timeout, - requestId, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + requestId, context).onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -821,7 +870,7 @@ public Mono enqueueAsync(String queueName, QueueMessag * specified to make the message invisible until the visibility timeout expires. A message must be in a format that * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * + * * @param queueName The queue name. * @param queueMessage A Message object which can be stored in a Queue. * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or @@ -851,7 +900,8 @@ public Mono> enqueueNoCustomHeadersWithRespon final String accept = "application/xml"; return FluxUtil .withContext(context -> service.enqueueNoCustomHeaders(this.client.getUrl(), queueName, visibilitytimeout, - messageTimeToLive, timeout, this.client.getVersion(), requestId, queueMessage, accept, context)); + messageTimeToLive, timeout, this.client.getVersion(), requestId, queueMessage, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** @@ -859,7 +909,7 @@ public Mono> enqueueNoCustomHeadersWithRespon * specified to make the message invisible until the visibility timeout expires. A message must be in a format that * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * + * * @param queueName The queue name. * @param queueMessage A Message object which can be stored in a Queue. * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or @@ -888,8 +938,10 @@ public Mono> enqueueNoCustomHeadersWithRespon QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.enqueueNoCustomHeaders(this.client.getUrl(), queueName, visibilitytimeout, messageTimeToLive, - timeout, this.client.getVersion(), requestId, queueMessage, accept, context); + return service + .enqueueNoCustomHeaders(this.client.getUrl(), queueName, visibilitytimeout, messageTimeToLive, timeout, + this.client.getVersion(), requestId, queueMessage, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** @@ -897,7 +949,7 @@ public Mono> enqueueNoCustomHeadersWithRespon * specified to make the message invisible until the visibility timeout expires. A message must be in a format that * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * + * * @param queueName The queue name. * @param queueMessage A Message object which can be stored in a Queue. * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or @@ -925,8 +977,12 @@ public ResponseBase enqueueWit QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.enqueueSync(this.client.getUrl(), queueName, visibilitytimeout, messageTimeToLive, timeout, - this.client.getVersion(), requestId, queueMessage, accept, context); + try { + return service.enqueueSync(this.client.getUrl(), queueName, visibilitytimeout, messageTimeToLive, timeout, + this.client.getVersion(), requestId, queueMessage, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** @@ -934,7 +990,7 @@ public ResponseBase enqueueWit * specified to make the message invisible until the visibility timeout expires. A message must be in a format that * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * + * * @param queueName The queue name. * @param queueMessage A Message object which can be stored in a Queue. * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or @@ -959,8 +1015,12 @@ public ResponseBase enqueueWit @ServiceMethod(returns = ReturnType.SINGLE) public SendMessageResultWrapper enqueue(String queueName, QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, String requestId) { - return enqueueWithResponse(queueName, queueMessage, visibilitytimeout, messageTimeToLive, timeout, requestId, - Context.NONE).getValue(); + try { + return enqueueWithResponse(queueName, queueMessage, visibilitytimeout, messageTimeToLive, timeout, + requestId, Context.NONE).getValue(); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** @@ -968,7 +1028,7 @@ public SendMessageResultWrapper enqueue(String queueName, QueueMessage queueMess * specified to make the message invisible until the visibility timeout expires. A message must be in a format that * can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for * versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * + * * @param queueName The queue name. * @param queueMessage A Message object which can be stored in a Queue. * @param visibilitytimeout Optional. If specified, the request must be made using an x-ms-version of 2011-08-18 or @@ -996,14 +1056,18 @@ public Response enqueueNoCustomHeadersWithResponse(Str QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.enqueueNoCustomHeadersSync(this.client.getUrl(), queueName, visibilitytimeout, messageTimeToLive, - timeout, this.client.getVersion(), requestId, queueMessage, accept, context); + try { + return service.enqueueNoCustomHeadersSync(this.client.getUrl(), queueName, visibilitytimeout, + messageTimeToLive, timeout, this.client.getVersion(), requestId, queueMessage, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility * of the message. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -1024,14 +1088,16 @@ public Response enqueueNoCustomHeadersWithResponse(Str peekWithResponseAsync(String queueName, Integer numberOfMessages, Integer timeout, String requestId) { final String peekonly = "true"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.peek(this.client.getUrl(), queueName, peekonly, numberOfMessages, - timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.peek(this.client.getUrl(), queueName, peekonly, numberOfMessages, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility * of the message. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -1053,14 +1119,16 @@ public Mono> String queueName, Integer numberOfMessages, Integer timeout, String requestId, Context context) { final String peekonly = "true"; final String accept = "application/xml"; - return service.peek(this.client.getUrl(), queueName, peekonly, numberOfMessages, timeout, - this.client.getVersion(), requestId, accept, context); + return service + .peek(this.client.getUrl(), queueName, peekonly, numberOfMessages, timeout, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility * of the message. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -1079,13 +1147,14 @@ public Mono> public Mono peekAsync(String queueName, Integer numberOfMessages, Integer timeout, String requestId) { return peekWithResponseAsync(queueName, numberOfMessages, timeout, requestId) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility * of the message. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -1105,13 +1174,14 @@ public Mono peekAsync(String queueName, Intege public Mono peekAsync(String queueName, Integer numberOfMessages, Integer timeout, String requestId, Context context) { return peekWithResponseAsync(queueName, numberOfMessages, timeout, requestId, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility * of the message. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -1132,14 +1202,16 @@ public Mono> peekNoCustomHeadersWithR Integer numberOfMessages, Integer timeout, String requestId) { final String peekonly = "true"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.peekNoCustomHeaders(this.client.getUrl(), queueName, peekonly, - numberOfMessages, timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.peekNoCustomHeaders(this.client.getUrl(), queueName, peekonly, + numberOfMessages, timeout, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility * of the message. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -1161,14 +1233,16 @@ public Mono> peekNoCustomHeadersWithR Integer numberOfMessages, Integer timeout, String requestId, Context context) { final String peekonly = "true"; final String accept = "application/xml"; - return service.peekNoCustomHeaders(this.client.getUrl(), queueName, peekonly, numberOfMessages, timeout, - this.client.getVersion(), requestId, accept, context); + return service + .peekNoCustomHeaders(this.client.getUrl(), queueName, peekonly, numberOfMessages, timeout, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility * of the message. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -1189,14 +1263,18 @@ public ResponseBase peekW Integer numberOfMessages, Integer timeout, String requestId, Context context) { final String peekonly = "true"; final String accept = "application/xml"; - return service.peekSync(this.client.getUrl(), queueName, peekonly, numberOfMessages, timeout, - this.client.getVersion(), requestId, accept, context); + try { + return service.peekSync(this.client.getUrl(), queueName, peekonly, numberOfMessages, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility * of the message. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -1214,13 +1292,17 @@ public ResponseBase peekW @ServiceMethod(returns = ReturnType.SINGLE) public PeekedMessageItemInternalWrapper peek(String queueName, Integer numberOfMessages, Integer timeout, String requestId) { - return peekWithResponse(queueName, numberOfMessages, timeout, requestId, Context.NONE).getValue(); + try { + return peekWithResponse(queueName, numberOfMessages, timeout, requestId, Context.NONE).getValue(); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility * of the message. - * + * * @param queueName The queue name. * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from * the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single @@ -1241,7 +1323,11 @@ public Response peekNoCustomHeadersWithRespons Integer numberOfMessages, Integer timeout, String requestId, Context context) { final String peekonly = "true"; final String accept = "application/xml"; - return service.peekNoCustomHeadersSync(this.client.getUrl(), queueName, peekonly, numberOfMessages, timeout, - this.client.getVersion(), requestId, accept, context); + try { + return service.peekNoCustomHeadersSync(this.client.getUrl(), queueName, peekonly, numberOfMessages, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java index 17a56887e03a..27677de59515 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.queue.implementation; import com.azure.core.annotation.BodyParam; @@ -35,11 +34,13 @@ import java.util.List; import java.util.Map; import reactor.core.publisher.Mono; +import com.azure.storage.queue.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in Queues. */ public final class QueuesImpl { + /** * The proxy service used to perform REST calls. */ @@ -52,7 +53,7 @@ public final class QueuesImpl { /** * Initializes an instance of QueuesImpl. - * + * * @param client the instance of the service client containing this operation class. */ QueuesImpl(AzureQueueStorageImpl client) { @@ -67,6 +68,7 @@ public final class QueuesImpl { @Host("{url}") @ServiceInterface(name = "AzureQueueStorageQue") public interface QueuesService { + @Put("/{queueName}") @ExpectedResponses({ 201, 204 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) @@ -285,7 +287,7 @@ Response setAccessPolicyNoCustomHeadersSync(@HostParam("url") String url, /** * creates a new queue under the given account. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -305,13 +307,15 @@ Response setAccessPolicyNoCustomHeadersSync(@HostParam("url") String url, public Mono> createWithResponseAsync(String queueName, Integer timeout, Map metadata, String requestId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.create(this.client.getUrl(), queueName, timeout, metadata, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.create(this.client.getUrl(), queueName, timeout, metadata, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * creates a new queue under the given account. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -332,13 +336,15 @@ public Mono> createWithResponseAsync(Str public Mono> createWithResponseAsync(String queueName, Integer timeout, Map metadata, String requestId, Context context) { final String accept = "application/xml"; - return service.create(this.client.getUrl(), queueName, timeout, metadata, this.client.getVersion(), requestId, - accept, context); + return service + .create(this.client.getUrl(), queueName, timeout, metadata, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * creates a new queue under the given account. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -356,12 +362,14 @@ public Mono> createWithResponseAsync(Str */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createAsync(String queueName, Integer timeout, Map metadata, String requestId) { - return createWithResponseAsync(queueName, timeout, metadata, requestId).flatMap(ignored -> Mono.empty()); + return createWithResponseAsync(queueName, timeout, metadata, requestId) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) + .flatMap(ignored -> Mono.empty()); } /** * creates a new queue under the given account. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -382,12 +390,13 @@ public Mono createAsync(String queueName, Integer timeout, Map createAsync(String queueName, Integer timeout, Map metadata, String requestId, Context context) { return createWithResponseAsync(queueName, timeout, metadata, requestId, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(ignored -> Mono.empty()); } /** * creates a new queue under the given account. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -407,13 +416,15 @@ public Mono createAsync(String queueName, Integer timeout, Map> createNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, Map metadata, String requestId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.createNoCustomHeaders(this.client.getUrl(), queueName, timeout, - metadata, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.createNoCustomHeaders(this.client.getUrl(), queueName, timeout, metadata, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * creates a new queue under the given account. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -434,13 +445,15 @@ public Mono> createNoCustomHeadersWithResponseAsync(String queueN public Mono> createNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, Map metadata, String requestId, Context context) { final String accept = "application/xml"; - return service.createNoCustomHeaders(this.client.getUrl(), queueName, timeout, metadata, - this.client.getVersion(), requestId, accept, context); + return service + .createNoCustomHeaders(this.client.getUrl(), queueName, timeout, metadata, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * creates a new queue under the given account. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -461,13 +474,17 @@ public Mono> createNoCustomHeadersWithResponseAsync(String queueN public ResponseBase createWithResponse(String queueName, Integer timeout, Map metadata, String requestId, Context context) { final String accept = "application/xml"; - return service.createSync(this.client.getUrl(), queueName, timeout, metadata, this.client.getVersion(), - requestId, accept, context); + try { + return service.createSync(this.client.getUrl(), queueName, timeout, metadata, this.client.getVersion(), + requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * creates a new queue under the given account. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -489,7 +506,7 @@ public void create(String queueName, Integer timeout, Map metada /** * creates a new queue under the given account. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -510,13 +527,17 @@ public void create(String queueName, Integer timeout, Map metada public Response createNoCustomHeadersWithResponse(String queueName, Integer timeout, Map metadata, String requestId, Context context) { final String accept = "application/xml"; - return service.createNoCustomHeadersSync(this.client.getUrl(), queueName, timeout, metadata, - this.client.getVersion(), requestId, accept, context); + try { + return service.createNoCustomHeadersSync(this.client.getUrl(), queueName, timeout, metadata, + this.client.getVersion(), requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * operation permanently deletes the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -532,13 +553,15 @@ public Response createNoCustomHeadersWithResponse(String queueName, Intege public Mono> deleteWithResponseAsync(String queueName, Integer timeout, String requestId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.delete(this.client.getUrl(), queueName, timeout, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.delete(this.client.getUrl(), queueName, timeout, this.client.getVersion(), + requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * operation permanently deletes the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -555,13 +578,14 @@ public Mono> deleteWithResponseAsync(Str public Mono> deleteWithResponseAsync(String queueName, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.delete(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, accept, - context); + return service + .delete(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * operation permanently deletes the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -575,12 +599,14 @@ public Mono> deleteWithResponseAsync(Str */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteAsync(String queueName, Integer timeout, String requestId) { - return deleteWithResponseAsync(queueName, timeout, requestId).flatMap(ignored -> Mono.empty()); + return deleteWithResponseAsync(queueName, timeout, requestId) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) + .flatMap(ignored -> Mono.empty()); } /** * operation permanently deletes the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -595,12 +621,14 @@ public Mono deleteAsync(String queueName, Integer timeout, String requestI */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteAsync(String queueName, Integer timeout, String requestId, Context context) { - return deleteWithResponseAsync(queueName, timeout, requestId, context).flatMap(ignored -> Mono.empty()); + return deleteWithResponseAsync(queueName, timeout, requestId, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) + .flatMap(ignored -> Mono.empty()); } /** * operation permanently deletes the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -616,13 +644,15 @@ public Mono deleteAsync(String queueName, Integer timeout, String requestI public Mono> deleteNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, String requestId) { final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), queueName, timeout, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.deleteNoCustomHeaders(this.client.getUrl(), queueName, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * operation permanently deletes the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -639,13 +669,15 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String queueN public Mono> deleteNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.deleteNoCustomHeaders(this.client.getUrl(), queueName, timeout, this.client.getVersion(), - requestId, accept, context); + return service + .deleteNoCustomHeaders(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, + accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * operation permanently deletes the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -662,13 +694,17 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String queueN public ResponseBase deleteWithResponse(String queueName, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.deleteSync(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, accept, - context); + try { + return service.deleteSync(this.client.getUrl(), queueName, timeout, this.client.getVersion(), requestId, + accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * operation permanently deletes the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -686,7 +722,7 @@ public void delete(String queueName, Integer timeout, String requestId) { /** * operation permanently deletes the specified queue. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -703,14 +739,18 @@ public void delete(String queueName, Integer timeout, String requestId) { public Response deleteNoCustomHeadersWithResponse(String queueName, Integer timeout, String requestId, Context context) { final String accept = "application/xml"; - return service.deleteNoCustomHeadersSync(this.client.getUrl(), queueName, timeout, this.client.getVersion(), - requestId, accept, context); + try { + return service.deleteNoCustomHeadersSync(this.client.getUrl(), queueName, timeout, this.client.getVersion(), + requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the * queue as name-values pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -727,14 +767,16 @@ public Mono> getPropertiesWithRes Integer timeout, String requestId) { final String comp = "metadata"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getProperties(this.client.getUrl(), queueName, comp, timeout, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getProperties(this.client.getUrl(), queueName, comp, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the * queue as name-values pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -752,14 +794,16 @@ public Mono> getPropertiesWithRes Integer timeout, String requestId, Context context) { final String comp = "metadata"; final String accept = "application/xml"; - return service.getProperties(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), - requestId, accept, context); + return service + .getProperties(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the * queue as name-values pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -773,13 +817,15 @@ public Mono> getPropertiesWithRes */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesAsync(String queueName, Integer timeout, String requestId) { - return getPropertiesWithResponseAsync(queueName, timeout, requestId).flatMap(ignored -> Mono.empty()); + return getPropertiesWithResponseAsync(queueName, timeout, requestId) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the * queue as name-values pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -794,13 +840,15 @@ public Mono getPropertiesAsync(String queueName, Integer timeout, String r */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesAsync(String queueName, Integer timeout, String requestId, Context context) { - return getPropertiesWithResponseAsync(queueName, timeout, requestId, context).flatMap(ignored -> Mono.empty()); + return getPropertiesWithResponseAsync(queueName, timeout, requestId, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) + .flatMap(ignored -> Mono.empty()); } /** * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the * queue as name-values pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -817,14 +865,16 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String String requestId) { final String comp = "metadata"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), queueName, - comp, timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), queueName, comp, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the * queue as name-values pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -842,14 +892,16 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String String requestId, Context context) { final String comp = "metadata"; final String accept = "application/xml"; - return service.getPropertiesNoCustomHeaders(this.client.getUrl(), queueName, comp, timeout, - this.client.getVersion(), requestId, accept, context); + return service + .getPropertiesNoCustomHeaders(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the * queue as name-values pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -867,14 +919,18 @@ public ResponseBase getPropertiesWithResponse( String requestId, Context context) { final String comp = "metadata"; final String accept = "application/xml"; - return service.getPropertiesSync(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), - requestId, accept, context); + try { + return service.getPropertiesSync(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), + requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the * queue as name-values pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -893,7 +949,7 @@ public void getProperties(String queueName, Integer timeout, String requestId) { /** * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the * queue as name-values pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -911,13 +967,17 @@ public Response getPropertiesNoCustomHeadersWithResponse(String queueName, Context context) { final String comp = "metadata"; final String accept = "application/xml"; - return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), queueName, comp, timeout, - this.client.getVersion(), requestId, accept, context); + try { + return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), queueName, comp, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -938,13 +998,15 @@ public Mono> setMetadataWithRespons Integer timeout, Map metadata, String requestId) { final String comp = "metadata"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setMetadata(this.client.getUrl(), queueName, comp, timeout, - metadata, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.setMetadata(this.client.getUrl(), queueName, comp, timeout, metadata, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -966,13 +1028,15 @@ public Mono> setMetadataWithRespons Integer timeout, Map metadata, String requestId, Context context) { final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadata(this.client.getUrl(), queueName, comp, timeout, metadata, this.client.getVersion(), - requestId, accept, context); + return service + .setMetadata(this.client.getUrl(), queueName, comp, timeout, metadata, this.client.getVersion(), requestId, + accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -991,12 +1055,14 @@ public Mono> setMetadataWithRespons @ServiceMethod(returns = ReturnType.SINGLE) public Mono setMetadataAsync(String queueName, Integer timeout, Map metadata, String requestId) { - return setMetadataWithResponseAsync(queueName, timeout, metadata, requestId).flatMap(ignored -> Mono.empty()); + return setMetadataWithResponseAsync(queueName, timeout, metadata, requestId) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) + .flatMap(ignored -> Mono.empty()); } /** * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1017,12 +1083,13 @@ public Mono setMetadataAsync(String queueName, Integer timeout, Map setMetadataAsync(String queueName, Integer timeout, Map metadata, String requestId, Context context) { return setMetadataWithResponseAsync(queueName, timeout, metadata, requestId, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(ignored -> Mono.empty()); } /** * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1043,13 +1110,15 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String q Map metadata, String requestId) { final String comp = "metadata"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setMetadataNoCustomHeaders(this.client.getUrl(), queueName, comp, - timeout, metadata, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.setMetadataNoCustomHeaders(this.client.getUrl(), queueName, comp, timeout, + metadata, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1071,13 +1140,15 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String q Map metadata, String requestId, Context context) { final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadataNoCustomHeaders(this.client.getUrl(), queueName, comp, timeout, metadata, - this.client.getVersion(), requestId, accept, context); + return service + .setMetadataNoCustomHeaders(this.client.getUrl(), queueName, comp, timeout, metadata, + this.client.getVersion(), requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1099,13 +1170,17 @@ public ResponseBase setMetadataWithResponse(Stri Map metadata, String requestId, Context context) { final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadataSync(this.client.getUrl(), queueName, comp, timeout, metadata, - this.client.getVersion(), requestId, accept, context); + try { + return service.setMetadataSync(this.client.getUrl(), queueName, comp, timeout, metadata, + this.client.getVersion(), requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1127,7 +1202,7 @@ public void setMetadata(String queueName, Integer timeout, Map m /** * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1149,14 +1224,18 @@ public Response setMetadataNoCustomHeadersWithResponse(String queueName, I Map metadata, String requestId, Context context) { final String comp = "metadata"; final String accept = "application/xml"; - return service.setMetadataNoCustomHeadersSync(this.client.getUrl(), queueName, comp, timeout, metadata, - this.client.getVersion(), requestId, accept, context); + try { + return service.setMetadataNoCustomHeadersSync(this.client.getUrl(), queueName, comp, timeout, metadata, + this.client.getVersion(), requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * returns details about any stored access policies specified on the queue that may be used with Shared Access * Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1174,14 +1253,16 @@ public Response setMetadataNoCustomHeadersWithResponse(String queueName, I getAccessPolicyWithResponseAsync(String queueName, Integer timeout, String requestId) { final String comp = "acl"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getAccessPolicy(this.client.getUrl(), queueName, comp, timeout, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getAccessPolicy(this.client.getUrl(), queueName, comp, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * returns details about any stored access policies specified on the queue that may be used with Shared Access * Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1200,14 +1281,16 @@ public Response setMetadataNoCustomHeadersWithResponse(String queueName, I getAccessPolicyWithResponseAsync(String queueName, Integer timeout, String requestId, Context context) { final String comp = "acl"; final String accept = "application/xml"; - return service.getAccessPolicy(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), - requestId, accept, context); + return service + .getAccessPolicy(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), requestId, + accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * returns details about any stored access policies specified on the queue that may be used with Shared Access * Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1223,13 +1306,14 @@ public Response setMetadataNoCustomHeadersWithResponse(String queueName, I public Mono getAccessPolicyAsync(String queueName, Integer timeout, String requestId) { return getAccessPolicyWithResponseAsync(queueName, timeout, requestId) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * returns details about any stored access policies specified on the queue that may be used with Shared Access * Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1246,13 +1330,14 @@ public Mono getAccessPolicyAsync(String queueName, public Mono getAccessPolicyAsync(String queueName, Integer timeout, String requestId, Context context) { return getAccessPolicyWithResponseAsync(queueName, timeout, requestId, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * returns details about any stored access policies specified on the queue that may be used with Shared Access * Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1269,14 +1354,16 @@ public Mono getAccessPolicyAsync(String queueName, getAccessPolicyNoCustomHeadersWithResponseAsync(String queueName, Integer timeout, String requestId) { final String comp = "acl"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getAccessPolicyNoCustomHeaders(this.client.getUrl(), queueName, - comp, timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getAccessPolicyNoCustomHeaders(this.client.getUrl(), queueName, comp, + timeout, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * returns details about any stored access policies specified on the queue that may be used with Shared Access * Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1294,14 +1381,16 @@ public Mono> getAccessPolicyNoCustomHeade String queueName, Integer timeout, String requestId, Context context) { final String comp = "acl"; final String accept = "application/xml"; - return service.getAccessPolicyNoCustomHeaders(this.client.getUrl(), queueName, comp, timeout, - this.client.getVersion(), requestId, accept, context); + return service + .getAccessPolicyNoCustomHeaders(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * returns details about any stored access policies specified on the queue that may be used with Shared Access * Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1319,14 +1408,18 @@ public Mono> getAccessPolicyNoCustomHeade getAccessPolicyWithResponse(String queueName, Integer timeout, String requestId, Context context) { final String comp = "acl"; final String accept = "application/xml"; - return service.getAccessPolicySync(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), - requestId, accept, context); + try { + return service.getAccessPolicySync(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), + requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * returns details about any stored access policies specified on the queue that may be used with Shared Access * Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1340,13 +1433,17 @@ public Mono> getAccessPolicyNoCustomHeade */ @ServiceMethod(returns = ReturnType.SINGLE) public QueueSignedIdentifierWrapper getAccessPolicy(String queueName, Integer timeout, String requestId) { - return getAccessPolicyWithResponse(queueName, timeout, requestId, Context.NONE).getValue(); + try { + return getAccessPolicyWithResponse(queueName, timeout, requestId, Context.NONE).getValue(); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * returns details about any stored access policies specified on the queue that may be used with Shared Access * Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1364,13 +1461,17 @@ public Response getAccessPolicyNoCustomHeadersWith Integer timeout, String requestId, Context context) { final String comp = "acl"; final String accept = "application/xml"; - return service.getAccessPolicyNoCustomHeadersSync(this.client.getUrl(), queueName, comp, timeout, - this.client.getVersion(), requestId, accept, context); + try { + return service.getAccessPolicyNoCustomHeadersSync(this.client.getUrl(), queueName, comp, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * sets stored access policies for the queue that may be used with Shared Access Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1389,13 +1490,15 @@ public Mono> setAccessPolicyWit final String comp = "acl"; final String accept = "application/xml"; QueueSignedIdentifierWrapper queueAclConverted = new QueueSignedIdentifierWrapper(queueAcl); - return FluxUtil.withContext(context -> service.setAccessPolicy(this.client.getUrl(), queueName, comp, timeout, - this.client.getVersion(), requestId, queueAclConverted, accept, context)); + return FluxUtil + .withContext(context -> service.setAccessPolicy(this.client.getUrl(), queueName, comp, timeout, + this.client.getVersion(), requestId, queueAclConverted, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * sets stored access policies for the queue that may be used with Shared Access Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1415,13 +1518,15 @@ public Mono> setAccessPolicyWit final String comp = "acl"; final String accept = "application/xml"; QueueSignedIdentifierWrapper queueAclConverted = new QueueSignedIdentifierWrapper(queueAcl); - return service.setAccessPolicy(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), - requestId, queueAclConverted, accept, context); + return service + .setAccessPolicy(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), requestId, + queueAclConverted, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * sets stored access policies for the queue that may be used with Shared Access Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1438,12 +1543,13 @@ public Mono> setAccessPolicyWit public Mono setAccessPolicyAsync(String queueName, Integer timeout, String requestId, List queueAcl) { return setAccessPolicyWithResponseAsync(queueName, timeout, requestId, queueAcl) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(ignored -> Mono.empty()); } /** * sets stored access policies for the queue that may be used with Shared Access Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1461,12 +1567,13 @@ public Mono setAccessPolicyAsync(String queueName, Integer timeout, String public Mono setAccessPolicyAsync(String queueName, Integer timeout, String requestId, List queueAcl, Context context) { return setAccessPolicyWithResponseAsync(queueName, timeout, requestId, queueAcl, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(ignored -> Mono.empty()); } /** * sets stored access policies for the queue that may be used with Shared Access Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1485,13 +1592,15 @@ public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync(Stri final String comp = "acl"; final String accept = "application/xml"; QueueSignedIdentifierWrapper queueAclConverted = new QueueSignedIdentifierWrapper(queueAcl); - return FluxUtil.withContext(context -> service.setAccessPolicyNoCustomHeaders(this.client.getUrl(), queueName, - comp, timeout, this.client.getVersion(), requestId, queueAclConverted, accept, context)); + return FluxUtil + .withContext(context -> service.setAccessPolicyNoCustomHeaders(this.client.getUrl(), queueName, comp, + timeout, this.client.getVersion(), requestId, queueAclConverted, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * sets stored access policies for the queue that may be used with Shared Access Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1511,13 +1620,15 @@ public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync(Stri final String comp = "acl"; final String accept = "application/xml"; QueueSignedIdentifierWrapper queueAclConverted = new QueueSignedIdentifierWrapper(queueAcl); - return service.setAccessPolicyNoCustomHeaders(this.client.getUrl(), queueName, comp, timeout, - this.client.getVersion(), requestId, queueAclConverted, accept, context); + return service + .setAccessPolicyNoCustomHeaders(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), + requestId, queueAclConverted, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * sets stored access policies for the queue that may be used with Shared Access Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1537,13 +1648,17 @@ public ResponseBase setAccessPolicyWithRespo final String comp = "acl"; final String accept = "application/xml"; QueueSignedIdentifierWrapper queueAclConverted = new QueueSignedIdentifierWrapper(queueAcl); - return service.setAccessPolicySync(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), - requestId, queueAclConverted, accept, context); + try { + return service.setAccessPolicySync(this.client.getUrl(), queueName, comp, timeout, this.client.getVersion(), + requestId, queueAclConverted, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * sets stored access policies for the queue that may be used with Shared Access Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1563,7 +1678,7 @@ public void setAccessPolicy(String queueName, Integer timeout, String requestId, /** * sets stored access policies for the queue that may be used with Shared Access Signatures. - * + * * @param queueName The queue name. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -1583,7 +1698,11 @@ public Response setAccessPolicyNoCustomHeadersWithResponse(String queueNam final String comp = "acl"; final String accept = "application/xml"; QueueSignedIdentifierWrapper queueAclConverted = new QueueSignedIdentifierWrapper(queueAcl); - return service.setAccessPolicyNoCustomHeadersSync(this.client.getUrl(), queueName, comp, timeout, - this.client.getVersion(), requestId, queueAclConverted, accept, context); + try { + return service.setAccessPolicyNoCustomHeadersSync(this.client.getUrl(), queueName, comp, timeout, + this.client.getVersion(), requestId, queueAclConverted, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java index 322dbb50f2c3..2ac55bda093f 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. - package com.azure.storage.queue.implementation; import com.azure.core.annotation.BodyParam; @@ -40,11 +39,13 @@ import java.util.Objects; import java.util.stream.Collectors; import reactor.core.publisher.Mono; +import com.azure.storage.queue.implementation.util.ModelHelper; /** * An instance of this class provides access to all the operations defined in Services. */ public final class ServicesImpl { + /** * The proxy service used to perform REST calls. */ @@ -57,7 +58,7 @@ public final class ServicesImpl { /** * Initializes an instance of ServicesImpl. - * + * * @param client the instance of the service client containing this operation class. */ ServicesImpl(AzureQueueStorageImpl client) { @@ -72,6 +73,7 @@ public final class ServicesImpl { @Host("{url}") @ServiceInterface(name = "AzureQueueStorageSer") public interface ServicesService { + @Put("/") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(QueueStorageExceptionInternal.class) @@ -260,7 +262,7 @@ Response listQueuesSegmentNextNoCustomHeadersSync( /** * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param queueServiceProperties The StorageService properties. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -278,14 +280,16 @@ public Mono> setPropertiesWithR final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setProperties(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, queueServiceProperties, accept, context)); + return FluxUtil + .withContext(context -> service.setProperties(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, queueServiceProperties, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param queueServiceProperties The StorageService properties. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -304,14 +308,16 @@ public Mono> setPropertiesWithR final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.setProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, - queueServiceProperties, accept, context); + return service + .setProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, + queueServiceProperties, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param queueServiceProperties The StorageService properties. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -327,13 +333,14 @@ public Mono> setPropertiesWithR public Mono setPropertiesAsync(QueueServiceProperties queueServiceProperties, Integer timeout, String requestId) { return setPropertiesWithResponseAsync(queueServiceProperties, timeout, requestId) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(ignored -> Mono.empty()); } /** * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param queueServiceProperties The StorageService properties. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -350,13 +357,14 @@ public Mono setPropertiesAsync(QueueServiceProperties queueServiceProperti public Mono setPropertiesAsync(QueueServiceProperties queueServiceProperties, Integer timeout, String requestId, Context context) { return setPropertiesWithResponseAsync(queueServiceProperties, timeout, requestId, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(ignored -> Mono.empty()); } /** * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param queueServiceProperties The StorageService properties. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -374,14 +382,16 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.setPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, - timeout, this.client.getVersion(), requestId, queueServiceProperties, accept, context)); + return FluxUtil + .withContext(context -> service.setPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, queueServiceProperties, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param queueServiceProperties The StorageService properties. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -400,14 +410,16 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.setPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, queueServiceProperties, accept, context); + return service + .setPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + requestId, queueServiceProperties, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param queueServiceProperties The StorageService properties. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -426,14 +438,18 @@ public ResponseBase setPropertiesWithRespons final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.setPropertiesSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - requestId, queueServiceProperties, accept, context); + try { + return service.setPropertiesSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + requestId, queueServiceProperties, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param queueServiceProperties The StorageService properties. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -452,7 +468,7 @@ public void setProperties(QueueServiceProperties queueServiceProperties, Integer /** * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and * CORS (Cross-Origin Resource Sharing) rules. - * + * * @param queueServiceProperties The StorageService properties. * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting @@ -471,14 +487,18 @@ public Response setPropertiesNoCustomHeadersWithResponse(QueueServicePrope final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.setPropertiesNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, queueServiceProperties, accept, context); + try { + return service.setPropertiesNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, queueServiceProperties, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -496,14 +516,16 @@ public Response setPropertiesNoCustomHeadersWithResponse(QueueServicePrope final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getProperties(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getProperties(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -522,14 +544,16 @@ public Response setPropertiesNoCustomHeadersWithResponse(QueueServicePrope final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.getProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, - accept, context); + return service + .getProperties(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -543,13 +567,15 @@ public Response setPropertiesNoCustomHeadersWithResponse(QueueServicePrope */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesAsync(Integer timeout, String requestId) { - return getPropertiesWithResponseAsync(timeout, requestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + return getPropertiesWithResponseAsync(timeout, requestId) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -565,13 +591,14 @@ public Mono getPropertiesAsync(Integer timeout, String r @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesAsync(Integer timeout, String requestId, Context context) { return getPropertiesWithResponseAsync(timeout, requestId, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -589,14 +616,16 @@ public Mono> getPropertiesNoCustomHeadersWithRe final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, - timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -615,14 +644,16 @@ public Mono> getPropertiesNoCustomHeadersWithRe final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.getPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, accept, context); + return service + .getPropertiesNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -641,14 +672,18 @@ public ResponseBase getPro final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.getPropertiesSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - requestId, accept, context); + try { + return service.getPropertiesSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -662,13 +697,17 @@ public ResponseBase getPro */ @ServiceMethod(returns = ReturnType.SINGLE) public QueueServiceProperties getProperties(Integer timeout, String requestId) { - return getPropertiesWithResponse(timeout, requestId, Context.NONE).getValue(); + try { + return getPropertiesWithResponse(timeout, requestId, Context.NONE).getValue(); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -687,14 +726,18 @@ public Response getPropertiesNoCustomHeadersWithResponse final String restype = "service"; final String comp = "properties"; final String accept = "application/xml"; - return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, accept, context); + try { + return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -711,14 +754,16 @@ public Response getPropertiesNoCustomHeadersWithResponse final String restype = "service"; final String comp = "stats"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getStatistics(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getStatistics(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -736,14 +781,16 @@ public Response getPropertiesNoCustomHeadersWithResponse final String restype = "service"; final String comp = "stats"; final String accept = "application/xml"; - return service.getStatistics(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, - accept, context); + return service + .getStatistics(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, accept, + context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -756,13 +803,15 @@ public Response getPropertiesNoCustomHeadersWithResponse */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getStatisticsAsync(Integer timeout, String requestId) { - return getStatisticsWithResponseAsync(timeout, requestId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + return getStatisticsWithResponseAsync(timeout, requestId) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -777,13 +826,14 @@ public Mono getStatisticsAsync(Integer timeout, String r @ServiceMethod(returns = ReturnType.SINGLE) public Mono getStatisticsAsync(Integer timeout, String requestId, Context context) { return getStatisticsWithResponseAsync(timeout, requestId, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -800,14 +850,16 @@ public Mono> getStatisticsNoCustomHeadersWithRe final String restype = "service"; final String comp = "stats"; final String accept = "application/xml"; - return FluxUtil.withContext(context -> service.getStatisticsNoCustomHeaders(this.client.getUrl(), restype, comp, - timeout, this.client.getVersion(), requestId, accept, context)); + return FluxUtil + .withContext(context -> service.getStatisticsNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -825,14 +877,16 @@ public Mono> getStatisticsNoCustomHeadersWithRe final String restype = "service"; final String comp = "stats"; final String accept = "application/xml"; - return service.getStatisticsNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, accept, context); + return service + .getStatisticsNoCustomHeaders(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException); } /** * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -850,14 +904,18 @@ public ResponseBase getSta final String restype = "service"; final String comp = "stats"; final String accept = "application/xml"; - return service.getStatisticsSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), - requestId, accept, context); + try { + return service.getStatisticsSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -870,13 +928,17 @@ public ResponseBase getSta */ @ServiceMethod(returns = ReturnType.SINGLE) public QueueServiceStatistics getStatistics(Integer timeout, String requestId) { - return getStatisticsWithResponse(timeout, requestId, Context.NONE).getValue(); + try { + return getStatisticsWithResponse(timeout, requestId, Context.NONE).getValue(); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location * endpoint when read-access geo-redundant replication is enabled for the storage account. - * + * * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting * Timeouts for Queue Service Operations.</a>. @@ -894,13 +956,17 @@ public Response getStatisticsNoCustomHeadersWithResponse final String restype = "service"; final String comp = "stats"; final String accept = "application/xml"; - return service.getStatisticsNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, accept, context); + try { + return service.getStatisticsNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -938,13 +1004,14 @@ public Mono> listQueuesSegmentSinglePageAsync(String pr return FluxUtil .withContext(context -> service.listQueuesSegment(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); } /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -983,13 +1050,14 @@ public Mono> listQueuesSegmentSinglePageAsync(String pr return service .listQueuesSegment(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); } /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1024,7 +1092,7 @@ public PagedFlux listQueuesSegmentAsync(String prefix, String marker, /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1060,7 +1128,7 @@ public PagedFlux listQueuesSegmentAsync(String prefix, String marker, /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1098,13 +1166,14 @@ public Mono> listQueuesSegmentNoCustomHeadersSinglePage return FluxUtil .withContext(context -> service.listQueuesSegmentNoCustomHeaders(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getQueueItems(), res.getValue().getNextMarker(), null)); } /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1143,13 +1212,14 @@ public Mono> listQueuesSegmentNoCustomHeadersSinglePage return service .listQueuesSegmentNoCustomHeaders(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getQueueItems(), res.getValue().getNextMarker(), null)); } /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1183,7 +1253,7 @@ public PagedFlux listQueuesSegmentNoCustomHeadersAsync(String prefix, /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1219,7 +1289,7 @@ public PagedFlux listQueuesSegmentNoCustomHeadersAsync(String prefix, /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1256,13 +1326,17 @@ public PagedResponse listQueuesSegmentSinglePage(String prefix, Strin ResponseBase res = service.listQueuesSegmentSync(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1300,13 +1374,17 @@ public PagedResponse listQueuesSegmentSinglePage(String prefix, Strin ResponseBase res = service.listQueuesSegmentSync(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1341,7 +1419,7 @@ public PagedIterable listQueuesSegment(String prefix, String marker, /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1377,7 +1455,7 @@ public PagedIterable listQueuesSegment(String prefix, String marker, /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1414,13 +1492,17 @@ public PagedResponse listQueuesSegmentNoCustomHeadersSinglePage(Strin Response res = service.listQueuesSegmentNoCustomHeadersSync(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), null); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getQueueItems(), res.getValue().getNextMarker(), null); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1458,13 +1540,17 @@ public PagedResponse listQueuesSegmentNoCustomHeadersSinglePage(Strin Response res = service.listQueuesSegmentNoCustomHeadersSync(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), null); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getQueueItems(), res.getValue().getNextMarker(), null); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1498,7 +1584,7 @@ public PagedIterable listQueuesSegmentNoCustomHeaders(String prefix, /** * The List Queues Segment operation returns a list of the queues under the specified account. - * + * * @param prefix Filters the results to return only queues whose name begins with the specified prefix. * @param marker A string value that identifies the portion of the list of queues to be returned with the next * listing operation. The operation returns the NextMarker value within the response body if the listing operation @@ -1533,9 +1619,9 @@ public PagedIterable listQueuesSegmentNoCustomHeaders(String prefix, /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1551,15 +1637,16 @@ public Mono> listQueuesSegmentNextSinglePageAsync(Strin return FluxUtil .withContext(context -> service.listQueuesSegmentNext(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1576,15 +1663,16 @@ public Mono> listQueuesSegmentNextSinglePageAsync(Strin final String accept = "application/xml"; return service .listQueuesSegmentNext(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders())); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1601,15 +1689,16 @@ public Mono> listQueuesSegmentNextNoCustomHeadersSingle return FluxUtil .withContext(context -> service.listQueuesSegmentNextNoCustomHeaders(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, accept, context)) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getQueueItems(), res.getValue().getNextMarker(), null)); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1627,15 +1716,16 @@ public Mono> listQueuesSegmentNextNoCustomHeadersSingle return service .listQueuesSegmentNextNoCustomHeaders(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, accept, context) + .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().getQueueItems(), res.getValue().getNextMarker(), null)); } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1650,15 +1740,19 @@ public PagedResponse listQueuesSegmentNextSinglePage(String nextLink, ResponseBase res = service.listQueuesSegmentNextSync(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1675,15 +1769,19 @@ public PagedResponse listQueuesSegmentNextSinglePage(String nextLink, ResponseBase res = service.listQueuesSegmentNextSync(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getQueueItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1697,15 +1795,19 @@ public PagedResponse listQueuesSegmentNextNoCustomHeadersSinglePage(S final String accept = "application/xml"; Response res = service.listQueuesSegmentNextNoCustomHeadersSync(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), null); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getQueueItems(), res.getValue().getNextMarker(), null); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } /** * Get the next page of items. - * + * * @param nextLink The URL to get the next list of items - * + * * The nextLink parameter. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the * analytics logs when storage analytics logging is enabled. @@ -1721,7 +1823,11 @@ public PagedResponse listQueuesSegmentNextNoCustomHeadersSinglePage(S final String accept = "application/xml"; Response res = service.listQueuesSegmentNextNoCustomHeadersSync(nextLink, this.client.getUrl(), this.client.getVersion(), requestId, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getQueueItems(), res.getValue().getNextMarker(), null); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getQueueItems(), res.getValue().getNextMarker(), null); + } catch (QueueStorageExceptionInternal internalException) { + throw ModelHelper.mapToQueueStorageException(internalException); + } } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/ModelHelper.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/ModelHelper.java index d7c1fc771b79..26cc1d86a0ab 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/ModelHelper.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/ModelHelper.java @@ -17,7 +17,6 @@ import java.util.Base64; import java.util.Objects; -import java.util.function.Supplier; public class ModelHelper { private static final ClientLogger LOGGER = new ClientLogger(ModelHelper.class); @@ -99,23 +98,7 @@ public static QueueProperties transformQueueProperties(QueuesGetPropertiesHeader * @param internal The internal exception. * @return The public exception. */ - public static Throwable mapToQueueStorageException(Throwable internal) { - if (internal instanceof QueueStorageExceptionInternal) { - QueueStorageExceptionInternal internalException = (QueueStorageExceptionInternal) internal; - return new QueueStorageException(internalException.getMessage(), internalException.getResponse(), - internalException.getValue()); - } - - return internal; - } - - public static Supplier wrapCallWithExceptionMapping(Supplier serviceCall) { - return () -> { - try { - return serviceCall.get(); - } catch (QueueStorageExceptionInternal internal) { - throw (QueueStorageException) mapToQueueStorageException(internal); - } - }; + public static QueueStorageException mapToQueueStorageException(QueueStorageExceptionInternal internal) { + return new QueueStorageException(internal.getMessage(), internal.getResponse(), internal.getValue()); } } diff --git a/sdk/storage/azure-storage-queue/swagger/README.md b/sdk/storage/azure-storage-queue/swagger/README.md index 78a7a0cf3966..c62e454adaae 100644 --- a/sdk/storage/azure-storage-queue/swagger/README.md +++ b/sdk/storage/azure-storage-queue/swagger/README.md @@ -30,6 +30,7 @@ default-http-exception-type: com.azure.storage.queue.implementation.models.Queue models-subpackage: implementation.models custom-types: QueueErrorCode,QueueSignedIdentifier,SendMessageResult,QueueMessageItem,PeekedMessageItem,QueueItem,QueueServiceProperties,QueueServiceStatistics,QueueCorsRule,QueueAccessPolicy,QueueAnalyticsLogging,QueueMetrics,QueueRetentionPolicy,GeoReplicationStatus,GeoReplicationStatusType,GeoReplication custom-types-subpackage: models +customization-class: src/main/java/QueueStorageCustomization.java generic-response-type: true use-input-stream-for-binary: true no-custom-headers: true diff --git a/sdk/storage/azure-storage-queue/swagger/pom.xml b/sdk/storage/azure-storage-queue/swagger/pom.xml new file mode 100644 index 000000000000..12c08a6ad2fb --- /dev/null +++ b/sdk/storage/azure-storage-queue/swagger/pom.xml @@ -0,0 +1,17 @@ + + + + + com.azure + azure-code-customization-parent + 1.0.0-beta.1 + ../../../parents/azure-code-customization-parent + + + com.azure + azure-storage-queue-customization + 1.0.0-beta.1 + 4.0.0 + diff --git a/sdk/storage/azure-storage-queue/swagger/src/main/java/QueueStorageCustomization.java b/sdk/storage/azure-storage-queue/swagger/src/main/java/QueueStorageCustomization.java new file mode 100644 index 000000000000..a4a17928bd1a --- /dev/null +++ b/sdk/storage/azure-storage-queue/swagger/src/main/java/QueueStorageCustomization.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import com.azure.autorest.customization.Customization; +import com.azure.autorest.customization.LibraryCustomization; +import com.azure.autorest.customization.PackageCustomization; +import com.github.javaparser.ParseProblemException; +import com.github.javaparser.StaticJavaParser; +import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.MethodDeclaration; +import com.github.javaparser.ast.body.Parameter; +import com.github.javaparser.ast.stmt.BlockStmt; +import com.github.javaparser.ast.stmt.CatchClause; +import com.github.javaparser.ast.stmt.Statement; +import com.github.javaparser.ast.stmt.TryStmt; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import com.github.javaparser.ast.type.Type; +import org.slf4j.Logger; + +import java.util.Arrays; +import java.util.List; + +/** + * Customization class for Blob Storage. + */ +public class QueueStorageCustomization extends Customization { + @Override + public void customize(LibraryCustomization customization, Logger logger) { + updateImplToMapInternalException(customization.getPackage("com.azure.storage.queue.implementation")); + } + + /** + * Customizes the implementation classes that will perform calls to the service. The following logic is used: + *

+ * - Check for the return of the method not equaling to PagedFlux, PagedIterable, PollerFlux, or SyncPoller. Those + * types wrap other APIs and those APIs being update is the correct change. + * - For asynchronous methods, add a call to + * {@code .onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException)} to handle + * mapping QueueStorageExceptionInternal to QueueStorageException. + * - For synchronous methods, wrap the return statement in a try-catch block that catches + * QueueStorageExceptionInternal and rethrows {@code ModelHelper.mapToQueueStorageException(e)}. Or, for void + * methods wrap the last statement. + * + * @param implPackage The implementation package. + */ + private static void updateImplToMapInternalException(PackageCustomization implPackage) { + List implsToUpdate = Arrays.asList("MessageIdsImpl", "MessagesImpl", "QueuesImpl", "ServicesImpl"); + for (String implToUpdate : implsToUpdate) { + implPackage.getClass(implToUpdate).customizeAst(ast -> { + ast.addImport("com.azure.storage.queue.implementation.util.ModelHelper"); + ast.addImport("com.azure.storage.queue.models.QueueStorageException"); + ast.addImport("com.azure.storage.queue.implementation.models.QueueStorageExceptionInternal"); + ast.getClassByName(implToUpdate).ifPresent(clazz -> { + clazz.getFields(); + + clazz.getMethods().forEach(methodDeclaration -> { + Type returnType = methodDeclaration.getType(); + // The way code generation works we only need to update the methods that have a class return type. + // As non-class return types, such as "void", call into the Response methods. + if (!returnType.isClassOrInterfaceType()) { + return; + } + + ClassOrInterfaceType returnTypeClass = returnType.asClassOrInterfaceType(); + String returnTypeName = returnTypeClass.getNameAsString(); + if (returnTypeName.equals("PagedFlux") || returnTypeName.equals("PagedIterable") + || returnTypeName.equals("PollerFlux") || returnTypeName.equals("SyncPoller")) { + return; + } + + if (returnTypeName.equals("Mono") || returnTypeName.equals("Flux")) { + addErrorMappingToAsyncMethod(methodDeclaration); + } else { + addErrorMappingToSyncMethod(methodDeclaration); + } + }); + }); + }); + } + } + + private static void addErrorMappingToAsyncMethod(MethodDeclaration method) { + BlockStmt body = method.getBody().get(); + + // Bit of hack to insert the 'onErrorMap' in the right location. + // Unfortunately, 'onErrorMap' returns which for some calls breaks typing, such as Void -> Object or + // PagedResponse -> PagedResponseBase. So, 'onErrorMap' needs to be inserted after the first method call. + // To do this, we track the first found '(' and the associated closing ')' to insert 'onErrorMap' after the ')'. + // So, 'service.methodCall(parameters).map()' becomes 'service.methodCall(parameters).onErrorMap().map()'. + String originalReturnStatement = body.getStatement(body.getStatements().size() - 1).asReturnStmt() + .getExpression().get().toString(); + int insertionPoint = findAsyncOnErrorMapInsertionPoint(originalReturnStatement); + String newReturnStatement = "return " + originalReturnStatement.substring(0, insertionPoint) + + ".onErrorMap(QueueStorageExceptionInternal.class, ModelHelper::mapToQueueStorageException)" + + originalReturnStatement.substring(insertionPoint) + ";"; + try { + Statement newReturn = StaticJavaParser.parseStatement(newReturnStatement); + body.getStatements().set(body.getStatements().size() - 1, newReturn); + } catch (ParseProblemException ex) { + throw new RuntimeException("Failed to parse: " + newReturnStatement, ex); + } + } + + private static int findAsyncOnErrorMapInsertionPoint(String returnStatement) { + int openParenthesis = 0; + int closeParenthesis = 0; + for (int i = 0; i < returnStatement.length(); i++) { + char c = returnStatement.charAt(i); + if (c == '(') { + openParenthesis++; + } else if (c == ')') { + closeParenthesis++; + if (openParenthesis == closeParenthesis) { + return i + 1; + } + } + } + return -1; + } + + private static void addErrorMappingToSyncMethod(MethodDeclaration method) { + BlockStmt body = method.getBody().get(); + + // Turn the last statement into a BlockStmt that will be used as the try block. + BlockStmt tryBlock = new BlockStmt(new NodeList<>(body.getStatement(body.getStatements().size() - 1))); + BlockStmt catchBlock = new BlockStmt(new NodeList<>(StaticJavaParser.parseStatement( + "throw ModelHelper.mapToQueueStorageException(internalException);"))); + Parameter catchParameter = new Parameter().setType("QueueStorageExceptionInternal") + .setName("internalException"); + CatchClause catchClause = new CatchClause(catchParameter, catchBlock); + TryStmt tryCatchMap = new TryStmt(tryBlock, new NodeList<>(catchClause), null); + + // Replace the last statement with the try-catch block. + body.getStatements().set(body.getStatements().size() - 1, tryCatchMap); + } +}