(ctx ParserContext, _ *Policy, node *yaml.Node)
| 736 | } |
| 737 | |
| 738 | func (p *parserImpl) parseImport(ctx ParserContext, _ *Policy, node *yaml.Node) *Import { |
| 739 | id := ctx.CollectMetadata(node) |
| 740 | imp := NewImport(id) |
| 741 | if p.assertYAMLType(id, node, yamlMap) == nil || !p.checkMapValid(ctx, id, node) { |
| 742 | return imp |
| 743 | } |
| 744 | p.RangeMap(node, func(key *yaml.Node, val *yaml.Node) bool { |
| 745 | ctx.CollectMetadata(key) |
| 746 | fieldName := key.Value |
| 747 | switch fieldName { |
| 748 | case "name": |
| 749 | imp.SetName(ctx.NewString(val)) |
| 750 | } |
| 751 | return true |
| 752 | }) |
| 753 | return imp |
| 754 | } |
| 755 | |
| 756 | // ParseRule will parse the current yaml node as though it is the entry point to a rule. |
| 757 | func (p *parserImpl) ParseRule(ctx ParserContext, policy *Policy, node *yaml.Node) *Rule { |
no test coverage detected