AfdRule IOperationSource <AfdRule> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = AfdRuleData.DeserializeAfdRuleData(document.RootElement); return(new AfdRule(_armClient, data)); }
internal static RuleListResult DeserializeRuleListResult(JsonElement element) { Optional <IReadOnlyList <AfdRuleData> > 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 <AfdRuleData> array = new List <AfdRuleData>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(AfdRuleData.DeserializeAfdRuleData(item)); } value = array; continue; } if (property.NameEquals("nextLink")) { nextLink = property.Value.GetString(); continue; } } return(new RuleListResult(Optional.ToList(value), nextLink.Value)); }