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

Function applyTemplateForEachResourceGroup

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

Source from the content-addressed store, hash-verified

235}
236
237func applyTemplateForEachResourceGroup(schemas []*SchemaWithPolicy, tpl *pongo2.Template, version, description, outputPath string) {
238 for _, resourceGroup := range getAllResourceGroupsFromSchemas(schemas) {
239 resourceSchemas := filerSchemasByResourceGroup(resourceGroup, schemas)
240 output, err := tpl.Execute(pongo2.Context{"schemas": resourceSchemas, "title": resourceGroup, "version": version, "description": description})
241 if err != nil {
242 util.ExitFatal(err)
243 return
244 }
245 outputPath = strings.Replace(outputPath, "__resource__", resourceGroup, 1)
246 ioutil.WriteFile(outputPath, []byte(output), 0644)
247 }
248}
249
250func applyTemplateForEachResource(schemas []*SchemaWithPolicy, tpl *pongo2.Template, outputPath string) {
251 for _, schemaWithPolicy := range schemas {

Callers 1

doTemplateFunction · 0.85

Calls 2

Tested by

no test coverage detected