Example #1
0
        internal static PublicIPAddressSku DeserializePublicIPAddressSku(JsonElement element)
        {
            Optional <PublicIPAddressSkuName> name = default;
            Optional <PublicIPAddressSkuTier> tier = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    name = new PublicIPAddressSkuName(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("tier"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    tier = new PublicIPAddressSkuTier(property.Value.GetString());
                    continue;
                }
            }
            return(new PublicIPAddressSku(Optional.ToNullable(name), Optional.ToNullable(tier)));
        }
        internal static PublicIPAddressSku DeserializePublicIPAddressSku(JsonElement element)
        {
            Optional <PublicIPAddressSkuName> name = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = new PublicIPAddressSkuName(property.Value.GetString());
                    continue;
                }
            }
            return(new PublicIPAddressSku(Optional.ToNullable(name)));
        }
        internal static PublicIPAddressSku DeserializePublicIPAddressSku(JsonElement element)
        {
            PublicIPAddressSkuName?name = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = new PublicIPAddressSkuName(property.Value.GetString());
                    continue;
                }
            }
            return(new PublicIPAddressSku(name));
        }