cloudapi: Add endpoints to clone aws images across regions

Support for creating multiple amis from a single compose. It uses the
AWSEC2* jobs to push images to new regions, and share them with new
accounts.

The compose it depends upon has to have succeeded.
This commit is contained in:
Sanne Raymaekers 2022-06-30 11:46:37 +02:00 committed by Ondřej Budai
parent 599829a3b8
commit d13347e1ca
8 changed files with 794 additions and 117 deletions

View file

@ -211,6 +211,101 @@ paths:
schema:
type: string
/composes/{id}/clone:
post:
operationId: postCloneCompose
summary: Clone an existing compose
parameters:
- in: path
name: id
schema:
type: string
format: uuid
example: 123e4567-e89b-12d3-a456-426655440000
required: true
description: ID of the compose
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CloneComposeBody'
responses:
'201':
description: The new image is being created
content:
application/json:
schema:
$ref: '#/components/schemas/CloneComposeResponse'
'400':
description: Invalid compose id
content:
text/plain:
schema:
type: string
'404':
description: Unknown compose id
content:
text/plain:
schema:
type: string
/clones/{id}:
get:
operationId: getCloneStatus
summary: The status of a cloned compose
security:
- Bearer: []
parameters:
- in: path
name: id
schema:
type: string
format: uuid
example: '123e4567-e89b-12d3-a456-426655440000'
required: true
description: ID of image status to get
description: |-
Get the status of a running or completed image from a compose.
This includes whether or not the image creation succeeded.
responses:
'200':
description: image status
content:
application/json:
schema:
$ref: '#/components/schemas/CloneStatus'
'400':
description: Invalid compose id
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Auth token is invalid
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Unauthorized to perform operation
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Unknown compose id
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Unexpected error occurred
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/compose:
post:
operationId: postCompose
@ -1030,6 +1125,40 @@ components:
format: uuid
example: '123e4567-e89b-12d3-a456-426655440000'
CloneComposeBody:
oneOf:
- $ref: '#/components/schemas/AWSEC2CloneCompose'
AWSEC2CloneCompose:
type: object
required:
- region
properties:
region:
type: string
share_with_accounts:
type: array
example: ['123456789012']
items:
type: string
CloneComposeResponse:
allOf:
- $ref: '#/components/schemas/ObjectReference'
- type: object
required:
- id
properties:
id:
type: string
format: uuid
example: '123e4567-e89b-12d3-a456-426655440000'
CloneStatus:
allOf:
- $ref: '#/components/schemas/ObjectReference'
- $ref: '#/components/schemas/UploadStatus'
parameters:
page:
name: page