From 37d8cdca1cb211077b78d7aca97d07adb2e03d83 Mon Sep 17 00:00:00 2001 From: Rabab Ibrahim Date: Tue, 10 Sep 2024 10:55:54 -0700 Subject: [PATCH] Blobs Sync Stack Migration (#40812) --- eng/versioning/version_client.txt | 3 + .../checkstyle-suppressions.xml | 7 + sdk/storage/azure-storage-blob/pom.xml | 4 +- .../azure-storage-blob/spotbugs-exclude.xml | 5 + .../com/azure/storage/blob/BlobClient.java | 74 +- .../azure/storage/blob/BlobClientBuilder.java | 36 +- .../blob/BlobContainerAsyncClient.java | 48 +- .../storage/blob/BlobContainerClient.java | 409 +- .../blob/BlobContainerClientBuilder.java | 33 +- .../storage/blob/BlobServiceAsyncClient.java | 92 +- .../azure/storage/blob/BlobServiceClient.java | 307 +- .../blob/BlobServiceClientBuilder.java | 47 +- .../blob/implementation/AppendBlobsImpl.java | 1197 ++++- .../blob/implementation/BlobsImpl.java | 4636 +++++++++++++++-- .../blob/implementation/BlockBlobsImpl.java | 2922 +++++++++-- .../blob/implementation/ContainersImpl.java | 3031 +++++++++-- .../blob/implementation/PageBlobsImpl.java | 2759 ++++++++-- .../blob/implementation/ServicesImpl.java | 1476 +++++- .../implementation/util/BlobQueryReader.java | 193 + .../blob/implementation/util/ModelHelper.java | 231 + .../specialized/AppendBlobAsyncClient.java | 3 +- .../blob/specialized/AppendBlobClient.java | 138 +- .../blob/specialized/BlobAsyncClientBase.java | 47 +- .../blob/specialized/BlobClientBase.java | 689 ++- .../blob/specialized/BlobLeaseClient.java | 174 +- .../specialized/BlobLeaseClientBuilder.java | 7 +- .../specialized/BlockBlobAsyncClient.java | 7 +- .../blob/specialized/BlockBlobClient.java | 59 +- .../blob/specialized/PageBlobAsyncClient.java | 27 +- .../blob/specialized/PageBlobClient.java | 421 +- .../src/main/java/module-info.java | 1 + .../blob/specialized/BlobBaseApiTests.java | 4 +- .../azure-storage-blob/swagger/README.md | 1 + .../azure-storage-file-datalake/pom.xml | 4 +- .../storage/file/datalake/FileApiTest.java | 5 +- 35 files changed, 16924 insertions(+), 2173 deletions(-) diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index c41f865b3373f..d66acdbb535be 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -490,6 +490,9 @@ unreleased_com.azure:azure-json;1.3.0-beta.1 unreleased_com.azure:azure-core-amqp;2.10.0-beta.1 +unreleased_com.azure:azure-core;1.52.0-beta.1 +unreleased_com.azure:azure-core-http-okhttp;1.13.0-beta.1 + # Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current # version and set the version to the released beta. Released beta dependencies are only valid # for dependency versions. These entries are specifically for when we've released a beta for diff --git a/sdk/storage/azure-storage-blob/checkstyle-suppressions.xml b/sdk/storage/azure-storage-blob/checkstyle-suppressions.xml index f106f985d40b3..d2e954d56ed63 100644 --- a/sdk/storage/azure-storage-blob/checkstyle-suppressions.xml +++ b/sdk/storage/azure-storage-blob/checkstyle-suppressions.xml @@ -35,7 +35,14 @@ + + + + + + + diff --git a/sdk/storage/azure-storage-blob/pom.xml b/sdk/storage/azure-storage-blob/pom.xml index 1e89f040f855a..de8794e58472c 100644 --- a/sdk/storage/azure-storage-blob/pom.xml +++ b/sdk/storage/azure-storage-blob/pom.xml @@ -70,7 +70,7 @@ com.azure azure-core - 1.51.0 + 1.52.0-beta.1 com.azure @@ -182,7 +182,7 @@ com.azure azure-core-http-okhttp - 1.12.2 + 1.13.0-beta.1 test diff --git a/sdk/storage/azure-storage-blob/spotbugs-exclude.xml b/sdk/storage/azure-storage-blob/spotbugs-exclude.xml index 1d9d591bb4dd3..8b12ac100b680 100644 --- a/sdk/storage/azure-storage-blob/spotbugs-exclude.xml +++ b/sdk/storage/azure-storage-blob/spotbugs-exclude.xml @@ -8,6 +8,7 @@ + @@ -185,4 +186,8 @@ + + + + diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java index 360104fb2f524..2951e455c2256 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java @@ -6,13 +6,16 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.HttpPipeline; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; +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.CpkInfo; import com.azure.storage.blob.models.CustomerProvidedKey; import com.azure.storage.blob.options.BlobParallelUploadOptions; import com.azure.storage.blob.models.BlobRequestConditions; @@ -32,6 +35,8 @@ import java.io.InputStream; import java.io.UncheckedIOException; +import java.nio.channels.AsynchronousFileChannel; +import java.nio.file.Path; import java.time.Duration; import java.util.Map; import java.util.Objects; @@ -61,19 +66,26 @@ public class BlobClient extends BlobClientBase { /** * The block size to use if none is specified in parallel operations. */ - public static final int BLOB_DEFAULT_UPLOAD_BLOCK_SIZE = BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; + public static final int BLOB_DEFAULT_UPLOAD_BLOCK_SIZE = 4 * Constants.MB; /** * The number of buffers to use if none is specied on the buffered upload method. */ - public static final int BLOB_DEFAULT_NUMBER_OF_BUFFERS = BlobAsyncClient.BLOB_DEFAULT_NUMBER_OF_BUFFERS; + public static final int BLOB_DEFAULT_NUMBER_OF_BUFFERS = 8; /** * If a blob is known to be greater than 100MB, using a larger block size will trigger some server-side * optimizations. If the block size is not set and the size of the blob is known to be greater than 100MB, this * value will be used. */ - public static final int BLOB_DEFAULT_HTBB_UPLOAD_BLOCK_SIZE = BlobAsyncClient.BLOB_DEFAULT_HTBB_UPLOAD_BLOCK_SIZE; + public static final int BLOB_DEFAULT_HTBB_UPLOAD_BLOCK_SIZE = 8 * Constants.MB; + /** + * The default block size used in {@link FluxUtil#readFile(AsynchronousFileChannel)}. + * This is to make sure we're using same size when using {@link BinaryData#fromFile(Path, int)} + * and {@link BinaryData#fromFile(Path, Long, Long, int)} + * to represent the content. + */ + private static final int DEFAULT_FILE_READ_CHUNK_SIZE = 1024 * 64; private final BlobAsyncClient client; private BlockBlobClient blockBlobClient; @@ -89,6 +101,31 @@ protected BlobClient(BlobAsyncClient client) { this.client = client; } + /** + * Protected constructor for use by {@link BlobClientBuilder}. + * + * @param client the async blob client + * @param pipeline The pipeline used to send and receive service requests. + * @param url The endpoint where to send service requests. + * @param serviceVersion The version of the service to receive requests. + * @param accountName The storage account name. + * @param containerName The container name. + * @param blobName The blob name. + * @param snapshot The snapshot identifier for the blob, pass {@code null} to interact with the blob directly. + * @param customerProvidedKey Customer provided key used during encryption of the blob's data on the server, pass + * {@code null} to allow the service to use its own encryption. + * @param encryptionScope Encryption scope used during encryption of the blob's data on the server, pass + * {@code null} to allow the service to use its own encryption. + * @param versionId The version identifier for the blob, pass {@code null} to interact with the latest blob version. + */ + protected BlobClient(BlobAsyncClient client, HttpPipeline pipeline, String url, BlobServiceVersion serviceVersion, + String accountName, String containerName, String blobName, String snapshot, CpkInfo customerProvidedKey, + EncryptionScope encryptionScope, String versionId) { + super(client, pipeline, url, serviceVersion, accountName, containerName, blobName, snapshot, customerProvidedKey, + encryptionScope, versionId); + this.client = client; + } + /** * Creates a new {@link BlobClient} linked to the {@code snapshot} of this blob resource. * @@ -97,7 +134,11 @@ protected BlobClient(BlobAsyncClient client) { */ @Override public BlobClient getSnapshotClient(String snapshot) { - return new BlobClient(client.getSnapshotClient(snapshot)); + BlobAsyncClient asyncClient = new BlobAsyncClient(getHttpPipeline(), getAccountUrl(), getServiceVersion(), + getAccountName(), getContainerName(), getBlobName(), snapshot, getCustomerProvidedKey(), + encryptionScope, getVersionId()); + return new BlobClient(asyncClient, getHttpPipeline(), getAccountUrl(), getServiceVersion(), getAccountName(), + getContainerName(), getBlobName(), snapshot, getCustomerProvidedKey(), encryptionScope, getVersionId()); } /** @@ -109,7 +150,11 @@ public BlobClient getSnapshotClient(String snapshot) { */ @Override public BlobClient getVersionClient(String versionId) { - return new BlobClient(client.getVersionClient(versionId)); + BlobAsyncClient asyncClient = new BlobAsyncClient(getHttpPipeline(), getAccountUrl(), getServiceVersion(), + getAccountName(), getContainerName(), getBlobName(), getSnapshotId(), getCustomerProvidedKey(), + encryptionScope, versionId); + return new BlobClient(asyncClient, getHttpPipeline(), getAccountUrl(), getServiceVersion(), getAccountName(), + getContainerName(), getBlobName(), getSnapshotId(), getCustomerProvidedKey(), encryptionScope, versionId); } /** @@ -120,7 +165,13 @@ public BlobClient getVersionClient(String versionId) { */ @Override public BlobClient getEncryptionScopeClient(String encryptionScope) { - return new BlobClient(client.getEncryptionScopeAsyncClient(encryptionScope)); + EncryptionScope finalEncryptionScope = null; + if (encryptionScope != null) { + finalEncryptionScope = new EncryptionScope().setEncryptionScope(encryptionScope); + } + return new BlobClient(this.client.getEncryptionScopeAsyncClient(encryptionScope), getHttpPipeline(), + getAccountUrl(), getServiceVersion(), getAccountName(), getContainerName(), getBlobName(), getSnapshotId(), + getCustomerProvidedKey(), finalEncryptionScope, getVersionId()); } /** @@ -132,7 +183,16 @@ public BlobClient getEncryptionScopeClient(String encryptionScope) { */ @Override public BlobClient getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey) { - return new BlobClient(client.getCustomerProvidedKeyAsyncClient(customerProvidedKey)); + CpkInfo finalCustomerProvidedKey = null; + if (customerProvidedKey != null) { + finalCustomerProvidedKey = new CpkInfo() + .setEncryptionKey(customerProvidedKey.getKey()) + .setEncryptionKeySha256(customerProvidedKey.getKeySha256()) + .setEncryptionAlgorithm(customerProvidedKey.getEncryptionAlgorithm()); + } + return new BlobClient(this.client.getCustomerProvidedKeyAsyncClient(customerProvidedKey), getHttpPipeline(), + getAccountUrl(), getServiceVersion(), getAccountName(), getContainerName(), getBlobName(), getSnapshotId(), + finalCustomerProvidedKey, encryptionScope, getVersionId()); } /** diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java index 9f68b931df66c..c980ef37a0715 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java @@ -127,7 +127,29 @@ public BlobClientBuilder() { * and {@link #retryOptions(RequestRetryOptions)} have been set. */ public BlobClient buildClient() { - return new BlobClient(buildAsyncClient()); + Objects.requireNonNull(blobName, "'blobName' cannot be null."); + Objects.requireNonNull(endpoint, "'endpoint' cannot be null"); + + BuilderHelper.httpsValidation(customerProvidedKey, "customer provided key", endpoint, LOGGER); + + if (Objects.nonNull(customerProvidedKey) && Objects.nonNull(encryptionScope)) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Customer provided key and encryption " + + "scope cannot both be set")); + } + + /* + Implicit and explicit root container access are functionally equivalent, but explicit references are easier + to read and debug. + */ + String blobContainerName = CoreUtils.isNullOrEmpty(containerName) ? BlobContainerClient.ROOT_CONTAINER_NAME + : containerName; + + BlobServiceVersion serviceVersion = version != null ? version : BlobServiceVersion.getLatest(); + + BlobAsyncClient asyncClient = buildAsyncClient(); + + return new BlobClient(asyncClient, asyncClient.getHttpPipeline(), endpoint, serviceVersion, accountName, + blobContainerName, blobName, snapshot, customerProvidedKey, encryptionScope, versionId); } /** @@ -171,15 +193,19 @@ public BlobAsyncClient buildAsyncClient() { BlobServiceVersion serviceVersion = version != null ? version : BlobServiceVersion.getLatest(); - HttpPipeline pipeline = (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline( - storageSharedKeyCredential, tokenCredential, azureSasCredential, sasToken, - endpoint, retryOptions, coreRetryOptions, logOptions, - clientOptions, httpClient, perCallPolicies, perRetryPolicies, configuration, audience, LOGGER); + HttpPipeline pipeline = constructPipeline(); return new BlobAsyncClient(pipeline, endpoint, serviceVersion, accountName, blobContainerName, blobName, snapshot, customerProvidedKey, encryptionScope, versionId); } + private HttpPipeline constructPipeline() { + return (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline( + storageSharedKeyCredential, tokenCredential, azureSasCredential, sasToken, + endpoint, retryOptions, coreRetryOptions, logOptions, + clientOptions, httpClient, perCallPolicies, perRetryPolicies, configuration, audience, LOGGER); + } + /** * Sets the {@link CustomerProvidedKey customer provided key} that is used to encrypt blob contents on the server. * 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 753176857abc4..adb06e7e29214 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 @@ -56,7 +56,6 @@ import java.net.URI; import java.time.Duration; import java.time.OffsetDateTime; -import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -315,6 +314,19 @@ public String getEncryptionScope() { return encryptionScope.getEncryptionScope(); } + /** + * Gets the {@link EncryptionScope} used to encrypt this blob's content on the server. + * + * @return the encryption scope used for encryption. + */ + BlobContainerEncryptionScope getBlobContainerEncryptionScope() { + if (blobContainerEncryptionScope == null) { + return null; + } + return blobContainerEncryptionScope; + } + + /** * Gets if the container this client represents exists in the cloud. * @@ -565,7 +577,7 @@ public Mono> deleteWithResponse(BlobRequestConditions requestCond Mono> deleteWithResponse(BlobRequestConditions requestConditions, Context context) { requestConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; - if (!validateNoETag(requestConditions)) { + if (!ModelHelper.validateNoETag(requestConditions)) { // Throwing is preferred to Mono.error because this will error out immediately instead of waiting until // subscription. throw LOGGER.logExceptionAsError( @@ -791,7 +803,7 @@ Mono> setMetadataWithResponse(Map metadata, BlobRequestConditions requestConditions, Context context) { context = context == null ? Context.NONE : context; requestConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; - if (!validateNoETag(requestConditions) || requestConditions.getIfUnmodifiedSince() != null) { + if (!ModelHelper.validateNoETag(requestConditions) || requestConditions.getIfUnmodifiedSince() != null) { // Throwing is preferred to Mono.error because this will error out immediately instead of waiting until // subscription. throw LOGGER.logExceptionAsError(new UnsupportedOperationException( @@ -961,36 +973,19 @@ Mono> setAccessPolicyWithResponse(PublicAccessType accessType, List identifiers, BlobRequestConditions requestConditions, Context context) { requestConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; - if (!validateNoETag(requestConditions)) { + if (!ModelHelper.validateNoETag(requestConditions)) { // Throwing is preferred to Mono.error because this will error out immediately instead of waiting until // subscription. throw LOGGER.logExceptionAsError( new UnsupportedOperationException("ETag access conditions are not supported for this API.")); } - /* - We truncate to seconds because the service only supports nanoseconds or seconds, but doing an - OffsetDateTime.now will only give back milliseconds (more precise fields are zeroed and not serialized). This - allows for proper serialization with no real detriment to users as sub-second precision on active time for - signed identifiers is not really necessary. - */ - if (identifiers != null) { - for (BlobSignedIdentifier identifier : identifiers) { - if (identifier.getAccessPolicy() != null && identifier.getAccessPolicy().getStartsOn() != null) { - identifier.getAccessPolicy().setStartsOn( - identifier.getAccessPolicy().getStartsOn().truncatedTo(ChronoUnit.SECONDS)); - } - if (identifier.getAccessPolicy() != null && identifier.getAccessPolicy().getExpiresOn() != null) { - identifier.getAccessPolicy().setExpiresOn( - identifier.getAccessPolicy().getExpiresOn().truncatedTo(ChronoUnit.SECONDS)); - } - } - } + List finalIdentifiers = ModelHelper.truncateTimeForBlobSignedIdentifier(identifiers); context = context == null ? Context.NONE : context; return this.azureBlobStorage.getContainers().setAccessPolicyNoCustomHeadersWithResponseAsync(containerName, null, requestConditions.getLeaseId(), accessType, requestConditions.getIfModifiedSince(), - requestConditions.getIfUnmodifiedSince(), null, identifiers, context); + requestConditions.getIfUnmodifiedSince(), null, finalIdentifiers, context); } /** @@ -1725,13 +1720,6 @@ public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureV .generateSas(SasImplUtils.extractSharedKeyCredential(getHttpPipeline()), stringToSignHandler, context); } - private static boolean validateNoETag(BlobRequestConditions modifiedRequestConditions) { - if (modifiedRequestConditions == null) { - return true; - } - return modifiedRequestConditions.getIfMatch() == null && modifiedRequestConditions.getIfNoneMatch() == null; - } - // private boolean validateNoTime(BlobRequestConditions modifiedRequestConditions) { // if (modifiedRequestConditions == null) { // return true; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClient.java index cc5528333cb56..aac26a1fd1eaa 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClient.java @@ -6,16 +6,47 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.ResponseBase; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.SharedExecutorService; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.implementation.AzureBlobStorageImpl; +import com.azure.storage.blob.implementation.AzureBlobStorageImplBuilder; +import com.azure.storage.blob.implementation.accesshelpers.BlobItemConstructorProxy; +import com.azure.storage.blob.implementation.models.BlobHierarchyListSegment; +import com.azure.storage.blob.implementation.models.BlobSignedIdentifierWrapper; +import com.azure.storage.blob.implementation.models.ContainersFilterBlobsHeaders; +import com.azure.storage.blob.implementation.models.ContainersGetAccessPolicyHeaders; +import com.azure.storage.blob.implementation.models.ContainersGetAccountInfoHeaders; +import com.azure.storage.blob.implementation.models.ContainersGetPropertiesHeaders; +import com.azure.storage.blob.implementation.models.ContainersListBlobFlatSegmentHeaders; +import com.azure.storage.blob.implementation.models.ContainersListBlobHierarchySegmentHeaders; +import com.azure.storage.blob.implementation.models.EncryptionScope; +import com.azure.storage.blob.implementation.models.FilterBlobSegment; +import com.azure.storage.blob.implementation.models.ListBlobsFlatSegmentResponse; +import com.azure.storage.blob.implementation.models.ListBlobsHierarchySegmentResponse; +import com.azure.storage.blob.implementation.util.BlobSasImplUtil; +import com.azure.storage.blob.implementation.util.ModelHelper; import com.azure.storage.blob.models.BlobContainerAccessPolicies; +import com.azure.storage.blob.models.BlobContainerEncryptionScope; import com.azure.storage.blob.models.BlobContainerProperties; +import com.azure.storage.blob.models.BlobErrorCode; import com.azure.storage.blob.models.BlobItem; import com.azure.storage.blob.models.BlobRequestConditions; import com.azure.storage.blob.models.BlobSignedIdentifier; +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.models.ListBlobsIncludeItem; import com.azure.storage.blob.models.ListBlobsOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; @@ -25,16 +56,27 @@ import com.azure.storage.blob.options.FindBlobsOptions; import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; import com.azure.storage.common.StorageSharedKeyCredential; +import com.azure.storage.common.implementation.SasImplUtils; import com.azure.storage.common.implementation.StorageImplUtils; -import reactor.core.publisher.Mono; +import java.net.URI; import java.time.Duration; import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; +import java.util.function.BiFunction; +import java.util.function.Supplier; +import java.util.stream.Collectors; import java.util.function.Consumer; -import static com.azure.storage.common.implementation.StorageImplUtils.blockWithOptionalTimeout; +import static com.azure.storage.blob.implementation.util.ModelHelper.wrapServiceCallWithExceptionMapping; +import static com.azure.storage.blob.implementation.util.ModelHelper.wrapTimeoutServiceCallWithExceptionMapping; +import static com.azure.storage.common.implementation.StorageImplUtils.sendRequest; /** * Client to a container. It may only be instantiated through a {@link BlobContainerClientBuilder} or via the method @@ -52,8 +94,6 @@ */ @ServiceClient(builder = BlobContainerClientBuilder.class) public final class BlobContainerClient { - private final BlobContainerAsyncClient client; - /** * Special container name for the root container in the Storage account. */ @@ -68,6 +108,15 @@ public final class BlobContainerClient { * Special container name for the logs container in the Storage account. */ public static final String LOG_CONTAINER_NAME = BlobContainerAsyncClient.LOG_CONTAINER_NAME; + private static final ClientLogger LOGGER = new ClientLogger(BlobContainerClient.class); + private final AzureBlobStorageImpl azureBlobStorage; + + private final String accountName; + private final String containerName; + private final BlobServiceVersion serviceVersion; + private final CpkInfo customerProvidedKey; // only used to pass down to blob clients + private final EncryptionScope encryptionScope; // only used to pass down to blob clients + private final BlobContainerEncryptionScope blobContainerEncryptionScope; /** * Package-private constructor for use by {@link BlobContainerClientBuilder}. @@ -75,7 +124,47 @@ public final class BlobContainerClient { * @param client the async container client */ BlobContainerClient(BlobContainerAsyncClient client) { - this.client = client; + this(client.getHttpPipeline(), client.getAccountUrl(), client.getServiceVersion(), + client.getAccountName(), client.getBlobContainerName(), client.getCustomerProvidedKey(), + new EncryptionScope().setEncryptionScope(client.getEncryptionScope()), + client.getBlobContainerEncryptionScope()); + } + + /** + * Package-private constructor for use by {@link BlobContainerClientBuilder}. + * + * @param pipeline The pipeline used to send and receive service requests. + * @param url The endpoint where to send service requests. + * @param serviceVersion The version of the service to receive requests. + * @param accountName The storage account name. + * @param containerName The container name. + * @param customerProvidedKey Customer provided key used during encryption of the blob's data on the server, pass + * {@code null} to allow the service to use its own encryption. + * @param encryptionScope Encryption scope used during encryption of the blob's data on the server, pass + * {@code null} to allow the service to use its own encryption. + */ + BlobContainerClient(HttpPipeline pipeline, String url, BlobServiceVersion serviceVersion, String accountName, + String containerName, CpkInfo customerProvidedKey, EncryptionScope encryptionScope, + BlobContainerEncryptionScope blobContainerEncryptionScope) { + this.azureBlobStorage = new AzureBlobStorageImplBuilder() + .pipeline(pipeline) + .url(url) + .version(serviceVersion.getVersion()) + .buildClient(); + this.serviceVersion = serviceVersion; + + this.accountName = accountName; + this.containerName = containerName; + this.customerProvidedKey = customerProvidedKey; + this.encryptionScope = encryptionScope; + this.blobContainerEncryptionScope = blobContainerEncryptionScope; + /* Check to make sure the uri is valid. We don't want the error to occur later in the generated layer + when the sas token has already been applied. */ + try { + URI.create(getBlobContainerUrl()); + } catch (IllegalArgumentException ex) { + throw LOGGER.logExceptionAsError(ex); + } } @@ -96,7 +185,7 @@ public final class BlobContainerClient { * @return A new {@link BlobClient} object which references the blob with the specified name in this container. */ public BlobClient getBlobClient(String blobName) { - return new BlobClient(client.getBlobAsyncClient(blobName)); + return getBlobClient(blobName, null); } /** @@ -117,7 +206,8 @@ public BlobClient getBlobClient(String blobName) { * @return A new {@link BlobClient} object which references the blob with the specified name in this container. */ public BlobClient getBlobClient(String blobName, String snapshot) { - return new BlobClient(client.getBlobAsyncClient(blobName, snapshot)); + return new BlobClient(new BlobAsyncClient(getHttpPipeline(), getAccountUrl(), getServiceVersion(), + getAccountName(), getBlobContainerName(), blobName, snapshot, getCustomerProvidedKey(), encryptionScope)); } /** @@ -130,7 +220,9 @@ public BlobClient getBlobClient(String blobName, String snapshot) { * @return A new {@link BlobClient} object which references the blob with the specified name in this container. */ public BlobClient getBlobVersionClient(String blobName, String versionId) { - return new BlobClient(client.getBlobVersionAsyncClient(blobName, versionId)); + return new BlobClient(new BlobAsyncClient(getHttpPipeline(), getAccountUrl(), getServiceVersion(), + getAccountName(), getBlobContainerName(), blobName, null, getCustomerProvidedKey(), encryptionScope, + versionId)); } /** @@ -148,7 +240,7 @@ public BlobClient getBlobVersionClient(String blobName, String versionId) { * @return The name of container. */ public String getBlobContainerName() { - return this.client.getBlobContainerName(); + return containerName; } /** @@ -157,7 +249,7 @@ public String getBlobContainerName() { * @return the URL of the storage account */ public String getAccountUrl() { - return this.client.getAccountUrl(); + return azureBlobStorage.getUrl(); } /** @@ -166,7 +258,7 @@ public String getAccountUrl() { * @return the URL. */ public String getBlobContainerUrl() { - return client.getBlobContainerUrl(); + return azureBlobStorage.getUrl() + "/" + containerName; } /** @@ -175,7 +267,7 @@ public String getBlobContainerUrl() { * @return account name associated with this storage resource. */ public String getAccountName() { - return this.client.getAccountName(); + return this.accountName; } /** @@ -184,7 +276,15 @@ public String getAccountName() { * @return {@link BlobServiceClient} */ public BlobServiceClient getServiceClient() { - return this.client.getServiceClientBuilder().buildClient(); + CustomerProvidedKey encryptionKey = this.customerProvidedKey == null ? null + : new CustomerProvidedKey(this.customerProvidedKey.getEncryptionKey()); + return new BlobServiceClientBuilder() + .endpoint(this.getBlobContainerUrl()) + .pipeline(this.getHttpPipeline()) + .serviceVersion(this.serviceVersion) + .blobContainerEncryptionScope(this.blobContainerEncryptionScope) + .encryptionScope(this.getEncryptionScope()) + .customerProvidedKey(encryptionKey).buildClient(); } /** @@ -193,7 +293,7 @@ public BlobServiceClient getServiceClient() { * @return the service version the client is using. */ public BlobServiceVersion getServiceVersion() { - return this.client.getServiceVersion(); + return serviceVersion; } /** @@ -202,7 +302,7 @@ public BlobServiceVersion getServiceVersion() { * @return The pipeline. */ public HttpPipeline getHttpPipeline() { - return client.getHttpPipeline(); + return azureBlobStorage.getHttpPipeline(); } /** @@ -212,7 +312,7 @@ public HttpPipeline getHttpPipeline() { * @return the customer provided key used for encryption. */ public CpkInfo getCustomerProvidedKey() { - return client.getCustomerProvidedKey(); + return customerProvidedKey; } /** @@ -221,7 +321,10 @@ public CpkInfo getCustomerProvidedKey() { * @return the encryption scope used for encryption. */ public String getEncryptionScope() { - return client.getEncryptionScope(); + if (encryptionScope == null) { + return null; + } + return encryptionScope.getEncryptionScope(); } /** @@ -259,9 +362,18 @@ public boolean exists() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response existsWithResponse(Duration timeout, Context context) { - Mono> response = client.existsWithResponse(context); - - return blockWithOptionalTimeout(response, timeout); + try { + Response response = getPropertiesWithResponse(null, timeout, context); + return new SimpleResponse<>(response, true); + } catch (RuntimeException e) { + if (ModelHelper.checkContainerDoesNotExistStatusCode(e) && e instanceof HttpResponseException) { + HttpResponse response = ((HttpResponseException) e).getResponse(); + return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), + response.getHeaders(), false); + } else { + throw LOGGER.logExceptionAsError(e); + } + } } /** @@ -317,8 +429,11 @@ public void create() { @ServiceMethod(returns = ReturnType.SINGLE) public Response createWithResponse(Map metadata, PublicAccessType accessType, Duration timeout, Context context) { - Mono> response = client.createWithResponse(metadata, accessType, context); - return blockWithOptionalTimeout(response, timeout); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> this.azureBlobStorage.getContainers() + .createNoCustomHeadersWithResponse(containerName, null, metadata, accessType, null, + blobContainerEncryptionScope, finalContext)); + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -372,8 +487,21 @@ public boolean createIfNotExists() { @ServiceMethod(returns = ReturnType.SINGLE) public Response createIfNotExistsWithResponse(BlobContainerCreateOptions options, Duration timeout, Context context) { - return StorageImplUtils.blockWithOptionalTimeout(client. - createIfNotExistsWithResponse(options, context), timeout); + BlobContainerCreateOptions finalOptions = options == null ? new BlobContainerCreateOptions() : options; + try { + Response response = createWithResponse(finalOptions.getMetadata(), finalOptions.getPublicAccessType(), + timeout, context); + return new SimpleResponse<>(response, true); + } catch (BlobStorageException e) { + if (e.getStatusCode() == 409 && e.getErrorCode().equals(BlobErrorCode.CONTAINER_ALREADY_EXISTS)) { + HttpResponse res = e.getResponse(); + return new SimpleResponse<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), false); + } else { + throw LOGGER.logExceptionAsError(e); + } + } catch (RuntimeException e) { + throw LOGGER.logExceptionAsError(e); + } } /** @@ -428,9 +556,22 @@ public void delete() { @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(BlobRequestConditions requestConditions, Duration timeout, Context context) { - Mono> response = client.deleteWithResponse(requestConditions, context); + BlobRequestConditions finalRequestConditions = requestConditions == null ? new BlobRequestConditions() + : requestConditions; + if (!ModelHelper.validateNoETag(requestConditions)) { + // Throwing is preferred to Mono.error because this will error out immediately instead of waiting until + // subscription. + throw LOGGER.logExceptionAsError( + new UnsupportedOperationException("ETag access conditions are not supported for this API.")); + } + Context finalContext = context == null ? Context.NONE : context; + + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getContainers().deleteNoCustomHeadersWithResponse(containerName, null, + finalRequestConditions.getLeaseId(), finalRequestConditions.getIfModifiedSince(), + finalRequestConditions.getIfUnmodifiedSince(), null, finalContext)); - return blockWithOptionalTimeout(response, timeout); + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -485,7 +626,17 @@ public boolean deleteIfExists() { @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteIfExistsWithResponse(BlobRequestConditions requestConditions, Duration timeout, Context context) { - return blockWithOptionalTimeout(client.deleteIfExistsWithResponse(requestConditions, context), timeout); + try { + Response response = this.deleteWithResponse(requestConditions, timeout, context); + return new SimpleResponse<>(response, true); + } catch (BlobStorageException e) { + if (e.getStatusCode() == 404 && e.getErrorCode().equals(BlobErrorCode.CONTAINER_NOT_FOUND)) { + HttpResponse res = e.getResponse(); + return new SimpleResponse<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), false); + } else { + throw LOGGER.logExceptionAsError(e); + } + } } /** @@ -538,7 +689,20 @@ public BlobContainerProperties getProperties() { @ServiceMethod(returns = ReturnType.SINGLE) public Response getPropertiesWithResponse(String leaseId, Duration timeout, Context context) { - return blockWithOptionalTimeout(client.getPropertiesWithResponse(leaseId, context), timeout); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getContainers().getPropertiesWithResponse(containerName, null, leaseId, null, + finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + ContainersGetPropertiesHeaders hd = response.getDeserializedHeaders(); + BlobContainerProperties properties = new BlobContainerProperties(hd.getXMsMeta(), hd.getETag(), + hd.getLastModified(), hd.getXMsLeaseDuration(), hd.getXMsLeaseState(), hd.getXMsLeaseStatus(), + hd.getXMsBlobPublicAccess(), Boolean.TRUE.equals(hd.isXMsHasImmutabilityPolicy()), + Boolean.TRUE.equals(hd.isXMsHasLegalHold()), hd.getXMsDefaultEncryptionScope(), + hd.isXMsDenyEncryptionScopeOverride(), hd.isXMsImmutableStorageWithVersioningEnabled()); + return new SimpleResponse<>(response, properties); } /** @@ -595,9 +759,20 @@ public void setMetadata(Map metadata) { @ServiceMethod(returns = ReturnType.SINGLE) public Response setMetadataWithResponse(Map metadata, BlobRequestConditions requestConditions, Duration timeout, Context context) { - Mono> response = client.setMetadataWithResponse(metadata, requestConditions, - context); - return blockWithOptionalTimeout(response, timeout); + Context finalContext = context == null ? Context.NONE : context; + BlobRequestConditions finalRequestConditions = requestConditions == null ? new BlobRequestConditions() + : requestConditions; + if (!ModelHelper.validateNoETag(finalRequestConditions) || finalRequestConditions.getIfUnmodifiedSince() != null) { + // Throwing is preferred to Mono.error because this will error out immediately instead of waiting until + // subscription. + throw LOGGER.logExceptionAsError(new UnsupportedOperationException( + "If-Modified-Since is the only HTTP access condition supported for this API")); + } + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + azureBlobStorage.getContainers().setMetadataWithResponse(containerName, null, + finalRequestConditions.getLeaseId(), metadata, finalRequestConditions.getIfModifiedSince(), null, + finalContext)); + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -657,7 +832,15 @@ public BlobContainerAccessPolicies getAccessPolicy() { @ServiceMethod(returns = ReturnType.SINGLE) public Response getAccessPolicyWithResponse(String leaseId, Duration timeout, Context context) { - return blockWithOptionalTimeout(client.getAccessPolicyWithResponse(leaseId, context), timeout); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getContainers().getAccessPolicyWithResponse(containerName, null, leaseId, null, + finalContext)); + ResponseBase response = sendRequest(operation, + timeout, BlobStorageException.class); + return new SimpleResponse<>(response, new BlobContainerAccessPolicies( + response.getDeserializedHeaders().getXMsBlobPublicAccess(), response.getValue().items())); } /** @@ -746,10 +929,21 @@ public void setAccessPolicy(PublicAccessType accessType, public Response setAccessPolicyWithResponse(PublicAccessType accessType, List identifiers, BlobRequestConditions requestConditions, Duration timeout, Context context) { - Mono> response = client - .setAccessPolicyWithResponse(accessType, identifiers, requestConditions, context); + BlobRequestConditions finalRequestConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; - return blockWithOptionalTimeout(response, timeout); + if (!ModelHelper.validateNoETag(requestConditions)) { + // Throwing is preferred to Mono.error because this will error out immediately instead of waiting until + // subscription. + throw LOGGER.logExceptionAsError( + new UnsupportedOperationException("ETag access conditions are not supported for this API.")); + } + List finalIdentifiers = ModelHelper.truncateTimeForBlobSignedIdentifier(identifiers); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getContainers().setAccessPolicyNoCustomHeadersWithResponse(containerName, null, + finalRequestConditions.getLeaseId(), accessType, finalRequestConditions.getIfModifiedSince(), + finalRequestConditions.getIfUnmodifiedSince(), null, finalIdentifiers, finalContext)); + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -859,7 +1053,42 @@ public PagedIterable listBlobs(ListBlobsOptions options, Duration time */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listBlobs(ListBlobsOptions options, String continuationToken, Duration timeout) { - return new PagedIterable<>(client.listBlobsFlatWithOptionalTimeout(options, continuationToken, timeout)); + BiFunction> retriever = (nextMarker, pageSize) -> { + ListBlobsOptions finalOptions = options == null ? new ListBlobsOptions() : options; + if (pageSize != null) { + finalOptions.setMaxResultsPerPage(pageSize); + } + ArrayList include = + finalOptions.getDetails().toList().isEmpty() ? null : finalOptions.getDetails().toList(); + + Supplier> operation = () -> { + ResponseBase response = + wrapServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getContainers().listBlobFlatSegmentWithResponse(containerName, + finalOptions.getPrefix(), nextMarker, finalOptions.getMaxResultsPerPage(), include, null, + null, Context.NONE)); + + List value = response.getValue().getSegment() == null ? Collections.emptyList() + : response.getValue().getSegment().getBlobItems().stream() + .map(ModelHelper::populateBlobItem) + .collect(Collectors.toList()); + + return new PagedResponseBase<>( + response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + value, + response.getValue().getNextMarker(), + response.getDeserializedHeaders()); + }; + try { + return timeout != null ? CoreUtils.getResultWithTimeout(SharedExecutorService.getInstance() + .submit(operation::get), timeout) : operation.get(); + } catch (InterruptedException | ExecutionException | TimeoutException e) { + throw LOGGER.logExceptionAsError(new RuntimeException("Failed to retrieve blobs with timeout.", e)); + } + }; + return new PagedIterable<>(pageSize -> retriever.apply(continuationToken, pageSize), retriever); } /** @@ -954,8 +1183,54 @@ public PagedIterable listBlobsByHierarchy(String directory) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listBlobsByHierarchy(String delimiter, ListBlobsOptions options, Duration timeout) { - return new PagedIterable<>(client - .listBlobsHierarchyWithOptionalTimeout(delimiter, options, timeout)); + BiFunction> func = (marker, pageSize) -> { + ListBlobsOptions finalOptions; + if (pageSize != null) { + if (options == null) { + finalOptions = new ListBlobsOptions().setMaxResultsPerPage(pageSize); + } else { + // Note that this prefers the value passed to .byPage(int) over the value on the options + finalOptions = new ListBlobsOptions() + .setMaxResultsPerPage(pageSize) + .setPrefix(options.getPrefix()) + .setDetails(options.getDetails()); + } + } else { + finalOptions = options == null ? new ListBlobsOptions() : options; + } + return listBlobsHierarchySegment(marker, delimiter, finalOptions, timeout); + }; + return new PagedIterable<>(pageSize -> func.apply(null, pageSize), func); + } + + private PagedResponse listBlobsHierarchySegment(String marker, String delimiter, ListBlobsOptions options, + Duration timeout) { + if (options.getDetails().getRetrieveSnapshots()) { + throw LOGGER.logExceptionAsError( + new UnsupportedOperationException("Including snapshots in a hierarchical listing is not supported.")); + } + ArrayList include = options.getDetails().toList().isEmpty() ? null + : options.getDetails().toList(); + + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> azureBlobStorage.getContainers().listBlobHierarchySegmentWithResponse(containerName, delimiter, + options.getPrefix(), marker, options.getMaxResultsPerPage(), include, null, null, Context.NONE)); + + ResponseBase response = + StorageImplUtils.sendRequest(operation, timeout, BlobStorageException.class); + + BlobHierarchyListSegment segment = response.getValue().getSegment(); + List value = new ArrayList<>(); + if (segment != null) { + segment.getBlobItems().forEach(item -> value.add(BlobItemConstructorProxy.create(item))); + segment.getBlobPrefixes().forEach(prefix -> value.add(new BlobItem() + .setName(ModelHelper.toBlobNameString(prefix.getName())) + .setIsPrefix(true))); + } + + return new PagedResponseBase<>( + response.getRequest(), response.getStatusCode(), response.getHeaders(), value, + response.getValue().getNextMarker(), response.getDeserializedHeaders()); } /** @@ -1003,7 +1278,40 @@ public PagedIterable findBlobsByTags(String query) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable findBlobsByTags(FindBlobsOptions options, Duration timeout, Context context) { - return new PagedIterable<>(client.findBlobsByTags(options, timeout, context)); + StorageImplUtils.assertNotNull("options", options); + BiFunction> func = (marker, pageSize) -> { + // Use pageSize if provided, otherwise use maxResultsPerPage from options + FindBlobsOptions finalOptions = (pageSize != null) + ? new FindBlobsOptions(options.getQuery()).setMaxResultsPerPage(pageSize) : options; + + return findBlobsByTagsHelper(finalOptions, marker, timeout, context); + }; + return new PagedIterable<>(pageSize -> func.apply(null, pageSize), func); + } + + private PagedResponse findBlobsByTagsHelper( + FindBlobsOptions options, String marker, + Duration timeout, Context context) { + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getContainers().filterBlobsWithResponse( + containerName, null, null, options.getQuery(), marker, + options.getMaxResultsPerPage(), null, context)); + + ResponseBase response = + StorageImplUtils.sendRequest(operation, timeout, BlobStorageException.class); + + List value = response.getValue().getBlobs().stream() + .map(ModelHelper::populateTaggedBlobItem) + .collect(Collectors.toList()); + + return new PagedResponseBase<>( + response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + value, + response.getValue().getNextMarker(), + response.getDeserializedHeaders()); } /** @@ -1047,9 +1355,14 @@ public StorageAccountInfo getAccountInfo(Duration timeout) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getAccountInfoWithResponse(Duration timeout, Context context) { - Mono> response = client.getAccountInfoWithResponse(context); - - return blockWithOptionalTimeout(response, timeout); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getContainers().getAccountInfoWithResponse(containerName, finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + ContainersGetAccountInfoHeaders hd = response.getDeserializedHeaders(); + return new SimpleResponse<>(response, new StorageAccountInfo(hd.getXMsSkuName(), hd.getXMsAccountKind())); } // TODO: Reintroduce this API once service starts supporting it. @@ -1094,7 +1407,8 @@ public Response getAccountInfoWithResponse(Duration timeout, */ public String generateUserDelegationSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues, UserDelegationKey userDelegationKey) { - return this.client.generateUserDelegationSas(blobServiceSasSignatureValues, userDelegationKey); + return generateUserDelegationSas(blobServiceSasSignatureValues, userDelegationKey, getAccountName(), + Context.NONE); } /** @@ -1147,8 +1461,8 @@ public String generateUserDelegationSas(BlobServiceSasSignatureValues blobServic */ public String generateUserDelegationSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues, UserDelegationKey userDelegationKey, String accountName, Consumer stringToSignHandler, Context context) { - return this.client.generateUserDelegationSas(blobServiceSasSignatureValues, userDelegationKey, accountName, - stringToSignHandler, context); + return new BlobSasImplUtil(blobServiceSasSignatureValues, getBlobContainerName()) + .generateUserDelegationSas(userDelegationKey, accountName, stringToSignHandler, context); } /** @@ -1175,7 +1489,7 @@ public String generateUserDelegationSas(BlobServiceSasSignatureValues blobServic * @return A {@code String} representing the SAS query parameters. */ public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues) { - return this.client.generateSas(blobServiceSasSignatureValues); + return generateSas(blobServiceSasSignatureValues, Context.NONE); } /** @@ -1221,7 +1535,8 @@ public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureV */ public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues, Consumer stringToSignHandler, Context context) { - return this.client.generateSas(blobServiceSasSignatureValues, stringToSignHandler, context); + return new BlobSasImplUtil(blobServiceSasSignatureValues, getBlobContainerName()) + .generateSas(SasImplUtils.extractSharedKeyCredential(getHttpPipeline()), stringToSignHandler, context); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClientBuilder.java index cd4f9e8f9b574..28c1f10752476 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClientBuilder.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClientBuilder.java @@ -121,7 +121,26 @@ public BlobContainerClientBuilder() { * @throws IllegalStateException If multiple credentials have been specified. */ public BlobContainerClient buildClient() { - return new BlobContainerClient(buildAsyncClient()); + BuilderHelper.httpsValidation(customerProvidedKey, "customer provided key", endpoint, LOGGER); + + if (Objects.nonNull(customerProvidedKey) && Objects.nonNull(encryptionScope)) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Customer provided key and encryption " + + "scope cannot both be set")); + } + + /* + Implicit and explicit root container access are functionally equivalent, but explicit references are easier + to read and debug. + */ + String blobContainerName = CoreUtils.isNullOrEmpty(containerName) ? BlobContainerClient.ROOT_CONTAINER_NAME + : containerName; + + BlobServiceVersion serviceVersion = version != null ? version : BlobServiceVersion.getLatest(); + + HttpPipeline pipeline = constructPipeline(); + + return new BlobContainerClient(pipeline, endpoint, serviceVersion, accountName, blobContainerName, + customerProvidedKey, encryptionScope, blobContainerEncryptionScope); } /** @@ -160,15 +179,19 @@ public BlobContainerAsyncClient buildAsyncClient() { BlobServiceVersion serviceVersion = version != null ? version : BlobServiceVersion.getLatest(); - HttpPipeline pipeline = (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline( - storageSharedKeyCredential, tokenCredential, azureSasCredential, sasToken, - endpoint, retryOptions, coreRetryOptions, logOptions, - clientOptions, httpClient, perCallPolicies, perRetryPolicies, configuration, audience, LOGGER); + HttpPipeline pipeline = constructPipeline(); return new BlobContainerAsyncClient(pipeline, endpoint, serviceVersion, accountName, blobContainerName, customerProvidedKey, encryptionScope, blobContainerEncryptionScope); } + private HttpPipeline constructPipeline() { + return (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline( + storageSharedKeyCredential, tokenCredential, azureSasCredential, sasToken, + endpoint, retryOptions, coreRetryOptions, logOptions, + clientOptions, httpClient, perCallPolicies, perRetryPolicies, configuration, audience, LOGGER); + } + /** * Sets the service endpoint, additionally parses it for information (SAS token, container name) * 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 3842d2b3e6213..cec9e88890e46 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 @@ -25,15 +25,12 @@ import com.azure.storage.blob.implementation.util.ModelHelper; import com.azure.storage.blob.models.BlobContainerEncryptionScope; import com.azure.storage.blob.models.BlobContainerItem; -import com.azure.storage.blob.models.BlobContainerListDetails; import com.azure.storage.blob.models.BlobCorsRule; -import com.azure.storage.blob.models.BlobRetentionPolicy; import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.BlobServiceStatistics; import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.KeyInfo; -import com.azure.storage.blob.models.ListBlobContainersIncludeType; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; @@ -179,6 +176,22 @@ public BlobServiceVersion getServiceVersion() { return serviceVersion; } + CpkInfo getCustomerProvidedKey() { + return customerProvidedKey; + } + + EncryptionScope getEncryptionScope() { + return encryptionScope; + } + + BlobContainerEncryptionScope getBlobContainerEncryptionScope() { + return blobContainerEncryptionScope; + } + + boolean isAnonymousAccess() { + return anonymousAccess; + } + /** * Creates a new container within a storage account. If a container with the same name already exists, the operation * fails. For more information, see the @@ -538,7 +551,7 @@ private Mono> listBlobContainersSegment(String return StorageImplUtils.applyOptionalTimeout( this.azureBlobStorage.getServices().listBlobContainersSegmentSinglePageAsync( options.getPrefix(), marker, options.getMaxResultsPerPage(), - toIncludeTypes(options.getDetails()), + ModelHelper.toIncludeTypes(options.getDetails()), null, null, Context.NONE), timeout); } @@ -628,35 +641,6 @@ private Mono> findBlobsByTags( }); } - /** - * Converts {@link BlobContainerListDetails} into list of {@link ListBlobContainersIncludeType} - * that contains only options selected. If no option is selected then null is returned. - * - * @return a list of selected options converted into {@link ListBlobContainersIncludeType}, null if none - * of options has been selected. - */ - private List toIncludeTypes(BlobContainerListDetails blobContainerListDetails) { - boolean hasDetails = blobContainerListDetails != null - && (blobContainerListDetails.getRetrieveMetadata() - || blobContainerListDetails.getRetrieveDeleted() - || blobContainerListDetails.getRetrieveSystemContainers()); - if (hasDetails) { - List flags = new ArrayList<>(3); - if (blobContainerListDetails.getRetrieveDeleted()) { - flags.add(ListBlobContainersIncludeType.DELETED); - } - if (blobContainerListDetails.getRetrieveMetadata()) { - flags.add(ListBlobContainersIncludeType.METADATA); - } - if (blobContainerListDetails.getRetrieveSystemContainers()) { - flags.add(ListBlobContainersIncludeType.SYSTEM); - } - return flags; - } else { - return null; - } - } - /** * Gets the properties of a storage account’s Blob service. For more information, see the * Azure Docs. @@ -807,14 +791,14 @@ Mono> setPropertiesWithResponse(BlobServiceProperties properties, finalProperties.setLogging(properties.getLogging()); if (finalProperties.getLogging() != null) { StorageImplUtils.assertNotNull("Logging Version", finalProperties.getLogging().getVersion()); - validateRetentionPolicy(finalProperties.getLogging().getRetentionPolicy(), "Logging Retention Policy"); + ModelHelper.validateRetentionPolicy(finalProperties.getLogging().getRetentionPolicy(), "Logging Retention Policy"); } // Hour Metrics finalProperties.setHourMetrics(properties.getHourMetrics()); if (finalProperties.getHourMetrics() != null) { StorageImplUtils.assertNotNull("HourMetrics Version", finalProperties.getHourMetrics().getVersion()); - validateRetentionPolicy(finalProperties.getHourMetrics().getRetentionPolicy(), "HourMetrics Retention " + ModelHelper.validateRetentionPolicy(finalProperties.getHourMetrics().getRetentionPolicy(), "HourMetrics Retention " + "Policy"); if (finalProperties.getHourMetrics().isEnabled()) { StorageImplUtils.assertNotNull("HourMetrics IncludeApis", @@ -827,7 +811,7 @@ Mono> setPropertiesWithResponse(BlobServiceProperties properties, if (finalProperties.getMinuteMetrics() != null) { StorageImplUtils.assertNotNull("MinuteMetrics Version", finalProperties.getMinuteMetrics().getVersion()); - validateRetentionPolicy(finalProperties.getMinuteMetrics().getRetentionPolicy(), "MinuteMetrics " + ModelHelper.validateRetentionPolicy(finalProperties.getMinuteMetrics().getRetentionPolicy(), "MinuteMetrics " + "Retention Policy"); if (finalProperties.getMinuteMetrics().isEnabled()) { StorageImplUtils.assertNotNull("MinuteMetrics IncludeApis", @@ -838,7 +822,7 @@ Mono> setPropertiesWithResponse(BlobServiceProperties properties, // CORS List corsRules = new ArrayList<>(); for (BlobCorsRule rule : properties.getCors()) { - corsRules.add(validatedCorsRule(rule)); + corsRules.add(ModelHelper.validatedCorsRule(rule)); } finalProperties.setCors(corsRules); @@ -847,7 +831,7 @@ Mono> setPropertiesWithResponse(BlobServiceProperties properties, // Delete Retention Policy finalProperties.setDeleteRetentionPolicy(properties.getDeleteRetentionPolicy()); - validateRetentionPolicy(finalProperties.getDeleteRetentionPolicy(), "DeleteRetentionPolicy Days"); + ModelHelper.validateRetentionPolicy(finalProperties.getDeleteRetentionPolicy(), "DeleteRetentionPolicy Days"); // Static Website finalProperties.setStaticWebsite(properties.getStaticWebsite()); @@ -859,38 +843,6 @@ Mono> setPropertiesWithResponse(BlobServiceProperties properties, .setPropertiesNoCustomHeadersWithResponseAsync(finalProperties, null, null, context); } - /** - * Sets any null fields to "" since the service requires all Cors rules to be set if some are set. - * @param originalRule {@link BlobCorsRule} - * @return The validated {@link BlobCorsRule} - */ - private BlobCorsRule validatedCorsRule(BlobCorsRule originalRule) { - if (originalRule == null) { - return null; - } - BlobCorsRule validRule = new BlobCorsRule(); - validRule.setAllowedHeaders(StorageImplUtils.emptyIfNull(originalRule.getAllowedHeaders())); - validRule.setAllowedMethods(StorageImplUtils.emptyIfNull(originalRule.getAllowedMethods())); - validRule.setAllowedOrigins(StorageImplUtils.emptyIfNull(originalRule.getAllowedOrigins())); - validRule.setExposedHeaders(StorageImplUtils.emptyIfNull(originalRule.getExposedHeaders())); - validRule.setMaxAgeInSeconds(originalRule.getMaxAgeInSeconds()); - return validRule; - } - - /** - * Validates a {@link BlobRetentionPolicy} according to service specs for set properties. - * @param retentionPolicy {@link BlobRetentionPolicy} - * @param policyName The name of the variable for errors. - */ - private void validateRetentionPolicy(BlobRetentionPolicy retentionPolicy, String policyName) { - if (retentionPolicy == null) { - return; - } - if (retentionPolicy.isEnabled()) { - StorageImplUtils.assertInBounds(policyName, retentionPolicy.getDays(), 1, 365); - } - } - /** * Gets a user delegation key for use with this account's blob storage. Note: This method call is only valid when * using {@link TokenCredential} in this object's {@link HttpPipeline}. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java index 2c85fafd7d457..f6743e2815ae9 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java @@ -9,12 +9,35 @@ import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpPipeline; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.implementation.AzureBlobStorageImpl; +import com.azure.storage.blob.implementation.AzureBlobStorageImplBuilder; +import com.azure.storage.blob.implementation.models.ContainersRestoreHeaders; +import com.azure.storage.blob.implementation.models.EncryptionScope; +import com.azure.storage.blob.implementation.models.FilterBlobSegment; +import com.azure.storage.blob.implementation.models.ServicesFilterBlobsHeaders; +import com.azure.storage.blob.implementation.models.ServicesGetAccountInfoHeaders; +import com.azure.storage.blob.implementation.models.ServicesGetPropertiesHeaders; +import com.azure.storage.blob.implementation.models.ServicesGetStatisticsHeaders; +import com.azure.storage.blob.implementation.models.ServicesGetUserDelegationKeyHeaders; +import com.azure.storage.blob.implementation.util.ModelHelper; +import com.azure.storage.blob.models.BlobContainerEncryptionScope; import com.azure.storage.blob.models.BlobContainerItem; +import com.azure.storage.blob.models.BlobContainerListDetails; +import com.azure.storage.blob.models.BlobCorsRule; import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.BlobServiceStatistics; +import com.azure.storage.blob.models.BlobStorageException; +import com.azure.storage.blob.models.CpkInfo; +import com.azure.storage.blob.models.KeyInfo; +import com.azure.storage.blob.models.ListBlobContainersIncludeType; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; @@ -24,13 +47,24 @@ import com.azure.storage.blob.options.FindBlobsOptions; import com.azure.storage.blob.options.UndeleteBlobContainerOptions; import com.azure.storage.common.StorageSharedKeyCredential; +import com.azure.storage.common.implementation.AccountSasImplUtil; +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.sas.AccountSasSignatureValues; -import reactor.core.publisher.Mono; +import java.net.URI; import java.time.Duration; import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; import java.util.Map; +import java.util.concurrent.Callable; +import java.util.function.BiFunction; +import java.util.stream.Collectors; + +import static com.azure.storage.blob.implementation.util.ModelHelper.wrapTimeoutServiceCallWithExceptionMapping; +import static com.azure.storage.common.implementation.StorageImplUtils.sendRequest; import java.util.function.Consumer; /** @@ -48,15 +82,51 @@ */ @ServiceClient(builder = BlobServiceClientBuilder.class) public final class BlobServiceClient { - private final BlobServiceAsyncClient blobServiceAsyncClient; + private static final ClientLogger LOGGER = new ClientLogger(BlobServiceClient.class); + private final AzureBlobStorageImpl azureBlobStorage; + private final String accountName; + private final BlobServiceVersion serviceVersion; + private final CpkInfo customerProvidedKey; // only used to pass down to blob clients + private final EncryptionScope encryptionScope; // only used to pass down to blob clients + private final BlobContainerEncryptionScope blobContainerEncryptionScope; // only used to pass down to container + // clients + private final boolean anonymousAccess; /** * Package-private constructor for use by {@link BlobServiceClientBuilder}. * - * @param blobServiceAsyncClient the async storage account client + * @param pipeline The pipeline used to send and receive service requests. + * @param url The endpoint where to send service requests. + * @param serviceVersion The version of the service to receive requests. + * @param accountName The storage account name. + * @param customerProvidedKey Customer provided key used during encryption of the blob's data on the server, pass + * {@code null} to allow the service to use its own encryption. + * @param encryptionScope Encryption scope used during encryption of the blob's data on the server, pass + * {@code null} to allow the service to use its own encryption. + * @param anonymousAccess Whether the client was built with anonymousAccess */ - BlobServiceClient(BlobServiceAsyncClient blobServiceAsyncClient) { - this.blobServiceAsyncClient = blobServiceAsyncClient; + BlobServiceClient(HttpPipeline pipeline, String url, + BlobServiceVersion serviceVersion, String accountName, CpkInfo customerProvidedKey, EncryptionScope encryptionScope, + BlobContainerEncryptionScope blobContainerEncryptionScope, boolean anonymousAccess) { + /* Check to make sure the uri is valid. We don't want the error to occur later in the generated layer + when the sas token has already been applied. */ + try { + URI.create(url); + } catch (IllegalArgumentException ex) { + throw LOGGER.logExceptionAsError(ex); + } + this.azureBlobStorage = new AzureBlobStorageImplBuilder() + .pipeline(pipeline) + .url(url) + .version(serviceVersion.getVersion()) + .buildClient(); + this.serviceVersion = serviceVersion; + + this.accountName = accountName; + this.customerProvidedKey = customerProvidedKey; + this.encryptionScope = encryptionScope; + this.blobContainerEncryptionScope = blobContainerEncryptionScope; + this.anonymousAccess = anonymousAccess; } /** @@ -75,7 +145,11 @@ public final class BlobServiceClient { * @return A {@link BlobContainerClient} object pointing to the specified container */ public BlobContainerClient getBlobContainerClient(String containerName) { - return new BlobContainerClient(blobServiceAsyncClient.getBlobContainerAsyncClient(containerName)); + if (CoreUtils.isNullOrEmpty(containerName)) { + containerName = BlobContainerAsyncClient.ROOT_CONTAINER_NAME; + } + return new BlobContainerClient(getHttpPipeline(), getAccountUrl(), getServiceVersion(), + getAccountName(), containerName, customerProvidedKey, encryptionScope, blobContainerEncryptionScope); } /** @@ -84,7 +158,7 @@ public BlobContainerClient getBlobContainerClient(String containerName) { * @return The pipeline. */ public HttpPipeline getHttpPipeline() { - return blobServiceAsyncClient.getHttpPipeline(); + return azureBlobStorage.getHttpPipeline(); } /** @@ -93,7 +167,7 @@ public HttpPipeline getHttpPipeline() { * @return the service version the client is using. */ public BlobServiceVersion getServiceVersion() { - return this.blobServiceAsyncClient.getServiceVersion(); + return serviceVersion; } /** @@ -247,7 +321,7 @@ public void deleteBlobContainer(String containerName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteBlobContainerWithResponse(String containerName, Context context) { - return blobServiceAsyncClient.deleteBlobContainerWithResponse(containerName, context).block(); + return getBlobContainerClient(containerName).deleteWithResponse(null, null, context); } /** @@ -299,7 +373,7 @@ public boolean deleteBlobContainerIfExists(String containerName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteBlobContainerIfExistsWithResponse(String containerName, Context context) { - return blobServiceAsyncClient.deleteBlobContainerIfExistsWithResponse(containerName, context).block(); + return getBlobContainerClient(containerName).deleteIfExistsWithResponse(null, null, context); } /** @@ -308,7 +382,7 @@ public Response deleteBlobContainerIfExistsWithResponse(String containe * @return the URL. */ public String getAccountUrl() { - return blobServiceAsyncClient.getAccountUrl(); + return azureBlobStorage.getUrl(); } /** @@ -356,7 +430,26 @@ public PagedIterable listBlobContainers() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listBlobContainers(ListBlobContainersOptions options, Duration timeout) { - return new PagedIterable<>(blobServiceAsyncClient.listBlobContainersWithOptionalTimeout(options, timeout)); + throwOnAnonymousAccess(); + BiFunction> pageRetriever = (marker, pageSize) -> { + ListBlobContainersOptions finalOptions = options != null ? options : new ListBlobContainersOptions(); + Integer finalPageSize = pageSize != null ? pageSize : finalOptions.getMaxResultsPerPage(); + return listBlobContainersSegment(marker, finalOptions.getDetails(), finalOptions.getPrefix(), finalPageSize, + timeout); + }; + return new PagedIterable<>(pageSize -> pageRetriever.apply(null, pageSize), pageRetriever); + + } + + private PagedResponse listBlobContainersSegment(String marker, BlobContainerListDetails details, + String prefix, Integer maxResultsPerPage, Duration timeout) { + // Set up the include types based on the details provided in the options + List include = ModelHelper.toIncludeTypes(details); + + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getServices().listBlobContainersSegmentSinglePage(prefix, marker, maxResultsPerPage, + include, null, null, Context.NONE)); + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -403,7 +496,40 @@ public PagedIterable findBlobsByTags(String query) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable findBlobsByTags(FindBlobsOptions options, Duration timeout, Context context) { - return new PagedIterable<>(blobServiceAsyncClient.findBlobsByTags(options, timeout, context)); + throwOnAnonymousAccess(); + StorageImplUtils.assertNotNull("options", options); + BiFunction> func = (marker, pageSize) -> { + FindBlobsOptions finalOptions = (pageSize != null) + ? new FindBlobsOptions(options.getQuery()).setMaxResultsPerPage(pageSize) : options; + return findBlobsByTagsHelper(finalOptions, marker, timeout, context); + }; + return new PagedIterable<>(pageSize -> func.apply(null, pageSize), func); + } + + private PagedResponse findBlobsByTagsHelper(FindBlobsOptions options, String marker, + Duration timeout, Context context) { + Context finalContext = context == null ? Context.NONE : context; + + StorageImplUtils.assertNotNull("options", options); + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getServices().filterBlobsWithResponse(null, null, options.getQuery(), marker, + options.getMaxResultsPerPage(), null, finalContext)); + + ResponseBase response = + StorageImplUtils.sendRequest(operation, timeout, BlobStorageException.class); + + List value = response.getValue().getBlobs().stream() + .map(ModelHelper::populateTaggedBlobItem) + .collect(Collectors.toList()); + + return new PagedResponseBase<>( + response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + value, + response.getValue().getNextMarker(), + response.getDeserializedHeaders()); } /** @@ -452,10 +578,15 @@ public BlobServiceProperties getProperties() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getPropertiesWithResponse(Duration timeout, Context context) { + Context finalContext = context == null ? Context.NONE : context; + throwOnAnonymousAccess(); + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getServices().getPropertiesWithResponse(null, null, finalContext)); + ResponseBase response = + StorageImplUtils.sendRequest(operation, timeout, BlobStorageException.class); - Mono> response = blobServiceAsyncClient.getPropertiesWithResponse(context); - - return StorageImplUtils.blockWithOptionalTimeout(response, timeout); + return new SimpleResponse<>(response, response.getValue()); } /** @@ -553,9 +684,67 @@ public void setProperties(BlobServiceProperties properties) { @ServiceMethod(returns = ReturnType.SINGLE) public Response setPropertiesWithResponse(BlobServiceProperties properties, Duration timeout, Context context) { - Mono> response = blobServiceAsyncClient.setPropertiesWithResponse(properties, context); + throwOnAnonymousAccess(); + BlobServiceProperties finalProperties; + if (properties != null) { + finalProperties = new BlobServiceProperties(); + + // Logging + finalProperties.setLogging(properties.getLogging()); + if (finalProperties.getLogging() != null) { + StorageImplUtils.assertNotNull("Logging Version", finalProperties.getLogging().getVersion()); + ModelHelper.validateRetentionPolicy(finalProperties.getLogging().getRetentionPolicy(), "Logging Retention Policy"); + } - return StorageImplUtils.blockWithOptionalTimeout(response, timeout); + // Hour Metrics + finalProperties.setHourMetrics(properties.getHourMetrics()); + if (finalProperties.getHourMetrics() != null) { + StorageImplUtils.assertNotNull("HourMetrics Version", finalProperties.getHourMetrics().getVersion()); + ModelHelper.validateRetentionPolicy(finalProperties.getHourMetrics().getRetentionPolicy(), "HourMetrics Retention " + + "Policy"); + if (finalProperties.getHourMetrics().isEnabled()) { + StorageImplUtils.assertNotNull("HourMetrics IncludeApis", + finalProperties.getHourMetrics().isIncludeApis()); + } + } + + // Minute Metrics + finalProperties.setMinuteMetrics(properties.getMinuteMetrics()); + if (finalProperties.getMinuteMetrics() != null) { + StorageImplUtils.assertNotNull("MinuteMetrics Version", + finalProperties.getMinuteMetrics().getVersion()); + ModelHelper.validateRetentionPolicy(finalProperties.getMinuteMetrics().getRetentionPolicy(), "MinuteMetrics " + + "Retention Policy"); + if (finalProperties.getMinuteMetrics().isEnabled()) { + StorageImplUtils.assertNotNull("MinuteMetrics IncludeApis", + finalProperties.getHourMetrics().isIncludeApis()); + } + } + + // CORS + List corsRules = new ArrayList<>(); + for (BlobCorsRule rule : properties.getCors()) { + corsRules.add(ModelHelper.validatedCorsRule(rule)); + } + finalProperties.setCors(corsRules); + + // Default Service Version + finalProperties.setDefaultServiceVersion(properties.getDefaultServiceVersion()); + + // Delete Retention Policy + finalProperties.setDeleteRetentionPolicy(properties.getDeleteRetentionPolicy()); + ModelHelper.validateRetentionPolicy(finalProperties.getDeleteRetentionPolicy(), "DeleteRetentionPolicy Days"); + + // Static Website + finalProperties.setStaticWebsite(properties.getStaticWebsite()); + } else { + finalProperties = null; + } + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getServices().setPropertiesNoCustomHeadersWithResponse(finalProperties, null, null, + finalContext)); + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -602,10 +791,21 @@ public UserDelegationKey getUserDelegationKey(OffsetDateTime start, OffsetDateTi @ServiceMethod(returns = ReturnType.SINGLE) public Response getUserDelegationKeyWithResponse(OffsetDateTime start, OffsetDateTime expiry, Duration timeout, Context context) { - Mono> response = blobServiceAsyncClient.getUserDelegationKeyWithResponse(start, - expiry, context); - - return StorageImplUtils.blockWithOptionalTimeout(response, timeout); + StorageImplUtils.assertNotNull("expiry", expiry); + if (start != null && !start.isBefore(expiry)) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("`start` must be null or a datetime before `expiry`.")); + } + throwOnAnonymousAccess(); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getServices().getUserDelegationKeyWithResponse(new KeyInfo() + .setStart(start == null ? "" : Constants.ISO_8601_UTC_DATE_FORMATTER.format(start)) + .setExpiry(Constants.ISO_8601_UTC_DATE_FORMATTER.format(expiry)), null, null, finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + return new SimpleResponse<>(response, response.getValue()); } /** @@ -651,9 +851,12 @@ public BlobServiceStatistics getStatistics() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getStatisticsWithResponse(Duration timeout, Context context) { - Mono> response = blobServiceAsyncClient.getStatisticsWithResponse(context); - - return StorageImplUtils.blockWithOptionalTimeout(response, timeout); + throwOnAnonymousAccess(); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getServices().getStatisticsWithResponse(null, null, finalContext)); + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -687,9 +890,16 @@ public StorageAccountInfo getAccountInfo() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getAccountInfoWithResponse(Duration timeout, Context context) { - Mono> response = blobServiceAsyncClient.getAccountInfoWithResponse(context); - - return StorageImplUtils.blockWithOptionalTimeout(response, timeout); + throwOnAnonymousAccess(); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getServices().getAccountInfoWithResponse(finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + ServicesGetAccountInfoHeaders hd = response.getDeserializedHeaders(); + return new SimpleResponse<>(response, new StorageAccountInfo(hd.getXMsSkuName(), hd.getXMsAccountKind(), + hd.isXMsIsHnsEnabled())); } /** @@ -698,7 +908,17 @@ public Response getAccountInfoWithResponse(Duration timeout, * @return account name associated with this storage resource. */ public String getAccountName() { - return this.blobServiceAsyncClient.getAccountName(); + return this.accountName; + } + + /** + * Checks if service client was built with credentials. + */ + private void throwOnAnonymousAccess() { + if (anonymousAccess) { + throw LOGGER.logExceptionAsError(new IllegalStateException("Service client cannot be accessed without " + + "credentials")); + } } /** @@ -731,7 +951,7 @@ public String getAccountName() { * @return A {@code String} representing the SAS query parameters. */ public String generateAccountSas(AccountSasSignatureValues accountSasSignatureValues) { - return this.blobServiceAsyncClient.generateAccountSas(accountSasSignatureValues); + return generateAccountSas(accountSasSignatureValues, Context.NONE); } /* TODO(gapra): REST Docs*/ @@ -783,7 +1003,10 @@ public String generateAccountSas(AccountSasSignatureValues accountSasSignatureVa */ public String generateAccountSas(AccountSasSignatureValues accountSasSignatureValues, Consumer stringToSignHandler, Context context) { - return this.blobServiceAsyncClient.generateAccountSas(accountSasSignatureValues, stringToSignHandler, context); + throwOnAnonymousAccess(); + return new AccountSasImplUtil(accountSasSignatureValues, + this.encryptionScope == null ? null : this.encryptionScope.getEncryptionScope()) + .generateSas(SasImplUtils.extractSharedKeyCredential(getHttpPipeline()), stringToSignHandler, context); } /** @@ -851,13 +1074,21 @@ public BlobContainerClient undeleteBlobContainer(String deletedContainerName, St * to interact with the restored container. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response undeleteBlobContainerWithResponse( - UndeleteBlobContainerOptions options, Duration timeout, Context context) { - Mono> response = - this.blobServiceAsyncClient.undeleteBlobContainerWithResponse(options, context) - .map(r -> new SimpleResponse<>(r, getBlobContainerClient(r.getValue().getBlobContainerName()))); - - return StorageImplUtils.blockWithOptionalTimeout(response, timeout); + public Response undeleteBlobContainerWithResponse(UndeleteBlobContainerOptions options, + Duration timeout, Context context) { + StorageImplUtils.assertNotNull("options", options); + boolean hasOptionalDestinationContainerName = options.getDestinationContainerName() != null; + String finalDestinationContainerName = + hasOptionalDestinationContainerName ? options.getDestinationContainerName() + : options.getDeletedContainerName(); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( + () -> + this.azureBlobStorage.getContainers().restoreWithResponse(finalDestinationContainerName, null, null, + options.getDeletedContainerName(), options.getDeletedContainerVersion(), finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + return new SimpleResponse<>(response, getBlobContainerClient(finalDestinationContainerName)); } // /** diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java index 226f3b6dc903d..663ad41d0cbe0 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java @@ -96,6 +96,7 @@ public final class BlobServiceClientBuilder implements private Configuration configuration; private BlobServiceVersion version; private BlobAudience audience; + private boolean anonymousAccess; /** * Creates a builder instance that is able to configure and construct {@link BlobServiceClient BlobServiceClients} @@ -113,7 +114,44 @@ public BlobServiceClientBuilder() { * and {@link #retryOptions(RequestRetryOptions)} have been set. */ public BlobServiceClient buildClient() { - return new BlobServiceClient(buildAsyncClient()); + BuilderHelper.httpsValidation(customerProvidedKey, "customer provided key", endpoint, LOGGER); + + anonymousAccess = false; + + if (Objects.nonNull(customerProvidedKey) && Objects.nonNull(encryptionScope)) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Customer provided key and encryption " + + "scope cannot both be set")); + } + + BlobServiceVersion serviceVersion = version != null ? version : BlobServiceVersion.getLatest(); + HttpPipeline pipeline = constructPipeline(); + + boolean foundCredential = false; + for (int i = 0; i < pipeline.getPolicyCount(); i++) { + if (pipeline.getPolicy(i) instanceof StorageSharedKeyCredentialPolicy) { + foundCredential = true; + break; + } + if (pipeline.getPolicy(i) instanceof BearerTokenAuthenticationPolicy) { + foundCredential = true; + break; + } + if (pipeline.getPolicy(i) instanceof AzureSasCredentialPolicy) { + foundCredential = true; + break; + } + } + anonymousAccess = !foundCredential; + + return new BlobServiceClient(pipeline, endpoint, serviceVersion, accountName, customerProvidedKey, + encryptionScope, blobContainerEncryptionScope, anonymousAccess); + } + + private HttpPipeline constructPipeline() { + return (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline( + storageSharedKeyCredential, tokenCredential, azureSasCredential, sasToken, + endpoint, retryOptions, coreRetryOptions, logOptions, + clientOptions, httpClient, perCallPolicies, perRetryPolicies, configuration, audience, LOGGER); } /** @@ -126,7 +164,7 @@ public BlobServiceClient buildClient() { public BlobServiceAsyncClient buildAsyncClient() { BuilderHelper.httpsValidation(customerProvidedKey, "customer provided key", endpoint, LOGGER); - boolean anonymousAccess = false; + anonymousAccess = false; if (Objects.nonNull(customerProvidedKey) && Objects.nonNull(encryptionScope)) { throw LOGGER.logExceptionAsError(new IllegalArgumentException("Customer provided key and encryption " @@ -134,10 +172,7 @@ public BlobServiceAsyncClient buildAsyncClient() { } BlobServiceVersion serviceVersion = version != null ? version : BlobServiceVersion.getLatest(); - HttpPipeline pipeline = (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline( - storageSharedKeyCredential, tokenCredential, azureSasCredential, sasToken, - endpoint, retryOptions, coreRetryOptions, logOptions, - clientOptions, httpClient, perCallPolicies, perRetryPolicies, configuration, audience, LOGGER); + HttpPipeline pipeline = constructPipeline(); boolean foundCredential = false; for (int i = 0; i < pipeline.getPolicyCount(); i++) { 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 70bcd8fc25ce2..eefcbfced4a74 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 @@ -128,6 +128,60 @@ Mono> createNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, @HeaderParam("x-ms-legal-hold") Boolean legalHold, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase createSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @HeaderParam("x-ms-blob-type") String blobType, @QueryParam("timeout") Integer timeout, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response createNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @HeaderParam("x-ms-blob-type") String blobType, @QueryParam("timeout") Integer timeout, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -220,6 +274,52 @@ Mono> appendBlockNoCustomHeaders(@HostParam("url") String url, @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase appendBlockSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, + @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response appendBlockNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, + @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, + Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -278,6 +378,64 @@ Mono> appendBlockFromUrlNoCustomHeaders(@HostParam("url") String @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase appendBlockFromUrlSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-copy-source") String sourceUrl, + @HeaderParam("x-ms-source-range") String sourceRange, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @QueryParam("timeout") Integer timeout, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, + @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response appendBlockFromUrlNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-copy-source") String sourceUrl, + @HeaderParam("x-ms-source-range") String sourceRange, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @QueryParam("timeout") Integer timeout, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, + @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -305,6 +463,34 @@ Mono> sealNoCustomHeaders(@HostParam("url") String url, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase sealSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response sealNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @HeaderParam("Accept") String accept, + Context context); } /** @@ -861,28 +1047,21 @@ public Mono> createNoCustomHeadersWithResponseAsync(String contai } /** - * 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. + * 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. - * @param body Initial data. * @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>. - * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. - * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. - * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append - * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value - * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - - * Precondition Failed). - * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating - * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it - * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition - * Failed). * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the * specified date/time. * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since @@ -892,21 +1071,58 @@ public Mono> createNoCustomHeadersWithResponseAsync(String contai * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. * @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 blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. + * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> appendBlockWithResponseAsync(String containerName, - String blob, long contentLength, Flux body, Integer timeout, byte[] transactionalContentMD5, - byte[] transactionalContentCrc64, String leaseId, Long maxSize, Long appendPosition, + public ResponseBase createWithResponse(String containerName, String blob, + long contentLength, Integer timeout, Map metadata, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, - String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { - final String comp = "appendblock"; + String ifTags, String requestId, String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, BlobHttpHeaders blobHttpHeaders, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String blobType = "AppendBlob"; final String accept = "application/xml"; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; String encryptionKeyInternal = null; if (cpkInfo != null) { encryptionKeyInternal = cpkInfo.getEncryptionKey(); @@ -927,19 +1143,268 @@ public Mono> appendBlockWithRe encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); } String encryptionScope = encryptionScopeInternal; - String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); - String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + String contentMd5Converted = Base64Util.encodeToString(contentMd5); DateTimeRfc1123 ifModifiedSinceConverted = 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + try { + return service.createSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @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>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void create(String containerName, String blob, long contentLength, Integer timeout, + Map metadata, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + createWithResponse(containerName, blob, contentLength, timeout, metadata, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, + immutabilityPolicyMode, legalHold, blobHttpHeaders, cpkInfo, encryptionScopeParam, Context.NONE); + } + + /** + * 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. + * @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>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createNoCustomHeadersWithResponse(String containerName, String blob, long contentLength, + Integer timeout, Map metadata, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, BlobHttpHeaders blobHttpHeaders, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String blobType = "AppendBlob"; + final String accept = "application/xml"; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + try { + return service.createNoCustomHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @param body Initial data. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> appendBlockWithResponseAsync(String containerName, + String blob, long contentLength, Flux body, Integer timeout, byte[] transactionalContentMD5, + byte[] transactionalContentCrc64, String leaseId, Long maxSize, Long appendPosition, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + final String comp = "appendblock"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = 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)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -1729,22 +2194,19 @@ public Mono> appendBlockNoCustomHeadersWithResponseAsync(String c } /** - * 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. + * 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 sourceUrl Specify a URL to the copy source. * @param contentLength The length of the request. - * @param sourceRange Bytes of source data in the specified range. - * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. - * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy - * source. + * @param body Initial data. * @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>. * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value @@ -1761,10 +2223,231 @@ public Mono> appendBlockNoCustomHeadersWithResponseAsync(String c * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since - * the specified date/time. - * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified - * since the specified date/time. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase appendBlockWithResponse(String containerName, String blob, + long contentLength, BinaryData body, Integer timeout, byte[] transactionalContentMD5, + byte[] transactionalContentCrc64, String leaseId, Long maxSize, Long appendPosition, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String comp = "appendblock"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.appendBlockSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @param body Initial data. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void appendBlock(String containerName, String blob, long contentLength, BinaryData body, Integer timeout, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String leaseId, Long maxSize, + Long appendPosition, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + appendBlockWithResponse(containerName, blob, contentLength, body, timeout, transactionalContentMD5, + transactionalContentCrc64, leaseId, maxSize, appendPosition, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, Context.NONE); + } + + /** + * 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. + * @param body Initial data. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response appendBlockNoCustomHeadersWithResponse(String containerName, String blob, long contentLength, + BinaryData body, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, + String leaseId, Long maxSize, Long appendPosition, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String comp = "appendblock"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.appendBlockNoCustomHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @param contentLength The length of the request. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the @@ -2269,40 +2952,314 @@ public Mono> appendBlockFromUrlNoCustomHeadersWithResponseAsync(S } /** - * The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 - * version or later. + * 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. + * @param contentLength The length of the request. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. * @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>. - * @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 transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the * specified date/time. * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since * the specified date/time. * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. - * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating - * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it - * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition - * Failed). + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sealWithResponseAsync(String containerName, String blob, - Integer timeout, String requestId, String leaseId, OffsetDateTime ifModifiedSince, - OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, Long appendPosition) { - final String comp = "seal"; + public ResponseBase appendBlockFromUrlWithResponse(String containerName, + String blob, String sourceUrl, long contentLength, String sourceRange, byte[] sourceContentMD5, + byte[] sourceContentcrc64, Integer timeout, byte[] transactionalContentMD5, String leaseId, Long maxSize, + Long appendPosition, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String comp = "appendblock"; final String accept = "application/xml"; - DateTimeRfc1123 ifModifiedSinceConverted - = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + try { + return service.appendBlockFromUrlSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @param contentLength The length of the request. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void appendBlockFromUrl(String containerName, String blob, String sourceUrl, long contentLength, + String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, + byte[] transactionalContentMD5, String leaseId, Long maxSize, Long appendPosition, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + appendBlockFromUrlWithResponse(containerName, blob, sourceUrl, contentLength, sourceRange, sourceContentMD5, + sourceContentcrc64, timeout, transactionalContentMD5, leaseId, maxSize, appendPosition, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, + sourceIfMatch, sourceIfNoneMatch, requestId, copySourceAuthorization, cpkInfo, encryptionScopeParam, + Context.NONE); + } + + /** + * 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. + * @param contentLength The length of the request. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param maxSize Optional conditional header. The max length in bytes permitted for the append blob. If the Append + * Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value + * specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - + * Precondition Failed). + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response appendBlockFromUrlNoCustomHeadersWithResponse(String containerName, String blob, + String sourceUrl, long contentLength, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, + Integer timeout, byte[] transactionalContentMD5, String leaseId, Long maxSize, Long appendPosition, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String comp = "appendblock"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + try { + return service.appendBlockFromUrlNoCustomHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sealWithResponseAsync(String containerName, String blob, + Integer timeout, String requestId, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, Long appendPosition) { + final String comp = "seal"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); return FluxUtil @@ -2520,4 +3477,132 @@ public Mono> sealNoCustomHeadersWithResponseAsync(String containe 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase sealWithResponse(String containerName, String blob, + Integer timeout, String requestId, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, Long appendPosition, Context context) { + final String comp = "seal"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.sealSync(this.client.getUrl(), containerName, blob, comp, timeout, this.client.getVersion(), + requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, + appendPosition, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void seal(String containerName, String blob, Integer timeout, String requestId, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + Long appendPosition) { + sealWithResponse(containerName, blob, timeout, requestId, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, appendPosition, Context.NONE); + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param appendPosition Optional conditional header, used only for the Append Block operation. A number indicating + * the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it + * is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition + * Failed). + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sealNoCustomHeadersWithResponse(String containerName, String blob, Integer timeout, + String requestId, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, Long appendPosition, Context context) { + final String comp = "seal"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.sealNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + ifMatch, ifNoneMatch, appendPosition, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } } 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 c5770824b839e..7e9b7354bc7d3 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 @@ -65,6 +65,7 @@ import com.azure.storage.blob.models.DeleteSnapshotsOptionType; import com.azure.storage.blob.models.EncryptionAlgorithmType; import com.azure.storage.blob.models.RehydratePriority; +import java.io.InputStream; import java.nio.ByteBuffer; import java.time.OffsetDateTime; import java.util.Map; @@ -145,6 +146,46 @@ Mono downloadNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Get("/{containerName}/{blob}") + @ExpectedResponses({ 200, 206 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase downloadSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-range-get-content-md5") Boolean rangeGetContentMD5, + @HeaderParam("x-ms-range-get-content-crc64") Boolean rangeGetContentCRC64, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Get("/{containerName}/{blob}") + @ExpectedResponses({ 200, 206 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response downloadNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-range-get-content-md5") Boolean rangeGetContentMD5, + @HeaderParam("x-ms-range-get-content-crc64") Boolean rangeGetContentCRC64, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + @Head("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -179,6 +220,40 @@ Mono> getPropertiesNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Head("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase getPropertiesSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Head("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response getPropertiesNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + @Delete("/{containerName}/{blob}") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -211,6 +286,38 @@ Mono> deleteNoCustomHeaders(@HostParam("url") String url, @QueryParam("deletetype") BlobDeleteType blobDeleteType, @HeaderParam("Accept") String accept, Context context); + @Delete("/{containerName}/{blob}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase deleteSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @QueryParam("deletetype") BlobDeleteType blobDeleteType, @HeaderParam("Accept") String accept, + Context context); + + @Delete("/{containerName}/{blob}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response deleteNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @QueryParam("deletetype") BlobDeleteType blobDeleteType, @HeaderParam("Accept") String accept, + Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -229,6 +336,24 @@ Mono> undeleteNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase undeleteSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response undeleteNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -249,6 +374,26 @@ Mono> setExpiryNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-expiry-option") BlobExpiryOptions expiryOptions, @HeaderParam("x-ms-expiry-time") String expiresOn, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase setExpirySync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-expiry-option") BlobExpiryOptions expiryOptions, + @HeaderParam("x-ms-expiry-time") String expiresOn, @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response setExpiryNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-expiry-option") BlobExpiryOptions expiryOptions, + @HeaderParam("x-ms-expiry-time") String expiresOn, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -289,6 +434,46 @@ Mono> setHttpHeadersNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase setHttpHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response setHttpHeadersNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -313,6 +498,30 @@ Mono> setImmutabilityPolicyNoCustomHeaders(@HostParam("url") Stri @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase setImmutabilityPolicySync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response setImmutabilityPolicyNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("Accept") String accept, Context context); + @Delete("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -331,6 +540,24 @@ Mono> deleteImmutabilityPolicyNoCustomHeaders(@HostParam("url") S @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Delete("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase deleteImmutabilityPolicySync( + @HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Delete("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response deleteImmutabilityPolicyNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -349,6 +576,24 @@ Mono> setLegalHoldNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-legal-hold") boolean legalHold, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase setLegalHoldSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-legal-hold") boolean legalHold, @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response setLegalHoldNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-legal-hold") boolean legalHold, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -386,13 +631,16 @@ Mono> setMetadataNoCustomHeaders(@HostParam("url") String url, Context context); @Put("/{containerName}/{blob}") - @ExpectedResponses({ 201 }) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> acquireLease(@HostParam("url") String url, + ResponseBase setMetadataSync(@HostParam("url") String url, @PathParam("containerName") String containerName, @PathParam("blob") String blob, - @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-duration") Integer duration, - @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @@ -401,13 +649,16 @@ Mono> acquireLease(@HostParam("url" Context context); @Put("/{containerName}/{blob}") - @ExpectedResponses({ 201 }) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> acquireLeaseNoCustomHeaders(@HostParam("url") String url, + Response setMetadataNoCustomHeadersSync(@HostParam("url") String url, @PathParam("containerName") String containerName, @PathParam("blob") String blob, - @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-duration") Integer duration, - @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @@ -416,13 +667,73 @@ Mono> acquireLeaseNoCustomHeaders(@HostParam("url") String url, Context context); @Put("/{containerName}/{blob}") - @ExpectedResponses({ 200 }) + @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> releaseLease(@HostParam("url") String url, + Mono> acquireLease(@HostParam("url") String url, @PathParam("containerName") String containerName, @PathParam("blob") String blob, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-duration") Integer duration, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Mono> acquireLeaseNoCustomHeaders(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-duration") Integer duration, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase acquireLeaseSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-duration") Integer duration, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response acquireLeaseNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-duration") Integer duration, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Mono> releaseLease(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, @@ -443,6 +754,34 @@ Mono> releaseLeaseNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase releaseLeaseSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response releaseLeaseNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -471,6 +810,34 @@ Mono> renewLeaseNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase renewLeaseSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response renewLeaseNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -501,6 +868,36 @@ Mono> changeLeaseNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase changeLeaseSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response changeLeaseNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -529,6 +926,34 @@ Mono> breakLeaseNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase breakLeaseSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-break-period") Integer breakPeriod, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response breakLeaseNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-break-period") Integer breakPeriod, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -565,6 +990,42 @@ Mono> createSnapshotNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase createSnapshotSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-meta-") Map metadata, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response createSnapshotNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-meta-") Map metadata, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -616,7 +1077,109 @@ Mono> startCopyFromURLNoCustomHeaders(@HostParam("url") String ur @Put("/{containerName}/{blob}") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> copyFromURL(@HostParam("url") String url, + ResponseBase startCopyFromURLSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("x-ms-rehydrate-priority") RehydratePriority rehydratePriority, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-source-if-tags") String sourceIfTags, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-copy-source") String copySource, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-seal-blob") Boolean sealBlob, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response startCopyFromURLNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("x-ms-rehydrate-priority") RehydratePriority rehydratePriority, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-source-if-tags") String sourceIfTags, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-copy-source") String copySource, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-seal-blob") Boolean sealBlob, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Mono> copyFromURL(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @HeaderParam("x-ms-requires-sync") String xMsRequiresSync, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-copy-source") String copySource, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-copy-source-tag-option") BlobCopySourceTagsMode copySourceTags, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Mono> copyFromURLNoCustomHeaders(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @HeaderParam("x-ms-requires-sync") String xMsRequiresSync, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-copy-source") String copySource, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-copy-source-tag-option") BlobCopySourceTagsMode copySourceTags, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase copyFromURLSync(@HostParam("url") String url, @PathParam("containerName") String containerName, @PathParam("blob") String blob, @HeaderParam("x-ms-requires-sync") String xMsRequiresSync, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTier tier, @@ -643,7 +1206,7 @@ Mono> copyFromURL(@HostParam("url") @Put("/{containerName}/{blob}") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> copyFromURLNoCustomHeaders(@HostParam("url") String url, + Response copyFromURLNoCustomHeadersSync(@HostParam("url") String url, @PathParam("containerName") String containerName, @PathParam("blob") String blob, @HeaderParam("x-ms-requires-sync") String xMsRequiresSync, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTier tier, @@ -689,6 +1252,28 @@ Mono> abortCopyFromURLNoCustomHeaders(@HostParam("url") String ur @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase abortCopyFromURLSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-copy-action") String copyActionAbortConstant, + @QueryParam("copyid") String copyId, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response abortCopyFromURLNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-copy-action") String copyActionAbortConstant, + @QueryParam("copyid") String copyId, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -715,6 +1300,32 @@ Mono> setTierNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase setTierSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("x-ms-rehydrate-priority") RehydratePriority rehydratePriority, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response setTierNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("x-ms-rehydrate-priority") RehydratePriority rehydratePriority, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("Accept") String accept, Context context); + @Get("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -731,6 +1342,22 @@ Mono> getAccountInfoNoCustomHeaders(@HostParam("url") String url, @QueryParam("restype") String restype, @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept, Context context); + @Get("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase getAccountInfoSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response getAccountInfoNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept, Context context); + @Post("/{containerName}/{blob}") @ExpectedResponses({ 200, 206 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -767,6 +1394,42 @@ Mono queryNoCustomHeaders(@HostParam("url") String url, @BodyParam("application/xml") QueryRequest queryRequest, @HeaderParam("Accept") String accept, Context context); + @Post("/{containerName}/{blob}") + @ExpectedResponses({ 200, 206 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase querySync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/xml") QueryRequest queryRequest, @HeaderParam("Accept") String accept, + Context context); + + @Post("/{containerName}/{blob}") + @ExpectedResponses({ 200, 206 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response queryNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/xml") QueryRequest queryRequest, @HeaderParam("Accept") String accept, + Context context); + @Get("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -789,6 +1452,28 @@ Mono> getTagsNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("Accept") String accept, Context context); + @Get("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase getTagsSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response getTagsNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -814,6 +1499,32 @@ Mono> setTagsNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-lease-id") String leaseId, @BodyParam("application/xml") BlobTags tags, @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase setTagsSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @QueryParam("timeout") Integer timeout, @QueryParam("versionid") String versionId, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-lease-id") String leaseId, @BodyParam("application/xml") BlobTags tags, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response setTagsNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @QueryParam("timeout") Integer timeout, @QueryParam("versionid") String versionId, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-lease-id") String leaseId, @BodyParam("application/xml") BlobTags tags, + @HeaderParam("Accept") String accept, Context context); } /** @@ -1039,18 +1750,157 @@ public Flux downloadAsync(String containerName, String blob, String * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 response. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Flux downloadAsync(String containerName, String blob, String snapshot, String versionId, + Integer timeout, String range, String leaseId, Boolean rangeGetContentMD5, Boolean rangeGetContentCRC64, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + 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) + .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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param rangeGetContentMD5 When set to true and specified together with the Range, the service returns the MD5 + * hash for the range, as long as the range is less than or equal to 4 MB in size. + * @param rangeGetContentCRC64 When set to true and specified together with the Range, the service returns the CRC64 + * hash for the range, as long as the range is less than or equal to 4 MB in size. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono downloadNoCustomHeadersWithResponseAsync(String containerName, String blob, + String snapshot, String versionId, Integer timeout, String range, String leaseId, Boolean rangeGetContentMD5, + Boolean rangeGetContentCRC64, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo) { + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = 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)) + .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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param rangeGetContentMD5 When set to true and specified together with the Range, the service returns the MD5 + * hash for the range, as long as the range is less than or equal to 4 MB in size. + * @param rangeGetContentCRC64 When set to true and specified together with the Range, the service returns the CRC64 + * hash for the range, as long as the range is less than or equal to 4 MB in size. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Flux downloadAsync(String containerName, String blob, String snapshot, String versionId, - Integer timeout, String range, String leaseId, Boolean rangeGetContentMD5, Boolean rangeGetContentCRC64, - OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, - 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMapMany(fluxByteBufferResponse -> fluxByteBufferResponse.getValue()); + public Mono downloadNoCustomHeadersWithResponseAsync(String containerName, String blob, + String snapshot, String versionId, Integer timeout, String range, String leaseId, Boolean rangeGetContentMD5, + Boolean rangeGetContentCRC64, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, Context context) { + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = 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) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -1084,16 +1934,17 @@ public Flux downloadAsync(String containerName, String blob, String * @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 cpkInfo Parameter group. + * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. + * @return the response body along with {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono downloadNoCustomHeadersWithResponseAsync(String containerName, String blob, + public ResponseBase downloadWithResponse(String containerName, String blob, String snapshot, String versionId, Integer timeout, String range, String leaseId, Boolean rangeGetContentMD5, Boolean rangeGetContentCRC64, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, - String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo) { + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, Context context) { final String accept = "application/xml"; String encryptionKeyInternal = null; if (cpkInfo != null) { @@ -1114,12 +1965,64 @@ 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.downloadSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param rangeGetContentMD5 When set to true and specified together with the Range, the service returns the MD5 + * hash for the range, as long as the range is less than or equal to 4 MB in size. + * @param rangeGetContentCRC64 When set to true and specified together with the Range, the service returns the CRC64 + * hash for the range, as long as the range is less than or equal to 4 MB in size. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InputStream download(String containerName, String blob, String snapshot, String versionId, Integer timeout, + String range, String leaseId, Boolean rangeGetContentMD5, Boolean rangeGetContentCRC64, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, CpkInfo cpkInfo) { + try { + return downloadWithResponse(containerName, blob, snapshot, versionId, timeout, range, leaseId, + rangeGetContentMD5, rangeGetContentCRC64, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, requestId, cpkInfo, Context.NONE).getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -1157,11 +2060,11 @@ public Mono downloadNoCustomHeadersWithResponseAsync(String cont * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 response body on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono downloadNoCustomHeadersWithResponseAsync(String containerName, String blob, - String snapshot, String versionId, Integer timeout, String range, String leaseId, Boolean rangeGetContentMD5, + public Response downloadNoCustomHeadersWithResponse(String containerName, String blob, String snapshot, + String versionId, Integer timeout, String range, String leaseId, Boolean rangeGetContentMD5, Boolean rangeGetContentCRC64, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, Context context) { final String accept = "application/xml"; @@ -1184,12 +2087,14 @@ 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, + try { + return service.downloadNoCustomHeadersSync(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); + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -1533,6 +2438,178 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String .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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase getPropertiesWithResponse(String containerName, String blob, + String snapshot, String versionId, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + CpkInfo cpkInfo, Context context) { + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.getPropertiesSync(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, + leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, + context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void getProperties(String containerName, String blob, String snapshot, String versionId, Integer timeout, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo) { + getPropertiesWithResponse(containerName, blob, snapshot, versionId, timeout, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, Context.NONE); + } + + /** + * 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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPropertiesNoCustomHeadersWithResponse(String containerName, String blob, String snapshot, + String versionId, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + CpkInfo cpkInfo, Context context) { + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), containerName, blob, snapshot, + versionId, timeout, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed * from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, @@ -1914,6 +2991,198 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String contai .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } + /** + * If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed + * from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, + * it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or + * snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] + * (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently + * removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until + * it is permanently removed. Use the List Blobs API and specify the "include=deleted" query parameter to discover + * which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a + * soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP + * status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when + * a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other + * operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access + * 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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param deleteSnapshots Required if the blob has associated snapshots. Specify one of the following two options: + * include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob + * itself. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 blobDeleteType Optional. Only possible value is 'permanent', which specifies to permanently delete a blob + * if blob soft delete is enabled. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase deleteWithResponse(String containerName, String blob, String snapshot, + String versionId, Integer timeout, String leaseId, DeleteSnapshotsOptionType deleteSnapshots, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, BlobDeleteType blobDeleteType, Context context) { + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.deleteSync(this.client.getUrl(), containerName, blob, snapshot, versionId, timeout, leaseId, + deleteSnapshots, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, blobDeleteType, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed + * from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, + * it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or + * snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] + * (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently + * removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until + * it is permanently removed. Use the List Blobs API and specify the "include=deleted" query parameter to discover + * which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a + * soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP + * status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when + * a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other + * operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access + * 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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param deleteSnapshots Required if the blob has associated snapshots. Specify one of the following two options: + * include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob + * itself. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 blobDeleteType Optional. Only possible value is 'permanent', which specifies to permanently delete a blob + * if blob soft delete is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String containerName, String blob, String snapshot, String versionId, Integer timeout, + String leaseId, DeleteSnapshotsOptionType deleteSnapshots, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + BlobDeleteType blobDeleteType) { + deleteWithResponse(containerName, blob, snapshot, versionId, timeout, leaseId, deleteSnapshots, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobDeleteType, Context.NONE); + } + + /** + * If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed + * from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, + * it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or + * snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] + * (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently + * removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until + * it is permanently removed. Use the List Blobs API and specify the "include=deleted" query parameter to discover + * which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a + * soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP + * status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when + * a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other + * operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access + * 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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param deleteSnapshots Required if the blob has associated snapshots. Specify one of the following two options: + * include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob + * itself. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 blobDeleteType Optional. Only possible value is 'permanent', which specifies to permanently delete a blob + * if blob soft delete is enabled. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteNoCustomHeadersWithResponse(String containerName, String blob, String snapshot, + String versionId, Integer timeout, String leaseId, DeleteSnapshotsOptionType deleteSnapshots, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, BlobDeleteType blobDeleteType, Context context) { + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.deleteNoCustomHeadersSync(this.client.getUrl(), containerName, blob, snapshot, versionId, + timeout, leaseId, deleteSnapshots, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, this.client.getVersion(), requestId, blobDeleteType, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * Undelete a blob that was previously soft deleted. * @@ -2026,17 +3295,92 @@ public Mono undeleteAsync(String containerName, String blob, Integer timeo * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> undeleteNoCustomHeadersWithResponseAsync(String containerName, String blob, + 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)) + .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> undeleteNoCustomHeadersWithResponseAsync(String containerName, String blob, + 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) + .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase undeleteWithResponse(String containerName, String blob, + Integer timeout, String requestId, Context context) { + final String comp = "undelete"; + final String accept = "application/xml"; + try { + return service.undeleteSync(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> undeleteNoCustomHeadersWithResponseAsync(String containerName, String blob, - 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + public void undelete(String containerName, String blob, Integer timeout, String requestId) { + undeleteWithResponse(containerName, blob, timeout, requestId, Context.NONE); } /** @@ -2053,17 +3397,19 @@ public Mono> undeleteNoCustomHeadersWithResponseAsync(String cont * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> undeleteNoCustomHeadersWithResponseAsync(String containerName, String blob, - Integer timeout, String requestId, Context context) { + public Response undeleteNoCustomHeadersWithResponse(String containerName, String blob, 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.undeleteNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -2231,6 +3577,90 @@ public Mono> setExpiryNoCustomHeadersWithResponseAsync(String con .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. + * @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>. + * @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 expiresOn The time to set the blob to expiry. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase setExpiryWithResponse(String containerName, String blob, + BlobExpiryOptions expiryOptions, Integer timeout, String requestId, String expiresOn, Context context) { + final String comp = "expiry"; + final String accept = "application/xml"; + try { + return service.setExpirySync(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @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>. + * @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 expiresOn The time to set the blob to expiry. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void setExpiry(String containerName, String blob, BlobExpiryOptions expiryOptions, Integer timeout, + String requestId, String expiresOn) { + setExpiryWithResponse(containerName, blob, expiryOptions, timeout, requestId, expiresOn, Context.NONE); + } + + /** + * 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. + * @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>. + * @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 expiresOn The time to set the blob to expiry. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setExpiryNoCustomHeadersWithResponse(String containerName, String blob, + BlobExpiryOptions expiryOptions, Integer timeout, String requestId, String expiresOn, Context context) { + final String comp = "expiry"; + final String accept = "application/xml"; + try { + return service.setExpiryNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, expiryOptions, expiresOn, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * The Set HTTP Headers operation sets system properties on the blob. * @@ -2436,46 +3866,196 @@ public Mono setHttpHeadersAsync(String containerName, String blob, Integer * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 setHttpHeadersAsync(String containerName, String blob, Integer timeout, String leaseId, - OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, - 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 - * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting - * Timeouts for Blob Service Operations.</a>. - * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. - * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the - * specified date/time. - * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since - * the specified date/time. - * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. - * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. - * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - * @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 blobHttpHeaders Parameter group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @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}. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setHttpHeadersAsync(String containerName, String blob, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 blobHttpHeaders Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setHttpHeadersNoCustomHeadersWithResponseAsync(String containerName, String blob, + Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, BlobHttpHeaders blobHttpHeaders) { + final String comp = "properties"; + final String accept = "application/xml"; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + DateTimeRfc1123 ifModifiedSinceConverted + = 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)) + .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 blobHttpHeaders Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setHttpHeadersNoCustomHeadersWithResponseAsync(String containerName, String blob, + Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, BlobHttpHeaders blobHttpHeaders, + Context context) { + final String comp = "properties"; + final String accept = "application/xml"; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + DateTimeRfc1123 ifModifiedSinceConverted + = 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) + .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 blobHttpHeaders Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setHttpHeadersNoCustomHeadersWithResponseAsync(String containerName, String blob, + public ResponseBase setHttpHeadersWithResponse(String containerName, String blob, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, - String ifMatch, String ifNoneMatch, String ifTags, String requestId, BlobHttpHeaders blobHttpHeaders) { + String ifMatch, String ifNoneMatch, String ifTags, String requestId, BlobHttpHeaders blobHttpHeaders, + Context context) { final String comp = "properties"; final String accept = "application/xml"; String cacheControlInternal = null; @@ -2513,12 +4093,45 @@ 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.setHttpHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 blobHttpHeaders Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void setHttpHeaders(String containerName, String blob, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, BlobHttpHeaders blobHttpHeaders) { + setHttpHeadersWithResponse(containerName, blob, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, blobHttpHeaders, Context.NONE); } /** @@ -2544,13 +4157,12 @@ public Mono> setHttpHeadersNoCustomHeadersWithResponseAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setHttpHeadersNoCustomHeadersWithResponseAsync(String containerName, String blob, - Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, - String ifMatch, String ifNoneMatch, String ifTags, String requestId, BlobHttpHeaders blobHttpHeaders, - Context context) { + public Response setHttpHeadersNoCustomHeadersWithResponse(String containerName, String blob, Integer timeout, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, BlobHttpHeaders blobHttpHeaders, Context context) { final String comp = "properties"; final String accept = "application/xml"; String cacheControlInternal = null; @@ -2588,12 +4200,14 @@ 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.setHttpHeadersNoCustomHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -2801,6 +4415,110 @@ public Mono> setImmutabilityPolicyNoCustomHeadersWithResponseAsyn .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase setImmutabilityPolicyWithResponse(String containerName, + String blob, Integer timeout, String requestId, OffsetDateTime ifUnmodifiedSince, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Context context) { + final String comp = "immutabilityPolicies"; + final String accept = "application/xml"; + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + try { + return service.setImmutabilityPolicySync(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, ifUnmodifiedSinceConverted, immutabilityPolicyExpiryConverted, + immutabilityPolicyMode, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void setImmutabilityPolicy(String containerName, String blob, Integer timeout, String requestId, + OffsetDateTime ifUnmodifiedSince, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode) { + setImmutabilityPolicyWithResponse(containerName, blob, timeout, requestId, ifUnmodifiedSince, + immutabilityPolicyExpiry, immutabilityPolicyMode, Context.NONE); + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setImmutabilityPolicyNoCustomHeadersWithResponse(String containerName, String blob, + Integer timeout, String requestId, OffsetDateTime ifUnmodifiedSince, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Context context) { + final String comp = "immutabilityPolicies"; + final String accept = "application/xml"; + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + try { + return service.setImmutabilityPolicyNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, + timeout, this.client.getVersion(), requestId, ifUnmodifiedSinceConverted, + immutabilityPolicyExpiryConverted, immutabilityPolicyMode, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * The Delete Immutability Policy operation deletes the immutability policy on the blob. * @@ -2914,17 +4632,92 @@ public Mono deleteImmutabilityPolicyAsync(String containerName, String blo * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteImmutabilityPolicyNoCustomHeadersWithResponseAsync(String containerName, + 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)) + .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteImmutabilityPolicyNoCustomHeadersWithResponseAsync(String containerName, + 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) + .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase deleteImmutabilityPolicyWithResponse( + String containerName, String blob, Integer timeout, String requestId, Context context) { + final String comp = "immutabilityPolicies"; + final String accept = "application/xml"; + try { + return service.deleteImmutabilityPolicySync(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteImmutabilityPolicyNoCustomHeadersWithResponseAsync(String containerName, - 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + public void deleteImmutabilityPolicy(String containerName, String blob, Integer timeout, String requestId) { + deleteImmutabilityPolicyWithResponse(containerName, blob, timeout, requestId, Context.NONE); } /** @@ -2941,17 +4734,19 @@ public Mono> deleteImmutabilityPolicyNoCustomHeadersWithResponseA * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteImmutabilityPolicyNoCustomHeadersWithResponseAsync(String containerName, - String blob, Integer timeout, String requestId, Context context) { + public Response deleteImmutabilityPolicyNoCustomHeadersWithResponse(String containerName, 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.deleteImmutabilityPolicyNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, + timeout, this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -3113,6 +4908,86 @@ public Mono> setLegalHoldNoCustomHeadersWithResponseAsync(String .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. + * @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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase setLegalHoldWithResponse(String containerName, String blob, + boolean legalHold, Integer timeout, String requestId, Context context) { + final String comp = "legalhold"; + final String accept = "application/xml"; + try { + return service.setLegalHoldSync(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, legalHold, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @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>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void setLegalHold(String containerName, String blob, boolean legalHold, Integer timeout, String requestId) { + setLegalHoldWithResponse(containerName, blob, legalHold, timeout, requestId, Context.NONE); + } + + /** + * 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. + * @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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setLegalHoldNoCustomHeadersWithResponse(String containerName, String blob, boolean legalHold, + Integer timeout, String requestId, Context context) { + final String comp = "legalhold"; + final String accept = "application/xml"; + try { + return service.setLegalHoldNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, legalHold, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value * pairs. @@ -3444,13 +5319,198 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String c * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setMetadataNoCustomHeadersWithResponseAsync(String containerName, String blob, + Integer timeout, Map metadata, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String comp = "metadata"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = 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) + .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase setMetadataWithResponse(String containerName, String blob, + Integer timeout, Map metadata, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String comp = "metadata"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.setMetadataSync(this.client.getUrl(), containerName, blob, comp, timeout, metadata, leaseId, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, + context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void setMetadata(String containerName, String blob, Integer timeout, Map metadata, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + setMetadataWithResponse(containerName, blob, timeout, metadata, leaseId, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, Context.NONE); + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setMetadataNoCustomHeadersWithResponseAsync(String containerName, String blob, - Integer timeout, Map metadata, String leaseId, OffsetDateTime ifModifiedSince, - OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, - CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + public Response setMetadataNoCustomHeadersWithResponse(String containerName, String blob, Integer timeout, + Map metadata, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, Context context) { final String comp = "metadata"; final String accept = "application/xml"; String encryptionKeyInternal = null; @@ -3477,12 +5537,14 @@ 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.setMetadataNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, timeout, + metadata, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -3750,6 +5812,140 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase acquireLeaseWithResponse(String containerName, String blob, + Integer timeout, Integer duration, String proposedLeaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + Context context) { + final String comp = "lease"; + final String action = "acquire"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.acquireLeaseSync(this.client.getUrl(), containerName, blob, comp, action, timeout, duration, + proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * [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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void acquireLease(String containerName, String blob, Integer timeout, Integer duration, + String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId) { + acquireLeaseWithResponse(containerName, blob, timeout, duration, proposedLeaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, Context.NONE); + } + + /** + * [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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response acquireLeaseNoCustomHeadersWithResponse(String containerName, String blob, Integer timeout, + Integer duration, String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, Context context) { + final String comp = "lease"; + final String action = "acquire"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.acquireLeaseNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, action, + timeout, duration, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. * @@ -3891,13 +6087,140 @@ public Mono releaseLeaseAsync(String containerName, String blob, String le * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono releaseLeaseAsync(String containerName, String blob, String leaseId, Integer timeout, - 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(ignored -> Mono.empty()); + public Mono releaseLeaseAsync(String containerName, String blob, String leaseId, Integer timeout, + 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) + .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. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String containerName, String blob, + String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId) { + final String comp = "lease"; + final String action = "release"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = 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)) + .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. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String containerName, String blob, + String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, Context context) { + final String comp = "lease"; + final String action = "release"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = 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) + .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. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase releaseLeaseWithResponse(String containerName, String blob, + String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, Context context) { + final String comp = "lease"; + final String action = "release"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.releaseLeaseSync(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -3921,24 +6244,13 @@ public Mono releaseLeaseAsync(String containerName, String blob, String le * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String containerName, String blob, - String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, - String ifMatch, String ifNoneMatch, String ifTags, String requestId) { - final String comp = "lease"; - final String action = "release"; - final String accept = "application/xml"; - DateTimeRfc1123 ifModifiedSinceConverted - = 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + public void releaseLease(String containerName, String blob, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + releaseLeaseWithResponse(containerName, blob, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, Context.NONE); } /** @@ -3963,12 +6275,12 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String containerName, String blob, - String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, - String ifMatch, String ifNoneMatch, String ifTags, String requestId, Context context) { + public Response releaseLeaseNoCustomHeadersWithResponse(String containerName, String blob, String leaseId, + Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, Context context) { final String comp = "lease"; final String action = "release"; final String accept = "application/xml"; @@ -3976,11 +6288,13 @@ 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.releaseLeaseNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, action, + timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -4216,6 +6530,124 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String co .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. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase renewLeaseWithResponse(String containerName, String blob, + String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, Context context) { + final String comp = "lease"; + final String action = "renew"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.renewLeaseSync(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * [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. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void renewLease(String containerName, String blob, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + renewLeaseWithResponse(containerName, blob, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, Context.NONE); + } + + /** + * [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. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renewLeaseNoCustomHeadersWithResponse(String containerName, String blob, String leaseId, + Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, Context context) { + final String comp = "lease"; + final String action = "renew"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.renewLeaseNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, action, + timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. * @@ -4469,6 +6901,134 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String c .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. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase changeLeaseWithResponse(String containerName, String blob, + String leaseId, String proposedLeaseId, Integer timeout, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + Context context) { + final String comp = "lease"; + final String action = "change"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.changeLeaseSync(this.client.getUrl(), containerName, blob, comp, action, timeout, leaseId, + proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * [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. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void changeLease(String containerName, String blob, String leaseId, String proposedLeaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + changeLeaseWithResponse(containerName, blob, leaseId, proposedLeaseId, timeout, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, Context.NONE); + } + + /** + * [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. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response changeLeaseNoCustomHeadersWithResponse(String containerName, String blob, String leaseId, + String proposedLeaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, Context context) { + final String comp = "lease"; + final String action = "change"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.changeLeaseNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, action, + timeout, leaseId, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, + ifNoneMatch, ifTags, this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. * @@ -4733,6 +7293,139 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String co .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in + * seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. + * If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + * expired, but the lease may be held for longer than the break period. If this header does not appear with a break + * operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks + * immediately. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase breakLeaseWithResponse(String containerName, String blob, + Integer timeout, Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, Context context) { + final String comp = "lease"; + final String action = "break"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.breakLeaseSync(this.client.getUrl(), containerName, blob, comp, action, timeout, breakPeriod, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * [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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in + * seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. + * If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + * expired, but the lease may be held for longer than the break period. If this header does not appear with a break + * operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks + * immediately. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void breakLease(String containerName, String blob, Integer timeout, Integer breakPeriod, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + breakLeaseWithResponse(containerName, blob, timeout, breakPeriod, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, Context.NONE); + } + + /** + * [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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in + * seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. + * If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + * expired, but the lease may be held for longer than the break period. If this header does not appear with a break + * operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks + * immediately. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response breakLeaseNoCustomHeadersWithResponse(String containerName, String blob, Integer timeout, + Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, Context context) { + final String comp = "lease"; + final String action = "break"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.breakLeaseNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, action, + timeout, breakPeriod, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, + ifTags, this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * The Create Snapshot operation creates a read-only snapshot of a blob. * @@ -4988,13 +7681,155 @@ public Mono createSnapshotAsync(String containerName, String blob, Integer * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createSnapshotNoCustomHeadersWithResponseAsync(String containerName, String blob, + Integer timeout, Map metadata, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String leaseId, String requestId, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam) { + final String comp = "snapshot"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = 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)) + .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createSnapshotNoCustomHeadersWithResponseAsync(String containerName, String blob, + Integer timeout, Map metadata, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String leaseId, String requestId, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, Context context) { + final String comp = "snapshot"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = 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) + .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createSnapshotNoCustomHeadersWithResponseAsync(String containerName, String blob, + public ResponseBase createSnapshotWithResponse(String containerName, String blob, Integer timeout, Map metadata, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String leaseId, String requestId, CpkInfo cpkInfo, - EncryptionScope encryptionScopeParam) { + EncryptionScope encryptionScopeParam, Context context) { final String comp = "snapshot"; final String accept = "application/xml"; String encryptionKeyInternal = null; @@ -5021,12 +7856,52 @@ 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.createSnapshotSync(this.client.getUrl(), containerName, blob, comp, timeout, metadata, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, leaseId, this.client.getVersion(), requestId, + accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void createSnapshot(String containerName, String blob, Integer timeout, Map metadata, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String leaseId, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + createSnapshotWithResponse(containerName, blob, timeout, metadata, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, leaseId, requestId, cpkInfo, encryptionScopeParam, Context.NONE); } /** @@ -5059,12 +7934,12 @@ public Mono> createSnapshotNoCustomHeadersWithResponseAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createSnapshotNoCustomHeadersWithResponseAsync(String containerName, String blob, - Integer timeout, Map metadata, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, - String ifMatch, String ifNoneMatch, String ifTags, String leaseId, String requestId, CpkInfo cpkInfo, + public Response createSnapshotNoCustomHeadersWithResponse(String containerName, String blob, Integer timeout, + Map metadata, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String leaseId, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { final String comp = "snapshot"; final String accept = "application/xml"; @@ -5092,12 +7967,14 @@ 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.createSnapshotNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, timeout, + metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, leaseId, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -5526,6 +8403,221 @@ public Mono> startCopyFromURLNoCustomHeadersWithResponseAsync(Str .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 + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 blobTagsString Optional. Used to set blob tags in various blob operations. + * @param sealBlob Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase startCopyFromURLWithResponse(String containerName, + String blob, String copySource, Integer timeout, Map metadata, AccessTier tier, + RehydratePriority rehydratePriority, OffsetDateTime sourceIfModifiedSince, + OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, String sourceIfTags, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String leaseId, String requestId, String blobTagsString, Boolean sealBlob, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + Context context) { + final String accept = "application/xml"; + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + try { + return service.startCopyFromURLSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 blobTagsString Optional. Used to set blob tags in various blob operations. + * @param sealBlob Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void startCopyFromURL(String containerName, String blob, String copySource, Integer timeout, + Map metadata, AccessTier tier, RehydratePriority rehydratePriority, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, String sourceIfTags, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String leaseId, String requestId, String blobTagsString, + Boolean sealBlob, OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, + Boolean legalHold) { + startCopyFromURLWithResponse(containerName, blob, copySource, timeout, metadata, tier, rehydratePriority, + sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, leaseId, requestId, blobTagsString, + sealBlob, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, Context.NONE); + } + + /** + * 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 + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 blobTagsString Optional. Used to set blob tags in various blob operations. + * @param sealBlob Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response startCopyFromURLNoCustomHeadersWithResponse(String containerName, String blob, + String copySource, Integer timeout, Map metadata, AccessTier tier, + RehydratePriority rehydratePriority, OffsetDateTime sourceIfModifiedSince, + OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, String sourceIfTags, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String leaseId, String requestId, String blobTagsString, Boolean sealBlob, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + Context context) { + final String accept = "application/xml"; + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + try { + return service.startCopyFromURLNoCustomHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * 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. @@ -5884,44 +8976,286 @@ public Mono copyFromURLAsync(String containerName, String blob, String cop * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> copyFromURLNoCustomHeadersWithResponseAsync(String containerName, String blob, + String copySource, Integer timeout, Map metadata, AccessTier tier, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String leaseId, String requestId, byte[] sourceContentMD5, + String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, String copySourceAuthorization, + BlobCopySourceTagsMode copySourceTags, EncryptionScope encryptionScopeParam) { + final String xMsRequiresSync = "true"; + final String accept = "application/xml"; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + 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)) + .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 + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> copyFromURLNoCustomHeadersWithResponseAsync(String containerName, String blob, + String copySource, Integer timeout, Map metadata, AccessTier tier, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String leaseId, String requestId, byte[] sourceContentMD5, + String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, String copySourceAuthorization, + BlobCopySourceTagsMode copySourceTags, EncryptionScope encryptionScopeParam, Context context) { + final String xMsRequiresSync = "true"; + final String accept = "application/xml"; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + 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) + .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 + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase copyFromURLWithResponse(String containerName, String blob, + String copySource, Integer timeout, Map metadata, AccessTier tier, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String leaseId, String requestId, byte[] sourceContentMD5, + String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, String copySourceAuthorization, + BlobCopySourceTagsMode copySourceTags, EncryptionScope encryptionScopeParam, Context context) { + final String xMsRequiresSync = "true"; + final String accept = "application/xml"; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + try { + return service.copyFromURLSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> copyFromURLNoCustomHeadersWithResponseAsync(String containerName, String blob, - String copySource, Integer timeout, Map metadata, AccessTier tier, - OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, - String sourceIfNoneMatch, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, - String ifNoneMatch, String ifTags, String leaseId, String requestId, byte[] sourceContentMD5, - String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, - BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, String copySourceAuthorization, - BlobCopySourceTagsMode copySourceTags, EncryptionScope encryptionScopeParam) { - final String xMsRequiresSync = "true"; - final String accept = "application/xml"; - String encryptionScopeInternal = null; - if (encryptionScopeParam != null) { - encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); - } - String encryptionScope = encryptionScopeInternal; - DateTimeRfc1123 sourceIfModifiedSinceConverted - = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); - DateTimeRfc1123 sourceIfUnmodifiedSinceConverted - = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - DateTimeRfc1123 ifModifiedSinceConverted - = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); - DateTimeRfc1123 ifUnmodifiedSinceConverted - = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + public void copyFromURL(String containerName, String blob, String copySource, Integer timeout, + Map metadata, AccessTier tier, OffsetDateTime sourceIfModifiedSince, + OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String leaseId, String requestId, byte[] sourceContentMD5, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + String copySourceAuthorization, BlobCopySourceTagsMode copySourceTags, EncryptionScope encryptionScopeParam) { + copyFromURLWithResponse(containerName, blob, copySource, timeout, metadata, tier, sourceIfModifiedSince, + sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, leaseId, requestId, sourceContentMD5, blobTagsString, immutabilityPolicyExpiry, + immutabilityPolicyMode, legalHold, copySourceAuthorization, copySourceTags, encryptionScopeParam, + Context.NONE); } /** @@ -5973,17 +9307,17 @@ public Mono> copyFromURLNoCustomHeadersWithResponseAsync(String c * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> copyFromURLNoCustomHeadersWithResponseAsync(String containerName, String blob, - String copySource, Integer timeout, Map metadata, AccessTier tier, - OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, - String sourceIfNoneMatch, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, - String ifNoneMatch, String ifTags, String leaseId, String requestId, byte[] sourceContentMD5, - String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, - BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, String copySourceAuthorization, - BlobCopySourceTagsMode copySourceTags, EncryptionScope encryptionScopeParam, Context context) { + public Response copyFromURLNoCustomHeadersWithResponse(String containerName, String blob, String copySource, + Integer timeout, Map metadata, AccessTier tier, OffsetDateTime sourceIfModifiedSince, + OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String leaseId, String requestId, byte[] sourceContentMD5, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + String copySourceAuthorization, BlobCopySourceTagsMode copySourceTags, EncryptionScope encryptionScopeParam, + Context context) { final String xMsRequiresSync = "true"; final String accept = "application/xml"; String encryptionScopeInternal = null; @@ -6002,14 +9336,16 @@ 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.copyFromURLNoCustomHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -6187,6 +9523,217 @@ public Mono> abortCopyFromURLNoCustomHeadersWithResponseAsync(Str .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. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase abortCopyFromURLWithResponse(String containerName, + String blob, String copyId, Integer timeout, String leaseId, String requestId, Context context) { + final String comp = "copy"; + final String copyActionAbortConstant = "abort"; + final String accept = "application/xml"; + try { + return service.abortCopyFromURLSync(this.client.getUrl(), containerName, blob, comp, + copyActionAbortConstant, copyId, timeout, leaseId, this.client.getVersion(), requestId, accept, + context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void abortCopyFromURL(String containerName, String blob, String copyId, Integer timeout, String leaseId, + String requestId) { + abortCopyFromURLWithResponse(containerName, blob, copyId, timeout, leaseId, requestId, Context.NONE); + } + + /** + * 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. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response abortCopyFromURLNoCustomHeadersWithResponse(String containerName, String blob, String copyId, + Integer timeout, String leaseId, String requestId, Context context) { + final String comp = "copy"; + final String copyActionAbortConstant = "abort"; + final String accept = "application/xml"; + try { + return service.abortCopyFromURLNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, + copyActionAbortConstant, copyId, timeout, leaseId, this.client.getVersion(), requestId, accept, + context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage + * 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. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @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>. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. + * @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 leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setTierWithResponseAsync(String containerName, String blob, + AccessTier tier, String snapshot, String versionId, Integer timeout, RehydratePriority rehydratePriority, + 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)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + } + + /** + * The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage + * 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. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @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>. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. + * @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 leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setTierWithResponseAsync(String containerName, String blob, + AccessTier tier, String snapshot, String versionId, Integer timeout, RehydratePriority rehydratePriority, + 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) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + } + + /** + * The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage + * 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. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @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>. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. + * @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 leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 setTierAsync(String containerName, String blob, AccessTier tier, String snapshot, + String versionId, Integer timeout, RehydratePriority rehydratePriority, String requestId, String leaseId, + String ifTags) { + return setTierWithResponseAsync(containerName, blob, tier, snapshot, versionId, timeout, rehydratePriority, + requestId, leaseId, ifTags) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); + } + /** * The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage * account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's @@ -6210,22 +9757,20 @@ public Mono> abortCopyFromURLNoCustomHeadersWithResponseAsync(Str * analytics logs when storage analytics logging is enabled. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setTierWithResponseAsync(String containerName, String blob, - AccessTier tier, String snapshot, String versionId, Integer timeout, RehydratePriority rehydratePriority, - 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + public Mono setTierAsync(String containerName, String blob, AccessTier tier, String snapshot, + 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) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -6251,21 +9796,21 @@ public Mono> setTierWithResponseAsync(St * analytics logs when storage analytics logging is enabled. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setTierWithResponseAsync(String containerName, String blob, + public Mono> setTierNoCustomHeadersWithResponseAsync(String containerName, String blob, AccessTier tier, String snapshot, String versionId, Integer timeout, RehydratePriority rehydratePriority, - String requestId, String leaseId, String ifTags, Context context) { + String requestId, String leaseId, String ifTags) { 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 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); } @@ -6292,19 +9837,22 @@ public Mono> setTierWithResponseAsync(St * analytics logs when storage analytics logging is enabled. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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. * @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. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setTierAsync(String containerName, String blob, AccessTier tier, String snapshot, - String versionId, Integer timeout, RehydratePriority rehydratePriority, String requestId, String leaseId, - String ifTags) { - return setTierWithResponseAsync(containerName, blob, tier, snapshot, versionId, timeout, rehydratePriority, - requestId, leaseId, ifTags) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(ignored -> Mono.empty()); + public Mono> setTierNoCustomHeadersWithResponseAsync(String containerName, String blob, + AccessTier tier, String snapshot, String versionId, Integer timeout, RehydratePriority rehydratePriority, + 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) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -6334,16 +9882,20 @@ public Mono setTierAsync(String containerName, String blob, AccessTier tie * @throws IllegalArgumentException thrown if parameters fail the validation. * @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. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setTierAsync(String containerName, String blob, AccessTier tier, String snapshot, - 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(ignored -> Mono.empty()); + public ResponseBase setTierWithResponse(String containerName, String blob, + AccessTier tier, String snapshot, String versionId, Integer timeout, RehydratePriority rehydratePriority, + String requestId, String leaseId, String ifTags, Context context) { + final String comp = "tier"; + final String accept = "application/xml"; + try { + return service.setTierSync(this.client.getUrl(), containerName, blob, comp, snapshot, versionId, timeout, + tier, rehydratePriority, this.client.getVersion(), requestId, leaseId, ifTags, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -6372,19 +9924,12 @@ public Mono setTierAsync(String containerName, String blob, AccessTier tie * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setTierNoCustomHeadersWithResponseAsync(String containerName, String blob, - AccessTier tier, String snapshot, String versionId, Integer timeout, RehydratePriority rehydratePriority, - 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + public void setTier(String containerName, String blob, AccessTier tier, String snapshot, String versionId, + Integer timeout, RehydratePriority rehydratePriority, String requestId, String leaseId, String ifTags) { + setTierWithResponse(containerName, blob, tier, snapshot, versionId, timeout, rehydratePriority, requestId, + leaseId, ifTags, Context.NONE); } /** @@ -6414,18 +9959,21 @@ public Mono> setTierNoCustomHeadersWithResponseAsync(String conta * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setTierNoCustomHeadersWithResponseAsync(String containerName, String blob, - AccessTier tier, String snapshot, String versionId, Integer timeout, RehydratePriority rehydratePriority, - String requestId, String leaseId, String ifTags, Context context) { + public Response setTierNoCustomHeadersWithResponse(String containerName, String blob, AccessTier tier, + String snapshot, String versionId, Integer timeout, RehydratePriority rehydratePriority, 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.setTierNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, snapshot, + versionId, timeout, tier, rehydratePriority, this.client.getVersion(), requestId, leaseId, ifTags, + accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -6552,6 +10100,70 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Strin .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase getAccountInfoWithResponse(String containerName, String blob, + Context context) { + final String restype = "account"; + final String comp = "properties"; + final String accept = "application/xml"; + try { + return service.getAccountInfoSync(this.client.getUrl(), containerName, blob, restype, comp, + this.client.getVersion(), accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void getAccountInfo(String containerName, String blob) { + getAccountInfoWithResponse(containerName, blob, Context.NONE); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAccountInfoNoCustomHeadersWithResponse(String containerName, String blob, + Context context) { + final String restype = "account"; + final String comp = "properties"; + final String accept = "application/xml"; + try { + return service.getAccountInfoNoCustomHeadersSync(this.client.getUrl(), containerName, blob, restype, comp, + this.client.getVersion(), accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * The Query operation enables users to select/project on blob data by providing simple query expressions. * @@ -6785,13 +10397,141 @@ public Flux queryAsync(String containerName, String blob, String sna * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 response body on successful completion of {@link Mono}. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono queryNoCustomHeadersWithResponseAsync(String containerName, String blob, + String snapshot, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + QueryRequest queryRequest, CpkInfo cpkInfo) { + final String comp = "query"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = 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)) + .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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 queryRequest the query request. + * @param cpkInfo Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono queryNoCustomHeadersWithResponseAsync(String containerName, String blob, + String snapshot, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + QueryRequest queryRequest, CpkInfo cpkInfo, Context context) { + final String comp = "query"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = 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) + .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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 queryRequest the query request. + * @param cpkInfo Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono queryNoCustomHeadersWithResponseAsync(String containerName, String blob, + public ResponseBase queryWithResponse(String containerName, String blob, String snapshot, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, - QueryRequest queryRequest, CpkInfo cpkInfo) { + QueryRequest queryRequest, CpkInfo cpkInfo, Context context) { final String comp = "query"; final String accept = "application/xml"; String encryptionKeyInternal = null; @@ -6813,12 +10553,56 @@ 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.querySync(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, leaseId, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, this.client.getVersion(), requestId, + queryRequest, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 queryRequest the query request. + * @param cpkInfo Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InputStream query(String containerName, String blob, String snapshot, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, QueryRequest queryRequest, CpkInfo cpkInfo) { + try { + return queryWithResponse(containerName, blob, snapshot, timeout, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, queryRequest, cpkInfo, Context.NONE) + .getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -6849,13 +10633,13 @@ public Mono queryNoCustomHeadersWithResponseAsync(String contain * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 response body on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono queryNoCustomHeadersWithResponseAsync(String containerName, String blob, - String snapshot, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, - OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, - QueryRequest queryRequest, CpkInfo cpkInfo, Context context) { + public Response queryNoCustomHeadersWithResponse(String containerName, String blob, String snapshot, + Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, QueryRequest queryRequest, CpkInfo cpkInfo, + Context context) { final String comp = "query"; final String accept = "application/xml"; String encryptionKeyInternal = null; @@ -6877,12 +10661,14 @@ 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, + try { + return service.queryNoCustomHeadersSync(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); + queryRequest, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -7088,6 +10874,115 @@ public Mono> getTagsNoCustomHeadersWithResponseAsync(String c .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return blob tags along with {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase getTagsWithResponse(String containerName, String blob, + Integer timeout, String requestId, String snapshot, String versionId, String ifTags, String leaseId, + Context context) { + final String comp = "tags"; + final String accept = "application/xml"; + try { + return service.getTagsSync(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, snapshot, versionId, ifTags, leaseId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 blob tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BlobTags getTags(String containerName, String blob, Integer timeout, String requestId, String snapshot, + String versionId, String ifTags, String leaseId) { + try { + return getTagsWithResponse(containerName, blob, timeout, requestId, snapshot, versionId, ifTags, leaseId, + Context.NONE).getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return blob tags along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTagsNoCustomHeadersWithResponse(String containerName, String blob, Integer timeout, + String requestId, String snapshot, String versionId, String ifTags, String leaseId, Context context) { + final String comp = "tags"; + final String accept = "application/xml"; + try { + return service.getTagsNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, timeout, + this.client.getVersion(), requestId, snapshot, versionId, ifTags, leaseId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * The Set Tags operation enables users to set tags on a blob. * @@ -7302,4 +11197,113 @@ public Mono> setTagsNoCustomHeadersWithResponseAsync(String conta 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @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 ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tags Blob tags. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase setTagsWithResponse(String containerName, String blob, + Integer timeout, String versionId, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, + String requestId, String ifTags, String leaseId, BlobTags tags, Context context) { + final String comp = "tags"; + final String accept = "application/xml"; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + try { + return service.setTagsSync(this.client.getUrl(), containerName, blob, comp, this.client.getVersion(), + timeout, versionId, transactionalContentMD5Converted, transactionalContentCrc64Converted, requestId, + ifTags, leaseId, tags, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @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 ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tags Blob tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void setTags(String containerName, String blob, Integer timeout, String versionId, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String requestId, String ifTags, + String leaseId, BlobTags tags) { + setTagsWithResponse(containerName, blob, timeout, versionId, transactionalContentMD5, transactionalContentCrc64, + requestId, ifTags, leaseId, tags, Context.NONE); + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param versionId The version id parameter is an opaque DateTime value that, when present, specifies the version + * of the blob to operate on. It's for service version 2019-10-10 and newer. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @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 ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tags Blob tags. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setTagsNoCustomHeadersWithResponse(String containerName, String blob, Integer timeout, + String versionId, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String requestId, + String ifTags, String leaseId, BlobTags tags, Context context) { + final String comp = "tags"; + final String accept = "application/xml"; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + try { + return service.setTagsNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, + this.client.getVersion(), timeout, versionId, transactionalContentMD5Converted, + transactionalContentCrc64Converted, requestId, ifTags, leaseId, tags, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } } 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 43e1069e53a93..0015e15e74b03 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 @@ -210,6 +210,70 @@ Mono> uploadNoCustomHeaders(@HostParam("url") String url, @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase uploadSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @HeaderParam("x-ms-blob-type") String blobType, @QueryParam("timeout") Integer timeout, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response uploadNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @HeaderParam("x-ms-blob-type") String blobType, @QueryParam("timeout") Integer timeout, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, + Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -284,6 +348,80 @@ Mono> putBlobFromUrlNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-copy-source-tag-option") BlobCopySourceTagsMode copySourceTags, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase putBlobFromUrlSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @HeaderParam("x-ms-blob-type") String blobType, @QueryParam("timeout") Integer timeout, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-source-if-tags") String sourceIfTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-tags") String blobTagsString, @HeaderParam("x-ms-copy-source") String copySource, + @HeaderParam("x-ms-copy-source-blob-properties") Boolean copySourceBlobProperties, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("x-ms-copy-source-tag-option") BlobCopySourceTagsMode copySourceTags, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response putBlobFromUrlNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @HeaderParam("x-ms-blob-type") String blobType, @QueryParam("timeout") Integer timeout, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-source-if-tags") String sourceIfTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-tags") String blobTagsString, @HeaderParam("x-ms-copy-source") String copySource, + @HeaderParam("x-ms-copy-source-blob-properties") Boolean copySourceBlobProperties, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("x-ms-copy-source-tag-option") BlobCopySourceTagsMode copySourceTags, + @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -352,6 +490,40 @@ Mono> stageBlockNoCustomHeaders(@HostParam("url") String url, @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase stageBlockSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("blockid") String blockId, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response stageBlockNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("blockid") String blockId, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, + Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -396,6 +568,50 @@ Mono> stageBlockFromURLNoCustomHeaders(@HostParam("url") String u @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase stageBlockFromURLSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("blockid") String blockId, + @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-copy-source") String sourceUrl, + @HeaderParam("x-ms-source-range") String sourceRange, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response stageBlockFromURLNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("blockid") String blockId, + @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-copy-source") String sourceUrl, + @HeaderParam("x-ms-source-range") String sourceRange, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -456,33 +672,115 @@ Mono> commitBlockListNoCustomHeaders(@HostParam("url") String url @HeaderParam("x-ms-legal-hold") Boolean legalHold, @BodyParam("application/xml") BlockLookupList blocks, @HeaderParam("Accept") String accept, Context context); - @Get("/{containerName}/{blob}") - @ExpectedResponses({ 200 }) + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> getBlockList(@HostParam("url") String url, + ResponseBase commitBlockListSync(@HostParam("url") String url, @PathParam("containerName") String containerName, @PathParam("blob") String blob, - @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, - @QueryParam("blocklisttype") BlockListType listType, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-tags") String ifTags, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, @BodyParam("application/xml") BlockLookupList blocks, @HeaderParam("Accept") String accept, Context context); - @Get("/{containerName}/{blob}") - @ExpectedResponses({ 200 }) + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> getBlockListNoCustomHeaders(@HostParam("url") String url, + Response commitBlockListNoCustomHeadersSync(@HostParam("url") String url, @PathParam("containerName") String containerName, @PathParam("blob") String blob, - @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, - @QueryParam("blocklisttype") BlockListType listType, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-tags") String ifTags, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob - * 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 + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-access-tier") AccessTier tier, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, @BodyParam("application/xml") BlockLookupList blocks, + @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Mono> getBlockList(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("blocklisttype") BlockListType listType, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Mono> getBlockListNoCustomHeaders(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("blocklisttype") BlockListType listType, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase getBlockListSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("blocklisttype") BlockListType listType, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response getBlockListNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("blocklisttype") BlockListType listType, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob + * 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. @@ -1712,18 +2010,15 @@ public Mono> uploadNoCustomHeadersWithResponseAsync(String contai } /** - * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given - * URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob - * 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. + * The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob + * 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. - * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in - * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. - * The source blob must either be public or must be authenticated via a shared access signature. + * @param body Initial data. * @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>. @@ -1743,41 +2038,931 @@ public Mono> uploadNoCustomHeadersWithResponseAsync(String contai * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * @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 blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase uploadWithResponse(String containerName, String blob, + long contentLength, BinaryData body, Integer timeout, byte[] transactionalContentMD5, + Map metadata, String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, byte[] transactionalContentCrc64, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String blobType = "BlockBlob"; + final String accept = "application/xml"; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + try { + return service.uploadSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob + * 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. + * @param body Initial data. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since * the specified date/time. - * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified - * since the specified date/time. - * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. - * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. - * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. * @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 sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. * @param blobTagsString Optional. Used to set blob tags in various blob operations. - * @param copySourceBlobProperties Optional, default is true. Indicates if properties from the source blob should be - * copied. - * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to - * copy source. - * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the - * tags specified by x-ms-tags. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. * @param blobHttpHeaders Parameter group. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putBlobFromUrlWithResponseAsync( - String containerName, String blob, long contentLength, String copySource, Integer timeout, + public void upload(String containerName, String blob, long contentLength, BinaryData body, Integer timeout, byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, - String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, - String sourceIfMatch, String sourceIfNoneMatch, String sourceIfTags, String requestId, byte[] sourceContentMD5, - String blobTagsString, Boolean copySourceBlobProperties, String copySourceAuthorization, - BlobCopySourceTagsMode copySourceTags, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, - EncryptionScope encryptionScopeParam) { + String ifTags, String requestId, String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, byte[] transactionalContentCrc64, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + uploadWithResponse(containerName, blob, contentLength, body, timeout, transactionalContentMD5, metadata, + leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, blobTagsString, + immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, transactionalContentCrc64, blobHttpHeaders, + cpkInfo, encryptionScopeParam, Context.NONE); + } + + /** + * The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob + * 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. + * @param body Initial data. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadNoCustomHeadersWithResponse(String containerName, String blob, long contentLength, + BinaryData body, Integer timeout, byte[] transactionalContentMD5, Map metadata, String leaseId, + AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + byte[] transactionalContentCrc64, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, Context context) { + final String blobType = "BlockBlob"; + final String accept = "application/xml"; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + try { + return service.uploadNoCustomHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given + * URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob + * 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. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param copySourceBlobProperties Optional, default is true. Indicates if properties from the source blob should be + * copied. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putBlobFromUrlWithResponseAsync( + String containerName, String blob, long contentLength, String copySource, Integer timeout, + byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String sourceIfTags, String requestId, byte[] sourceContentMD5, + String blobTagsString, Boolean copySourceBlobProperties, String copySourceAuthorization, + BlobCopySourceTagsMode copySourceTags, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam) { + final String blobType = "BlockBlob"; + final String accept = "application/xml"; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + 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)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + } + + /** + * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given + * URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob + * 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. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param copySourceBlobProperties Optional, default is true. Indicates if properties from the source blob should be + * copied. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putBlobFromUrlWithResponseAsync( + String containerName, String blob, long contentLength, String copySource, Integer timeout, + byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String sourceIfTags, String requestId, byte[] sourceContentMD5, + String blobTagsString, Boolean copySourceBlobProperties, String copySourceAuthorization, + BlobCopySourceTagsMode copySourceTags, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, Context context) { + final String blobType = "BlockBlob"; + final String accept = "application/xml"; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + 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) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + } + + /** + * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given + * URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob + * 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. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param copySourceBlobProperties Optional, default is true. Indicates if properties from the source blob should be + * copied. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 putBlobFromUrlAsync(String containerName, String blob, long contentLength, String copySource, + Integer timeout, byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String sourceIfTags, String requestId, byte[] sourceContentMD5, + String blobTagsString, Boolean copySourceBlobProperties, String copySourceAuthorization, + BlobCopySourceTagsMode copySourceTags, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam) { + return putBlobFromUrlWithResponseAsync(containerName, blob, contentLength, copySource, timeout, + transactionalContentMD5, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, + requestId, sourceContentMD5, blobTagsString, copySourceBlobProperties, copySourceAuthorization, + copySourceTags, blobHttpHeaders, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); + } + + /** + * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given + * URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob + * 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. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param copySourceBlobProperties Optional, default is true. Indicates if properties from the source blob should be + * copied. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @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 putBlobFromUrlAsync(String containerName, String blob, long contentLength, String copySource, + Integer timeout, byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String sourceIfTags, String requestId, byte[] sourceContentMD5, + String blobTagsString, Boolean copySourceBlobProperties, String copySourceAuthorization, + BlobCopySourceTagsMode copySourceTags, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, Context context) { + return putBlobFromUrlWithResponseAsync(containerName, blob, contentLength, copySource, timeout, + transactionalContentMD5, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, + requestId, sourceContentMD5, blobTagsString, copySourceBlobProperties, copySourceAuthorization, + copySourceTags, blobHttpHeaders, cpkInfo, encryptionScopeParam, context) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); + } + + /** + * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given + * URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob + * 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. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param copySourceBlobProperties Optional, default is true. Indicates if properties from the source blob should be + * copied. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putBlobFromUrlNoCustomHeadersWithResponseAsync(String containerName, String blob, + long contentLength, String copySource, Integer timeout, byte[] transactionalContentMD5, + Map metadata, String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, String sourceIfTags, String requestId, byte[] sourceContentMD5, String blobTagsString, + Boolean copySourceBlobProperties, String copySourceAuthorization, BlobCopySourceTagsMode copySourceTags, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + final String blobType = "BlockBlob"; + final String accept = "application/xml"; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + 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)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + } + + /** + * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given + * URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob + * 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. + * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param copySourceBlobProperties Optional, default is true. Indicates if properties from the source blob should be + * copied. + * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the + * tags specified by x-ms-tags. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putBlobFromUrlNoCustomHeadersWithResponseAsync(String containerName, String blob, + long contentLength, String copySource, Integer timeout, byte[] transactionalContentMD5, + Map metadata, String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, String sourceIfTags, String requestId, byte[] sourceContentMD5, String blobTagsString, + Boolean copySourceBlobProperties, String copySourceAuthorization, BlobCopySourceTagsMode copySourceTags, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { final String blobType = "BlockBlob"; final String accept = "application/xml"; String contentTypeInternal = null; @@ -1841,15 +3026,15 @@ 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, + 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)) + copySourceBlobProperties, copySourceAuthorization, copySourceTags, accept, context) .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } @@ -1909,18 +3094,17 @@ public Mono> putBlobFromUrlW * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putBlobFromUrlWithResponseAsync( - String containerName, String blob, long contentLength, String copySource, Integer timeout, - byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, - OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, - String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, - String sourceIfMatch, String sourceIfNoneMatch, String sourceIfTags, String requestId, byte[] sourceContentMD5, - String blobTagsString, Boolean copySourceBlobProperties, String copySourceAuthorization, - BlobCopySourceTagsMode copySourceTags, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, - EncryptionScope encryptionScopeParam, Context context) { + public ResponseBase putBlobFromUrlWithResponse(String containerName, + String blob, long contentLength, String copySource, Integer timeout, byte[] transactionalContentMD5, + Map metadata, String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, String sourceIfTags, String requestId, byte[] sourceContentMD5, String blobTagsString, + Boolean copySourceBlobProperties, String copySourceAuthorization, BlobCopySourceTagsMode copySourceTags, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { final String blobType = "BlockBlob"; final String accept = "application/xml"; String contentTypeInternal = null; @@ -1984,16 +3168,18 @@ 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, + try { + return service.putBlobFromUrlSync(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); + copySourceBlobProperties, copySourceAuthorization, copySourceTags, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -2051,10 +3237,9 @@ public Mono> putBlobFromUrlW * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 putBlobFromUrlAsync(String containerName, String blob, long contentLength, String copySource, + public void putBlobFromUrl(String containerName, String blob, long contentLength, String copySource, Integer timeout, byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, @@ -2062,230 +3247,11 @@ public Mono putBlobFromUrlAsync(String containerName, String blob, long co String blobTagsString, Boolean copySourceBlobProperties, String copySourceAuthorization, BlobCopySourceTagsMode copySourceTags, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { - return putBlobFromUrlWithResponseAsync(containerName, blob, contentLength, copySource, timeout, - transactionalContentMD5, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, - ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, - requestId, sourceContentMD5, blobTagsString, copySourceBlobProperties, copySourceAuthorization, - copySourceTags, blobHttpHeaders, cpkInfo, encryptionScopeParam) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given - * URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob - * 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. - * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in - * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. - * The source blob must either be public or must be authenticated via a shared access signature. - * @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>. - * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value - * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. - * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and - * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names - * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata - * for more information. - * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. - * @param tier Optional. Indicates the tier to be set on the blob. - * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the - * specified date/time. - * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since - * the specified date/time. - * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. - * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. - * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since - * the specified date/time. - * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified - * since the specified date/time. - * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. - * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. - * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - * @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 sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. - * @param blobTagsString Optional. Used to set blob tags in various blob operations. - * @param copySourceBlobProperties Optional, default is true. Indicates if properties from the source blob should be - * copied. - * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to - * copy source. - * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the - * tags specified by x-ms-tags. - * @param blobHttpHeaders Parameter group. - * @param cpkInfo Parameter group. - * @param encryptionScopeParam Parameter group. - * @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. - * @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 putBlobFromUrlAsync(String containerName, String blob, long contentLength, String copySource, - Integer timeout, byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, - OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, - String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, - String sourceIfMatch, String sourceIfNoneMatch, String sourceIfTags, String requestId, byte[] sourceContentMD5, - String blobTagsString, Boolean copySourceBlobProperties, String copySourceAuthorization, - BlobCopySourceTagsMode copySourceTags, BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, - EncryptionScope encryptionScopeParam, Context context) { - return putBlobFromUrlWithResponseAsync(containerName, blob, contentLength, copySource, timeout, - transactionalContentMD5, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, - ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, - requestId, sourceContentMD5, blobTagsString, copySourceBlobProperties, copySourceAuthorization, - copySourceTags, blobHttpHeaders, cpkInfo, encryptionScopeParam, context) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * The Put Blob from URL operation creates a new Block Blob where the contents of the blob are read from a given - * URL. This API is supported beginning with the 2020-04-08 version. Partial updates are not supported with Put Blob - * 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. - * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in - * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. - * The source blob must either be public or must be authenticated via a shared access signature. - * @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>. - * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value - * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. - * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and - * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names - * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata - * for more information. - * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. - * @param tier Optional. Indicates the tier to be set on the blob. - * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the - * specified date/time. - * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since - * the specified date/time. - * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. - * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. - * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since - * the specified date/time. - * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified - * since the specified date/time. - * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. - * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. - * @param sourceIfTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - * @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 sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. - * @param blobTagsString Optional. Used to set blob tags in various blob operations. - * @param copySourceBlobProperties Optional, default is true. Indicates if properties from the source blob should be - * copied. - * @param copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to - * copy source. - * @param copySourceTags Optional, default 'replace'. Indicates if source tags should be copied or replaced with the - * tags specified by x-ms-tags. - * @param blobHttpHeaders Parameter group. - * @param cpkInfo Parameter group. - * @param encryptionScopeParam Parameter group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putBlobFromUrlNoCustomHeadersWithResponseAsync(String containerName, String blob, - long contentLength, String copySource, Integer timeout, byte[] transactionalContentMD5, - Map metadata, String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, - OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, - OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, - String sourceIfNoneMatch, String sourceIfTags, String requestId, byte[] sourceContentMD5, String blobTagsString, - Boolean copySourceBlobProperties, String copySourceAuthorization, BlobCopySourceTagsMode copySourceTags, - BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { - final String blobType = "BlockBlob"; - final String accept = "application/xml"; - String contentTypeInternal = null; - if (blobHttpHeaders != null) { - contentTypeInternal = blobHttpHeaders.getContentType(); - } - String contentType = contentTypeInternal; - String contentEncodingInternal = null; - if (blobHttpHeaders != null) { - contentEncodingInternal = blobHttpHeaders.getContentEncoding(); - } - String contentEncoding = contentEncodingInternal; - String contentLanguageInternal = null; - if (blobHttpHeaders != null) { - contentLanguageInternal = blobHttpHeaders.getContentLanguage(); - } - String contentLanguage = contentLanguageInternal; - byte[] contentMd5Internal = null; - if (blobHttpHeaders != null) { - contentMd5Internal = blobHttpHeaders.getContentMd5(); - } - byte[] contentMd5 = contentMd5Internal; - String cacheControlInternal = null; - if (blobHttpHeaders != null) { - cacheControlInternal = blobHttpHeaders.getCacheControl(); - } - String cacheControl = cacheControlInternal; - String contentDispositionInternal = null; - if (blobHttpHeaders != null) { - contentDispositionInternal = blobHttpHeaders.getContentDisposition(); - } - String contentDisposition = contentDispositionInternal; - String encryptionKeyInternal = null; - if (cpkInfo != null) { - encryptionKeyInternal = cpkInfo.getEncryptionKey(); - } - String encryptionKey = encryptionKeyInternal; - String encryptionKeySha256Internal = null; - if (cpkInfo != null) { - encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); - } - String encryptionKeySha256 = encryptionKeySha256Internal; - EncryptionAlgorithmType encryptionAlgorithmInternal = null; - if (cpkInfo != null) { - encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); - } - EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; - String encryptionScopeInternal = null; - if (encryptionScopeParam != null) { - encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); - } - String encryptionScope = encryptionScopeInternal; - String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); - String contentMd5Converted = Base64Util.encodeToString(contentMd5); - DateTimeRfc1123 ifModifiedSinceConverted - = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); - DateTimeRfc1123 ifUnmodifiedSinceConverted - = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - DateTimeRfc1123 sourceIfModifiedSinceConverted - = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); - 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + putBlobFromUrlWithResponse(containerName, blob, contentLength, copySource, timeout, transactionalContentMD5, + metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, + sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, sourceIfTags, requestId, + sourceContentMD5, blobTagsString, copySourceBlobProperties, copySourceAuthorization, copySourceTags, + blobHttpHeaders, cpkInfo, encryptionScopeParam, Context.NONE); } /** @@ -2344,10 +3310,10 @@ public Mono> putBlobFromUrlNoCustomHeadersWithResponseAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putBlobFromUrlNoCustomHeadersWithResponseAsync(String containerName, String blob, + public Response putBlobFromUrlNoCustomHeadersWithResponse(String containerName, String blob, long contentLength, String copySource, Integer timeout, byte[] transactionalContentMD5, Map metadata, String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, @@ -2418,16 +3384,18 @@ 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, + try { + return service.putBlobFromUrlNoCustomHeadersSync(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); + copySourceBlobProperties, copySourceAuthorization, copySourceTags, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -2708,7 +3676,265 @@ public Mono> stageBlockNoCustomHeadersWithResponseAsync(String co * analytics logs when storage analytics logging is enabled. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. - * @param context The context to associate with this operation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stageBlockNoCustomHeadersWithResponseAsync(String containerName, String blob, + String blockId, long contentLength, Flux body, byte[] transactionalContentMD5, + byte[] transactionalContentCrc64, Integer timeout, String leaseId, String requestId, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, Context context) { + final String comp = "block"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + 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) + .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 + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stageBlockWithResponseAsync(String containerName, + String blob, String blockId, long contentLength, BinaryData body, byte[] transactionalContentMD5, + byte[] transactionalContentCrc64, Integer timeout, String leaseId, String requestId, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam) { + final String comp = "block"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + 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)) + .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 + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stageBlockWithResponseAsync(String containerName, + String blob, String blockId, long contentLength, BinaryData body, byte[] transactionalContentMD5, + byte[] transactionalContentCrc64, Integer timeout, String leaseId, String requestId, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, Context context) { + final String comp = "block"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + 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) + .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 + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 stageBlockAsync(String containerName, String blob, String blockId, long contentLength, + BinaryData body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, + 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 + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @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 stageBlockAsync(String containerName, String blob, String blockId, long contentLength, + BinaryData body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, + 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 + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -2716,9 +3942,9 @@ public Mono> stageBlockNoCustomHeadersWithResponseAsync(String co */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> stageBlockNoCustomHeadersWithResponseAsync(String containerName, String blob, - String blockId, long contentLength, Flux body, byte[] transactionalContentMD5, + String blockId, long contentLength, BinaryData body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, String leaseId, String requestId, CpkInfo cpkInfo, - EncryptionScope encryptionScopeParam, Context context) { + EncryptionScope encryptionScopeParam) { final String comp = "block"; final String accept = "application/xml"; String encryptionKeyInternal = null; @@ -2743,11 +3969,11 @@ 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 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); } @@ -2771,16 +3997,17 @@ public Mono> stageBlockNoCustomHeadersWithResponseAsync(String co * analytics logs when storage analytics logging is enabled. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. + * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> stageBlockWithResponseAsync(String containerName, - String blob, String blockId, long contentLength, BinaryData body, byte[] transactionalContentMD5, + public Mono> stageBlockNoCustomHeadersWithResponseAsync(String containerName, String blob, + String blockId, long contentLength, BinaryData body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, String leaseId, String requestId, CpkInfo cpkInfo, - EncryptionScope encryptionScopeParam) { + EncryptionScope encryptionScopeParam, Context context) { final String comp = "block"; final String accept = "application/xml"; String encryptionKeyInternal = null; @@ -2805,11 +4032,11 @@ 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 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); } @@ -2837,11 +4064,11 @@ public Mono> stageBlockWithRespo * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> stageBlockWithResponseAsync(String containerName, - String blob, String blockId, long contentLength, BinaryData body, byte[] transactionalContentMD5, + public ResponseBase stageBlockWithResponse(String containerName, String blob, + String blockId, long contentLength, BinaryData body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, String leaseId, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { final String comp = "block"; @@ -2868,12 +4095,14 @@ 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, + try { + return service.stageBlockSync(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); + accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -2899,16 +4128,13 @@ public Mono> stageBlockWithRespo * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 stageBlockAsync(String containerName, String blob, String blockId, long contentLength, - BinaryData body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, - 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()); + public void stageBlock(String containerName, String blob, String blockId, long contentLength, BinaryData body, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, String leaseId, + String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + stageBlockWithResponse(containerName, blob, blockId, contentLength, body, transactionalContentMD5, + transactionalContentCrc64, timeout, leaseId, requestId, cpkInfo, encryptionScopeParam, Context.NONE); } /** @@ -2935,20 +4161,50 @@ public Mono stageBlockAsync(String containerName, String blob, String bloc * @throws IllegalArgumentException thrown if parameters fail the validation. * @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. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono stageBlockAsync(String containerName, String blob, String blockId, long contentLength, - BinaryData body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, - 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()); + public Response stageBlockNoCustomHeadersWithResponse(String containerName, String blob, String blockId, + long contentLength, BinaryData body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, + Integer timeout, String leaseId, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, + Context context) { + final String comp = "block"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + try { + return service.stageBlockNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, blockId, + contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, leaseId, + encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, this.client.getVersion(), + requestId, body, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** - * The Stage Block operation creates a new block to be committed as part of a blob. + * 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. @@ -2956,26 +4212,38 @@ public Mono stageBlockAsync(String containerName, String blob, String bloc * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter * must be the same size for each block. * @param contentLength The length of the request. - * @param body Initial data. - * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. - * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param sourceUrl Specify a URL to the copy source. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. * @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>. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> stageBlockNoCustomHeadersWithResponseAsync(String containerName, String blob, - String blockId, long contentLength, BinaryData body, byte[] transactionalContentMD5, - byte[] transactionalContentCrc64, Integer timeout, String leaseId, String requestId, CpkInfo cpkInfo, + public Mono> stageBlockFromURLWithResponseAsync( + String containerName, String blob, String blockId, long contentLength, String sourceUrl, String sourceRange, + byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String leaseId, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, String requestId, String copySourceAuthorization, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { final String comp = "block"; final String accept = "application/xml"; @@ -2999,18 +4267,24 @@ public Mono> stageBlockNoCustomHeadersWithResponseAsync(String co encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); } String encryptionScope = encryptionScopeInternal; - String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); - String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); 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)) + .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. + * 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. @@ -3018,27 +4292,39 @@ public Mono> stageBlockNoCustomHeadersWithResponseAsync(String co * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter * must be the same size for each block. * @param contentLength The length of the request. - * @param body Initial data. - * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. - * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param sourceUrl Specify a URL to the copy source. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. * @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>. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> stageBlockNoCustomHeadersWithResponseAsync(String containerName, String blob, - String blockId, long contentLength, BinaryData body, byte[] transactionalContentMD5, - byte[] transactionalContentCrc64, Integer timeout, String leaseId, String requestId, CpkInfo cpkInfo, + public Mono> stageBlockFromURLWithResponseAsync( + String containerName, String blob, String blockId, long contentLength, String sourceUrl, String sourceRange, + byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String leaseId, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, String requestId, String copySourceAuthorization, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { final String comp = "block"; final String accept = "application/xml"; @@ -3062,13 +4348,18 @@ public Mono> stageBlockNoCustomHeadersWithResponseAsync(String co encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); } String encryptionScope = encryptionScopeInternal; - String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); - String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); 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) + .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); } @@ -3106,15 +4397,113 @@ public Mono> stageBlockNoCustomHeadersWithResponseAsync(String co * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono stageBlockFromURLAsync(String containerName, String blob, String blockId, long contentLength, + String sourceUrl, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, + String leaseId, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + 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 + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param sourceUrl Specify a URL to the copy source. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @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 stageBlockFromURLAsync(String containerName, String blob, String blockId, long contentLength, + String sourceUrl, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, + String leaseId, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + return stageBlockFromURLWithResponseAsync(containerName, blob, blockId, contentLength, sourceUrl, sourceRange, + sourceContentMD5, sourceContentcrc64, timeout, leaseId, sourceIfModifiedSince, sourceIfUnmodifiedSince, + sourceIfMatch, sourceIfNoneMatch, requestId, copySourceAuthorization, 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 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 + * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter + * must be the same size for each block. + * @param contentLength The length of the request. + * @param sourceUrl Specify a URL to the copy source. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> stageBlockFromURLWithResponseAsync( - String containerName, String blob, String blockId, long contentLength, String sourceUrl, String sourceRange, - byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String leaseId, - OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, - String sourceIfNoneMatch, String requestId, String copySourceAuthorization, CpkInfo cpkInfo, - EncryptionScope encryptionScopeParam) { + public Mono> stageBlockFromURLNoCustomHeadersWithResponseAsync(String containerName, String blob, + String blockId, long contentLength, String sourceUrl, String sourceRange, byte[] sourceContentMD5, + byte[] sourceContentcrc64, Integer timeout, String leaseId, OffsetDateTime sourceIfModifiedSince, + OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, String requestId, + String copySourceAuthorization, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { final String comp = "block"; final String accept = "application/xml"; String encryptionKeyInternal = null; @@ -3143,12 +4532,11 @@ 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.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); } @@ -3187,15 +4575,14 @@ public Mono> stageBlockFr * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> stageBlockFromURLWithResponseAsync( - String containerName, String blob, String blockId, long contentLength, String sourceUrl, String sourceRange, - byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String leaseId, - OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, - String sourceIfNoneMatch, String requestId, String copySourceAuthorization, CpkInfo cpkInfo, - EncryptionScope encryptionScopeParam, Context context) { + public Mono> stageBlockFromURLNoCustomHeadersWithResponseAsync(String containerName, String blob, + String blockId, long contentLength, String sourceUrl, String sourceRange, byte[] sourceContentMD5, + byte[] sourceContentcrc64, Integer timeout, String leaseId, OffsetDateTime sourceIfModifiedSince, + OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, String requestId, + String copySourceAuthorization, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { final String comp = "block"; final String accept = "application/xml"; String encryptionKeyInternal = null; @@ -3225,8 +4612,8 @@ public Mono> stageBlockFr 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, + .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) @@ -3264,22 +4651,55 @@ public Mono> stageBlockFr * copy source. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. + * @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. * @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. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono stageBlockFromURLAsync(String containerName, String blob, String blockId, long contentLength, - String sourceUrl, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, - String leaseId, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, - String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, - CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { - 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()); + public ResponseBase stageBlockFromURLWithResponse(String containerName, + String blob, String blockId, long contentLength, String sourceUrl, String sourceRange, byte[] sourceContentMD5, + byte[] sourceContentcrc64, Integer timeout, String leaseId, OffsetDateTime sourceIfModifiedSince, + OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, String requestId, + String copySourceAuthorization, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String comp = "block"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + try { + return service.stageBlockFromURLSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -3313,23 +4733,20 @@ public Mono stageBlockFromURLAsync(String containerName, String blob, Stri * copy source. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. - * @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. * @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 stageBlockFromURLAsync(String containerName, String blob, String blockId, long contentLength, + public void stageBlockFromURL(String containerName, String blob, String blockId, long contentLength, String sourceUrl, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String leaseId, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, - CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { - return stageBlockFromURLWithResponseAsync(containerName, blob, blockId, contentLength, sourceUrl, sourceRange, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + stageBlockFromURLWithResponse(containerName, blob, blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5, sourceContentcrc64, timeout, leaseId, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestId, copySourceAuthorization, cpkInfo, encryptionScopeParam, - context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(ignored -> Mono.empty()); + Context.NONE); } /** @@ -3363,17 +4780,18 @@ public Mono stageBlockFromURLAsync(String containerName, String blob, Stri * copy source. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. + * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> stageBlockFromURLNoCustomHeadersWithResponseAsync(String containerName, String blob, + public Response stageBlockFromURLNoCustomHeadersWithResponse(String containerName, String blob, String blockId, long contentLength, String sourceUrl, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String leaseId, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, String requestId, - String copySourceAuthorization, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + String copySourceAuthorization, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { final String comp = "block"; final String accept = "application/xml"; String encryptionKeyInternal = null; @@ -3402,59 +4820,102 @@ public Mono> stageBlockFromURLNoCustomHeadersWithResponseAsync(St = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return FluxUtil.withContext(context -> 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); + try { + return service.stageBlockFromURLNoCustomHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** - * The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from - * a URL. + * The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order + * to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block + * operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then + * 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 blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less - * than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter - * must be the same size for each block. - * @param contentLength The length of the request. - * @param sourceUrl Specify a URL to the copy source. - * @param sourceRange Bytes of source data in the specified range. - * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. - * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy - * source. + * @param blocks Blob Blocks. * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. - * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since * the specified date/time. - * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified - * since the specified date/time. - * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. - * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to - * copy source. + * @param blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. - * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> stageBlockFromURLNoCustomHeadersWithResponseAsync(String containerName, String blob, - String blockId, long contentLength, String sourceUrl, String sourceRange, byte[] sourceContentMD5, - byte[] sourceContentcrc64, Integer timeout, String leaseId, OffsetDateTime sourceIfModifiedSince, - OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, String sourceIfNoneMatch, String requestId, - String copySourceAuthorization, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { - final String comp = "block"; + public Mono> commitBlockListWithResponseAsync( + String containerName, String blob, BlockLookupList blocks, Integer timeout, byte[] transactionalContentMD5, + byte[] transactionalContentCrc64, Map metadata, String leaseId, AccessTier tier, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, BlobHttpHeaders blobHttpHeaders, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + final String comp = "blocklist"; final String accept = "application/xml"; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; String encryptionKeyInternal = null; if (cpkInfo != null) { encryptionKeyInternal = cpkInfo.getEncryptionKey(); @@ -3475,18 +4936,23 @@ public Mono> stageBlockFromURLNoCustomHeadersWithResponseAsync(St encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); } String encryptionScope = encryptionScopeInternal; - String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); - String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); - DateTimeRfc1123 sourceIfModifiedSinceConverted - = 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) + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = 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)) .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } @@ -3530,6 +4996,7 @@ public Mono> stageBlockFromURLNoCustomHeadersWithResponseAsync(St * @param blobHttpHeaders Parameter group. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. + * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -3542,7 +5009,7 @@ public Mono> commitBlockLis OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, BlobHttpHeaders blobHttpHeaders, - CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { final String comp = "blocklist"; final String accept = "application/xml"; String cacheControlInternal = null; @@ -3604,17 +5071,77 @@ 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 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); } + /** + * The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order + * to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block + * operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then + * 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. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 commitBlockListAsync(String containerName, String blob, BlockLookupList blocks, Integer timeout, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Map metadata, String leaseId, + AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + return commitBlockListWithResponseAsync(containerName, blob, blocks, timeout, transactionalContentMD5, + transactionalContentCrc64, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, + blobHttpHeaders, cpkInfo, encryptionScopeParam) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); + } + /** * The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order * to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block @@ -3659,16 +5186,76 @@ public Mono> commitBlockLis * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> commitBlockListWithResponseAsync( - String containerName, String blob, BlockLookupList blocks, Integer timeout, byte[] transactionalContentMD5, - byte[] transactionalContentCrc64, Map metadata, String leaseId, AccessTier tier, - OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, - String ifTags, String requestId, String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + public Mono commitBlockListAsync(String containerName, String blob, BlockLookupList blocks, Integer timeout, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Map metadata, String leaseId, + AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + 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) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); + } + + /** + * The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order + * to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block + * operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then + * 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. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> commitBlockListNoCustomHeadersWithResponseAsync(String containerName, String blob, + BlockLookupList blocks, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, + Map metadata, String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, BlobHttpHeaders blobHttpHeaders, - CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { final String comp = "blocklist"; final String accept = "application/xml"; String cacheControlInternal = null; @@ -3730,14 +5317,14 @@ 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 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); } @@ -3781,24 +5368,90 @@ public Mono> commitBlockLis * @param blobHttpHeaders Parameter group. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. + * @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. * @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. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono commitBlockListAsync(String containerName, String blob, BlockLookupList blocks, Integer timeout, - byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Map metadata, String leaseId, - AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, - String ifNoneMatch, String ifTags, String requestId, String blobTagsString, - OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, - BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { - return commitBlockListWithResponseAsync(containerName, blob, blocks, timeout, transactionalContentMD5, - transactionalContentCrc64, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, - ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, - blobHttpHeaders, cpkInfo, encryptionScopeParam) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(ignored -> Mono.empty()); + public Mono> commitBlockListNoCustomHeadersWithResponseAsync(String containerName, String blob, + BlockLookupList blocks, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, + Map metadata, String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, BlobHttpHeaders blobHttpHeaders, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String comp = "blocklist"; + final String accept = "application/xml"; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = 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) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -3845,76 +5498,16 @@ public Mono commitBlockListAsync(String containerName, String blob, BlockL * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 commitBlockListAsync(String containerName, String blob, BlockLookupList blocks, Integer timeout, - byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Map metadata, String leaseId, - AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, - String ifNoneMatch, String ifTags, String requestId, String blobTagsString, - OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, - BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { - 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(ignored -> Mono.empty()); - } - - /** - * The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order - * to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block - * operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then - * 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. - * @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>. - * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. - * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value - * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. - * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and - * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names - * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata - * for more information. - * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. - * @param tier Optional. Indicates the tier to be set on the blob. - * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the - * specified date/time. - * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since - * the specified date/time. - * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. - * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. - * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - * @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 blobTagsString Optional. Used to set blob tags in various blob operations. - * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. - * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. - * @param legalHold Specified if a legal hold should be set on the blob. - * @param blobHttpHeaders Parameter group. - * @param cpkInfo Parameter group. - * @param encryptionScopeParam Parameter group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @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}. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> commitBlockListNoCustomHeadersWithResponseAsync(String containerName, String blob, - BlockLookupList blocks, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, - Map metadata, String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, - OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, - String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + public ResponseBase commitBlockListWithResponse(String containerName, + String blob, BlockLookupList blocks, Integer timeout, byte[] transactionalContentMD5, + byte[] transactionalContentCrc64, Map metadata, String leaseId, AccessTier tier, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, BlobHttpHeaders blobHttpHeaders, - CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { final String comp = "blocklist"; final String accept = "application/xml"; String cacheControlInternal = null; @@ -3976,15 +5569,74 @@ 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.commitBlockListSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order + * to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block + * operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then + * 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. + * @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>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the blob. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void commitBlockList(String containerName, String blob, BlockLookupList blocks, Integer timeout, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Map metadata, String leaseId, + AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + commitBlockListWithResponse(containerName, blob, blocks, timeout, transactionalContentMD5, + transactionalContentCrc64, metadata, leaseId, tier, ifModifiedSince, ifUnmodifiedSince, ifMatch, + ifNoneMatch, ifTags, requestId, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, + blobHttpHeaders, cpkInfo, encryptionScopeParam, Context.NONE); } /** @@ -4031,10 +5683,10 @@ public Mono> commitBlockListNoCustomHeadersWithResponseAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> commitBlockListNoCustomHeadersWithResponseAsync(String containerName, String blob, + public Response commitBlockListNoCustomHeadersWithResponse(String containerName, String blob, BlockLookupList blocks, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Map metadata, String leaseId, AccessTier tier, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, @@ -4102,15 +5754,17 @@ 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.commitBlockListNoCustomHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -4316,4 +5970,114 @@ public Mono> getBlockListNoCustomHeadersWithResponseAsync(St 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 + * lists together. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase getBlockListWithResponse(String containerName, + String blob, BlockListType listType, String snapshot, Integer timeout, String leaseId, String ifTags, + String requestId, Context context) { + final String comp = "blocklist"; + final String accept = "application/xml"; + try { + return service.getBlockListSync(this.client.getUrl(), containerName, blob, comp, snapshot, listType, + timeout, leaseId, ifTags, this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * lists together. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BlockList getBlockList(String containerName, String blob, BlockListType listType, String snapshot, + Integer timeout, String leaseId, String ifTags, String requestId) { + try { + return getBlockListWithResponse(containerName, blob, listType, snapshot, timeout, leaseId, ifTags, + requestId, Context.NONE).getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * lists together. + * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getBlockListNoCustomHeadersWithResponse(String containerName, String blob, + BlockListType listType, String snapshot, Integer timeout, String leaseId, String ifTags, String requestId, + Context context) { + final String comp = "blocklist"; + final String accept = "application/xml"; + try { + return service.getBlockListNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, snapshot, + listType, timeout, leaseId, ifTags, this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } } 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 ab18e09328427..98c26465d2b8c 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 @@ -54,6 +54,7 @@ import com.azure.storage.blob.models.BlobSignedIdentifier; import com.azure.storage.blob.models.ListBlobsIncludeItem; import com.azure.storage.blob.models.PublicAccessType; +import java.io.InputStream; import java.nio.ByteBuffer; import java.time.OffsetDateTime; import java.util.List; @@ -122,6 +123,30 @@ Mono> createNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-deny-encryption-scope-override") Boolean encryptionScopeOverridePrevented, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase createSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, + @HeaderParam("x-ms-blob-public-access") PublicAccessType access, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-default-encryption-scope") String defaultEncryptionScope, + @HeaderParam("x-ms-deny-encryption-scope-override") Boolean encryptionScopeOverridePrevented, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response createNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, + @HeaderParam("x-ms-blob-public-access") PublicAccessType access, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-default-encryption-scope") String defaultEncryptionScope, + @HeaderParam("x-ms-deny-encryption-scope-override") Boolean encryptionScopeOverridePrevented, + @HeaderParam("Accept") String accept, Context context); + @Get("/{containerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -140,6 +165,24 @@ Mono> getPropertiesNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Get("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase getPropertiesSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response getPropertiesNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + @Delete("/{containerName}") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -162,6 +205,28 @@ Mono> deleteNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Delete("/{containerName}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase deleteSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Delete("/{containerName}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response deleteNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -184,6 +249,28 @@ Mono> setMetadataNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase setMetadataSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-meta-") Map metadata, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response setMetadataNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-meta-") Map metadata, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + @Get("/{containerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -204,6 +291,26 @@ Mono> getAccessPolicyNoCustomHeaders(@Host @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Get("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase getAccessPolicySync( + @HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response getAccessPolicyNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + @Put("/{containerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -232,6 +339,34 @@ Mono> setAccessPolicyNoCustomHeaders(@HostParam("url") String url @BodyParam("application/xml") BlobSignedIdentifierWrapper containerAcl, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase setAccessPolicySync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-public-access") PublicAccessType access, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/xml") BlobSignedIdentifierWrapper containerAcl, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response setAccessPolicyNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-public-access") PublicAccessType access, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/xml") BlobSignedIdentifierWrapper containerAcl, + @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -254,6 +389,28 @@ Mono> restoreNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-deleted-container-version") String deletedContainerVersion, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase restoreSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-deleted-container-name") String deletedContainerName, + @HeaderParam("x-ms-deleted-container-version") String deletedContainerVersion, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response restoreNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-deleted-container-name") String deletedContainerName, + @HeaderParam("x-ms-deleted-container-version") String deletedContainerVersion, + @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -276,6 +433,28 @@ Mono> renameNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-source-lease-id") String sourceLeaseId, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase renameSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-source-container-name") String sourceContainerName, + @HeaderParam("x-ms-source-lease-id") String sourceLeaseId, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response renameNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-source-container-name") String sourceContainerName, + @HeaderParam("x-ms-source-lease-id") String sourceLeaseId, @HeaderParam("Accept") String accept, + Context context); + @Post("/{containerName}") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -316,6 +495,26 @@ Mono submitBatchNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @BodyParam("application/xml") BinaryData body, @HeaderParam("Accept") String accept, Context context); + @Post("/{containerName}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase submitBatchSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-Type") String multipartContentType, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/xml") BinaryData body, @HeaderParam("Accept") String accept, Context context); + + @Post("/{containerName}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response submitBatchNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-Type") String multipartContentType, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/xml") BinaryData body, @HeaderParam("Accept") String accept, Context context); + @Get("/{containerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -338,6 +537,28 @@ Mono> filterBlobsNoCustomHeaders(@HostParam("url") S @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, @HeaderParam("Accept") String accept, Context context); + @Get("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase filterBlobsSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @QueryParam("where") String where, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, + @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response filterBlobsNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @QueryParam("where") String where, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, + @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -365,12 +586,26 @@ Mono> acquireLeaseNoCustomHeaders(@HostParam("url") String url, @HeaderParam("Accept") String accept, Context context); @Put("/{containerName}") - @ExpectedResponses({ 200 }) + @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> releaseLease(@HostParam("url") String url, + ResponseBase acquireLeaseSync(@HostParam("url") String url, @PathParam("containerName") String containerName, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-duration") Integer duration, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response acquireLeaseNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("comp") String comp, + @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-duration") Integer duration, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @@ -379,7 +614,7 @@ Mono> releaseLease(@HostParam( @Put("/{containerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> releaseLeaseNoCustomHeaders(@HostParam("url") String url, + Mono> releaseLease(@HostParam("url") String url, @PathParam("containerName") String containerName, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @@ -391,7 +626,7 @@ Mono> releaseLeaseNoCustomHeaders(@HostParam("url") String url, @Put("/{containerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> renewLease(@HostParam("url") String url, + Mono> releaseLeaseNoCustomHeaders(@HostParam("url") String url, @PathParam("containerName") String containerName, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @@ -403,7 +638,7 @@ Mono> renewLease(@HostParam("url @Put("/{containerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> renewLeaseNoCustomHeaders(@HostParam("url") String url, + ResponseBase releaseLeaseSync(@HostParam("url") String url, @PathParam("containerName") String containerName, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @@ -413,24 +648,24 @@ Mono> renewLeaseNoCustomHeaders(@HostParam("url") String url, @HeaderParam("Accept") String accept, Context context); @Put("/{containerName}") - @ExpectedResponses({ 202 }) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> breakLease(@HostParam("url") String url, + Response releaseLeaseNoCustomHeadersSync(@HostParam("url") String url, @PathParam("containerName") String containerName, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-break-period") Integer breakPeriod, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); @Put("/{containerName}") - @ExpectedResponses({ 202 }) + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> breakLeaseNoCustomHeaders(@HostParam("url") String url, + Mono> renewLease(@HostParam("url") String url, @PathParam("containerName") String containerName, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, - @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-break-period") Integer breakPeriod, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @@ -439,11 +674,10 @@ Mono> breakLeaseNoCustomHeaders(@HostParam("url") String url, @Put("/{containerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> changeLease(@HostParam("url") String url, + Mono> renewLeaseNoCustomHeaders(@HostParam("url") String url, @PathParam("containerName") String containerName, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @@ -452,31 +686,164 @@ Mono> changeLease(@HostParam("u @Put("/{containerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> changeLeaseNoCustomHeaders(@HostParam("url") String url, + ResponseBase renewLeaseSync(@HostParam("url") String url, @PathParam("containerName") String containerName, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); - @Get("/{containerName}") + @Put("/{containerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> listBlobFlatSegment( - @HostParam("url") String url, @PathParam("containerName") String containerName, - @QueryParam("restype") String restype, @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, - @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, - @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, + Response renewLeaseNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("comp") String comp, + @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); - @Get("/{containerName}") - @ExpectedResponses({ 200 }) + @Put("/{containerName}") + @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> listBlobFlatSegmentNoCustomHeaders(@HostParam("url") String url, + Mono> breakLease(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("comp") String comp, + @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-break-period") Integer breakPeriod, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Mono> breakLeaseNoCustomHeaders(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("comp") String comp, + @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-break-period") Integer breakPeriod, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase breakLeaseSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("comp") String comp, + @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-break-period") Integer breakPeriod, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response breakLeaseNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("comp") String comp, + @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-break-period") Integer breakPeriod, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Mono> changeLease(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("comp") String comp, + @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Mono> changeLeaseNoCustomHeaders(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("comp") String comp, + @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase changeLeaseSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("comp") String comp, + @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response changeLeaseNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("comp") String comp, + @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Mono> listBlobFlatSegment( + @HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, + @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, + @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Mono> listBlobFlatSegmentNoCustomHeaders(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Get("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase listBlobFlatSegmentSync( + @HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, + @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, + @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response listBlobFlatSegmentNoCustomHeadersSync(@HostParam("url") String url, @PathParam("containerName") String containerName, @QueryParam("restype") String restype, @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, @@ -508,6 +875,30 @@ Mono> listBlobHierarchySegmentNoCust @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Get("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase + listBlobHierarchySegmentSync(@HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("prefix") String prefix, @QueryParam("delimiter") String delimiter, + @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, + @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response listBlobHierarchySegmentNoCustomHeadersSync( + @HostParam("url") String url, @PathParam("containerName") String containerName, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, + @QueryParam("delimiter") String delimiter, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + @Get("/{containerName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -523,6 +914,22 @@ Mono> getAccountInfoNoCustomHeaders(@HostParam("url") String url, @PathParam("containerName") String containerName, @QueryParam("restype") String restype, @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase getAccountInfoSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response getAccountInfoNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, + @HeaderParam("Accept") String accept, Context context); } /** @@ -781,92 +1188,221 @@ public Mono> createNoCustomHeadersWithResponseAsync(String contai } /** - * 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 - * Timeouts for Blob Service Operations.</a>. - * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. - * @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. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @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}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPropertiesWithResponseAsync(String containerName, - 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)) - .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. + * 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 * Timeouts for Blob Service Operations.</a>. - * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param access Specifies whether data in the container may be accessed publicly and the level of access. * @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 blobContainerEncryptionScope Parameter group. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPropertiesWithResponseAsync(String containerName, - Integer timeout, String leaseId, String requestId, Context context) { + public ResponseBase createWithResponse(String containerName, Integer timeout, + Map metadata, PublicAccessType access, String requestId, + BlobContainerEncryptionScope blobContainerEncryptionScope, 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + String defaultEncryptionScopeInternal = null; + if (blobContainerEncryptionScope != null) { + defaultEncryptionScopeInternal = blobContainerEncryptionScope.getDefaultEncryptionScope(); + } + String defaultEncryptionScope = defaultEncryptionScopeInternal; + Boolean encryptionScopeOverridePreventedInternal = null; + if (blobContainerEncryptionScope != null) { + encryptionScopeOverridePreventedInternal + = blobContainerEncryptionScope.isEncryptionScopeOverridePrevented(); + } + Boolean encryptionScopeOverridePrevented = encryptionScopeOverridePreventedInternal; + try { + return service.createSync(this.client.getUrl(), containerName, restype, timeout, metadata, access, + this.client.getVersion(), requestId, defaultEncryptionScope, encryptionScopeOverridePrevented, accept, + context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** - * returns all user-defined metadata and system properties for the specified container. The data returned does not - * include the container's list of blobs. + * 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 * Timeouts for Blob Service Operations.</a>. - * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param access Specifies whether data in the container may be accessed publicly and the level of access. * @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 blobContainerEncryptionScope Parameter group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 getPropertiesAsync(String containerName, Integer timeout, String leaseId, String requestId) { - return getPropertiesWithResponseAsync(containerName, timeout, leaseId, requestId) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(ignored -> Mono.empty()); + public void create(String containerName, Integer timeout, Map metadata, PublicAccessType access, + String requestId, BlobContainerEncryptionScope blobContainerEncryptionScope) { + createWithResponse(containerName, timeout, metadata, access, requestId, blobContainerEncryptionScope, + Context.NONE); } /** - * returns all user-defined metadata and system properties for the specified container. The data returned does not - * include the container's list of blobs. + * 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 * Timeouts for Blob Service Operations.</a>. - * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param access Specifies whether data in the container may be accessed publicly and the level of access. + * @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 blobContainerEncryptionScope Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createNoCustomHeadersWithResponse(String containerName, Integer timeout, + Map metadata, PublicAccessType access, String requestId, + BlobContainerEncryptionScope blobContainerEncryptionScope, Context context) { + final String restype = "container"; + final String accept = "application/xml"; + String defaultEncryptionScopeInternal = null; + if (blobContainerEncryptionScope != null) { + defaultEncryptionScopeInternal = blobContainerEncryptionScope.getDefaultEncryptionScope(); + } + String defaultEncryptionScope = defaultEncryptionScopeInternal; + Boolean encryptionScopeOverridePreventedInternal = null; + if (blobContainerEncryptionScope != null) { + encryptionScopeOverridePreventedInternal + = blobContainerEncryptionScope.isEncryptionScopeOverridePrevented(); + } + Boolean encryptionScopeOverridePrevented = encryptionScopeOverridePreventedInternal; + try { + return service.createNoCustomHeadersSync(this.client.getUrl(), containerName, restype, timeout, metadata, + access, this.client.getVersion(), requestId, defaultEncryptionScope, encryptionScopeOverridePrevented, + accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPropertiesWithResponseAsync(String containerName, + 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)) + .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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPropertiesWithResponseAsync(String containerName, + 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) + .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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @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 context The context to associate with this operation. @@ -938,6 +1474,86 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String .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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase getPropertiesWithResponse(String containerName, + Integer timeout, String leaseId, String requestId, Context context) { + final String restype = "container"; + final String accept = "application/xml"; + try { + return service.getPropertiesSync(this.client.getUrl(), containerName, restype, timeout, leaseId, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void getProperties(String containerName, Integer timeout, String leaseId, String requestId) { + getPropertiesWithResponse(containerName, timeout, leaseId, requestId, Context.NONE); + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPropertiesNoCustomHeadersWithResponse(String containerName, Integer timeout, + String leaseId, String requestId, Context context) { + final String restype = "container"; + final String accept = "application/xml"; + try { + return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), containerName, restype, timeout, + leaseId, this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * operation marks the specified container for deletion. The container and any blobs contained within it are later * deleted during garbage collection. @@ -1140,80 +1756,108 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String contai } /** - * operation sets one or more user-defined name-value pairs for the specified container. + * 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 * Timeouts for Blob Service Operations.</a>. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value - * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. - * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and - * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names - * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata - * for more information. * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. * @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 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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setMetadataWithResponseAsync(String containerName, - Integer timeout, String leaseId, Map metadata, OffsetDateTime ifModifiedSince, - String requestId) { + public ResponseBase deleteWithResponse(String containerName, Integer timeout, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + Context context) { final String restype = "container"; - final String comp = "metadata"; final String accept = "application/xml"; DateTimeRfc1123 ifModifiedSinceConverted = 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.deleteSync(this.client.getUrl(), containerName, restype, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, + context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** - * operation sets one or more user-defined name-value pairs for the specified container. + * 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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String containerName, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId) { + deleteWithResponse(containerName, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, requestId, + Context.NONE); + } + + /** + * 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 * Timeouts for Blob Service Operations.</a>. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value - * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. - * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and - * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names - * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata - * for more information. * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. * @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 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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setMetadataWithResponseAsync(String containerName, - Integer timeout, String leaseId, Map metadata, OffsetDateTime ifModifiedSince, String requestId, - Context context) { + public Response deleteNoCustomHeadersWithResponse(String containerName, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { final String restype = "container"; - final String comp = "metadata"; 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.deleteNoCustomHeadersSync(this.client.getUrl(), containerName, restype, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, + context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -1237,10 +1881,87 @@ public Mono> setMetadataWithRes * @throws IllegalArgumentException thrown if parameters fail the validation. * @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. + * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setMetadataAsync(String containerName, Integer timeout, String leaseId, + public Mono> setMetadataWithResponseAsync(String containerName, + Integer timeout, String leaseId, Map metadata, OffsetDateTime ifModifiedSince, + String requestId) { + final String restype = "container"; + final String comp = "metadata"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = 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)) + .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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setMetadataWithResponseAsync(String containerName, + Integer timeout, String leaseId, Map metadata, OffsetDateTime ifModifiedSince, String requestId, + Context context) { + final String restype = "container"; + final String comp = "metadata"; + 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) + .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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 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) @@ -1356,6 +2077,115 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String c .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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase setMetadataWithResponse(String containerName, + Integer timeout, String leaseId, Map metadata, OffsetDateTime ifModifiedSince, String requestId, + Context context) { + final String restype = "container"; + final String comp = "metadata"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + try { + return service.setMetadataSync(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, + metadata, ifModifiedSinceConverted, this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void setMetadata(String containerName, Integer timeout, String leaseId, Map metadata, + OffsetDateTime ifModifiedSince, String requestId) { + setMetadataWithResponse(containerName, timeout, leaseId, metadata, ifModifiedSince, requestId, Context.NONE); + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setMetadataNoCustomHeadersWithResponse(String containerName, Integer timeout, String leaseId, + Map metadata, OffsetDateTime ifModifiedSince, String requestId, Context context) { + final String restype = "container"; + final String comp = "metadata"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + try { + return service.setMetadataNoCustomHeadersSync(this.client.getUrl(), containerName, restype, comp, timeout, + leaseId, metadata, ifModifiedSinceConverted, this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * gets the permissions for the specified container. The permissions indicate whether container data may be accessed * publicly. @@ -1524,6 +2354,94 @@ public Mono> getAccessPolicyNoCustomHeader .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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the permissions for the specified container along with {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase getAccessPolicyWithResponse( + String containerName, Integer timeout, String leaseId, String requestId, Context context) { + final String restype = "container"; + final String comp = "acl"; + final String accept = "application/xml"; + try { + return service.getAccessPolicySync(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 permissions for the specified container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BlobSignedIdentifierWrapper getAccessPolicy(String containerName, Integer timeout, String leaseId, + String requestId) { + try { + return getAccessPolicyWithResponse(containerName, timeout, leaseId, requestId, Context.NONE).getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the permissions for the specified container along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAccessPolicyNoCustomHeadersWithResponse(String containerName, + Integer timeout, String leaseId, String requestId, Context context) { + final String restype = "container"; + final String comp = "acl"; + final String accept = "application/xml"; + try { + return service.getAccessPolicyNoCustomHeadersSync(this.client.getUrl(), containerName, restype, comp, + timeout, leaseId, this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * sets the permissions for the specified container. The permissions indicate whether blobs in a container may be * accessed publicly. @@ -1756,26 +2674,143 @@ public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync(Stri } /** - * Restores a previously-deleted container. + * 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 * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param access Specifies whether data in the container may be accessed publicly and the level of access. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. * @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 deletedContainerName Optional. Version 2019-12-12 and later. Specifies the name of the deleted container - * to restore. - * @param deletedContainerVersion Optional. Version 2019-12-12 and later. Specifies the version of the deleted - * container to restore. + * @param containerAcl the acls for the container. + * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> restoreWithResponseAsync(String containerName, - Integer timeout, String requestId, String deletedContainerName, String deletedContainerVersion) { + public ResponseBase setAccessPolicyWithResponse(String containerName, + Integer timeout, String leaseId, PublicAccessType access, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId, List containerAcl, Context context) { + final String restype = "container"; + final String comp = "acl"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + BlobSignedIdentifierWrapper containerAclConverted = new BlobSignedIdentifierWrapper(containerAcl); + try { + return service.setAccessPolicySync(this.client.getUrl(), containerName, restype, comp, timeout, leaseId, + access, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, + containerAclConverted, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param access Specifies whether data in the container may be accessed publicly and the level of access. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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 containerAcl the acls for the container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void setAccessPolicy(String containerName, Integer timeout, String leaseId, PublicAccessType access, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + List containerAcl) { + setAccessPolicyWithResponse(containerName, timeout, leaseId, access, ifModifiedSince, ifUnmodifiedSince, + requestId, containerAcl, Context.NONE); + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param access Specifies whether data in the container may be accessed publicly and the level of access. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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 containerAcl the acls for the container. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setAccessPolicyNoCustomHeadersWithResponse(String containerName, Integer timeout, + String leaseId, PublicAccessType access, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String requestId, List containerAcl, Context context) { + final String restype = "container"; + final String comp = "acl"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + BlobSignedIdentifierWrapper containerAclConverted = new BlobSignedIdentifierWrapper(containerAcl); + try { + return service.setAccessPolicyNoCustomHeadersSync(this.client.getUrl(), containerName, restype, comp, + timeout, leaseId, access, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + this.client.getVersion(), requestId, containerAclConverted, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @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 deletedContainerName Optional. Version 2019-12-12 and later. Specifies the name of the deleted container + * to restore. + * @param deletedContainerVersion Optional. Version 2019-12-12 and later. Specifies the version of the deleted + * container to restore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> restoreWithResponseAsync(String containerName, + Integer timeout, String requestId, String deletedContainerName, String deletedContainerVersion) { final String restype = "container"; final String comp = "undelete"; final String accept = "application/xml"; @@ -1933,6 +2968,96 @@ public Mono> restoreNoCustomHeadersWithResponseAsync(String conta .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 + * Timeouts for Blob Service Operations.</a>. + * @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 deletedContainerName Optional. Version 2019-12-12 and later. Specifies the name of the deleted container + * to restore. + * @param deletedContainerVersion Optional. Version 2019-12-12 and later. Specifies the version of the deleted + * container to restore. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase restoreWithResponse(String containerName, Integer timeout, + String requestId, String deletedContainerName, String deletedContainerVersion, Context context) { + final String restype = "container"; + final String comp = "undelete"; + final String accept = "application/xml"; + try { + return service.restoreSync(this.client.getUrl(), containerName, restype, comp, timeout, + this.client.getVersion(), requestId, deletedContainerName, deletedContainerVersion, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @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 deletedContainerName Optional. Version 2019-12-12 and later. Specifies the name of the deleted container + * to restore. + * @param deletedContainerVersion Optional. Version 2019-12-12 and later. Specifies the version of the deleted + * container to restore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void restore(String containerName, Integer timeout, String requestId, String deletedContainerName, + String deletedContainerVersion) { + restoreWithResponse(containerName, timeout, requestId, deletedContainerName, deletedContainerVersion, + Context.NONE); + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @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 deletedContainerName Optional. Version 2019-12-12 and later. Specifies the name of the deleted container + * to restore. + * @param deletedContainerVersion Optional. Version 2019-12-12 and later. Specifies the version of the deleted + * container to restore. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response restoreNoCustomHeadersWithResponse(String containerName, Integer timeout, String requestId, + String deletedContainerName, String deletedContainerVersion, Context context) { + final String restype = "container"; + final String comp = "undelete"; + final String accept = "application/xml"; + try { + return service.restoreNoCustomHeadersSync(this.client.getUrl(), containerName, restype, comp, timeout, + this.client.getVersion(), requestId, deletedContainerName, deletedContainerVersion, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * Renames an existing container. * @@ -2102,6 +3227,92 @@ public Mono> renameNoCustomHeadersWithResponseAsync(String contai .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 sourceLeaseId A lease ID for the source path. If specified, the source path must have an active lease and + * the lease ID must match. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase renameWithResponse(String containerName, + String sourceContainerName, Integer timeout, String requestId, String sourceLeaseId, Context context) { + final String restype = "container"; + final String comp = "rename"; + final String accept = "application/xml"; + try { + return service.renameSync(this.client.getUrl(), containerName, restype, comp, timeout, + this.client.getVersion(), requestId, sourceContainerName, sourceLeaseId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 sourceLeaseId A lease ID for the source path. If specified, the source path must have an active lease and + * the lease ID must match. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void rename(String containerName, String sourceContainerName, Integer timeout, String requestId, + String sourceLeaseId) { + renameWithResponse(containerName, sourceContainerName, timeout, requestId, sourceLeaseId, Context.NONE); + } + + /** + * 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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @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 sourceLeaseId A lease ID for the source path. If specified, the source path must have an active lease and + * the lease ID must match. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renameNoCustomHeadersWithResponse(String containerName, String sourceContainerName, + Integer timeout, String requestId, String sourceLeaseId, Context context) { + final String restype = "container"; + final String comp = "rename"; + final String accept = "application/xml"; + try { + return service.renameNoCustomHeadersSync(this.client.getUrl(), containerName, restype, comp, timeout, + this.client.getVersion(), requestId, sourceContainerName, sourceLeaseId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * The Batch operation allows multiple API calls to be embedded into a single HTTP request. * @@ -2457,27 +3668,124 @@ public Mono submitBatchNoCustomHeadersWithResponseAsync(String c } /** - * 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. + * 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. + * Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param body Initial data. * @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>. * @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 where Filters the results to return only to return only blobs whose tags match the specified expression. - * @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 - * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as - * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value - * is opaque to the client. - * @param maxresults Specifies the maximum number of containers to return. If the request does not specify - * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the - * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving - * the remainder of the results. For this reason, it is possible that the service will return fewer results than - * specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify one or more datasets to include in the response. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase submitBatchWithResponse(String containerName, + long contentLength, String multipartContentType, BinaryData body, Integer timeout, String requestId, + Context context) { + final String restype = "container"; + final String comp = "batch"; + final String accept = "application/xml"; + try { + return service.submitBatchSync(this.client.getUrl(), containerName, restype, comp, contentLength, + multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param body Initial data. + * @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>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InputStream submitBatch(String containerName, long contentLength, String multipartContentType, + BinaryData body, Integer timeout, String requestId) { + try { + return submitBatchWithResponse(containerName, contentLength, multipartContentType, body, timeout, requestId, + Context.NONE).getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param body Initial data. + * @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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response submitBatchNoCustomHeadersWithResponse(String containerName, long contentLength, + String multipartContentType, BinaryData body, Integer timeout, String requestId, Context context) { + final String restype = "container"; + final String comp = "batch"; + final String accept = "application/xml"; + try { + return service.submitBatchNoCustomHeadersSync(this.client.getUrl(), containerName, restype, comp, + contentLength, multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, + context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @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 where Filters the results to return only to return only blobs whose tags match the specified expression. + * @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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -2713,6 +4021,140 @@ public Mono> filterBlobsNoCustomHeadersWithResponseA .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 + * Timeouts for Blob Service Operations.</a>. + * @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 where Filters the results to return only to return only blobs whose tags match the specified expression. + * @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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a Filter Blobs API call along with {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase filterBlobsWithResponse(String containerName, + Integer timeout, String requestId, String where, String marker, Integer maxresults, + List include, Context context) { + final String restype = "container"; + final String comp = "blobs"; + final String accept = "application/xml"; + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + try { + return service.filterBlobsSync(this.client.getUrl(), containerName, restype, comp, timeout, + this.client.getVersion(), requestId, where, marker, maxresults, includeConverted, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @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 where Filters the results to return only to return only blobs whose tags match the specified expression. + * @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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 result of a Filter Blobs API call. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FilterBlobSegment filterBlobs(String containerName, Integer timeout, String requestId, String where, + String marker, Integer maxresults, List include) { + try { + return filterBlobsWithResponse(containerName, timeout, requestId, where, marker, maxresults, include, + Context.NONE).getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @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 where Filters the results to return only to return only blobs whose tags match the specified expression. + * @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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a Filter Blobs API call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response filterBlobsNoCustomHeadersWithResponse(String containerName, Integer timeout, + String requestId, String where, String marker, Integer maxresults, List include, + Context context) { + final String restype = "container"; + final String comp = "blobs"; + final String accept = "application/xml"; + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + try { + return service.filterBlobsNoCustomHeadersSync(this.client.getUrl(), containerName, restype, comp, timeout, + this.client.getVersion(), requestId, where, marker, maxresults, includeConverted, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * [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. @@ -2923,12 +4365,457 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String * @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>. - * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never - * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or - * change. - * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) - * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID - * string formats. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String containerName, Integer timeout, + Integer duration, String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String requestId, Context context) { + final String comp = "lease"; + final String restype = "container"; + final String action = "acquire"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = 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) + .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 + * Timeouts for Blob Service Operations.</a>. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase acquireLeaseWithResponse(String containerName, + Integer timeout, Integer duration, String proposedLeaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { + final String comp = "lease"; + final String restype = "container"; + final String action = "acquire"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.acquireLeaseSync(this.client.getUrl(), containerName, comp, restype, action, timeout, + duration, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * [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 + * Timeouts for Blob Service Operations.</a>. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void acquireLease(String containerName, Integer timeout, Integer duration, String proposedLeaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { + acquireLeaseWithResponse(containerName, timeout, duration, proposedLeaseId, ifModifiedSince, ifUnmodifiedSince, + requestId, Context.NONE); + } + + /** + * [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 + * Timeouts for Blob Service Operations.</a>. + * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never + * expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or + * change. + * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response acquireLeaseNoCustomHeadersWithResponse(String containerName, Integer timeout, + Integer duration, String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String requestId, Context context) { + final String comp = "lease"; + final String restype = "container"; + final String action = "acquire"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.acquireLeaseNoCustomHeadersSync(this.client.getUrl(), containerName, comp, restype, action, + timeout, duration, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * [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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> releaseLeaseWithResponseAsync(String containerName, + String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String requestId) { + final String comp = "lease"; + final String restype = "container"; + final String action = "release"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = 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)) + .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> releaseLeaseWithResponseAsync(String containerName, + String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String requestId, Context context) { + final String comp = "lease"; + final String restype = "container"; + final String action = "release"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + 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) + .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 releaseLeaseAsync(String containerName, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { + return releaseLeaseWithResponseAsync(containerName, leaseId, timeout, ifModifiedSince, 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 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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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 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. + * @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 releaseLeaseAsync(String containerName, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { + return releaseLeaseWithResponseAsync(containerName, leaseId, timeout, ifModifiedSince, 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 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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String containerName, String leaseId, + Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { + final String comp = "lease"; + final String restype = "container"; + final String action = "release"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = 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)) + .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String containerName, String leaseId, + Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + Context context) { + final String comp = "lease"; + final String restype = "container"; + final String action = "release"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = 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) + .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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase releaseLeaseWithResponse(String containerName, + String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String requestId, Context context) { + final String comp = "lease"; + final String restype = "container"; + final String action = "release"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.releaseLeaseSync(this.client.getUrl(), containerName, comp, restype, action, timeout, + leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, + accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * [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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void releaseLease(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId) { + releaseLeaseWithResponse(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, requestId, + Context.NONE); + } + + /** + * [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 + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the * specified date/time. * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since @@ -2939,25 +4826,26 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String containerName, Integer timeout, - Integer duration, String proposedLeaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, - String requestId, Context context) { + public Response releaseLeaseNoCustomHeadersWithResponse(String containerName, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { final String comp = "lease"; final String restype = "container"; - final String action = "acquire"; + final String action = "release"; final String accept = "application/xml"; DateTimeRfc1123 ifModifiedSinceConverted = 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.releaseLeaseNoCustomHeadersSync(this.client.getUrl(), containerName, comp, restype, action, + timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), + requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -2981,19 +4869,19 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> releaseLeaseWithResponseAsync(String containerName, + public Mono> renewLeaseWithResponseAsync(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { final String comp = "lease"; final String restype = "container"; - final String action = "release"; + final String action = "renew"; final String accept = "application/xml"; DateTimeRfc1123 ifModifiedSinceConverted = 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, + .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); @@ -3021,18 +4909,18 @@ public Mono> releaseLeaseWithR * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> releaseLeaseWithResponseAsync(String containerName, + public Mono> renewLeaseWithResponseAsync(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { final String comp = "lease"; final String restype = "container"; - final String action = "release"; + final String action = "renew"; final String accept = "application/xml"; DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.releaseLease(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, + return service.renewLease(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context) .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } @@ -3058,9 +4946,9 @@ public Mono> releaseLeaseWithR * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono releaseLeaseAsync(String containerName, String leaseId, Integer timeout, + public Mono renewLeaseAsync(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { - return releaseLeaseWithResponseAsync(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, + return renewLeaseWithResponseAsync(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, requestId).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } @@ -3087,9 +4975,9 @@ public Mono releaseLeaseAsync(String containerName, String leaseId, Intege * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono releaseLeaseAsync(String containerName, String leaseId, Integer timeout, + public Mono renewLeaseAsync(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { - return releaseLeaseWithResponseAsync(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, + return renewLeaseWithResponseAsync(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, requestId, context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) .flatMap(ignored -> Mono.empty()); } @@ -3115,18 +5003,18 @@ public Mono releaseLeaseAsync(String containerName, String leaseId, Intege * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String containerName, String leaseId, + public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { final String comp = "lease"; final String restype = "container"; - final String action = "release"; + final String action = "renew"; final String accept = "application/xml"; DateTimeRfc1123 ifModifiedSinceConverted = 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, + .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); @@ -3154,19 +5042,19 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String containerName, String leaseId, + public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { final String comp = "lease"; final String restype = "container"; - final String action = "release"; + final String action = "renew"; final String accept = "application/xml"; DateTimeRfc1123 ifModifiedSinceConverted = 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, + .renewLeaseNoCustomHeaders(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context) .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); @@ -3187,15 +5075,16 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String * the specified date/time. * @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 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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renewLeaseWithResponseAsync(String containerName, - String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, - String requestId) { + public ResponseBase renewLeaseWithResponse(String containerName, String leaseId, + Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + Context context) { final String comp = "lease"; final String restype = "container"; final String action = "renew"; @@ -3204,11 +5093,13 @@ 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.renewLeaseSync(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, + context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -3226,27 +5117,15 @@ public Mono> renewLeaseWithRespo * the specified date/time. * @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 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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renewLeaseWithResponseAsync(String containerName, - String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, - String requestId, Context context) { - final String comp = "lease"; - final String restype = "container"; - final String action = "renew"; - final String accept = "application/xml"; - DateTimeRfc1123 ifModifiedSinceConverted - = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); - 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + public void renewLease(String containerName, String leaseId, Integer timeout, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId) { + renewLeaseWithResponse(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, requestId, + Context.NONE); } /** @@ -3264,17 +5143,30 @@ public Mono> renewLeaseWithRespo * the specified date/time. * @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 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. * @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. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono renewLeaseAsync(String containerName, String leaseId, Integer timeout, - OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { - return renewLeaseWithResponseAsync(containerName, leaseId, timeout, ifModifiedSince, ifUnmodifiedSince, - requestId).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(ignored -> Mono.empty()); + public Response renewLeaseNoCustomHeadersWithResponse(String containerName, String leaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { + final String comp = "lease"; + final String restype = "container"; + final String action = "renew"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.renewLeaseNoCustomHeadersSync(this.client.getUrl(), containerName, comp, restype, action, + timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), + requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -3282,28 +5174,43 @@ public Mono renewLeaseAsync(String containerName, String leaseId, Integer * 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 * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. + * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in + * seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. + * If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + * expired, but the lease may be held for longer than the break period. If this header does not appear with a break + * operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks + * immediately. * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the * specified date/time. * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since * the specified date/time. * @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 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. * @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. + * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - 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).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(ignored -> Mono.empty()); + public Mono> breakLeaseWithResponseAsync(String containerName, + Integer timeout, Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String requestId) { + final String comp = "lease"; + final String restype = "container"; + final String action = "break"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = 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)) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -3311,36 +5218,41 @@ public Mono renewLeaseAsync(String containerName, String leaseId, Integer * 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 * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. + * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in + * seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. + * If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + * expired, but the lease may be held for longer than the break period. If this header does not appear with a break + * operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks + * immediately. * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the * specified date/time. * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since * the specified date/time. * @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 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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String containerName, String leaseId, - Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { + public Mono> breakLeaseWithResponseAsync(String containerName, + Integer timeout, Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String requestId, Context context) { final String comp = "lease"; final String restype = "container"; - final String action = "renew"; + final String action = "break"; final String accept = "application/xml"; DateTimeRfc1123 ifModifiedSinceConverted = 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 service.breakLease(this.client.getUrl(), containerName, comp, restype, action, timeout, breakPeriod, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, accept, context) .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } @@ -3349,39 +5261,32 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String co * 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 * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting * Timeouts for Blob Service Operations.</a>. + * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in + * seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. + * If longer, the time remaining on the lease is used. A new lease will not be available before the break period has + * expired, but the lease may be held for longer than the break period. If this header does not appear with a break + * operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks + * immediately. * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the * specified date/time. * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since * the specified date/time. * @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 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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String containerName, String leaseId, - Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, - Context context) { - final String comp = "lease"; - final String restype = "container"; - final String action = "renew"; - final String accept = "application/xml"; - DateTimeRfc1123 ifModifiedSinceConverted - = 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + public Mono breakLeaseAsync(String containerName, Integer timeout, Integer breakPeriod, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { + return breakLeaseWithResponseAsync(containerName, timeout, breakPeriod, ifModifiedSince, ifUnmodifiedSince, + requestId).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -3404,28 +5309,18 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String co * the specified date/time. * @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 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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> breakLeaseWithResponseAsync(String containerName, - Integer timeout, Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, - String requestId) { - final String comp = "lease"; - final String restype = "container"; - final String action = "break"; - final String accept = "application/xml"; - DateTimeRfc1123 ifModifiedSinceConverted - = 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + 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).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(ignored -> Mono.empty()); } /** @@ -3448,16 +5343,14 @@ public Mono> breakLeaseWithRespo * the specified date/time. * @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 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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> breakLeaseWithResponseAsync(String containerName, - Integer timeout, Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, - String requestId, Context context) { + public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String containerName, Integer timeout, + Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { final String comp = "lease"; final String restype = "container"; final String action = "break"; @@ -3466,8 +5359,10 @@ public Mono> breakLeaseWithRespo = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); 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) + 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); } @@ -3491,17 +5386,29 @@ public Mono> breakLeaseWithRespo * the specified date/time. * @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 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. * @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. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono breakLeaseAsync(String containerName, Integer timeout, Integer breakPeriod, - OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { - return breakLeaseWithResponseAsync(containerName, timeout, breakPeriod, ifModifiedSince, ifUnmodifiedSince, - requestId).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(ignored -> Mono.empty()); + public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String containerName, Integer timeout, + Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + Context context) { + final String comp = "lease"; + final String restype = "container"; + final String action = "break"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = 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) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -3528,14 +5435,27 @@ public Mono breakLeaseAsync(String containerName, Integer timeout, Integer * @throws IllegalArgumentException thrown if parameters fail the validation. * @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. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - 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).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(ignored -> Mono.empty()); + public ResponseBase breakLeaseWithResponse(String containerName, Integer timeout, + Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, + Context context) { + final String comp = "lease"; + final String restype = "container"; + final String action = "break"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.breakLeaseSync(this.client.getUrl(), containerName, comp, restype, action, timeout, + breakPeriod, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), requestId, + accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -3561,24 +5481,12 @@ public Mono breakLeaseAsync(String containerName, Integer timeout, Integer * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String containerName, Integer timeout, - Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { - final String comp = "lease"; - final String restype = "container"; - final String action = "break"; - final String accept = "application/xml"; - DateTimeRfc1123 ifModifiedSinceConverted - = 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + public void breakLease(String containerName, Integer timeout, Integer breakPeriod, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId) { + breakLeaseWithResponse(containerName, timeout, breakPeriod, ifModifiedSince, ifUnmodifiedSince, requestId, + Context.NONE); } /** @@ -3605,10 +5513,10 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String co * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String containerName, Integer timeout, + public Response breakLeaseNoCustomHeadersWithResponse(String containerName, Integer timeout, Integer breakPeriod, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { final String comp = "lease"; @@ -3619,11 +5527,13 @@ 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.breakLeaseNoCustomHeadersSync(this.client.getUrl(), containerName, comp, restype, action, + timeout, breakPeriod, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), + requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -3861,6 +5771,125 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String c .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) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase changeLeaseWithResponse(String containerName, + String leaseId, String proposedLeaseId, Integer timeout, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String requestId, Context context) { + final String comp = "lease"; + final String restype = "container"; + final String action = "change"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.changeLeaseSync(this.client.getUrl(), containerName, comp, restype, action, timeout, leaseId, + proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.getVersion(), + requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * [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) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void changeLease(String containerName, String leaseId, String proposedLeaseId, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String requestId) { + changeLeaseWithResponse(containerName, leaseId, proposedLeaseId, timeout, ifModifiedSince, ifUnmodifiedSince, + requestId, Context.NONE); + } + + /** + * [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) + * if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID + * string formats. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response changeLeaseNoCustomHeadersWithResponse(String containerName, String leaseId, + String proposedLeaseId, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String requestId, Context context) { + final String comp = "lease"; + final String restype = "container"; + final String action = "change"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.changeLeaseNoCustomHeadersSync(this.client.getUrl(), containerName, comp, restype, action, + timeout, leaseId, proposedLeaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * [Update] The List Blobs operation returns a list of the blobs under the specified container. * @@ -3927,16 +5956,130 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String c * Timeouts for Blob Service Operations.</a>. * @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 context The context to associate with this operation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of blobs along with {@link ResponseBase} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> + listBlobFlatSegmentWithResponseAsync(String containerName, String prefix, String marker, Integer maxresults, + List include, Integer timeout, String requestId, Context context) { + final String restype = "container"; + final String comp = "list"; + final String accept = "application/xml"; + String includeConverted = (include == null) + ? null + : 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) + .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 + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @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>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 an enumeration of blobs on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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).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 + * listing operation. The operation returns the NextMarker value within the response body if the listing operation + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of blobs on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listBlobFlatSegmentAsync(String containerName, String prefix, + String marker, Integer maxresults, List include, Integer timeout, String requestId, + Context context) { + return listBlobFlatSegmentWithResponseAsync(containerName, prefix, marker, maxresults, include, 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 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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @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>. + * @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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 an enumeration of blobs along with {@link ResponseBase} on successful completion of {@link Mono}. + * @return an enumeration of blobs along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - listBlobFlatSegmentWithResponseAsync(String containerName, String prefix, String marker, Integer maxresults, - List include, Integer timeout, String requestId, Context context) { + public Mono> listBlobFlatSegmentNoCustomHeadersWithResponseAsync( + String containerName, String prefix, String marker, Integer maxresults, List include, + Integer timeout, String requestId) { final String restype = "container"; final String comp = "list"; final String accept = "application/xml"; @@ -3945,9 +6088,10 @@ 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 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); } @@ -3972,17 +6116,28 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String c * Timeouts for Blob Service Operations.</a>. * @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 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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an enumeration of blobs on successful completion of {@link Mono}. + * @return an enumeration of blobs along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - 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).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public Mono> listBlobFlatSegmentNoCustomHeadersWithResponseAsync( + String containerName, String prefix, String marker, Integer maxresults, List include, + Integer timeout, String requestId, Context context) { + final String restype = "container"; + final String comp = "list"; + final String accept = "application/xml"; + String includeConverted = (include == null) + ? null + : 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) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -4010,15 +6165,26 @@ public Mono listBlobFlatSegmentAsync(String contai * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 an enumeration of blobs on successful completion of {@link Mono}. + * @return an enumeration of blobs along with {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono listBlobFlatSegmentAsync(String containerName, String prefix, - String marker, Integer maxresults, List include, Integer timeout, String requestId, - Context context) { - return listBlobFlatSegmentWithResponseAsync(containerName, prefix, marker, maxresults, include, timeout, - requestId, context).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public ResponseBase + listBlobFlatSegmentWithResponse(String containerName, String prefix, String marker, Integer maxresults, + List include, Integer timeout, String requestId, Context context) { + final String restype = "container"; + final String comp = "list"; + final String accept = "application/xml"; + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + try { + return service.listBlobFlatSegmentSync(this.client.getUrl(), containerName, restype, comp, prefix, marker, + maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -4045,25 +6211,17 @@ public Mono listBlobFlatSegmentAsync(String contai * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 an enumeration of blobs along with {@link Response} on successful completion of {@link Mono}. + * @return an enumeration of blobs. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listBlobFlatSegmentNoCustomHeadersWithResponseAsync( - String containerName, String prefix, String marker, Integer maxresults, List include, - Integer timeout, String requestId) { - final String restype = "container"; - final String comp = "list"; - final String accept = "application/xml"; - String includeConverted = (include == null) - ? null - : 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + public ListBlobsFlatSegmentResponse listBlobFlatSegment(String containerName, String prefix, String marker, + Integer maxresults, List include, Integer timeout, String requestId) { + try { + return listBlobFlatSegmentWithResponse(containerName, prefix, marker, maxresults, include, timeout, + requestId, Context.NONE).getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -4091,12 +6249,12 @@ public Mono> listBlobFlatSegmentNoCustomH * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 an enumeration of blobs along with {@link Response} on successful completion of {@link Mono}. + * @return an enumeration of blobs along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listBlobFlatSegmentNoCustomHeadersWithResponseAsync( - String containerName, String prefix, String marker, Integer maxresults, List include, - Integer timeout, String requestId, Context context) { + public Response listBlobFlatSegmentNoCustomHeadersWithResponse(String containerName, + String prefix, String marker, Integer maxresults, List include, Integer timeout, + String requestId, Context context) { final String restype = "container"; final String comp = "list"; final String accept = "application/xml"; @@ -4105,10 +6263,13 @@ 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.listBlobFlatSegmentNoCustomHeadersSync(this.client.getUrl(), containerName, restype, comp, + prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, + context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -4383,6 +6544,150 @@ public Mono> listBlobHierarchySegmen .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 + * appearance of the delimiter character. The delimiter may be a single character or a string. + * @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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of blobs along with {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase + listBlobHierarchySegmentWithResponse(String containerName, String delimiter, String prefix, String marker, + Integer maxresults, List include, Integer timeout, String requestId, + Context context) { + final String restype = "container"; + final String comp = "list"; + final String accept = "application/xml"; + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + try { + return service.listBlobHierarchySegmentSync(this.client.getUrl(), containerName, restype, comp, prefix, + delimiter, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, accept, + context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * [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 + * appearance of the delimiter character. The delimiter may be a single character or a string. + * @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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @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>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 an enumeration of blobs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ListBlobsHierarchySegmentResponse listBlobHierarchySegment(String containerName, String delimiter, + String prefix, String marker, Integer maxresults, List include, Integer timeout, + String requestId) { + try { + return listBlobHierarchySegmentWithResponse(containerName, delimiter, prefix, marker, maxresults, include, + timeout, requestId, Context.NONE).getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * [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 + * appearance of the delimiter character. The delimiter may be a single character or a string. + * @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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of blobs along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listBlobHierarchySegmentNoCustomHeadersWithResponse( + String containerName, String delimiter, String prefix, String marker, Integer maxresults, + List include, Integer timeout, String requestId, Context context) { + final String restype = "container"; + final String comp = "list"; + final String accept = "application/xml"; + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + try { + return service.listBlobHierarchySegmentNoCustomHeadersSync(this.client.getUrl(), containerName, restype, + comp, prefix, delimiter, marker, maxresults, includeConverted, timeout, this.client.getVersion(), + requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * Returns the sku name and account kind. * @@ -4499,4 +6804,64 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Strin 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. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase getAccountInfoWithResponse(String containerName, + Context context) { + final String restype = "account"; + final String comp = "properties"; + final String accept = "application/xml"; + try { + return service.getAccountInfoSync(this.client.getUrl(), containerName, restype, comp, + this.client.getVersion(), accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void getAccountInfo(String containerName) { + getAccountInfoWithResponse(containerName, Context.NONE); + } + + /** + * 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. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAccountInfoNoCustomHeadersWithResponse(String containerName, Context context) { + final String restype = "account"; + final String comp = "properties"; + final String accept = "application/xml"; + try { + return service.getAccountInfoNoCustomHeadersSync(this.client.getUrl(), containerName, restype, comp, + this.client.getVersion(), accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } } 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 f68cf7adea5ae..24a25a6b8a70e 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 @@ -143,6 +143,66 @@ Mono> createNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, @HeaderParam("x-ms-legal-hold") Boolean legalHold, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase createSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @HeaderParam("x-ms-blob-type") String blobType, @QueryParam("timeout") Integer timeout, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-access-tier") PremiumPageBlobAccessTier tier, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-blob-content-length") long blobContentLength, + @HeaderParam("x-ms-blob-sequence-number") Long blobSequenceNumber, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response createNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @HeaderParam("x-ms-blob-type") String blobType, @QueryParam("timeout") Integer timeout, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("x-ms-access-tier") PremiumPageBlobAccessTier tier, + @HeaderParam("x-ms-blob-content-type") String contentType, + @HeaderParam("x-ms-blob-content-encoding") String contentEncoding, + @HeaderParam("x-ms-blob-content-language") String contentLanguage, + @HeaderParam("x-ms-blob-content-md5") String contentMd5, + @HeaderParam("x-ms-blob-cache-control") String cacheControl, + @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-blob-content-disposition") String contentDisposition, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-blob-content-length") long blobContentLength, + @HeaderParam("x-ms-blob-sequence-number") Long blobSequenceNumber, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-tags") String blobTagsString, + @HeaderParam("x-ms-immutability-policy-until-date") DateTimeRfc1123 immutabilityPolicyExpiry, + @HeaderParam("x-ms-immutability-policy-mode") BlobImmutabilityPolicyMode immutabilityPolicyMode, + @HeaderParam("x-ms-legal-hold") Boolean legalHold, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -243,6 +303,56 @@ Mono> uploadPagesNoCustomHeaders(@HostParam("url") String url, @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase uploadPagesSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, + @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, + @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response uploadPagesNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-MD5") String transactionalContentMD5, + @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, + @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, + @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/octet-stream") BinaryData body, @HeaderParam("Accept") String accept, + Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -287,6 +397,50 @@ Mono> clearPagesNoCustomHeaders(@HostParam("url") String url, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase clearPagesSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, + @HeaderParam("Content-Length") long contentLength, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, + @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, + @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response clearPagesNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, + @HeaderParam("Content-Length") long contentLength, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, + @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, + @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -345,6 +499,64 @@ Mono> uploadPagesFromURLNoCustomHeaders(@HostParam("url") String @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase uploadPagesFromURLSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, + @HeaderParam("x-ms-copy-source") String sourceUrl, @HeaderParam("x-ms-source-range") String sourceRange, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, + @HeaderParam("Content-Length") long contentLength, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, + @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, + @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response uploadPagesFromURLNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, + @HeaderParam("x-ms-copy-source") String sourceUrl, @HeaderParam("x-ms-source-range") String sourceRange, + @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, + @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, + @HeaderParam("Content-Length") long contentLength, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, + @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, + @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, + @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, + @HeaderParam("x-ms-source-if-match") String sourceIfMatch, + @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-copy-source-authorization") String copySourceAuthorization, + @HeaderParam("Accept") String accept, Context context); + @Get("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -378,11 +590,10 @@ Mono> getPageRangesNoCustomHeaders(@HostParam("url") String u @Get("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> getPageRangesDiff(@HostParam("url") String url, + ResponseBase getPageRangesSync(@HostParam("url") String url, @PathParam("containerName") String containerName, @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, - @QueryParam("timeout") Integer timeout, @QueryParam("prevsnapshot") String prevsnapshot, - @HeaderParam("x-ms-previous-snapshot-url") String prevSnapshotUrl, @HeaderParam("x-ms-range") String range, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @@ -394,11 +605,10 @@ Mono> getPageRangesDif @Get("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> getPageRangesDiffNoCustomHeaders(@HostParam("url") String url, + Response getPageRangesNoCustomHeadersSync(@HostParam("url") String url, @PathParam("containerName") String containerName, @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, - @QueryParam("timeout") Integer timeout, @QueryParam("prevsnapshot") String prevsnapshot, - @HeaderParam("x-ms-previous-snapshot-url") String prevSnapshotUrl, @HeaderParam("x-ms-range") String range, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @@ -407,47 +617,145 @@ Mono> getPageRangesDiffNoCustomHeaders(@HostParam("url") Stri @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @HeaderParam("Accept") String accept, Context context); - @Put("/{containerName}/{blob}") + @Get("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> resize(@HostParam("url") String url, + Mono> getPageRangesDiff(@HostParam("url") String url, @PathParam("containerName") String containerName, @PathParam("blob") String blob, - @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, - @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, - @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, - @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("timeout") Integer timeout, @QueryParam("prevsnapshot") String prevsnapshot, + @HeaderParam("x-ms-previous-snapshot-url") String prevSnapshotUrl, @HeaderParam("x-ms-range") String range, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, - @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-blob-content-length") long blobContentLength, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @HeaderParam("Accept") String accept, Context context); - @Put("/{containerName}/{blob}") + @Get("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> resizeNoCustomHeaders(@HostParam("url") String url, + Mono> getPageRangesDiffNoCustomHeaders(@HostParam("url") String url, @PathParam("containerName") String containerName, @PathParam("blob") String blob, - @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, - @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, - @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, - @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("timeout") Integer timeout, @QueryParam("prevsnapshot") String prevsnapshot, + @HeaderParam("x-ms-previous-snapshot-url") String prevSnapshotUrl, @HeaderParam("x-ms-range") String range, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, - @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-blob-content-length") long blobContentLength, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("Accept") String accept, Context context); + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @HeaderParam("Accept") String accept, Context context); - @Put("/{containerName}/{blob}") + @Get("/{containerName}/{blob}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) - Mono> updateSequenceNumber( - @HostParam("url") String url, @PathParam("containerName") String containerName, - @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-lease-id") String leaseId, + ResponseBase getPageRangesDiffSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("timeout") Integer timeout, @QueryParam("prevsnapshot") String prevsnapshot, + @HeaderParam("x-ms-previous-snapshot-url") String prevSnapshotUrl, @HeaderParam("x-ms-range") String range, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @HeaderParam("Accept") String accept, Context context); + + @Get("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response getPageRangesDiffNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("snapshot") String snapshot, + @QueryParam("timeout") Integer timeout, @QueryParam("prevsnapshot") String prevsnapshot, + @HeaderParam("x-ms-previous-snapshot-url") String prevSnapshotUrl, @HeaderParam("x-ms-range") String range, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Mono> resize(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-blob-content-length") long blobContentLength, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Mono> resizeNoCustomHeaders(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-blob-content-length") long blobContentLength, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase resizeSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-blob-content-length") long blobContentLength, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response resizeNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, + @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, + @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, + @HeaderParam("x-ms-encryption-scope") String encryptionScope, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-blob-content-length") long blobContentLength, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Mono> updateSequenceNumber( + @HostParam("url") String url, @PathParam("containerName") String containerName, + @PathParam("blob") String blob, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @@ -473,6 +781,38 @@ Mono> updateSequenceNumberNoCustomHeaders(@HostParam("url") Strin @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase updateSequenceNumberSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-sequence-number-action") SequenceNumberActionType sequenceNumberAction, + @HeaderParam("x-ms-blob-sequence-number") Long blobSequenceNumber, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response updateSequenceNumberNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, + @HeaderParam("x-ms-sequence-number-action") SequenceNumberActionType sequenceNumberAction, + @HeaderParam("x-ms-blob-sequence-number") Long blobSequenceNumber, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + @Put("/{containerName}/{blob}") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -498,6 +838,32 @@ Mono> copyIncrementalNoCustomHeaders(@HostParam("url") String url @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-copy-source") String copySource, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase copyIncrementalSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-copy-source") String copySource, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{containerName}/{blob}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response copyIncrementalNoCustomHeadersSync(@HostParam("url") String url, + @PathParam("containerName") String containerName, @PathParam("blob") String blob, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, + @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("x-ms-if-tags") String ifTags, @HeaderParam("x-ms-copy-source") String copySource, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); } /** @@ -1093,25 +1459,24 @@ public Mono> createNoCustomHeadersWithResponseAsync(String contai } /** - * The Upload Pages operation writes a range of pages to a page blob. + * 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. - * @param body Initial data. - * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. - * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size + * must be aligned to a 512-byte boundary. * @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>. - * @param range Return only the bytes of the blob in the specified range. + * @param tier Optional. Indicates the tier to be set on the page blob. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. - * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence - * number less than or equal to the specified. - * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number - * less than the specified. - * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified - * sequence number. * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the * specified date/time. * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since @@ -1119,25 +1484,63 @@ public Mono> createNoCustomHeadersWithResponseAsync(String contai * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can + * use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. * @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 blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. + * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadPagesWithResponseAsync(String containerName, - String blob, long contentLength, Flux body, byte[] transactionalContentMD5, - byte[] transactionalContentCrc64, Integer timeout, String range, String leaseId, - Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, - OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, - String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { - final String comp = "page"; - final String pageWrite = "update"; + public ResponseBase createWithResponse(String containerName, String blob, + long contentLength, long blobContentLength, Integer timeout, PremiumPageBlobAccessTier tier, + Map metadata, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, Long blobSequenceNumber, String requestId, + String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, BlobHttpHeaders blobHttpHeaders, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String blobType = "PageBlob"; final String accept = "application/xml"; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; String encryptionKeyInternal = null; if (cpkInfo != null) { encryptionKeyInternal = cpkInfo.getEncryptionKey(); @@ -1158,36 +1561,296 @@ public Mono> uploadPagesWithResp encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); } String encryptionScope = encryptionScopeInternal; - String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); - String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + String contentMd5Converted = Base64Util.encodeToString(contentMd5); DateTimeRfc1123 ifModifiedSinceConverted = 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + try { + return service.createSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** - * The Upload Pages operation writes a range of pages to a page blob. + * 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. - * @param body Initial data. - * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. - * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size + * must be aligned to a 512-byte boundary. * @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>. - * @param range Return only the bytes of the blob in the specified range. - * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param tier Optional. Indicates the tier to be set on the page blob. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can + * use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. + * @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 blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void create(String containerName, String blob, long contentLength, long blobContentLength, Integer timeout, + PremiumPageBlobAccessTier tier, Map metadata, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, Long blobSequenceNumber, + String requestId, String blobTagsString, OffsetDateTime immutabilityPolicyExpiry, + BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, BlobHttpHeaders blobHttpHeaders, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + createWithResponse(containerName, blob, contentLength, blobContentLength, timeout, tier, metadata, leaseId, + ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, blobSequenceNumber, requestId, + blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold, blobHttpHeaders, cpkInfo, + encryptionScopeParam, Context.NONE); + } + + /** + * 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. + * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size + * must be aligned to a 512-byte boundary. + * @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>. + * @param tier Optional. Indicates the tier to be set on the page blob. + * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value + * pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. + * If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and + * metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names + * must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata + * for more information. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can + * use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. + * @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 blobTagsString Optional. Used to set blob tags in various blob operations. + * @param immutabilityPolicyExpiry Specifies the date time when the blobs immutability policy is set to expire. + * @param immutabilityPolicyMode Specifies the immutability policy mode to set on the blob. + * @param legalHold Specified if a legal hold should be set on the blob. + * @param blobHttpHeaders Parameter group. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createNoCustomHeadersWithResponse(String containerName, String blob, long contentLength, + long blobContentLength, Integer timeout, PremiumPageBlobAccessTier tier, Map metadata, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, Long blobSequenceNumber, String requestId, String blobTagsString, + OffsetDateTime immutabilityPolicyExpiry, BlobImmutabilityPolicyMode immutabilityPolicyMode, Boolean legalHold, + BlobHttpHeaders blobHttpHeaders, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String blobType = "PageBlob"; + final String accept = "application/xml"; + String contentTypeInternal = null; + if (blobHttpHeaders != null) { + contentTypeInternal = blobHttpHeaders.getContentType(); + } + String contentType = contentTypeInternal; + String contentEncodingInternal = null; + if (blobHttpHeaders != null) { + contentEncodingInternal = blobHttpHeaders.getContentEncoding(); + } + String contentEncoding = contentEncodingInternal; + String contentLanguageInternal = null; + if (blobHttpHeaders != null) { + contentLanguageInternal = blobHttpHeaders.getContentLanguage(); + } + String contentLanguage = contentLanguageInternal; + byte[] contentMd5Internal = null; + if (blobHttpHeaders != null) { + contentMd5Internal = blobHttpHeaders.getContentMd5(); + } + byte[] contentMd5 = contentMd5Internal; + String cacheControlInternal = null; + if (blobHttpHeaders != null) { + cacheControlInternal = blobHttpHeaders.getCacheControl(); + } + String cacheControl = cacheControlInternal; + String contentDispositionInternal = null; + if (blobHttpHeaders != null) { + contentDispositionInternal = blobHttpHeaders.getContentDisposition(); + } + String contentDisposition = contentDispositionInternal; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String contentMd5Converted = Base64Util.encodeToString(contentMd5); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 immutabilityPolicyExpiryConverted + = immutabilityPolicyExpiry == null ? null : new DateTimeRfc1123(immutabilityPolicyExpiry); + try { + return service.createNoCustomHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadPagesWithResponseAsync(String containerName, + String blob, long contentLength, Flux body, byte[] transactionalContentMD5, + byte[] transactionalContentCrc64, Integer timeout, String range, String leaseId, + Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + final String comp = "page"; + final String pageWrite = "update"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = 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)) + .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. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence * number less than or equal to the specified. * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number @@ -1951,11 +2614,14 @@ public Mono> uploadPagesNoCustomHeadersWithResponseAsync(String c } /** - * The Clear Pages operation clears a set of pages from a page blob. + * 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. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. * @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>. @@ -1978,16 +2644,230 @@ public Mono> uploadPagesNoCustomHeadersWithResponseAsync(String c * analytics logs when storage analytics logging is enabled. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. + * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> clearPagesWithResponseAsync(String containerName, - String blob, long contentLength, Integer timeout, String range, String leaseId, - Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, - OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + public ResponseBase uploadPagesWithResponse(String containerName, String blob, + long contentLength, BinaryData body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, + Integer timeout, String range, String leaseId, Long ifSequenceNumberLessThanOrEqualTo, + Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String comp = "page"; + final String pageWrite = "update"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.uploadPagesSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void uploadPages(String containerName, String blob, long contentLength, BinaryData body, + byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, String range, String leaseId, + Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + uploadPagesWithResponse(containerName, blob, contentLength, body, transactionalContentMD5, + transactionalContentCrc64, timeout, range, leaseId, ifSequenceNumberLessThanOrEqualTo, + ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, requestId, cpkInfo, encryptionScopeParam, Context.NONE); + } + + /** + * 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. + * @param body Initial data. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadPagesNoCustomHeadersWithResponse(String containerName, String blob, long contentLength, + BinaryData body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, + String range, String leaseId, Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, + Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, + Context context) { + final String comp = "page"; + final String pageWrite = "update"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.uploadPagesNoCustomHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> clearPagesWithResponseAsync(String containerName, + String blob, long contentLength, Integer timeout, String range, String leaseId, + Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { final String comp = "page"; final String pageWrite = "clear"; @@ -2345,22 +3225,15 @@ public Mono> clearPagesNoCustomHeadersWithResponseAsync(String co } /** - * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. + * The Clear Pages operation clears a set of pages from a page blob. * * @param containerName The container name. * @param blob The blob name. - * @param sourceUrl Specify a URL to the copy source. - * @param sourceRange Bytes of source data in the specified range. The length of this range should match the - * ContentLength header and x-ms-range/Range destination range header. * @param contentLength The length of the request. - * @param range The range of bytes to which the source range would be written. The range should be 512 aligned and - * range-end is required. - * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. - * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy - * source. * @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>. + * @param range Return only the bytes of the blob in the specified range. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence * number less than or equal to the specified. @@ -2375,34 +3248,24 @@ public Mono> clearPagesNoCustomHeadersWithResponseAsync(String co * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since - * the specified date/time. - * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified - * since the specified date/time. - * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. - * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to - * copy source. * @param cpkInfo Parameter group. * @param encryptionScopeParam Parameter group. + * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link ResponseBase} on successful completion of {@link Mono}. + * @return the {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadPagesFromURLWithResponseAsync( - String containerName, String blob, String sourceUrl, String sourceRange, long contentLength, String range, - byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String leaseId, - Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, - OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, - String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, - String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, - CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + public ResponseBase clearPagesWithResponse(String containerName, String blob, + long contentLength, Integer timeout, String range, String leaseId, Long ifSequenceNumberLessThanOrEqualTo, + Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { final String comp = "page"; - final String pageWrite = "update"; + final String pageWrite = "clear"; final String accept = "application/xml"; String encryptionKeyInternal = null; if (cpkInfo != null) { @@ -2424,34 +3287,249 @@ public Mono> uploadPagesF encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); } String encryptionScope = encryptionScopeInternal; - String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); - String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - DateTimeRfc1123 sourceIfModifiedSinceConverted - = 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, + try { + return service.clearPagesSync(this.client.getUrl(), containerName, blob, comp, pageWrite, contentLength, + timeout, range, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, - sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, - this.client.getVersion(), requestId, copySourceAuthorization, accept, context)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** - * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. + * The Clear Pages operation clears a set of pages from a page blob. * * @param containerName The container name. * @param blob The blob name. - * @param sourceUrl Specify a URL to the copy source. - * @param sourceRange Bytes of source data in the specified range. The length of this range should match the + * @param contentLength The length of the request. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void clearPages(String containerName, String blob, long contentLength, Integer timeout, String range, + String leaseId, Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, + Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + clearPagesWithResponse(containerName, blob, contentLength, timeout, range, leaseId, + ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, Context.NONE); + } + + /** + * 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. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response clearPagesNoCustomHeadersWithResponse(String containerName, String blob, long contentLength, + Integer timeout, String range, String leaseId, Long ifSequenceNumberLessThanOrEqualTo, + Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String comp = "page"; + final String pageWrite = "clear"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.clearPagesNoCustomHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @param sourceRange Bytes of source data in the specified range. The length of this range should match the + * ContentLength header and x-ms-range/Range destination range header. + * @param contentLength The length of the request. + * @param range The range of bytes to which the source range would be written. The range should be 512 aligned and + * range-end is required. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadPagesFromURLWithResponseAsync( + String containerName, String blob, String sourceUrl, String sourceRange, long contentLength, String range, + byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String leaseId, + Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + final String comp = "page"; + final String pageWrite = "update"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = 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)) + .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. + * @param sourceRange Bytes of source data in the specified range. The length of this range should match the * ContentLength header and x-ms-range/Range destination range header. * @param contentLength The length of the request. * @param range The range of bytes to which the source range would be written. The range should be 512 aligned and @@ -2810,74 +3888,615 @@ public Mono> uploadPagesFromURLNoCustomHeadersWithResponseAsync(S * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since - * the specified date/time. - * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified - * since the specified date/time. - * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. - * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadPagesFromURLNoCustomHeadersWithResponseAsync(String containerName, String blob, + String sourceUrl, String sourceRange, long contentLength, String range, byte[] sourceContentMD5, + byte[] sourceContentcrc64, Integer timeout, String leaseId, Long ifSequenceNumberLessThanOrEqualTo, + Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, String requestId, String copySourceAuthorization, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, Context context) { + final String comp = "page"; + final String pageWrite = "update"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = 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) + .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. + * @param sourceRange Bytes of source data in the specified range. The length of this range should match the + * ContentLength header and x-ms-range/Range destination range header. + * @param contentLength The length of the request. + * @param range The range of bytes to which the source range would be written. The range should be 512 aligned and + * range-end is required. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase uploadPagesFromURLWithResponse(String containerName, + String blob, String sourceUrl, String sourceRange, long contentLength, String range, byte[] sourceContentMD5, + byte[] sourceContentcrc64, Integer timeout, String leaseId, Long ifSequenceNumberLessThanOrEqualTo, + Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, String requestId, String copySourceAuthorization, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, Context context) { + final String comp = "page"; + final String pageWrite = "update"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + try { + return service.uploadPagesFromURLSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. + * @param sourceRange Bytes of source data in the specified range. The length of this range should match the + * ContentLength header and x-ms-range/Range destination range header. + * @param contentLength The length of the request. + * @param range The range of bytes to which the source range would be written. The range should be 512 aligned and + * range-end is required. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void uploadPagesFromURL(String containerName, String blob, String sourceUrl, String sourceRange, + long contentLength, String range, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, + String leaseId, Long ifSequenceNumberLessThanOrEqualTo, Long ifSequenceNumberLessThan, + Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, + String sourceIfMatch, String sourceIfNoneMatch, String requestId, String copySourceAuthorization, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + uploadPagesFromURLWithResponse(containerName, blob, sourceUrl, sourceRange, contentLength, range, + sourceContentMD5, sourceContentcrc64, timeout, leaseId, ifSequenceNumberLessThanOrEqualTo, + ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, + ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, requestId, + copySourceAuthorization, cpkInfo, encryptionScopeParam, Context.NONE); + } + + /** + * 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. + * @param sourceRange Bytes of source data in the specified range. The length of this range should match the + * ContentLength header and x-ms-range/Range destination range header. + * @param contentLength The length of the request. + * @param range The range of bytes to which the source range would be written. The range should be 512 aligned and + * range-end is required. + * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy + * source. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifSequenceNumberLessThanOrEqualTo Specify this header value to operate only on a blob if it has a sequence + * number less than or equal to the specified. + * @param ifSequenceNumberLessThan Specify this header value to operate only on a blob if it has a sequence number + * less than the specified. + * @param ifSequenceNumberEqualTo Specify this header value to operate only on a blob if it has the specified + * sequence number. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param sourceIfModifiedSince Specify this header value to operate only on a blob if it has been modified since + * the specified date/time. + * @param sourceIfUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified + * since the specified date/time. + * @param sourceIfMatch Specify an ETag value to operate only on blobs with a matching value. + * @param sourceIfNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to + * copy source. + * @param cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadPagesFromURLNoCustomHeadersWithResponse(String containerName, String blob, + String sourceUrl, String sourceRange, long contentLength, String range, byte[] sourceContentMD5, + byte[] sourceContentcrc64, Integer timeout, String leaseId, Long ifSequenceNumberLessThanOrEqualTo, + Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, + OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, + String sourceIfNoneMatch, String requestId, String copySourceAuthorization, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, Context context) { + final String comp = "page"; + final String pageWrite = "update"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted + = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted + = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + try { + return service.uploadPagesFromURLNoCustomHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 list of pages along with {@link ResponseBase} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPageRangesWithResponseAsync( + String containerName, String blob, String snapshot, Integer timeout, String range, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, String marker, Integer maxresults) { + final String comp = "pagelist"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = 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)) + .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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of pages along with {@link ResponseBase} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPageRangesWithResponseAsync( + String containerName, String blob, String snapshot, Integer timeout, String range, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, String marker, Integer maxresults, Context context) { + final String comp = "pagelist"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = 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) + .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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 list of pages on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getPageRangesAsync(String containerName, String blob, String snapshot, Integer timeout, + String range, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + 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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of pages on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getPageRangesAsync(String containerName, String blob, String snapshot, Integer timeout, + String range, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + 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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @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>. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. * @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 copySourceAuthorization Only Bearer type is supported. Credentials should be a valid OAuth access token to - * copy source. - * @param cpkInfo Parameter group. - * @param encryptionScopeParam Parameter group. - * @param context The context to associate with this operation. + * @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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the list of pages along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadPagesFromURLNoCustomHeadersWithResponseAsync(String containerName, String blob, - String sourceUrl, String sourceRange, long contentLength, String range, byte[] sourceContentMD5, - byte[] sourceContentcrc64, Integer timeout, String leaseId, Long ifSequenceNumberLessThanOrEqualTo, - Long ifSequenceNumberLessThan, Long ifSequenceNumberEqualTo, OffsetDateTime ifModifiedSince, - OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, - OffsetDateTime sourceIfModifiedSince, OffsetDateTime sourceIfUnmodifiedSince, String sourceIfMatch, - String sourceIfNoneMatch, String requestId, String copySourceAuthorization, CpkInfo cpkInfo, - EncryptionScope encryptionScopeParam, Context context) { - final String comp = "page"; - final String pageWrite = "update"; + public Mono> getPageRangesNoCustomHeadersWithResponseAsync(String containerName, String blob, + String snapshot, Integer timeout, String range, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + String marker, Integer maxresults) { + final String comp = "pagelist"; final String accept = "application/xml"; - String encryptionKeyInternal = null; - if (cpkInfo != null) { - encryptionKeyInternal = cpkInfo.getEncryptionKey(); - } - String encryptionKey = encryptionKeyInternal; - String encryptionKeySha256Internal = null; - if (cpkInfo != null) { - encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); - } - String encryptionKeySha256 = encryptionKeySha256Internal; - EncryptionAlgorithmType encryptionAlgorithmInternal = null; - if (cpkInfo != null) { - encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); - } - EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; - String encryptionScopeInternal = null; - if (encryptionScopeParam != null) { - encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); - } - String encryptionScope = encryptionScopeInternal; - String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); - String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - DateTimeRfc1123 sourceIfModifiedSinceConverted - = 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 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); } @@ -2915,26 +4534,27 @@ public Mono> uploadPagesFromURLNoCustomHeadersWithResponseAsync(S * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving * the remainder of the results. For this reason, it is possible that the service will return fewer results than * specified by maxresults, or than the default of 5000. + * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of pages along with {@link ResponseBase} on successful completion of {@link Mono}. + * @return the list of pages along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPageRangesWithResponseAsync( - String containerName, String blob, String snapshot, Integer timeout, String range, String leaseId, - OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, - String ifTags, String requestId, String marker, Integer maxresults) { + public Mono> getPageRangesNoCustomHeadersWithResponseAsync(String containerName, String blob, + String snapshot, Integer timeout, String range, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + String marker, Integer maxresults, Context context) { final String comp = "pagelist"; final String accept = "application/xml"; DateTimeRfc1123 ifModifiedSinceConverted = 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 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); } @@ -2976,24 +4596,26 @@ public Mono> getPageRanges * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of pages along with {@link ResponseBase} on successful completion of {@link Mono}. + * @return the list of pages along with {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPageRangesWithResponseAsync( - String containerName, String blob, String snapshot, Integer timeout, String range, String leaseId, - OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, - String ifTags, String requestId, String marker, Integer maxresults, Context context) { + public ResponseBase getPageRangesWithResponse(String containerName, + String blob, String snapshot, Integer timeout, String range, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + String marker, Integer maxresults, Context context) { final String comp = "pagelist"; final String accept = "application/xml"; DateTimeRfc1123 ifModifiedSinceConverted = 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.getPageRangesSync(this.client.getUrl(), containerName, blob, comp, snapshot, timeout, range, + leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + this.client.getVersion(), requestId, marker, maxresults, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -3033,16 +4655,19 @@ public Mono> getPageRanges * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of pages on successful completion of {@link Mono}. + * @return the list of pages. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPageRangesAsync(String containerName, String blob, String snapshot, Integer timeout, - String range, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + public PageList getPageRanges(String containerName, String blob, String snapshot, Integer timeout, String range, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, 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())); + try { + return getPageRangesWithResponse(containerName, blob, snapshot, timeout, range, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, marker, maxresults, Context.NONE) + .getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -3083,21 +4708,31 @@ public Mono getPageRangesAsync(String containerName, String blob, Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of pages on successful completion of {@link Mono}. + * @return the list of pages along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPageRangesAsync(String containerName, String blob, String snapshot, Integer timeout, - String range, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, - 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())); + public Response getPageRangesNoCustomHeadersWithResponse(String containerName, String blob, + String snapshot, Integer timeout, String range, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + String marker, Integer maxresults, Context context) { + final String comp = "pagelist"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.getPageRangesNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, snapshot, + timeout, range, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, + ifTags, this.client.getVersion(), requestId, marker, maxresults, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** - * The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a - * page blob. + * [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. @@ -3108,6 +4743,14 @@ public Mono getPageRangesAsync(String containerName, String blob, Stri * @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>. + * @param prevsnapshot Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that + * specifies that the response will contain only pages that were changed between target blob and previous snapshot. + * Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot + * specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only + * for blobs created on or after January 1, 2016. + * @param prevSnapshotUrl Optional. This header is only supported in service versions 2019-04-19 and after and + * specifies the URL of a previous snapshot of the target blob. The response will only contain pages that were + * changed between the target blob and its previous snapshot. * @param range Return only the bytes of the blob in the specified range. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the @@ -3132,11 +4775,12 @@ public Mono getPageRangesAsync(String containerName, String blob, Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of pages along with {@link Response} on successful completion of {@link Mono}. + * @return the list of pages along with {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPageRangesNoCustomHeadersWithResponseAsync(String containerName, String blob, - String snapshot, Integer timeout, String range, String leaseId, OffsetDateTime ifModifiedSince, + public Mono> getPageRangesDiffWithResponseAsync( + String containerName, String blob, String snapshot, Integer timeout, String prevsnapshot, + String prevSnapshotUrl, String range, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, String marker, Integer maxresults) { final String comp = "pagelist"; @@ -3146,15 +4790,16 @@ public Mono> getPageRangesNoCustomHeadersWithResponseAsync(St 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)) + .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); } /** - * The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a - * page blob. + * [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. @@ -3165,6 +4810,14 @@ public Mono> getPageRangesNoCustomHeadersWithResponseAsync(St * @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>. + * @param prevsnapshot Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that + * specifies that the response will contain only pages that were changed between target blob and previous snapshot. + * Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot + * specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only + * for blobs created on or after January 1, 2016. + * @param prevSnapshotUrl Optional. This header is only supported in service versions 2019-04-19 and after and + * specifies the URL of a previous snapshot of the target blob. The response will only contain pages that were + * changed between the target blob and its previous snapshot. * @param range Return only the bytes of the blob in the specified range. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the @@ -3190,11 +4843,12 @@ public Mono> getPageRangesNoCustomHeadersWithResponseAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of pages along with {@link Response} on successful completion of {@link Mono}. + * @return the list of pages along with {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPageRangesNoCustomHeadersWithResponseAsync(String containerName, String blob, - String snapshot, Integer timeout, String range, String leaseId, OffsetDateTime ifModifiedSince, + public Mono> getPageRangesDiffWithResponseAsync( + String containerName, String blob, String snapshot, Integer timeout, String prevsnapshot, + String prevSnapshotUrl, String range, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, String marker, Integer maxresults, Context context) { final String comp = "pagelist"; @@ -3204,9 +4858,9 @@ public Mono> getPageRangesNoCustomHeadersWithResponseAsync(St 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) + .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); } @@ -3255,26 +4909,76 @@ public Mono> getPageRangesNoCustomHeadersWithResponseAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of pages along with {@link ResponseBase} on successful completion of {@link Mono}. + * @return the list of pages on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPageRangesDiffWithResponseAsync( - String containerName, String blob, String snapshot, Integer timeout, String prevsnapshot, - String prevSnapshotUrl, String range, String leaseId, OffsetDateTime ifModifiedSince, + public Mono getPageRangesDiffAsync(String containerName, String blob, String snapshot, Integer timeout, + String prevsnapshot, String prevSnapshotUrl, String range, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, String marker, Integer maxresults) { - final String comp = "pagelist"; - final String accept = "application/xml"; - DateTimeRfc1123 ifModifiedSinceConverted - = 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + return getPageRangesDiffWithResponseAsync(containerName, blob, snapshot, timeout, prevsnapshot, prevSnapshotUrl, + range, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, marker, + 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 + * snapshot to retrieve. For more information on working with blob snapshots, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating + * a Snapshot of a Blob.</a>. + * @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>. + * @param prevsnapshot Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that + * specifies that the response will contain only pages that were changed between target blob and previous snapshot. + * Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot + * specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only + * for blobs created on or after January 1, 2016. + * @param prevSnapshotUrl Optional. This header is only supported in service versions 2019-04-19 and after and + * specifies the URL of a previous snapshot of the target blob. The response will only contain pages that were + * changed between the target blob and its previous snapshot. + * @param range Return only the bytes of the blob in the specified range. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of pages on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getPageRangesDiffAsync(String containerName, String blob, String snapshot, Integer timeout, + String prevsnapshot, String prevSnapshotUrl, String range, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + 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).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -3319,28 +5023,27 @@ public Mono> getPageRa * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving * the remainder of the results. For this reason, it is possible that the service will return fewer results than * specified by maxresults, or than the default of 5000. - * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of pages along with {@link ResponseBase} on successful completion of {@link Mono}. + * @return the list of pages along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPageRangesDiffWithResponseAsync( - String containerName, String blob, String snapshot, Integer timeout, String prevsnapshot, - String prevSnapshotUrl, String range, String leaseId, OffsetDateTime ifModifiedSince, - OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, - String marker, Integer maxresults, Context context) { + public Mono> getPageRangesDiffNoCustomHeadersWithResponseAsync(String containerName, String blob, + String snapshot, Integer timeout, String prevsnapshot, String prevSnapshotUrl, String range, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, String marker, Integer maxresults) { final String comp = "pagelist"; final String accept = "application/xml"; DateTimeRfc1123 ifModifiedSinceConverted = 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 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); } @@ -3386,20 +5089,28 @@ public Mono> getPageRa * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving * the remainder of the results. For this reason, it is possible that the service will return fewer results than * specified by maxresults, or than the default of 5000. + * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of pages on successful completion of {@link Mono}. + * @return the list of pages along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPageRangesDiffAsync(String containerName, String blob, String snapshot, Integer timeout, - String prevsnapshot, String prevSnapshotUrl, String range, String leaseId, OffsetDateTime ifModifiedSince, - OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, - String marker, Integer maxresults) { - return getPageRangesDiffWithResponseAsync(containerName, blob, snapshot, timeout, prevsnapshot, prevSnapshotUrl, - range, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, marker, - maxresults).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public Mono> getPageRangesDiffNoCustomHeadersWithResponseAsync(String containerName, String blob, + String snapshot, Integer timeout, String prevsnapshot, String prevSnapshotUrl, String range, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, String marker, Integer maxresults, Context context) { + final String comp = "pagelist"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = 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) + .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } /** @@ -3448,17 +5159,26 @@ public Mono getPageRangesDiffAsync(String containerName, String blob, * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of pages on successful completion of {@link Mono}. + * @return the list of pages along with {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPageRangesDiffAsync(String containerName, String blob, String snapshot, Integer timeout, - String prevsnapshot, String prevSnapshotUrl, String range, String leaseId, OffsetDateTime ifModifiedSince, - OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, - 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).onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public ResponseBase getPageRangesDiffWithResponse(String containerName, + String blob, String snapshot, Integer timeout, String prevsnapshot, String prevSnapshotUrl, String range, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, String requestId, String marker, Integer maxresults, Context context) { + final String comp = "pagelist"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.getPageRangesDiffSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -3506,25 +5226,20 @@ public Mono getPageRangesDiffAsync(String containerName, String blob, * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of pages along with {@link Response} on successful completion of {@link Mono}. + * @return the list of pages. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPageRangesDiffNoCustomHeadersWithResponseAsync(String containerName, String blob, - String snapshot, Integer timeout, String prevsnapshot, String prevSnapshotUrl, String range, String leaseId, - OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, - String ifTags, String requestId, String marker, Integer maxresults) { - final String comp = "pagelist"; - final String accept = "application/xml"; - DateTimeRfc1123 ifModifiedSinceConverted - = 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + public PageList getPageRangesDiff(String containerName, String blob, String snapshot, Integer timeout, + String prevsnapshot, String prevSnapshotUrl, String range, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + String marker, Integer maxresults) { + try { + return getPageRangesDiffWithResponse(containerName, blob, snapshot, timeout, prevsnapshot, prevSnapshotUrl, + range, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, requestId, marker, + maxresults, Context.NONE).getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -3573,10 +5288,10 @@ public Mono> getPageRangesDiffNoCustomHeadersWithResponseAsyn * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 list of pages along with {@link Response} on successful completion of {@link Mono}. + * @return the list of pages along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPageRangesDiffNoCustomHeadersWithResponseAsync(String containerName, String blob, + public Response getPageRangesDiffNoCustomHeadersWithResponse(String containerName, String blob, String snapshot, Integer timeout, String prevsnapshot, String prevSnapshotUrl, String range, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, String marker, Integer maxresults, Context context) { @@ -3586,11 +5301,14 @@ 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.getPageRangesDiffNoCustomHeadersSync(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); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -3894,13 +5612,183 @@ public Mono> resizeNoCustomHeadersWithResponseAsync(String contai * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> resizeNoCustomHeadersWithResponseAsync(String containerName, String blob, + long blobContentLength, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String comp = "properties"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = 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) + .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 + * must be aligned to a 512-byte boundary. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase resizeWithResponse(String containerName, String blob, + long blobContentLength, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + final String comp = "properties"; + final String accept = "application/xml"; + String encryptionKeyInternal = null; + if (cpkInfo != null) { + encryptionKeyInternal = cpkInfo.getEncryptionKey(); + } + String encryptionKey = encryptionKeyInternal; + String encryptionKeySha256Internal = null; + if (cpkInfo != null) { + encryptionKeySha256Internal = cpkInfo.getEncryptionKeySha256(); + } + String encryptionKeySha256 = encryptionKeySha256Internal; + EncryptionAlgorithmType encryptionAlgorithmInternal = null; + if (cpkInfo != null) { + encryptionAlgorithmInternal = cpkInfo.getEncryptionAlgorithm(); + } + EncryptionAlgorithmType encryptionAlgorithm = encryptionAlgorithmInternal; + String encryptionScopeInternal = null; + if (encryptionScopeParam != null) { + encryptionScopeInternal = encryptionScopeParam.getEncryptionScope(); + } + String encryptionScope = encryptionScopeInternal; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.resizeSync(this.client.getUrl(), containerName, blob, comp, timeout, leaseId, encryptionKey, + encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSinceConverted, + ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, blobContentLength, this.client.getVersion(), + requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * must be aligned to a 512-byte boundary. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void resize(String containerName, String blob, long blobContentLength, Integer timeout, String leaseId, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId, CpkInfo cpkInfo, EncryptionScope encryptionScopeParam) { + resizeWithResponse(containerName, blob, blobContentLength, timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, ifTags, requestId, cpkInfo, encryptionScopeParam, Context.NONE); + } + + /** + * 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 + * must be aligned to a 512-byte boundary. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 cpkInfo Parameter group. + * @param encryptionScopeParam Parameter group. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> resizeNoCustomHeadersWithResponseAsync(String containerName, String blob, - long blobContentLength, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, - OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, - CpkInfo cpkInfo, EncryptionScope encryptionScopeParam, Context context) { + public Response resizeNoCustomHeadersWithResponse(String containerName, String blob, long blobContentLength, + Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, CpkInfo cpkInfo, + EncryptionScope encryptionScopeParam, Context context) { final String comp = "properties"; final String accept = "application/xml"; String encryptionKeyInternal = null; @@ -3927,12 +5815,14 @@ 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, + try { + return service.resizeNoCustomHeadersSync(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); + requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -4201,6 +6091,139 @@ public Mono> updateSequenceNumberNoCustomHeadersWithResponseAsync .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 + * property applies to page blobs only. This property indicates how the service should modify the blob's sequence + * number. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can + * use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase updateSequenceNumberWithResponse( + String containerName, String blob, SequenceNumberActionType sequenceNumberAction, Integer timeout, + String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, + String ifNoneMatch, String ifTags, Long blobSequenceNumber, String requestId, Context context) { + final String comp = "properties"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.updateSequenceNumberSync(this.client.getUrl(), containerName, blob, comp, timeout, leaseId, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + sequenceNumberAction, blobSequenceNumber, this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * property applies to page blobs only. This property indicates how the service should modify the blob's sequence + * number. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can + * use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void updateSequenceNumber(String containerName, String blob, SequenceNumberActionType sequenceNumberAction, + Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, Long blobSequenceNumber, String requestId) { + updateSequenceNumberWithResponse(containerName, blob, sequenceNumberAction, timeout, leaseId, ifModifiedSince, + ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, blobSequenceNumber, requestId, Context.NONE); + } + + /** + * 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 + * property applies to page blobs only. This property indicates how the service should modify the blob's sequence + * number. + * @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>. + * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can + * use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateSequenceNumberNoCustomHeadersWithResponse(String containerName, String blob, + SequenceNumberActionType sequenceNumberAction, Integer timeout, String leaseId, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, Long blobSequenceNumber, + String requestId, Context context) { + final String comp = "properties"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.updateSequenceNumberNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, + timeout, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, + sequenceNumberAction, blobSequenceNumber, this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot * is copied such that only the differential changes between the previously copied snapshot are transferred to the @@ -4460,4 +6483,136 @@ public Mono> copyIncrementalNoCustomHeadersWithResponseAsync(Stri this.client.getVersion(), requestId, accept, context) .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); } + + /** + * The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot + * 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 + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase copyIncrementalWithResponse(String containerName, + String blob, String copySource, Integer timeout, OffsetDateTime ifModifiedSince, + OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, String ifTags, String requestId, + Context context) { + final String comp = "incrementalcopy"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.copyIncrementalSync(this.client.getUrl(), containerName, blob, comp, timeout, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot + * 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 + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void copyIncremental(String containerName, String blob, String copySource, Integer timeout, + OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, String ifMatch, String ifNoneMatch, + String ifTags, String requestId) { + copyIncrementalWithResponse(containerName, blob, copySource, timeout, ifModifiedSince, ifUnmodifiedSince, + ifMatch, ifNoneMatch, ifTags, requestId, Context.NONE); + } + + /** + * The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot + * 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 + * length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. + * The source blob must either be public or must be authenticated via a shared access signature. + * @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>. + * @param ifModifiedSince Specify this header value to operate only on a blob if it has been modified since the + * specified date/time. + * @param ifUnmodifiedSince Specify this header value to operate only on a blob if it has not been modified since + * the specified date/time. + * @param ifMatch Specify an ETag value to operate only on blobs with a matching value. + * @param ifNoneMatch Specify an ETag value to operate only on blobs without a matching value. + * @param ifTags Specify a SQL where clause on blob tags to operate only on blobs with a matching value. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response copyIncrementalNoCustomHeadersWithResponse(String containerName, String blob, + String copySource, Integer timeout, OffsetDateTime ifModifiedSince, OffsetDateTime ifUnmodifiedSince, + String ifMatch, String ifNoneMatch, String ifTags, String requestId, Context context) { + final String comp = "incrementalcopy"; + final String accept = "application/xml"; + DateTimeRfc1123 ifModifiedSinceConverted + = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted + = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + try { + return service.copyIncrementalNoCustomHeadersSync(this.client.getUrl(), containerName, blob, comp, timeout, + ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, ifTags, copySource, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } } 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 c249cabb2bff2..f8e2a34907182 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 @@ -18,6 +18,7 @@ import com.azure.core.annotation.ServiceMethod; import com.azure.core.annotation.UnexpectedResponseExceptionType; import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; @@ -46,6 +47,7 @@ import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListBlobContainersIncludeType; import com.azure.storage.blob.models.UserDelegationKey; +import java.io.InputStream; import java.nio.ByteBuffer; import java.util.List; import java.util.Objects; @@ -107,6 +109,26 @@ Mono> setPropertiesNoCustomHeaders(@HostParam("url") String url, @BodyParam("application/xml") BlobServiceProperties blobServiceProperties, @HeaderParam("Accept") String accept, Context context); + @Put("/") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase setPropertiesSync(@HostParam("url") String url, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/xml") BlobServiceProperties blobServiceProperties, + @HeaderParam("Accept") String accept, Context context); + + @Put("/") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response setPropertiesNoCustomHeadersSync(@HostParam("url") String url, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/xml") BlobServiceProperties blobServiceProperties, + @HeaderParam("Accept") String accept, Context context); + @Get("/") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -125,6 +147,24 @@ Mono> getPropertiesNoCustomHeaders(@HostParam("u @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Get("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase getPropertiesSync( + @HostParam("url") String url, @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Get("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response getPropertiesNoCustomHeadersSync(@HostParam("url") String url, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + @Get("/") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -143,6 +183,24 @@ Mono> getStatisticsNoCustomHeaders(@HostParam("u @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Get("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase getStatisticsSync( + @HostParam("url") String url, @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Get("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response getStatisticsNoCustomHeadersSync(@HostParam("url") String url, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + @Get("/") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -163,6 +221,26 @@ Mono> listBlobContainersSegmentNoCustomHeaders(@ @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + @Get("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase listBlobContainersSegmentSync( + @HostParam("url") String url, @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, + @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, + @QueryParam("include") String listBlobContainersIncludeType, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); + + @Get("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response listBlobContainersSegmentNoCustomHeadersSync(@HostParam("url") String url, + @QueryParam("comp") String comp, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String listBlobContainersIncludeType, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + @Post("/") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -181,6 +259,24 @@ Mono> getUserDelegationKeyNoCustomHeaders(@HostParam @HeaderParam("x-ms-client-request-id") String requestId, @BodyParam("application/xml") KeyInfo keyInfo, @HeaderParam("Accept") String accept, Context context); + @Post("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase getUserDelegationKeySync( + @HostParam("url") String url, @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @BodyParam("application/xml") KeyInfo keyInfo, + @HeaderParam("Accept") String accept, Context context); + + @Post("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response getUserDelegationKeyNoCustomHeadersSync(@HostParam("url") String url, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @BodyParam("application/xml") KeyInfo keyInfo, + @HeaderParam("Accept") String accept, Context context); + @Get("/") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -195,6 +291,20 @@ Mono> getAccountInfoNoCustomHeaders(@HostParam("url") String url, @QueryParam("restype") String restype, @QueryParam("comp") String comp, @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept, Context context); + @Get("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase getAccountInfoSync(@HostParam("url") String url, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept, Context context); + + @Get("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response getAccountInfoNoCustomHeadersSync(@HostParam("url") String url, + @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @HeaderParam("x-ms-version") String version, @HeaderParam("Accept") String accept, Context context); + @Post("/") @ExpectedResponses({ 202 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -231,6 +341,24 @@ Mono submitBatchNoCustomHeaders(@HostParam("url") String url, @Q @HeaderParam("x-ms-client-request-id") String requestId, @BodyParam("application/xml") BinaryData body, @HeaderParam("Accept") String accept, Context context); + @Post("/") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase submitBatchSync(@HostParam("url") String url, + @QueryParam("comp") String comp, @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-Type") String multipartContentType, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/xml") BinaryData body, @HeaderParam("Accept") String accept, Context context); + + @Post("/") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response submitBatchNoCustomHeadersSync(@HostParam("url") String url, + @QueryParam("comp") String comp, @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Content-Type") String multipartContentType, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @BodyParam("application/xml") BinaryData body, @HeaderParam("Accept") String accept, Context context); + @Get("/") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -251,6 +379,26 @@ Mono> filterBlobsNoCustomHeaders(@HostParam("url") S @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, @HeaderParam("Accept") String accept, Context context); + @Get("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase filterBlobsSync(@HostParam("url") String url, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @QueryParam("where") String where, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, + @HeaderParam("Accept") String accept, Context context); + + @Get("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response filterBlobsNoCustomHeadersSync(@HostParam("url") String url, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @QueryParam("where") String where, @QueryParam("marker") String marker, + @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, + @HeaderParam("Accept") String accept, Context context); + @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) @@ -267,6 +415,23 @@ Mono> listBlobContainersSegmentNextNoCustomHeade @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("url") String url, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + ResponseBase + listBlobContainersSegmentNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("url") String url, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(BlobStorageExceptionInternal.class) + Response listBlobContainersSegmentNextNoCustomHeadersSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("url") String url, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("Accept") String accept, Context context); } /** @@ -426,6 +591,85 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( .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 + * Timeouts for Blob Service Operations.</a>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase setPropertiesWithResponse( + BlobServiceProperties blobServiceProperties, Integer timeout, String requestId, Context context) { + final String restype = "service"; + final String comp = "properties"; + final String accept = "application/xml"; + try { + return service.setPropertiesSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + requestId, blobServiceProperties, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws BlobStorageExceptionInternal thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void setProperties(BlobServiceProperties blobServiceProperties, Integer timeout, String requestId) { + setPropertiesWithResponse(blobServiceProperties, timeout, requestId, Context.NONE); + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setPropertiesNoCustomHeadersWithResponse(BlobServiceProperties blobServiceProperties, + Integer timeout, String requestId, Context context) { + final String restype = "service"; + final String comp = "properties"; + final String accept = "application/xml"; + try { + return service.setPropertiesNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, blobServiceProperties, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS * (Cross-Origin Resource Sharing) rules. @@ -582,77 +826,87 @@ public Mono> getPropertiesNoCustomHeadersWithRes } /** - * 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. + * 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>. * @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 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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return stats for the storage service along with {@link ResponseBase} on successful completion of {@link Mono}. + * @return the properties of a storage account's Blob service, including properties for Storage Analytics and CORS + * (Cross-Origin Resource Sharing) rules along with {@link ResponseBase}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getStatisticsWithResponseAsync(Integer timeout, String requestId) { + public ResponseBase getPropertiesWithResponse(Integer timeout, + String requestId, Context context) { final String restype = "service"; - final String comp = "stats"; + final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil - .withContext(context -> service.getStatistics(this.client.getUrl(), restype, comp, timeout, - this.client.getVersion(), requestId, accept, context)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.getPropertiesSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** - * 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. + * 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>. * @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 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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return stats for the storage service along with {@link ResponseBase} on successful completion of {@link Mono}. + * @return the properties of a storage account's Blob service, including properties for Storage Analytics and CORS + * (Cross-Origin Resource Sharing) rules. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getStatisticsWithResponseAsync(Integer timeout, String requestId, Context context) { - 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + public BlobServiceProperties getProperties(Integer timeout, String requestId) { + try { + return getPropertiesWithResponse(timeout, requestId, Context.NONE).getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** - * 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. + * 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>. * @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 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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return stats for the storage service on successful completion of {@link Mono}. + * @return the properties of a storage account's Blob service, including properties for Storage Analytics and CORS + * (Cross-Origin Resource Sharing) rules along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getStatisticsAsync(Integer timeout, String requestId) { - return getStatisticsWithResponseAsync(timeout, requestId) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public Response getPropertiesNoCustomHeadersWithResponse(Integer timeout, String requestId, + Context context) { + final String restype = "service"; + final String comp = "properties"; + final String accept = "application/xml"; + try { + return service.getPropertiesNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -664,23 +918,498 @@ public Mono getStatisticsAsync(Integer timeout, String re * Timeouts for Blob Service Operations.</a>. * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 stats for the storage service along with {@link ResponseBase} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> + getStatisticsWithResponseAsync(Integer timeout, String requestId) { + 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)) + .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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return stats for the storage service along with {@link ResponseBase} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> + getStatisticsWithResponseAsync(Integer timeout, String requestId, Context context) { + 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) + .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>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 stats for the storage service on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getStatisticsAsync(Integer timeout, String requestId) { + 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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return stats for the storage service on successful completion of {@link Mono}. + */ + @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>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 stats for the storage service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getStatisticsNoCustomHeadersWithResponseAsync(Integer timeout, + String requestId) { + 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)) + .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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return stats for the storage service along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getStatisticsNoCustomHeadersWithResponseAsync(Integer timeout, + String requestId, Context context) { + 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) + .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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return stats for the storage service along with {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase getStatisticsWithResponse(Integer timeout, + String requestId, Context context) { + final String restype = "service"; + final String comp = "stats"; + final String accept = "application/xml"; + try { + return service.getStatisticsSync(this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), + requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 stats for the storage service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BlobServiceStatistics getStatistics(Integer timeout, String requestId) { + try { + return getStatisticsWithResponse(timeout, requestId, Context.NONE).getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return stats for the storage service along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getStatisticsNoCustomHeadersWithResponse(Integer timeout, String requestId, + Context context) { + final String restype = "service"; + final String comp = "stats"; + final String accept = "application/xml"; + try { + return service.getStatisticsNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param listBlobContainersIncludeType Include this parameter to specify that the container's metadata be returned + * as part of the response body. + * @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>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 an enumeration of containers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listBlobContainersSegmentSinglePageAsync(String prefix, String marker, + Integer maxresults, List listBlobContainersIncludeType, Integer timeout, + String requestId) { + final String comp = "list"; + final String accept = "application/xml"; + String listBlobContainersIncludeTypeConverted = (listBlobContainersIncludeType == null) + ? null + : listBlobContainersIncludeType.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil + .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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param listBlobContainersIncludeType Include this parameter to specify that the container's metadata be returned + * as part of the response body. + * @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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of containers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listBlobContainersSegmentSinglePageAsync(String prefix, String marker, + Integer maxresults, List listBlobContainersIncludeType, Integer timeout, + String requestId, Context context) { + final String comp = "list"; + final String accept = "application/xml"; + String listBlobContainersIncludeTypeConverted = (listBlobContainersIncludeType == null) + ? null + : listBlobContainersIncludeType.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + 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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param listBlobContainersIncludeType Include this parameter to specify that the container's metadata be returned + * as part of the response body. + * @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>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 an enumeration of containers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listBlobContainersSegmentAsync(String prefix, String marker, Integer maxresults, + List listBlobContainersIncludeType, Integer timeout, String requestId) { + return new PagedFlux<>(() -> listBlobContainersSegmentSinglePageAsync(prefix, marker, maxresults, + listBlobContainersIncludeType, timeout, requestId), + nextLink -> listBlobContainersSegmentNextSinglePageAsync(nextLink, requestId)); + } + + /** + * 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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param listBlobContainersIncludeType Include this parameter to specify that the container's metadata be returned + * as part of the response body. + * @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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of containers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listBlobContainersSegmentAsync(String prefix, String marker, Integer maxresults, + List listBlobContainersIncludeType, Integer timeout, String requestId, + Context context) { + return new PagedFlux<>( + () -> listBlobContainersSegmentSinglePageAsync(prefix, marker, maxresults, listBlobContainersIncludeType, + timeout, requestId, context), + nextLink -> listBlobContainersSegmentNextSinglePageAsync(nextLink, requestId, context)); + } + + /** + * 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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param listBlobContainersIncludeType Include this parameter to specify that the container's metadata be returned + * as part of the response body. + * @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>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 an enumeration of containers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listBlobContainersSegmentNoCustomHeadersSinglePageAsync(String prefix, + String marker, Integer maxresults, List listBlobContainersIncludeType, + Integer timeout, String requestId) { + final String comp = "list"; + final String accept = "application/xml"; + String listBlobContainersIncludeTypeConverted = (listBlobContainersIncludeType == null) + ? null + : listBlobContainersIncludeType.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil + .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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param listBlobContainersIncludeType Include this parameter to specify that the container's metadata be returned + * as part of the response body. + * @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>. + * @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 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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return stats for the storage service on successful completion of {@link Mono}. + * @return an enumeration of containers along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getStatisticsAsync(Integer timeout, String requestId, Context context) { - return getStatisticsWithResponseAsync(timeout, requestId, context) + public Mono> listBlobContainersSegmentNoCustomHeadersSinglePageAsync(String prefix, + String marker, Integer maxresults, List listBlobContainersIncludeType, + Integer timeout, String requestId, Context context) { + final String comp = "list"; + final String accept = "application/xml"; + String listBlobContainersIncludeTypeConverted = (listBlobContainersIncludeType == null) + ? null + : listBlobContainersIncludeType.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service + .listBlobContainersSegmentNoCustomHeaders(this.client.getUrl(), comp, prefix, marker, maxresults, + listBlobContainersIncludeTypeConverted, timeout, this.client.getVersion(), requestId, accept, context) .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), null)); } /** - * 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. + * 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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param listBlobContainersIncludeType Include this parameter to specify that the container's metadata be returned + * as part of the response body. * @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>. @@ -689,24 +1418,34 @@ public Mono getStatisticsAsync(Integer timeout, String re * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 stats for the storage service along with {@link Response} on successful completion of {@link Mono}. + * @return an enumeration of containers as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getStatisticsNoCustomHeadersWithResponseAsync(Integer timeout, + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listBlobContainersSegmentNoCustomHeadersAsync(String prefix, String marker, + Integer maxresults, List listBlobContainersIncludeType, Integer timeout, String requestId) { - 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + return new PagedFlux<>( + () -> listBlobContainersSegmentNoCustomHeadersSinglePageAsync(prefix, marker, maxresults, + listBlobContainersIncludeType, timeout, requestId), + nextLink -> listBlobContainersSegmentNextSinglePageAsync(nextLink, requestId)); } /** - * 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. + * 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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param listBlobContainersIncludeType Include this parameter to specify that the container's metadata be returned + * as part of the response body. * @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>. @@ -716,18 +1455,16 @@ public Mono> getStatisticsNoCustomHeadersWithRes * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 stats for the storage service along with {@link Response} on successful completion of {@link Mono}. + * @return an enumeration of containers as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getStatisticsNoCustomHeadersWithResponseAsync(Integer timeout, + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listBlobContainersSegmentNoCustomHeadersAsync(String prefix, String marker, + Integer maxresults, List listBlobContainersIncludeType, Integer timeout, String requestId, Context context) { - 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + return new PagedFlux<>( + () -> listBlobContainersSegmentNoCustomHeadersSinglePageAsync(prefix, marker, maxresults, + listBlobContainersIncludeType, timeout, requestId, context), + nextLink -> listBlobContainersSegmentNextSinglePageAsync(nextLink, requestId, context)); } /** @@ -754,10 +1491,10 @@ public Mono> getStatisticsNoCustomHeadersWithRes * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 an enumeration of containers along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return an enumeration of containers along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listBlobContainersSegmentSinglePageAsync(String prefix, String marker, + public PagedResponse listBlobContainersSegmentSinglePage(String prefix, String marker, Integer maxresults, List listBlobContainersIncludeType, Integer timeout, String requestId) { final String comp = "list"; @@ -767,13 +1504,16 @@ public Mono> listBlobContainersSegmentSinglePag : listBlobContainersIncludeType.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return FluxUtil - .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())); + ResponseBase res + = service.listBlobContainersSegmentSync(this.client.getUrl(), comp, prefix, marker, maxresults, + listBlobContainersIncludeTypeConverted, timeout, this.client.getVersion(), requestId, accept, + Context.NONE); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -801,10 +1541,10 @@ public Mono> listBlobContainersSegmentSinglePag * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 an enumeration of containers along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return an enumeration of containers along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listBlobContainersSegmentSinglePageAsync(String prefix, String marker, + public PagedResponse listBlobContainersSegmentSinglePage(String prefix, String marker, Integer maxresults, List listBlobContainersIncludeType, Integer timeout, String requestId, Context context) { final String comp = "list"; @@ -814,12 +1554,15 @@ public Mono> listBlobContainersSegmentSinglePag : listBlobContainersIncludeType.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - 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())); + ResponseBase res + = service.listBlobContainersSegmentSync(this.client.getUrl(), comp, prefix, marker, maxresults, + listBlobContainersIncludeTypeConverted, timeout, this.client.getVersion(), requestId, accept, context); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -846,14 +1589,15 @@ public Mono> listBlobContainersSegmentSinglePag * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 an enumeration of containers as paginated response with {@link PagedFlux}. + * @return an enumeration of containers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listBlobContainersSegmentAsync(String prefix, String marker, Integer maxresults, + public PagedIterable listBlobContainersSegment(String prefix, String marker, Integer maxresults, List listBlobContainersIncludeType, Integer timeout, String requestId) { - return new PagedFlux<>(() -> listBlobContainersSegmentSinglePageAsync(prefix, marker, maxresults, - listBlobContainersIncludeType, timeout, requestId), - nextLink -> listBlobContainersSegmentNextSinglePageAsync(nextLink, requestId)); + return new PagedIterable<>( + () -> listBlobContainersSegmentSinglePage(prefix, marker, maxresults, listBlobContainersIncludeType, + timeout, requestId, Context.NONE), + nextLink -> listBlobContainersSegmentNextSinglePage(nextLink, requestId)); } /** @@ -881,16 +1625,16 @@ public PagedFlux listBlobContainersSegmentAsync(String prefix * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 an enumeration of containers as paginated response with {@link PagedFlux}. + * @return an enumeration of containers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listBlobContainersSegmentAsync(String prefix, String marker, Integer maxresults, + public PagedIterable listBlobContainersSegment(String prefix, String marker, Integer maxresults, List listBlobContainersIncludeType, Integer timeout, String requestId, Context context) { - return new PagedFlux<>( - () -> listBlobContainersSegmentSinglePageAsync(prefix, marker, maxresults, listBlobContainersIncludeType, + return new PagedIterable<>( + () -> listBlobContainersSegmentSinglePage(prefix, marker, maxresults, listBlobContainersIncludeType, timeout, requestId, context), - nextLink -> listBlobContainersSegmentNextSinglePageAsync(nextLink, requestId, context)); + nextLink -> listBlobContainersSegmentNextSinglePage(nextLink, requestId, context)); } /** @@ -917,10 +1661,10 @@ public PagedFlux listBlobContainersSegmentAsync(String prefix * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 an enumeration of containers along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return an enumeration of containers along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listBlobContainersSegmentNoCustomHeadersSinglePageAsync(String prefix, + public PagedResponse listBlobContainersSegmentNoCustomHeadersSinglePage(String prefix, String marker, Integer maxresults, List listBlobContainersIncludeType, Integer timeout, String requestId) { final String comp = "list"; @@ -930,13 +1674,15 @@ public Mono> listBlobContainersSegmentNoCustomH : listBlobContainersIncludeType.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - return FluxUtil - .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)); + Response res = service.listBlobContainersSegmentNoCustomHeadersSync(this.client.getUrl(), + comp, prefix, marker, maxresults, listBlobContainersIncludeTypeConverted, timeout, this.client.getVersion(), + requestId, accept, Context.NONE); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), null); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -964,10 +1710,10 @@ public Mono> listBlobContainersSegmentNoCustomH * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 an enumeration of containers along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return an enumeration of containers along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listBlobContainersSegmentNoCustomHeadersSinglePageAsync(String prefix, + public PagedResponse listBlobContainersSegmentNoCustomHeadersSinglePage(String prefix, String marker, Integer maxresults, List listBlobContainersIncludeType, Integer timeout, String requestId, Context context) { final String comp = "list"; @@ -977,12 +1723,15 @@ public Mono> listBlobContainersSegmentNoCustomH : listBlobContainersIncludeType.stream() .map(paramItemValue -> Objects.toString(paramItemValue, "")) .collect(Collectors.joining(",")); - 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)); + Response res = service.listBlobContainersSegmentNoCustomHeadersSync(this.client.getUrl(), + comp, prefix, marker, maxresults, listBlobContainersIncludeTypeConverted, timeout, this.client.getVersion(), + requestId, accept, context); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), null); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -1009,16 +1758,16 @@ public Mono> listBlobContainersSegmentNoCustomH * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 an enumeration of containers as paginated response with {@link PagedFlux}. + * @return an enumeration of containers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listBlobContainersSegmentNoCustomHeadersAsync(String prefix, String marker, + public PagedIterable listBlobContainersSegmentNoCustomHeaders(String prefix, String marker, Integer maxresults, List listBlobContainersIncludeType, Integer timeout, String requestId) { - return new PagedFlux<>( - () -> listBlobContainersSegmentNoCustomHeadersSinglePageAsync(prefix, marker, maxresults, - listBlobContainersIncludeType, timeout, requestId), - nextLink -> listBlobContainersSegmentNextSinglePageAsync(nextLink, requestId)); + return new PagedIterable<>( + () -> listBlobContainersSegmentNoCustomHeadersSinglePage(prefix, marker, maxresults, + listBlobContainersIncludeType, timeout, requestId, Context.NONE), + nextLink -> listBlobContainersSegmentNextSinglePage(nextLink, requestId)); } /** @@ -1046,16 +1795,16 @@ public PagedFlux listBlobContainersSegmentNoCustomHeadersAsyn * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 an enumeration of containers as paginated response with {@link PagedFlux}. + * @return an enumeration of containers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listBlobContainersSegmentNoCustomHeadersAsync(String prefix, String marker, + public PagedIterable listBlobContainersSegmentNoCustomHeaders(String prefix, String marker, Integer maxresults, List listBlobContainersIncludeType, Integer timeout, String requestId, Context context) { - return new PagedFlux<>( - () -> listBlobContainersSegmentNoCustomHeadersSinglePageAsync(prefix, marker, maxresults, + return new PagedIterable<>( + () -> listBlobContainersSegmentNoCustomHeadersSinglePage(prefix, marker, maxresults, listBlobContainersIncludeType, timeout, requestId, context), - nextLink -> listBlobContainersSegmentNextSinglePageAsync(nextLink, requestId, context)); + nextLink -> listBlobContainersSegmentNextSinglePage(nextLink, requestId, context)); } /** @@ -1214,6 +1963,90 @@ public Mono> getUserDelegationKeyNoCustomHeadersWith .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 + * Timeouts for Blob Service Operations.</a>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a user delegation key along with {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase + getUserDelegationKeyWithResponse(KeyInfo keyInfo, Integer timeout, String requestId, Context context) { + final String restype = "service"; + final String comp = "userdelegationkey"; + final String accept = "application/xml"; + try { + return service.getUserDelegationKeySync(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, keyInfo, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 user delegation key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public UserDelegationKey getUserDelegationKey(KeyInfo keyInfo, Integer timeout, String requestId) { + try { + return getUserDelegationKeyWithResponse(keyInfo, timeout, requestId, Context.NONE).getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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 + * Timeouts for Blob Service Operations.</a>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a user delegation key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getUserDelegationKeyNoCustomHeadersWithResponse(KeyInfo keyInfo, Integer timeout, + String requestId, Context context) { + final String restype = "service"; + final String comp = "userdelegationkey"; + final String accept = "application/xml"; + try { + return service.getUserDelegationKeyNoCustomHeadersSync(this.client.getUrl(), restype, comp, timeout, + this.client.getVersion(), requestId, keyInfo, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * Returns the sku name and account kind. * @@ -1285,17 +2118,70 @@ public Mono getAccountInfoAsync(Context context) { * * @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}. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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)) + .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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Context context) { + 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) + .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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase getAccountInfoWithResponse(Context context) { + final String restype = "account"; + final String comp = "properties"; + final String accept = "application/xml"; + try { + return service.getAccountInfoSync(this.client.getUrl(), restype, comp, this.client.getVersion(), accept, + context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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. */ @ServiceMethod(returns = ReturnType.SINGLE) - 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)) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + public void getAccountInfo() { + getAccountInfoWithResponse(Context.NONE); } /** @@ -1305,17 +2191,19 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @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}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Context context) { + public Response getAccountInfoNoCustomHeadersWithResponse(Context context) { 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) - .onErrorMap(BlobStorageExceptionInternal.class, ModelHelper::mapToBlobStorageException); + try { + return service.getAccountInfoNoCustomHeadersSync(this.client.getUrl(), restype, comp, + this.client.getVersion(), accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } } /** @@ -1650,6 +2538,96 @@ public Mono submitBatchNoCustomHeadersWithResponseAsync(long con .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>. + * @param body Initial data. + * @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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase submitBatchWithResponse(long contentLength, + String multipartContentType, BinaryData body, Integer timeout, String requestId, Context context) { + final String comp = "batch"; + final String accept = "application/xml"; + try { + return service.submitBatchSync(this.client.getUrl(), comp, contentLength, multipartContentType, timeout, + this.client.getVersion(), requestId, body, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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>. + * @param body Initial data. + * @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>. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InputStream submitBatch(long contentLength, String multipartContentType, BinaryData body, Integer timeout, + String requestId) { + try { + return submitBatchWithResponse(contentLength, multipartContentType, body, timeout, requestId, Context.NONE) + .getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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>. + * @param body Initial data. + * @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>. + * @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 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response submitBatchNoCustomHeadersWithResponse(long contentLength, String multipartContentType, + BinaryData body, Integer timeout, String requestId, Context context) { + final String comp = "batch"; + final String accept = "application/xml"; + try { + return service.submitBatchNoCustomHeadersSync(this.client.getUrl(), comp, contentLength, + multipartContentType, timeout, this.client.getVersion(), requestId, body, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * 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 @@ -1902,6 +2880,137 @@ public Mono> filterBlobsNoCustomHeadersWithResponseA .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>. + * @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 where Filters the results to return only to return only blobs whose tags match the specified expression. + * @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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a Filter Blobs API call along with {@link ResponseBase}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseBase filterBlobsWithResponse(Integer timeout, + String requestId, String where, String marker, Integer maxresults, List include, + Context context) { + final String comp = "blobs"; + final String accept = "application/xml"; + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + try { + return service.filterBlobsSync(this.client.getUrl(), comp, timeout, this.client.getVersion(), requestId, + where, marker, maxresults, includeConverted, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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>. + * @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 where Filters the results to return only to return only blobs whose tags match the specified expression. + * @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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 result of a Filter Blobs API call. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FilterBlobSegment filterBlobs(Integer timeout, String requestId, String where, String marker, + Integer maxresults, List include) { + try { + return filterBlobsWithResponse(timeout, requestId, where, marker, maxresults, include, Context.NONE) + .getValue(); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + + /** + * 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>. + * @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 where Filters the results to return only to return only blobs whose tags match the specified expression. + * @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 + * did not return all containers remaining to be listed with the current page. The NextMarker value can be used as + * the value for the marker parameter in a subsequent call to request the next page of list items. The marker value + * is opaque to the client. + * @param maxresults Specifies the maximum number of containers to return. If the request does not specify + * maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the + * listing operation crosses a partition boundary, then the service will return a continuation token for retrieving + * the remainder of the results. For this reason, it is possible that the service will return fewer results than + * specified by maxresults, or than the default of 5000. + * @param include Include this parameter to specify one or more datasets to include in the response. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a Filter Blobs API call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response filterBlobsNoCustomHeadersWithResponse(Integer timeout, String requestId, + String where, String marker, Integer maxresults, List include, Context context) { + final String comp = "blobs"; + final String accept = "application/xml"; + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + try { + return service.filterBlobsNoCustomHeadersSync(this.client.getUrl(), comp, timeout, this.client.getVersion(), + requestId, where, marker, maxresults, includeConverted, accept, context); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } + /** * Get the next page of items. * @@ -2003,4 +3112,115 @@ public Mono> listBlobContainersSegmentNextNoCus .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 an enumeration of containers along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedResponse listBlobContainersSegmentNextSinglePage(String nextLink, String requestId) { + final String accept = "application/xml"; + ResponseBase res + = service.listBlobContainersSegmentNextSync(nextLink, this.client.getUrl(), this.client.getVersion(), + requestId, accept, Context.NONE); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(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. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of containers along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedResponse listBlobContainersSegmentNextSinglePage(String nextLink, String requestId, + Context context) { + final String accept = "application/xml"; + ResponseBase res + = service.listBlobContainersSegmentNextSync(nextLink, this.client.getUrl(), this.client.getVersion(), + requestId, accept, context); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), res.getDeserializedHeaders()); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 an enumeration of containers along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedResponse listBlobContainersSegmentNextNoCustomHeadersSinglePage(String nextLink, + String requestId) { + final String accept = "application/xml"; + Response res = service.listBlobContainersSegmentNextNoCustomHeadersSync(nextLink, + this.client.getUrl(), this.client.getVersion(), requestId, accept, Context.NONE); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), null); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(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. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an enumeration of containers along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedResponse listBlobContainersSegmentNextNoCustomHeadersSinglePage(String nextLink, + String requestId, Context context) { + final String accept = "application/xml"; + Response res = service.listBlobContainersSegmentNextNoCustomHeadersSync(nextLink, + this.client.getUrl(), this.client.getVersion(), requestId, accept, context); + try { + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().getBlobContainerItems(), res.getValue().getNextMarker(), null); + } catch (BlobStorageExceptionInternal internalException) { + throw ModelHelper.mapToBlobStorageException(internalException); + } + } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/BlobQueryReader.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/BlobQueryReader.java index d2dd45333eb37..9259961b06f12 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/BlobQueryReader.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/BlobQueryReader.java @@ -22,12 +22,17 @@ import com.azure.storage.internal.avro.implementation.AvroConstants; import com.azure.storage.internal.avro.implementation.AvroObject; import com.azure.storage.internal.avro.implementation.AvroReaderFactory; +import com.azure.storage.internal.avro.implementation.AvroReaderSyncFactory; import com.azure.storage.internal.avro.implementation.schema.AvroSchema; import com.azure.storage.internal.avro.implementation.schema.primitive.AvroNullSchema; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; @@ -41,6 +46,7 @@ */ public class BlobQueryReader { + private static final ClientLogger LOGGER = new ClientLogger(BlobQueryReader.class); private final Flux avro; private final Consumer progressConsumer; private final Consumer errorConsumer; @@ -74,6 +80,73 @@ public Flux read() { .concatMap(this::parseRecord); } + /** + * Avro parses a query reactive stream. + * + * The Avro stream is formatted as the Avro Header (that specifies the schema) and the Avro Body (that contains + * a series of blocks of data). The Query Avro schema indicates that the objects being emitted from the parser can + * either be a result data record, an end record, a progress record or an error record. + * + * @param inputStream The input stream to read from. + * @return The parsed query reactive stream. + * @throws IOException If an I/O error occurs. + */ + public InputStream readInputStream(InputStream inputStream) throws IOException { + AvroReaderSyncFactory avroReaderSyncFactory = new AvroReaderSyncFactory(); + ByteBuffer fullBuffer = convertInputStreamToByteBuffer(inputStream); + + Iterable avroObjects = avroReaderSyncFactory.getAvroReader(fullBuffer).read(); + + // serialize AvroObject back to bytes + byte[] processedData = serializeAvroObjectsToBytes(avroObjects); + return new ByteArrayInputStream(processedData); + } + + private ByteBuffer convertInputStreamToByteBuffer(InputStream inputStream) throws IOException { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; // Temporary buffer size + int bytesRead; + while ((bytesRead = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + byte[] data = outputStream.toByteArray(); // Get all data read from the stream + + // Convert the byte array to ByteBuffer + ByteBuffer byteBuffer = ByteBuffer.allocateDirect(data.length); + byteBuffer.put(data); + byteBuffer.flip(); // Prepare the buffer for reading + return byteBuffer; + } + + private byte[] serializeAvroObjectsToBytes(Iterable avroObjects) { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + for (AvroObject avroObject : avroObjects) { + try { + Object potentialMap = avroObject.getObject(); + if (!(potentialMap instanceof Map)) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Expected object to be of type Map")); + } + Map recordMap = (Map) potentialMap; // Safely cast it to a Map + ByteBuffer buffer = parseSyncRecord(recordMap); // Use the Map directly + + if (buffer != null) { + if (buffer.hasArray()) { + outputStream.write(buffer.array(), buffer.position(), buffer.remaining()); + } else { + // If the buffer does not have an accessible array, manually copy + byte[] data = new byte[buffer.remaining()]; + buffer.get(data); + outputStream.write(data); + } + buffer.clear(); // Prepare buffer for next iteration if reusing + } + } catch (IOException e) { + throw LOGGER.logExceptionAsError(new UncheckedIOException(e)); + } + } + return outputStream.toByteArray(); + } + /** * Parses a query record. * @@ -102,6 +175,34 @@ private Mono parseRecord(Object quickQueryRecord) { } } + /** + * Parses a query record. + * + * @param quickQueryRecord The query record. + * @return The optional data in the record. + */ + private ByteBuffer parseSyncRecord(Object quickQueryRecord) { + if (!(quickQueryRecord instanceof Map)) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Expected object to be of type Map")); + } + Map record = (Map) quickQueryRecord; + Object recordSchema = record.get(AvroConstants.RECORD); + + switch (recordSchema.toString()) { + case "resultData": + return parseSyncResultData(record); + case "end": + return parseSyncEnd(record); + case "progress": + return parseSyncProgress(record); + case "error": + return parseSyncError(record); + default: + throw LOGGER.logExceptionAsError(new IllegalStateException(String.format("Unknown record type %s " + + "while parsing query response. ", recordSchema.toString()))); + } + } + /** * Parses a query result data record. * @param dataRecord The query result data record. @@ -119,6 +220,23 @@ private Mono parseResultData(Map dataRecord) { } } + /** + * Parses a query result data record. + * @param dataRecord The query result data record. + * @return The data in the record. + */ + private ByteBuffer parseSyncResultData(Map dataRecord) { + Object data = dataRecord.get("data"); + + if (checkParametersNotNull(data)) { + AvroSchema.checkType("data", data, List.class); + return ByteBuffer.wrap(AvroSchema.getBytes((List) data)); + } else { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Failed to parse result data record from " + + "query response stream.")); + } + } + /** * Parses a query end record. * @param endRecord The query end record. @@ -139,6 +257,26 @@ private Mono parseEnd(Map endRecord) { return Mono.empty(); } + /** + * Parses a query end record. + * @param endRecord The query end record. + * @return Mono.empty or Mono.error + */ + private ByteBuffer parseSyncEnd(Map endRecord) { + if (progressConsumer != null) { + Object totalBytes = endRecord.get("totalBytes"); + + if (checkParametersNotNull(totalBytes)) { + AvroSchema.checkType("totalBytes", totalBytes, Long.class); + progressConsumer.accept(new BlobQueryProgress((long) totalBytes, (long) totalBytes)); + } else { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Failed to parse end record from query " + + "response stream.")); + } + } + return null; + } + /** * Parses a query progress record. * @param progressRecord The query progress record. @@ -161,6 +299,28 @@ private Mono parseProgress(Map progressRecord) { return Mono.empty(); } + /** + * Parses a query progress record. + * @param progressRecord The query progress record. + * @return Mono.empty or Mono.error + */ + private ByteBuffer parseSyncProgress(Map progressRecord) { + if (progressConsumer != null) { + Object bytesScanned = progressRecord.get("bytesScanned"); + Object totalBytes = progressRecord.get("totalBytes"); + + if (checkParametersNotNull(bytesScanned, totalBytes)) { + AvroSchema.checkType("bytesScanned", bytesScanned, Long.class); + AvroSchema.checkType("totalBytes", totalBytes, Long.class); + progressConsumer.accept(new BlobQueryProgress((long) bytesScanned, (long) totalBytes)); + } else { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Failed to parse progress record from " + + "query response stream.")); + } + } + return null; + } + /** * Parses a query error record. * @param errorRecord The query error record. @@ -194,6 +354,39 @@ private Mono parseError(Map errorRecord) { return Mono.empty(); } + /** + * Parses a query error record. + * @param errorRecord The query error record. + * @return Mono.empty or Mono.error + */ + private ByteBuffer parseSyncError(Map errorRecord) { + Object fatal = errorRecord.get("fatal"); + Object name = errorRecord.get("name"); + Object description = errorRecord.get("description"); + Object position = errorRecord.get("position"); + + if (checkParametersNotNull(fatal, name, description, position)) { + AvroSchema.checkType("fatal", fatal, Boolean.class); + AvroSchema.checkType("name", name, String.class); + AvroSchema.checkType("description", description, String.class); + AvroSchema.checkType("position", position, Long.class); + + BlobQueryError error = new BlobQueryError((Boolean) fatal, (String) name, + (String) description, (Long) position); + + if (errorConsumer != null) { + errorConsumer.accept(error); + } else { + throw LOGGER.logExceptionAsError(new UncheckedIOException(new IOException("An error was reported during query response processing, " + + System.lineSeparator() + error.toString()))); + } + } else { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Failed to parse error record from " + + "query response stream.")); + } + return null; + } + /** * Checks whether or not all parameters are non-null. */ 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 1e6d4e9508409..622bc90bc7ba1 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 @@ -3,6 +3,7 @@ package com.azure.storage.blob.implementation.util; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; import com.azure.core.http.RequestConditions; @@ -10,6 +11,7 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.storage.blob.BlobAsyncClient; import com.azure.storage.blob.implementation.accesshelpers.BlobDownloadHeadersConstructorProxy; import com.azure.storage.blob.implementation.accesshelpers.BlobItemConstructorProxy; @@ -25,32 +27,47 @@ import com.azure.storage.blob.implementation.models.BlobsQueryHeaders; import com.azure.storage.blob.implementation.models.FilterBlobItem; import com.azure.storage.blob.models.BlobBeginCopySourceRequestConditions; +import com.azure.storage.blob.models.BlobContainerListDetails; +import com.azure.storage.blob.models.BlobCorsRule; import com.azure.storage.blob.models.BlobDownloadAsyncResponse; import com.azure.storage.blob.models.BlobDownloadHeaders; import com.azure.storage.blob.models.BlobDownloadResponse; +import com.azure.storage.blob.models.BlobErrorCode; import com.azure.storage.blob.models.BlobItem; import com.azure.storage.blob.models.BlobLeaseRequestConditions; import com.azure.storage.blob.models.BlobProperties; import com.azure.storage.blob.models.BlobQueryHeaders; import com.azure.storage.blob.models.BlobRequestConditions; +import com.azure.storage.blob.models.BlobRetentionPolicy; +import com.azure.storage.blob.models.BlobSignedIdentifier; import com.azure.storage.blob.models.BlobStorageException; +import com.azure.storage.blob.models.CopyStatusType; +import com.azure.storage.blob.models.ListBlobContainersIncludeType; import com.azure.storage.blob.models.ObjectReplicationPolicy; import com.azure.storage.blob.models.ObjectReplicationRule; import com.azure.storage.blob.models.ObjectReplicationStatus; import com.azure.storage.blob.models.PageBlobCopyIncrementalRequestConditions; +import com.azure.storage.blob.models.PageRange; import com.azure.storage.blob.models.ParallelTransferOptions; import com.azure.storage.blob.models.TaggedBlobItem; import com.azure.storage.common.Utility; import com.azure.storage.common.implementation.Constants; +import com.azure.storage.common.implementation.StorageImplUtils; +import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.Callable; +import java.util.function.Supplier; /** * This class provides helper methods for common model patterns. @@ -67,6 +84,11 @@ public final class ModelHelper { private static final HttpHeaderName X_MS_ERROR_CODE = HttpHeaderName.fromString("x-ms-error-code"); + /** + * Indicates the number of bytes in a page. + */ + public static final int PAGE_BYTES = 512; + /** * Determines whether the passed authority is IP style, that is, it is of the format {@code :}. * @@ -468,6 +490,197 @@ public static long getBlobLength(BlobDownloadHeaders headers) { : ChunkedDownloadUtils.extractTotalBlobLength(headers.getContentRange()); } + public static boolean checkBlobDoesNotExistStatusCode(Throwable t) { + if (t instanceof BlobStorageException) { + BlobStorageException s = (BlobStorageException) t; + return s.getStatusCode() == 404 + && (s.getErrorCode() == BlobErrorCode.RESOURCE_NOT_FOUND + || s.getErrorCode() == BlobErrorCode.BLOB_NOT_FOUND); + /* HttpResponseException - file get properties is a head request so a body is not returned. Error + conversion logic does not properly handle errors that don't return XML. */ + } else if (t instanceof HttpResponseException) { + HttpResponseException h = (HttpResponseException) t; + String errorCode = h.getResponse().getHeaderValue(X_MS_ERROR_CODE); + return h.getResponse().getStatusCode() == 404 + && (BlobErrorCode.RESOURCE_NOT_FOUND.toString().equals(errorCode) + || BlobErrorCode.BLOB_NOT_FOUND.toString().equals(errorCode)); + } else { + return false; + } + } + + public static boolean checkContainerDoesNotExistStatusCode(Throwable t) { + if (t instanceof BlobStorageException) { + BlobStorageException s = (BlobStorageException) t; + return s.getStatusCode() == 404 + && (s.getErrorCode() == BlobErrorCode.RESOURCE_NOT_FOUND + || s.getErrorCode() == BlobErrorCode.CONTAINER_NOT_FOUND); + /* HttpResponseException - file get properties is a head request so a body is not returned. Error + conversion logic does not properly handle errors that don't return XML. */ + } else if (t instanceof HttpResponseException) { + HttpResponseException h = (HttpResponseException) t; + String errorCode = h.getResponse().getHeaderValue(X_MS_ERROR_CODE); + return h.getResponse().getStatusCode() == 404 + && (BlobErrorCode.RESOURCE_NOT_FOUND.toString().equals(errorCode) + || BlobErrorCode.CONTAINER_NOT_FOUND.toString().equals(errorCode)); + } else { + return false; + } + } + + public static String tagsToString(Map tags) { + if (tags == null || tags.isEmpty()) { + return null; + } + StringBuilder sb = new StringBuilder(); + boolean first = true; // Flag to track if it's the first element in the loop + for (Map.Entry entry : tags.entrySet()) { + try { + if (!first) { + sb.append("&"); // Append the delimiter before the key-value pair, except for the first + } else { + first = false; // Update flag after processing the first entry + } + sb.append(URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8.toString())); + sb.append("="); + sb.append(URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString())); + } catch (UnsupportedEncodingException e) { + throw LOGGER.logExceptionAsError(new IllegalStateException(e)); + } + } + return sb.toString(); + } + + public static LongRunningOperationStatus mapStatusToLongRunningOperationStatus(CopyStatusType status) { + LongRunningOperationStatus operationStatus; + switch (status) { + case SUCCESS: + operationStatus = LongRunningOperationStatus.SUCCESSFULLY_COMPLETED; + break; + case FAILED: + operationStatus = LongRunningOperationStatus.FAILED; + break; + case ABORTED: + operationStatus = LongRunningOperationStatus.USER_CANCELLED; + break; + case PENDING: + operationStatus = LongRunningOperationStatus.IN_PROGRESS; + break; + default: + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "CopyStatusType is not supported. Status: " + status)); + } + return operationStatus; + } + + public static boolean validateNoETag(BlobRequestConditions modifiedRequestConditions) { + if (modifiedRequestConditions == null) { + return true; + } + return modifiedRequestConditions.getIfMatch() == null && modifiedRequestConditions.getIfNoneMatch() == null; + } + + /** + * Converts {@link BlobContainerListDetails} into list of {@link ListBlobContainersIncludeType} + * that contains only options selected. If no option is selected then null is returned. + * + * @return a list of selected options converted into {@link ListBlobContainersIncludeType}, null if none + * of options has been selected. + */ + public static List toIncludeTypes(BlobContainerListDetails blobContainerListDetails) { + boolean hasDetails = blobContainerListDetails != null + && (blobContainerListDetails.getRetrieveMetadata() + || blobContainerListDetails.getRetrieveDeleted() + || blobContainerListDetails.getRetrieveSystemContainers()); + if (hasDetails) { + List flags = new ArrayList<>(3); + if (blobContainerListDetails.getRetrieveDeleted()) { + flags.add(ListBlobContainersIncludeType.DELETED); + } + if (blobContainerListDetails.getRetrieveMetadata()) { + flags.add(ListBlobContainersIncludeType.METADATA); + } + if (blobContainerListDetails.getRetrieveSystemContainers()) { + flags.add(ListBlobContainersIncludeType.SYSTEM); + } + return flags; + } else { + return null; + } + } + + /** + * Validates a {@link BlobRetentionPolicy} according to service specs for set properties. + * @param retentionPolicy {@link BlobRetentionPolicy} + * @param policyName The name of the variable for errors. + */ + public static void validateRetentionPolicy(BlobRetentionPolicy retentionPolicy, String policyName) { + if (retentionPolicy == null) { + return; + } + if (retentionPolicy.isEnabled()) { + StorageImplUtils.assertInBounds(policyName, retentionPolicy.getDays(), 1, 365); + } + } + + /** + * Sets any null fields to "" since the service requires all Cors rules to be set if some are set. + * @param originalRule {@link BlobCorsRule} + * @return The validated {@link BlobCorsRule} + */ + public static BlobCorsRule validatedCorsRule(BlobCorsRule originalRule) { + if (originalRule == null) { + return null; + } + BlobCorsRule validRule = new BlobCorsRule(); + validRule.setAllowedHeaders(StorageImplUtils.emptyIfNull(originalRule.getAllowedHeaders())); + validRule.setAllowedMethods(StorageImplUtils.emptyIfNull(originalRule.getAllowedMethods())); + validRule.setAllowedOrigins(StorageImplUtils.emptyIfNull(originalRule.getAllowedOrigins())); + validRule.setExposedHeaders(StorageImplUtils.emptyIfNull(originalRule.getExposedHeaders())); + validRule.setMaxAgeInSeconds(originalRule.getMaxAgeInSeconds()); + return validRule; + } + + public static String pageRangeToString(PageRange pageRange) { + if (pageRange.getStart() < 0 || pageRange.getEnd() <= 0) { + throw new IllegalArgumentException("PageRange's start and end values must be greater than or equal to " + + "0 if specified."); + } + if (pageRange.getStart() % PAGE_BYTES != 0) { + throw new IllegalArgumentException("PageRange's start value must be a multiple of 512."); + } + if (pageRange.getEnd() % PAGE_BYTES != PAGE_BYTES - 1) { + throw new IllegalArgumentException("PageRange's end value must be 1 less than a multiple of 512."); + } + if (pageRange.getEnd() <= pageRange.getStart()) { + throw new IllegalArgumentException("PageRange's End value must be after the start."); + } + return "bytes=" + pageRange.getStart() + '-' + pageRange.getEnd(); + } + + public static List truncateTimeForBlobSignedIdentifier(List identifiers) { + if (identifiers == null) { + return null; + } + /* + We truncate to seconds because the service only supports nanoseconds or seconds, but doing an + OffsetDateTime.now will only give back milliseconds (more precise fields are zeroed and not serialized). This + allows for proper serialization with no real detriment to users as sub-second precision on active time for + signed identifiers is not really necessary. + */ + for (BlobSignedIdentifier identifier : identifiers) { + if (identifier.getAccessPolicy() != null && identifier.getAccessPolicy().getStartsOn() != null) { + identifier.getAccessPolicy().setStartsOn( + identifier.getAccessPolicy().getStartsOn().truncatedTo(ChronoUnit.SECONDS)); + } + if (identifier.getAccessPolicy() != null && identifier.getAccessPolicy().getExpiresOn() != null) { + identifier.getAccessPolicy().setExpiresOn( + identifier.getAccessPolicy().getExpiresOn().truncatedTo(ChronoUnit.SECONDS)); + } + } + return identifiers; + } + /** * Maps the internal exception to a public exception, if and only if {@code internal} is an instance of * {@link BlobStorageExceptionInternal} and it will be mapped to {@link BlobStorageException}. @@ -483,6 +696,24 @@ public static BlobStorageException mapToBlobStorageException(BlobStorageExceptio return new BlobStorageException(internal.getMessage(), internal.getResponse(), internal.getValue()); } + public static Callable wrapTimeoutServiceCallWithExceptionMapping(Supplier serviceCall) { + return () -> { + try { + return serviceCall.get(); + } catch (BlobStorageExceptionInternal internal) { + throw mapToBlobStorageException(internal); + } + }; + } + + public static T wrapServiceCallWithExceptionMapping(Supplier serviceCall) { + try { + return serviceCall.get(); + } catch (BlobStorageExceptionInternal internal) { + throw mapToBlobStorageException(internal); + } + } + 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 c448b13923a4d..c9a955866bb65 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,6 +22,7 @@ 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; @@ -291,7 +292,7 @@ Mono> createWithResponse(AppendBlobCreateOptions option options.getMetadata(), requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, - tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), + ModelHelper.tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), options.hasLegalHold(), options.getHeaders(), getCustomerProvidedKey(), encryptionScope, context) .map(rb -> { diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/AppendBlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/AppendBlobClient.java index b7d2e0256fa8e..f32655608e183 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/AppendBlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/AppendBlobClient.java @@ -7,19 +7,30 @@ import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; import com.azure.core.exception.UnexpectedLengthException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.ResponseBase; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobClient; import com.azure.storage.blob.BlobClientBuilder; import com.azure.storage.blob.BlobContainerClient; import com.azure.storage.blob.BlobServiceClient; import com.azure.storage.blob.BlobServiceVersion; +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.BlobErrorCode; import com.azure.storage.blob.models.BlobHttpHeaders; +import com.azure.storage.blob.models.BlobImmutabilityPolicy; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.BlobRequestConditions; 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; @@ -35,8 +46,10 @@ import java.time.Duration; import java.util.Map; import java.util.Objects; +import java.util.concurrent.Callable; -import static com.azure.storage.common.implementation.StorageImplUtils.blockWithOptionalTimeout; +import static com.azure.storage.blob.implementation.util.ModelHelper.wrapTimeoutServiceCallWithExceptionMapping; +import static com.azure.storage.common.implementation.StorageImplUtils.sendRequest; /** * Client to an append blob. It may only be instantiated through a {@link SpecializedBlobClientBuilder} or via the @@ -53,7 +66,7 @@ */ @ServiceClient(builder = SpecializedBlobClientBuilder.class) public final class AppendBlobClient extends BlobClientBase { - + private static final ClientLogger LOGGER = new ClientLogger(AppendBlobClient.class); private final AppendBlobAsyncClient appendBlobAsyncClient; /** @@ -61,30 +74,29 @@ public final class AppendBlobClient extends BlobClientBase { * @deprecated use {@link AppendBlobClient#getMaxAppendBlockBytes()}. */ @Deprecated - public static final int MAX_APPEND_BLOCK_BYTES = AppendBlobAsyncClient.MAX_APPEND_BLOCK_BYTES; + public static final int MAX_APPEND_BLOCK_BYTES = 4 * Constants.MB; /** * Indicates the maximum number of blocks allowed in an append blob. * @deprecated use {@link AppendBlobClient#getMaxBlocks()}. */ @Deprecated - public static final int MAX_BLOCKS = AppendBlobAsyncClient.MAX_BLOCKS; + public static final int MAX_BLOCKS = 50000; /** * Indicates the maximum number of bytes that can be sent in a call to appendBlock. */ - static final int MAX_APPEND_BLOCK_BYTES_VERSIONS_2021_12_02_AND_BELOW = AppendBlobAsyncClient.MAX_APPEND_BLOCK_BYTES_VERSIONS_2021_12_02_AND_BELOW; + static final int MAX_APPEND_BLOCK_BYTES_VERSIONS_2021_12_02_AND_BELOW = 4 * Constants.MB; /** * Indicates the maximum number of bytes that can be sent in a call to appendBlock. * For versions 2022-11-02 and above. */ - static final int MAX_APPEND_BLOCK_BYTES_VERSIONS_2022_11_02_AND_ABOVE = AppendBlobAsyncClient.MAX_APPEND_BLOCK_BYTES_VERSIONS_2022_11_02_AND_ABOVE; - + static final int MAX_APPEND_BLOCK_BYTES_VERSIONS_2022_11_02_AND_ABOVE = 100 * Constants.MB; /** * Indicates the maximum number of blocks allowed in an append blob. */ - static final int MAX_APPEND_BLOCKS = AppendBlobAsyncClient.MAX_APPEND_BLOCKS; + static final int MAX_APPEND_BLOCKS = 50000; /** * Package-private constructor for use by {@link BlobClientBuilder}. @@ -92,8 +104,36 @@ public final class AppendBlobClient extends BlobClientBase { * @param appendBlobAsyncClient the async append blob client */ AppendBlobClient(AppendBlobAsyncClient appendBlobAsyncClient) { - super(appendBlobAsyncClient); - this.appendBlobAsyncClient = appendBlobAsyncClient; + this(appendBlobAsyncClient, appendBlobAsyncClient.getHttpPipeline(), appendBlobAsyncClient.getAccountUrl(), + appendBlobAsyncClient.getServiceVersion(), appendBlobAsyncClient.getAccountName(), + appendBlobAsyncClient.getContainerName(), appendBlobAsyncClient.getBlobName(), + appendBlobAsyncClient.getSnapshotId(), appendBlobAsyncClient.getCustomerProvidedKey(), + new EncryptionScope().setEncryptionScope(appendBlobAsyncClient.getEncryptionScope()), + appendBlobAsyncClient.getVersionId()); + } + + /** + * Package-private constructor for use by {@link SpecializedBlobClientBuilder}. + * + * @param pipeline The pipeline used to send and receive service requests. + * @param url The endpoint where to send service requests. + * @param serviceVersion The version of the service to receive requests. + * @param accountName The storage account name. + * @param containerName The container name. + * @param blobName The blob name. + * @param snapshot The snapshot identifier for the blob, pass {@code null} to interact with the blob directly. + * @param customerProvidedKey Customer provided key used during encryption of the blob's data on the server, pass + * {@code null} to allow the service to use its own encryption. + * @param encryptionScope Encryption scope used during encryption of the blob's data on the server, pass + * {@code null} to allow the service to use its own encryption. + * @param versionId The version identifier for the blob, pass {@code null} to interact with the latest blob version. + */ + AppendBlobClient(AppendBlobAsyncClient asyncClient, HttpPipeline pipeline, String url, + BlobServiceVersion serviceVersion, String accountName, String containerName, String blobName, String snapshot, + CpkInfo customerProvidedKey, EncryptionScope encryptionScope, String versionId) { + super(asyncClient, pipeline, url, serviceVersion, accountName, containerName, blobName, snapshot, customerProvidedKey, + encryptionScope, versionId); + this.appendBlobAsyncClient = asyncClient; } /** @@ -104,7 +144,13 @@ public final class AppendBlobClient extends BlobClientBase { */ @Override public AppendBlobClient getEncryptionScopeClient(String encryptionScope) { - return new AppendBlobClient(appendBlobAsyncClient.getEncryptionScopeAsyncClient(encryptionScope)); + EncryptionScope finalEncryptionScope = null; + if (encryptionScope != null) { + finalEncryptionScope = new EncryptionScope().setEncryptionScope(encryptionScope); + } + return new AppendBlobClient(this.appendBlobAsyncClient.getEncryptionScopeAsyncClient(encryptionScope), + getHttpPipeline(), getAccountUrl(), getServiceVersion(), getAccountName(), getContainerName(), + getBlobName(), getSnapshotId(), getCustomerProvidedKey(), finalEncryptionScope, getVersionId()); } /** @@ -116,7 +162,16 @@ public AppendBlobClient getEncryptionScopeClient(String encryptionScope) { */ @Override public AppendBlobClient getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey) { - return new AppendBlobClient(appendBlobAsyncClient.getCustomerProvidedKeyAsyncClient(customerProvidedKey)); + CpkInfo finalCustomerProvidedKey = null; + if (customerProvidedKey != null) { + finalCustomerProvidedKey = new CpkInfo() + .setEncryptionKey(customerProvidedKey.getKey()) + .setEncryptionKeySha256(customerProvidedKey.getKeySha256()) + .setEncryptionAlgorithm(customerProvidedKey.getEncryptionAlgorithm()); + } + return new AppendBlobClient(this.appendBlobAsyncClient.getCustomerProvidedKeyAsyncClient(customerProvidedKey), + getHttpPipeline(), getAccountUrl(), getServiceVersion(), getAccountName(), getContainerName(), + getBlobName(), getSnapshotId(), finalCustomerProvidedKey, encryptionScope, getVersionId()); } /** @@ -278,8 +333,28 @@ public Response createWithResponse(BlobHttpHeaders headers, Map< @ServiceMethod(returns = ReturnType.SINGLE) public Response createWithResponse(AppendBlobCreateOptions options, Duration timeout, Context context) { - return StorageImplUtils.blockWithOptionalTimeout(appendBlobAsyncClient. - createWithResponse(options, context), timeout); + AppendBlobCreateOptions finalOptions = (options == null) ? new AppendBlobCreateOptions() : options; + BlobRequestConditions requestConditions = finalOptions.getRequestConditions() == null + ? new BlobRequestConditions() : finalOptions.getRequestConditions(); + Context finalContext = context == null ? Context.NONE : context; + BlobImmutabilityPolicy immutabilityPolicy = finalOptions.getImmutabilityPolicy() == null + ? new BlobImmutabilityPolicy() : finalOptions.getImmutabilityPolicy(); + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( + () -> + this.azureBlobStorage.getAppendBlobs().createWithResponse(containerName, blobName, 0, null, + finalOptions.getMetadata(), requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), + requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), + requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, + ModelHelper.tagsToString(finalOptions.getTags()), immutabilityPolicy.getExpiryTime(), + immutabilityPolicy.getPolicyMode(), finalOptions.hasLegalHold(), finalOptions.getHeaders(), + getCustomerProvidedKey(), encryptionScope, finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + AppendBlobsCreateHeaders hd = response.getDeserializedHeaders(); + AppendBlobItem item = new AppendBlobItem(hd.getETag(), hd.getLastModified(), hd.getContentMD5(), + hd.isXMsRequestServerEncrypted(), hd.getXMsEncryptionKeySha256(), hd.getXMsEncryptionScope(), null, null, + hd.getXMsVersionId()); + return new SimpleResponse<>(response, item); } /** @@ -336,8 +411,22 @@ public AppendBlobItem createIfNotExists() { @ServiceMethod(returns = ReturnType.SINGLE) public Response createIfNotExistsWithResponse(AppendBlobCreateOptions options, Duration timeout, Context context) { - return StorageImplUtils.blockWithOptionalTimeout(appendBlobAsyncClient. - createIfNotExistsWithResponse(options, context), timeout); + AppendBlobCreateOptions finalOptions = options == null ? new AppendBlobCreateOptions() : options; + finalOptions.setRequestConditions(new AppendBlobRequestConditions() + .setIfNoneMatch(Constants.HeaderConstants.ETAG_WILDCARD)); + try { + return createWithResponse(finalOptions, timeout, context); + } catch (BlobStorageException e) { + if (e.getStatusCode() == 409 && (e.getErrorCode().equals(BlobErrorCode.BLOB_ALREADY_EXISTS) + || e.getErrorCode().equals(BlobErrorCode.RESOURCE_ALREADY_EXISTS))) { + HttpResponse res = e.getResponse(); + return new SimpleResponse<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), null); + } else { + throw LOGGER.logExceptionAsError(e); + } + } catch (RuntimeException e) { + throw LOGGER.logExceptionAsError(e); + } } /** @@ -577,9 +666,18 @@ public void seal() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response sealWithResponse(AppendBlobSealOptions options, Duration timeout, Context context) { - Mono> response = appendBlobAsyncClient.sealWithResponse(options, context); - - return blockWithOptionalTimeout(response, timeout); + AppendBlobSealOptions finalOptions = (options == null) ? new AppendBlobSealOptions() : options; + + AppendBlobRequestConditions requestConditions = (finalOptions.getRequestConditions() == null) + ? new AppendBlobRequestConditions() : finalOptions.getRequestConditions(); + Context finalContext = context == null ? Context.NONE : context; + + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getAppendBlobs().sealNoCustomHeadersWithResponse(containerName, blobName, null, null, + requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), + requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), + requestConditions.getIfNoneMatch(), requestConditions.getAppendPosition(), finalContext)); + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -589,7 +687,7 @@ public Response sealWithResponse(AppendBlobSealOptions options, Duration t * @return the max number of block bytes that can be uploaded based on service version. */ public int getMaxAppendBlockBytes() { - if (appendBlobAsyncClient.getServiceVersion().ordinal() < BlobServiceVersion.V2022_11_02.ordinal()) { + if (getServiceVersion().ordinal() < BlobServiceVersion.V2022_11_02.ordinal()) { return MAX_APPEND_BLOCK_BYTES_VERSIONS_2021_12_02_AND_BELOW; } else { return MAX_APPEND_BLOCK_BYTES_VERSIONS_2022_11_02_AND_ABOVE; 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 a9d489c13feb0..eb824cf564f94 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 @@ -89,14 +89,11 @@ import java.io.IOException; import java.io.UncheckedIOException; -import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URI; import java.net.URL; -import java.net.URLEncoder; import java.nio.ByteBuffer; import java.nio.channels.AsynchronousFileChannel; -import java.nio.charset.Charset; import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; import java.nio.file.OpenOption; @@ -764,7 +761,7 @@ private Mono onStart(String sourceUrl, Map metadat destinationRequestConditions.getIfModifiedSince(), destinationRequestConditions.getIfUnmodifiedSince(), destinationRequestConditions.getIfMatch(), destinationRequestConditions.getIfNoneMatch(), destinationRequestConditions.getTagsConditions(), destinationRequestConditions.getLeaseId(), null, - tagsToString(tags), sealBlob, immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), + ModelHelper.tagsToString(tags), sealBlob, immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), legalHold, context)) .map(response -> { final BlobsStartCopyFromURLHeaders headers = response.getDeserializedHeaders(); @@ -775,26 +772,6 @@ private Mono onStart(String sourceUrl, Map metadat }); } - String tagsToString(Map tags) { - if (tags == null || tags.isEmpty()) { - return null; - } - StringBuilder sb = new StringBuilder(); - for (Map.Entry entry : tags.entrySet()) { - try { - sb.append(URLEncoder.encode(entry.getKey(), Charset.defaultCharset().toString())); - sb.append("="); - sb.append(URLEncoder.encode(entry.getValue(), Charset.defaultCharset().toString())); - sb.append("&"); - } catch (UnsupportedEncodingException e) { - throw LOGGER.logExceptionAsError(new IllegalStateException(e)); - } - } - - sb.deleteCharAt(sb.length() - 1); // Remove the last '&' - return sb.toString(); - } - private Mono> onPoll(PollResponse pollResponse) { if (pollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED || pollResponse.getStatus() == LongRunningOperationStatus.FAILED) { @@ -814,25 +791,7 @@ private Mono> onPoll(PollResponse pollR response.getETag(), response.getCopyCompletionTime(), response.getCopyStatusDescription(), response.getVersionId()); - LongRunningOperationStatus operationStatus; - switch (status) { - case SUCCESS: - operationStatus = LongRunningOperationStatus.SUCCESSFULLY_COMPLETED; - break; - case FAILED: - operationStatus = LongRunningOperationStatus.FAILED; - break; - case ABORTED: - operationStatus = LongRunningOperationStatus.USER_CANCELLED; - break; - case PENDING: - operationStatus = LongRunningOperationStatus.IN_PROGRESS; - break; - default: - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - "CopyStatusType is not supported. Status: " + status)); - } - + LongRunningOperationStatus operationStatus = ModelHelper.mapStatusToLongRunningOperationStatus(status); return new PollResponse<>(operationStatus, result); }).onErrorReturn( new PollResponse<>(LongRunningOperationStatus.fromString("POLLING_FAILED", true), lastInfo)); @@ -1034,7 +993,7 @@ Mono> copyFromUrlWithResponse(BlobCopyFromUrlOptions options, C destRequestConditions.getIfUnmodifiedSince(), destRequestConditions.getIfMatch(), destRequestConditions.getIfNoneMatch(), destRequestConditions.getTagsConditions(), destRequestConditions.getLeaseId(), null, null, - tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), + ModelHelper.tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), options.hasLegalHold(), sourceAuth, options.getCopySourceTagsMode(), this.encryptionScope, context) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getXMsCopyId())); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java index 5e5bce8daed90..4462a5c9b745d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java @@ -5,30 +5,62 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; import com.azure.core.http.RequestConditions; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; import com.azure.core.util.polling.SyncPoller; import com.azure.storage.blob.BlobContainerClient; +import com.azure.storage.blob.BlobContainerClientBuilder; import com.azure.storage.blob.BlobServiceClient; import com.azure.storage.blob.BlobServiceVersion; +import com.azure.storage.blob.implementation.AzureBlobStorageImpl; +import com.azure.storage.blob.implementation.AzureBlobStorageImplBuilder; +import com.azure.storage.blob.implementation.accesshelpers.BlobPropertiesConstructorProxy; +import com.azure.storage.blob.implementation.models.BlobPropertiesInternalGetProperties; +import com.azure.storage.blob.implementation.models.BlobTag; +import com.azure.storage.blob.implementation.models.BlobTags; +import com.azure.storage.blob.implementation.models.BlobsCopyFromURLHeaders; +import com.azure.storage.blob.implementation.models.BlobsCreateSnapshotHeaders; +import com.azure.storage.blob.implementation.models.BlobsGetAccountInfoHeaders; +import com.azure.storage.blob.implementation.models.BlobsGetPropertiesHeaders; +import com.azure.storage.blob.implementation.models.BlobsGetTagsHeaders; +import com.azure.storage.blob.implementation.models.BlobsQueryHeaders; +import com.azure.storage.blob.implementation.models.BlobsSetImmutabilityPolicyHeaders; +import com.azure.storage.blob.implementation.models.BlobsSetLegalHoldHeaders; +import com.azure.storage.blob.implementation.models.BlobsStartCopyFromURLHeaders; +import com.azure.storage.blob.implementation.models.EncryptionScope; +import com.azure.storage.blob.implementation.models.InternalBlobLegalHoldResult; +import com.azure.storage.blob.implementation.models.QueryRequest; +import com.azure.storage.blob.implementation.models.QuerySerialization; +import com.azure.storage.blob.implementation.util.BlobQueryReader; +import com.azure.storage.blob.implementation.util.BlobRequestConditionProperty; +import com.azure.storage.blob.implementation.util.BlobSasImplUtil; import com.azure.storage.blob.implementation.util.ByteBufferBackedOutputStreamUtil; import com.azure.storage.blob.implementation.util.ChunkedDownloadUtils; import com.azure.storage.blob.implementation.util.ModelHelper; import com.azure.storage.blob.models.AccessTier; +import com.azure.storage.blob.models.BlobBeginCopySourceRequestConditions; import com.azure.storage.blob.models.BlobCopyInfo; import com.azure.storage.blob.models.BlobDownloadAsyncResponse; import com.azure.storage.blob.models.BlobDownloadContentAsyncResponse; import com.azure.storage.blob.models.BlobDownloadContentResponse; import com.azure.storage.blob.models.BlobDownloadResponse; +import com.azure.storage.blob.models.BlobErrorCode; import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobImmutabilityPolicy; +import com.azure.storage.blob.models.BlobImmutabilityPolicyMode; import com.azure.storage.blob.models.BlobLegalHoldResult; import com.azure.storage.blob.models.BlobProperties; import com.azure.storage.blob.models.BlobQueryAsyncResponse; @@ -38,6 +70,7 @@ import com.azure.storage.blob.models.BlobSeekableByteChannelReadResult; import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.models.ConsistentReadControl; +import com.azure.storage.blob.models.CopyStatusType; import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.CustomerProvidedKey; import com.azure.storage.blob.models.DeleteSnapshotsOptionType; @@ -57,8 +90,9 @@ import com.azure.storage.blob.options.BlobSetTagsOptions; import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; 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.FluxInputStream; +import com.azure.storage.common.implementation.SasImplUtils; import com.azure.storage.common.implementation.StorageImplUtils; import com.azure.storage.common.implementation.StorageSeekableByteChannel; import reactor.core.publisher.Mono; @@ -67,6 +101,8 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.UncheckedIOException; +import java.net.MalformedURLException; +import java.net.URI; import java.net.URL; import java.nio.ByteBuffer; import java.nio.channels.SeekableByteChannel; @@ -75,13 +111,25 @@ import java.nio.file.StandardOpenOption; import java.time.Duration; import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.EnumSet; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiFunction; +import java.util.function.Function; import java.util.function.Consumer; +import static com.azure.storage.blob.implementation.util.ModelHelper.wrapServiceCallWithExceptionMapping; +import static com.azure.storage.blob.implementation.util.ModelHelper.wrapTimeoutServiceCallWithExceptionMapping; import static com.azure.storage.common.implementation.StorageImplUtils.blockWithOptionalTimeout; +import static com.azure.storage.common.implementation.StorageImplUtils.sendRequest; /** * This class provides a client that contains all operations that apply to any blob type. @@ -92,6 +140,42 @@ */ public class BlobClientBase { private static final ClientLogger LOGGER = new ClientLogger(BlobClientBase.class); + private static final Set DEFAULT_OPEN_OPTIONS_SET = Collections.unmodifiableSet(new HashSet<>( + Arrays.asList(StandardOpenOption.CREATE_NEW, StandardOpenOption.READ, StandardOpenOption.WRITE))); + + /** + * Backing REST client for the blob client. + */ + protected final AzureBlobStorageImpl azureBlobStorage; + + private final String snapshot; + private final String versionId; + private final CpkInfo customerProvidedKey; + + /** + * Encryption scope of the blob. + */ + protected final EncryptionScope encryptionScope; + + /** + * Storage account name that contains the blob. + */ + protected final String accountName; + + /** + * Container name that contains the blob. + */ + protected final String containerName; + + /** + * Name of the blob. + */ + protected final String blobName; + + /** + * Storage REST API version used in requests to the Storage service. + */ + protected final BlobServiceVersion serviceVersion; private final BlobAsyncClientBase client; @@ -101,7 +185,80 @@ public class BlobClientBase { * @param client the async blob client */ protected BlobClientBase(BlobAsyncClientBase client) { + if (client.getSnapshotId() != null && client.getVersionId() != null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("'snapshot' and 'versionId' cannot be used at the same time.")); + } this.client = client; + this.azureBlobStorage = new AzureBlobStorageImplBuilder() + .pipeline(client.getHttpPipeline()) + .url(client.getAccountUrl()) + .version(client.getServiceVersion().getVersion()) + .buildClient(); + this.serviceVersion = client.getServiceVersion(); + + this.accountName = client.getAccountName(); + this.containerName = client.getContainerName(); + this.blobName = client.getBlobName(); + this.snapshot = client.getSnapshotId(); + this.customerProvidedKey = client.getCustomerProvidedKey(); + this.encryptionScope = new EncryptionScope().setEncryptionScope(client.getEncryptionScope()); + this.versionId = client.getVersionId(); + /* Check to make sure the uri is valid. We don't want the error to occur later in the generated layer + when the sas token has already been applied. */ + try { + URI.create(getBlobUrl()); + } catch (IllegalArgumentException ex) { + throw LOGGER.logExceptionAsError(ex); + } + } + + /** + * Protected constructor for use by {@link SpecializedBlobClientBuilder}. + * + * @param client the async blob client + * @param pipeline The pipeline used to send and receive service requests. + * @param url The endpoint where to send service requests. + * @param serviceVersion The version of the service to receive requests. + * @param accountName The storage account name. + * @param containerName The container name. + * @param blobName The blob name. + * @param snapshot The snapshot identifier for the blob, pass {@code null} to interact with the blob directly. + * @param customerProvidedKey Customer provided key used during encryption of the blob's data on the server, pass + * {@code null} to allow the service to use its own encryption. + * @param encryptionScope Encryption scope used during encryption of the blob's data on the server, pass + * {@code null} to allow the service to use its own encryption. + * @param versionId The version identifier for the blob, pass {@code null} to interact with the latest blob version. + */ + protected BlobClientBase(BlobAsyncClientBase client, HttpPipeline pipeline, String url, + BlobServiceVersion serviceVersion, String accountName, String containerName, String blobName, String snapshot, + CpkInfo customerProvidedKey, EncryptionScope encryptionScope, String versionId) { + if (snapshot != null && versionId != null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("'snapshot' and 'versionId' cannot be used at the same time.")); + } + this.client = client; + this.azureBlobStorage = new AzureBlobStorageImplBuilder() + .pipeline(pipeline) + .url(url) + .version(serviceVersion.getVersion()) + .buildClient(); + this.serviceVersion = serviceVersion; + + this.accountName = accountName; + this.containerName = containerName; + this.blobName = blobName; + this.snapshot = snapshot; + this.customerProvidedKey = customerProvidedKey; + this.encryptionScope = encryptionScope; + this.versionId = versionId; + /* Check to make sure the uri is valid. We don't want the error to occur later in the generated layer + when the sas token has already been applied. */ + try { + URI.create(getBlobUrl()); + } catch (IllegalArgumentException ex) { + throw LOGGER.logExceptionAsError(ex); + } } /** @@ -111,7 +268,9 @@ protected BlobClientBase(BlobAsyncClientBase client) { * @return a {@link BlobClientBase} used to interact with the specific snapshot. */ public BlobClientBase getSnapshotClient(String snapshot) { - return new BlobClientBase(client.getSnapshotClient(snapshot)); + return new BlobClientBase(this.client.getSnapshotClient(snapshot), getHttpPipeline(), getAccountUrl(), + getServiceVersion(), getAccountName(), getContainerName(), getBlobName(), snapshot, + getCustomerProvidedKey(), encryptionScope, getVersionId()); } /** @@ -122,7 +281,9 @@ public BlobClientBase getSnapshotClient(String snapshot) { * @return a {@link BlobClientBase} used to interact with the specific version. */ public BlobClientBase getVersionClient(String versionId) { - return new BlobClientBase(client.getVersionClient(versionId)); + return new BlobClientBase(this.client.getVersionClient(versionId), getHttpPipeline(), getAccountUrl(), + getServiceVersion(), getAccountName(), getContainerName(), getBlobName(), getSnapshotId(), + getCustomerProvidedKey(), encryptionScope, versionId); } /** @@ -132,7 +293,13 @@ public BlobClientBase getVersionClient(String versionId) { * @return a {@link BlobClientBase} with the specified {@code encryptionScope}. */ public BlobClientBase getEncryptionScopeClient(String encryptionScope) { - return new BlobClientBase(client.getEncryptionScopeAsyncClient(encryptionScope)); + EncryptionScope finalEncryptionScope = null; + if (encryptionScope != null) { + finalEncryptionScope = new EncryptionScope().setEncryptionScope(encryptionScope); + } + return new BlobClientBase(this.client.getEncryptionScopeAsyncClient(encryptionScope), getHttpPipeline(), + getAccountUrl(), getServiceVersion(), getAccountName(), getContainerName(), getBlobName(), snapshot, + getCustomerProvidedKey(), finalEncryptionScope, getVersionId()); } /** @@ -143,7 +310,16 @@ public BlobClientBase getEncryptionScopeClient(String encryptionScope) { * @return a {@link BlobClientBase} with the specified {@code customerProvidedKey}. */ public BlobClientBase getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey) { - return new BlobClientBase(client.getCustomerProvidedKeyAsyncClient(customerProvidedKey)); + CpkInfo finalCustomerProvidedKey = null; + if (customerProvidedKey != null) { + finalCustomerProvidedKey = new CpkInfo() + .setEncryptionKey(customerProvidedKey.getKey()) + .setEncryptionKeySha256(customerProvidedKey.getKeySha256()) + .setEncryptionAlgorithm(customerProvidedKey.getEncryptionAlgorithm()); + } + return new BlobClientBase(this.client.getCustomerProvidedKeyAsyncClient(customerProvidedKey), getHttpPipeline(), + getAccountUrl(), getServiceVersion(), getAccountName(), getContainerName(), getBlobName(), snapshot, + finalCustomerProvidedKey, encryptionScope, getVersionId()); } /** @@ -152,7 +328,7 @@ public BlobClientBase getCustomerProvidedKeyClient(CustomerProvidedKey customerP * @return the URL of the storage account */ public String getAccountUrl() { - return client.getAccountUrl(); + return azureBlobStorage.getUrl(); } /** @@ -161,7 +337,14 @@ public String getAccountUrl() { * @return the URL. */ public String getBlobUrl() { - return client.getBlobUrl(); + String blobUrl = azureBlobStorage.getUrl() + "/" + containerName + "/" + Utility.urlEncode(blobName); + if (this.isSnapshot()) { + blobUrl = Utility.appendQueryParameter(blobUrl, "snapshot", getSnapshotId()); + } + if (this.getVersionId() != null) { + blobUrl = Utility.appendQueryParameter(blobUrl, "versionid", getVersionId()); + } + return blobUrl; } /** @@ -170,7 +353,7 @@ public String getBlobUrl() { * @return account name associated with this storage resource. */ public String getAccountName() { - return client.getAccountName(); + return this.accountName; } /** @@ -188,7 +371,7 @@ public String getAccountName() { * @return The name of the container. */ public final String getContainerName() { - return client.getContainerName(); + return this.containerName; } /** @@ -206,7 +389,15 @@ public final String getContainerName() { * @return {@link BlobContainerClient} */ public BlobContainerClient getContainerClient() { - return client.getContainerClientBuilder().buildClient(); + CustomerProvidedKey encryptionKey = this.customerProvidedKey == null ? null + : new CustomerProvidedKey(this.customerProvidedKey.getEncryptionKey()); + return new BlobContainerClientBuilder() + .endpoint(this.getBlobUrl()) + .pipeline(this.getHttpPipeline()) + .serviceVersion(this.serviceVersion) + .customerProvidedKey(encryptionKey) + .encryptionScope(this.getEncryptionScope()).buildClient(); + //return client.getContainerClientBuilder().buildClient(); } /** @@ -224,7 +415,7 @@ public BlobContainerClient getContainerClient() { * @return The decoded name of the blob. */ public final String getBlobName() { - return client.getBlobName(); + return this.blobName; } /** @@ -233,7 +424,7 @@ public final String getBlobName() { * @return The pipeline. */ public HttpPipeline getHttpPipeline() { - return client.getHttpPipeline(); + return azureBlobStorage.getHttpPipeline(); } /** @@ -242,7 +433,7 @@ public HttpPipeline getHttpPipeline() { * @return the customer provided key used for encryption. */ public CpkInfo getCustomerProvidedKey() { - return client.getCustomerProvidedKey(); + return this.customerProvidedKey; } /** @@ -251,7 +442,11 @@ public CpkInfo getCustomerProvidedKey() { * @return the encryption scope used for encryption. */ public String getEncryptionScope() { - return client.getEncryptionScope(); + if (encryptionScope == null) { + return null; + } + return encryptionScope.getEncryptionScope(); + //return client.getEncryptionScope(); } /** @@ -260,7 +455,7 @@ public String getEncryptionScope() { * @return the service version the client is using. */ public BlobServiceVersion getServiceVersion() { - return client.getServiceVersion(); + return this.serviceVersion; } /** @@ -269,7 +464,7 @@ public BlobServiceVersion getServiceVersion() { * @return A string that represents the snapshotId of the snapshot blob */ public String getSnapshotId() { - return client.getSnapshotId(); + return this.snapshot; } /** @@ -278,7 +473,7 @@ public String getSnapshotId() { * @return A string that represents the versionId of the snapshot blob */ public String getVersionId() { - return client.getVersionId(); + return this.versionId; } /** @@ -287,7 +482,7 @@ public String getVersionId() { * @return A boolean that indicates if a blob is a snapshot */ public boolean isSnapshot() { - return client.isSnapshot(); + return this.snapshot != null; } /** @@ -497,9 +692,26 @@ public Boolean exists() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response existsWithResponse(Duration timeout, Context context) { - Mono> response = client.existsWithResponse(context); - - return blockWithOptionalTimeout(response, timeout); + try { + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( + () -> this.azureBlobStorage.getBlobs().getPropertiesNoCustomHeadersWithResponse(containerName, blobName, + snapshot, versionId, null, null, null, null, null, null, null, null, customerProvidedKey, context)); + return new SimpleResponse<>(sendRequest(operation, timeout, BlobStorageException.class), true); + } catch (RuntimeException e) { + if (e instanceof HttpResponseException) { + HttpResponse response = ((HttpResponseException) e).getResponse(); + if (e instanceof BlobStorageException + && BlobErrorCode.BLOB_USES_CUSTOMER_SPECIFIED_ENCRYPTION.equals(((BlobStorageException) e).getErrorCode())) { + return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), true); + } else if (ModelHelper.checkBlobDoesNotExistStatusCode(e)) { + return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), false); + } else { + throw LOGGER.logExceptionAsError(e); + } + } else { + throw LOGGER.logExceptionAsError(e); + } + } } /** @@ -624,7 +836,99 @@ public SyncPoller beginCopy(String sourceUrl, Map beginCopy(BlobBeginCopyOptions options) { - return client.beginCopy(options).getSyncPoller(); + StorageImplUtils.assertNotNull("options", options); + final AtomicReference copyId = new AtomicReference<>(); + final Duration interval = options.getPollInterval() != null ? options.getPollInterval() : Duration.ofSeconds(1); + final BlobBeginCopySourceRequestConditions sourceModifiedConditions = + options.getSourceRequestConditions() == null + ? new BlobBeginCopySourceRequestConditions() + : options.getSourceRequestConditions(); + final BlobRequestConditions destinationRequestConditions = + options.getDestinationRequestConditions() == null + ? new BlobRequestConditions() + : options.getDestinationRequestConditions(); + final BlobImmutabilityPolicy immutabilityPolicy = options.getImmutabilityPolicy() == null + ? new BlobImmutabilityPolicy() : options.getImmutabilityPolicy(); + + Function, PollResponse> syncActivationOperation = (pollingContext) -> { + try { + new URL(options.getSourceUrl()); + } catch (MalformedURLException ex) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("'sourceUrl' is not a valid url.", ex)); + } + ResponseBase response = + wrapServiceCallWithExceptionMapping(() -> azureBlobStorage.getBlobs().startCopyFromURLWithResponse( + containerName, blobName, options.getSourceUrl(), null, options.getMetadata(), options.getTier(), + options.getRehydratePriority(), sourceModifiedConditions.getIfModifiedSince(), + sourceModifiedConditions.getIfUnmodifiedSince(), sourceModifiedConditions.getIfMatch(), + sourceModifiedConditions.getIfNoneMatch(), sourceModifiedConditions.getTagsConditions(), + destinationRequestConditions.getIfModifiedSince(), + destinationRequestConditions.getIfUnmodifiedSince(), destinationRequestConditions.getIfMatch(), + destinationRequestConditions.getIfNoneMatch(), destinationRequestConditions.getTagsConditions(), + destinationRequestConditions.getLeaseId(), null, ModelHelper.tagsToString(options.getTags()), + options.isSealDestination(), immutabilityPolicy.getExpiryTime(), + immutabilityPolicy.getPolicyMode(), options.isLegalHold(), Context.NONE)); + + BlobsStartCopyFromURLHeaders headers = response.getDeserializedHeaders(); + copyId.set(headers.getXMsCopyId()); + + return new PollResponse<>( + LongRunningOperationStatus.IN_PROGRESS, + new BlobCopyInfo(options.getSourceUrl(), headers.getXMsCopyId(), headers.getXMsCopyStatus(), + headers.getETag(), headers.getLastModified(), ModelHelper.getErrorCode(response.getHeaders()), + headers.getXMsVersionId()) + ); + }; + + Function, PollResponse> pollOperation = (pollingContext) -> + onPoll(pollingContext.getLatestResponse(), destinationRequestConditions); + + BiFunction, PollResponse, BlobCopyInfo> cancelOperation = + (pollingContext, firstResponse) -> { + if (firstResponse == null || firstResponse.getValue() == null) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Cannot cancel a poll response that never started.")); + } + final String copyIdentifier = firstResponse.getValue().getCopyId(); + if (!CoreUtils.isNullOrEmpty(copyIdentifier)) { + LOGGER.info("Cancelling copy operation for copy id: {}", copyIdentifier); + abortCopyFromUrl(copyIdentifier); + return firstResponse.getValue(); + } + return null; + }; + + Function, Void> fetchResultOperation = (pollingContext) -> null; + return SyncPoller.createPoller(interval, syncActivationOperation, pollOperation, cancelOperation, + fetchResultOperation); + } + + + private PollResponse onPoll(PollResponse pollResponse, + BlobRequestConditions requestConditions) { + if (pollResponse.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED + || pollResponse.getStatus() == LongRunningOperationStatus.FAILED) { + return pollResponse; + } + + final BlobCopyInfo lastInfo = pollResponse.getValue(); + if (lastInfo == null) { + LOGGER.warning("BlobCopyInfo does not exist. Activation operation failed."); + return new PollResponse<>(LongRunningOperationStatus.fromString("COPY_START_FAILED", true), null); + } + + try { + Response response = getPropertiesWithResponse(requestConditions, null, null); + BlobProperties value = response.getValue(); + final CopyStatusType status = value.getCopyStatus(); + final BlobCopyInfo result = new BlobCopyInfo(value.getCopySource(), value.getCopyId(), status, + value.getETag(), value.getCopyCompletionTime(), value.getCopyStatusDescription(), value.getVersionId()); + + LongRunningOperationStatus operationStatus = ModelHelper.mapStatusToLongRunningOperationStatus(status); + return new PollResponse<>(operationStatus, result); + } catch (RuntimeException e) { + return new PollResponse<>(LongRunningOperationStatus.fromString("POLLING_FAILED", true), lastInfo); + } } @@ -675,8 +979,13 @@ public void abortCopyFromUrl(String copyId) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response abortCopyFromUrlWithResponse(String copyId, String leaseId, Duration timeout, - Context context) { - return blockWithOptionalTimeout(client.abortCopyFromUrlWithResponse(copyId, leaseId, context), timeout); + Context context) { + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getBlobs().abortCopyFromURLNoCustomHeadersWithResponse(containerName, blobName, + copyId, null, leaseId, null, finalContext)); + + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -789,10 +1098,36 @@ public Response copyFromUrlWithResponse(String copySource, Map copyFromUrlWithResponse(BlobCopyFromUrlOptions options, Duration timeout, Context context) { - Mono> response = client - .copyFromUrlWithResponse(options, context); + StorageImplUtils.assertNotNull("options", options); + RequestConditions sourceModifiedRequestConditions = options.getSourceRequestConditions() == null + ? new RequestConditions() : options.getSourceRequestConditions(); + BlobRequestConditions destRequestConditions = options.getDestinationRequestConditions() == null + ? new BlobRequestConditions() : options.getDestinationRequestConditions(); + BlobImmutabilityPolicy immutabilityPolicy = options.getImmutabilityPolicy() == null + ? new BlobImmutabilityPolicy() : options.getImmutabilityPolicy(); + + try { + new URL(options.getCopySource()); + } catch (MalformedURLException ex) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("'copySource' is not a valid url.", ex)); + } + String sourceAuth = options.getSourceAuthorization() == null + ? null : options.getSourceAuthorization().toString(); + + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( + () -> this.azureBlobStorage.getBlobs().copyFromURLWithResponse(containerName, blobName, + options.getCopySource(), null, options.getMetadata(), options.getTier(), + sourceModifiedRequestConditions.getIfModifiedSince(), + sourceModifiedRequestConditions.getIfUnmodifiedSince(), sourceModifiedRequestConditions.getIfMatch(), + sourceModifiedRequestConditions.getIfNoneMatch(), destRequestConditions.getIfModifiedSince(), + destRequestConditions.getIfUnmodifiedSince(), destRequestConditions.getIfMatch(), + destRequestConditions.getIfNoneMatch(), destRequestConditions.getTagsConditions(), + destRequestConditions.getLeaseId(), null, null, ModelHelper.tagsToString(options.getTags()), + immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), options.hasLegalHold(), + sourceAuth, options.getCopySourceTagsMode(), this.encryptionScope, context)); - return blockWithOptionalTimeout(response, timeout); + ResponseBase response = sendRequest(operation, timeout, BlobStorageException.class); + return new SimpleResponse<>(response, response.getDeserializedHeaders().getXMsCopyId()); } /** @@ -1313,10 +1648,16 @@ public void delete() { @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, BlobRequestConditions requestConditions, Duration timeout, Context context) { - Mono> response = client - .deleteWithResponse(deleteBlobSnapshotOptions, requestConditions, context); + Context finalContext = context == null ? Context.NONE : context; + BlobRequestConditions finalRequestConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + azureBlobStorage.getBlobs().deleteNoCustomHeadersWithResponse(containerName, blobName, snapshot, versionId, + null, finalRequestConditions.getLeaseId(), deleteBlobSnapshotOptions, + finalRequestConditions.getIfModifiedSince(), finalRequestConditions.getIfUnmodifiedSince(), + finalRequestConditions.getIfMatch(), finalRequestConditions.getIfNoneMatch(), + finalRequestConditions.getTagsConditions(), null, null, finalContext)); - return blockWithOptionalTimeout(response, timeout); + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -1376,8 +1717,19 @@ public boolean deleteIfExists() { @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteIfExistsWithResponse(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, BlobRequestConditions requestConditions, Duration timeout, Context context) { - return blockWithOptionalTimeout(client.deleteIfExistsWithResponse(deleteBlobSnapshotOptions, - requestConditions, context), timeout); + try { + Response response = this.deleteWithResponse(deleteBlobSnapshotOptions, requestConditions, timeout, + context); + return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), true); + } catch (RuntimeException e) { + if (ModelHelper.checkBlobDoesNotExistStatusCode(e) && e instanceof HttpResponseException) { + HttpResponse response = ((HttpResponseException) e).getResponse(); + return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), + false); + } else { + throw LOGGER.logExceptionAsError(e); + } + } } /** @@ -1428,9 +1780,19 @@ public BlobProperties getProperties() { @ServiceMethod(returns = ReturnType.SINGLE) public Response getPropertiesWithResponse(BlobRequestConditions requestConditions, Duration timeout, Context context) { - Mono> response = client.getPropertiesWithResponse(requestConditions, context); - - return blockWithOptionalTimeout(response, timeout); + BlobRequestConditions finalRequestConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( + () -> + this.azureBlobStorage.getBlobs().getPropertiesWithResponse(containerName, blobName, snapshot, versionId, + null, finalRequestConditions.getLeaseId(), finalRequestConditions.getIfModifiedSince(), + finalRequestConditions.getIfUnmodifiedSince(), finalRequestConditions.getIfMatch(), + finalRequestConditions.getIfNoneMatch(), finalRequestConditions.getTagsConditions(), null, + customerProvidedKey, finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + return new SimpleResponse<>(response, BlobPropertiesConstructorProxy + .create(new BlobPropertiesInternalGetProperties(response.getDeserializedHeaders()))); } /** @@ -1488,10 +1850,18 @@ public void setHttpHeaders(BlobHttpHeaders headers) { @ServiceMethod(returns = ReturnType.SINGLE) public Response setHttpHeadersWithResponse(BlobHttpHeaders headers, BlobRequestConditions requestConditions, Duration timeout, Context context) { - Mono> response = client - .setHttpHeadersWithResponse(headers, requestConditions, context); + BlobRequestConditions finalRequestConditions = requestConditions == null ? new BlobRequestConditions() + : requestConditions; + Context finalContext = context == null ? Context.NONE : context; + + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getBlobs().setHttpHeadersNoCustomHeadersWithResponse(containerName, blobName, null, + finalRequestConditions.getLeaseId(), finalRequestConditions.getIfModifiedSince(), + finalRequestConditions.getIfUnmodifiedSince(), finalRequestConditions.getIfMatch(), + finalRequestConditions.getIfNoneMatch(), finalRequestConditions.getTagsConditions(), null, headers, + finalContext)); - return blockWithOptionalTimeout(response, timeout); + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -1547,9 +1917,18 @@ public void setMetadata(Map metadata) { @ServiceMethod(returns = ReturnType.SINGLE) public Response setMetadataWithResponse(Map metadata, BlobRequestConditions requestConditions, Duration timeout, Context context) { - Mono> response = client.setMetadataWithResponse(metadata, requestConditions, context); + BlobRequestConditions finalRequestConditions = requestConditions == null ? new BlobRequestConditions() + : requestConditions; + Context finalContext = context == null ? Context.NONE : context; - return blockWithOptionalTimeout(response, timeout); + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getBlobs().setMetadataNoCustomHeadersWithResponse(containerName, blobName, null, + metadata, finalRequestConditions.getLeaseId(), finalRequestConditions.getIfModifiedSince(), + finalRequestConditions.getIfUnmodifiedSince(), finalRequestConditions.getIfMatch(), + finalRequestConditions.getIfNoneMatch(), finalRequestConditions.getTagsConditions(), null, + customerProvidedKey, encryptionScope, finalContext)); + + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -1598,9 +1977,22 @@ public Map getTags() { @ServiceMethod(returns = ReturnType.SINGLE) public Response> getTagsWithResponse(BlobGetTagsOptions options, Duration timeout, Context context) { - Mono>> response = client.getTagsWithResponse(options, context); - - return blockWithOptionalTimeout(response, timeout); + BlobGetTagsOptions finalTagOptions = (options == null) ? new BlobGetTagsOptions() : options; + BlobRequestConditions requestConditions = (finalTagOptions.getRequestConditions() == null) + ? new BlobRequestConditions() : finalTagOptions.getRequestConditions(); + Context finalContext = context == null ? Context.NONE : context; + + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( + () -> + this.azureBlobStorage.getBlobs().getTagsWithResponse(containerName, blobName, null, null, snapshot, + versionId, requestConditions.getTagsConditions(), requestConditions.getLeaseId(), finalContext)); + + ResponseBase response = sendRequest(operation, timeout, BlobStorageException.class); + Map tags = new HashMap<>(); + for (BlobTag tag : response.getValue().getBlobTagSet()) { + tags.put(tag.getKey(), tag.getValue()); + } + return new SimpleResponse<>(response, tags); } /** @@ -1651,9 +2043,23 @@ public void setTags(Map tags) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response setTagsWithResponse(BlobSetTagsOptions options, Duration timeout, Context context) { - Mono> response = client.setTagsWithResponse(options, context); - - return blockWithOptionalTimeout(response, timeout); + StorageImplUtils.assertNotNull("options", options); + Context finalContext = context == null ? Context.NONE : context; + BlobRequestConditions requestConditions = (options.getRequestConditions() == null) + ? new BlobRequestConditions() : options.getRequestConditions(); + List tagList = null; + if (options.getTags() != null) { + tagList = new ArrayList<>(); + for (Map.Entry entry : options.getTags().entrySet()) { + tagList.add(new BlobTag().setKey(entry.getKey()).setValue(entry.getValue())); + } + } + BlobTags t = new BlobTags().setBlobTagSet(tagList); + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getBlobs().setTagsNoCustomHeadersWithResponse(containerName, blobName, null, + versionId, null, null, null, requestConditions.getTagsConditions(), requestConditions.getLeaseId(), t, + finalContext)); + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -1709,11 +2115,18 @@ public BlobClientBase createSnapshot() { @ServiceMethod(returns = ReturnType.SINGLE) public Response createSnapshotWithResponse(Map metadata, BlobRequestConditions requestConditions, Duration timeout, Context context) { - Mono> response = client - .createSnapshotWithResponse(metadata, requestConditions, context) - .map(rb -> new SimpleResponse<>(rb, new BlobClientBase(rb.getValue()))); + Context finalContext = context == null ? Context.NONE : context; + BlobRequestConditions finalRequestConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; + + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( + () -> this.azureBlobStorage.getBlobs().createSnapshotWithResponse(containerName, blobName, null, metadata, + finalRequestConditions.getIfModifiedSince(), finalRequestConditions.getIfUnmodifiedSince(), + finalRequestConditions.getIfMatch(), finalRequestConditions.getIfNoneMatch(), + finalRequestConditions.getTagsConditions(), finalRequestConditions.getLeaseId(), null, + customerProvidedKey, encryptionScope, finalContext)); - return blockWithOptionalTimeout(response, timeout); + ResponseBase response = sendRequest(operation, timeout, BlobStorageException.class); + return new SimpleResponse<>(response, this.getSnapshotClient(response.getDeserializedHeaders().getXMsSnapshot())); } /** @@ -1804,7 +2217,14 @@ public Response setAccessTierWithResponse(AccessTier tier, RehydratePriori @ServiceMethod(returns = ReturnType.SINGLE) public Response setAccessTierWithResponse(BlobSetAccessTierOptions options, Duration timeout, Context context) { - return blockWithOptionalTimeout(client.setTierWithResponse(options, context), timeout); + StorageImplUtils.assertNotNull("options", options); + Context finalContext = context == null ? Context.NONE : context; + + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getBlobs().setTierNoCustomHeadersWithResponse(containerName, blobName, + options.getTier(), snapshot, versionId, null, options.getPriority(), null, options.getLeaseId(), + options.getTagsConditions(), finalContext)); + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -1848,9 +2268,11 @@ public void undelete() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response undeleteWithResponse(Duration timeout, Context context) { - Mono> response = client.undeleteWithResponse(context); - - return blockWithOptionalTimeout(response, timeout); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getBlobs().undeleteNoCustomHeadersWithResponse(containerName, blobName, null, null, + finalContext)); + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -1896,9 +2318,14 @@ public StorageAccountInfo getAccountInfo() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getAccountInfoWithResponse(Duration timeout, Context context) { - Mono> response = client.getAccountInfoWithResponse(context); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( + () -> this.azureBlobStorage.getBlobs().getAccountInfoWithResponse(containerName, blobName, finalContext)); - return blockWithOptionalTimeout(response, timeout); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + BlobsGetAccountInfoHeaders hd = response.getDeserializedHeaders(); + return new SimpleResponse<>(response, new StorageAccountInfo(hd.getXMsSkuName(), hd.getXMsAccountKind())); } /** @@ -1927,7 +2354,8 @@ public Response getAccountInfoWithResponse(Duration timeout, */ public String generateUserDelegationSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues, UserDelegationKey userDelegationKey) { - return this.client.generateUserDelegationSas(blobServiceSasSignatureValues, userDelegationKey); + return generateUserDelegationSas(blobServiceSasSignatureValues, userDelegationKey, getAccountName(), + Context.NONE); } /** @@ -1978,8 +2406,9 @@ public String generateUserDelegationSas(BlobServiceSasSignatureValues blobServic */ public String generateUserDelegationSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues, UserDelegationKey userDelegationKey, String accountName, Consumer stringToSignHandler, Context context) { - return this.client.generateUserDelegationSas(blobServiceSasSignatureValues, userDelegationKey, accountName, - stringToSignHandler, context); + return new BlobSasImplUtil(blobServiceSasSignatureValues, getContainerName(), getBlobName(), + getSnapshotId(), getVersionId(), getEncryptionScope()) + .generateUserDelegationSas(userDelegationKey, accountName, stringToSignHandler, context); } /** @@ -2006,7 +2435,7 @@ public String generateUserDelegationSas(BlobServiceSasSignatureValues blobServic * @return A {@code String} representing the SAS query parameters. */ public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues) { - return this.client.generateSas(blobServiceSasSignatureValues); + return generateSas(blobServiceSasSignatureValues, Context.NONE); } /** @@ -2052,7 +2481,9 @@ public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureV */ public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues, Consumer stringToSignHandler, Context context) { - return this.client.generateSas(blobServiceSasSignatureValues, stringToSignHandler, context); + return new BlobSasImplUtil(blobServiceSasSignatureValues, getContainerName(), getBlobName(), + getSnapshotId(), getVersionId(), getEncryptionScope()) + .generateSas(SasImplUtils.extractSharedKeyCredential(getHttpPipeline()), stringToSignHandler, context); } /** @@ -2121,16 +2552,34 @@ public InputStream openQueryInputStream(String expression) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response openQueryInputStreamWithResponse(BlobQueryOptions queryOptions) { - - // Data to subscribe to and read from. - BlobQueryAsyncResponse response = client.queryWithResponse(queryOptions).block(); - - // Create input stream from the data. - if (response == null) { - throw LOGGER.logExceptionAsError(new IllegalStateException("Query response cannot be null")); + StorageImplUtils.assertNotNull("options", queryOptions); + BlobRequestConditions requestConditions = queryOptions.getRequestConditions() == null + ? new BlobRequestConditions() : queryOptions.getRequestConditions(); + QuerySerialization in = BlobQueryReader.transformInputSerialization(queryOptions.getInputSerialization(), + LOGGER); + QuerySerialization out = BlobQueryReader.transformOutputSerialization(queryOptions.getOutputSerialization(), + LOGGER); + + QueryRequest qr = new QueryRequest() + .setExpression(queryOptions.getExpression()) + .setInputSerialization(in) + .setOutputSerialization(out); + + ResponseBase response = wrapServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getBlobs().queryWithResponse(containerName, blobName, getSnapshotId(), null, + requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), + requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), + requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, qr, + getCustomerProvidedKey(), Context.NONE)); + InputStream avroInputStream = response.getValue(); + BlobQueryReader reader = new BlobQueryReader(null, queryOptions.getProgressConsumer(), + queryOptions.getErrorConsumer()); + try { + InputStream resultStream = reader.readInputStream(avroInputStream); + return new SimpleResponse<>(response, resultStream); + } catch (IOException e) { + throw LOGGER.logExceptionAsError(new UncheckedIOException(e)); } - return new ResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), - new FluxInputStream(response.getValue()), response.getDeserializedHeaders()); } /** @@ -2207,12 +2656,49 @@ public void query(OutputStream stream, String expression) { public BlobQueryResponse queryWithResponse(BlobQueryOptions queryOptions, Duration timeout, Context context) { StorageImplUtils.assertNotNull("options", queryOptions); StorageImplUtils.assertNotNull("outputStream", queryOptions.getOutputStream()); - Mono download = client - .queryWithResponse(queryOptions, context) - .flatMap(response -> FluxUtil.writeToOutputStream(response.getValue(), queryOptions.getOutputStream()) - .thenReturn(new BlobQueryResponse(response))); - - return blockWithOptionalTimeout(download, timeout); + Context finalContext = context == null ? Context.NONE : context; + BlobRequestConditions requestConditions = queryOptions.getRequestConditions() == null + ? new BlobRequestConditions() : queryOptions.getRequestConditions(); + QuerySerialization in = BlobQueryReader.transformInputSerialization(queryOptions.getInputSerialization(), + LOGGER); + QuerySerialization out = BlobQueryReader.transformOutputSerialization(queryOptions.getOutputSerialization(), + LOGGER); + + QueryRequest qr = new QueryRequest() + .setExpression(queryOptions.getExpression()) + .setInputSerialization(in) + .setOutputSerialization(out); + + Callable> operation = () -> { + ResponseBase response = wrapServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getBlobs().queryWithResponse(containerName, blobName, getSnapshotId(), null, + requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), + requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), + requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, qr, + getCustomerProvidedKey(), finalContext)); + + InputStream avroInputStream = response.getValue(); + BlobQueryReader reader = new BlobQueryReader(null, queryOptions.getProgressConsumer(), + queryOptions.getErrorConsumer()); + InputStream resultStream = reader.readInputStream(avroInputStream); + OutputStream outputStream = queryOptions.getOutputStream(); + byte[] buffer = new byte[4096]; + int bytesRead; + while ((bytesRead = resultStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + + return response; + }; + + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + + BlobQueryAsyncResponse asyncResponse = new BlobQueryAsyncResponse(response.getRequest(), + response.getStatusCode(), response.getHeaders(), null, + ModelHelper.transformQueryHeaders(response.getDeserializedHeaders(), response.getHeaders())); + + return new BlobQueryResponse(asyncResponse); } /** @@ -2269,10 +2755,37 @@ public BlobImmutabilityPolicy setImmutabilityPolicy(BlobImmutabilityPolicy immut @ServiceMethod(returns = ReturnType.SINGLE) public Response setImmutabilityPolicyWithResponse(BlobImmutabilityPolicy immutabilityPolicy, BlobRequestConditions requestConditions, Duration timeout, Context context) { - Mono> response = client.setImmutabilityPolicyWithResponse(immutabilityPolicy, - requestConditions, context); + Context finalContext = context == null ? Context.NONE : context; + BlobImmutabilityPolicy finalImmutabilityPolicy = immutabilityPolicy == null ? new BlobImmutabilityPolicy() + : immutabilityPolicy; + if (BlobImmutabilityPolicyMode.MUTABLE.equals(finalImmutabilityPolicy.getPolicyMode())) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("immutabilityPolicy.policyMode must be %s or %s", + BlobImmutabilityPolicyMode.LOCKED.toString(), BlobImmutabilityPolicyMode.UNLOCKED.toString()))); + } - return blockWithOptionalTimeout(response, timeout); + BlobRequestConditions finalRequestConditions = requestConditions == null + ? new BlobRequestConditions() : requestConditions; + + ModelHelper.validateConditionsNotPresent(finalRequestConditions, + EnumSet.of(BlobRequestConditionProperty.LEASE_ID, BlobRequestConditionProperty.TAGS_CONDITIONS, + BlobRequestConditionProperty.IF_MATCH, BlobRequestConditionProperty.IF_NONE_MATCH, + BlobRequestConditionProperty.IF_MODIFIED_SINCE), "setImmutabilityPolicy(WithResponse)", + "requestConditions"); + + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getBlobs().setImmutabilityPolicyWithResponse(containerName, blobName, null, null, + finalRequestConditions.getIfUnmodifiedSince(), finalImmutabilityPolicy.getExpiryTime(), + finalImmutabilityPolicy.getPolicyMode(), finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + + BlobsSetImmutabilityPolicyHeaders headers = response.getDeserializedHeaders(); + BlobImmutabilityPolicy responsePolicy = new BlobImmutabilityPolicy() + .setPolicyMode(headers.getXMsImmutabilityPolicyMode()) + .setExpiryTime(headers.getXMsImmutabilityPolicyUntilDate()); + return new SimpleResponse<>(response, responsePolicy); } /** @@ -2315,9 +2828,11 @@ public void deleteImmutabilityPolicy() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteImmutabilityPolicyWithResponse(Duration timeout, Context context) { - Mono> response = client.deleteImmutabilityPolicyWithResponse(context); - - return blockWithOptionalTimeout(response, timeout); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getBlobs().deleteImmutabilityPolicyNoCustomHeadersWithResponse(containerName, + blobName, null, null, finalContext)); + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -2362,8 +2877,14 @@ public BlobLegalHoldResult setLegalHold(boolean legalHold) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response setLegalHoldWithResponse(boolean legalHold, Duration timeout, Context context) { - Mono> response = client.setLegalHoldWithResponse(legalHold, context); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( + () -> this.azureBlobStorage.getBlobs().setLegalHoldWithResponse(containerName, blobName, legalHold, null, + null, finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + return new SimpleResponse<>(response, + new InternalBlobLegalHoldResult(response.getDeserializedHeaders().isXMsLegalHold())); - return blockWithOptionalTimeout(response, timeout); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobLeaseClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobLeaseClient.java index 855fc1e82e021..a623a848018a6 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobLeaseClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobLeaseClient.java @@ -6,12 +6,27 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.HttpPipeline; import com.azure.core.http.RequestConditions; import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.ResponseBase; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.storage.blob.BlobClient; import com.azure.storage.blob.BlobContainerClient; +import com.azure.storage.blob.implementation.AzureBlobStorageImpl; +import com.azure.storage.blob.implementation.AzureBlobStorageImplBuilder; +import com.azure.storage.blob.implementation.models.BlobsAcquireLeaseHeaders; +import com.azure.storage.blob.implementation.models.BlobsBreakLeaseHeaders; +import com.azure.storage.blob.implementation.models.BlobsChangeLeaseHeaders; +import com.azure.storage.blob.implementation.models.BlobsRenewLeaseHeaders; +import com.azure.storage.blob.implementation.models.ContainersAcquireLeaseHeaders; +import com.azure.storage.blob.implementation.models.ContainersBreakLeaseHeaders; +import com.azure.storage.blob.implementation.models.ContainersChangeLeaseHeaders; +import com.azure.storage.blob.implementation.models.ContainersRenewLeaseHeaders; import com.azure.storage.blob.implementation.util.ModelHelper; +import com.azure.storage.blob.models.BlobLeaseRequestConditions; +import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.options.BlobAcquireLeaseOptions; import com.azure.storage.blob.options.BlobBreakLeaseOptions; import com.azure.storage.blob.options.BlobChangeLeaseOptions; @@ -21,6 +36,10 @@ import java.net.URL; import java.time.Duration; +import java.util.concurrent.Callable; + +import static com.azure.storage.blob.implementation.util.ModelHelper.wrapTimeoutServiceCallWithExceptionMapping; +import static com.azure.storage.common.implementation.StorageImplUtils.sendRequest; /** * This class provides a client that contains all the leasing operations for {@link BlobContainerClient containers} and @@ -54,10 +73,26 @@ */ @ServiceClient(builder = BlobLeaseClientBuilder.class) public final class BlobLeaseClient { - private final BlobLeaseAsyncClient client; + private final String containerName; + private final String blobName; + private final boolean isBlob; + private final AzureBlobStorageImpl client; + private final String accountName; + + private volatile String leaseId; - BlobLeaseClient(BlobLeaseAsyncClient client) { - this.client = client; + BlobLeaseClient(HttpPipeline pipeline, String url, String containerName, String blobName, String leaseId, + boolean isBlob, String accountName, String serviceVersion) { + this.isBlob = isBlob; + this.leaseId = leaseId; + this.client = new AzureBlobStorageImplBuilder() + .pipeline(pipeline) + .url(url) + .version(serviceVersion) + .buildClient(); + this.accountName = accountName; + this.containerName = containerName; + this.blobName = blobName; } /** @@ -68,7 +103,11 @@ public final class BlobLeaseClient { * @return URL of the lease client. */ public String getResourceUrl() { - return client.getResourceUrl(); + if (this.isBlob) { + return this.client.getUrl() + "/" + containerName + "/" + blobName; + } else { + return this.client.getUrl() + "/" + containerName; + } } /** @@ -77,7 +116,7 @@ public String getResourceUrl() { * @return the lease ID. */ public String getLeaseId() { - return client.getLeaseId(); + return leaseId; } /** @@ -161,8 +200,33 @@ public Response acquireLeaseWithResponse(int durationInSeconds, RequestC @ServiceMethod(returns = ReturnType.SINGLE) public Response acquireLeaseWithResponse(BlobAcquireLeaseOptions options, Duration timeout, Context context) { - return StorageImplUtils.blockWithOptionalTimeout(this.client.acquireLeaseWithResponse(options, context), - timeout); + StorageImplUtils.assertNotNull("options", options); + BlobLeaseRequestConditions requestConditions = (options.getRequestConditions() == null) + ? new BlobLeaseRequestConditions() : options.getRequestConditions(); + Context finalContext = context == null ? Context.NONE : context; + + if (this.isBlob) { + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.client.getBlobs().acquireLeaseWithResponse(containerName, blobName, null, + options.getDuration(), this.leaseId, requestConditions.getIfModifiedSince(), + requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), + requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + this.leaseId = response.getDeserializedHeaders().getXMsLeaseId(); + return new SimpleResponse<>(response, response.getDeserializedHeaders().getXMsLeaseId()); + } else { + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.client.getContainers().acquireLeaseWithResponse(containerName, null, options.getDuration(), + this.leaseId, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), + null, finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + this.leaseId = response.getDeserializedHeaders().getXMsLeaseId(); + return new SimpleResponse<>(response, response.getDeserializedHeaders().getXMsLeaseId()); + } } /** @@ -241,7 +305,27 @@ public Response renewLeaseWithResponse(RequestConditions modifiedRequest @ServiceMethod(returns = ReturnType.SINGLE) public Response renewLeaseWithResponse(BlobRenewLeaseOptions options, Duration timeout, Context context) { - return StorageImplUtils.blockWithOptionalTimeout(this.client.renewLeaseWithResponse(options, context), timeout); + BlobRenewLeaseOptions finalOptions = (options == null) ? new BlobRenewLeaseOptions() : options; + BlobLeaseRequestConditions requestConditions = (finalOptions.getRequestConditions() == null) + ? new BlobLeaseRequestConditions() : finalOptions.getRequestConditions(); + Context finalContext = context == null ? Context.NONE : context; + if (this.isBlob) { + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.client.getBlobs().renewLeaseWithResponse(containerName, blobName, this.leaseId, null, + requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), + requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), + requestConditions.getTagsConditions(), null, finalContext)); + ResponseBase response = sendRequest(operation, timeout, BlobStorageException.class); + return new SimpleResponse<>(response, response.getDeserializedHeaders().getXMsLeaseId()); + } else { + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.client.getContainers().renewLeaseWithResponse(containerName, this.leaseId, null, + requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), null, finalContext)); + ResponseBase response = sendRequest(operation, timeout, BlobStorageException.class); + return new SimpleResponse<>(response, response.getDeserializedHeaders().getXMsLeaseId()); + } } /** @@ -319,8 +403,23 @@ public Response releaseLeaseWithResponse(RequestConditions modifiedRequest @ServiceMethod(returns = ReturnType.SINGLE) public Response releaseLeaseWithResponse(BlobReleaseLeaseOptions options, Duration timeout, Context context) { - return StorageImplUtils.blockWithOptionalTimeout(this.client.releaseLeaseWithResponse(options, context), - timeout); + BlobReleaseLeaseOptions finalOptions = (options == null) ? new BlobReleaseLeaseOptions() : options; + BlobLeaseRequestConditions requestConditions = (finalOptions.getRequestConditions() == null) + ? new BlobLeaseRequestConditions() : finalOptions.getRequestConditions(); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation; + if (this.isBlob) { + operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.client.getBlobs().releaseLeaseNoCustomHeadersWithResponse(containerName, blobName, this.leaseId, + null, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), + requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), + requestConditions.getTagsConditions(), null, finalContext)); + } else { + operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.client.getContainers().releaseLeaseNoCustomHeadersWithResponse(containerName, this.leaseId, null, + requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), null, finalContext)); + } + return sendRequest(operation, timeout, BlobStorageException.class); } /** @@ -412,7 +511,30 @@ public Response breakLeaseWithResponse(Integer breakPeriodInSeconds, */ @ServiceMethod(returns = ReturnType.SINGLE) public Response breakLeaseWithResponse(BlobBreakLeaseOptions options, Duration timeout, Context context) { - return StorageImplUtils.blockWithOptionalTimeout(this.client.breakLeaseWithResponse(options, context), timeout); + BlobBreakLeaseOptions finalOptions = (options == null) ? new BlobBreakLeaseOptions() : options; + BlobLeaseRequestConditions requestConditions = (finalOptions.getRequestConditions() == null) + ? new BlobLeaseRequestConditions() : finalOptions.getRequestConditions(); + Context finalContext = context == null ? Context.NONE : context; + Integer breakPeriod = finalOptions.getBreakPeriod() == null ? null + : Math.toIntExact(finalOptions.getBreakPeriod().getSeconds()); + + if (this.isBlob) { + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.client.getBlobs().breakLeaseWithResponse(containerName, blobName, null, breakPeriod, + requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), + requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), + requestConditions.getTagsConditions(), null, finalContext)); + ResponseBase response = sendRequest(operation, timeout, BlobStorageException.class); + return new SimpleResponse<>(response, response.getDeserializedHeaders().getXMsLeaseTime()); + } else { + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> this.client.getContainers().breakLeaseWithResponse( + containerName, null, breakPeriod, requestConditions.getIfModifiedSince(), + requestConditions.getIfUnmodifiedSince(), null, finalContext)); + ResponseBase response = sendRequest(operation, timeout, BlobStorageException.class); + return new SimpleResponse<>(response, response.getDeserializedHeaders().getXMsLeaseTime()); + } } /** @@ -492,8 +614,32 @@ public Response changeLeaseWithResponse(String proposedId, */ @ServiceMethod(returns = ReturnType.SINGLE) public Response changeLeaseWithResponse(BlobChangeLeaseOptions options, Duration timeout, Context context) { - return StorageImplUtils.blockWithOptionalTimeout(this.client.changeLeaseWithResponse(options, context), - timeout); + StorageImplUtils.assertNotNull("options", options); + BlobLeaseRequestConditions requestConditions = (options.getRequestConditions() == null) + ? new BlobLeaseRequestConditions() : options.getRequestConditions(); + Context finalContext = context == null ? Context.NONE : context; + + if (this.isBlob) { + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping(() -> + this.client.getBlobs().changeLeaseWithResponse(containerName, blobName, this.leaseId, + options.getProposedId(), null, requestConditions.getIfModifiedSince(), + requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), + requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + this.leaseId = response.getDeserializedHeaders().getXMsLeaseId(); + return new SimpleResponse<>(response, response.getDeserializedHeaders().getXMsLeaseId()); + } else { + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.client.getContainers().changeLeaseWithResponse(containerName, this.leaseId, + options.getProposedId(), null, requestConditions.getIfModifiedSince(), + requestConditions.getIfUnmodifiedSince(), null, finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + this.leaseId = response.getDeserializedHeaders().getXMsLeaseId(); + return new SimpleResponse<>(response, response.getDeserializedHeaders().getXMsLeaseId()); + } } /** @@ -502,7 +648,7 @@ public Response changeLeaseWithResponse(BlobChangeLeaseOptions options, * @return account name associated with this storage resource. */ public String getAccountName() { - return client.getAccountName(); + return this.accountName; } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobLeaseClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobLeaseClientBuilder.java index 8d232a3d0d6ee..4a2c112a543ff 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobLeaseClientBuilder.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobLeaseClientBuilder.java @@ -86,7 +86,9 @@ public final class BlobLeaseClientBuilder { * @return a {@link BlobLeaseClient} based on the configurations in this builder. */ public BlobLeaseClient buildClient() { - return new BlobLeaseClient(buildAsyncClient()); + BlobServiceVersion version = (serviceVersion == null) ? BlobServiceVersion.getLatest() : serviceVersion; + return new BlobLeaseClient(pipeline, url, containerName, blobName, getLeaseId(), isBlob, accountName, + version.getVersion()); } /** @@ -96,7 +98,8 @@ public BlobLeaseClient buildClient() { */ public BlobLeaseAsyncClient buildAsyncClient() { BlobServiceVersion version = (serviceVersion == null) ? BlobServiceVersion.getLatest() : serviceVersion; - return new BlobLeaseAsyncClient(pipeline, url, containerName, blobName, getLeaseId(), isBlob, accountName, version.getVersion()); + return new BlobLeaseAsyncClient(pipeline, url, containerName, blobName, getLeaseId(), isBlob, accountName, + version.getVersion()); } /** 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 25e5a953c6670..83ff58ec3055e 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,6 +19,7 @@ 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; @@ -434,7 +435,7 @@ Mono> uploadWithResponse(BlockBlobSimpleUploadOptions op requestConditions.getLeaseId(), options.getTier(), requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, - tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), + ModelHelper.tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), options.isLegalHold(), null, options.getHeaders(), getCustomerProvidedKey(), encryptionScope, finalContext) .map(rb -> { @@ -586,7 +587,7 @@ Mono> uploadFromUrlWithResponse(BlobUploadFromUrlOptions sourceRequestConditions.getIfModifiedSince(), sourceRequestConditions.getIfUnmodifiedSince(), sourceRequestConditions.getIfMatch(), sourceRequestConditions.getIfNoneMatch(), sourceRequestConditions.getTagsConditions(), - null, options.getContentMd5(), tagsToString(options.getTags()), + null, options.getContentMd5(), ModelHelper.tagsToString(options.getTags()), options.isCopySourceBlobProperties(), sourceAuth, options.getCopySourceTagsMode(), options.getHeaders(), getCustomerProvidedKey(), encryptionScope, context) .map(rb -> { @@ -1150,7 +1151,7 @@ Mono> commitBlockListWithResponse(BlockBlobCommitBlockLi requestConditions.getLeaseId(), options.getTier(), requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, - tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), + ModelHelper.tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), options.isLegalHold(), options.getHeaders(), getCustomerProvidedKey(), encryptionScope, context) .map(rb -> { BlockBlobsCommitBlockListHeaders hd = rb.getDeserializedHeaders(); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobClient.java index 7b3bfbadcccb0..2bc2c3e51aaaa 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobClient.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; import com.azure.core.exception.UnexpectedLengthException; +import com.azure.core.http.HttpPipeline; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; @@ -14,6 +15,8 @@ import com.azure.storage.blob.BlobAsyncClient; import com.azure.storage.blob.BlobClient; import com.azure.storage.blob.BlobClientBuilder; +import com.azure.storage.blob.BlobServiceVersion; +import com.azure.storage.blob.implementation.models.EncryptionScope; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; @@ -72,25 +75,25 @@ public final class BlockBlobClient extends BlobClientBase { * @deprecated Use {@link #MAX_STAGE_BLOCK_BYTES_LONG}. */ @Deprecated - public static final int MAX_UPLOAD_BLOB_BYTES = BlockBlobAsyncClient.MAX_UPLOAD_BLOB_BYTES; + public static final int MAX_UPLOAD_BLOB_BYTES = 256 * Constants.MB; /** * Indicates the maximum number of bytes that can be sent in a call to upload. */ - public static final long MAX_UPLOAD_BLOB_BYTES_LONG = BlockBlobAsyncClient.MAX_UPLOAD_BLOB_BYTES_LONG; + public static final long MAX_UPLOAD_BLOB_BYTES_LONG = 5000L * Constants.MB; /** * Indicates the maximum number of bytes that can be sent in a call to stageBlock. * @deprecated Use {@link #MAX_STAGE_BLOCK_BYTES_LONG} */ @Deprecated - public static final int MAX_STAGE_BLOCK_BYTES = BlockBlobAsyncClient.MAX_STAGE_BLOCK_BYTES; + public static final int MAX_STAGE_BLOCK_BYTES = 100 * Constants.MB; /** * Indicates the maximum number of bytes that can be sent in a call to stageBlock. */ - public static final long MAX_STAGE_BLOCK_BYTES_LONG = BlockBlobAsyncClient.MAX_STAGE_BLOCK_BYTES_LONG; + public static final long MAX_STAGE_BLOCK_BYTES_LONG = 4000L * Constants.MB; /** * Indicates the maximum number of blocks allowed in a block blob. */ - public static final int MAX_BLOCKS = BlockBlobAsyncClient.MAX_BLOCKS; + public static final int MAX_BLOCKS = 50000; /** * Package-private constructor for use by {@link SpecializedBlobClientBuilder}. @@ -98,7 +101,32 @@ public final class BlockBlobClient extends BlobClientBase { * @param client the async block blob client */ BlockBlobClient(BlockBlobAsyncClient client) { - super(client); + this(client, client.getHttpPipeline(), client.getAccountUrl(), client.getServiceVersion(), client.getAccountName(), + client.getContainerName(), client.getBlobName(), client.getSnapshotId(), client.getCustomerProvidedKey(), + new EncryptionScope().setEncryptionScope(client.getEncryptionScope()), client.getVersionId()); + } + + /** + * Package-private constructor for use by {@link SpecializedBlobClientBuilder}. + * + * @param pipeline The pipeline used to send and receive service requests. + * @param url The endpoint where to send service requests. + * @param serviceVersion The version of the service to receive requests. + * @param accountName The storage account name. + * @param containerName The container name. + * @param blobName The blob name. + * @param snapshot The snapshot identifier for the blob, pass {@code null} to interact with the blob directly. + * @param customerProvidedKey Customer provided key used during encryption of the blob's data on the server, pass + * {@code null} to allow the service to use its own encryption. + * @param encryptionScope Encryption scope used during encryption of the blob's data on the server, pass + * {@code null} to allow the service to use its own encryption. + * @param versionId The version identifier for the blob, pass {@code null} to interact with the latest blob version. + */ + BlockBlobClient(BlockBlobAsyncClient client, HttpPipeline pipeline, String url, BlobServiceVersion serviceVersion, + String accountName, String containerName, String blobName, String snapshot, CpkInfo customerProvidedKey, + EncryptionScope encryptionScope, String versionId) { + super(client, pipeline, url, serviceVersion, accountName, containerName, blobName, snapshot, + customerProvidedKey, encryptionScope, versionId); this.client = client; } @@ -110,7 +138,13 @@ public final class BlockBlobClient extends BlobClientBase { */ @Override public BlockBlobClient getEncryptionScopeClient(String encryptionScope) { - return new BlockBlobClient(client.getEncryptionScopeAsyncClient(encryptionScope)); + EncryptionScope finalEncryptionScope = null; + if (encryptionScope != null) { + finalEncryptionScope = new EncryptionScope().setEncryptionScope(encryptionScope); + } + return new BlockBlobClient(client.getEncryptionScopeAsyncClient(encryptionScope), getHttpPipeline(), + getAccountUrl(), getServiceVersion(), getAccountName(), getContainerName(), getBlobName(), getSnapshotId(), + getCustomerProvidedKey(), finalEncryptionScope, getVersionId()); } /** @@ -122,7 +156,16 @@ public BlockBlobClient getEncryptionScopeClient(String encryptionScope) { */ @Override public BlockBlobClient getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey) { - return new BlockBlobClient(client.getCustomerProvidedKeyAsyncClient(customerProvidedKey)); + CpkInfo finalCustomerProvidedKey = null; + if (customerProvidedKey != null) { + finalCustomerProvidedKey = new CpkInfo() + .setEncryptionKey(customerProvidedKey.getKey()) + .setEncryptionKeySha256(customerProvidedKey.getKeySha256()) + .setEncryptionAlgorithm(customerProvidedKey.getEncryptionAlgorithm()); + } + return new BlockBlobClient(client.getCustomerProvidedKeyAsyncClient(customerProvidedKey), getHttpPipeline(), + getAccountUrl(), getServiceVersion(), getAccountName(), getContainerName(), getBlobName(), getSnapshotId(), + finalCustomerProvidedKey, encryptionScope, getVersionId()); } /** 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 dd92e87a943f4..4212a3311de6a 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 @@ -162,23 +162,6 @@ public PageBlobAsyncClient getCustomerProvidedKeyAsyncClient(CustomerProvidedKey getVersionId()); } - private static String pageRangeToString(PageRange pageRange) { - if (pageRange.getStart() < 0 || pageRange.getEnd() <= 0) { - throw new IllegalArgumentException("PageRange's start and end values must be greater than or equal to " - + "0 if specified."); - } - if (pageRange.getStart() % PAGE_BYTES != 0) { - throw new IllegalArgumentException("PageRange's start value must be a multiple of 512."); - } - if (pageRange.getEnd() % PAGE_BYTES != PAGE_BYTES - 1) { - throw new IllegalArgumentException("PageRange's end value must be 1 less than a multiple of 512."); - } - if (pageRange.getEnd() <= pageRange.getStart()) { - throw new IllegalArgumentException("PageRange's End value must be after the start."); - } - return "bytes=" + pageRange.getStart() + '-' + pageRange.getEnd(); - } - /** * Creates a page blob of the specified length. By default, this method will not overwrite an existing blob. * Call PutPage to upload data to a page blob. For more information, see the @@ -339,7 +322,7 @@ Mono> createWithResponse(PageBlobCreateOptions options, C options.getSize(), null, null, options.getMetadata(), requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), - options.getSequenceNumber(), null, tagsToString(options.getTags()), + options.getSequenceNumber(), null, ModelHelper.tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), immutabilityPolicy.getPolicyMode(), options.isLegalHold(), options.getHeaders(), getCustomerProvidedKey(), encryptionScope, context) .map(rb -> { @@ -529,7 +512,7 @@ Mono> uploadPagesWithResponse(PageRange pageRange, Flux> uploadPagesFromUrlWithResponse(PageBlobUploadPagesF throw LOGGER.logExceptionAsError(new IllegalArgumentException("range cannot be null.")); } - String rangeString = pageRangeToString(options.getRange()); + String rangeString = ModelHelper.pageRangeToString(options.getRange()); long sourceOffset = options.getSourceOffset() == null ? 0L : options.getSourceOffset(); - String sourceRangeString = pageRangeToString(new PageRange() + String sourceRangeString = ModelHelper.pageRangeToString(new PageRange() .setStart(sourceOffset) .setEnd(sourceOffset + (options.getRange().getEnd() - options.getRange().getStart()))); @@ -803,7 +786,7 @@ Mono> clearPagesWithResponse(PageRange pageRange, // subscription. throw LOGGER.logExceptionAsError(new IllegalArgumentException("pageRange cannot be null.")); } - String pageRangeStr = pageRangeToString(pageRange); + String pageRangeStr = ModelHelper.pageRangeToString(pageRange); context = context == null ? Context.NONE : context; return this.azureBlobStorage.getPageBlobs().clearPagesWithResponseAsync(containerName, blobName, 0, diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobClient.java index f9b041e44ecba..9b34468cfdc82 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobClient.java @@ -7,19 +7,42 @@ import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; import com.azure.core.exception.UnexpectedLengthException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpRange; +import com.azure.core.http.HttpResponse; import com.azure.core.http.RequestConditions; -import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.ResponseBase; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; +import com.azure.core.util.UrlBuilder; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.BlobServiceVersion; +import com.azure.storage.blob.implementation.models.EncryptionScope; +import com.azure.storage.blob.implementation.models.PageBlobsClearPagesHeaders; +import com.azure.storage.blob.implementation.models.PageBlobsCopyIncrementalHeaders; +import com.azure.storage.blob.implementation.models.PageBlobsCreateHeaders; +import com.azure.storage.blob.implementation.models.PageBlobsGetPageRangesDiffHeaders; +import com.azure.storage.blob.implementation.models.PageBlobsGetPageRangesHeaders; +import com.azure.storage.blob.implementation.models.PageBlobsResizeHeaders; +import com.azure.storage.blob.implementation.models.PageBlobsUpdateSequenceNumberHeaders; +import com.azure.storage.blob.implementation.models.PageListHelper; import com.azure.storage.blob.implementation.util.ModelHelper; +import com.azure.storage.blob.models.BlobErrorCode; import com.azure.storage.blob.models.BlobHttpHeaders; +import com.azure.storage.blob.models.BlobImmutabilityPolicy; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.BlobRequestConditions; import com.azure.storage.blob.models.BlobStorageException; +import com.azure.storage.blob.models.ClearRange; import com.azure.storage.blob.models.CopyStatusType; +import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.CustomerProvidedKey; +import com.azure.storage.blob.models.PageBlobCopyIncrementalRequestConditions; import com.azure.storage.blob.models.PageBlobItem; import com.azure.storage.blob.models.PageBlobRequestConditions; import com.azure.storage.blob.models.PageList; @@ -38,11 +61,21 @@ import reactor.core.publisher.Mono; import java.io.InputStream; +import java.net.MalformedURLException; import java.net.URL; import java.nio.ByteBuffer; import java.time.Duration; +import java.util.Collections; +import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.concurrent.Callable; +import java.util.function.BiFunction; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static com.azure.storage.blob.implementation.util.ModelHelper.wrapTimeoutServiceCallWithExceptionMapping; +import static com.azure.storage.common.implementation.StorageImplUtils.sendRequest; /** * Client to a page blob. It may only be instantiated through a {@link SpecializedBlobClientBuilder} or via the method @@ -55,17 +88,18 @@ */ @ServiceClient(builder = SpecializedBlobClientBuilder.class) public final class PageBlobClient extends BlobClientBase { + private static final ClientLogger LOGGER = new ClientLogger(PageBlobClient.class); private final PageBlobAsyncClient pageBlobAsyncClient; /** * Indicates the number of bytes in a page. */ - public static final int PAGE_BYTES = PageBlobAsyncClient.PAGE_BYTES; + public static final int PAGE_BYTES = 512; /** * Indicates the maximum number of bytes that may be sent in a call to putPage. */ - public static final int MAX_PUT_PAGES_BYTES = PageBlobAsyncClient.MAX_PUT_PAGES_BYTES; + public static final int MAX_PUT_PAGES_BYTES = 4 * Constants.MB; /** * Package-private constructor for use by {@link SpecializedBlobClientBuilder}. @@ -73,7 +107,35 @@ public final class PageBlobClient extends BlobClientBase { * @param pageBlobAsyncClient the async page blob client */ PageBlobClient(PageBlobAsyncClient pageBlobAsyncClient) { - super(pageBlobAsyncClient); + this(pageBlobAsyncClient, pageBlobAsyncClient.getHttpPipeline(), pageBlobAsyncClient.getAccountUrl(), + pageBlobAsyncClient.getServiceVersion(), pageBlobAsyncClient.getAccountName(), + pageBlobAsyncClient.getContainerName(), pageBlobAsyncClient.getBlobName(), + pageBlobAsyncClient.getSnapshotId(), pageBlobAsyncClient.getCustomerProvidedKey(), + new EncryptionScope().setEncryptionScope(pageBlobAsyncClient.getEncryptionScope()), + pageBlobAsyncClient.getVersionId()); + } + + /** + * Package-private constructor for use by {@link SpecializedBlobClientBuilder}. + * + * @param pipeline The pipeline used to send and receive service requests. + * @param url The endpoint where to send service requests. + * @param serviceVersion The version of the service to receive requests. + * @param accountName The storage account name. + * @param containerName The container name. + * @param blobName The blob name. + * @param snapshot The snapshot identifier for the blob, pass {@code null} to interact with the blob directly. + * @param customerProvidedKey Customer provided key used during encryption of the blob's data on the server, pass + * {@code null} to allow the service to use its own encryption. + * @param encryptionScope Encryption scope used during encryption of the blob's data on the server, pass + * {@code null} to allow the service to use its own encryption. + * @param versionId The version identifier for the blob, pass {@code null} to interact with the latest blob version. + */ + PageBlobClient(PageBlobAsyncClient pageBlobAsyncClient, HttpPipeline pipeline, String url, + BlobServiceVersion serviceVersion, String accountName, String containerName, String blobName, String snapshot, CpkInfo customerProvidedKey, + EncryptionScope encryptionScope, String versionId) { + super(pageBlobAsyncClient, pipeline, url, serviceVersion, accountName, containerName, blobName, snapshot, customerProvidedKey, + encryptionScope, versionId); this.pageBlobAsyncClient = pageBlobAsyncClient; } @@ -85,7 +147,14 @@ public final class PageBlobClient extends BlobClientBase { */ @Override public PageBlobClient getEncryptionScopeClient(String encryptionScope) { - return new PageBlobClient(pageBlobAsyncClient.getEncryptionScopeAsyncClient(encryptionScope)); + EncryptionScope finalEncryptionScope = null; + if (encryptionScope != null) { + finalEncryptionScope = new EncryptionScope().setEncryptionScope(encryptionScope); + } + PageBlobAsyncClient asyncClient = pageBlobAsyncClient.getEncryptionScopeAsyncClient(encryptionScope); + return new PageBlobClient(asyncClient, getHttpPipeline(), getAccountUrl(), getServiceVersion(), getAccountName(), + getContainerName(), getBlobName(), getSnapshotId(), getCustomerProvidedKey(), finalEncryptionScope, + getVersionId()); } /** @@ -97,7 +166,17 @@ public PageBlobClient getEncryptionScopeClient(String encryptionScope) { */ @Override public PageBlobClient getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey) { - return new PageBlobClient(pageBlobAsyncClient.getCustomerProvidedKeyAsyncClient(customerProvidedKey)); + CpkInfo finalCustomerProvidedKey = null; + if (customerProvidedKey != null) { + finalCustomerProvidedKey = new CpkInfo() + .setEncryptionKey(customerProvidedKey.getKey()) + .setEncryptionKeySha256(customerProvidedKey.getKeySha256()) + .setEncryptionAlgorithm(customerProvidedKey.getEncryptionAlgorithm()); + } + PageBlobAsyncClient asyncClient = pageBlobAsyncClient.getCustomerProvidedKeyAsyncClient(customerProvidedKey); + return new PageBlobClient(asyncClient, getHttpPipeline(), getAccountUrl(), getServiceVersion(), getAccountName(), + getContainerName(), getBlobName(), getSnapshotId(), finalCustomerProvidedKey, encryptionScope, + getVersionId()); } /** @@ -262,8 +341,45 @@ public Response createWithResponse(long size, Long sequenceNumber, */ @ServiceMethod(returns = ReturnType.SINGLE) public Response createWithResponse(PageBlobCreateOptions options, Duration timeout, Context context) { - Mono> response = pageBlobAsyncClient.createWithResponse(options, context); - return StorageImplUtils.blockWithOptionalTimeout(response, timeout); +// Mono> response = pageBlobAsyncClient.createWithResponse(options, context); +// return StorageImplUtils.blockWithOptionalTimeout(response, timeout); + StorageImplUtils.assertNotNull("options", options); + Context finalContext = context == null ? Context.NONE : context; + BlobRequestConditions requestConditions = options.getRequestConditions() == null ? new BlobRequestConditions() + : options.getRequestConditions(); + + if (options.getSize() % PAGE_BYTES != 0) { + // Throwing is preferred to Single.error because this will error out immediately instead of waiting until + // subscription. + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("size must be a multiple of PageBlobAsyncClient.PAGE_BYTES.")); + } + if (options.getSequenceNumber() != null && options.getSequenceNumber() < 0) { + // Throwing is preferred to Single.error because this will error out immediately instead of waiting until + // subscription. + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("SequenceNumber must be greater than or equal to 0.")); + } + BlobImmutabilityPolicy immutabilityPolicy = options.getImmutabilityPolicy() == null + ? new BlobImmutabilityPolicy() : options.getImmutabilityPolicy(); + + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( + () -> + this.azureBlobStorage.getPageBlobs().createWithResponse(containerName, blobName, 0, options.getSize(), null, + null, options.getMetadata(), requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), + requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), + requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), options.getSequenceNumber(), + null, ModelHelper.tagsToString(options.getTags()), immutabilityPolicy.getExpiryTime(), + immutabilityPolicy.getPolicyMode(), options.isLegalHold(), options.getHeaders(), + getCustomerProvidedKey(), encryptionScope, finalContext)); + + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + PageBlobsCreateHeaders hd = response.getDeserializedHeaders(); + PageBlobItem item = new PageBlobItem(hd.getETag(), hd.getLastModified(), hd.getContentMD5(), + hd.isXMsRequestServerEncrypted(), hd.getXMsEncryptionKeySha256(), hd.getXMsEncryptionScope(), + null, hd.getXMsVersionId()); + return new SimpleResponse<>(response, item); } /** @@ -324,8 +440,22 @@ public PageBlobItem createIfNotExists(long size) { @ServiceMethod(returns = ReturnType.SINGLE) public Response createIfNotExistsWithResponse(PageBlobCreateOptions options, Duration timeout, Context context) { - return StorageImplUtils.blockWithOptionalTimeout(pageBlobAsyncClient. - createIfNotExistsWithResponse(options, context), timeout); + StorageImplUtils.assertNotNull("options", options); + options.setRequestConditions(new BlobRequestConditions().setIfNoneMatch(Constants.HeaderConstants.ETAG_WILDCARD) + .setIfNoneMatch(Constants.HeaderConstants.ETAG_WILDCARD)); + try { + return createWithResponse(options, timeout, context); + } catch (BlobStorageException e) { + if (e.getStatusCode() == 409 && (e.getErrorCode().equals(BlobErrorCode.BLOB_ALREADY_EXISTS) + || e.getErrorCode().equals(BlobErrorCode.RESOURCE_ALREADY_EXISTS))) { + HttpResponse res = e.getResponse(); + return new SimpleResponse<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), null); + } else { + throw LOGGER.logExceptionAsError(e); + } + } catch (RuntimeException e) { + throw LOGGER.logExceptionAsError(e); + } } /** @@ -615,10 +745,32 @@ public PageBlobItem clearPages(PageRange pageRange) { @ServiceMethod(returns = ReturnType.SINGLE) public Response clearPagesWithResponse(PageRange pageRange, PageBlobRequestConditions pageBlobRequestConditions, Duration timeout, Context context) { - Mono> response = pageBlobAsyncClient.clearPagesWithResponse(pageRange, - pageBlobRequestConditions, context); - - return StorageImplUtils.blockWithOptionalTimeout(response, timeout); + PageBlobRequestConditions finalPageBlobRequestConditions = pageBlobRequestConditions == null + ? new PageBlobRequestConditions() : pageBlobRequestConditions; + if (pageRange == null) { + // Throwing is preferred to Single.error because this will error out immediately instead of waiting until + // subscription. + throw LOGGER.logExceptionAsError(new IllegalArgumentException("pageRange cannot be null.")); + } + String pageRangeStr = ModelHelper.pageRangeToString(pageRange); + Context finalContext = context == null ? Context.NONE : context; + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( + () -> this.azureBlobStorage.getPageBlobs().clearPagesWithResponse(containerName, blobName, 0, null, + pageRangeStr, finalPageBlobRequestConditions.getLeaseId(), + finalPageBlobRequestConditions.getIfSequenceNumberLessThanOrEqualTo(), + finalPageBlobRequestConditions.getIfSequenceNumberLessThan(), + finalPageBlobRequestConditions.getIfSequenceNumberEqualTo(), + finalPageBlobRequestConditions.getIfModifiedSince(), + finalPageBlobRequestConditions.getIfUnmodifiedSince(), finalPageBlobRequestConditions.getIfMatch(), + finalPageBlobRequestConditions.getIfNoneMatch(), finalPageBlobRequestConditions.getTagsConditions(), + null, getCustomerProvidedKey(), encryptionScope, finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + PageBlobsClearPagesHeaders hd = response.getDeserializedHeaders(); + PageBlobItem item = new PageBlobItem(hd.getETag(), hd.getLastModified(), hd.getContentMD5(), + hd.isXMsRequestServerEncrypted(), hd.getXMsEncryptionKeySha256(), null, + hd.getXMsBlobSequenceNumber()); + return new SimpleResponse<>(response, item); } /** @@ -682,8 +834,21 @@ public PageList getPageRanges(BlobRange blobRange) { @Deprecated public Response getPageRangesWithResponse(BlobRange blobRange, BlobRequestConditions requestConditions, Duration timeout, Context context) { - return StorageImplUtils.blockWithOptionalTimeout(pageBlobAsyncClient - .getPageRangesWithResponse(blobRange, requestConditions, context), timeout); + BlobRange finalBlobRange = blobRange == null ? new BlobRange(0) : blobRange; + BlobRequestConditions finalRequestConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; + Context finalContext = context == null ? Context.NONE : context; + + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getPageBlobs().getPageRangesWithResponse(containerName, blobName, getSnapshotId(), + null, finalBlobRange.toHeaderValue(), finalRequestConditions.getLeaseId(), + finalRequestConditions.getIfModifiedSince(), finalRequestConditions.getIfUnmodifiedSince(), + finalRequestConditions.getIfMatch(), finalRequestConditions.getIfNoneMatch(), + finalRequestConditions.getTagsConditions(), null, null, null, finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), + response.getValue()); } /** @@ -747,13 +912,55 @@ public PagedIterable listPageRanges(BlobRange blobRange) { @ServiceMethod(returns = ReturnType.SINGLE) public PagedIterable listPageRanges(ListPageRangesOptions options, Duration timeout, Context context) { - return new PagedIterable<>( - // pull timeout out of options - new PagedFlux<>( - pageSize -> pageBlobAsyncClient.listPageRangesWithOptionalTimeout( - options, timeout, context).apply(null, pageSize), - (continuationToken, pageSize) -> pageBlobAsyncClient.listPageRangesWithOptionalTimeout( - options, timeout, context).apply(continuationToken, pageSize))); + Objects.requireNonNull(options, "options must not be null"); + Context finalContext = context == null ? Context.NONE : context; + + // Helper function to retrieve a page of items + BiFunction> pageRetriever = (continuationToken, pageSize) -> { + BlobRequestConditions requestConditions = options.getRequestConditions() == null + ? new BlobRequestConditions() : options.getRequestConditions(); + Integer finalPageSize = pageSize == null ? options.getMaxResultsPerPage() : pageSize; + + // Call the synchronous service method + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getPageBlobs().getPageRangesWithResponse(containerName, blobName, getSnapshotId(), + null, options.getRange().toHeaderValue(), requestConditions.getLeaseId(), + requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), + requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), + requestConditions.getTagsConditions(), null, continuationToken, finalPageSize, finalContext)); + + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + List value = parsePageRangeItems(response.getValue()); + + return new PagedResponseBase<>( + response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + value, + PageListHelper.getNextMarker(response.getValue()), + response.getDeserializedHeaders()); + }; + return new PagedIterable<>(pageSize -> pageRetriever.apply(null, pageSize), pageRetriever); + } + + private List parsePageRangeItems(PageList pageList) { + if (pageList == null) { + return Collections.emptyList(); + } + return Stream.concat( + pageList.getPageRange().stream().map(this::toPageBlobRange), + pageList.getClearRange().stream().map(this::toPageBlobRange) + ).collect(Collectors.toList()); + } + + private PageRangeItem toPageBlobRange(PageRange range) { + return new PageRangeItem(new HttpRange(range.getStart(), range.getEnd() - range.getStart() + 1), false); + } + + private PageRangeItem toPageBlobRange(ClearRange range) { + return new PageRangeItem(new HttpRange(range.getStart(), range.getEnd() - range.getStart() + 1), true); } /** @@ -828,9 +1035,26 @@ public PageList getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { @Deprecated public Response getPageRangesDiffWithResponse(BlobRange blobRange, String prevSnapshot, BlobRequestConditions requestConditions, Duration timeout, Context context) { - return StorageImplUtils.blockWithOptionalTimeout(pageBlobAsyncClient - .getPageRangesDiffWithResponse(blobRange, prevSnapshot, null, requestConditions, context), - timeout); + BlobRange finalBlobRange = blobRange == null ? new BlobRange(0) : blobRange; + BlobRequestConditions finalRequestConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; + + if (prevSnapshot == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("prevSnapshot cannot be null")); + } + Context finalContext = context == null ? Context.NONE : context; + + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getPageBlobs().getPageRangesDiffWithResponse(containerName, blobName, + getSnapshotId(), null, prevSnapshot, null, finalBlobRange.toHeaderValue(), + finalRequestConditions.getLeaseId(), finalRequestConditions.getIfModifiedSince(), + finalRequestConditions.getIfUnmodifiedSince(), finalRequestConditions.getIfMatch(), + finalRequestConditions.getIfNoneMatch(), finalRequestConditions.getTagsConditions(), null, null, + null, finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), + response.getValue()); } /** @@ -901,13 +1125,38 @@ public PagedIterable listPageRangesDiff(BlobRange blobRange, Stri @ServiceMethod(returns = ReturnType.SINGLE) public PagedIterable listPageRangesDiff(ListPageRangesDiffOptions options, Duration timeout, Context context) { - return new PagedIterable<>( - // pull timeout out of options - new PagedFlux<>( - pageSize -> pageBlobAsyncClient.listPageRangesDiffWithOptionalTimeout( - options, timeout, context).apply(null, pageSize), - (continuationToken, pageSize) -> pageBlobAsyncClient.listPageRangesDiffWithOptionalTimeout( - options, timeout, context).apply(continuationToken, pageSize))); + Objects.requireNonNull(options, "options must not be null"); + Context finalContext = context == null ? Context.NONE : context; + + BiFunction> pageRetriever = (continuationToken, pageSize) -> { + BlobRequestConditions requestConditions = options.getRequestConditions() == null + ? new BlobRequestConditions() : options.getRequestConditions(); + + // Dynamically use pageSize provided during the iteration if available + Integer finalPageSize = pageSize != null ? pageSize : options.getMaxResultsPerPage(); + + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getPageBlobs().getPageRangesDiffWithResponse(containerName, blobName, + getSnapshotId(), null, options.getPreviousSnapshot(), null, options.getRange().toHeaderValue(), + requestConditions.getLeaseId(), requestConditions.getIfModifiedSince(), + requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), + requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, continuationToken, + finalPageSize, finalContext)); + + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + List value = parsePageRangeItems(response.getValue()); + + return new PagedResponseBase<>( + response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + value, + PageListHelper.getNextMarker(response.getValue()), + response.getDeserializedHeaders()); + }; + return new PagedIterable<>(pageSize -> pageRetriever.apply(null, pageSize), pageRetriever); } /** @@ -982,9 +1231,31 @@ public PageList getManagedDiskPageRangesDiff(BlobRange blobRange, String prevSna @ServiceMethod(returns = ReturnType.SINGLE) public Response getManagedDiskPageRangesDiffWithResponse(BlobRange blobRange, String prevSnapshotUrl, BlobRequestConditions requestConditions, Duration timeout, Context context) { - return StorageImplUtils.blockWithOptionalTimeout(pageBlobAsyncClient - .getPageRangesDiffWithResponse(blobRange, null, prevSnapshotUrl, requestConditions, context), - timeout); + BlobRange finalBlobRange = blobRange == null ? new BlobRange(0) : blobRange; + BlobRequestConditions finalRequestConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; + + if (prevSnapshotUrl == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("prevSnapshot cannot be null")); + } + try { + new URL(prevSnapshotUrl); + } catch (MalformedURLException ex) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("'prevSnapshotUrl' is not a valid url.", ex)); + } + Context finalContext = context == null ? Context.NONE : context; + + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getPageBlobs().getPageRangesDiffWithResponse(containerName, blobName, + getSnapshotId(), null, null, prevSnapshotUrl, finalBlobRange.toHeaderValue(), + finalRequestConditions.getLeaseId(), finalRequestConditions.getIfModifiedSince(), + finalRequestConditions.getIfUnmodifiedSince(), finalRequestConditions.getIfMatch(), + finalRequestConditions.getIfNoneMatch(), finalRequestConditions.getTagsConditions(), null, null, + null, finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), + response.getHeaders(), response.getValue()); } /** @@ -1036,9 +1307,29 @@ public PageBlobItem resize(long size) { @ServiceMethod(returns = ReturnType.SINGLE) public Response resizeWithResponse(long size, BlobRequestConditions requestConditions, Duration timeout, Context context) { - Mono> response = pageBlobAsyncClient.resizeWithResponse(size, requestConditions, - context); - return StorageImplUtils.blockWithOptionalTimeout(response, timeout); + if (size % PAGE_BYTES != 0) { + // Throwing is preferred to Single.error because this will error out immediately instead of waiting until + // subscription. + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("size must be a multiple of PageBlobAsyncClient.PAGE_BYTES.")); + } + BlobRequestConditions finalRequestConditions = requestConditions == null ? new BlobRequestConditions() + : requestConditions; + Context finalContext = context == null ? Context.NONE : context; + + Callable> operation = wrapTimeoutServiceCallWithExceptionMapping( + () -> + this.azureBlobStorage.getPageBlobs().resizeWithResponse(containerName, blobName, size, null, + finalRequestConditions.getLeaseId(), finalRequestConditions.getIfModifiedSince(), + finalRequestConditions.getIfUnmodifiedSince(), finalRequestConditions.getIfMatch(), + finalRequestConditions.getIfNoneMatch(), finalRequestConditions.getTagsConditions(), null, + getCustomerProvidedKey(), encryptionScope, finalContext)); + ResponseBase response = sendRequest(operation, timeout, BlobStorageException.class); + + PageBlobsResizeHeaders hd = response.getDeserializedHeaders(); + PageBlobItem item = new PageBlobItem(hd.getETag(), hd.getLastModified(), null, null, null, null, + hd.getXMsBlobSequenceNumber()); + return new SimpleResponse<>(response, item); } /** @@ -1095,9 +1386,29 @@ public PageBlobItem updateSequenceNumber(SequenceNumberActionType action, @ServiceMethod(returns = ReturnType.SINGLE) public Response updateSequenceNumberWithResponse(SequenceNumberActionType action, Long sequenceNumber, BlobRequestConditions requestConditions, Duration timeout, Context context) { - Mono> response = pageBlobAsyncClient - .updateSequenceNumberWithResponse(action, sequenceNumber, requestConditions, context); - return StorageImplUtils.blockWithOptionalTimeout(response, timeout); + if (sequenceNumber != null && sequenceNumber < 0) { + // Throwing is preferred to Single.error because this will error out immediately instead of waiting until + // subscription. + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("SequenceNumber must be greater than or equal to 0.")); + } + BlobRequestConditions finalRequestConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; + Long finalSequenceNumber = action == SequenceNumberActionType.INCREMENT ? null : sequenceNumber; + Context finalContext = context == null ? Context.NONE : context; + + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getPageBlobs().updateSequenceNumberWithResponse(containerName, blobName, action, null, + finalRequestConditions.getLeaseId(), finalRequestConditions.getIfModifiedSince(), + finalRequestConditions.getIfUnmodifiedSince(), finalRequestConditions.getIfMatch(), + finalRequestConditions.getIfNoneMatch(), finalRequestConditions.getTagsConditions(), + finalSequenceNumber, null, finalContext)); + + ResponseBase response = sendRequest(operation, timeout, BlobStorageException.class); + PageBlobsUpdateSequenceNumberHeaders hd = response.getDeserializedHeaders(); + PageBlobItem item = new PageBlobItem(hd.getETag(), hd.getLastModified(), null, null, null, null, + hd.getXMsBlobSequenceNumber()); + return new SimpleResponse<>(response, item); } /** @@ -1251,7 +1562,29 @@ public Response copyIncrementalWithResponse(String source, Strin @ServiceMethod(returns = ReturnType.SINGLE) public Response copyIncrementalWithResponse(PageBlobCopyIncrementalOptions options, Duration timeout, Context context) { - Mono> response = pageBlobAsyncClient.copyIncrementalWithResponse(options, context); - return StorageImplUtils.blockWithOptionalTimeout(response, timeout); + StorageImplUtils.assertNotNull("options", options); + UrlBuilder builder = UrlBuilder.parse(options.getSource()); + builder.setQueryParameter(Constants.UrlConstants.SNAPSHOT_QUERY_PARAMETER, options.getSnapshot()); + PageBlobCopyIncrementalRequestConditions modifiedRequestConditions = (options.getRequestConditions() == null) + ? new PageBlobCopyIncrementalRequestConditions() : options.getRequestConditions(); + + try { + builder.toUrl(); + } catch (MalformedURLException e) { + // We are parsing a valid url and adding a query parameter. If this fails, we can't recover. + throw LOGGER.logExceptionAsError(new IllegalArgumentException(e)); + } + Context finalContext = context == null ? Context.NONE : context; + + Callable> operation = + wrapTimeoutServiceCallWithExceptionMapping(() -> + this.azureBlobStorage.getPageBlobs().copyIncrementalWithResponse(containerName, blobName, + builder.toString(), null, modifiedRequestConditions.getIfModifiedSince(), + modifiedRequestConditions.getIfUnmodifiedSince(), modifiedRequestConditions.getIfMatch(), + modifiedRequestConditions.getIfNoneMatch(), modifiedRequestConditions.getTagsConditions(), null, + finalContext)); + ResponseBase response = sendRequest(operation, timeout, + BlobStorageException.class); + return new SimpleResponse<>(response, response.getDeserializedHeaders().getXMsCopyStatus()); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/module-info.java b/sdk/storage/azure-storage-blob/src/main/java/module-info.java index 4440b9bcbfb7e..c5bae00754af7 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/module-info.java +++ b/sdk/storage/azure-storage-blob/src/main/java/module-info.java @@ -5,6 +5,7 @@ requires transitive com.azure.storage.common; requires com.azure.storage.internal.avro; + requires com.azure.core; exports com.azure.storage.blob; exports com.azure.storage.blob.models; diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseApiTests.java index 5a512b5252cfd..1c7a8473bbc29 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseApiTests.java @@ -35,6 +35,7 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.io.UncheckedIOException; import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; @@ -521,8 +522,7 @@ public void queryFatalError() { liveTestScenarioWithRetry(() -> { /* Input Stream. */ - InputStream qqStream = bc.openQueryInputStreamWithResponse(options).getValue(); - assertThrows(Throwable.class, () -> readFromInputStream(qqStream, Constants.KB)); + assertThrows(UncheckedIOException.class, () -> bc.openQueryInputStreamWithResponse(options).getValue()); /* Output Stream. */ //Exceptions.ReactiveException.class diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index 125c549a9e1ca..3686eac7d1779 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -24,6 +24,7 @@ generate-client-as-impl: true generate-client-interfaces: false service-interface-as-public: true license-header: MICROSOFT_MIT_SMALL +enable-sync-stack: true context-client-method-parameter: true optional-constant-as-enum: true default-http-exception-type: com.azure.storage.blob.implementation.models.BlobStorageExceptionInternal diff --git a/sdk/storage/azure-storage-file-datalake/pom.xml b/sdk/storage/azure-storage-file-datalake/pom.xml index a9c861a6a8949..3ae08a8e115a0 100644 --- a/sdk/storage/azure-storage-file-datalake/pom.xml +++ b/sdk/storage/azure-storage-file-datalake/pom.xml @@ -66,7 +66,7 @@ com.azure azure-core - 1.51.0 + 1.52.0-beta.1 com.azure @@ -147,7 +147,7 @@ com.azure azure-core-http-okhttp - 1.12.2 + 1.13.0-beta.1 test diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileApiTest.java b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileApiTest.java index 696a3a6c9d50b..718003dad4e9b 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileApiTest.java +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileApiTest.java @@ -2976,9 +2976,8 @@ public void queryFatalError() { String expression = "SELECT * from BlobStorage"; liveTestScenarioWithRetry(() -> { - InputStream qqStream = fc.openQueryInputStreamWithResponse(new FileQueryOptions(expression) - .setInputSerialization(new FileQueryJsonSerialization())).getValue(); - assertThrows(UncheckedIOException.class, () -> readFromInputStream(qqStream, Constants.KB)); + assertThrows(UncheckedIOException.class, () -> fc.openQueryInputStreamWithResponse( + new FileQueryOptions(expression).setInputSerialization(new FileQueryJsonSerialization())).getValue()); assertThrows(RuntimeException.class, () -> fc.queryWithResponse(new FileQueryOptions(expression, new ByteArrayOutputStream()).setInputSerialization(new FileQueryJsonSerialization()), null, null));