internal SecurityRuleAssociations(NetworkInterfaceAssociation networkInterfaceAssociation, SubnetAssociation subnetAssociation, IReadOnlyList <SecurityRuleData> defaultSecurityRules, IReadOnlyList <EffectiveNetworkSecurityRule> effectiveSecurityRules)
 {
     NetworkInterfaceAssociation = networkInterfaceAssociation;
     SubnetAssociation           = subnetAssociation;
     DefaultSecurityRules        = defaultSecurityRules;
     EffectiveSecurityRules      = effectiveSecurityRules;
 }
        internal static SecurityRuleAssociations DeserializeSecurityRuleAssociations(JsonElement element)
        {
            Optional <NetworkInterfaceAssociation>   networkInterfaceAssociation            = default;
            Optional <SubnetAssociation>             subnetAssociation                      = default;
            Optional <IReadOnlyList <SecurityRule> > defaultSecurityRules                   = default;
            Optional <IReadOnlyList <EffectiveNetworkSecurityRule> > effectiveSecurityRules = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("networkInterfaceAssociation"))
                {
                    networkInterfaceAssociation = NetworkInterfaceAssociation.DeserializeNetworkInterfaceAssociation(property.Value);
                    continue;
                }
                if (property.NameEquals("subnetAssociation"))
                {
                    subnetAssociation = SubnetAssociation.DeserializeSubnetAssociation(property.Value);
                    continue;
                }
                if (property.NameEquals("defaultSecurityRules"))
                {
                    List <SecurityRule> array = new List <SecurityRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(SecurityRule.DeserializeSecurityRule(item));
                    }
                    defaultSecurityRules = array;
                    continue;
                }
                if (property.NameEquals("effectiveSecurityRules"))
                {
                    List <EffectiveNetworkSecurityRule> array = new List <EffectiveNetworkSecurityRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(EffectiveNetworkSecurityRule.DeserializeEffectiveNetworkSecurityRule(item));
                    }
                    effectiveSecurityRules = array;
                    continue;
                }
            }
            return(new SecurityRuleAssociations(networkInterfaceAssociation.Value, subnetAssociation.Value, Optional.ToList(defaultSecurityRules), Optional.ToList(effectiveSecurityRules)));
        }
        internal static SecurityRuleAssociations DeserializeSecurityRuleAssociations(JsonElement element)
        {
            NetworkInterfaceAssociation  networkInterfaceAssociation            = default;
            SubnetAssociation            subnetAssociation                      = default;
            IReadOnlyList <SecurityRule> defaultSecurityRules                   = default;
            IReadOnlyList <EffectiveNetworkSecurityRule> effectiveSecurityRules = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("networkInterfaceAssociation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    networkInterfaceAssociation = NetworkInterfaceAssociation.DeserializeNetworkInterfaceAssociation(property.Value);
                    continue;
                }
                if (property.NameEquals("subnetAssociation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    subnetAssociation = SubnetAssociation.DeserializeSubnetAssociation(property.Value);
                    continue;
                }
                if (property.NameEquals("defaultSecurityRules"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <SecurityRule> array = new List <SecurityRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(SecurityRule.DeserializeSecurityRule(item));
                        }
                    }
                    defaultSecurityRules = array;
                    continue;
                }
                if (property.NameEquals("effectiveSecurityRules"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <EffectiveNetworkSecurityRule> array = new List <EffectiveNetworkSecurityRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(EffectiveNetworkSecurityRule.DeserializeEffectiveNetworkSecurityRule(item));
                        }
                    }
                    effectiveSecurityRules = array;
                    continue;
                }
            }
            return(new SecurityRuleAssociations(networkInterfaceAssociation, subnetAssociation, defaultSecurityRules, effectiveSecurityRules));
        }