예제 #1
0
 private static void HandleIngressRules(YamlSequenceNode yamlSequenceNode, List <ConfigIngressRule> rules)
 {
     foreach (var child in yamlSequenceNode.Children)
     {
         YamlParser.ThrowIfNotYamlMapping(child);
         var rule = new ConfigIngressRule();
         HandleIngressRuleMapping((YamlMappingNode)child, rule);
         rules.Add(rule);
     }
 }
예제 #2
0
        private static void HandleIngressRuleMapping(YamlMappingNode yamlMappingNode, ConfigIngressRule rule)
        {
            foreach (var child in yamlMappingNode !.Children)
            {
                var key = YamlParser.GetScalarValue(child.Key);

                switch (key)
                {
                case "host":
                    rule.Host = YamlParser.GetScalarValue(key, child.Value);
                    break;

                case "path":
                    rule.Path = YamlParser.GetScalarValue(key, child.Value);
                    break;

                case "service":
                    rule.Service = YamlParser.GetScalarValue(key, child.Value).ToLowerInvariant();
                    break;

                default:
                    throw new TyeYamlException(child.Key.Start, CoreStrings.FormatUnrecognizedKey(key));
                }
            }
        }