<PackageReference Include="Azure.Storage.Blobs" Version="12.25.1" />

AppendBlobRestClient

using Azure.Core; using Azure.Core.Pipeline; using Azure.Storage.Blobs.Models; using System; using System.Collections.Generic; using System.IO; using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; namespace Azure.Storage.Blobs { internal class AppendBlobRestClient { private readonly HttpPipeline _pipeline; private readonly string _url; private readonly string _version; internal ClientDiagnostics ClientDiagnostics { get; } public AppendBlobRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string url, string version) { if (clientDiagnostics == null) throw new ArgumentNullException("clientDiagnostics"); ClientDiagnostics = clientDiagnostics; if (pipeline == null) throw new ArgumentNullException("pipeline"); _pipeline = pipeline; if (url == null) throw new ArgumentNullException("url"); _url = url; if (version == null) throw new ArgumentNullException("version"); _version = version; } internal HttpMessage CreateCreateRequest(long contentLength, int? timeout, string blobContentType, string blobContentEncoding, string blobContentLanguage, byte[] blobContentMD5, string blobCacheControl, IDictionary<string, string> metadata, string leaseId, string blobContentDisposition, string encryptionKey, string encryptionKeySha256, EncryptionAlgorithmTypeInternal? encryptionAlgorithm, string encryptionScope, DateTimeOffset? ifModifiedSince, DateTimeOffset? ifUnmodifiedSince, string ifMatch, string ifNoneMatch, string ifTags, string blobTagsString, DateTimeOffset? immutabilityPolicyExpiry, BlobImmutabilityPolicyMode? immutabilityPolicyMode, bool? legalHold) { HttpMessage val = _pipeline.CreateMessage(); Request val2 = val.get_Request(); val2.set_Method(RequestMethod.get_Put()); RawRequestUriBuilder rawRequestUriBuilder = new RawRequestUriBuilder(); rawRequestUriBuilder.AppendRaw(_url, false); if (timeout.HasValue) rawRequestUriBuilder.AppendQuery("timeout", timeout.Value, true); val2.set_Uri(rawRequestUriBuilder); RequestHeaders headers = val2.get_Headers(); headers.Add("x-ms-blob-type", "AppendBlob"); if (blobContentType != null) { headers = val2.get_Headers(); headers.Add("x-ms-blob-content-type", blobContentType); } if (blobContentEncoding != null) { headers = val2.get_Headers(); headers.Add("x-ms-blob-content-encoding", blobContentEncoding); } if (blobContentLanguage != null) { headers = val2.get_Headers(); headers.Add("x-ms-blob-content-language", blobContentLanguage); } if (blobContentMD5 != null) val2.get_Headers().Add("x-ms-blob-content-md5", blobContentMD5, "D"); if (blobCacheControl != null) { headers = val2.get_Headers(); headers.Add("x-ms-blob-cache-control", blobCacheControl); } if (metadata != null) val2.get_Headers().Add("x-ms-meta-", metadata); if (leaseId != null) { headers = val2.get_Headers(); headers.Add("x-ms-lease-id", leaseId); } if (blobContentDisposition != null) { headers = val2.get_Headers(); headers.Add("x-ms-blob-content-disposition", blobContentDisposition); } if (encryptionKey != null) { headers = val2.get_Headers(); headers.Add("x-ms-encryption-key", encryptionKey); } if (encryptionKeySha256 != null) { headers = val2.get_Headers(); headers.Add("x-ms-encryption-key-sha256", encryptionKeySha256); } if (encryptionAlgorithm.HasValue) { headers = val2.get_Headers(); headers.Add("x-ms-encryption-algorithm", encryptionAlgorithm.Value.ToSerialString()); } if (encryptionScope != null) { headers = val2.get_Headers(); headers.Add("x-ms-encryption-scope", encryptionScope); } if (ifModifiedSince.HasValue) val2.get_Headers().Add("If-Modified-Since", ifModifiedSince.Value, "R"); if (ifUnmodifiedSince.HasValue) val2.get_Headers().Add("If-Unmodified-Since", ifUnmodifiedSince.Value, "R"); if (ifMatch != null) { headers = val2.get_Headers(); headers.Add("If-Match", ifMatch); } if (ifNoneMatch != null) { headers = val2.get_Headers(); headers.Add("If-None-Match", ifNoneMatch); } if (ifTags != null) { headers = val2.get_Headers(); headers.Add("x-ms-if-tags", ifTags); } headers = val2.get_Headers(); headers.Add("x-ms-version", _version); if (blobTagsString != null) { headers = val2.get_Headers(); headers.Add("x-ms-tags", blobTagsString); } if (immutabilityPolicyExpiry.HasValue) val2.get_Headers().Add("x-ms-immutability-policy-until-date", immutabilityPolicyExpiry.Value, "R"); if (immutabilityPolicyMode.HasValue) { headers = val2.get_Headers(); headers.Add("x-ms-immutability-policy-mode", immutabilityPolicyMode.Value.ToSerialString()); } if (legalHold.HasValue) val2.get_Headers().Add("x-ms-legal-hold", legalHold.Value); headers = val2.get_Headers(); headers.Add("Accept", "application/xml"); return val; } [AsyncStateMachine(typeof(<CreateAsync>d__8))] public Task<ResponseWithHeaders<AppendBlobCreateHeaders>> CreateAsync(long contentLength, int? timeout = default(int?), string blobContentType = null, string blobContentEncoding = null, string blobContentLanguage = null, byte[] blobContentMD5 = null, string blobCacheControl = null, IDictionary<string, string> metadata = null, string leaseId = null, string blobContentDisposition = null, string encryptionKey = null, string encryptionKeySha256 = null, EncryptionAlgorithmTypeInternal? encryptionAlgorithm = default(EncryptionAlgorithmTypeInternal?), string encryptionScope = null, DateTimeOffset? ifModifiedSince = default(DateTimeOffset?), DateTimeOffset? ifUnmodifiedSince = default(DateTimeOffset?), string ifMatch = null, string ifNoneMatch = null, string ifTags = null, string blobTagsString = null, DateTimeOffset? immutabilityPolicyExpiry = default(DateTimeOffset?), BlobImmutabilityPolicyMode? immutabilityPolicyMode = default(BlobImmutabilityPolicyMode?), bool? legalHold = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { <CreateAsync>d__8 stateMachine = default(<CreateAsync>d__8); stateMachine.<>t__builder = AsyncTaskMethodBuilder<ResponseWithHeaders<AppendBlobCreateHeaders>>.Create(); stateMachine.<>4__this = this; stateMachine.contentLength = contentLength; stateMachine.timeout = timeout; stateMachine.blobContentType = blobContentType; stateMachine.blobContentEncoding = blobContentEncoding; stateMachine.blobContentLanguage = blobContentLanguage; stateMachine.blobContentMD5 = blobContentMD5; stateMachine.blobCacheControl = blobCacheControl; stateMachine.metadata = metadata; stateMachine.leaseId = leaseId; stateMachine.blobContentDisposition = blobContentDisposition; stateMachine.encryptionKey = encryptionKey; stateMachine.encryptionKeySha256 = encryptionKeySha256; stateMachine.encryptionAlgorithm = encryptionAlgorithm; stateMachine.encryptionScope = encryptionScope; stateMachine.ifModifiedSince = ifModifiedSince; stateMachine.ifUnmodifiedSince = ifUnmodifiedSince; stateMachine.ifMatch = ifMatch; stateMachine.ifNoneMatch = ifNoneMatch; stateMachine.ifTags = ifTags; stateMachine.blobTagsString = blobTagsString; stateMachine.immutabilityPolicyExpiry = immutabilityPolicyExpiry; stateMachine.immutabilityPolicyMode = immutabilityPolicyMode; stateMachine.legalHold = legalHold; stateMachine.cancellationToken = cancellationToken; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; } public ResponseWithHeaders<AppendBlobCreateHeaders> Create(long contentLength, int? timeout = default(int?), string blobContentType = null, string blobContentEncoding = null, string blobContentLanguage = null, byte[] blobContentMD5 = null, string blobCacheControl = null, IDictionary<string, string> metadata = null, string leaseId = null, string blobContentDisposition = null, string encryptionKey = null, string encryptionKeySha256 = null, EncryptionAlgorithmTypeInternal? encryptionAlgorithm = default(EncryptionAlgorithmTypeInternal?), string encryptionScope = null, DateTimeOffset? ifModifiedSince = default(DateTimeOffset?), DateTimeOffset? ifUnmodifiedSince = default(DateTimeOffset?), string ifMatch = null, string ifNoneMatch = null, string ifTags = null, string blobTagsString = null, DateTimeOffset? immutabilityPolicyExpiry = default(DateTimeOffset?), BlobImmutabilityPolicyMode? immutabilityPolicyMode = default(BlobImmutabilityPolicyMode?), bool? legalHold = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { HttpMessage val = CreateCreateRequest(contentLength, timeout, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5, blobCacheControl, metadata, leaseId, blobContentDisposition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, blobTagsString, immutabilityPolicyExpiry, immutabilityPolicyMode, legalHold); try { _pipeline.Send(val, cancellationToken); AppendBlobCreateHeaders headers = new AppendBlobCreateHeaders(val.get_Response()); if (val.get_Response().get_Status() != 201) throw new RequestFailedException(val.get_Response()); return ResponseWithHeaders.FromValue(headers, val.get_Response()); } finally { ((IDisposable)val)?.Dispose(); } } internal HttpMessage CreateAppendBlockRequest(long contentLength, Stream body, int? timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, string leaseId, long? maxSize, long? appendPosition, string encryptionKey, string encryptionKeySha256, EncryptionAlgorithmTypeInternal? encryptionAlgorithm, string encryptionScope, DateTimeOffset? ifModifiedSince, DateTimeOffset? ifUnmodifiedSince, string ifMatch, string ifNoneMatch, string ifTags, string structuredBodyType, long? structuredContentLength) { HttpMessage val = _pipeline.CreateMessage(); Request val2 = val.get_Request(); val2.set_Method(RequestMethod.get_Put()); RawRequestUriBuilder rawRequestUriBuilder = new RawRequestUriBuilder(); rawRequestUriBuilder.AppendRaw(_url, false); rawRequestUriBuilder.AppendQuery("comp", "appendblock", true); if (timeout.HasValue) rawRequestUriBuilder.AppendQuery("timeout", timeout.Value, true); val2.set_Uri(rawRequestUriBuilder); if (transactionalContentCrc64 != null) val2.get_Headers().Add("x-ms-content-crc64", transactionalContentCrc64, "D"); RequestHeaders headers; if (leaseId != null) { headers = val2.get_Headers(); headers.Add("x-ms-lease-id", leaseId); } if (maxSize.HasValue) val2.get_Headers().Add("x-ms-blob-condition-maxsize", maxSize.Value); if (appendPosition.HasValue) val2.get_Headers().Add("x-ms-blob-condition-appendpos", appendPosition.Value); if (encryptionKey != null) { headers = val2.get_Headers(); headers.Add("x-ms-encryption-key", encryptionKey); } if (encryptionKeySha256 != null) { headers = val2.get_Headers(); headers.Add("x-ms-encryption-key-sha256", encryptionKeySha256); } if (encryptionAlgorithm.HasValue) { headers = val2.get_Headers(); headers.Add("x-ms-encryption-algorithm", encryptionAlgorithm.Value.ToSerialString()); } if (encryptionScope != null) { headers = val2.get_Headers(); headers.Add("x-ms-encryption-scope", encryptionScope); } if (ifModifiedSince.HasValue) val2.get_Headers().Add("If-Modified-Since", ifModifiedSince.Value, "R"); if (ifUnmodifiedSince.HasValue) val2.get_Headers().Add("If-Unmodified-Since", ifUnmodifiedSince.Value, "R"); if (ifMatch != null) { headers = val2.get_Headers(); headers.Add("If-Match", ifMatch); } if (ifNoneMatch != null) { headers = val2.get_Headers(); headers.Add("If-None-Match", ifNoneMatch); } if (ifTags != null) { headers = val2.get_Headers(); headers.Add("x-ms-if-tags", ifTags); } headers = val2.get_Headers(); headers.Add("x-ms-version", _version); if (structuredBodyType != null) { headers = val2.get_Headers(); headers.Add("x-ms-structured-body", structuredBodyType); } if (structuredContentLength.HasValue) val2.get_Headers().Add("x-ms-structured-content-length", structuredContentLength.Value); headers = val2.get_Headers(); headers.Add("Accept", "application/xml"); val2.get_Headers().Add("Content-Length", contentLength); if (transactionalContentMD5 != null) val2.get_Headers().Add("Content-MD5", transactionalContentMD5, "D"); headers = val2.get_Headers(); headers.Add("Content-Type", "application/octet-stream"); val2.set_Content(RequestContent.Create(body)); return val; } [AsyncStateMachine(typeof(<AppendBlockAsync>d__11))] public Task<ResponseWithHeaders<AppendBlobAppendBlockHeaders>> AppendBlockAsync(long contentLength, Stream body, int? timeout = default(int?), byte[] transactionalContentMD5 = null, byte[] transactionalContentCrc64 = null, string leaseId = null, long? maxSize = default(long?), long? appendPosition = default(long?), string encryptionKey = null, string encryptionKeySha256 = null, EncryptionAlgorithmTypeInternal? encryptionAlgorithm = default(EncryptionAlgorithmTypeInternal?), string encryptionScope = null, DateTimeOffset? ifModifiedSince = default(DateTimeOffset?), DateTimeOffset? ifUnmodifiedSince = default(DateTimeOffset?), string ifMatch = null, string ifNoneMatch = null, string ifTags = null, string structuredBodyType = null, long? structuredContentLength = default(long?), CancellationToken cancellationToken = default(CancellationToken)) { <AppendBlockAsync>d__11 stateMachine = default(<AppendBlockAsync>d__11); stateMachine.<>t__builder = AsyncTaskMethodBuilder<ResponseWithHeaders<AppendBlobAppendBlockHeaders>>.Create(); stateMachine.<>4__this = this; stateMachine.contentLength = contentLength; stateMachine.body = body; stateMachine.timeout = timeout; stateMachine.transactionalContentMD5 = transactionalContentMD5; stateMachine.transactionalContentCrc64 = transactionalContentCrc64; stateMachine.leaseId = leaseId; stateMachine.maxSize = maxSize; stateMachine.appendPosition = appendPosition; stateMachine.encryptionKey = encryptionKey; stateMachine.encryptionKeySha256 = encryptionKeySha256; stateMachine.encryptionAlgorithm = encryptionAlgorithm; stateMachine.encryptionScope = encryptionScope; stateMachine.ifModifiedSince = ifModifiedSince; stateMachine.ifUnmodifiedSince = ifUnmodifiedSince; stateMachine.ifMatch = ifMatch; stateMachine.ifNoneMatch = ifNoneMatch; stateMachine.ifTags = ifTags; stateMachine.structuredBodyType = structuredBodyType; stateMachine.structuredContentLength = structuredContentLength; stateMachine.cancellationToken = cancellationToken; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; } public ResponseWithHeaders<AppendBlobAppendBlockHeaders> AppendBlock(long contentLength, Stream body, int? timeout = default(int?), byte[] transactionalContentMD5 = null, byte[] transactionalContentCrc64 = null, string leaseId = null, long? maxSize = default(long?), long? appendPosition = default(long?), string encryptionKey = null, string encryptionKeySha256 = null, EncryptionAlgorithmTypeInternal? encryptionAlgorithm = default(EncryptionAlgorithmTypeInternal?), string encryptionScope = null, DateTimeOffset? ifModifiedSince = default(DateTimeOffset?), DateTimeOffset? ifUnmodifiedSince = default(DateTimeOffset?), string ifMatch = null, string ifNoneMatch = null, string ifTags = null, string structuredBodyType = null, long? structuredContentLength = default(long?), CancellationToken cancellationToken = default(CancellationToken)) { if (body != null) { HttpMessage val = CreateAppendBlockRequest(contentLength, body, timeout, transactionalContentMD5, transactionalContentCrc64, leaseId, maxSize, appendPosition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, structuredBodyType, structuredContentLength); try { _pipeline.Send(val, cancellationToken); AppendBlobAppendBlockHeaders headers = new AppendBlobAppendBlockHeaders(val.get_Response()); if (val.get_Response().get_Status() != 201) throw new RequestFailedException(val.get_Response()); return ResponseWithHeaders.FromValue(headers, val.get_Response()); } finally { ((IDisposable)val)?.Dispose(); } } throw new ArgumentNullException("body"); } internal HttpMessage CreateAppendBlockFromUrlRequest(string sourceUrl, long contentLength, string sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, int? timeout, byte[] transactionalContentMD5, string encryptionKey, string encryptionKeySha256, EncryptionAlgorithmTypeInternal? encryptionAlgorithm, string encryptionScope, string leaseId, long? maxSize, long? appendPosition, DateTimeOffset? ifModifiedSince, DateTimeOffset? ifUnmodifiedSince, string ifMatch, string ifNoneMatch, string ifTags, DateTimeOffset? sourceIfModifiedSince, DateTimeOffset? sourceIfUnmodifiedSince, string sourceIfMatch, string sourceIfNoneMatch, string copySourceAuthorization, FileShareTokenIntent? fileRequestIntent) { HttpMessage val = _pipeline.CreateMessage(); Request val2 = val.get_Request(); val2.set_Method(RequestMethod.get_Put()); RawRequestUriBuilder rawRequestUriBuilder = new RawRequestUriBuilder(); rawRequestUriBuilder.AppendRaw(_url, false); rawRequestUriBuilder.AppendQuery("comp", "appendblock", true); if (timeout.HasValue) rawRequestUriBuilder.AppendQuery("timeout", timeout.Value, true); val2.set_Uri(rawRequestUriBuilder); RequestHeaders headers = val2.get_Headers(); headers.Add("x-ms-copy-source", sourceUrl); if (sourceRange != null) { headers = val2.get_Headers(); headers.Add("x-ms-source-range", sourceRange); } if (sourceContentMD5 != null) val2.get_Headers().Add("x-ms-source-content-md5", sourceContentMD5, "D"); if (sourceContentcrc64 != null) val2.get_Headers().Add("x-ms-source-content-crc64", sourceContentcrc64, "D"); if (encryptionKey != null) { headers = val2.get_Headers(); headers.Add("x-ms-encryption-key", encryptionKey); } if (encryptionKeySha256 != null) { headers = val2.get_Headers(); headers.Add("x-ms-encryption-key-sha256", encryptionKeySha256); } if (encryptionAlgorithm.HasValue) { headers = val2.get_Headers(); headers.Add("x-ms-encryption-algorithm", encryptionAlgorithm.Value.ToSerialString()); } if (encryptionScope != null) { headers = val2.get_Headers(); headers.Add("x-ms-encryption-scope", encryptionScope); } if (leaseId != null) { headers = val2.get_Headers(); headers.Add("x-ms-lease-id", leaseId); } if (maxSize.HasValue) val2.get_Headers().Add("x-ms-blob-condition-maxsize", maxSize.Value); if (appendPosition.HasValue) val2.get_Headers().Add("x-ms-blob-condition-appendpos", appendPosition.Value); if (ifModifiedSince.HasValue) val2.get_Headers().Add("If-Modified-Since", ifModifiedSince.Value, "R"); if (ifUnmodifiedSince.HasValue) val2.get_Headers().Add("If-Unmodified-Since", ifUnmodifiedSince.Value, "R"); if (ifMatch != null) { headers = val2.get_Headers(); headers.Add("If-Match", ifMatch); } if (ifNoneMatch != null) { headers = val2.get_Headers(); headers.Add("If-None-Match", ifNoneMatch); } if (ifTags != null) { headers = val2.get_Headers(); headers.Add("x-ms-if-tags", ifTags); } if (sourceIfModifiedSince.HasValue) val2.get_Headers().Add("x-ms-source-if-modified-since", sourceIfModifiedSince.Value, "R"); if (sourceIfUnmodifiedSince.HasValue) val2.get_Headers().Add("x-ms-source-if-unmodified-since", sourceIfUnmodifiedSince.Value, "R"); if (sourceIfMatch != null) { headers = val2.get_Headers(); headers.Add("x-ms-source-if-match", sourceIfMatch); } if (sourceIfNoneMatch != null) { headers = val2.get_Headers(); headers.Add("x-ms-source-if-none-match", sourceIfNoneMatch); } headers = val2.get_Headers(); headers.Add("x-ms-version", _version); if (copySourceAuthorization != null) { headers = val2.get_Headers(); headers.Add("x-ms-copy-source-authorization", copySourceAuthorization); } if (fileRequestIntent.HasValue) { headers = val2.get_Headers(); headers.Add("x-ms-file-request-intent", fileRequestIntent.Value.ToString()); } headers = val2.get_Headers(); headers.Add("Accept", "application/xml"); return val; } [AsyncStateMachine(typeof(<AppendBlockFromUrlAsync>d__14))] public Task<ResponseWithHeaders<AppendBlobAppendBlockFromUrlHeaders>> AppendBlockFromUrlAsync(string sourceUrl, long contentLength, string sourceRange = null, byte[] sourceContentMD5 = null, byte[] sourceContentcrc64 = null, int? timeout = default(int?), byte[] transactionalContentMD5 = null, string encryptionKey = null, string encryptionKeySha256 = null, EncryptionAlgorithmTypeInternal? encryptionAlgorithm = default(EncryptionAlgorithmTypeInternal?), string encryptionScope = null, string leaseId = null, long? maxSize = default(long?), long? appendPosition = default(long?), DateTimeOffset? ifModifiedSince = default(DateTimeOffset?), DateTimeOffset? ifUnmodifiedSince = default(DateTimeOffset?), string ifMatch = null, string ifNoneMatch = null, string ifTags = null, DateTimeOffset? sourceIfModifiedSince = default(DateTimeOffset?), DateTimeOffset? sourceIfUnmodifiedSince = default(DateTimeOffset?), string sourceIfMatch = null, string sourceIfNoneMatch = null, string copySourceAuthorization = null, FileShareTokenIntent? fileRequestIntent = default(FileShareTokenIntent?), CancellationToken cancellationToken = default(CancellationToken)) { <AppendBlockFromUrlAsync>d__14 stateMachine = default(<AppendBlockFromUrlAsync>d__14); stateMachine.<>t__builder = AsyncTaskMethodBuilder<ResponseWithHeaders<AppendBlobAppendBlockFromUrlHeaders>>.Create(); stateMachine.<>4__this = this; stateMachine.sourceUrl = sourceUrl; stateMachine.contentLength = contentLength; stateMachine.sourceRange = sourceRange; stateMachine.sourceContentMD5 = sourceContentMD5; stateMachine.sourceContentcrc64 = sourceContentcrc64; stateMachine.timeout = timeout; stateMachine.transactionalContentMD5 = transactionalContentMD5; stateMachine.encryptionKey = encryptionKey; stateMachine.encryptionKeySha256 = encryptionKeySha256; stateMachine.encryptionAlgorithm = encryptionAlgorithm; stateMachine.encryptionScope = encryptionScope; stateMachine.leaseId = leaseId; stateMachine.maxSize = maxSize; stateMachine.appendPosition = appendPosition; stateMachine.ifModifiedSince = ifModifiedSince; stateMachine.ifUnmodifiedSince = ifUnmodifiedSince; stateMachine.ifMatch = ifMatch; stateMachine.ifNoneMatch = ifNoneMatch; stateMachine.ifTags = ifTags; stateMachine.sourceIfModifiedSince = sourceIfModifiedSince; stateMachine.sourceIfUnmodifiedSince = sourceIfUnmodifiedSince; stateMachine.sourceIfMatch = sourceIfMatch; stateMachine.sourceIfNoneMatch = sourceIfNoneMatch; stateMachine.copySourceAuthorization = copySourceAuthorization; stateMachine.fileRequestIntent = fileRequestIntent; stateMachine.cancellationToken = cancellationToken; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; } public ResponseWithHeaders<AppendBlobAppendBlockFromUrlHeaders> AppendBlockFromUrl(string sourceUrl, long contentLength, string sourceRange = null, byte[] sourceContentMD5 = null, byte[] sourceContentcrc64 = null, int? timeout = default(int?), byte[] transactionalContentMD5 = null, string encryptionKey = null, string encryptionKeySha256 = null, EncryptionAlgorithmTypeInternal? encryptionAlgorithm = default(EncryptionAlgorithmTypeInternal?), string encryptionScope = null, string leaseId = null, long? maxSize = default(long?), long? appendPosition = default(long?), DateTimeOffset? ifModifiedSince = default(DateTimeOffset?), DateTimeOffset? ifUnmodifiedSince = default(DateTimeOffset?), string ifMatch = null, string ifNoneMatch = null, string ifTags = null, DateTimeOffset? sourceIfModifiedSince = default(DateTimeOffset?), DateTimeOffset? sourceIfUnmodifiedSince = default(DateTimeOffset?), string sourceIfMatch = null, string sourceIfNoneMatch = null, string copySourceAuthorization = null, FileShareTokenIntent? fileRequestIntent = default(FileShareTokenIntent?), CancellationToken cancellationToken = default(CancellationToken)) { if (sourceUrl != null) { HttpMessage val = CreateAppendBlockFromUrlRequest(sourceUrl, contentLength, sourceRange, sourceContentMD5, sourceContentcrc64, timeout, transactionalContentMD5, encryptionKey, encryptionKeySha256, encryptionAlgorithm, encryptionScope, leaseId, maxSize, appendPosition, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, ifTags, sourceIfModifiedSince, sourceIfUnmodifiedSince, sourceIfMatch, sourceIfNoneMatch, copySourceAuthorization, fileRequestIntent); try { _pipeline.Send(val, cancellationToken); AppendBlobAppendBlockFromUrlHeaders headers = new AppendBlobAppendBlockFromUrlHeaders(val.get_Response()); if (val.get_Response().get_Status() != 201) throw new RequestFailedException(val.get_Response()); return ResponseWithHeaders.FromValue(headers, val.get_Response()); } finally { ((IDisposable)val)?.Dispose(); } } throw new ArgumentNullException("sourceUrl"); } internal HttpMessage CreateSealRequest(int? timeout, string leaseId, DateTimeOffset? ifModifiedSince, DateTimeOffset? ifUnmodifiedSince, string ifMatch, string ifNoneMatch, long? appendPosition) { HttpMessage val = _pipeline.CreateMessage(); Request val2 = val.get_Request(); val2.set_Method(RequestMethod.get_Put()); RawRequestUriBuilder rawRequestUriBuilder = new RawRequestUriBuilder(); rawRequestUriBuilder.AppendRaw(_url, false); rawRequestUriBuilder.AppendQuery("comp", "seal", true); if (timeout.HasValue) rawRequestUriBuilder.AppendQuery("timeout", timeout.Value, true); val2.set_Uri(rawRequestUriBuilder); RequestHeaders headers = val2.get_Headers(); headers.Add("x-ms-version", _version); if (leaseId != null) { headers = val2.get_Headers(); headers.Add("x-ms-lease-id", leaseId); } if (ifModifiedSince.HasValue) val2.get_Headers().Add("If-Modified-Since", ifModifiedSince.Value, "R"); if (ifUnmodifiedSince.HasValue) val2.get_Headers().Add("If-Unmodified-Since", ifUnmodifiedSince.Value, "R"); if (ifMatch != null) { headers = val2.get_Headers(); headers.Add("If-Match", ifMatch); } if (ifNoneMatch != null) { headers = val2.get_Headers(); headers.Add("If-None-Match", ifNoneMatch); } if (appendPosition.HasValue) val2.get_Headers().Add("x-ms-blob-condition-appendpos", appendPosition.Value); headers = val2.get_Headers(); headers.Add("Accept", "application/xml"); return val; } [AsyncStateMachine(typeof(<SealAsync>d__17))] public Task<ResponseWithHeaders<AppendBlobSealHeaders>> SealAsync(int? timeout = default(int?), string leaseId = null, DateTimeOffset? ifModifiedSince = default(DateTimeOffset?), DateTimeOffset? ifUnmodifiedSince = default(DateTimeOffset?), string ifMatch = null, string ifNoneMatch = null, long? appendPosition = default(long?), CancellationToken cancellationToken = default(CancellationToken)) { <SealAsync>d__17 stateMachine = default(<SealAsync>d__17); stateMachine.<>t__builder = AsyncTaskMethodBuilder<ResponseWithHeaders<AppendBlobSealHeaders>>.Create(); stateMachine.<>4__this = this; stateMachine.timeout = timeout; stateMachine.leaseId = leaseId; stateMachine.ifModifiedSince = ifModifiedSince; stateMachine.ifUnmodifiedSince = ifUnmodifiedSince; stateMachine.ifMatch = ifMatch; stateMachine.ifNoneMatch = ifNoneMatch; stateMachine.appendPosition = appendPosition; stateMachine.cancellationToken = cancellationToken; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; } public ResponseWithHeaders<AppendBlobSealHeaders> Seal(int? timeout = default(int?), string leaseId = null, DateTimeOffset? ifModifiedSince = default(DateTimeOffset?), DateTimeOffset? ifUnmodifiedSince = default(DateTimeOffset?), string ifMatch = null, string ifNoneMatch = null, long? appendPosition = default(long?), CancellationToken cancellationToken = default(CancellationToken)) { HttpMessage val = CreateSealRequest(timeout, leaseId, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, appendPosition); try { _pipeline.Send(val, cancellationToken); AppendBlobSealHeaders headers = new AppendBlobSealHeaders(val.get_Response()); if (val.get_Response().get_Status() != 200) throw new RequestFailedException(val.get_Response()); return ResponseWithHeaders.FromValue(headers, val.get_Response()); } finally { ((IDisposable)val)?.Dispose(); } } } }