Ejemplo n.º 1
0
 internal EffectiveNetworkSecurityGroup(WritableSubResource networkSecurityGroup, EffectiveNetworkSecurityGroupAssociation association, IReadOnlyList <EffectiveNetworkSecurityRule> effectiveSecurityRules, string tagMap)
 {
     NetworkSecurityGroup   = networkSecurityGroup;
     Association            = association;
     EffectiveSecurityRules = effectiveSecurityRules;
     TagMap = tagMap;
 }
        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));
        }
Ejemplo n.º 3
0
        internal static EffectiveNetworkSecurityGroup DeserializeEffectiveNetworkSecurityGroup(JsonElement element)
        {
            Optional <SubResource> networkSecurityGroup = default;
            Optional <EffectiveNetworkSecurityGroupAssociation>      association            = default;
            Optional <IReadOnlyList <EffectiveNetworkSecurityRule> > effectiveSecurityRules = default;
            Optional <string> tagMap = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("networkSecurityGroup"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    networkSecurityGroup = SubResource.DeserializeSubResource(property.Value);
                    continue;
                }
                if (property.NameEquals("association"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    association = EffectiveNetworkSecurityGroupAssociation.DeserializeEffectiveNetworkSecurityGroupAssociation(property.Value);
                    continue;
                }
                if (property.NameEquals("effectiveSecurityRules"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <EffectiveNetworkSecurityRule> array = new List <EffectiveNetworkSecurityRule>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(EffectiveNetworkSecurityRule.DeserializeEffectiveNetworkSecurityRule(item));
                    }
                    effectiveSecurityRules = array;
                    continue;
                }
                if (property.NameEquals("tagMap"))
                {
                    tagMap = property.Value.GetString();
                    continue;
                }
            }
            return(new EffectiveNetworkSecurityGroup(networkSecurityGroup.Value, association.Value, Optional.ToList(effectiveSecurityRules), tagMap.Value));
        }