Exemplo n.º 1
0
 public virtual Response <Certificate> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _certificateClientDiagnostics.CreateScope("Certificate.Get");
     scope.Start();
     try
     {
         var response = _certificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw _certificateClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new Certificate(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
        public virtual Response <Certificate> Get(string name, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(name, nameof(name));

            using var scope = _certificateClientDiagnostics.CreateScope("CertificateCollection.Get");
            scope.Start();
            try
            {
                var response = _certificateRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken);
                if (response.Value == null)
                {
                    throw _certificateClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new Certificate(ArmClient, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }