internal static PublicIPPrefixListResult DeserializePublicIPPrefixListResult(JsonElement element)
        {
            Optional <IReadOnlyList <PublicIPPrefixData> > 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 <PublicIPPrefixData> array = new List <PublicIPPrefixData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(PublicIPPrefixData.DeserializePublicIPPrefixData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new PublicIPPrefixListResult(Optional.ToList(value), nextLink.Value));
        }
 private void ValidateCommon(PublicIPPrefixData data, string name)
 {
     Assert.AreEqual(name, data.Name);
     Assert.AreEqual(28, data.PrefixLength);
     Assert.AreEqual(PublicIPPrefixSkuName.Standard, data.Sku.Name);
     Assert.AreEqual(IPVersion.IPv4, data.PublicIPAddressVersion);
 }
Пример #3
0
        PublicIPPrefix IOperationSource <PublicIPPrefix> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = PublicIPPrefixData.DeserializePublicIPPrefixData(document.RootElement);

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