Exemple #1
0
 public virtual Response<EncryptionProtectorResource> Get(EncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default)
 {
     using var scope = _encryptionProtectorClientDiagnostics.CreateScope("EncryptionProtectorCollection.Get");
     scope.Start();
     try
     {
         var response = _encryptionProtectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionProtectorName, cancellationToken);
         if (response.Value == null)
             throw new RequestFailedException(response.GetRawResponse());
         return Response.FromValue(new EncryptionProtectorResource(Client, response.Value), response.GetRawResponse());
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
 public virtual Response <EncryptionProtector> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("EncryptionProtector.Get");
     scope.Start();
     try
     {
         var response = _encryptionProtectorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new EncryptionProtector(this, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }