From cfe02be081eb78a6c1398b3cd610eae91814b597 Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Fri, 12 Feb 2021 07:20:16 +0100 Subject: [PATCH] Add support for labels on automation functions Idea for these labels is to give instructions which labels to copy on step and on workflow when function step is added to the graph. Labels are defined with "step,workflow", "workflow" or "step" for value. UI should follow these instructions when copying labels to workflow and/or step. --- .../automation/http_request_handler.gen.go | 5 ++- .../automation/http_request_handler.yaml | 3 ++ automation/automation/log_handler.gen.go | 20 +++++---- automation/automation/log_handler.yaml | 7 +++ automation/automation/loop_handler.gen.go | 20 +++++---- automation/automation/loop_handler.yaml | 1 - automation/types/function.go | 2 + automation/types/workflow.go | 2 + compose/automation/modules_handler.gen.go | 5 ++- compose/automation/modules_handler.yaml | 4 ++ compose/automation/namespaces_handler.gen.go | 5 ++- compose/automation/namespaces_handler.yaml | 4 ++ compose/automation/records_handler.gen.go | 40 ++++++++++------- compose/automation/records_handler.yaml | 23 ++++++++++ pkg/codegen/afunc.go | 1 + pkg/codegen/assets/afunc.gen.go.tpl | 1 + system/automation/roles_handler.gen.go | 45 +++++++++++-------- system/automation/roles_handler.yaml | 25 +++++++++++ system/automation/users_handler.gen.go | 45 +++++++++++-------- system/automation/users_handler.yaml | 25 +++++++++++ 20 files changed, 208 insertions(+), 75 deletions(-) diff --git a/automation/automation/http_request_handler.gen.go b/automation/automation/http_request_handler.gen.go index 722f90555..e9f7f7705 100644 --- a/automation/automation/http_request_handler.gen.go +++ b/automation/automation/http_request_handler.gen.go @@ -98,8 +98,9 @@ func (a httpRequestSendArgs) GetBody() (bool, string, io.Reader, interface{}) { // } func (h httpRequestHandler) Send() *atypes.Function { return &atypes.Function{ - Ref: "httpRequestSend", - Kind: "function", + Ref: "httpRequestSend", + Kind: "function", + Labels: map[string]string{"http request": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Sends HTTP request", }, diff --git a/automation/automation/http_request_handler.yaml b/automation/automation/http_request_handler.yaml index 12f634019..6cdb40265 100644 --- a/automation/automation/http_request_handler.yaml +++ b/automation/automation/http_request_handler.yaml @@ -67,10 +67,13 @@ results: body: &rBody wf: Reader + functions: send: meta: short: Sends HTTP request + labels: + "http request": "step,workflow" params: url: *url method: *method diff --git a/automation/automation/log_handler.gen.go b/automation/automation/log_handler.gen.go index 186bdc14a..429fbfd8c 100644 --- a/automation/automation/log_handler.gen.go +++ b/automation/automation/log_handler.gen.go @@ -51,8 +51,9 @@ type ( // } func (h logHandler) Debug() *atypes.Function { return &atypes.Function{ - Ref: "logDebug", - Kind: "function", + Ref: "logDebug", + Kind: "function", + Labels: map[string]string{"debug": "step", "logger": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Writes debug log message", }, @@ -103,8 +104,9 @@ type ( // } func (h logHandler) Info() *atypes.Function { return &atypes.Function{ - Ref: "logInfo", - Kind: "function", + Ref: "logInfo", + Kind: "function", + Labels: map[string]string{"debug": "step", "logger": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Writes info log message", }, @@ -155,8 +157,9 @@ type ( // } func (h logHandler) Warn() *atypes.Function { return &atypes.Function{ - Ref: "logWarn", - Kind: "function", + Ref: "logWarn", + Kind: "function", + Labels: map[string]string{"debug": "step", "logger": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Writes warn log message", }, @@ -207,8 +210,9 @@ type ( // } func (h logHandler) Error() *atypes.Function { return &atypes.Function{ - Ref: "logError", - Kind: "function", + Ref: "logError", + Kind: "function", + Labels: map[string]string{"debug": "step", "logger": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Writes error log message", }, diff --git a/automation/automation/log_handler.yaml b/automation/automation/log_handler.yaml index 69bf57b63..80d66a263 100644 --- a/automation/automation/log_handler.yaml +++ b/automation/automation/log_handler.yaml @@ -7,11 +7,15 @@ params: types: - { wf: KV } +labels: &labels + debug: "step" + logger: "step,workflow" functions: debug: meta: short: Writes debug log message + labels: *labels params: message: *message fields: *fields @@ -19,6 +23,7 @@ functions: info: meta: short: Writes info log message + labels: *labels params: message: *message fields: *fields @@ -26,6 +31,7 @@ functions: warn: meta: short: Writes warn log message + labels: *labels params: message: *message fields: *fields @@ -33,6 +39,7 @@ functions: error: meta: short: Writes error log message + labels: *labels params: message: *message fields: *fields diff --git a/automation/automation/loop_handler.gen.go b/automation/automation/loop_handler.gen.go index 7d9c9ab38..7e9453333 100644 --- a/automation/automation/loop_handler.gen.go +++ b/automation/automation/loop_handler.gen.go @@ -61,8 +61,9 @@ type ( // } func (h loopHandler) Sequence() *atypes.Function { return &atypes.Function{ - Ref: "loopSequence", - Kind: "iterator", + Ref: "loopSequence", + Kind: "iterator", + Labels: map[string]string(nil), Meta: &atypes.FunctionMeta{ Short: "Iterates over sequence of numbers", }, @@ -133,8 +134,9 @@ type ( // } func (h loopHandler) Do() *atypes.Function { return &atypes.Function{ - Ref: "loopDo", - Kind: "iterator", + Ref: "loopDo", + Kind: "iterator", + Labels: map[string]string(nil), Meta: &atypes.FunctionMeta{ Short: "Iterates while condition is true", }, @@ -185,8 +187,9 @@ type ( // } func (h loopHandler) Each() *atypes.Function { return &atypes.Function{ - Ref: "loopEach", - Kind: "iterator", + Ref: "loopEach", + Kind: "iterator", + Labels: map[string]string(nil), Meta: &atypes.FunctionMeta{ Short: "Iterates over set of items", }, @@ -241,8 +244,9 @@ type ( // } func (h loopHandler) Lines() *atypes.Function { return &atypes.Function{ - Ref: "loopLines", - Kind: "iterator", + Ref: "loopLines", + Kind: "iterator", + Labels: map[string]string(nil), Meta: &atypes.FunctionMeta{ Short: "Iterates over lines from stream", }, diff --git a/automation/automation/loop_handler.yaml b/automation/automation/loop_handler.yaml index 5d9c38a61..c91d4132b 100644 --- a/automation/automation/loop_handler.yaml +++ b/automation/automation/loop_handler.yaml @@ -3,7 +3,6 @@ name: loop imports: - io - functions: sequence: kind: iterator diff --git a/automation/types/function.go b/automation/types/function.go index 53057b6d9..fbb5ffabc 100644 --- a/automation/types/function.go +++ b/automation/types/function.go @@ -24,6 +24,8 @@ type ( Handler FunctionHandler `json:"-"` Iterator IteratorHandler `json:"-"` + + Labels map[string]string `json:"labels,omitempty"` } FunctionMeta struct { diff --git a/automation/types/workflow.go b/automation/types/workflow.go index f177cc89b..db8f44128 100644 --- a/automation/types/workflow.go +++ b/automation/types/workflow.go @@ -95,6 +95,8 @@ type ( Results []*Expr `json:"results"` Meta WorkflowStepMeta `json:"meta,omitempty"` + + Labels map[string]string `json:"labels,omitempty"` } WorkflowStepMeta struct { diff --git a/compose/automation/modules_handler.gen.go b/compose/automation/modules_handler.gen.go index 137292543..dd377fddd 100644 --- a/compose/automation/modules_handler.gen.go +++ b/compose/automation/modules_handler.gen.go @@ -67,8 +67,9 @@ func (a modulesLookupArgs) GetNamespace() (bool, uint64, string, *types.Namespac // } func (h modulesHandler) Lookup() *atypes.Function { return &atypes.Function{ - Ref: "composeModulesLookup", - Kind: "function", + Ref: "composeModulesLookup", + Kind: "function", + Labels: map[string]string{"compose": "step,workflow", "lookup": "step", "module": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Lookup for compose Lookup by ID", }, diff --git a/compose/automation/modules_handler.yaml b/compose/automation/modules_handler.yaml index 2c7264269..f28fcaf2a 100644 --- a/compose/automation/modules_handler.yaml +++ b/compose/automation/modules_handler.yaml @@ -28,5 +28,9 @@ functions: params: module: *moduleLookup namespace: *namespaceLookup + labels: + lookup: "step" + module: "step,workflow" + compose: "step,workflow" results: module: *rvModule diff --git a/compose/automation/namespaces_handler.gen.go b/compose/automation/namespaces_handler.gen.go index 4450dc9de..641e201e8 100644 --- a/compose/automation/namespaces_handler.gen.go +++ b/compose/automation/namespaces_handler.gen.go @@ -57,8 +57,9 @@ func (a namespacesLookupArgs) GetNamespace() (bool, uint64, string, *types.Names // } func (h namespacesHandler) Lookup() *atypes.Function { return &atypes.Function{ - Ref: "composeNamespacesLookup", - Kind: "function", + Ref: "composeNamespacesLookup", + Kind: "function", + Labels: map[string]string{"compose": "step,workflow", "lookup": "step", "namespace": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Lookup for compose namespace by ID", }, diff --git a/compose/automation/namespaces_handler.yaml b/compose/automation/namespaces_handler.yaml index 81aa9dc47..56dac505f 100644 --- a/compose/automation/namespaces_handler.yaml +++ b/compose/automation/namespaces_handler.yaml @@ -18,6 +18,10 @@ functions: lookup: meta: short: Lookup for compose namespace by ID + labels: + lookup: "step" + namespace: "step,workflow" + compose: "step,workflow" params: namespace: *namespaceLookup results: diff --git a/compose/automation/records_handler.gen.go b/compose/automation/records_handler.gen.go index 6a00ac077..829f837eb 100644 --- a/compose/automation/records_handler.gen.go +++ b/compose/automation/records_handler.gen.go @@ -83,8 +83,9 @@ func (a recordsLookupArgs) GetRecord() (bool, uint64, *types.Record) { // } func (h recordsHandler) Lookup() *atypes.Function { return &atypes.Function{ - Ref: "composeRecordsLookup", - Kind: "function", + Ref: "composeRecordsLookup", + Kind: "function", + Labels: map[string]string{"compose": "step,workflow", "record": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Lookup for compose record by ID", }, @@ -253,8 +254,9 @@ func (a recordsSearchArgs) GetNamespace() (bool, uint64, string, *types.Namespac // } func (h recordsHandler) Search() *atypes.Function { return &atypes.Function{ - Ref: "composeRecordsSearch", - Kind: "function", + Ref: "composeRecordsSearch", + Kind: "function", + Labels: map[string]string{"compose": "step,workflow", "record": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Searches for records and returns them", }, @@ -495,8 +497,9 @@ func (a recordsEachArgs) GetNamespace() (bool, uint64, string, *types.Namespace) // } func (h recordsHandler) Each() *atypes.Function { return &atypes.Function{ - Ref: "composeRecordsEach", - Kind: "iterator", + Ref: "composeRecordsEach", + Kind: "iterator", + Labels: map[string]string{"compose": "step,workflow", "record": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Searches for records and iterates over results", }, @@ -661,8 +664,9 @@ func (a recordsNewArgs) GetNamespace() (bool, uint64, string, *types.Namespace) // } func (h recordsHandler) New() *atypes.Function { return &atypes.Function{ - Ref: "composeRecordsNew", - Kind: "function", + Ref: "composeRecordsNew", + Kind: "function", + Labels: map[string]string{"compose": "step,workflow", "record": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Make a new record", }, @@ -772,8 +776,9 @@ type ( // } func (h recordsHandler) Validate() *atypes.Function { return &atypes.Function{ - Ref: "composeRecordsValidate", - Kind: "function", + Ref: "composeRecordsValidate", + Kind: "function", + Labels: map[string]string{"compose": "step,workflow", "record": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Validate record", }, @@ -851,8 +856,9 @@ type ( // } func (h recordsHandler) Create() *atypes.Function { return &atypes.Function{ - Ref: "composeRecordsCreate", - Kind: "function", + Ref: "composeRecordsCreate", + Kind: "function", + Labels: map[string]string{"compose": "step,workflow", "create": "step", "record": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Creates and stores a new record", }, @@ -927,8 +933,9 @@ type ( // } func (h recordsHandler) Update() *atypes.Function { return &atypes.Function{ - Ref: "composeRecordsUpdate", - Kind: "function", + Ref: "composeRecordsUpdate", + Kind: "function", + Labels: map[string]string{"compose": "step,workflow", "record": "step,workflow", "update": "step"}, Meta: &atypes.FunctionMeta{ Short: "Updates an existing record", }, @@ -1005,8 +1012,9 @@ func (a recordsDeleteArgs) GetRecord() (bool, uint64, *types.Record) { // } func (h recordsHandler) Delete() *atypes.Function { return &atypes.Function{ - Ref: "composeRecordsDelete", - Kind: "function", + Ref: "composeRecordsDelete", + Kind: "function", + Labels: map[string]string{"compose": "step,workflow", "delete": "step", "record": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Soft deletes compose record by ID", }, diff --git a/compose/automation/records_handler.yaml b/compose/automation/records_handler.yaml index a9465d180..a76443d41 100644 --- a/compose/automation/records_handler.yaml +++ b/compose/automation/records_handler.yaml @@ -85,10 +85,16 @@ params: types: - { wf: String } +labels: &labels + record: "step,workflow" + compose: "step,workflow" + functions: lookup: meta: short: Lookup for compose record by ID + labels: + <<: *labels params: module: *moduleLookup namespace: *namespaceLookup @@ -99,6 +105,8 @@ functions: search: meta: short: Searches for records and returns them + labels: + <<: *labels params: *filterParams results: records: @@ -111,6 +119,8 @@ functions: kind: iterator meta: short: Searches for records and iterates over results + labels: + <<: *labels params: *filterParams results: record: *rvRecord @@ -120,6 +130,8 @@ functions: new: meta: short: Make a new record + labels: + <<: *labels params: module: *moduleLookup namespace: *namespaceLookup @@ -129,6 +141,8 @@ functions: validate: meta: short: Validate record + labels: + <<: *labels params: record: *record results: @@ -140,6 +154,9 @@ functions: create: meta: short: Creates and stores a new record + labels: + <<: *labels + create: "step" params: record: <<: *record @@ -150,6 +167,9 @@ functions: update: meta: short: Updates an existing record + labels: + <<: *labels + update: "step" params: record: <<: *record @@ -160,6 +180,9 @@ functions: delete: meta: short: Soft deletes compose record by ID + labels: + <<: *labels + delete: "step" params: record: *recordLookup diff --git a/pkg/codegen/afunc.go b/pkg/codegen/afunc.go index b072e138e..122e8a0b6 100644 --- a/pkg/codegen/afunc.go +++ b/pkg/codegen/afunc.go @@ -32,6 +32,7 @@ type ( aFuncDef struct { Name string Kind string + Labels map[string]string Meta *aFuncMetaDef Params aFuncParamSet Results aFuncResultSet diff --git a/pkg/codegen/assets/afunc.gen.go.tpl b/pkg/codegen/assets/afunc.gen.go.tpl index 60729af12..43ac76f9e 100644 --- a/pkg/codegen/assets/afunc.gen.go.tpl +++ b/pkg/codegen/assets/afunc.gen.go.tpl @@ -92,6 +92,7 @@ func (h {{ $.Name }}Handler) {{ export .Name }}() *atypes.Function { return &atypes.Function{ Ref: {{ printf "%q" ( $REF ) }}, Kind: {{ printf "%q" .Kind }}, + Labels: {{ printf "%#v" .Labels }}, {{- if .Meta }} Meta: &atypes.FunctionMeta{ {{- if .Meta.Short }} diff --git a/system/automation/roles_handler.gen.go b/system/automation/roles_handler.gen.go index f696b7fb2..23b56b835 100644 --- a/system/automation/roles_handler.gen.go +++ b/system/automation/roles_handler.gen.go @@ -65,8 +65,9 @@ func (a rolesLookupArgs) GetLookup() (bool, uint64, string, *types.Role) { // } func (h rolesHandler) Lookup() *atypes.Function { return &atypes.Function{ - Ref: "rolesLookup", - Kind: "function", + Ref: "rolesLookup", + Kind: "function", + Labels: map[string]string{"users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Looks-up for role by ID", }, @@ -189,8 +190,9 @@ type ( // } func (h rolesHandler) Search() *atypes.Function { return &atypes.Function{ - Ref: "rolesSearch", - Kind: "function", + Ref: "rolesSearch", + Kind: "function", + Labels: map[string]string{"users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Searches for roles and returns them", }, @@ -398,8 +400,9 @@ type ( // } func (h rolesHandler) Each() *atypes.Function { return &atypes.Function{ - Ref: "rolesEach", - Kind: "iterator", + Ref: "rolesEach", + Kind: "iterator", + Labels: map[string]string(nil), Meta: &atypes.FunctionMeta{ Short: "Searches for roles and iterates over results", }, @@ -514,8 +517,9 @@ type ( // } func (h rolesHandler) Create() *atypes.Function { return &atypes.Function{ - Ref: "rolesCreate", - Kind: "function", + Ref: "rolesCreate", + Kind: "function", + Labels: map[string]string{"create": "step", "users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Creates new role", }, @@ -590,8 +594,9 @@ type ( // } func (h rolesHandler) Update() *atypes.Function { return &atypes.Function{ - Ref: "rolesUpdate", - Kind: "function", + Ref: "rolesUpdate", + Kind: "function", + Labels: map[string]string{"update": "step", "users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Updates exiting role", }, @@ -669,8 +674,9 @@ func (a rolesDeleteArgs) GetLookup() (bool, uint64, string, *types.Role) { // } func (h rolesHandler) Delete() *atypes.Function { return &atypes.Function{ - Ref: "rolesDelete", - Kind: "function", + Ref: "rolesDelete", + Kind: "function", + Labels: map[string]string{"delete": "step", "users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Deletes the role", }, @@ -733,8 +739,9 @@ func (a rolesRecoverArgs) GetLookup() (bool, uint64, string, *types.Role) { // } func (h rolesHandler) Recover() *atypes.Function { return &atypes.Function{ - Ref: "rolesRecover", - Kind: "function", + Ref: "rolesRecover", + Kind: "function", + Labels: map[string]string{"recover": "step", "users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Recovers deleted role", }, @@ -797,8 +804,9 @@ func (a rolesArchiveArgs) GetLookup() (bool, uint64, string, *types.Role) { // } func (h rolesHandler) Archive() *atypes.Function { return &atypes.Function{ - Ref: "rolesArchive", - Kind: "function", + Ref: "rolesArchive", + Kind: "function", + Labels: map[string]string{"archive": "step", "users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Archives the role", }, @@ -861,8 +869,9 @@ func (a rolesUnarchiveArgs) GetLookup() (bool, uint64, string, *types.Role) { // } func (h rolesHandler) Unarchive() *atypes.Function { return &atypes.Function{ - Ref: "rolesUnarchive", - Kind: "function", + Ref: "rolesUnarchive", + Kind: "function", + Labels: map[string]string{"unarchive": "step", "users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Unarchives the role", }, diff --git a/system/automation/roles_handler.yaml b/system/automation/roles_handler.yaml index a297792f9..381bbe88f 100644 --- a/system/automation/roles_handler.yaml +++ b/system/automation/roles_handler.yaml @@ -61,10 +61,15 @@ params: types: - { wf: String } +labels: &labels + users: "step,workflow" + functions: lookup: meta: short: Looks-up for role by ID + labels: + <<: *labels params: lookup: *lookup results: @@ -73,6 +78,8 @@ functions: search: meta: short: Searches for roles and returns them + labels: + <<: *labels params: *filterParams results: roles: @@ -93,6 +100,9 @@ functions: create: meta: short: Creates new role + labels: + <<: *labels + create: "step" params: role: <<: *role @@ -103,6 +113,9 @@ functions: update: meta: short: Updates exiting role + labels: + <<: *labels + update: "step" params: role: <<: *role @@ -113,23 +126,35 @@ functions: delete: meta: short: Deletes the role + labels: + <<: *labels + delete: "step" params: lookup: *lookup recover: meta: short: Recovers deleted role + labels: + <<: *labels + recover: "step" params: lookup: *lookup archive: meta: short: Archives the role + labels: + <<: *labels + archive: "step" params: lookup: *lookup unarchive: meta: short: Unarchives the role + labels: + <<: *labels + unarchive: "step" params: lookup: *lookup diff --git a/system/automation/users_handler.gen.go b/system/automation/users_handler.gen.go index 3c57c582e..f364796fb 100644 --- a/system/automation/users_handler.gen.go +++ b/system/automation/users_handler.gen.go @@ -66,8 +66,9 @@ func (a usersLookupArgs) GetLookup() (bool, uint64, string, string, *types.User) // } func (h usersHandler) Lookup() *atypes.Function { return &atypes.Function{ - Ref: "usersLookup", - Kind: "function", + Ref: "usersLookup", + Kind: "function", + Labels: map[string]string{"users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Looks-up for user by ID", }, @@ -189,8 +190,9 @@ type ( // } func (h usersHandler) Search() *atypes.Function { return &atypes.Function{ - Ref: "usersSearch", - Kind: "function", + Ref: "usersSearch", + Kind: "function", + Labels: map[string]string{"users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Searches for users and returns them", }, @@ -390,8 +392,9 @@ type ( // } func (h usersHandler) Each() *atypes.Function { return &atypes.Function{ - Ref: "usersEach", - Kind: "iterator", + Ref: "usersEach", + Kind: "iterator", + Labels: map[string]string{"users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Searches for users and iterates over results", }, @@ -501,8 +504,9 @@ type ( // } func (h usersHandler) Create() *atypes.Function { return &atypes.Function{ - Ref: "usersCreate", - Kind: "function", + Ref: "usersCreate", + Kind: "function", + Labels: map[string]string{"users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Creates new user", }, @@ -577,8 +581,9 @@ type ( // } func (h usersHandler) Update() *atypes.Function { return &atypes.Function{ - Ref: "usersUpdate", - Kind: "function", + Ref: "usersUpdate", + Kind: "function", + Labels: map[string]string{"users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Updates exiting user", }, @@ -657,8 +662,9 @@ func (a usersDeleteArgs) GetLookup() (bool, uint64, string, string, *types.User) // } func (h usersHandler) Delete() *atypes.Function { return &atypes.Function{ - Ref: "usersDelete", - Kind: "function", + Ref: "usersDelete", + Kind: "function", + Labels: map[string]string{"delete": "step", "users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Deletes user", }, @@ -724,8 +730,9 @@ func (a usersRecoverArgs) GetLookup() (bool, uint64, string, string, *types.User // } func (h usersHandler) Recover() *atypes.Function { return &atypes.Function{ - Ref: "usersRecover", - Kind: "function", + Ref: "usersRecover", + Kind: "function", + Labels: map[string]string{"recover": "step", "users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Recovers deleted user", }, @@ -791,8 +798,9 @@ func (a usersSuspendArgs) GetLookup() (bool, uint64, string, string, *types.User // } func (h usersHandler) Suspend() *atypes.Function { return &atypes.Function{ - Ref: "usersSuspend", - Kind: "function", + Ref: "usersSuspend", + Kind: "function", + Labels: map[string]string{"suspend": "step", "users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Suspends user", }, @@ -858,8 +866,9 @@ func (a usersUnsuspendArgs) GetLookup() (bool, uint64, string, string, *types.Us // } func (h usersHandler) Unsuspend() *atypes.Function { return &atypes.Function{ - Ref: "usersUnsuspend", - Kind: "function", + Ref: "usersUnsuspend", + Kind: "function", + Labels: map[string]string{"unsuspend": "step", "users": "step,workflow"}, Meta: &atypes.FunctionMeta{ Short: "Unsuspends user", }, diff --git a/system/automation/users_handler.yaml b/system/automation/users_handler.yaml index a38147bb2..83ca40326 100644 --- a/system/automation/users_handler.yaml +++ b/system/automation/users_handler.yaml @@ -58,12 +58,17 @@ snippets: types: - { wf: String } +labels: &labels + users: "step,workflow" + functions: lookup: meta: short: Looks-up for user by ID params: lookup: *lookup + labels: + <<: *labels results: user: *rvUser @@ -71,6 +76,8 @@ functions: meta: short: Searches for users and returns them params: *filterParams + labels: + <<: *labels results: users: <<: *rvUser @@ -83,6 +90,8 @@ functions: meta: short: Searches for users and iterates over results params: *filterParams + labels: + <<: *labels results: user: *rvUser total: *rvTotal @@ -90,6 +99,8 @@ functions: create: meta: short: Creates new user + labels: + <<: *labels params: user: <<: *user @@ -100,6 +111,8 @@ functions: update: meta: short: Updates exiting user + labels: + <<: *labels params: user: <<: *user @@ -108,24 +121,36 @@ functions: user: *rvUser delete: + labels: + <<: *labels + delete: "step" meta: short: Deletes user params: lookup: *lookup recover: + labels: + <<: *labels + recover: "step" meta: short: Recovers deleted user params: lookup: *lookup suspend: + labels: + <<: *labels + suspend: "step" meta: short: Suspends user params: lookup: *lookup unsuspend: + labels: + <<: *labels + unsuspend: "step" meta: short: Unsuspends user params: