Exemple #1
0
        internal static ListVirtualWANsResult DeserializeListVirtualWANsResult(JsonElement element)
        {
            Optional <IReadOnlyList <VirtualWANData> > 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 <VirtualWANData> array = new List <VirtualWANData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(VirtualWANData.DeserializeVirtualWANData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new ListVirtualWANsResult(Optional.ToList(value), nextLink.Value));
        }
        VirtualWAN IOperationSource <VirtualWAN> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = VirtualWANData.DeserializeVirtualWANData(document.RootElement);

            return(new VirtualWAN(_armClient, data));
        }