internal static NetworkSecurityGroupResult DeserializeNetworkSecurityGroupResult(JsonElement element) { Optional <SecurityRuleAccess> securityRuleAccessResult = default; Optional <IReadOnlyList <EvaluatedNetworkSecurityGroup> > evaluatedNetworkSecurityGroups = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("securityRuleAccessResult")) { securityRuleAccessResult = new SecurityRuleAccess(property.Value.GetString()); continue; } if (property.NameEquals("evaluatedNetworkSecurityGroups")) { List <EvaluatedNetworkSecurityGroup> array = new List <EvaluatedNetworkSecurityGroup>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(EvaluatedNetworkSecurityGroup.DeserializeEvaluatedNetworkSecurityGroup(item)); } evaluatedNetworkSecurityGroups = array; continue; } } return(new NetworkSecurityGroupResult(Optional.ToNullable(securityRuleAccessResult), Optional.ToList(evaluatedNetworkSecurityGroups))); }
internal static NetworkSecurityGroupResult DeserializeNetworkSecurityGroupResult(JsonElement element) { SecurityRuleAccess?securityRuleAccessResult = default; IReadOnlyList <EvaluatedNetworkSecurityGroup> evaluatedNetworkSecurityGroups = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("securityRuleAccessResult")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } securityRuleAccessResult = new SecurityRuleAccess(property.Value.GetString()); continue; } if (property.NameEquals("evaluatedNetworkSecurityGroups")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <EvaluatedNetworkSecurityGroup> array = new List <EvaluatedNetworkSecurityGroup>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(EvaluatedNetworkSecurityGroup.DeserializeEvaluatedNetworkSecurityGroup(item)); } } evaluatedNetworkSecurityGroups = array; continue; } } return(new NetworkSecurityGroupResult(securityRuleAccessResult, evaluatedNetworkSecurityGroups)); }