VpnGateway IOperationSource <VpnGateway> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = VpnGatewayData.DeserializeVpnGatewayData(document.RootElement); return(new VpnGateway(_armClient, data)); }
internal static ListVpnGatewaysResult DeserializeListVpnGatewaysResult(JsonElement element) { Optional <IReadOnlyList <VpnGatewayData> > value = default; Optional <string> nextLink = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <VpnGatewayData> array = new List <VpnGatewayData>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(VpnGatewayData.DeserializeVpnGatewayData(item)); } value = array; continue; } if (property.NameEquals("nextLink")) { nextLink = property.Value.GetString(); continue; } } return(new ListVpnGatewaysResult(Optional.ToList(value), nextLink.Value)); }