internal static AzureFirewallApplicationRuleCollection DeserializeAzureFirewallApplicationRuleCollection(JsonElement element)
        {
            string name     = default;
            string etag     = default;
            string id       = default;
            int?   priority = default;
            AzureFirewallRCAction action = default;
            IList <AzureFirewallApplicationRule> rules = default;
            ProvisioningState?provisioningState        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("priority"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            priority = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("action"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            action = AzureFirewallRCAction.DeserializeAzureFirewallRCAction(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("rules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <AzureFirewallApplicationRule> array = new List <AzureFirewallApplicationRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(AzureFirewallApplicationRule.DeserializeAzureFirewallApplicationRule(item));
                                }
                            }
                            rules = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new AzureFirewallApplicationRuleCollection(id, name, etag, priority, action, rules, provisioningState));
        }
Exemplo n.º 2
0
        internal static AzureFirewallNetworkRuleCollection DeserializeAzureFirewallNetworkRuleCollection(JsonElement element)
        {
            Optional <string> name     = default;
            Optional <string> etag     = default;
            Optional <string> id       = default;
            Optional <int>    priority = default;
            Optional <AzureFirewallRCAction>             action = default;
            Optional <IList <AzureFirewallNetworkRule> > rules  = default;
            Optional <ProvisioningState> provisioningState      = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("priority"))
                        {
                            priority = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("action"))
                        {
                            action = AzureFirewallRCAction.DeserializeAzureFirewallRCAction(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("rules"))
                        {
                            List <AzureFirewallNetworkRule> array = new List <AzureFirewallNetworkRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AzureFirewallNetworkRule.DeserializeAzureFirewallNetworkRule(item));
                            }
                            rules = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new AzureFirewallNetworkRuleCollection(id.Value, name.Value, etag.Value, Optional.ToNullable(priority), action.Value, Optional.ToList(rules), Optional.ToNullable(provisioningState)));
        }