Beispiel #1
0
 public virtual Response <LogProfileResource> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _logProfileClientDiagnostics.CreateScope("LogProfileResource.Get");
     scope.Start();
     try
     {
         var response = _logProfileRestClient.Get(Id.SubscriptionId, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new LogProfileResource(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
Beispiel #2
0
        public virtual Response <LogProfileResource> Get(string logProfileName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(logProfileName, nameof(logProfileName));

            using var scope = _logProfileClientDiagnostics.CreateScope("LogProfileCollection.Get");
            scope.Start();
            try
            {
                var response = _logProfileRestClient.Get(Id.SubscriptionId, logProfileName, cancellationToken);
                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new LogProfileResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }