Convert string GetAtt into array format so that it it's easier to compare
(n *yaml.Node)
| 11 | |
| 12 | // Convert string GetAtt into array format so that it it's easier to compare |
| 13 | func parseGetAtt(n *yaml.Node) error { |
| 14 | parts := strings.SplitN(n.Value, ".", 2) |
| 15 | |
| 16 | if len(parts) != 2 { |
| 17 | return errors.New("GetAtt requires two parameters") |
| 18 | } |
| 19 | |
| 20 | *n = yaml.Node{ |
| 21 | Kind: yaml.SequenceNode, |
| 22 | |
| 23 | HeadComment: n.HeadComment, |
| 24 | LineComment: n.LineComment, |
| 25 | FootComment: n.FootComment, |
| 26 | |
| 27 | Content: []*yaml.Node{ |
| 28 | { |
| 29 | Kind: yaml.ScalarNode, |
| 30 | Style: 0, |
| 31 | Tag: "!!str", |
| 32 | Value: parts[0], |
| 33 | }, |
| 34 | { |
| 35 | Kind: yaml.ScalarNode, |
| 36 | Style: 0, |
| 37 | Tag: "!!str", |
| 38 | Value: parts[1], |
| 39 | }, |
| 40 | }, |
| 41 | } |
| 42 | return nil |
| 43 | } |
| 44 | |
| 45 | // NormalizeNode takes a *yaml.Node and convert tag-style names into map-style, |
| 46 | // and converts other scalars into a canonical format |