Beispiel #1
0
        ExpressRouteGateway IOperationSource <ExpressRouteGateway> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = ExpressRouteGatewayData.DeserializeExpressRouteGatewayData(document.RootElement);

            return(new ExpressRouteGateway(_armClient, data));
        }
        internal static ExpressRouteGatewayList DeserializeExpressRouteGatewayList(JsonElement element)
        {
            Optional <IReadOnlyList <ExpressRouteGatewayData> > value = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ExpressRouteGatewayData> array = new List <ExpressRouteGatewayData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ExpressRouteGatewayData.DeserializeExpressRouteGatewayData(item));
                    }
                    value = array;
                    continue;
                }
            }
            return(new ExpressRouteGatewayList(Optional.ToList(value)));
        }