コード例 #1
0
 /// <summary>
 /// 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.
 /// </summary>
 /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</param>
 /// <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>
 /// <param name="async">Whether to invoke the operation asynchronously.  The default value is true.</param>
 /// <param name="operationName">Operation name.</param>
 /// <param name="cancellationToken">Cancellation token.</param>
 /// <returns>Azure.Response</returns>
 public static async System.Threading.Tasks.ValueTask <Azure.Response> SetAccessTierAsync(
     Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics,
     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,
     bool async           = true,
     string operationName = "BlobClient.SetAccessTier",
     System.Threading.CancellationToken cancellationToken = default)
 {
     Azure.Core.Pipeline.DiagnosticScope _scope = clientDiagnostics.CreateScope(operationName);
     try
     {
         _scope.AddAttribute("url", resourceUri);
         _scope.Start();
         using (Azure.Core.HttpMessage _message = SetAccessTierAsync_CreateMessage(
                    pipeline,
                    resourceUri,
                    tier,
                    version,
                    timeout,
                    rehydratePriority,
                    requestId,
                    leaseId))
         {
             if (async)
             {
                 // Send the request asynchronously if we're being called via an async path
                 await pipeline.SendAsync(_message, cancellationToken).ConfigureAwait(false);
             }
             else
             {
                 // Send the request synchronously through the API that blocks if we're being called via a sync path
                 // (this is safe because the Task will complete before the user can call Wait)
                 pipeline.Send(_message, cancellationToken);
             }
             Azure.Response _response = _message.Response;
             cancellationToken.ThrowIfCancellationRequested();
             return(SetAccessTierAsync_CreateResponse(clientDiagnostics, _response));
         }
     }
     catch (System.Exception ex)
     {
         _scope.Failed(ex);
         throw;
     }
     finally
     {
         _scope.Dispose();
     }
 }
コード例 #2
0
            /// <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);
            }
 public virtual Azure.Response SetBlobAccessTier(System.Uri blobUri, Azure.Storage.Blobs.Models.AccessTier accessTier, Azure.Storage.Blobs.Models.RehydratePriority?rehydratePriority = default(Azure.Storage.Blobs.Models.RehydratePriority?), Azure.Storage.Blobs.Models.BlobRequestConditions leaseAccessConditions = null)
 {
     throw null;
 }
 public virtual System.Threading.Tasks.Task <Azure.Response[]> SetBlobsAccessTierAsync(System.Collections.Generic.IEnumerable <System.Uri> blobUris, Azure.Storage.Blobs.Models.AccessTier accessTier, Azure.Storage.Blobs.Models.RehydratePriority?rehydratePriority = default(Azure.Storage.Blobs.Models.RehydratePriority?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     throw null;
 }
 public virtual Azure.Response SetBlobAccessTier(string blobContainerName, string blobName, Azure.Storage.Blobs.Models.AccessTier accessTier, Azure.Storage.Blobs.Models.RehydratePriority?rehydratePriority = default(Azure.Storage.Blobs.Models.RehydratePriority?), Azure.Storage.Blobs.Models.BlobRequestConditions leaseAccessConditions = null)
 {
     throw null;
 }