示例#1
0
 public virtual Response <VirtualClusterResource> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _virtualClusterClientDiagnostics.CreateScope("VirtualClusterResource.Get");
     scope.Start();
     try
     {
         var response = _virtualClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new VirtualClusterResource(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
示例#2
0
        public virtual Response <VirtualCluster> Get(string virtualClusterName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(virtualClusterName, nameof(virtualClusterName));

            using var scope = _virtualClusterClientDiagnostics.CreateScope("VirtualClusterCollection.Get");
            scope.Start();
            try
            {
                var response = _virtualClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualClusterName, cancellationToken);
                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new VirtualCluster(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }