예제 #1
0
 public virtual Response <CommunicationServiceResource> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _communicationServiceClientDiagnostics.CreateScope("CommunicationServiceResource.Get");
     scope.Start();
     try
     {
         var response = _communicationServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new CommunicationServiceResource(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
        public virtual Response <CommunicationService> Get(string communicationServiceName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(communicationServiceName, nameof(communicationServiceName));

            using var scope = _communicationServiceClientDiagnostics.CreateScope("CommunicationServiceCollection.Get");
            scope.Start();
            try
            {
                var response = _communicationServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, communicationServiceName, cancellationToken);
                if (response.Value == null)
                {
                    throw _communicationServiceClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new CommunicationService(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }