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

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