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

            using var scope = _webPubSubClientDiagnostics.CreateScope("WebPubSubCollection.Get");
            scope.Start();
            try
            {
                var response = _webPubSubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken);
                if (response.Value == null)
                {
                    throw _webPubSubClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new WebPubSub(ArmClient, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }