MCPcopy Create free account
hub / github.com/cloudwan/gohan / applyTemplateForEachResource

Function applyTemplateForEachResource

cli/template.go:250–264  ·  view source on GitHub ↗
(schemas []*SchemaWithPolicy, tpl *pongo2.Template, outputPath string)

Source from the content-addressed store, hash-verified

248}
249
250func applyTemplateForEachResource(schemas []*SchemaWithPolicy, tpl *pongo2.Template, outputPath string) {
251 for _, schemaWithPolicy := range schemas {
252 schema := schemaWithPolicy.Schema
253 if schema.Metadata["type"] == "metaschema" || schema.Type == "abstract" {
254 continue
255 }
256 output, err := tpl.Execute(pongo2.Context{"schema": schemaWithPolicy})
257 if err != nil {
258 util.ExitFatal(err)
259 return
260 }
261 outputPathForResource := strings.Replace(outputPath, "__resource__", schema.ID, 1)
262 ioutil.WriteFile(outputPathForResource, []byte(output), 0644)
263 }
264}
265
266func getAllResourceGroupsFromSchemas(schemas []*SchemaWithPolicy) []string {
267 resourcesSet := make(map[string]bool)

Callers 1

doTemplateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected