Beispiel #1
0
 internal EffectiveNetworkSecurityGroup(SubResource networkSecurityGroup, EffectiveNetworkSecurityGroupAssociation association, IReadOnlyList <EffectiveNetworkSecurityRule> effectiveSecurityRules, string tagMap)
 {
     NetworkSecurityGroup   = networkSecurityGroup;
     Association            = association;
     EffectiveSecurityRules = effectiveSecurityRules;
     TagMap = tagMap;
 }
Beispiel #2
0
        internal static EffectiveNetworkSecurityGroup DeserializeEffectiveNetworkSecurityGroup(JsonElement element)
        {
            SubResource networkSecurityGroup = default;
            EffectiveNetworkSecurityGroupAssociation     association            = default;
            IReadOnlyList <EffectiveNetworkSecurityRule> effectiveSecurityRules = default;
            string tagMap = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("networkSecurityGroup"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    networkSecurityGroup = SubResource.DeserializeSubResource(property.Value);
                    continue;
                }
                if (property.NameEquals("association"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    association = EffectiveNetworkSecurityGroupAssociation.DeserializeEffectiveNetworkSecurityGroupAssociation(property.Value);
                    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;
                }
                if (property.NameEquals("tagMap"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    tagMap = property.Value.GetString();
                    continue;
                }
            }
            return(new EffectiveNetworkSecurityGroup(networkSecurityGroup, association, effectiveSecurityRules, tagMap));
        }