Implements API documentation

This patch includes API documentation for the craton service:
calls for region, cell, and host as well as their respective
parameters file.

Change-Id: I6414a6c2a48a1a05e54bfb5ad8c743c541286747
Closes-bug: 1606865
This commit is contained in:
Jovon McCloud 2016-09-07 16:50:25 +00:00
parent 5c2737b935
commit 6d8ea915eb
5 changed files with 1046 additions and 0 deletions

273
api-ref/source/v1/cells.inc Normal file
View File

@ -0,0 +1,273 @@
.. -*- rst -*-
======
Cells
======
Definition of cell
Create Cell
============
.. rest_method:: POST /v1/cells
Create a new Cell
Normal response codes: OK(200)
Error response codes: invalid request(400), validation exception(405)
Request
-------
.. rest_parameters:: parameters.yaml
- name : cell_name
- region_id: region_id_body
- project_id: project_id
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
**Example Create Cell** (TO-DO)
..literalinclude:: ../../doc/api_samples/cells/cells-create-req.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- cell: cell
- id: cell_id_body
- name: cell_name
- region_id: region_id_body
- project_id: project_id
- note: note
- data: data
**Example Create Cell** (TO-DO)
..literalinclude:: ../../doc/api_samples/cells/cells-create-resp.json
:language: javascript
List Cells
==========
.. rest_method:: GET /v1/cells
Gets all Cells
Normal response codes: OK(200)
Error response codes: invalid request(400), cell not found(404), validation exception(405)
Default response: unexpected error
Request
--------
.. rest_parameters:: parameters.yaml
- cell: cell_name_query
- region: region_name_query
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
Response
--------
.. rest_parameters:: parameters.yaml
- cells: cells
- id: cell_id_body
- name: cell_name
- region_id: region_id_body
- project_id: project_id
- note: note
- data: data
**Example List Cells** (TO-DO)
..literalinclude:: ../../doc/api_samples/cells/cells-list-resp.json
:language: javascript
**Example Unexpected Error **
..literalinclude:: ../../doc/api_samples/errors/errors-unexpected-resp.json
:language: javascript
Update Cells
============
.. rest_method:: PUT /v1/cells/{cell_id}
Update an existing cell
Normal response codes: OK(200)
Error response codes: invalid request(400), cell not found(404), validation exception(405)
Request
-------
.. rest_parameters:: parameters.yaml
- id: cell_id_body
- name: cell_name
- region_id: region_id_body
- project_id: project_id
- note: note
- data: data
- cell_id: cell_id
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
**Example Update Cell** (TO-DO)
..literalinclude:: ../../doc/api_samples/cells/cells-update-req.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- cell: cell
- id: cell_id_body
- name: cell_name
- region_id: region_id_body
- project_id: project_id
- note: note
- data: data
**Example Update Cell** (TO-DO)
..literalinclude:: ../../doc/api_samples/cells/cells-update-resp.json
:language: javascript
Update Cell Data
==================
.. rest_method:: PUT /v1/cells/{cell_id}/data
Update user defined data for the cell
Normal response codes: OK(200)
Error response codes: invalid request(400), cell not found(404), validation exception(405)
Request
-------
.. rest_parameters:: parameters.yaml
- key: key
- value: value
- cell_id: cell_id
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
**Example Update Cell Data** (TO-DO)
..literalinclude:: ../../doc/api_samples/cells/cells-upadate—data-req.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- key: key
- value: value
**Example Update Cell Data** (TO-DO)
..literalinclude:: ../../doc/api_samples/cells/cells-update-data-resp.json
:language: javascript
Delete Cell
===========
.. rest_method:: DELETE /v1/cells/{cell_id}
Deletes an existing record of a Cell
Normal response codes: OK(200)
Error response codes: invalid request(400), cell not found(404)
Request
-------
.. rest_parameters:: parameters.yaml
- cell_id: cell_id
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
Response
--------
No body content is returned on a successful DELETE
Delete Cell Data
================
.. rest_method:: DELETE /v1/cells/{cell_id}/data
Delete existing key/value data for the cell
Normal response codes: OK(200)
Error response codes: invalid request(400), cell not found(404) validation exception(405)
Request
-------
.. rest_parameters:: parameters.yaml
- cell_id: cell_id
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
Response
--------
No body content is returned on a successful DELETE

301
api-ref/source/v1/hosts.inc Normal file
View File

@ -0,0 +1,301 @@
.. -*- rst -*-
=====
Hosts
=====
Definition of host
Create Host
============
.. rest_method:: POST /v1/hosts
Create a new host
Normal response codes: OK(200)
Error response codes: invalid request(400), validation exception(405)
Request
-------
.. rest_parameters:: parameters.yaml
- name: host_name
- region_id: region_id_body
- project_id: project_id
- ip_address: ip_address
- device_type: device_type
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
**Example Create Host** (TO-DO)
..literalinclude:: ../../doc/api_samples/hosts/hosts-create-req.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- host: host
- id: host_id_body
- name: host_name
- cell_id: cell_id_body
- parent_id: parent_id
- project_id: project_id
- region_id: region_id_body
- ip_address: ip_address
- device_type: device_type
- labels: labels
- note: note
- data: data
**Example Create Host** (TO-DO)
..literalinclude:: ../../doc/api_samples/hosts/hosts-create-resp.json
:language: javascript
List Hosts
==========
.. rest_method:: GET /v1/hosts
Gets all Host
Normal response codes: OK(200)
Error response codes: invalid request(400), host not found(404), validation exception(405)
Default response: unexpected error
Request
--------
.. rest_parameters:: parameters.yaml
- limit: limit
- name: host_name_query
- id: host_id_query
- region: region_name_query
- cell: cell_name_query
- ip_address: ip_address_query
- service: service
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
Response
--------
.. rest_parameters:: parameters.yaml
- hosts: hosts
- id: host_id_body
- name: host_name
- cell_id: cell_id_body
- parent_id: parent_id
- project_id: project_id
- region_id: region_id_body
- ip_address: ip_address
- device_type: device_type
- labels: labels
- note: note
- data: data
**Example List Host** (TO-DO)
..literalinclude:: ../../doc/api_samples/hosts/hosts-list-resp.json
:language: javascript
**Example Unexpected Error **
..literalinclude:: ../../doc/api_samples/errors/errors-unexpected-resp.json
:language: javascript
Update Hosts
============
.. rest_method:: PUT /v1/hosts/{host_id}
Update an existing host
Normal response codes: OK(200)
Error response codes: invalid request(400), host not found(404), validation exception(405)
Request
-------
.. rest_parameters:: parameters.yaml
- id: host_id_body
- name: host_name
- cell_id: cell_id_body
- parent_id: parent_id
- project_id: project_id
- region_id: region_id_body
- ip_address: ip_address
- device_type: device_type
- labels: labels
- note: note
- data: data
- host_id: host_id
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
**Example Update Host** (TO-DO)
..literalinclude:: ../../doc/api_samples/hosts/hosts-update-req.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- host: host
- id: host_id_body
- name: host_name
- cell_id: cell_id_body
- parent_id: parent_id
- project_id: project_id
- region_id: region_id_body
- ip_address: ip_address
- device_type: device_type
- labels: labels
- note: note
- data: data
**Example Update Host** (TO-DO)
..literalinclude:: ../../doc/api_samples/hosts/hosts-update-resp.json
:language: javascript
Update Host Data
==================
.. rest_method:: PUT /v1/hosts/{host_id}/data
Update user defined data for the host
Normal response codes: OK(200)
Error response codes: invalid request(400), host not found(404), validation exception(405)
Request
-------
.. rest_parameters:: parameters.yaml
- key: key
- value: value
- host_id: host_id
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
**Example Update Host Data** (TO-DO)
..literalinclude:: ../../doc/api_samples/hosts/hosts-upadate—data-req.json
:language: javascript
Response
--------
.. rest_parameters:: parameters.yaml
- key: key
- value: value
**Example Update Host Data** (TO-DO)
..literalinclude:: ../../doc/api_samples/hosts/hosts-update-data-resp.json
:language: javascript
Delete Host
===========
.. rest_method:: DELETE /v1/hosts/{host_id}
Deletes an existing record of a Host
Normal response codes: OK(200)
Error response codes: invalid request(400), host not found(404)
Request
-------
.. rest_parameters:: parameters.yaml
- host_id: host_id
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
Response
--------
No body content is returned on a successful DELETE
Delete Host Data
================
.. rest_method:: DELETE /v1/hosts/{host_id}/data
Delete existing key/value data for the Host
Normal response codes: OK(200)
Error response codes: invalid request(400), host not found(404) validation exception(405)
Request
-------
.. rest_parameters:: parameters.yaml
- host_id: host_id
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
Response
--------
No body content is returned on a successful DELETE

View File

@ -0,0 +1,11 @@
:tocdepth: 2
===========
Craton API
===========
.. rest_expand_all::
.. include:: cells.inc
.. include:: hosts.inc
.. include:: regions.inc

View File

@ -0,0 +1,201 @@
# variables in header
Content-Type:
description: |
Type of content sent using cURL
in: header
required: true
type: string
X-Auth-Project:
description: |
ID of the project this user is assigned to.
in: header
required: true
type: integer
X-Auth-Token:
description: |
User authentication token for the current session
in: header
required: true
type: string
X-Auth-User
description: |
User of the current session
in: header
required: true
type: string
# variables in path
cell_id:
description: |
The unique ID of the cell
in: path
required: true
type: integer
host_id:
description: |
The unique ID of the host
region_id:
description: |
The unique ID of the region
in: path
required: true
type: integer
# variables in body
cell:
description: |
A cell object
in: body
required: false
type: object
cell_id_body:
description: |
Unique ID of the cell
in: body
required: false
type: integer
cell_name:
description: |
Unique name of the cell
in: body
required: true
type: string
cells:
description: |
An array of cell objects
in: body
required: false
type: array
data:
description: |
User defined information
in: body
required: false
type: object
device_type:
description: |
Type of host
in: body
required: false
type: string
host:
description: |
A host object
in: body
required: false
type: object
host_id_body:
description: |
Unique ID of the host
in: body
required: false
type: integer
host_name:
description: |
Unique name of the host
hosts:
description: |
An array of host objects
in: body
required: false
type: array
ip_address:
description: |
IP adress
in: body
type: string
labels:
description: |
User defined labels
in: body
required: false
type: string
parent_id:
description: |
Parent ID of this host
in: body
required: false
type: integer
project_id:
description: |
ID of the project
in: body
required: true
type: integer
note:
description: |
Note used for governance
in: body
required: false
type: string
region:
description: |
A region object
in: body
required: false
type: object
region_id_body:
description: |
The unique ID of the region
in: body
required: false
type: integer
region_name:
description: |
Unique name of the region
in: body
required: true
type: string
regions:
description: |
An array of region objects
in: body
required: true
type: array
# variables in query
cell_name_query:
description: |
Name of the cell to get
in: query
required: false
type: string
ip_address_query:
description: |
IP address to get
in: query
required: false
type: string
host_id_query:
description: |
ID of the host to get
in: query
required: false
type: integer
host_name_query:
description: |
Name of host to get
in: query
required: false
type: string
limit:
description: |
Number of host to return ranging from 1 - 10000. Default = 1000
in: query
required: false
type: integer
region_id_query:
description: |
ID of the region to get
in: query
required: false
type: string
region_name_query:
description: |
Name of the the region to get
in: query
required: false
type: string
service:
description: |
Openstack service to query host by
in: query
required: false
type: array

View File

@ -0,0 +1,260 @@
.. -*- rst -*-
=======
Regions
=======
Definition of region
Create Region
==============
.. rest_method:: POST /v1/region
Creates a new Region
Normal response codes: OK(200)
Error response codes: invalid request(400), validation exception(405)
Request
-------
.. rest_parameters:: parameters.yaml
- name: region_name
- project_id: project_id
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
**Example Create Region**
..literalinclude:: ../../doc/api_samples/regions/regions-create-req.json
:language: javascript
Response
--------
- region: region
- id: region_id_body
- name: region_name
- project_id: project_id
- cells: cells
- data: data
**Example Create Region**
..literalinclude:: ../../doc/api_samples/regions/regions-create-resp.json
:language: javascript
List Regions
==============
.. rest_method:: GET /v1/regions
Gets all Regions
Normal response codes: OK(200)
Error response codes: invalid request(400), validation exception(405)
Default response: unexpected error
Request
--------
- name: region_name_query
- id: region_id_query
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
Response
--------
.. rest_parameters:: parameters.yaml
- region: region
- id: region_id_body
- name: region_name
- project_id: project_id
- cells: cells
- data: data
**Example List Regions**
..literalinclude:: ../../doc/api_samples/regions/regions-list-resp.json
:language: javascript
**Example Unexpected Error **
..literalinclude:: ../../doc/api_samples/errors/errors-unexpected-resp.json
:language: javascript
Update Region
=============
.. rest_method:: PUT /v1/regions/{region_id}
Update an existing region
Normal response codes: OK(200)
Error response codes: invalid request(400), region not found(404), validation exception(405)
Request
-------
.. rest_parameters:: parameters.yaml
- id: region_id_body
- name: region_name
- project_id: project_id
- cells: cells
- data: data
- region_id: region_id
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
**Example Update Region** (TO-DO)
..literalinclude:: ../../doc/api_samples/regions/regions-update-req.json
:language: javascript
Response
--------
- region: region
- id: region_id_body
- name: region_name
- project_id: project_id
- cells: cells
- data: data
**Example Update Region** (TO-DO)
..literalinclude:: ../../doc/api_samples/regions/regions-update-resp.json
:language: javascript
Update Region Data
==================
.. rest_method:: PUT /v1/regions/{region_id}/data
Update user defined data for the region
Normal response codes: OK(200)
Error response codes: invalid request(400), region not found(404), validation exception(405)
Request
-------
.. rest_parameters:: parameters.yaml
- key: key
- value: value
- region_id: region_id
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
**Example Update Region Data** (TO-DO)
..literalinclude:: ../../doc/api_samples/regions/regions-upadate—data-req.json
:language: javascript
Response
--------
- key: key
- value: value
**Example Update Region Data** (TO-DO)
..literalinclude:: ../../doc/api_samples/regions/regions-update-data-resp.json
:language: javascript
Delete Region
==============
.. rest_method:: DELETE /v1/regions/{region_id}
Deletes an existing record of a Region
Normal response codes: OK(200)
Error response codes: invalid request(400), region not found(404)
Request
-------
.. rest_parameters:: parameters.yaml
- region_id: region_id
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
Response
--------
No body content is returned on a successful DELETE
Delete Region Data
==================
.. rest_method:: DELETE /v1/regions/{region_id}/data
Delete existing key/value data for the region
Normal response codes: OK(200)
Error response codes: invalid request(400), region not found(404) validation exception(405)
Request
-------
.. rest_parameters:: parameters.yaml
- region_id: region_id
Required Header
^^^^^^^^^^^^^^^
- Content-Type: Content_Type
- X-Auth-Token: X-Auth-Token
- X-Auth-User: X-Auth-User
- X-Auth-Project: X-Auth-Project
Response
--------
No body content is returned on a successful DELETE