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