From f734fc1de2c6af105d1a688336e8b26f17c3f62f Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Thu, 11 Mar 2021 13:25:46 -0500 Subject: [PATCH] Add events for functions and executions --- app/config/events.php | 37 ++++++++++++++++++++++++++++++- app/controllers/api/functions.php | 7 ++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/app/config/events.php b/app/config/events.php index 2bb3862fd..47b902fb8 100644 --- a/app/config/events.php +++ b/app/config/events.php @@ -97,6 +97,41 @@ return [ 'model' => Response::MODEL_ANY, 'note' => '', ], + 'functions.create' => [ + 'description' => 'This event triggers when a function is created.', + 'model' => Response::MODEL_FUNCTION, + 'note' => 'version >= 0.7', + ], + 'functions.update' => [ + 'description' => 'This event triggers when a function is updated.', + 'model' => Response::MODEL_FUNCTION, + 'note' => 'version >= 0.7', + ], + 'functions.delete' => [ + 'description' => 'This event triggers when a function is deleted.', + 'model' => Response::MODEL_ANY, + 'note' => 'version >= 0.7', + ], + 'functions.tags.create' => [ + 'description' => 'This event triggers when a function tag is created.', + 'model' => Response::MODEL_TAG, + 'note' => 'version >= 0.7', + ], + 'functions.tags.update' => [ + 'description' => 'This event triggers when a function tag is updated.', + 'model' => Response::MODEL_FUNCTION, + 'note' => 'version >= 0.7', + ], + 'functions.tags.delete' => [ + 'description' => 'This event triggers when a function tag is deleted.', + 'model' => Response::MODEL_ANY, + 'note' => 'version >= 0.7', + ], + 'functions.executions.create' => [ + 'description' => 'This event triggers when a function execution is created.', + 'model' => Response::MODEL_EXECUTION, + 'note' => 'version >= 0.7', + ], 'storage.files.create' => [ 'description' => 'This event triggers when a storage file is created.', 'model' => Response::MODEL_FILE, @@ -162,4 +197,4 @@ return [ 'model' => Response::MODEL_MEMBERSHIP, 'note' => 'version >= 0.7', ], -]; \ No newline at end of file +]; diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 7a6b11bcd..e6ff1bad5 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -27,6 +27,7 @@ App::post('/v1/functions') ->groups(['api', 'functions']) ->desc('Create Function') ->label('scope', 'functions.write') + ->label('event', 'functions.create') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'functions') ->label('sdk.method', 'create') @@ -265,6 +266,7 @@ App::put('/v1/functions/:functionId') ->groups(['api', 'functions']) ->desc('Update Function') ->label('scope', 'functions.write') + ->label('event', 'functions.update') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'functions') ->label('sdk.method', 'update') @@ -330,6 +332,7 @@ App::patch('/v1/functions/:functionId/tag') ->groups(['api', 'functions']) ->desc('Update Function Tag') ->label('scope', 'functions.write') + ->label('event', 'functions.tags.update') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'functions') ->label('sdk.method', 'updateTag') @@ -387,6 +390,7 @@ App::delete('/v1/functions/:functionId') ->groups(['api', 'functions']) ->desc('Delete Function') ->label('scope', 'functions.write') + ->label('event', 'functions.delete') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'functions') ->label('sdk.method', 'delete') @@ -424,6 +428,7 @@ App::post('/v1/functions/:functionId/tags') ->groups(['api', 'functions']) ->desc('Create Tag') ->label('scope', 'functions.write') + ->label('event', 'functions.tags.create') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'functions') ->label('sdk.method', 'createTag') @@ -601,6 +606,7 @@ App::delete('/v1/functions/:functionId/tags/:tagId') ->groups(['api', 'functions']) ->desc('Delete Tag') ->label('scope', 'functions.write') + ->label('event', 'functions.tags.delete') ->label('sdk.platform', [APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'functions') ->label('sdk.method', 'deleteTag') @@ -662,6 +668,7 @@ App::post('/v1/functions/:functionId/executions') ->groups(['api', 'functions']) ->desc('Create Execution') ->label('scope', 'execution.write') + ->label('event', 'functions.executions.create') ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER]) ->label('sdk.namespace', 'functions') ->label('sdk.method', 'createExecution')