752 lines
18 KiB
YAML
Executable File
752 lines
18 KiB
YAML
Executable File
# this is an example of the Uber API
|
|
# as a demonstration of an API spec in YAML
|
|
swagger: '2.0'
|
|
info:
|
|
version: 3.5.0
|
|
title: Image API'S
|
|
description: Image api's
|
|
All api's should supply two header parameters
|
|
X-Auth-Token - Token received from keystone
|
|
X-Auth-Region - The region
|
|
There is an optional header parameter X-RANGER-Client which tells who is the client for the api's
|
|
|
|
# the domain of the service
|
|
host: 127.0.0.1
|
|
# array of all schemes that your API supports
|
|
schemes:
|
|
- https
|
|
|
|
# will be prefixed to all paths
|
|
basePath: /v1/orm
|
|
produces:
|
|
- application/json
|
|
|
|
paths:
|
|
/image:
|
|
parameters:
|
|
- $ref: "#/parameters/Token"
|
|
- $ref: "#/parameters/Region"
|
|
- $ref: "#/parameters/Client"
|
|
post:
|
|
summary: create image
|
|
description: |
|
|
The post image endpoint create a new image and send it to the Heat to create this image in each region needed
|
|
Return all data of the new image
|
|
parameters:
|
|
- name: full image
|
|
in: body
|
|
description: input body to create full image
|
|
schema:
|
|
$ref: '#/definitions/Image'
|
|
required: true
|
|
|
|
tags:
|
|
- Image
|
|
|
|
responses:
|
|
201:
|
|
description: image is created
|
|
schema:
|
|
$ref: '#/definitions/Image'
|
|
400:
|
|
description: Bad Request Error
|
|
schema:
|
|
$ref: '#/definitions/400'
|
|
409:
|
|
description: Duplicate Error
|
|
schema:
|
|
$ref: '#/definitions/409'
|
|
default:
|
|
description: Unexpected error
|
|
schema:
|
|
$ref: '#/definitions/Error'
|
|
|
|
get:
|
|
summary: get a list of imagess by criteria (visibility, region, tenant)
|
|
description: |
|
|
The get images retrieve all imagess matched to the above criterias
|
|
parameters:
|
|
- name: visibility
|
|
in: query
|
|
type: "string"
|
|
enum: [
|
|
"public",
|
|
"private"
|
|
]
|
|
required: false
|
|
description: public or private image
|
|
- name: region
|
|
in: query
|
|
type: "string"
|
|
description: region name
|
|
required: false
|
|
- name: tenant
|
|
in: query
|
|
type: "string"
|
|
description: tenant name.
|
|
required: false
|
|
tags:
|
|
- Image
|
|
responses:
|
|
200:
|
|
description: list of images by criteria
|
|
schema:
|
|
$ref: '#/definitions/Images'
|
|
400:
|
|
description: Bad Request Error
|
|
schema:
|
|
$ref: '#/definitions/400'
|
|
default:
|
|
description: Unexpected error
|
|
schema:
|
|
$ref: '#/definitions/Error'
|
|
|
|
/images/{image_uuid_or_name}:
|
|
parameters:
|
|
- $ref: "#/parameters/Token"
|
|
- $ref: "#/parameters/Region"
|
|
- $ref: "#/parameters/Client"
|
|
get:
|
|
summary: get image (one) by id or name
|
|
description: retrieve image has this param if not found get image by name that maches this param
|
|
parameters:
|
|
- name: image_uuid_or_name
|
|
in: path
|
|
type: string
|
|
description: uuid or name of the requested image.
|
|
required: true
|
|
tags:
|
|
- Image
|
|
responses:
|
|
200:
|
|
description: the requested image
|
|
schema:
|
|
$ref: '#/definitions/Image'
|
|
404:
|
|
description: image not found
|
|
schema:
|
|
$ref: '#/definitions/404'
|
|
400:
|
|
description: Bad Request Error
|
|
schema:
|
|
$ref: '#/definitions/400'
|
|
default:
|
|
description: Unexpected error
|
|
schema:
|
|
$ref: '#/definitions/Error'
|
|
|
|
delete:
|
|
summary: delete image (one) by id or name
|
|
description: delete image need to remove all regions one by one before deleting the image other wise will fail to delete
|
|
parameters:
|
|
- name: image_uuid_or_name
|
|
in: path
|
|
type: string
|
|
description: uuid or name of the image to delete.
|
|
required: true
|
|
tags:
|
|
- Image
|
|
responses:
|
|
405:
|
|
description: metod not allowed
|
|
schema:
|
|
$ref: '#/definitions/Error'
|
|
204:
|
|
description: no content
|
|
|
|
default:
|
|
description: Unexpected error
|
|
schema:
|
|
$ref: '#/definitions/Error'
|
|
|
|
put:
|
|
summary: get image (one) by id or name
|
|
description: retrieve image has this param if not found get image by name that maches this param
|
|
parameters:
|
|
- name: image_uuid_or_name
|
|
in: path
|
|
type: string
|
|
description: uuid or name of the requested image.
|
|
required: true
|
|
- name: full image
|
|
in: body
|
|
description: input body to create full image
|
|
schema:
|
|
$ref: '#/definitions/Image'
|
|
required: true
|
|
tags:
|
|
- Image
|
|
responses:
|
|
201:
|
|
description: image is created
|
|
schema:
|
|
$ref: '#/definitions/Image'
|
|
404:
|
|
description: image not found
|
|
schema:
|
|
$ref: '#/definitions/404'
|
|
400:
|
|
description: Bad Request Error
|
|
schema:
|
|
$ref: '#/definitions/400'
|
|
default:
|
|
description: Unexpected error
|
|
schema:
|
|
$ref: '#/definitions/Error'
|
|
|
|
/image/{image_uuid}/regions:
|
|
parameters:
|
|
- $ref: "#/parameters/Token"
|
|
- $ref: "#/parameters/Region"
|
|
- $ref: "#/parameters/Client"
|
|
post:
|
|
summary: add region to an image
|
|
description: |
|
|
it will add the regions in the body to the image and send them to heat to be created
|
|
parameters:
|
|
- name: image_uuid
|
|
in: path
|
|
type: string
|
|
description: uuid of the requested image.
|
|
required: true
|
|
- name: regions
|
|
in: body
|
|
description: list of full regions
|
|
schema:
|
|
$ref: '#/definitions/Regions'
|
|
required: true
|
|
tags:
|
|
- Regions
|
|
responses:
|
|
201:
|
|
description: regions added to image
|
|
schema:
|
|
$ref: '#/definitions/Regions'
|
|
404:
|
|
description: image not found
|
|
schema:
|
|
$ref: '#/definitions/404'
|
|
409:
|
|
description: Duplicate Error
|
|
schema:
|
|
$ref: '#/definitions/409'
|
|
400:
|
|
description: Bad Request Error
|
|
schema:
|
|
$ref: '#/definitions/400'
|
|
default:
|
|
description: Unexpected error
|
|
schema:
|
|
$ref: '#/definitions/Error'
|
|
put:
|
|
summary: replace region in an image
|
|
description: |
|
|
it will remove all existing regions in the image and replace them in the regions in request body and the old regions will be sent to be removed from heat and the new ones will be sent as created
|
|
parameters:
|
|
- name: image_uuid
|
|
in: path
|
|
type: string
|
|
description: uuid of the requested image.
|
|
required: true
|
|
- name: regions
|
|
in: body
|
|
description: list of full regions
|
|
schema:
|
|
$ref: '#/definitions/Regions'
|
|
required: true
|
|
tags:
|
|
- Regions
|
|
responses:
|
|
201:
|
|
description: regions added to image
|
|
schema:
|
|
$ref: '#/definitions/Regions'
|
|
404:
|
|
description: image not found
|
|
schema:
|
|
$ref: '#/definitions/404'
|
|
400:
|
|
description: Bad Request Error
|
|
schema:
|
|
$ref: '#/definitions/400'
|
|
default:
|
|
description: Unexpected error
|
|
schema:
|
|
$ref: '#/definitions/Error'
|
|
/image/{image_uuid}/regions/{region_name}:
|
|
parameters:
|
|
- $ref: "#/parameters/Token"
|
|
- $ref: "#/parameters/Region"
|
|
- $ref: "#/parameters/Client"
|
|
delete:
|
|
summary: delete region from image by region name name
|
|
description: delete region from image by region name name and send it to heat to be removed
|
|
parameters:
|
|
- name: image_uuid
|
|
in: path
|
|
type: string
|
|
description: uuid of the requested image.
|
|
required: true
|
|
- name: region_name
|
|
in: path
|
|
type: string
|
|
description: name of the region need to delete
|
|
required: true
|
|
tags:
|
|
- Regions
|
|
responses:
|
|
204:
|
|
description: no content
|
|
404:
|
|
description: image not found
|
|
schema:
|
|
$ref: '#/definitions/404'
|
|
default:
|
|
description: Unexpected error
|
|
schema:
|
|
$ref: '#/definitions/Error'
|
|
|
|
/image/{image_uuid}/enabled/:
|
|
parameters:
|
|
- $ref: "#/parameters/Token"
|
|
- $ref: "#/parameters/Region"
|
|
- $ref: "#/parameters/Client"
|
|
put:
|
|
summary: enable and disable image
|
|
description: got in all regions related to this image and set them to enable/disable and send them to head to be modified
|
|
parameters:
|
|
- name: image_uuid
|
|
in: path
|
|
type: string
|
|
description: uuid of the requested image.
|
|
required: true
|
|
- name: enabled input json
|
|
in: body
|
|
description: input body enable/disable image
|
|
schema:
|
|
$ref: '#/definitions/Enable'
|
|
required: true
|
|
tags:
|
|
- Enabled
|
|
responses:
|
|
200:
|
|
description: image is created
|
|
schema:
|
|
$ref: '#/definitions/Image'
|
|
404:
|
|
description: image not found
|
|
schema:
|
|
$ref: '#/definitions/404'
|
|
400:
|
|
description: Bad Request Error
|
|
schema:
|
|
$ref: '#/definitions/400'
|
|
default:
|
|
description: Unexpected error
|
|
schema:
|
|
$ref: '#/definitions/Error'
|
|
|
|
/images/{image_uuid}/regions/{region_name}/metadata:
|
|
parameters:
|
|
- $ref: "#/parameters/Token"
|
|
- $ref: "#/parameters/Region"
|
|
- $ref: "#/parameters/Client"
|
|
post:
|
|
summary: add metadata to region in an image
|
|
description: add metadata to specified region related to image this operation does not require send this region to heat its only in the ims db (it will replace existing ones)
|
|
parameters:
|
|
- name: image_uuid
|
|
in: path
|
|
type: string
|
|
description: uuid of the requested image.
|
|
required: true
|
|
- name: region_name
|
|
in: path
|
|
type: string
|
|
description: region name of requested region
|
|
required: true
|
|
- name: metadata input json
|
|
in: body
|
|
description: the metadata json that need to be added to the region
|
|
schema:
|
|
$ref: '#/definitions/MetaDataWrapper'
|
|
required: true
|
|
tags:
|
|
- Metadata
|
|
|
|
responses:
|
|
201:
|
|
description: added metadata to region
|
|
schema:
|
|
type: string
|
|
404:
|
|
description: image not found
|
|
schema:
|
|
$ref: '#/definitions/404'
|
|
400:
|
|
description: Bad Request Error
|
|
schema:
|
|
$ref: '#/definitions/400'
|
|
default:
|
|
description: Unexpected error
|
|
schema:
|
|
$ref: '#/definitions/Error'
|
|
|
|
/images/{image_uuid}/customers/:
|
|
parameters:
|
|
- $ref: "#/parameters/Token"
|
|
- $ref: "#/parameters/Region"
|
|
- $ref: "#/parameters/Client"
|
|
post:
|
|
summary: add customer to an image
|
|
description: add customer to private image
|
|
parameters:
|
|
- name: image_uuid
|
|
in: path
|
|
type: string
|
|
description: uuid of the requested image.
|
|
required: true
|
|
- name: customer input json
|
|
in: body
|
|
description: input body customer
|
|
schema:
|
|
$ref: '#/definitions/Customer'
|
|
required: true
|
|
tags:
|
|
- Customers
|
|
responses:
|
|
200:
|
|
description: customers added to image
|
|
schema:
|
|
$ref: '#/definitions/Image'
|
|
404:
|
|
description: image not found
|
|
schema:
|
|
$ref: '#/definitions/404'
|
|
409:
|
|
description: Duplicate Error
|
|
schema:
|
|
$ref: '#/definitions/409'
|
|
400:
|
|
description: Bad Request Error
|
|
schema:
|
|
$ref: '#/definitions/400'
|
|
default:
|
|
description: Unexpected error
|
|
schema:
|
|
$ref: '#/definitions/Error'
|
|
|
|
put:
|
|
summary: replace image customers
|
|
description: replace all customers to specific image
|
|
parameters:
|
|
- name: image_uuid
|
|
in: path
|
|
type: string
|
|
description: uuid of the requested image.
|
|
required: true
|
|
- name: customer input json
|
|
in: body
|
|
description: input body customer
|
|
schema:
|
|
$ref: '#/definitions/Customer'
|
|
required: true
|
|
tags:
|
|
- Customers
|
|
responses:
|
|
200:
|
|
description: customers added to image
|
|
schema:
|
|
$ref: '#/definitions/Image'
|
|
404:
|
|
description: image not found
|
|
schema:
|
|
$ref: '#/definitions/404'
|
|
400:
|
|
description: Bad Request Error
|
|
schema:
|
|
$ref: '#/definitions/400'
|
|
default:
|
|
description: Unexpected error
|
|
schema:
|
|
$ref: '#/definitions/Error'
|
|
|
|
|
|
definitions:
|
|
Image:
|
|
type: object
|
|
required:
|
|
- name
|
|
- url
|
|
- visibility
|
|
- disk-format
|
|
- container-format
|
|
properties:
|
|
name:
|
|
type: string
|
|
description: name
|
|
example: Ubuntu
|
|
enabled:
|
|
type: boolean
|
|
description: tells if image enabled
|
|
example: true
|
|
url:
|
|
type: string
|
|
description: url
|
|
example: /v1/images/b2173dd3-7ad6-4362-baa6-a68bce3565cb/file
|
|
visibility:
|
|
type: string
|
|
description: if image visible
|
|
example: private
|
|
disk-format:
|
|
type: string
|
|
description: disk-format
|
|
example: raw
|
|
container-format:
|
|
type: string
|
|
description: container-format
|
|
example: bare
|
|
min-disk:
|
|
type: integer
|
|
description: int32
|
|
example: 0
|
|
min-ram:
|
|
type: integer
|
|
description: int32
|
|
example: 1024
|
|
tags:
|
|
type: array
|
|
items:
|
|
type: string
|
|
example: tag1
|
|
properties:
|
|
$ref: '#/definitions/Dictionary'
|
|
regions:
|
|
type: array
|
|
items:
|
|
$ref: '#/definitions/Region'
|
|
customers:
|
|
type: array
|
|
items:
|
|
type: string
|
|
example: 1a15e3ea-bc4f-4aec-8a98-8feb2537a354
|
|
owner:
|
|
type: string
|
|
description: owner
|
|
example: bab7d5c60cd041a0a36f7c4b6e1dd978
|
|
schema:
|
|
type: string
|
|
description: schema
|
|
example: /v2/schemas/image
|
|
protected:
|
|
type: boolean
|
|
description: if image is protected
|
|
example: true
|
|
|
|
Enable:
|
|
type: object
|
|
properties:
|
|
enabled:
|
|
type: boolean
|
|
description: can be true or false
|
|
example: true
|
|
|
|
Customer:
|
|
type: object
|
|
properties:
|
|
customers:
|
|
type: array
|
|
items:
|
|
type: string
|
|
|
|
Images:
|
|
type: array
|
|
items:
|
|
properties:
|
|
name:
|
|
type: string
|
|
description: name
|
|
visibility:
|
|
type: string
|
|
description: name
|
|
id:
|
|
type: string
|
|
description: name
|
|
|
|
MetaDataWrapper:
|
|
type: object
|
|
properties:
|
|
metadata:
|
|
$ref: '#/definitions/MetaData'
|
|
|
|
MetaData:
|
|
type: object
|
|
properties:
|
|
checksum:
|
|
type: string
|
|
example: '1024'
|
|
size:
|
|
type: string
|
|
example: '123'
|
|
virtual_size:
|
|
type: string
|
|
example: '123'
|
|
|
|
Region:
|
|
type: object
|
|
required:
|
|
- name
|
|
- type
|
|
properties:
|
|
name:
|
|
type: string
|
|
example: tn17
|
|
type:
|
|
type: string
|
|
description: single or group
|
|
example: single
|
|
status:
|
|
type: string
|
|
readOnly: true
|
|
example: error
|
|
error_message:
|
|
type: string
|
|
readOnly: true
|
|
example: fail to create
|
|
|
|
OutputRegion:
|
|
type: object
|
|
properties:
|
|
name:
|
|
type: string
|
|
example: tn17
|
|
type:
|
|
type: string
|
|
description: single or group
|
|
example: single
|
|
status:
|
|
type: string
|
|
error_message:
|
|
type: string
|
|
checksum:
|
|
type: string
|
|
example: '1024'
|
|
size:
|
|
type: string
|
|
example: '123'
|
|
virtual_size:
|
|
type: string
|
|
example: '123'
|
|
|
|
OutputRegions:
|
|
type: array
|
|
items:
|
|
$ref: '#/definitions/OutputRegion'
|
|
|
|
Regions:
|
|
type: array
|
|
items:
|
|
$ref: '#/definitions/Region'
|
|
|
|
200:
|
|
type: object
|
|
properties:
|
|
name:
|
|
type: string
|
|
description: name
|
|
visibility:
|
|
type: string
|
|
description: name
|
|
id:
|
|
type: string
|
|
description: name
|
|
|
|
Error:
|
|
type: object
|
|
properties:
|
|
code:
|
|
type: integer
|
|
format: int32
|
|
type:
|
|
type: string
|
|
transaction_id:
|
|
type: string
|
|
message:
|
|
type: string
|
|
details:
|
|
type: string
|
|
|
|
409:
|
|
type: object
|
|
properties:
|
|
code:
|
|
type: integer
|
|
format: int32
|
|
type:
|
|
type: string
|
|
transaction_id:
|
|
type: string
|
|
message:
|
|
type: string
|
|
details:
|
|
type: string
|
|
|
|
400:
|
|
type: object
|
|
properties:
|
|
code:
|
|
type: integer
|
|
format: int32
|
|
type:
|
|
type: string
|
|
transaction_id:
|
|
type: string
|
|
message:
|
|
type: string
|
|
details:
|
|
type: string
|
|
|
|
404:
|
|
type: object
|
|
properties:
|
|
code:
|
|
type: integer
|
|
format: int32
|
|
type:
|
|
type: string
|
|
transaction_id:
|
|
type: string
|
|
message:
|
|
type: string
|
|
details:
|
|
type: string
|
|
|
|
Dictionary:
|
|
type: object
|
|
additionalProperties:
|
|
type: "string"
|
|
example: {"property1": "value1"}
|
|
|
|
|
|
parameters:
|
|
Token:
|
|
name: X-Auth-Token
|
|
in: header
|
|
description: Token from keystone
|
|
required: true
|
|
type: string
|
|
|
|
Region:
|
|
name: X-Auth-Region
|
|
in: header
|
|
description: Region
|
|
required: true
|
|
type: string
|
|
|
|
Client:
|
|
name: X-Auth-Client
|
|
in: header
|
|
description: Client name
|
|
required: false
|
|
type: string
|