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));
        }
Beispiel #2
0
 internal EvaluatedNetworkSecurityGroup(ResourceIdentifier networkSecurityGroupId, string appliedTo, MatchedRule matchedRule, IReadOnlyList <NetworkSecurityRulesEvaluationResult> rulesEvaluationResult)
 {
     NetworkSecurityGroupId = networkSecurityGroupId;
     AppliedTo             = appliedTo;
     MatchedRule           = matchedRule;
     RulesEvaluationResult = rulesEvaluationResult;
 }
Beispiel #3
0
        internal static EvaluatedNetworkSecurityGroup DeserializeEvaluatedNetworkSecurityGroup(JsonElement element)
        {
            Optional <ResourceIdentifier> 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"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    networkSecurityGroupId = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("appliedTo"))
                {
                    appliedTo = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("matchedRule"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    matchedRule = MatchedRule.DeserializeMatchedRule(property.Value);
                    continue;
                }
                if (property.NameEquals("rulesEvaluationResult"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    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)));
        }