StorageAccount IOperationSource <StorageAccount> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = StorageAccountData.DeserializeStorageAccountData(document.RootElement);

            return(new StorageAccount(_armClient, data));
        }
Пример #2
0
        internal static StorageAccountListResult DeserializeStorageAccountListResult(JsonElement element)
        {
            Optional <IReadOnlyList <StorageAccountData> > 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 <StorageAccountData> array = new List <StorageAccountData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(StorageAccountData.DeserializeStorageAccountData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new StorageAccountListResult(Optional.ToList(value), nextLink.Value));
        }