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