diff --git a/src/openapi.yaml b/src/openapi.yaml index 2262c328..9c28de9b 100644 --- a/src/openapi.yaml +++ b/src/openapi.yaml @@ -244,6 +244,8 @@ paths: $ref: './resources/OrganizationAvailableRole.yaml' /organization/{organizationId}/gitToken: $ref: './resources/GitToken.yaml' + /organization/{organizationId}/gitToken/{gitTokenId}: + $ref: './resources/GitTokenRef.yaml' /organization/{organizationId}/member: $ref: './resources/OrganizationMember.yaml' /organization/{organizationId}/inviteMember: diff --git a/src/parameters/_index.yaml b/src/parameters/_index.yaml index 328adc5e..4421f6c9 100644 --- a/src/parameters/_index.yaml +++ b/src/parameters/_index.yaml @@ -44,6 +44,8 @@ jobId: # QUERY gitCommitId: $ref: ./query/gitCommitId.yaml +gitTokenId: + $ref: ./path/gitTokenId.yaml instanceId: $ref: ./path/instanceId.yaml invoiceId: diff --git a/src/parameters/path/gitTokenId.yaml b/src/parameters/path/gitTokenId.yaml new file mode 100644 index 00000000..eca863bc --- /dev/null +++ b/src/parameters/path/gitTokenId.yaml @@ -0,0 +1,7 @@ +name: gitTokenId +in: path +description: Git Token ID +required: true +schema: + type: string + format: uuid diff --git a/src/resources/GitToken.yaml b/src/resources/GitToken.yaml index 21a971be..c61bfdea 100644 --- a/src/resources/GitToken.yaml +++ b/src/resources/GitToken.yaml @@ -19,3 +19,29 @@ get: $ref: '../responses/Forbidden.yaml' '404': $ref: '../responses/NotFound.yaml' +post: + summary: 'Create a git token' + description: Create a new git token to be used as a git provider by a service + operationId: createGitToken + parameters: + - $ref: '../parameters/path/organizationId.yaml' + tags: + - Organization Main Calls + requestBody: + content: + application/json: + schema: + $ref: '../schemas/GitTokenRequest.yaml' + responses: + '201': + description: 'Git token created' + content: + application/json: + schema: + $ref: '../schemas/GitTokenResponse.yaml' + '401': + $ref: '../responses/NotAuthorized.yaml' + '403': + $ref: '../responses/Forbidden.yaml' + '404': + $ref: '../responses/NotFound.yaml' diff --git a/src/resources/GitTokenRef.yaml b/src/resources/GitTokenRef.yaml new file mode 100644 index 00000000..3c785fcf --- /dev/null +++ b/src/resources/GitTokenRef.yaml @@ -0,0 +1,45 @@ +put: + summary: 'Edit a git token' + operationId: editGitToken + parameters: + - $ref: '../parameters/path/organizationId.yaml' + - $ref: '../parameters/path/gitTokenId.yaml' + tags: + - Organization Main Calls + requestBody: + content: + application/json: + schema: + $ref: '../schemas/GitTokenRequest.yaml' + responses: + '200': + description: 'Git token edited' + content: + application/json: + schema: + $ref: '../schemas/GitTokenResponse.yaml' + '400': + $ref: '../responses/BadRequest.yaml' + '401': + $ref: '../responses/NotAuthorized.yaml' + '403': + $ref: '../responses/Forbidden.yaml' + '404': + $ref: '../responses/NotFound.yaml' +delete: + summary: 'Delete a git token' + operationId: deleteGitToken + parameters: + - $ref: '../parameters/path/organizationId.yaml' + - $ref: '../parameters/path/gitTokenId.yaml' + tags: + - Organization Main Calls + responses: + '204': + $ref: '../responses/Deleted.yaml' + '401': + $ref: '../responses/NotAuthorized.yaml' + '403': + $ref: '../responses/Forbidden.yaml' + '404': + $ref: '../responses/NotFound.yaml' diff --git a/src/schemas/GitTokenRequest.yaml b/src/schemas/GitTokenRequest.yaml new file mode 100644 index 00000000..1636d25e --- /dev/null +++ b/src/schemas/GitTokenRequest.yaml @@ -0,0 +1,18 @@ +type: object +required: + - name + - type + - token +properties: + name: + type: string + description: + type: string + type: + $ref: './enums/GitProvider.yaml' + token: + type: string + description: The token from your git provider side + workspace: + type: string + description: Mandatory only for BITBUCKET git provider, to allow us to fetch repositories at creation/edition of a service diff --git a/src/schemas/GitTokenResponse.yaml b/src/schemas/GitTokenResponse.yaml index ca4357b2..39aa8b1e 100644 --- a/src/schemas/GitTokenResponse.yaml +++ b/src/schemas/GitTokenResponse.yaml @@ -11,3 +11,6 @@ allOf: type: string type: $ref: './enums/GitProvider.yaml' + expired_at: + type: string + format: date diff --git a/src/schemas/_index.yaml b/src/schemas/_index.yaml index dc76a6b7..0d669b97 100644 --- a/src/schemas/_index.yaml +++ b/src/schemas/_index.yaml @@ -358,6 +358,8 @@ GitRepositoryBranchResponseList: $ref: ./GitRepositoryBranchResponseList.yaml GitRepositoryResponseList: $ref: ./GitRepositoryResponseList.yaml +GitTokenRequest: + $ref: ./GitTokenRequest.yaml GitTokenResponse: $ref: ./GitTokenResponse.yaml GitTokenResponseList: