public virtual Response <SharedGalleryImage> Get(string galleryImageName, CancellationToken cancellationToken = default)
        {
            if (galleryImageName == null)
            {
                throw new ArgumentNullException(nameof(galleryImageName));
            }

            using var scope = _clientDiagnostics.CreateScope("SharedGalleryImageCollection.Get");
            scope.Start();
            try
            {
                var response = _sharedGalleryImagesRestClient.Get(Id.SubscriptionId, Id.Parent.Name, Id.Name, galleryImageName, cancellationToken);
                if (response.Value == null)
                {
                    throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                response.Value.Id = SharedGalleryImage.CreateResourceIdentifier(Id.SubscriptionId, Id.Parent.Name, Id.Name, galleryImageName);
                return(Response.FromValue(new SharedGalleryImage(this, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
        public virtual Response <SharedGalleryImage> Get(string galleryImageName, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("SharedGalleryImageContainer.Get");
            scope.Start();
            try
            {
                if (galleryImageName == null)
                {
                    throw new ArgumentNullException(nameof(galleryImageName));
                }

                var response = _restClient.Get(Id.Parent.Name, Id.Name, galleryImageName, cancellationToken: cancellationToken);
                if (response.Value == null)
                {
                    throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new SharedGalleryImage(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
 public virtual Response <SharedGalleryImage> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("SharedGalleryImage.Get");
     scope.Start();
     try
     {
         var response = _restClient.Get(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new SharedGalleryImage(this, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
예제 #4
0
 public virtual Response <SharedGalleryImageResource> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _sharedGalleryImageClientDiagnostics.CreateScope("SharedGalleryImageResource.Get");
     scope.Start();
     try
     {
         var response = _sharedGalleryImageRestClient.Get(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         response.Value.Id = CreateResourceIdentifier(Id.SubscriptionId, new AzureLocation(Id.Parent.Parent.Name), Id.Parent.Name, Id.Name);
         return(Response.FromValue(new SharedGalleryImageResource(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }