RestorePoint IOperationSource <RestorePoint> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = RestorePointData.DeserializeRestorePointData(document.RootElement);

            return(new RestorePoint(_armClient, data));
        }
コード例 #2
0
        internal static RestorePointListResult DeserializeRestorePointListResult(JsonElement element)
        {
            Optional <IReadOnlyList <RestorePointData> > 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 <RestorePointData> array = new List <RestorePointData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(RestorePointData.DeserializeRestorePointData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new RestorePointListResult(Optional.ToList(value), nextLink.Value));
        }