Ejemplo n.º 1
0
        internal static ApplicationGatewaySku DeserializeApplicationGatewaySku(JsonElement element)
        {
            Optional <ApplicationGatewaySkuName> name = default;
            Optional <ApplicationGatewayTier>    tier = default;
            Optional <int> capacity = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = new ApplicationGatewaySkuName(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("tier"))
                {
                    tier = new ApplicationGatewayTier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("capacity"))
                {
                    capacity = property.Value.GetInt32();
                    continue;
                }
            }
            return(new ApplicationGatewaySku(Optional.ToNullable(name), Optional.ToNullable(tier), Optional.ToNullable(capacity)));
        }
Ejemplo n.º 2
0
        internal static ApplicationGatewaySku DeserializeApplicationGatewaySku(JsonElement element)
        {
            ApplicationGatewaySkuName?name = default;
            ApplicationGatewayTier?   tier = default;
            int?capacity = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = new ApplicationGatewaySkuName(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("tier"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    tier = new ApplicationGatewayTier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("capacity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    capacity = property.Value.GetInt32();
                    continue;
                }
            }
            return(new ApplicationGatewaySku(name, tier, capacity));
        }