Пример #1
0
        internal static ListVirtualHubBgpConnectionResults DeserializeListVirtualHubBgpConnectionResults(JsonElement element)
        {
            Optional <IReadOnlyList <BgpConnectionData> > 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 <BgpConnectionData> array = new List <BgpConnectionData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(BgpConnectionData.DeserializeBgpConnectionData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new ListVirtualHubBgpConnectionResults(Optional.ToList(value), nextLink.Value));
        }
Пример #2
0
        BgpConnection IOperationSource <BgpConnection> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = BgpConnectionData.DeserializeBgpConnectionData(document.RootElement);

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