Skip to content

Commit

Permalink
feat(COR-683): add api to create, update, delete and list variable en…
Browse files Browse the repository at this point in the history
…dpoint
  • Loading branch information
pggb25 committed Jul 21, 2023
1 parent bf9c1c3 commit 8675858
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -744,10 +744,14 @@ paths:
$ref: './resources/JobClone.yaml'
/service/{serviceId}/deploymentStage:
$ref: './resources/deploymentStage/ServiceDeploymentStage.yaml'
/variable:
$ref: './resources/variable/Variable.yaml'
/variable/{variableId}/alias:
$ref: './resources/variable/VariableAlias.yaml'
/variable/{variableId}/override:
$ref: './resources/variable/VariableOverride.yaml'
/variable/{variableId}:
$ref: './resources/variable/VariableRef.yaml'
#/organization/{organizationId}/job/preview:
#/organization/{organizationId}/job/deploy:
components:
Expand Down
64 changes: 64 additions & 0 deletions src/resources/variable/Variable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
get:

Check warning on line 1 in src/resources/variable/Variable.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

operation-description

Operation "description" must be present and non-empty string.
summary: 'List variables'
operationId: listVariables
parameters:
- in: query
name: parent_id
schema:
type: string
format: uuid
description: the id where the variable will be added
- in: query
name: scope
schema:
$ref: '../../schemas/enums/APIVariableScope.yaml'
description: the scope of the parent where the variable will be added
- in: query
name: is_secret
schema:
type: boolean
nullable: true
description: true if the variable is a secret
tags:
- Variable Main Calls

Check warning on line 23 in src/resources/variable/Variable.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

operation-tag-defined

Operation tags must be defined in global tags.
responses:
'200':
description: 'List variables'
content:
application/json:
schema:
$ref: '../../schemas/variable/VariableResponseList.yaml'
'401':
$ref: '../../responses/NotAuthorized.yaml'
'403':
$ref: '../../responses/Forbidden.yaml'
'404':
$ref: '../../responses/NotFound.yaml'
post:
summary: 'Create a variable'
description: |
- Create a variable at the level defined in the request body.
operationId: createVariable

tags:
- Variable Main Calls

Check warning on line 44 in src/resources/variable/Variable.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

operation-tag-defined

Operation tags must be defined in global tags.
requestBody:
content:
application/json:
schema:
$ref: '../../schemas/variable/VariableRequest.yaml'
responses:
'201':
description: 'Create a variable'
content:
application/json:
schema:
$ref: '../../schemas/variable/VariableResponse.yaml'
'400':
$ref: '../../responses/BadRequest.yaml'
'401':
$ref: '../../responses/NotAuthorized.yaml'
'403':
$ref: '../../responses/Forbidden.yaml'
'404':
$ref: '../../responses/NotFound.yaml'
55 changes: 55 additions & 0 deletions src/resources/variable/VariableRef.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
delete:

Check failure on line 1 in src/resources/variable/VariableRef.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

path-params

Operation must define parameter "{variableId}" as expected by path "/variable/{variableId}".

Check failure on line 1 in src/resources/variable/VariableRef.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

invalid-ref

ENOENT: no such file or directory, open '/github/workspace/src/parameters/path/VariableId.yaml'
summary: 'Delete a variable'
description: |
- To delete a variable
- You can't delete a BUILT_IN variable
- If you delete a variable having override or alias, the associated override/alias will be deleted as well
operationId: deleteVariable
parameters:
- $ref: '../../parameters/path/VariableId.yaml'

tags:
- Variable Main Calls

Check warning on line 12 in src/resources/variable/VariableRef.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

operation-tag-defined

Operation tags must be defined in global tags.
responses:
'204':
$ref: '../../responses/Deleted.yaml'
'401':
$ref: '../../responses/NotAuthorized.yaml'
'403':
$ref: '../../responses/Forbidden.yaml'
'404':
$ref: '../../responses/NotFound.yaml'

put:

Check failure on line 23 in src/resources/variable/VariableRef.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

path-params

Operation must define parameter "{variableId}" as expected by path "/variable/{variableId}".
summary: 'Edit a variable'
description: |
- You can't edit a BUILT_IN variable
- For an override, you can't edit the key
- For an alias, you can't edit the value
operationId: editVariable
parameters:
- $ref: '../../parameters/path/applicationId.yaml'

tags:
- Variable Main Calls

Check warning on line 34 in src/resources/variable/VariableRef.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

operation-tag-defined

Operation tags must be defined in global tags.
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../schemas/variable/VariableEditRequest.yaml'
responses:
'200':
description: 'Edited variable value'
content:
application/json:
schema:
$ref: '../../schemas/variable/VariableResponse.yaml'
'400':
$ref: '../../responses/BadRequest.yaml'
'401':
$ref: '../../responses/NotAuthorized.yaml'
'403':
$ref: '../../responses/Forbidden.yaml'
'404':
$ref: '../../responses/NotFound.yaml'
6 changes: 6 additions & 0 deletions src/schemas/_index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,14 @@ VariableAliasRequest:
$ref: ./variable/VariableAliasRequest.yaml
VariableOverrideRequest:
$ref: ./variable/VariableOverrideRequest.yaml
VariableRequest:
$ref: ./variable/VariableRequest.yaml
VariableEditRequest:
$ref: ./variable/VariableEditRequest.yaml
VariableResponse:
$ref: ./variable/VariableResponse.yaml
VariableResponseList:
$ref: ./variable/VariableResponseList.yaml
VariableAlias:
$ref: ./variable/VariableAlias.yaml
VariableOverride:
Expand Down
9 changes: 9 additions & 0 deletions src/schemas/variable/VariableEditRequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type: object
required:
- key
- value
properties:
key:
type: string
value:
type: string
22 changes: 22 additions & 0 deletions src/schemas/variable/VariableRequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
type: object
required:
- key
- value
- is_secret
- variable_scope
- variable_parent_id
properties:
key:
type: string
value:
type: string
mount_path:
type: string
nullable: true
is_secret:
type: boolean
variable_scope:
$ref: '../enums/APIVariableScope.yaml'
variable_parent_id:
type: string
format: uuid
6 changes: 6 additions & 0 deletions src/schemas/variable/VariableResponseList.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: object
properties:
results:
type: array
items:
$ref: './VariableResponse.yaml'

0 comments on commit 8675858

Please sign in to comment.