Add function_alias to execution, webhook and job

executions, webhooks and jobs endpoints are able to
take function_alias as a parameter.

An alias point to a function and a specific version of
this one.

Change-Id: I2e28a4e08fa80109767c28f77da7887a8603f2ec
This commit is contained in:
Gaëtan Trellu 2019-06-18 16:18:56 -04:00
parent 1df4688d10
commit 982c45c978
8 changed files with 136 additions and 51 deletions

View File

@ -36,10 +36,11 @@ Request
.. rest_parameters:: parameters.yaml .. rest_parameters:: parameters.yaml
- x-auth-token: x-auth-token - x-auth-token: x-auth-token
- function_id: function_id - function_id: execution_function_id
- function_alias: execution_function_alias
- input: execution_input - input: execution_input
- description: execution_description - description: execution_description
- function_version: execution_version - function_version: execution_function_version
- sync: execution_sync - sync: execution_sync
Request Example Request Example
@ -48,16 +49,19 @@ Request Example
.. literalinclude:: samples/executions/create-execution-request.json .. literalinclude:: samples/executions/create-execution-request.json
:language: javascript :language: javascript
.. literalinclude:: samples/executions/create-execution-alias-request.json
:language: javascript
Response Parameters Response Parameters
------------------- -------------------
.. rest_parameters:: parameters.yaml .. rest_parameters:: parameters.yaml
- id: id - id: id
- function_id: function_id - function_id: execution_function_id
- input: execution_input - input: execution_input
- description: execution_description - description: execution_description
- function_version: execution_version - function_version: execution_function_version
- sync: execution_sync - sync: execution_sync
- project_id: project_id - project_id: project_id
- status: status - status: status
@ -104,10 +108,10 @@ Response Parameters
.. rest_parameters:: parameters.yaml .. rest_parameters:: parameters.yaml
- id: id - id: id
- function_id: function_id - function_id: execution_function_id
- input: execution_input - input: execution_input
- description: execution_description - description: execution_description
- function_version: execution_version - function_version: execution_function_version
- sync: execution_sync - sync: execution_sync
- project_id: project_id - project_id: project_id
- status: status - status: status
@ -156,10 +160,10 @@ Response Parameters
.. rest_parameters:: parameters.yaml .. rest_parameters:: parameters.yaml
- id: id - id: id
- function_id: function_id - function_id: execution_function_id
- input: execution_input - input: execution_input
- description: execution_description - description: execution_description
- function_version: execution_version - function_version: execution_function_version
- sync: execution_sync - sync: execution_sync
- project_id: project_id - project_id: project_id
- status: status - status: status
@ -207,10 +211,10 @@ Response Parameters
.. rest_parameters:: parameters.yaml .. rest_parameters:: parameters.yaml
- id: id - id: id
- function_id: function_id - function_id: execution_function_id
- input: execution_input - input: execution_input
- description: execution_description - description: execution_description
- function_version: execution_version - function_version: execution_function_version
- sync: execution_sync - sync: execution_sync
- project_id: project_id - project_id: project_id
- status: status - status: status

View File

@ -37,8 +37,9 @@ Request
- x-auth-token: x-auth-token - x-auth-token: x-auth-token
- name: job_name - name: job_name
- function_id: function_id - function_id: job_function_id
- function_version: job_version - function_alias: job_function_alias
- function_version: job_function_version
- function_input: job_input - function_input: job_input
- pattern: job_pattern - pattern: job_pattern
- count: job_count - count: job_count
@ -49,6 +50,9 @@ Request Example
.. literalinclude:: samples/jobs/create-job-request.json .. literalinclude:: samples/jobs/create-job-request.json
:language: javascript :language: javascript
.. literalinclude:: samples/jobs/create-job-alias-request.json
:language: javascript
Response Parameters Response Parameters
------------------- -------------------
@ -56,8 +60,8 @@ Response Parameters
- id: id - id: id
- name: job_name - name: job_name
- function_id: function_id - function_id: job_function_id
- function_version: job_version - function_version: job_function_version
- function_input: job_input - function_input: job_input
- pattern: job_pattern - pattern: job_pattern
- count: job_count - count: job_count
@ -109,8 +113,8 @@ Response Parameters
- id: id - id: id
- name: job_name - name: job_name
- function_id: function_id - function_id: job_function_id
- function_version: job_version - function_version: job_function_version
- function_input: job_input - function_input: job_input
- pattern: job_pattern - pattern: job_pattern
- count: job_count - count: job_count
@ -163,8 +167,8 @@ Response Parameters
- id: id - id: id
- name: job_name - name: job_name
- function_id: function_id - function_id: job_function_id
- function_version: job_version - function_version: job_function_version
- function_input: job_input - function_input: job_input
- pattern: job_pattern - pattern: job_pattern
- count: job_count - count: job_count

View File

@ -108,6 +108,29 @@ execution_description:
required: false required: false
type: string type: string
execution_function_alias:
description: |
Alias name of the function (if an alias has been created)
in: body
required: false
type: string
execution_function_id:
description: |
ID for the function, if an alias is used then ``function_id`` is
not required
in: body
required: true
type: uuid
execution_function_version:
description: |
Version of the function to execute, default is ``0``. If an alias is
used then ``function_version`` is not required
in: body
required: false
type: integer
execution_input: execution_input:
description: | description: |
Input data to pass to the function, e.g. ``{"name": "foo"}`` Input data to pass to the function, e.g. ``{"name": "foo"}``
@ -122,13 +145,6 @@ execution_sync:
required: false required: false
type: bool type: bool
execution_version:
description: |
Version of the function to execute, default is ``0``
in: body
required: false
type: integer
function_code: function_code:
description: | description: |
Source code type, e.g. "``package``", "``swift``", "``image``" Source code type, e.g. "``package``", "``swift``", "``image``"
@ -282,6 +298,29 @@ job_first_execution:
required: true required: true
type: string type: string
job_function_alias:
description: |
Alias name of the function (if an alias has been created)
in: body
required: false
type: string
job_function_id:
description: |
ID for the function, if an alias is used then ``function_id`` is
not required
in: body
required: true
type: uuid
job_function_version:
description: |
Version of the function to execute, default is ``0``. If an alias is
used then ``function_version`` is not required
in: body
required: false
type: integer
job_input: job_input:
description: | description: |
Input data to pass to the function, e.g. ``{"name": "foo"}`` Input data to pass to the function, e.g. ``{"name": "foo"}``
@ -331,15 +370,6 @@ job_status_update:
required: false required: false
type: string type: string
job_version:
description: |
Version of the function to execute, default is ``0``
in: body
required: false
type: integer
project_id: project_id:
description: | description: |
ID for the project that owns the resource ID for the project that owns the resource
@ -457,16 +487,31 @@ webhook_description:
required: false required: false
type: string type: string
webhook_function_alias:
description: |
Alias name of the function (if an alias has been created)
in: body
required: false
type: string
webhook_function_id:
description: |
ID for the function, if an alias is used then ``function_id`` is
not required
in: body
required: true
type: uuid
webhook_function_version:
description: |
Version of the function
in: body
required: false
type: integer
webhook_url: webhook_url:
description: | description: |
Webhook URL Webhook URL
in: body in: body
required: true required: true
type: string type: string
webhook_version:
description: |
Version of the function
in: body
required: false
type: integer

View File

@ -0,0 +1,6 @@
{
"description": "Execution of a function based on an alias",
"sync": true,
"input": "{\"name\": \"foo\"}",
"function_alias": "hq-production-function"
}

View File

@ -0,0 +1,7 @@
{
"count": 5,
"name": "every-minute",
"pattern": "* * * * *",
"function_input": "{\"name\": \"Foo\"}",
"function_alias": "hq-production-function"
}

View File

@ -0,0 +1,4 @@
{
"function_alias": "hq-production-function",
"description": "Webhook based on function alias triggered by Jenkins"
}

View File

@ -0,0 +1,4 @@
{
"description": "Webhook based on function alias triggered by Gitlab",
"function_alias": "hq-staging-function"
}

View File

@ -36,8 +36,9 @@ Request
.. rest_parameters:: parameters.yaml .. rest_parameters:: parameters.yaml
- x-auth-token: x-auth-token - x-auth-token: x-auth-token
- function_id: function_id - function_id: webhook_function_id
- function_version: webhook_version - function_alias: webhook_function_alias
- function_version: webhook_function_version
- description: webhook_description - description: webhook_description
Request Example Request Example
@ -46,6 +47,9 @@ Request Example
.. literalinclude:: samples/webhooks/create-webhook-request.json .. literalinclude:: samples/webhooks/create-webhook-request.json
:language: javascript :language: javascript
.. literalinclude:: samples/webhooks/create-webhook-alias-request.json
:language: javascript
Response Parameters Response Parameters
------------------- -------------------
@ -53,8 +57,8 @@ Response Parameters
- id: id - id: id
- description: webhook_description - description: webhook_description
- function_id: function_id - function_id: webhook_function_id
- version_number: webhook_version - version_number: webhook_function_version
- webhook_url: webhook_url - webhook_url: webhook_url
- project_id: project_id - project_id: project_id
- created_at: created_at - created_at: created_at
@ -102,8 +106,8 @@ Response Parameters
- id: id - id: id
- description: webhook_description - description: webhook_description
- function_id: function_id - function_id: webhook_function_id
- version_number: webhook_version - version_number: webhook_function_version
- webhook_url: webhook_url - webhook_url: webhook_url
- project_id: project_id - project_id: project_id
- created_at: created_at - created_at: created_at
@ -152,8 +156,8 @@ Response Parameters
- id: id - id: id
- description: webhook_description - description: webhook_description
- function_id: function_id - function_id: webhook_function_id
- version_number: webhook_version - version_number: webhook_function_version
- webhook_url: webhook_url - webhook_url: webhook_url
- project_id: project_id - project_id: project_id
- created_at: created_at - created_at: created_at
@ -193,6 +197,10 @@ Request
- x-auth-token: x-auth-token - x-auth-token: x-auth-token
- webhook_id: path_webhook_id - webhook_id: path_webhook_id
- function_id: webhook_function_id
- function_alias: webhook_function_alias
- function_version: webhook_function_version
- description: webhook_description
Response Parameters Response Parameters
------------------- -------------------
@ -201,8 +209,8 @@ Response Parameters
- id: id - id: id
- description: webhook_description - description: webhook_description
- function_id: function_id - function_id: webhook_function_id
- version_number: webhook_version - version_number: webhook_function_version
- webhook_url: webhook_url - webhook_url: webhook_url
- project_id: project_id - project_id: project_id
- created_at: created_at - created_at: created_at
@ -214,6 +222,9 @@ Request Example
.. literalinclude:: samples/webhooks/update-webhook-request.json .. literalinclude:: samples/webhooks/update-webhook-request.json
:language: javascript :language: javascript
.. literalinclude:: samples/webhooks/update-webhook-alias-request.json
:language: javascript
Response Example Response Example
---------------- ----------------