示例#1
0
        public virtual Response <DiagnosticSettingsResource> Get(string name, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(name, nameof(name));

            using var scope = _diagnosticSettingsDiagnosticSettingsClientDiagnostics.CreateScope("DiagnosticSettingsCollection.Get");
            scope.Start();
            try
            {
                var response = _diagnosticSettingsDiagnosticSettingsRestClient.Get(Id, name, cancellationToken);
                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new DiagnosticSettingsResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
示例#2
0
 public virtual Response <DiagnosticSettingsResource> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _diagnosticSettingsDiagnosticSettingsClientDiagnostics.CreateScope("DiagnosticSettingsResource.Get");
     scope.Start();
     try
     {
         var response = _diagnosticSettingsDiagnosticSettingsRestClient.Get(Id.Parent, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new DiagnosticSettingsResource(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }