internal static EvaluatedNetworkSecurityGroup DeserializeEvaluatedNetworkSecurityGroup(JsonElement element)
        {
            string      networkSecurityGroupId = default;
            string      appliedTo   = default;
            MatchedRule matchedRule = default;
            IReadOnlyList <NetworkSecurityRulesEvaluationResult> rulesEvaluationResult = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("networkSecurityGroupId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    networkSecurityGroupId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("appliedTo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    appliedTo = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("matchedRule"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    matchedRule = MatchedRule.DeserializeMatchedRule(property.Value);
                    continue;
                }
                if (property.NameEquals("rulesEvaluationResult"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <NetworkSecurityRulesEvaluationResult> array = new List <NetworkSecurityRulesEvaluationResult>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(NetworkSecurityRulesEvaluationResult.DeserializeNetworkSecurityRulesEvaluationResult(item));
                        }
                    }
                    rulesEvaluationResult = array;
                    continue;
                }
            }
            return(new EvaluatedNetworkSecurityGroup(networkSecurityGroupId, appliedTo, matchedRule, rulesEvaluationResult));
        }
Exemple #2
0
        internal static EvaluatedNetworkSecurityGroup DeserializeEvaluatedNetworkSecurityGroup(JsonElement element)
        {
            Optional <string>      networkSecurityGroupId = default;
            Optional <string>      appliedTo   = default;
            Optional <MatchedRule> matchedRule = default;
            Optional <IReadOnlyList <NetworkSecurityRulesEvaluationResult> > rulesEvaluationResult = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("networkSecurityGroupId"))
                {
                    networkSecurityGroupId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("appliedTo"))
                {
                    appliedTo = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("matchedRule"))
                {
                    matchedRule = MatchedRule.DeserializeMatchedRule(property.Value);
                    continue;
                }
                if (property.NameEquals("rulesEvaluationResult"))
                {
                    List <NetworkSecurityRulesEvaluationResult> array = new List <NetworkSecurityRulesEvaluationResult>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(NetworkSecurityRulesEvaluationResult.DeserializeNetworkSecurityRulesEvaluationResult(item));
                    }
                    rulesEvaluationResult = array;
                    continue;
                }
            }
            return(new EvaluatedNetworkSecurityGroup(networkSecurityGroupId.Value, appliedTo.Value, matchedRule.Value, Optional.ToList(rulesEvaluationResult)));
        }