feat: invokable scripts (#387)

* basic list, create, and invoke working

* all commands working

* added support for create script body from file and invoke params from file

* linter cleanup

* update defaults to existing parameters if not provided

* updated generated mock files, added mock files for scripts, added basic script create test

* added mock script list

* cleanup pass, fixed not using params in list call

* added update mock test

* fixed mock tests requiring go 1.18

* updated openapi, integrated overrides upstream, added new override to fix codegen bug

* added nil check

* fixed routes
This commit is contained in:
Andrew Depke
2022-06-22 14:08:55 -06:00
committed by GitHub
parent a68106ee88
commit 760f07ed9e
31 changed files with 3207 additions and 337 deletions

View File

@ -119,6 +119,12 @@ paths:
$ref: "./openapi/src/oss/paths/replications_replicationID_validate.yml"
/api/v2/config:
$ref: "./openapi/src/oss/paths/config.yml"
/api/v2/scripts:
$ref: "./openapi/src/svc/invocable-scripts/paths/scripts.yml"
/api/v2/scripts/{scriptID}:
$ref: "./openapi/src/svc/invocable-scripts/paths/scripts_scriptID.yml"
/api/v2/scripts/{scriptID}/invoke:
$ref: "./overrides/paths/scripts_scriptID_invoke.yml"
components:
parameters:
TraceSpan:
@ -457,3 +463,17 @@ components:
$ref: "./openapi/src/oss/schemas/Replications.yml"
Config:
$ref: "./openapi/src/oss/schemas/Config.yml"
Script:
$ref: "./openapi/src/svc/invocable-scripts/schemas/Script.yml"
Scripts:
$ref: "./openapi/src/svc/invocable-scripts/schemas/Scripts.yml"
ScriptCreateRequest:
$ref: "./openapi/src/svc/invocable-scripts/schemas/ScriptCreateRequest.yml"
ScriptUpdateRequest:
$ref: "./openapi/src/svc/invocable-scripts/schemas/ScriptUpdateRequest.yml"
ScriptInvocationParams:
$ref: "./overrides/schemas/ScriptInvocationParams.yml"
ScriptHTTPResponseData:
$ref: "./openapi/src/svc/invocable-scripts/schemas/ScriptHTTPResponseData.yml"
ScriptLanguage:
$ref: "./openapi/src/svc/invocable-scripts/schemas/ScriptLanguage.yml"

View File

@ -0,0 +1,27 @@
post:
operationId: PostScriptsIDInvoke
tags:
- Invokable Scripts
summary: Invoke a script
description: Invokes a script and substitutes `params` keys referenced in the script with `params` key-values sent in the request body.
parameters:
- in: path
name: scriptID
schema:
type: string
required: true
requestBody:
content:
application/json:
schema:
$ref: '../schemas/ScriptInvocationParams.yml'
responses:
'200':
description: The result of the script execution.
content:
application/json:
schema:
$ref: '../../openapi/src/svc/invocable-scripts/schemas/ScriptHTTPResponseData.yml'
default:
description: Unexpected error
$ref: '../../openapi/src/common/responses/ServerError.yml'

View File

@ -0,0 +1,4 @@
type: object
properties:
params:
type: object