internal static ServiceEndpointPolicyListResult DeserializeServiceEndpointPolicyListResult(JsonElement element)
        {
            Optional <IReadOnlyList <ServiceEndpointPolicyData> > 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 <ServiceEndpointPolicyData> array = new List <ServiceEndpointPolicyData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ServiceEndpointPolicyData.DeserializeServiceEndpointPolicyData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new ServiceEndpointPolicyListResult(Optional.ToList(value), nextLink.Value));
        }
Exemplo n.º 2
0
        ServiceEndpointPolicy IOperationSource <ServiceEndpointPolicy> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = ServiceEndpointPolicyData.DeserializeServiceEndpointPolicyData(document.RootElement);

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