Пример #1
0
        VirtualNetworkGatewayNatRule IOperationSource <VirtualNetworkGatewayNatRule> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = VirtualNetworkGatewayNatRuleData.DeserializeVirtualNetworkGatewayNatRuleData(document.RootElement);

            return(new VirtualNetworkGatewayNatRule(_armClient, data));
        }
        internal static ListVirtualNetworkGatewayNatRulesResult DeserializeListVirtualNetworkGatewayNatRulesResult(JsonElement element)
        {
            Optional <IReadOnlyList <VirtualNetworkGatewayNatRuleData> > 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 <VirtualNetworkGatewayNatRuleData> array = new List <VirtualNetworkGatewayNatRuleData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(VirtualNetworkGatewayNatRuleData.DeserializeVirtualNetworkGatewayNatRuleData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new ListVirtualNetworkGatewayNatRulesResult(Optional.ToList(value), nextLink.Value));
        }