public async virtual Task <Response <GalleryImageVersion> > GetAsync(ReplicationStatusTypes?expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("GalleryImageVersion.Get"); scope.Start(); try { var response = await _galleryImageVersionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new GalleryImageVersion(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <GalleryImageVersionResource> > GetAsync(string galleryImageVersionName, ReplicationStatusTypes?expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(galleryImageVersionName, nameof(galleryImageVersionName)); using var scope = _galleryImageVersionClientDiagnostics.CreateScope("GalleryImageVersionCollection.Get"); scope.Start(); try { var response = await _galleryImageVersionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, galleryImageVersionName, expand, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new GalleryImageVersionResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }