Reorganized and split (rbac) resource type codegen
This commit is contained in:
-7
@@ -23,13 +23,6 @@ var (
|
||||
_ = strconv.FormatUint
|
||||
)
|
||||
|
||||
const (
|
||||
{{- range .types }}
|
||||
{{ .const }} = {{ printf "%q" .type }}
|
||||
{{- end }}
|
||||
)
|
||||
|
||||
|
||||
{{- range .types }}
|
||||
|
||||
// RbacResource returns string representation of RBAC resource for {{ .goType }} by calling {{ .resFunc }} fn
|
||||
@@ -0,0 +1,9 @@
|
||||
package {{ .package }}
|
||||
|
||||
{{ template "gocode/header-gentext.tpl" }}
|
||||
|
||||
const (
|
||||
{{- range .types }}
|
||||
{{ .const }} = {{ printf "%q" .type }}
|
||||
{{- end }}
|
||||
)
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
[...schema.#codegen] &
|
||||
[
|
||||
for cmp in app.corteza.components {
|
||||
template: "gocode/rbac/$component_types.go.tpl"
|
||||
template: "gocode/rbac/$component_types_rbac.go.tpl"
|
||||
output: "\(cmp.ident)/types/rbac.gen.go"
|
||||
payload: {
|
||||
package: "types"
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package codegen
|
||||
|
||||
import (
|
||||
"github.com/cortezaproject/corteza-server/app"
|
||||
"github.com/cortezaproject/corteza-server/codegen/schema"
|
||||
)
|
||||
|
||||
[...schema.#codegen] &
|
||||
[
|
||||
for cmp in app.corteza.components {
|
||||
template: "gocode/types/$component_resources.go.tpl"
|
||||
output: "\(cmp.ident)/types/resources.gen.go"
|
||||
payload: {
|
||||
package: "types"
|
||||
|
||||
cmpIdent: cmp.ident
|
||||
// Operation/resource validators, grouped by resource
|
||||
types: [
|
||||
for res in cmp.resources {
|
||||
const: "\(res.expIdent)ResourceType"
|
||||
type: res.fqrn
|
||||
},
|
||||
{
|
||||
const: "ComponentResourceType"
|
||||
type: cmp.fqrn
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user