Ejemplo n.º 1
0
        public virtual Response <ApiPortalResource> Get(string apiPortalName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(apiPortalName, nameof(apiPortalName));

            using var scope = _apiPortalResourceApiPortalsClientDiagnostics.CreateScope("ApiPortalResourceCollection.Get");
            scope.Start();
            try
            {
                var response = _apiPortalResourceApiPortalsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, apiPortalName, cancellationToken);
                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new ApiPortalResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Ejemplo n.º 2
0
 public virtual Response <ApiPortalResource> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _apiPortalResourceApiPortalsClientDiagnostics.CreateScope("ApiPortalResource.Get");
     scope.Start();
     try
     {
         var response = _apiPortalResourceApiPortalsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new ApiPortalResource(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }