GalleryApplicationVersion IOperationSource <GalleryApplicationVersion> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = GalleryApplicationVersionData.DeserializeGalleryApplicationVersionData(document.RootElement); return(new GalleryApplicationVersion(_client, data)); }
public async Task <Response <GalleryApplicationVersionData> > GetAsync(string resourceGroupName, string galleryName, string galleryApplicationName, string galleryApplicationVersionName, ReplicationStatusTypes?expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (galleryName == null) { throw new ArgumentNullException(nameof(galleryName)); } if (galleryApplicationName == null) { throw new ArgumentNullException(nameof(galleryApplicationName)); } if (galleryApplicationVersionName == null) { throw new ArgumentNullException(nameof(galleryApplicationVersionName)); } using var message = CreateGetRequest(resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { GalleryApplicationVersionData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = GalleryApplicationVersionData.DeserializeGalleryApplicationVersionData(document.RootElement); return(Response.FromValue(value, message.Response)); }