Exemple #1
0
        internal static VirtualClusterListResult DeserializeVirtualClusterListResult(JsonElement element)
        {
            Optional <IReadOnlyList <VirtualClusterData> > 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 <VirtualClusterData> array = new List <VirtualClusterData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(VirtualClusterData.DeserializeVirtualClusterData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new VirtualClusterListResult(Optional.ToList(value), nextLink.Value));
        }
Exemple #2
0
        VirtualCluster IOperationSource <VirtualCluster> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = VirtualClusterData.DeserializeVirtualClusterData(document.RootElement);

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