Skip to content

Commit

Permalink
feat(COR-683): add api to create an override on the variable endpoint (
Browse files Browse the repository at this point in the history
  • Loading branch information
pggb25 authored Jul 21, 2023
1 parent e84c977 commit bf9c1c3
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,8 @@ paths:
$ref: './resources/deploymentStage/ServiceDeploymentStage.yaml'
/variable/{variableId}/alias:
$ref: './resources/variable/VariableAlias.yaml'
/variable/{variableId}/override:
$ref: './resources/variable/VariableOverride.yaml'
#/organization/{organizationId}/job/preview:
#/organization/{organizationId}/job/deploy:
components:
Expand Down
2 changes: 1 addition & 1 deletion src/resources/variable/VariableAlias.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
post:
summary: 'WIP: Create a variable alias'
summary: 'Create a variable alias'
description: |
- Allows you to add an alias at the level defined in the request body on an existing variable having a higher scope, in order to customize its key.
- You have to specify a key in the request body and the scope and the parent id of the alias
Expand Down
34 changes: 34 additions & 0 deletions src/resources/variable/VariableOverride.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
post:
summary: 'Create a variable override'
description: |
- Allows you to override a variable that has a higher scope.
- You have to specify a value in the request body and the scope and the parent id of the variable to alias
- The system will create a new environment variable at project level with the same key as the one corresponding to the variable id in the path
- The response body will contain the newly created variable
- Information regarding the overridden_variable will be exposed in the "overridden_variable" or in the "overridden_secret" field of the newly created variable
operationId: createVariableOverride
parameters:
- $ref: '../../parameters/path/variableId.yaml'

tags:
- Variable Main Calls
requestBody:
content:
application/json:
schema:
$ref: '../../schemas/variable/VariableOverrideRequest.yaml'
responses:
'201':
description: 'Create variable override'
content:
application/json:
schema:
$ref: '../../schemas/variable/VariableResponse.yaml'
'400':
description: Can't create an override on a higher scope. Overrides can only be created from one scope to a lower scope. Scope hierarchy is ORGANIZATION > PROJECT > ENVIRONMENT > APPLICATION
'401':
$ref: '../../responses/NotAuthorized.yaml'
'403':
$ref: '../../responses/Forbidden.yaml'
'404':
$ref: '../../responses/NotFound.yaml'
2 changes: 2 additions & 0 deletions src/schemas/_index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,8 @@ WeekdayEnum:
$ref: ./enums/Weekday.yaml
VariableAliasRequest:
$ref: ./variable/VariableAliasRequest.yaml
VariableOverrideRequest:
$ref: ./variable/VariableOverrideRequest.yaml
VariableResponse:
$ref: ./variable/VariableResponse.yaml
VariableAlias:
Expand Down
8 changes: 4 additions & 4 deletions src/schemas/variable/VariableAliasRequest.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
type: object
required:
- key
- aliasScope
- aliasParentId
- alias_scope
- alias_parent_id
properties:
key:
type: string
aliasScope:
alias_scope:
$ref: '../enums/APIVariableScope.yaml'
aliasParentId:
alias_parent_id:
type: string
format: uuid
13 changes: 13 additions & 0 deletions src/schemas/variable/VariableOverrideRequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: object
required:
- value
- alias_scope
- alias_parent_id
properties:
value:
type: string
alias_scope:
$ref: '../enums/APIVariableScope.yaml'
alias_parent_id:
type: string
format: uuid

0 comments on commit bf9c1c3

Please sign in to comment.