Beispiel #1
0
        public async virtual Task <Response <GalleryApplicationVersion> > GetAsync(string galleryApplicationVersionName, ReplicationStatusTypes?expand = null, CancellationToken cancellationToken = default)
        {
            if (galleryApplicationVersionName == null)
            {
                throw new ArgumentNullException(nameof(galleryApplicationVersionName));
            }

            using var scope = _clientDiagnostics.CreateScope("GalleryApplicationVersionCollection.Get");
            scope.Start();
            try
            {
                var response = await _galleryApplicationVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, galleryApplicationVersionName, expand, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
                }
                return(Response.FromValue(new GalleryApplicationVersion(this, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
 public virtual async Task<Response<GalleryApplicationVersionResource>> GetAsync(ReplicationStatusTypes? expand = null, CancellationToken cancellationToken = default)
 {
     using var scope = _galleryApplicationVersionClientDiagnostics.CreateScope("GalleryApplicationVersionResource.Get");
     scope.Start();
     try
     {
         var response = await _galleryApplicationVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false);
         if (response.Value == null)
             throw new RequestFailedException(response.GetRawResponse());
         return Response.FromValue(new GalleryApplicationVersionResource(Client, response.Value), response.GetRawResponse());
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }