コード例 #1
0
        VirtualRouter IOperationSource <VirtualRouter> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = VirtualRouterData.DeserializeVirtualRouterData(document.RootElement);

            return(new VirtualRouter(_armClient, data));
        }
コード例 #2
0
        internal static VirtualRouterListResult DeserializeVirtualRouterListResult(JsonElement element)
        {
            Optional <IReadOnlyList <VirtualRouterData> > 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 <VirtualRouterData> array = new List <VirtualRouterData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(VirtualRouterData.DeserializeVirtualRouterData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new VirtualRouterListResult(Optional.ToList(value), nextLink.Value));
        }