SapVirtualInstanceResource IOperationSource <SapVirtualInstanceResource> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = SapVirtualInstanceData.DeserializeSapVirtualInstanceData(document.RootElement); return(new SapVirtualInstanceResource(_client, data)); }
public async Task <Response <SapVirtualInstanceData> > GetAsync(string subscriptionId, string resourceGroupName, string sapVirtualInstanceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(sapVirtualInstanceName, nameof(sapVirtualInstanceName)); using var message = CreateGetRequest(subscriptionId, resourceGroupName, sapVirtualInstanceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { SapVirtualInstanceData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = SapVirtualInstanceData.DeserializeSapVirtualInstanceData(document.RootElement); return(Response.FromValue(value, message.Response)); }