/// <summary>
            /// Create the Service.SubmitBatchAsync request.
            /// </summary>
            /// <param name="pipeline">The pipeline used for sending requests.</param>
            /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the desired operation.</param>
            /// <param name="body">Initial data</param>
            /// <param name="contentLength">The length of the request.</param>
            /// <param name="multipartContentType">Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_{GUID}</param>
            /// <param name="version">Specifies the version of the operation to use for this request.</param>
            /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a 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>
            /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.</param>
            /// <returns>The Service.SubmitBatchAsync Message.</returns>
            internal static Azure.Core.HttpMessage SubmitBatchAsync_CreateMessage(
                Azure.Core.Pipeline.HttpPipeline pipeline,
                System.Uri resourceUri,
                System.IO.Stream body,
                long contentLength,
                string multipartContentType,
                string version,
                int?timeout      = default,
                string requestId = default)
            {
                // Validation
                if (resourceUri == null)
                {
                    throw new System.ArgumentNullException(nameof(resourceUri));
                }
                if (body == null)
                {
                    throw new System.ArgumentNullException(nameof(body));
                }
                if (multipartContentType == null)
                {
                    throw new System.ArgumentNullException(nameof(multipartContentType));
                }
                if (version == null)
                {
                    throw new System.ArgumentNullException(nameof(version));
                }

                // Create the request
                Azure.Core.HttpMessage _message = pipeline.CreateMessage();
                Azure.Core.Request     _request = _message.Request;

                // Set the endpoint
                _request.Method = Azure.Core.RequestMethod.Post;
                _request.Uri.Reset(resourceUri);
                _request.Uri.AppendQuery("comp", "batch", escapeValue: false);
                if (timeout != null)
                {
                    _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.CultureInfo.InvariantCulture));
                }

                // Add request headers
                _request.Headers.SetValue("Content-Length", contentLength.ToString(System.Globalization.CultureInfo.InvariantCulture));
                _request.Headers.SetValue("Content-Type", multipartContentType);
                _request.Headers.SetValue("x-ms-version", version);
                if (requestId != null)
                {
                    _request.Headers.SetValue("x-ms-client-request-id", requestId);
                }

                // Create the body
                _request.Content = Azure.Core.RequestContent.Create(body);

                return(_message);
            }
            /// <summary>
            /// Create the Blob.SetAccessTierAsync request.
            /// </summary>
            /// <param name="pipeline">The pipeline used for sending requests.</param>
            /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the desired operation.</param>
            /// <param name="tier">Indicates the tier to be set on the blob.</param>
            /// <param name="version">Specifies the version of the operation to use for this request.</param>
            /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a 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>
            /// <param name="rehydratePriority">Optional: Indicates the priority with which to rehydrate an archived blob.</param>
            /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.</param>
            /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and matches this ID.</param>
            /// <returns>The Blob.SetAccessTierAsync Message.</returns>
            internal static Azure.Core.HttpMessage SetAccessTierAsync_CreateMessage(
                Azure.Core.Pipeline.HttpPipeline pipeline,
                System.Uri resourceUri,
                Azure.Storage.Blobs.Models.AccessTier tier,
                string version,
                int?timeout = default,
                Azure.Storage.Blobs.Models.RehydratePriority?rehydratePriority = default,
                string requestId = default,
                string leaseId   = default)
            {
                // Validation
                if (resourceUri == null)
                {
                    throw new System.ArgumentNullException(nameof(resourceUri));
                }
                if (version == null)
                {
                    throw new System.ArgumentNullException(nameof(version));
                }

                // Create the request
                Azure.Core.HttpMessage _message = pipeline.CreateMessage();
                Azure.Core.Request     _request = _message.Request;

                // Set the endpoint
                _request.Method = Azure.Core.RequestMethod.Put;
                _request.Uri.Reset(resourceUri);
                _request.Uri.AppendQuery("comp", "tier", escapeValue: false);
                if (timeout != null)
                {
                    _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.CultureInfo.InvariantCulture));
                }

                // Add request headers
                _request.Headers.SetValue("x-ms-access-tier", tier.ToString());
                _request.Headers.SetValue("x-ms-version", version);
                if (rehydratePriority != null)
                {
                    _request.Headers.SetValue("x-ms-rehydrate-priority", rehydratePriority.Value.ToString());
                }
                if (requestId != null)
                {
                    _request.Headers.SetValue("x-ms-client-request-id", requestId);
                }
                if (leaseId != null)
                {
                    _request.Headers.SetValue("x-ms-lease-id", leaseId);
                }

                return(_message);
            }
Exemple #3
0
            /// <summary>
            /// Create the Blob.DeleteAsync request.
            /// </summary>
            /// <param name="pipeline">The pipeline used for sending requests.</param>
            /// <param name="resourceUri">The URL of the service account, container, or blob that is the targe of the desired operation.</param>
            /// <param name="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>
            /// <param name="timeout">The timeout parameter is expressed in seconds. For more information, see <a 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>
            /// <param name="leaseId">If specified, the operation only succeeds if the resource's lease is active and matches this ID.</param>
            /// <param name="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>
            /// <param name="ifModifiedSince">Specify this header value to operate only on a blob if it has been modified since the specified date/time.</param>
            /// <param name="ifUnmodifiedSince">Specify this header value to operate only on a blob if it has not been modified since the specified date/time.</param>
            /// <param name="ifMatch">Specify an ETag value to operate only on blobs with a matching value.</param>
            /// <param name="ifNoneMatch">Specify an ETag value to operate only on blobs without a matching value.</param>
            /// <param name="requestId">Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.</param>
            /// <returns>The Blob.DeleteAsync Message.</returns>
            internal static Azure.Core.HttpMessage DeleteAsync_CreateMessage(
                Azure.Core.Pipeline.HttpPipeline pipeline,
                System.Uri resourceUri,
                string snapshot = default,
                int?timeout     = default,
                string leaseId  = default,
                Azure.Storage.Blobs.Models.DeleteSnapshotsOption?deleteSnapshots = default,
                System.DateTimeOffset?ifModifiedSince   = default,
                System.DateTimeOffset?ifUnmodifiedSince = default,
                Azure.ETag?ifMatch     = default,
                Azure.ETag?ifNoneMatch = default,
                string requestId       = default)
            {
                // Validation
                if (resourceUri == null)
                {
                    throw new System.ArgumentNullException(nameof(resourceUri));
                }

                // Create the request
                Azure.Core.HttpMessage _message = pipeline.CreateMessage();
                Azure.Core.Request     _request = _message.Request;

                // Set the endpoint
                _request.Method = Azure.Core.RequestMethod.Delete;
                _request.Uri.Reset(resourceUri);
                if (snapshot != null)
                {
                    _request.Uri.AppendQuery("snapshot", snapshot);
                }
                if (timeout != null)
                {
                    _request.Uri.AppendQuery("timeout", timeout.Value.ToString(System.Globalization.CultureInfo.InvariantCulture));
                }

                // Add request headers
                _request.Headers.SetValue("x-ms-version", "2019-02-02");
                if (leaseId != null)
                {
                    _request.Headers.SetValue("x-ms-lease-id", leaseId);
                }
                if (deleteSnapshots != null)
                {
                    _request.Headers.SetValue("x-ms-delete-snapshots", Azure.Storage.Blobs.BatchRestClient.Serialization.ToString(deleteSnapshots.Value));
                }
                if (ifModifiedSince != null)
                {
                    _request.Headers.SetValue("If-Modified-Since", ifModifiedSince.Value.ToString("R", System.Globalization.CultureInfo.InvariantCulture));
                }
                if (ifUnmodifiedSince != null)
                {
                    _request.Headers.SetValue("If-Unmodified-Since", ifUnmodifiedSince.Value.ToString("R", System.Globalization.CultureInfo.InvariantCulture));
                }
                if (ifMatch != null)
                {
                    _request.Headers.SetValue("If-Match", ifMatch.Value.ToString());
                }
                if (ifNoneMatch != null)
                {
                    _request.Headers.SetValue("If-None-Match", ifNoneMatch.Value.ToString());
                }
                if (requestId != null)
                {
                    _request.Headers.SetValue("x-ms-client-request-id", requestId);
                }

                return(_message);
            }