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