Beispiel #1
0
 private static void HandleServiceVolumes(YamlSequenceNode yamlSequenceNode, List <ConfigVolume> volumes)
 {
     foreach (var child in yamlSequenceNode.Children)
     {
         YamlParser.ThrowIfNotYamlMapping(child);
         var volume = new ConfigVolume();
         HandleServiceVolumeNameMapping((YamlMappingNode)child, volume);
         volumes.Add(volume);
     }
 }
Beispiel #2
0
        private static void HandleServiceVolumeNameMapping(YamlMappingNode yamlMappingNode, ConfigVolume volume)
        {
            foreach (var child in yamlMappingNode !.Children)
            {
                var key = YamlParser.GetScalarValue(child.Key);

                switch (key)
                {
                case "name":
                    volume.Name = YamlParser.GetScalarValue(key, child.Value);
                    break;

                case "source":
                    volume.Source = YamlParser.GetScalarValue(key, child.Value);
                    break;

                case "target":
                    volume.Target = YamlParser.GetScalarValue(key, child.Value);
                    break;

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