public virtual Response <GalleryImage> Get(CancellationToken cancellationToken = default) { using var scope = _galleryImageClientDiagnostics.CreateScope("GalleryImage.Get"); scope.Start(); try { var response = _galleryImageRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw _galleryImageClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new GalleryImage(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <GalleryImage> Get(string galleryImageName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(galleryImageName, nameof(galleryImageName)); using var scope = _galleryImageClientDiagnostics.CreateScope("GalleryImageCollection.Get"); scope.Start(); try { var response = _galleryImageRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryImageName, cancellationToken); if (response.Value == null) { throw _galleryImageClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new GalleryImage(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <GalleryImage> Get(string galleryImageName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("GalleryImageCollection.Get"); scope.Start(); try { if (galleryImageName == null) { throw new ArgumentNullException(nameof(galleryImageName)); } var response = _restClient.Get(Id.ResourceGroupName, Id.Name, galleryImageName, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new GalleryImage(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }