com.microsoft.azure.storage.blob.GeneratedAppendBlobs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-storage-blob Show documentation
Show all versions of azure-storage-blob Show documentation
The Azure Storage Java Blob library.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator
package com.microsoft.azure.storage.blob;
import com.microsoft.azure.storage.blob.models.AppendBlobAppendBlockFromUrlResponse;
import com.microsoft.azure.storage.blob.models.AppendBlobAppendBlockResponse;
import com.microsoft.azure.storage.blob.models.AppendBlobCreateResponse;
import com.microsoft.azure.storage.blob.models.AppendPositionAccessConditions;
import com.microsoft.azure.storage.blob.models.BlobHTTPHeaders;
import com.microsoft.azure.storage.blob.models.LeaseAccessConditions;
import com.microsoft.azure.storage.blob.models.ModifiedAccessConditions;
import com.microsoft.azure.storage.blob.models.SourceModifiedAccessConditions;
import com.microsoft.azure.storage.blob.models.StorageErrorException;
import com.microsoft.rest.v2.Context;
import com.microsoft.rest.v2.DateTimeRfc1123;
import com.microsoft.rest.v2.RestProxy;
import com.microsoft.rest.v2.ServiceCallback;
import com.microsoft.rest.v2.ServiceFuture;
import com.microsoft.rest.v2.Validator;
import com.microsoft.rest.v2.annotations.BodyParam;
import com.microsoft.rest.v2.annotations.ExpectedResponses;
import com.microsoft.rest.v2.annotations.HeaderParam;
import com.microsoft.rest.v2.annotations.Host;
import com.microsoft.rest.v2.annotations.HostParam;
import com.microsoft.rest.v2.annotations.PUT;
import com.microsoft.rest.v2.annotations.QueryParam;
import com.microsoft.rest.v2.annotations.UnexpectedResponseExceptionType;
import com.microsoft.rest.v2.util.Base64Util;
import io.reactivex.Completable;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.annotations.NonNull;
import java.net.URL;
import java.nio.ByteBuffer;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
/**
* An instance of this class provides access to all the operations defined in
* GeneratedAppendBlobs.
*/
public final class GeneratedAppendBlobs {
/**
* The proxy service used to perform REST calls.
*/
private AppendBlobsService service;
/**
* The service client containing this operation class.
*/
private GeneratedStorageClient client;
/**
* Initializes an instance of GeneratedAppendBlobs.
*
* @param client the instance of the service client containing this operation class.
*/
public GeneratedAppendBlobs(GeneratedStorageClient client) {
this.service = RestProxy.create(AppendBlobsService.class, client);
this.client = client;
}
/**
* The interface defining all the services for GeneratedAppendBlobs to be
* used by the proxy service to perform REST calls.
*/
@Host("{url}")
private interface AppendBlobsService {
@PUT("{containerName}/{blob}")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(StorageErrorException.class)
Single create(Context context, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @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);
@PUT("{containerName}/{blob}")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(StorageErrorException.class)
Single appendBlock(Context context, @HostParam("url") String url, @BodyParam("application/octet-stream") Flowable body, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @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);
@PUT("{containerName}/{blob}")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(StorageErrorException.class)
Single appendBlockFromUrl(Context context, @HostParam("url") String url, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @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-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);
}
/**
* The Create Append Blob operation creates a new append blob.
*
* @param context The context to associate with this operation.
* @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 requestId Provides a 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 Additional parameters for the operation.
* @param leaseAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws StorageErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
public void create(Context context, @NonNull long contentLength, Integer timeout, Map metadata, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions) {
createAsync(context, contentLength, timeout, metadata, requestId, blobHTTPHeaders, leaseAccessConditions, modifiedAccessConditions).blockingAwait();
}
/**
* The Create Append Blob operation creates a new append blob.
*
* @param context The context to associate with this operation.
* @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 requestId Provides a 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 Additional parameters for the operation.
* @param leaseAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a ServiceFuture which will be completed with the result of the network request.
*/
public ServiceFuture createAsync(Context context, @NonNull long contentLength, Integer timeout, Map metadata, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, ServiceCallback serviceCallback) {
return ServiceFuture.fromBody(createAsync(context, contentLength, timeout, metadata, requestId, blobHTTPHeaders, leaseAccessConditions, modifiedAccessConditions), serviceCallback);
}
/**
* The Create Append Blob operation creates a new append blob.
*
* @param context The context to associate with this operation.
* @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 requestId Provides a 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 Additional parameters for the operation.
* @param leaseAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Single which performs the network request upon subscription.
*/
public Single createWithRestResponseAsync(Context context, @NonNull long contentLength, Integer timeout, Map metadata, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions) {
if (this.client.url() == null) {
throw new IllegalArgumentException("Parameter this.client.url() is required and cannot be null.");
}
Validator.validate(metadata);
Validator.validate(blobHTTPHeaders);
Validator.validate(leaseAccessConditions);
Validator.validate(modifiedAccessConditions);
final String blobType = "AppendBlob";
String blobContentType = null;
if (blobHTTPHeaders != null) {
blobContentType = blobHTTPHeaders.blobContentType();
}
String blobContentEncoding = null;
if (blobHTTPHeaders != null) {
blobContentEncoding = blobHTTPHeaders.blobContentEncoding();
}
String blobContentLanguage = null;
if (blobHTTPHeaders != null) {
blobContentLanguage = blobHTTPHeaders.blobContentLanguage();
}
byte[] blobContentMD5 = null;
if (blobHTTPHeaders != null) {
blobContentMD5 = blobHTTPHeaders.blobContentMD5();
}
String blobCacheControl = null;
if (blobHTTPHeaders != null) {
blobCacheControl = blobHTTPHeaders.blobCacheControl();
}
String blobContentDisposition = null;
if (blobHTTPHeaders != null) {
blobContentDisposition = blobHTTPHeaders.blobContentDisposition();
}
String leaseId = null;
if (leaseAccessConditions != null) {
leaseId = leaseAccessConditions.leaseId();
}
OffsetDateTime ifModifiedSince = null;
if (modifiedAccessConditions != null) {
ifModifiedSince = modifiedAccessConditions.ifModifiedSince();
}
OffsetDateTime ifUnmodifiedSince = null;
if (modifiedAccessConditions != null) {
ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince();
}
String ifMatch = null;
if (modifiedAccessConditions != null) {
ifMatch = modifiedAccessConditions.ifMatch();
}
String ifNoneMatch = null;
if (modifiedAccessConditions != null) {
ifNoneMatch = modifiedAccessConditions.ifNoneMatch();
}
String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5);
DateTimeRfc1123 ifModifiedSinceConverted = null;
if (ifModifiedSince != null) {
ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
}
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
if (ifUnmodifiedSince != null) {
ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
}
return service.create(context, this.client.url(), timeout, contentLength, metadata, this.client.version(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch);
}
/**
* The Create Append Blob operation creates a new append blob.
*
* @param context The context to associate with this operation.
* @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 requestId Provides a 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 Additional parameters for the operation.
* @param leaseAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Single which performs the network request upon subscription.
*/
public Completable createAsync(Context context, @NonNull long contentLength, Integer timeout, Map metadata, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions) {
return createWithRestResponseAsync(context, contentLength, timeout, metadata, requestId, blobHTTPHeaders, leaseAccessConditions, modifiedAccessConditions)
.toCompletable();
}
/**
* 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 context The context to associate with this operation.
* @param body Initial data.
* @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 transactionalContentMD5 Specify the transactional md5 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 leaseAccessConditions Additional parameters for the operation.
* @param appendPositionAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws StorageErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
public void appendBlock(Context context, @NonNull Flowable body, @NonNull long contentLength, Integer timeout, byte[] transactionalContentMD5, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions) {
appendBlockAsync(context, body, contentLength, timeout, transactionalContentMD5, requestId, leaseAccessConditions, appendPositionAccessConditions, modifiedAccessConditions).blockingAwait();
}
/**
* 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 context The context to associate with this operation.
* @param body Initial data.
* @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 transactionalContentMD5 Specify the transactional md5 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 leaseAccessConditions Additional parameters for the operation.
* @param appendPositionAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a ServiceFuture which will be completed with the result of the network request.
*/
public ServiceFuture appendBlockAsync(Context context, @NonNull Flowable body, @NonNull long contentLength, Integer timeout, byte[] transactionalContentMD5, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions, ServiceCallback serviceCallback) {
return ServiceFuture.fromBody(appendBlockAsync(context, body, contentLength, timeout, transactionalContentMD5, requestId, leaseAccessConditions, appendPositionAccessConditions, modifiedAccessConditions), serviceCallback);
}
/**
* 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 context The context to associate with this operation.
* @param body Initial data.
* @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 transactionalContentMD5 Specify the transactional md5 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 leaseAccessConditions Additional parameters for the operation.
* @param appendPositionAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Single which performs the network request upon subscription.
*/
public Single appendBlockWithRestResponseAsync(Context context, @NonNull Flowable body, @NonNull long contentLength, Integer timeout, byte[] transactionalContentMD5, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions) {
if (this.client.url() == null) {
throw new IllegalArgumentException("Parameter this.client.url() is required and cannot be null.");
}
if (body == null) {
throw new IllegalArgumentException("Parameter body is required and cannot be null.");
}
Validator.validate(leaseAccessConditions);
Validator.validate(appendPositionAccessConditions);
Validator.validate(modifiedAccessConditions);
final String comp = "appendblock";
String leaseId = null;
if (leaseAccessConditions != null) {
leaseId = leaseAccessConditions.leaseId();
}
Long maxSize = null;
if (appendPositionAccessConditions != null) {
maxSize = appendPositionAccessConditions.maxSize();
}
Long appendPosition = null;
if (appendPositionAccessConditions != null) {
appendPosition = appendPositionAccessConditions.appendPosition();
}
OffsetDateTime ifModifiedSince = null;
if (modifiedAccessConditions != null) {
ifModifiedSince = modifiedAccessConditions.ifModifiedSince();
}
OffsetDateTime ifUnmodifiedSince = null;
if (modifiedAccessConditions != null) {
ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince();
}
String ifMatch = null;
if (modifiedAccessConditions != null) {
ifMatch = modifiedAccessConditions.ifMatch();
}
String ifNoneMatch = null;
if (modifiedAccessConditions != null) {
ifNoneMatch = modifiedAccessConditions.ifNoneMatch();
}
String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5);
DateTimeRfc1123 ifModifiedSinceConverted = null;
if (ifModifiedSince != null) {
ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
}
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
if (ifUnmodifiedSince != null) {
ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
}
return service.appendBlock(context, this.client.url(), body, timeout, contentLength, transactionalContentMD5Converted, this.client.version(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch);
}
/**
* 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 context The context to associate with this operation.
* @param body Initial data.
* @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 transactionalContentMD5 Specify the transactional md5 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 leaseAccessConditions Additional parameters for the operation.
* @param appendPositionAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Single which performs the network request upon subscription.
*/
public Completable appendBlockAsync(Context context, @NonNull Flowable body, @NonNull long contentLength, Integer timeout, byte[] transactionalContentMD5, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions) {
return appendBlockWithRestResponseAsync(context, body, contentLength, timeout, transactionalContentMD5, requestId, leaseAccessConditions, appendPositionAccessConditions, modifiedAccessConditions)
.toCompletable();
}
/**
* 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 context The context to associate with this operation.
* @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 timeout The timeout parameter is expressed in seconds. For more information, see <a 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 leaseAccessConditions Additional parameters for the operation.
* @param appendPositionAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @param sourceModifiedAccessConditions Additional parameters for the operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws StorageErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
public void appendBlockFromUrl(Context context, @NonNull URL sourceUrl, @NonNull long contentLength, String sourceRange, byte[] sourceContentMD5, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions) {
appendBlockFromUrlAsync(context, sourceUrl, contentLength, sourceRange, sourceContentMD5, timeout, requestId, leaseAccessConditions, appendPositionAccessConditions, modifiedAccessConditions, sourceModifiedAccessConditions).blockingAwait();
}
/**
* 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 context The context to associate with this operation.
* @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 timeout The timeout parameter is expressed in seconds. For more information, see <a 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 leaseAccessConditions Additional parameters for the operation.
* @param appendPositionAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @param sourceModifiedAccessConditions Additional parameters for the operation.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a ServiceFuture which will be completed with the result of the network request.
*/
public ServiceFuture appendBlockFromUrlAsync(Context context, @NonNull URL sourceUrl, @NonNull long contentLength, String sourceRange, byte[] sourceContentMD5, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, ServiceCallback serviceCallback) {
return ServiceFuture.fromBody(appendBlockFromUrlAsync(context, sourceUrl, contentLength, sourceRange, sourceContentMD5, timeout, requestId, leaseAccessConditions, appendPositionAccessConditions, modifiedAccessConditions, sourceModifiedAccessConditions), serviceCallback);
}
/**
* 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 context The context to associate with this operation.
* @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 timeout The timeout parameter is expressed in seconds. For more information, see <a 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 leaseAccessConditions Additional parameters for the operation.
* @param appendPositionAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @param sourceModifiedAccessConditions Additional parameters for the operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Single which performs the network request upon subscription.
*/
public Single appendBlockFromUrlWithRestResponseAsync(Context context, @NonNull URL sourceUrl, @NonNull long contentLength, String sourceRange, byte[] sourceContentMD5, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions) {
if (this.client.url() == null) {
throw new IllegalArgumentException("Parameter this.client.url() is required and cannot be null.");
}
if (sourceUrl == null) {
throw new IllegalArgumentException("Parameter sourceUrl is required and cannot be null.");
}
Validator.validate(sourceUrl);
Validator.validate(leaseAccessConditions);
Validator.validate(appendPositionAccessConditions);
Validator.validate(modifiedAccessConditions);
Validator.validate(sourceModifiedAccessConditions);
final String comp = "appendblock";
String leaseId = null;
if (leaseAccessConditions != null) {
leaseId = leaseAccessConditions.leaseId();
}
Long maxSize = null;
if (appendPositionAccessConditions != null) {
maxSize = appendPositionAccessConditions.maxSize();
}
Long appendPosition = null;
if (appendPositionAccessConditions != null) {
appendPosition = appendPositionAccessConditions.appendPosition();
}
OffsetDateTime ifModifiedSince = null;
if (modifiedAccessConditions != null) {
ifModifiedSince = modifiedAccessConditions.ifModifiedSince();
}
OffsetDateTime ifUnmodifiedSince = null;
if (modifiedAccessConditions != null) {
ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince();
}
String ifMatch = null;
if (modifiedAccessConditions != null) {
ifMatch = modifiedAccessConditions.ifMatch();
}
String ifNoneMatch = null;
if (modifiedAccessConditions != null) {
ifNoneMatch = modifiedAccessConditions.ifNoneMatch();
}
OffsetDateTime sourceIfModifiedSince = null;
if (sourceModifiedAccessConditions != null) {
sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince();
}
OffsetDateTime sourceIfUnmodifiedSince = null;
if (sourceModifiedAccessConditions != null) {
sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince();
}
String sourceIfMatch = null;
if (sourceModifiedAccessConditions != null) {
sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch();
}
String sourceIfNoneMatch = null;
if (sourceModifiedAccessConditions != null) {
sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch();
}
String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5);
DateTimeRfc1123 ifModifiedSinceConverted = null;
if (ifModifiedSince != null) {
ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
}
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
if (ifUnmodifiedSince != null) {
ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
}
DateTimeRfc1123 sourceIfModifiedSinceConverted = null;
if (sourceIfModifiedSince != null) {
sourceIfModifiedSinceConverted = new DateTimeRfc1123(sourceIfModifiedSince);
}
DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null;
if (sourceIfUnmodifiedSince != null) {
sourceIfUnmodifiedSinceConverted = new DateTimeRfc1123(sourceIfUnmodifiedSince);
}
return service.appendBlockFromUrl(context, this.client.url(), sourceUrl, sourceRange, sourceContentMD5Converted, timeout, contentLength, this.client.version(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch);
}
/**
* 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 context The context to associate with this operation.
* @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 timeout The timeout parameter is expressed in seconds. For more information, see <a 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 leaseAccessConditions Additional parameters for the operation.
* @param appendPositionAccessConditions Additional parameters for the operation.
* @param modifiedAccessConditions Additional parameters for the operation.
* @param sourceModifiedAccessConditions Additional parameters for the operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Single which performs the network request upon subscription.
*/
public Completable appendBlockFromUrlAsync(Context context, @NonNull URL sourceUrl, @NonNull long contentLength, String sourceRange, byte[] sourceContentMD5, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions) {
return appendBlockFromUrlWithRestResponseAsync(context, sourceUrl, contentLength, sourceRange, sourceContentMD5, timeout, requestId, leaseAccessConditions, appendPositionAccessConditions, modifiedAccessConditions, sourceModifiedAccessConditions)
.toCompletable();
}
}