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

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