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

Method parseImport

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

Source from the content-addressed store, hash-verified

736}
737
738func (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.
757func (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