public async virtual Task <BlobContainerDeleteImmutabilityPolicyOperation> DeleteAsync(string ifMatch, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (ifMatch == null) { throw new ArgumentNullException(nameof(ifMatch)); } using var scope = _clientDiagnostics.CreateScope("ImmutabilityPolicy.Delete"); scope.Start(); try { var response = await _blobContainersRestClient.DeleteImmutabilityPolicyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Name, ifMatch, cancellationToken).ConfigureAwait(false); var operation = new BlobContainerDeleteImmutabilityPolicyOperation(response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <ImmutabilityPolicy> > DeleteImmutabilityPolicyAsync(string ifMatch, CancellationToken cancellationToken = default) { if (ifMatch == null) { throw new ArgumentNullException(nameof(ifMatch)); } using var scope = _clientDiagnostics.CreateScope("BlobContainer.DeleteImmutabilityPolicy"); scope.Start(); try { var response = await _restClient.DeleteImmutabilityPolicyAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); return(response); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ArmOperation <ImmutabilityPolicy> > DeleteAsync(bool waitForCompletion, string ifMatch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(ifMatch, nameof(ifMatch)); using var scope = _immutabilityPolicyBlobContainersClientDiagnostics.CreateScope("ImmutabilityPolicy.Delete"); scope.Start(); try { var response = await _immutabilityPolicyBlobContainersRestClient.DeleteImmutabilityPolicyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Name, ifMatch, cancellationToken).ConfigureAwait(false); var operation = new StorageArmOperation <ImmutabilityPolicy>(Response.FromValue(new ImmutabilityPolicy(Client, response), response.GetRawResponse())); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }