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

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