コード例 #1
0
        internal static AzureFirewall DeserializeAzureFirewall(JsonElement element)
        {
            Optional <IList <string> > zones              = default;
            Optional <string>          etag               = default;
            Optional <string>          id                 = default;
            Optional <string>          name               = default;
            Optional <string>          type               = default;
            Optional <string>          location           = default;
            Optional <IDictionary <string, string> > tags = default;
            Optional <IList <AzureFirewallApplicationRuleCollection> > applicationRuleCollections = default;
            Optional <IList <AzureFirewallNatRuleCollection> >         natRuleCollections         = default;
            Optional <IList <AzureFirewallNetworkRuleCollection> >     networkRuleCollections     = default;
            Optional <IList <AzureFirewallIPConfiguration> >           ipConfigurations           = default;
            Optional <AzureFirewallIPConfiguration> managementIpConfiguration = default;
            Optional <ProvisioningState>            provisioningState         = default;
            Optional <AzureFirewallThreatIntelMode> threatIntelMode           = default;
            Optional <SubResource>    virtualHub     = default;
            Optional <SubResource>    firewallPolicy = default;
            Optional <HubIPAddresses> hubIpAddresses = default;
            Optional <IReadOnlyList <AzureFirewallIpGroups> > ipGroups = default;
            Optional <AzureFirewallSku> sku = default;
            Optional <IDictionary <string, string> > additionalProperties = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("zones"))
                {
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    zones = array;
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("applicationRuleCollections"))
                        {
                            List <AzureFirewallApplicationRuleCollection> array = new List <AzureFirewallApplicationRuleCollection>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AzureFirewallApplicationRuleCollection.DeserializeAzureFirewallApplicationRuleCollection(item));
                            }
                            applicationRuleCollections = array;
                            continue;
                        }
                        if (property0.NameEquals("natRuleCollections"))
                        {
                            List <AzureFirewallNatRuleCollection> array = new List <AzureFirewallNatRuleCollection>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AzureFirewallNatRuleCollection.DeserializeAzureFirewallNatRuleCollection(item));
                            }
                            natRuleCollections = array;
                            continue;
                        }
                        if (property0.NameEquals("networkRuleCollections"))
                        {
                            List <AzureFirewallNetworkRuleCollection> array = new List <AzureFirewallNetworkRuleCollection>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AzureFirewallNetworkRuleCollection.DeserializeAzureFirewallNetworkRuleCollection(item));
                            }
                            networkRuleCollections = array;
                            continue;
                        }
                        if (property0.NameEquals("ipConfigurations"))
                        {
                            List <AzureFirewallIPConfiguration> array = new List <AzureFirewallIPConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AzureFirewallIPConfiguration.DeserializeAzureFirewallIPConfiguration(item));
                            }
                            ipConfigurations = array;
                            continue;
                        }
                        if (property0.NameEquals("managementIpConfiguration"))
                        {
                            managementIpConfiguration = AzureFirewallIPConfiguration.DeserializeAzureFirewallIPConfiguration(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("threatIntelMode"))
                        {
                            threatIntelMode = new AzureFirewallThreatIntelMode(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("virtualHub"))
                        {
                            virtualHub = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("firewallPolicy"))
                        {
                            firewallPolicy = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("hubIpAddresses"))
                        {
                            hubIpAddresses = HubIPAddresses.DeserializeHubIPAddresses(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("ipGroups"))
                        {
                            List <AzureFirewallIpGroups> array = new List <AzureFirewallIpGroups>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AzureFirewallIpGroups.DeserializeAzureFirewallIpGroups(item));
                            }
                            ipGroups = array;
                            continue;
                        }
                        if (property0.NameEquals("sku"))
                        {
                            sku = AzureFirewallSku.DeserializeAzureFirewallSku(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("additionalProperties"))
                        {
                            Dictionary <string, string> dictionary = new Dictionary <string, string>();
                            foreach (var property1 in property0.Value.EnumerateObject())
                            {
                                dictionary.Add(property1.Name, property1.Value.GetString());
                            }
                            additionalProperties = dictionary;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new AzureFirewall(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToList(zones), etag.Value, Optional.ToList(applicationRuleCollections), Optional.ToList(natRuleCollections), Optional.ToList(networkRuleCollections), Optional.ToList(ipConfigurations), managementIpConfiguration.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(threatIntelMode), virtualHub.Value, firewallPolicy.Value, hubIpAddresses.Value, Optional.ToList(ipGroups), sku.Value, Optional.ToDictionary(additionalProperties)));
        }
コード例 #2
0
        internal static AzureFirewall DeserializeAzureFirewall(JsonElement element)
        {
            IList <string> zones              = default;
            string         etag               = default;
            string         id                 = default;
            string         name               = default;
            string         type               = default;
            string         location           = default;
            IDictionary <string, string> tags = default;
            IList <AzureFirewallApplicationRuleCollection> applicationRuleCollections = default;
            IList <AzureFirewallNatRuleCollection>         natRuleCollections         = default;
            IList <AzureFirewallNetworkRuleCollection>     networkRuleCollections     = default;
            IList <AzureFirewallIPConfiguration>           ipConfigurations           = default;
            AzureFirewallIPConfiguration managementIpConfiguration = default;
            ProvisioningState?           provisioningState         = default;
            AzureFirewallThreatIntelMode?threatIntelMode           = default;
            SubResource    virtualHub                         = default;
            SubResource    firewallPolicy                     = default;
            HubIPAddresses hubIpAddresses                     = default;
            IList <AzureFirewallIpGroups> ipGroups            = default;
            AzureFirewallSku             sku                  = default;
            IDictionary <string, string> additionalProperties = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("zones"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(item.GetString());
                        }
                    }
                    zones = array;
                    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("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, property0.Value.GetString());
                        }
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("applicationRuleCollections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <AzureFirewallApplicationRuleCollection> array = new List <AzureFirewallApplicationRuleCollection>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(AzureFirewallApplicationRuleCollection.DeserializeAzureFirewallApplicationRuleCollection(item));
                                }
                            }
                            applicationRuleCollections = array;
                            continue;
                        }
                        if (property0.NameEquals("natRuleCollections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <AzureFirewallNatRuleCollection> array = new List <AzureFirewallNatRuleCollection>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(AzureFirewallNatRuleCollection.DeserializeAzureFirewallNatRuleCollection(item));
                                }
                            }
                            natRuleCollections = array;
                            continue;
                        }
                        if (property0.NameEquals("networkRuleCollections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <AzureFirewallNetworkRuleCollection> array = new List <AzureFirewallNetworkRuleCollection>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(AzureFirewallNetworkRuleCollection.DeserializeAzureFirewallNetworkRuleCollection(item));
                                }
                            }
                            networkRuleCollections = array;
                            continue;
                        }
                        if (property0.NameEquals("ipConfigurations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <AzureFirewallIPConfiguration> array = new List <AzureFirewallIPConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(AzureFirewallIPConfiguration.DeserializeAzureFirewallIPConfiguration(item));
                                }
                            }
                            ipConfigurations = array;
                            continue;
                        }
                        if (property0.NameEquals("managementIpConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            managementIpConfiguration = AzureFirewallIPConfiguration.DeserializeAzureFirewallIPConfiguration(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("threatIntelMode"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            threatIntelMode = new AzureFirewallThreatIntelMode(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("virtualHub"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            virtualHub = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("firewallPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            firewallPolicy = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("hubIpAddresses"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            hubIpAddresses = HubIPAddresses.DeserializeHubIPAddresses(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("ipGroups"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <AzureFirewallIpGroups> array = new List <AzureFirewallIpGroups>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(AzureFirewallIpGroups.DeserializeAzureFirewallIpGroups(item));
                                }
                            }
                            ipGroups = array;
                            continue;
                        }
                        if (property0.NameEquals("sku"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            sku = AzureFirewallSku.DeserializeAzureFirewallSku(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("additionalProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            Dictionary <string, string> dictionary = new Dictionary <string, string>();
                            foreach (var property1 in property0.Value.EnumerateObject())
                            {
                                if (property1.Value.ValueKind == JsonValueKind.Null)
                                {
                                    dictionary.Add(property1.Name, null);
                                }
                                else
                                {
                                    dictionary.Add(property1.Name, property1.Value.GetString());
                                }
                            }
                            additionalProperties = dictionary;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new AzureFirewall(id, name, type, location, tags, zones, etag, applicationRuleCollections, natRuleCollections, networkRuleCollections, ipConfigurations, managementIpConfiguration, provisioningState, threatIntelMode, virtualHub, firewallPolicy, hubIpAddresses, ipGroups, sku, additionalProperties));
        }