ClusterResource IOperationSource <ClusterResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = ClusterResourceData.DeserializeClusterResourceData(document.RootElement);

            return(new ClusterResource(_armClient, data));
        }
コード例 #2
0
        internal static ListClusters DeserializeListClusters(JsonElement element)
        {
            Optional <IReadOnlyList <ClusterResourceData> > value = default;

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