示例#1
0
 public virtual Response <ImmutabilityPolicy> GetImmutabilityPolicy(string ifMatch = null, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("BlobContainer.GetImmutabilityPolicy");
     scope.Start();
     try
     {
         var response = _restClient.GetImmutabilityPolicy(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ifMatch, cancellationToken);
         return(response);
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
 public virtual Response <ImmutabilityPolicy> Get(string ifMatch = null, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("ImmutabilityPolicy.Get");
     scope.Start();
     try
     {
         var response = _blobContainersRestClient.GetImmutabilityPolicy(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Name, ifMatch, cancellationToken);
         if (response.Value == null)
         {
             throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new ImmutabilityPolicy(this, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }