Serve event contraints via API
This commit is contained in:
@@ -4,14 +4,10 @@ package rest
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
//
|
||||
// Definitions file that controls how this file is generated:
|
||||
// {{ .Source }}
|
||||
|
||||
func getEventTypeDefinitions() []eventTypeDef {
|
||||
return []eventTypeDef{
|
||||
{{ range .Definitions }}
|
||||
// {{ printf "%#v" .Imports }}
|
||||
{{ range $r := .Resources }}
|
||||
{{ template "eventTypeDefinitions" dict "res" $r "type" "on" "types" .On }}
|
||||
{{ template "eventTypeDefinitions" dict "res" $r "type" "before" "types" .BeforeAfter }}
|
||||
@@ -37,6 +33,13 @@ func getEventTypeDefinitions() []eventTypeDef {
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
},
|
||||
Constraints: []eventTypeConstraintDef{
|
||||
{{ range $.res.Constraints }}
|
||||
{
|
||||
Name: {{ printf "%q" .Name }},
|
||||
},
|
||||
{{ end }}
|
||||
},
|
||||
},
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
@@ -38,10 +38,11 @@ type (
|
||||
// used for filename
|
||||
ResourceFile string
|
||||
|
||||
On []string `yaml:"on"`
|
||||
BeforeAfter []string `yaml:"ba"`
|
||||
Properties []*eventProps `yaml:"props"`
|
||||
Result string `yaml:"result"`
|
||||
On []string `yaml:"on"`
|
||||
BeforeAfter []string `yaml:"ba"`
|
||||
Properties []*eventProps `yaml:"props"`
|
||||
Constraints []*eventConstraint `yaml:"constraints"`
|
||||
Result string `yaml:"result"`
|
||||
}
|
||||
|
||||
eventProps struct {
|
||||
@@ -58,6 +59,10 @@ type (
|
||||
// Do not allow change of the variable through
|
||||
Immutable bool
|
||||
}
|
||||
|
||||
eventConstraint struct {
|
||||
Name string
|
||||
}
|
||||
)
|
||||
|
||||
func procEvents(mm ...string) (dd []*eventsDef, err error) {
|
||||
|
||||
Reference in New Issue
Block a user