public virtual Response <CommunityGalleryResource> Get(AzureLocation location, string publicGalleryName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(publicGalleryName, nameof(publicGalleryName)); using var scope = _communityGalleryClientDiagnostics.CreateScope("CommunityGalleryCollection.Get"); scope.Start(); try { var response = _communityGalleryRestClient.Get(Id.SubscriptionId, location, publicGalleryName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } response.Value.Id = CommunityGalleryResource.CreateResourceIdentifier(Id.SubscriptionId, location, publicGalleryName); return(Response.FromValue(new CommunityGalleryResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <CommunityGalleryResource> Get(CancellationToken cancellationToken = default) { using var scope = _communityGalleryClientDiagnostics.CreateScope("CommunityGalleryResource.Get"); scope.Start(); try { var response = _communityGalleryRestClient.Get(Id.SubscriptionId, new AzureLocation(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.Name), Id.Name); return(Response.FromValue(new CommunityGalleryResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }