/// <summary> /// The Batch operation allows multiple API calls to be embedded into a single HTTP request. /// </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="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> /// <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{Azure.Storage.Blobs.Models.BlobBatchResult}</returns> public static async System.Threading.Tasks.ValueTask <Azure.Response <Azure.Storage.Blobs.Models.BlobBatchResult> > SubmitBatchAsync( Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, Azure.Core.Pipeline.HttpPipeline pipeline, System.Uri resourceUri, System.IO.Stream body, long contentLength, string multipartContentType, string version, int?timeout = default, string requestId = default, bool async = true, string operationName = "ServiceClient.SubmitBatch", 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 = SubmitBatchAsync_CreateMessage( pipeline, resourceUri, body, contentLength, multipartContentType, version, timeout, requestId)) { 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(SubmitBatchAsync_CreateResponse(clientDiagnostics, _response)); } } catch (System.Exception ex) { _scope.Failed(ex); throw; } finally { _scope.Dispose(); } }
/// <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(); } }
/// <summary> /// 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). /// </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> /// <param name="async">Whether to invoke the operation asynchronously. The default value is true.</param> /// <param name="clientDiagnostics">The ClientDiagnostics instance used for operation reporting.</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> DeleteAsync( Azure.Core.Pipeline.ClientDiagnostics clientDiagnostics, 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, bool async = true, string operationName = "Azure.Storage.Blobs.BlobClient.Delete", 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 = DeleteAsync_CreateMessage( pipeline, resourceUri, snapshot, timeout, leaseId, deleteSnapshots, ifModifiedSince, ifUnmodifiedSince, ifMatch, ifNoneMatch, requestId)) { 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(DeleteAsync_CreateResponse(_response)); } } catch (System.Exception ex) { _scope.Failed(ex); throw; } finally { _scope.Dispose(); } }