MCPcopy Create free account
hub / github.com/cel-expr/cel-go / parseImport

Method parseImport

policy/parser.go:780–796  ·  view source on GitHub ↗
(ctx ParserContext, _ *Policy, node *yaml.Node)

Source from the content-addressed store, hash-verified

778}
779
780func (p *parserImpl) parseImport(ctx ParserContext, _ *Policy, node *yaml.Node) *Import {
781 id := ctx.CollectMetadata(node)
782 imp := NewImport(id)
783 if p.assertYAMLType(id, node, yamlMap) == nil || !p.checkMapValid(ctx, id, node) {
784 return imp
785 }
786 p.RangeMap(node, func(key *yaml.Node, val *yaml.Node) bool {
787 ctx.CollectMetadata(key)
788 fieldName := key.Value
789 switch fieldName {
790 case "name":
791 imp.SetName(ctx.NewString(val))
792 }
793 return true
794 })
795 return imp
796}
797
798// ParseRule will parse the current yaml node as though it is the entry point to a rule.
799func (p *parserImpl) ParseRule(ctx ParserContext, policy *Policy, node *yaml.Node) *Rule {

Callers 1

parseImportsMethod · 0.95

Calls 7

assertYAMLTypeMethod · 0.95
checkMapValidMethod · 0.95
SetNameMethod · 0.95
RangeMapMethod · 0.80
NewImportFunction · 0.70
CollectMetadataMethod · 0.65
NewStringMethod · 0.65

Tested by

no test coverage detected