Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(COR-683): add api to create an override on the variable endpoint #415

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -746,15 +746,17 @@
$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:
parameters:
$ref: './parameters/_index.yaml'

Check warning on line 755 in src/openapi.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

oas3-unused-component

Potentially unused component has been detected.
schemas:
$ref: './schemas/_index.yaml'

Check warning on line 757 in src/openapi.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

oas3-unused-component

Potentially unused component has been detected.
responses:
$ref: './responses/_index.yaml'

Check warning on line 759 in src/openapi.yaml

View workflow job for this annotation

GitHub Actions / Lint (pull_request)

oas3-unused-component

Potentially unused component has been detected.
securitySchemes:
bearerAuth:
type: http
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 All @@ -11,7 +11,7 @@
parameters:
- $ref: '../../parameters/path/variableId.yaml'
tags:
- Variable Main Calls

Check warning on line 14 in src/resources/variable/VariableAlias.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:
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

Check warning on line 14 in src/resources/variable/VariableOverride.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/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
Loading