| 222 | } |
| 223 | |
| 224 | func applyTemplateForAll(schemas []*SchemaWithPolicy, tpl *pongo2.Template, title, version, description, outputPath string) { |
| 225 | output, err := tpl.Execute(pongo2.Context{"schemas": schemas, "title": title, "version": version, "description": description}) |
| 226 | if err != nil { |
| 227 | util.ExitFatal(err) |
| 228 | return |
| 229 | } |
| 230 | if outputPath == "" { |
| 231 | fmt.Println(output) |
| 232 | } else { |
| 233 | ioutil.WriteFile(outputPath, []byte(output), 0644) |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | func applyTemplateForEachResourceGroup(schemas []*SchemaWithPolicy, tpl *pongo2.Template, version, description, outputPath string) { |
| 238 | for _, resourceGroup := range getAllResourceGroupsFromSchemas(schemas) { |