Welcome to {{cookiecutter.module_name}}’s documentation!¶
This is an {{cookiecutter.module_name}} documentation.
Install¶
This is an install guide.
Section1¶
this is section 1.
- First item with some lengthy text wrapping hopefully across several lines.
- Second item
- Third item
This is a python code block
print 'hello world'
def test():
pass
Subsection1.1¶
this is a table
aA | bB | eE |
cC | dD | eF |
cC | dD | eF |
Subsubsection1.1.1¶
A link to Sphinx Home in citation style.
RESTful API¶
A Python Flask based simple and powerful API. All definitions can be found
under source code {{cookiecutter.module_name}}/api
.
Resources¶
Documentation for various API resources can be found separately in the following locations:
Host¶
About host managment.
Create Host¶
POST api/hosts
Create one host.
Request
Name | In | Type | Required | Description |
---|---|---|---|---|
host_ip |
body | string | True | The ip address binds by dockerd process |
host_port |
body | integer | True | The tcp port binds by dockerd process |
magmt_ip |
body | string | True | The ip address used to establish session with router |
seq |
body | integer | False | reserved field |
Request Example
{
"host": {
"host_ip": "10.75.44.10",
"host_port": 2376,
"magmt_ip": "10.75.44.10",
}
}
Request Example(with optional seq)
{
"host": {
"host_ip": "10.75.44.10",
"host_port": 2376,
"magmt_ip": "10.75.44.10",
"seq": 10
}
}
Response paramters in data json
Name | In | Type | Description |
---|---|---|---|
id |
body | string | id in UUID format |
created_at |
body | string | Time at which the resource has been created (in UTC ISO8601 format). |
updated_on |
body | string | Time at which the resource has been updated (in UTC ISO8601 format). |
host_ip |
body | string | The ip address binds by dockerd process |
host_port |
body | integer | The tcp port binds by dockerd process |
magmt_ip |
body | string | The ip address used to establish session with router |
seq |
body | integer | reserved field |
Response Example
{
"info": {},
"data":{
"id": "794d77d6558c493f901b64d98ece2246",
"host_ip": "10.75.44.10",
"host_port": 2376,
"magmt_ip": "10.75.44.10",
"created_on": "2018-06-13 14:08:24",
"updated_on": "2018-06-13 14:08:24",
"seq": 10
}
}
Get Host Detail¶
GET api/hosts/{host_id}
Get one host detail information.
Request
Name | In | Type | Required | Description |
---|---|---|---|---|
host_id |
path | string | True | The id of the host |
Response paramters in data json
Name | In | Type | Description |
---|---|---|---|
id |
body | string | id in UUID format |
created_at |
body | string | Time at which the resource has been created (in UTC ISO8601 format). |
updated_on |
body | string | Time at which the resource has been updated (in UTC ISO8601 format). |
host_ip |
body | string | The ip address binds by dockerd process |
host_port |
body | integer | The tcp port binds by dockerd process |
magmt_ip |
body | string | The ip address used to establish session with router |
seq |
body | integer | reserved field |
Response Example
with request like GET api/hosts/794d77d6558c493f901b64d98ece2246
{
"info": {},
"data": {
"id": "794d77d6558c493f901b64d98ece2246",
"host_ip": "10.75.44.10",
"host_port": 2376,
"magmt_ip": "10.75.44.10",
"created_on": "2018-06-13 14:08:24",
"updated_on": "2018-06-13 14:08:24",
"seq": 1
},
}
List Hosts¶
GET api/hosts
Lists all hosts which can use as docker host.
Request
Name | In | Type | Required | Description |
---|---|---|---|---|
host_ip |
query | string | False | The ip address binds by dockerd process |
host_port |
query | integer | False | The tcp port binds by dockerd process |
magmt_ip |
query | string | False | The ip address used to establish session with router |
seq |
query | integer | False | reserved field |
Response paramters in data json
Name | In | Type | Description |
---|---|---|---|
id |
body | string | id in UUID format |
created_at |
body | string | Time at which the resource has been created (in UTC ISO8601 format). |
updated_on |
body | string | Time at which the resource has been updated (in UTC ISO8601 format). |
host_ip |
body | string | The ip address binds by dockerd process |
host_port |
body | integer | The tcp port binds by dockerd process |
magmt_ip |
body | string | The ip address used to establish session with router |
seq |
body | integer | reserved field |
Response Example
with request like GET api/hosts?host_port=2376
{
"info": {},
"data": [
{
"id": "794d77d6558c493f901b64d98ece2246",
"host_ip": "10.75.44.10",
"host_port": 2376,
"magmt_ip": "10.75.44.10",
"created_on": "2018-06-13 14:08:24",
"updated_on": "2018-06-13 14:08:24",
"seq": 1
},
{
"id": "794d7716558ca93f90db64d98ace2246",
"host_ip": "10.75.44.11",
"host_port": 2376,
"magmt_ip": "10.75.44.11",
"created_on": "2018-06-13 14:08:24",
"updated_on": "2018-06-13 14:08:24",
"seq": 2
}
]
}
Status codes¶
Return values | Description |
---|---|
200 OK | The GET , PUT or DELETE request was successful, the resource(s) itself is returned as JSON. |
201 Created | The POST request was successful and the resource is returned as JSON. |
400 Bad Request | A required attribute of the API request is missing, e.g., the host_ip of an docker host is not given. |
404 Not Found | A resource could not be accessed, e.g., an ID for a resource could not be found. |