Example #1
0
        public virtual Response <ServerTrustGroup> Get(string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default)
        {
            if (locationName == null)
            {
                throw new ArgumentNullException(nameof(locationName));
            }
            if (serverTrustGroupName == null)
            {
                throw new ArgumentNullException(nameof(serverTrustGroupName));
            }

            using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupCollection.Get");
            scope.Start();
            try
            {
                var response = _serverTrustGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, locationName, serverTrustGroupName, cancellationToken);
                if (response.Value == null)
                {
                    throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new ServerTrustGroup(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Example #2
0
 public virtual Response <ServerTrustGroup> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _serverTrustGroupClientDiagnostics.CreateScope("ServerTrustGroup.Get");
     scope.Start();
     try
     {
         var response = _serverTrustGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new ServerTrustGroup(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }