public virtual Response <Gallery> Get(SelectPermissions?select = null, CancellationToken cancellationToken = default) { using var scope = _galleryClientDiagnostics.CreateScope("Gallery.Get"); scope.Start(); try { var response = _galleryRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, select, cancellationToken); if (response.Value == null) { throw _galleryClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new Gallery(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <GalleryResource> Get(string galleryName, SelectPermissions?select = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(galleryName, nameof(galleryName)); using var scope = _galleryClientDiagnostics.CreateScope("GalleryCollection.Get"); scope.Start(); try { var response = _galleryRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, galleryName, select, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new GalleryResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <Gallery> Get(string galleryName, SelectPermissions?select = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("GalleryContainer.Get"); scope.Start(); try { if (galleryName == null) { throw new ArgumentNullException(nameof(galleryName)); } var response = _restClient.Get(Id.ResourceGroupName, galleryName, select, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new Gallery(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }