summaryrefslogtreecommitdiffstats
path: root/compass-deck/api/api.raml
diff options
context:
space:
mode:
Diffstat (limited to 'compass-deck/api/api.raml')
-rw-r--r--compass-deck/api/api.raml4027
1 files changed, 4027 insertions, 0 deletions
diff --git a/compass-deck/api/api.raml b/compass-deck/api/api.raml
new file mode 100644
index 0000000..6855b57
--- /dev/null
+++ b/compass-deck/api/api.raml
@@ -0,0 +1,4027 @@
+#%RAML 0.8
+title: Compass
+version: v1
+baseUri: http://10.145.89.151/api
+mediaType: application/json
+
+
+/permissions:
+ get:
+ body:
+ application/json:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ [
+ {
+ "alias": "list permissions",
+ "description": "list all permissions",
+ "id": 1,
+ "name": "list_permissions"
+ },
+ ]
+ description: List all permissions
+ headers:
+ X-Auth-Header:
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /{permission_id}:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ [
+ {
+ "alias": "list permissions",
+ "description": "list all permissions",
+ "id": 1,
+ "name": "list_permissions"
+ }
+ ]
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ message: "Cannot find the record in table Permission: {'id': '<permission_id>'}"
+ }
+ description: List a specific permission info
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+/users:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ [
+ {
+ "id": 1,
+ "email": "someuser@email.com",
+ "first_name": "",
+ "last_name": "",
+ "is_admin": false,
+ "active": true,
+ "created_at": "--timestamp---",
+ "last_login_at": "--timestamp---"
+ },
+ ]
+
+ description: Lists information for all users
+ headers:
+ X-Auth-Header:
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ queryParameters:
+ email:
+ is_admin:
+ active:
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "email": "admin@someemail.com",
+ "password": "admin",
+ "firstname": "First",
+ "lastname": "Last"
+ }
+ responses:
+ 201:
+ body:
+ application/json:
+ example: |
+ {
+ "id": 3,
+ "email": "user3@someemail.com",
+ "first_name": "",
+ "last_name": "",
+ "is_admin": false,
+ "active": true,
+ "created_at": "--timestamp---",
+ "last_login_at": "--timestamp---"
+ }
+ 400:
+ body:
+ application/json:
+ example: |
+ {
+ "bad request"
+ }
+ 403:
+ body:
+ application/json:
+ example: |
+ {
+ "forbidden"
+ }
+ 409:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The user already exists!"
+ }
+ description: Creates a user(admin only)
+ headers:
+ X-Auth-Header:
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /{user_id}:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "id": 1,
+ "email": "someuser@email.com",
+ "first_name": "",
+ "last_name": "",
+ "is_admin": false,
+ "active": true,
+ "created_at": "2014-03-25 12:00:00",
+ "last_login_at": "2014-03-25 12:05:00"
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The user with id 'some--id--' cannot be found!"
+ }
+ description: Lists information for a specific user
+ headers:
+ X-Auth-Header:
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {"password": 123}
+ responses:
+ 201:
+ body:
+ application/json:
+ example: |
+ {
+ "id": 3,
+ "email": "user3@someemail.com",
+ "first_name": "",
+ "last_name": "",
+ "is_admin": false,
+ "active": true
+ }
+ 409:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The user with id 'some--id--' cannot be found!"
+ }
+ description: Updates user’s information
+ headers:
+ X-Auth-Header:
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ delete:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "id": 3,
+ "email": "user3@someemail.com",
+ "first_name": "",
+ "last_name": "",
+ "is_admin": false,
+ "active": true
+ }
+ 409:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The user cannot be found!"
+ }
+ description: Deletes a user(admin only)
+ headers:
+ X-Auth-Header:
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /permissions:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ [
+ {
+ "created_at": "2014-10-17 16:28:21",
+ "user_id": 1,
+ "description": "list all permissions",
+ "permission_id": 1,
+ "updated_at": "2014-10-17 16:28:21",
+ "alias": "list permissions",
+ "id": 1,
+ "name": "list_permissions"
+ }
+ ]
+ 409:
+ body:
+ application/json:
+ example: |
+ {
+ "type": "itemNotFound",
+ "message": "The user with id 'some--id--' cannot be found!"
+ }
+ description: Lists permissions for a specified user
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /action:
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "add_permissions": [1,2,3],
+ "remove_permissions": [1],
+ "set_permissions": [1],
+ "disable_user": [1],
+ "enable_user": [1]
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ Add permission:
+
+ [
+ {
+ "created_at": "2014-10-17 16:28:21",
+ "user_id": 1,
+ "description": "list all permissions",
+ "permission_id": 1,
+ "updated_at": "2014-10-17 16:28:21",
+ "alias": "list permissions",
+ "id": 1,
+ "name": "list_permissions"
+ }
+ ]
+
+ Remove permission:
+
+ [
+ {
+ "created_at": "2014-10-17 16:28:21",
+ "user_id": 1,
+ "description": "list all permissions",
+ "permission_id": 1,
+ "updated_at": "2014-10-17 16:28:21",
+ "alias": "list permissions",
+ "id": 1,
+ "name": "list_permissions"
+ }
+ ]
+
+ Set Permission:
+
+ [
+ {
+ "created_at": "2014-10-17 16:28:21",
+ "user_id": 1,
+ "description": "list all permissions",
+ "permission_id": 1,
+ "updated_at": "2014-10-17 16:28:21",
+ "alias": "list permissions",
+ "id": 1,
+ "name": "list_permissions"
+ }
+ ]
+
+ Enable user:
+
+ {
+ "created_at": "2014-10-17 16:28:21",
+ "updated_at": "2014-10-17 16:28:21",
+ "email": "admin@huawei.com",
+ "is_admin": true,
+ "active": true,
+ "id": 1
+ }
+
+ Disable user:
+
+ {
+ "created_at": "2014-10-17 16:28:21",
+ "updated_at": "2014-10-17 16:28:21",
+ "email": "admin@huawei.com",
+ "is_admin": true,
+ "active": true,
+ "id": 1
+ }
+ 409:
+ body:
+ application/json:
+ example: |
+ {
+ "type": "itemNotFound",
+ "message": "The user cannot be found!"
+ }
+ description: Adds/Removes permissions, Enable/Disable a user (admin only)
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /token:
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "email": "admin@huawei.com",
+ "password": "admin"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "expire_timestamp": "2014-10-06 13:25:23",
+ "token": "$1$c1ZWGYEn$WTg57cnP4pEwd9JMJ7beS/",
+ "user_id": 1,
+ "id": 3
+ }
+ 409:
+ body:
+ application/json:
+ example: |
+ {
+ "type": "unauthorized",
+ "message": "Either email or password is wrong!"
+ }
+ description: Authenticates and generates a token
+ /login:
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "email": "admin@huawei.com",
+ "password": "admin"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "expire_timestamp": "2014-10-06 13:25:23",
+ "token": "$1$c1ZWGYEn$WTg57cnP4pEwd9JMJ7beS/",
+ "user_id": 1,
+ "id": 3
+ }
+ 401:
+ body:
+ application/json:
+ example: |
+ {
+ "type": "unauthorized",
+ "message": "Either email or password is wrong!"
+ }
+ 403:
+ body:
+ application/json:
+ example: |
+ {
+ "type": "userDisabled",
+ "message”: "User is disabled !"
+ }
+ description: Login
+ /logout:
+ post:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ [
+ {
+ "expire_timestamp": "2014-10-17 18:30:29",
+ "token": "$1$AFqIS5Kn$1ASgOkPv.G1a7pkRRHKY.0",
+ "user_id": 1,
+ "id": 1
+ }
+ ]
+ 401:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "invalid user token: $1$AFqIS5Kn$1ASgOkPv.G1a7pkRRHKY.0",
+ }
+ description: Logout
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+/switches:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ [
+ {
+ "ip": "172.29.8.40",
+ "created_at": "2014-10-17 17:28:06",
+ "updated_at": "2014-10-17 17:28:06",
+ "state": "initialized",
+ "filters": "",
+ "credentials": {
+ "version": "2c",
+ "community": "public"
+ },
+ "id": 2
+ }
+ ]
+ description: Lists switches
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "ip": "172.29.8.40",
+ "credentials":
+ {
+ "version": "2c",
+ "community": "public"
+ }
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "ip": "172.29.8.40",
+ "created_at": "2014-10-17 17:28:06",
+ "updated_at": "2014-10-17 17:28:06",
+ "state": "initialized",
+ "filters": "",
+ "credentials": {
+ "version": "2c",
+ "community": "public"
+ },
+ "id": 2
+ }
+ 409:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "IP address '192.168.1.1' already exists"
+ }
+ description: Creates a switch
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /{switch_id}:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "ip": "172.29.8.40",
+ "created_at": "2014-10-17 17:28:06",
+ "updated_at": "2014-10-17 17:28:06",
+ "state": "initialized",
+ "filters": "",
+ "credentials": {
+ "version": "2c",
+ "community": "public"
+ },
+ "id": 2
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cannot find the switch which id is '1'."
+ }
+ description: Lists a switch
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "ip": "172.29.8.40",
+ "credentials":
+ {
+ "version": "2c",
+ "community": "private"
+ }
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "ip": "172.29.8.40",
+ "created_at": "2014-10-17 17:28:06",
+ "updated_at": "2014-10-17 17:28:06",
+ "state": "initialized",
+ "filters": "",
+ "credentials": {
+ "version": "2c",
+ "community": "private"
+ },
+ "id": 2
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cannot update the switch which id is '1'! The switch does not exists."
+ }
+ description: Set the switch properties
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ patch:
+ body:
+ application/json:
+ schema: |
+ {
+ "ip": "172.29.8.40",
+ "credentials":
+ {
+ "version": "3",
+ "community": "public"
+ }
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "ip": "172.29.8.40",
+ "created_at": "2014-10-17 17:28:06",
+ "updated_at": "2014-10-17 17:28:06",
+ "state": "initialized",
+ "filters": "",
+ "credentials": {
+ "version": "3",
+ "community": "public"
+ },
+ "id": 2
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cannot update the switch which id is '1'! The switch does not exists."
+ }
+ description: Updates the switch properties
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ delete:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "ip": "172.29.8.41",
+ "created_at": "2014-10-17 17:45:17",
+ "updated_at": "2014-10-17 17:45:17",
+ "state": "initialized",
+ "filters": "",
+ "credentials": {
+ "version": "2c",
+ "community": "public"
+ },
+ "id": 3
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cannot find the record in table Switch: {'id': 4}"
+ }
+ description: Delete switch
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /machines:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ Get:
+ [
+ {
+ "vlans": [],
+ "updated_at": "2014-10-17 18:02:21",
+ "created_at": "2014-10-17 18:02:21",
+ "switch_id": 3,
+ "id": 1,
+ "mac": "28:6e:d4:46:c4:25",
+ "tag": {},
+ "location": {},
+ "switch_ip": "172.29.8.41",
+ "ipmi_credentials": {},
+ "machine_id": 1,
+ "port": "10",
+ "switch_machine_id": 204
+ }
+ ]
+ queryParameters:
+ port:
+ portStart:
+ portEnd:
+ portRange:
+ PortPrefix:
+ PortSuffix:
+ vlans:
+ mac:
+ tag:
+ location:
+ description: Lists machines for a specified switch
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "mac": "28:6e:d4:46:c4:25",
+ "port": "1",
+ "vlans": "88",
+ "ipmi_credentials": {
+ "ip": "1.2.3.4",
+ "username": "test",
+ "password": "test"
+ },
+ "tag": "tag",
+ "location": {
+ "column": "1",
+ "row": "1",
+ "unit": "1"
+ }
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "id": 1,
+ "mac": "28:6e:d4:47:c8:6c",
+ "vlan": 1,
+ "port": "10"
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The switch does not exists."
+ }
+ description: Manually add a machine
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /machines:
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "mac": "28:6e:d4:46:c4:25",
+ "port": "1",
+ "vlans": "88"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "duplicate_switches_machines": [
+ {
+ "mac": "a1:b2:c3:d4:e1:f6",
+ "port": "101"
+ }
+ ],
+ "switches_machines": [
+ {
+ "vlans": [],
+ "updated_at": "2015-05-07 10:55:12",
+ "created_at": "2015-05-07 10:55:12",
+ "switch_id": 2,
+ "id": 1,
+ "mac": "70:7b:e8:e2:72:21",
+ "tag": {},
+ "location": {},
+ "switch_ip": "10.145.8.10",
+ "ipmi_credentials": {},
+ "machine_id": 1,
+ "port": "204",
+ "switch_machine_id": 1
+ },
+ {
+ "vlans": [],
+ "updated_at": "2015-05-07 10:55:12",
+ "created_at": "2015-05-07 10:55:12",
+ "switch_id": 2,
+ "id": 2,
+ "mac": "a1:b2:c3:d4:e1:f6",
+ "tag": {},
+ "location": {},
+ "switch_ip": "10.145.8.10",
+ "ipmi_credentials": {},
+ "machine_id": 2,
+ "port": "101",
+ "switch_machine_id": 2
+ },
+ {
+ "vlans": [],
+ "updated_at": "2015-05-07 10:55:12",
+ "created_at": "2015-05-07 10:55:12",
+ "switch_id": 3,
+ "id": 3,
+ "mac": "a1:b2:c3:d4:e5:f9",
+ "tag": {},
+ "location": {},
+ "switch_ip": "172.29.8.40",
+ "ipmi_credentials": {},
+ "machine_id": 3,
+ "port": "121",
+ "switch_machine_id": 3
+ }
+ ],
+ "fail_switches_machines": [
+ {
+ "mac": "a1:b5:c3:d4:e5:f9",
+ "port": "131"
+ },
+ {
+ "mac": "a1:b2:c3:d4:e1:f6",
+ "port": "13"
+ }
+ ]
+ }
+ description: Batch switch machines. If the machine is connected to other switch or switch does not exist, it will be added to fail_switches_machines and return. If machine is already existed, it will be added to duplicate_switches_machines.
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+
+ /{id}/machines/{machine_id}:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "vlans": [
+ 88
+ ],
+ "updated_at": "2014-10-17 17:40:13",
+ "created_at": "2014-10-17 17:40:13",
+ "switch_id": 2,
+ "id": 1,
+ "mac": "28:6e:d4:46:c4:25",
+ "tag": {},
+ "location": {},
+ "switch_ip": "172.29.8.40",
+ "ipmi_credentials": {},
+ "machine_id": 1,
+ "port": "7",
+ "switch_machine_id": 1
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cannot find the record in table SwitchMachine: {'machine_id': 1000, 'switch_id': 2}"
+ }
+ description: Get machine of a specified switch
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "port": "80",
+ "vlans": "88",
+ "pmi_credentials": "pmi_credentials here",
+ "tag": "tag here",
+ "location":
+ {"building": "E5"}
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "vlans": [
+ 88
+ ],
+ "updated_at": "2014-10-17 17:40:13",
+ "created_at": "2014-10-17 17:40:13",
+ "switch_id": 2,
+ "id": 1,
+ "mac": "28:6e:d4:46:c4:25",
+ "tag": {},
+ "location": {
+ "building": "E5"
+ },
+ "switch_ip": "172.29.8.40",
+ "ipmi_credentials": {},
+ "machine_id": 1,
+ "port": "7",
+ "switch_machine_id": 1
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cannot find the record in table SwitchMachine: {'machine_id': 1000, 'switch_id': 2}"
+ }
+ description: set machine property of a specified switch
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ patch:
+ body:
+ application/json:
+ schema: |
+ {
+ "port": "80",
+ "vlans": "88",
+ "pmi_credentials": "pmi_credentials here",
+ "tag": "tag here",
+ "location":
+ {"city": "Beijing"}
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "vlans": [
+ 88
+ ],
+ "updated_at": "2014-10-17 17:40:13",
+ "created_at": "2014-10-17 17:40:13",
+ "switch_id": 2,
+ "id": 1,
+ "mac": "28:6e:d4:46:c4:25",
+ "tag": {},
+ "location": {
+ "building": "E5",
+ "city": "beijing"
+ },
+ "switch_ip": "172.29.8.40",
+ "ipmi_credentials": {},
+ "machine_id": 1,
+ "port": "7",
+ "switch_machine_id": 1
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cannot find the record in table SwitchMachine: {'machine_id': 1000, 'switch_id': 2}"
+ }
+ description: update machine property of a specified switch
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ delete:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "vlans": [
+ 88
+ ],
+ "updated_at": "2014-10-17 17:40:13",
+ "created_at": "2014-10-17 17:40:13",
+ "switch_id": 2,
+ "id": 1,
+ "mac": "28:6e:d4:46:c4:25",
+ "tag": {},
+ "location": {
+ "building": "E5",
+ "city": "beijing"
+ },
+ "switch_ip": "172.29.8.40",
+ "ipmi_credentials": {},
+ "machine_id": 1,
+ "port": "7",
+ "switch_machine_id": 1
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cannot find the record in table SwitchMachine: {'machine_id': 1000, 'switch_id': 2}"
+ }
+ description: Delete a machine from a switch
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /{switch_id}/action:
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "find_machines": 1,
+ "add_macheins": [{"machine_id":1,"port":"10"}],
+ "rermove_machines": 1,
+ "set_machines": [{"machine_id": 1, "port": "10"}]
+ }
+ responses:
+ 202:
+ body:
+ application/json:
+ example: |
+ find_machines:
+ {
+ "status": "action {'find_machines': None} sent",
+ "details": {}
+ }
+ 200:
+ body:
+ application/json:
+ example: |
+ add_machines:
+ [
+ {
+ "vlans": [],
+ "updated_at": "2014-10-17 17:56:44",
+ "created_at": "2014-10-17 17:56:44",
+ "switch_id": 3,
+ "id": 1,
+ "mac": "28:6e:d4:46:c4:25",
+ "tag": {},
+ "location": {},
+ "switch_ip": "172.29.8.41",
+ "ipmi_credentials": {},
+ "machine_id": 1,
+ "port": "10",
+ "switch_machine_id": 203
+ }
+ ]
+
+ remove_machines:
+ []
+ set_machines:
+ [
+ {
+ "vlans": [],
+ "updated_at": "2014-10-17 17:56:44",
+ "created_at": "2014-10-17 17:56:44",
+ "switch_id": 3,
+ "id": 1,
+ "mac": "28:6e:d4:46:c4:25",
+ "tag": {},
+ "location": {},
+ "switch_ip": "172.29.8.41",
+ "ipmi_credentials": {},
+ "machine_id": 1,
+ "port": "10",
+ "switch_machine_id": 203
+ }
+ ]
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cannot update the switch which id is '1'! The switch does not exists."
+ }
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+/switchbatch:
+ post:
+ body:
+ application/json:
+ schema: |
+ [{
+ "switch_ip": "127.0.0.1":
+ "credentials":{
+ "version": "2c",
+ "community": "public"
+ },{
+ "switch_ip": "127.0.0.2"
+ }]
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "switches": [
+ {
+ "vendor": "Huawei",
+ "ip": "10.145.8.10",
+ "created_at": "2015-05-04 16:13:34",
+ "updated_at": "2015-05-04 16:13:34",
+ "state": "initialized",
+ "filters": "",
+ "credentials": {
+ "version": "2c",
+ "community": "public"
+ },
+ "id": 2
+ },
+ {
+ "ip": "172.29.8.40",
+ "created_at": "2015-05-04 16:13:34",
+ "updated_at": "2015-05-04 16:13:34",
+ "state": "initialized",
+ "filters": "",
+ "credentials": {},
+ "id": 3
+ }
+ ],
+ "fail_switches": [
+ {
+ "ip": "172.29.8.40"
+ }
+ ]
+ }
+ description: Batch switches. If switch ip already existed, switch data will be added in fail_switches list and return.
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+/machines:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ [
+ {
+ "created_at": "2014-10-17 17:40:13",
+ "updated_at": "2014-10-17 23:22:53",
+ "switches": [],
+ "mac": "28:6e:d4:46:c4:25",
+ "tag": {},
+ "location": {
+ "building": "E5",
+ "city": "beijing"
+ },
+ "ipmi_credentials": {},
+ "id": 1
+ },
+ ]
+ queryParameters:
+ mac:
+ tag:
+ location:
+ description: Lists machines
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /{machine_id}:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "created_at": "2014-10-17 17:40:13",
+ "updated_at": "2014-10-17 23:22:53",
+ "switches": [],
+ "mac": "28:6e:d4:46:c4:25",
+ "tag": {},
+ "location": {
+ "building": "E5",
+ "city": "beijing"
+ },
+ "ipmi_credentials": {},
+ "id": 1
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The machine witch ID '$machine_id' cannot be found!"
+ }
+ description: Lists machines of a specific machine
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "ipmi_credentials": {
+ "builder": "huawei"
+ }
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "created_at": "2014-10-17 17:40:13",
+ "updated_at": "2014-10-17 23:58:46",
+ "switches": [],
+ "mac": "28:6e:d4:46:c4:25",
+ "tag": {
+ "builder": "huawei"
+ },
+ "location": {
+ "building": "E5",
+ "city": "beijing"
+ },
+ "ipmi_credentials": {},
+ "id": 1
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The machine witch ID “$machine_id” cannot be found!"
+ }
+ description: set machine properties
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ patch:
+ body:
+ application/json:
+ schema: |
+ {
+ "ipmi_credentials": {
+ "builder": "huawei"
+ },
+ "tag": {
+ "type": "ES200"
+ }
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "created_at": "2014-10-17 17:40:13",
+ "updated_at": "2014-10-18 00:03:12",
+ "switches": [],
+ "mac": "28:6e:d4:46:c4:25",
+ "tag": {
+ "type": "ES200"
+ },
+ "location": {
+ "building": "E5",
+ "city": "beijing"
+ },
+ "ipmi_credentials": {},
+ "id": 1
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The machine witch ID '$machine_id' cannot be found!"
+ }
+ description: updatge machine properties
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ delete:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "created_at": "2014-10-17 17:40:13",
+ "updated_at": "2014-10-18 00:03:12",
+ "switches": [],
+ "mac": "28:6e:d4:46:c4:25",
+ "tag": {
+ "type": "ES200"
+ },
+ "location": {
+ "building": "E5",
+ "city": "beijing"
+ },
+ "ipmi_credentials": {},
+ "id": 1
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The machine witch ID '$machine_id' cannot be found!"
+ }
+ description: Delete a machine (admin only)
+ /action:
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "tag": {"builder": "huawei"},
+ "poweron": "true",
+ "poweroff": "true",
+ "reset": "true"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ tag example:
+
+ {
+ "created_at": "2014-10-17 17:40:13",
+ "updated_at": "2014-10-18 00:10:58",
+ "id": 2,
+ "switches": [
+ {
+ "switch_ip": "172.29.8.40",
+ "vlans": [
+ 88
+ ],
+ "port": "4"
+ }
+ ],
+ "mac": "00:0c:29:2b:c9:d4",
+ "tag": {
+ "builder": "huawei"
+ },
+ "location": {},
+ "switch_ip": "172.29.8.40",
+ "ipmi_credentials": {},
+ "vlans": [
+ 88
+ ],
+ "port": "4"
+ }
+
+ poweron/ poweroff / reset is null example:
+
+ {
+ "status": "poweron 00:0c:29:2b:c9:d4 action sent",
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The machine witch ID '$machine_id' cannot be found!"
+ }
+ 400:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The machine haven't set IPMI info!"
+ }
+ description: machine actions
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+/flavors:
+ /{flavor_id}/metadata:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "flavor_config": {
+ "neutron_config": {...},
+ "security": {...},
+ "ha_proxy": {...},
+ "network_mapping": {...}
+
+ }
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {message: "flavor <flavor_id> does not exist"}
+ description: List specific flavor metadata.
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /{flavor_id}/ui_metadata:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "flavor_config":
+ {
+ "category": "service_credentials",
+ "modifiable_data": [
+ "username",
+ "password",
+ ]
+ "table_display_header": [
+ "Service",
+ "UserName",
+ "Password",
+ "Action",
+ ]
+ "accordion_heading": "OpenStack Database and Queue Credentials",
+ "action”: true,
+ "data_structure": "table"
+ },
+ {...},
+ {...}
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {message: "flavor <flavor_id> does not exist"}
+ description: List specific flavor ui metadata.
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+/adapters:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ [{
+ "flavors": [
+ {
+ "roles": [
+ {
+ "display_name": "all in one compute",
+ "description": "all in one compute",
+ "adapter_id": 3,
+ "role_id": 35,
+ "flavor_id": 4,
+ "optional": true,
+ "id": 35,
+ "name": "allinone-compute"
+ }
+ ],
+ "display_name": "All-In-One",
+ "id": 4,
+ "template": "allinone.tmpl",
+ "name": "allinone"
+ },
+ ],
+ "package_installer": {
+ "id": 1,
+ "alias": "chef_installer",
+ "name": "chef_installer",
+ "settings": {
+ "chef_server_ip": "10.145.88.211",
+ "client_name": "",
+ "chef_server_dns": "compass",
+ "databags": [],
+ "chef_url": "https://10.145.88.211",
+ "key_dir": ""
+ }
+ },
+ "name": "openstack_icehouse",
+ "os_installer": {
+ "id": 1,
+ "alias": "cobbler",
+ "name": "cobbler",
+ "settings": {
+ "credentials": {
+ "username": "cobbler",
+ "password": "cobbler"
+ },
+ "cobbler_url": "http://10.145.88.211/cobbler_api"
+ }
+ },
+ "supported_oses": [
+ {
+ "os_id": 1,
+ "id": 1,
+ "name": "Ubuntu-12.04-x86_64"
+ },
+ {
+ "os_id": 2,
+ "id": 2,
+ "name": "CentOS-6.5-x86_64"
+ }
+ ],
+ "display_name": "OpenStack Icehouse",
+ "id": 3
+ }]
+ queryParameters:
+ name:
+ description: Lists information for all adapters
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /{id}:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "id" : 1,
+ "name": "openstack",
+ "display": "OpenStack",
+ "os_installer": "cobbler",
+ "package_installer": "chef",
+ "roles": [ { "display_name": "compute",
+ "name": "os-compute-worker"
+ },
+ { "display_name": "controller",
+ "name": "os-controller"
+ },
+ { "display_name": "network",
+ "name": "os-network"
+ },
+ { "display_name": "storage",
+ "name": "os-block-storage-worker"
+ ],
+ "compatible_os": [
+ {
+ "name": "CentOs",
+ "os_id": 1
+ },
+ {
+ "name": "Ubuntu",
+ "os_id": 2
+ }
+ ]
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The adapter with id 'some_id' cannot be found!"
+ }
+ description: Lists information for a specified adapter
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /oses/{os_id}/metadata:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "package_config": {
+ "security": {
+ "_self": {
+ "mapping_to": "",
+ "description": null,
+ "required_in_whole_config": true,
+ "display_type": null,
+ "js_validator": null,
+ "default_value": null,
+ "field_type": "dict",
+ "name": "security",
+ "required_in_options": false,
+ "is_required": false,
+ "options": null
+ },
+ },
+ "os_config": {
+ "server_credentials": {
+ "_self": {
+ "mapping_to": "server_credentials",
+ "description": null,
+ "required_in_whole_config": true,
+ "display_type": null,
+ "js_validator": null,
+ "default_value": null,
+ "field_type": "dict",
+ "name": "server_credentials",
+ "required_in_options": false,
+ "is_required": false,
+ "options": null
+ },
+ "username": {
+ "_self": {
+ "mapping_to": "username",
+ "description": "username",
+ "required_in_whole_config": false,
+ "display_type": "text",
+ "js_validator": null,
+ "default_value": "root",
+ "field_type": "basestring",
+ "name": "username",
+ "required_in_options": false,
+ "is_required": true,
+ "options": null
+ }
+ },
+ },
+ },
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The adapter with id 'some_id' cannot be found!"
+ }
+ description: Lists config formats for a specified adapter and os
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /oses/{os_id}/ui_metadata:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "os_global_config": [
+ {
+ "title": "Server Credentials",
+ "data": [
+ {
+ "default_value": "root",
+ "display_name": "User name",
+ "name": "username",
+ "display_type": "text",
+ "is_required": "true",
+ "placeholder": "Username",
+ "order": 1
+ },
+ {
+ "display_name": "Confirm Password",
+ "name": "confirmPassword",
+ "datamatch": "password",
+ "display_type": "password",
+ "is_required": "true",
+ "placeholder": "Confirm Password",
+ "order": 3
+ },
+ {
+ "display_name": "Password",
+ "name": "password",
+ "display_type": "password",
+ "is_required": "true",
+ "placeholder": "Password",
+ "order": 2
+ }],
+ "order": 2,
+ "name": "server_credentials"
+ },
+ }
+ }]
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "os <os_id> does not exist"
+ }
+ description: List specified os ui metadata.
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+
+/subnets:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ [{
+ "updated_at": "2014-10-18 21:24:46",
+ "subnet": "10.145.88.0/23",
+ "created_at": "2014-10-18 21:24:46",
+ "id": 1,
+ "name": "10.145.88.0/23"
+ }]
+ description: Gets all subnetworks information
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "subnet": "10.172.20.0/24",
+ "name": "test_subnet"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "updated_at": "2014-10-18 21:24:46",
+ "subnet": "10.145.88.0/23",
+ "created_at": "2014-10-18 21:24:46",
+ "id": 1,
+ "name": "10.145.88.0/23"
+ }
+ 400:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Keyword '$somekey' cannot be recognized!"
+ }
+ 409:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Subnet already exists!"
+ }
+ description: Creates one subnetwork
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /{subnet_id}:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "updated_at": "2014-10-18 21:24:46",
+ "subnet": "10.145.88.0/23",
+ "created_at": "2014-10-18 21:24:46",
+ "id": 1,
+ "name": "10.145.88.0/23"
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Subnetwork with id 'some_id' cannot be found!"
+ }
+ description: Gets one subnetwork info
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "subnet": "10.172.20.0/24",
+ "name": "update_subnet"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "updated_at": "2014-10-18 21:44:17",
+ "subnet": "10.145.86.0/23",
+ "created_at": "2014-10-18 21:43:50",
+ "id": 1,
+ "name": "10.145.86.0/23"
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Subnetwork with id 'some_id' cannot be found!"
+ }
+ 409:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Subnet name already exists!"
+ }
+ description: set subnet properties
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ delete:
+ responses:
+ 403:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Subnetwork is in use by some interface. Cannot delete it."
+ }
+
+
+ {
+ "message": "Subnetwork can only be deleted by creator or admin!"
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Subnetwork with id 'some_id' cannot be found!"
+ }
+ description: Deletes a subnetwork (owner, admin only)
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+/clusters:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ [
+ {
+ "created_at": "2014-10-18 23:01:23",
+ "os_name": "CentOS-6.5-x86_64",
+ "name": "cluster1",
+ "reinstall_distributed_system": true,
+ "adapter_id": 3,
+ "updated_at": "2014-10-18 23:01:23",
+ "owner": "admin@huawei.com",
+ "os_id": 2,
+ "distributed_system_installed": false,
+ "flavor": {
+ "display_name": "All-In-One",
+ "name": "allinone",
+ "roles": [
+ {
+ "display_name": "all in one compute",
+ "description": "all in one compute",
+ "adapter_id": 3,
+ "role_id": 35,
+ "flavor_id": 4,
+ "optional": true,
+ "id": 35,
+ "name": "allinone-compute"
+ }
+ ],
+ "adapter_id": 3,
+ "template": "allinone.tmpl",
+ "id": 4
+ },
+ "id": 1
+ }
+ ]
+ queryParameters:
+ name:
+ os_name:
+ owner:
+ adapter_name:
+ flavor_name:
+ description: Lists all information for all clusters
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "adapter_id": 3,
+ "name": "add_cluster",
+ "os_id": 1,
+ "flavor_id": 1
+ }
+ responses:
+ 201:
+ body:
+ application/json:
+ example: |
+ {
+ "created_at": "2014-10-18 23:01:23",
+ "os_name": "CentOS-6.5-x86_64",
+ "name": "cluster1",
+ "reinstall_distributed_system": true,
+ "adapter_id": 3,
+ "updated_at": "2014-10-18 23:01:23",
+ "owner": "admin@huawei.com",
+ "os_id": 2,
+ "distributed_system_installed": false,
+ "flavor": {
+ "display_name": "All-In-One",
+ "name": "allinone",
+ "roles": [
+ {
+ "display_name": "all in one compute",
+ "description": "all in one compute",
+ "adapter_id": 3,
+ "role_id": 35,
+ "flavor_id": 4,
+ "optional": true,
+ "id": 35,
+ "name": "allinone-compute"
+ }
+ ],
+ "adapter_id": 3,
+ "template": "allinone.tmpl",
+ "id": 4
+ },
+ "id": 1
+ }
+ 409:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cluster with name 'cluster_01' already exists!"
+ }
+ description: Creates a new cluster
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /{cluster_id}:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "created_at": "2014-10-18 23:01:23",
+ "os_name": "CentOS-6.5-x86_64",
+ "name": "cluster1",
+ "reinstall_distributed_system": true,
+ "adapter_id": 3,
+ "updated_at": "2014-10-18 23:01:23",
+ "owner": "admin@huawei.com",
+ "os_id": 2,
+ "distributed_system_installed": false,
+ "flavor": {
+ "display_name": "All-In-One",
+ "name": "allinone",
+ "roles": [
+ {
+ "display_name": "all in one compute",
+ "description": "all in one compute",
+ "adapter_id": 3,
+ "role_id": 35,
+ "flavor_id": 4,
+ "optional": true,
+ "id": 35,
+ "name": "allinone-compute"
+ }
+ ],
+ "adapter_id": 3,
+ "template": "allinone.tmpl",
+ "id": 4
+ },
+ "id": 1
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cluster with id 'some_id' cannot be found!"
+ }
+ description: Lists information for a specified cluster
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "name": "update_cluster"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "created_at": "2014-10-18 23:16:02",
+ "os_name": "CentOS-6.5-x86_64",
+ "name": "cluster_new",
+ "reinstall_distributed_system": true,
+ "adapter_id": 3,
+ "updated_at": "2014-10-18 23:16:39",
+ "owner": "admin@huawei.com",
+ "os_id": 2,
+ "distributed_system_installed": false,
+ "flavor": {
+ "display_name": "All-In-One",
+ "name": "allinone",
+ "roles": [
+ {
+ "display_name": "all in one compute",
+ "description": "all in one compute",
+ "adapter_id": 3,
+ "role_id": 35,
+ "flavor_id": 4,
+ "optional": true,
+ "id": 35,
+ "name": "allinone-compute"
+ }
+ ],
+ "adapter_id": 3,
+ "template": "allinone.tmpl",
+ "id": 4
+ },
+ "id": 2
+ }
+ 400:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cluster <cluster_id> not found"
+ }
+ description: set properties of cluster
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ delete:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "created_at": "2014-10-18 23:01:23",
+ "os_name": "CentOS-6.5-x86_64",
+ "name": "cluster1",
+ "reinstall_distributed_system": true,
+ "adapter_id": 3,
+ "updated_at": "2014-10-18 23:01:23",
+ "owner": "admin@huawei.com",
+ "os_id": 2,
+ "distributed_system_installed": false,
+ "flavor": {
+ "display_name": "All-In-One",
+ "name": "allinone",
+ "roles": [
+ {
+ "display_name": "all in one compute",
+ "description": "all in one compute",
+ "adapter_id": 3,
+ "role_id": 35,
+ "flavor_id": 4,
+ "optional": true,
+ "id": 35,
+ "name": "allinone-compute"
+ }
+ ],
+ "adapter_id": 3,
+ "template": "allinone.tmpl",
+ "id": 4
+ },
+ "id": 1
+ }
+ 403:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cluster has been deployed or is being installed. Not allowed to delete it now!"
+ }
+ description: Deletes a specific cluster before deploy (admin, owner only). Hosts will be still kept even cluster(s) is deleted.
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /config:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "package_config": {
+ },
+ "os_config": {
+ }
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cluster with id 'some_id' cannot be found!"
+ }
+ description: Gets config information for a specified cluster
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "os_config":{
+ "general": {
+ "language": "EN",
+ "timezone": "PDT",
+ "domain": "xxx",
+ "default_gateway": "10.0.0.1"
+ },
+ "server_credentials": {
+ "username": "admin",
+ "password": "admin"
+ },
+ "partition": {
+ "/var" : {
+ "_type": "$path",
+ "max_size": "20",
+ "size_percentage": "20"
+ }
+ }
+ },
+ "package_config":{
+ "network_mapping": {
+ "management": {
+ "interface": "eth0"
+ },
+ "tenant": {
+ "interface": "eth1"
+ },
+ "storage": {
+ "interface":" eth2"
+ },
+ "public": {
+ "interface": "eth3"
+ }
+ }
+ }
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "os_config”: {
+ "general”: {
+ "language": "EN",
+ "timezone": "PDT",
+ "domain": "xxx",
+ "default_gateway": "10.0.0.1"
+ },
+ "server_crendentials": {
+ "username": "admin",
+ "password": "admin"
+ },
+ "partition": {
+ "/var" : {
+ "max_size": "20",
+ "size_percentage": "20",
+ },
+ }
+ }
+
+ {
+ "package_config": {
+ "network_mapping": {
+ "management": {
+ "interface": "eth0"
+ },
+ "tenant": {
+ "interface": "eth1"
+ },
+ "storage": {
+ "interface":"eth2"
+ },
+ "public": {
+ "interface": "eth3"
+ }
+ }
+ }
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cluster with id 'some_id' cannot be found!"
+ }
+ description: set properties in cluster config
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ patch:
+ body:
+ application/json:
+ schema: |
+ {
+ "package_config": {
+ "security": {
+ "dashboard_credentials": {
+ "username": "root"
+ }
+ }
+ }
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "package_config":{
+ "security": {
+ "service_crendentials": {
+ "image": {
+ "username": "admin",
+ "password": "admin"
+ },
+ ...
+ },
+ "dashboard_credentials":{
+ "username": "root",
+ "password": "admin"
+ }
+ }
+ }
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cluster with id 'some_id' cannot be found!"
+ }
+ description: update properties in cluster config
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ delete:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "package_config":{
+ "security": {
+ "service_crendentials": {
+ "image": {
+ "username": "admin",
+ "password": "admin"
+ },
+ ...
+ }
+ }
+ }
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cluster with id 'some_id' cannot be found!"
+ }
+ description: delete cluster config
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /state:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "package_config": {
+ },
+ "os_config": {
+ }
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cluster with id 'some_id' cannot be found!"
+ }
+ description: get cluster state
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /hosts:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ [
+ {
+ "id" : 1,
+ "name": "host_01",
+ "dns": "xxx",
+ "os": "Centos",
+ "mac": "---MAC-address---",
+ "machine_id": 1,
+ "os_installed": true,
+ },
+ …...
+ ]
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cluster with id 'some_id' cannot be found!"
+ }
+ description: Gets the information of the hosts belonging to this cluster
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "machine_id": 1,
+ "name": "cluster_host",
+ "reinstall_os": "True",
+ "roles": ["allinone-compute"]
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "os_installer": {
+ "id": 1,
+ "alias": "cobbler",
+ "name": "cobbler",
+ "settings": {
+ "credentials": {
+ "username": "cobbler",
+ "password": "cobbler"
+ },
+ "cobbler_url": "http://10.145.88.211/cobbler_api"
+ }
+ },
+ "ip": null,
+ "clusterhost_id": 2,
+ "updated_at": "2014-10-18 23:47:47",
+ "switches": [
+ {
+ "switch_ip": "172.29.8.40",
+ "vlans": [
+ 88
+ ],
+ "port": "4"
+ }
+ ],
+ "os_installed": false,
+ "tag": {},
+ "cluster_id": 2,
+ "id": 2,
+ "switch_ip": "172.29.8.40",
+ "networks": {
+ },
+ "hostname": null,
+ "reinstall_os": true,
+ "owner": "admin@huawei.com",
+ "port": "4",
+ "location": {},
+ "os_name": "CentOS-6.5-x86_64",
+ "reinstall_distributed_system": true,
+ "mac": "00:0c:29:2b:c9:d4",
+ "host_id": 2,
+ "distributed_system_installed": false,
+ "name": "None.cluster_new",
+ "roles": [],
+ "clustername": "cluster_new",
+ "created_at": "2014-10-18 23:47:47",
+ "machine_id": 2
+ }
+ 409:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "host <host_id> already exists"
+ }
+ description: add host to a cluster
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /{host_id}:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "id" : 1,
+ "name": "host_01",
+ "dns": "xxx",
+ "os": "Centos",
+ "mac": "---MAC-address---",
+ "machine_id": 1,
+ "os_installed": true,
+ "links": [
+ {
+ "href" : "/hosts/1",
+ "rel": "self"
+ },
+ {
+ "href": "/clusters/1/hosts/1/config",
+ "rel": "host package config"
+ }
+ ]
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: get host of a cluster
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "name": "update_cluster_host",
+ "reinstall_os": "False",
+ "roles": ["ha-proxy"]
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "os_installer": {
+ "id": 1,
+ "alias": "cobbler",
+ "name": "cobbler",
+ "settings": {
+ "credentials": {
+ "username": "cobbler",
+ "password": "cobbler"
+ },
+ "cobbler_url": "http://10.145.88.211/cobbler_api"
+ }
+ },
+ "ip": null,
+ "clusterhost_id": 2,
+ "updated_at": "2014-10-19 00:10:43",
+ "switches": [
+ {
+ "switch_ip": "172.29.8.40",
+ "vlans": [
+ 88
+ ],
+ "port": "4"
+ }
+ ],
+ "os_installed": false,
+ "tag": {},
+ "cluster_id": 2,
+ "id": 2,
+ "switch_ip": "172.29.8.40",
+ "networks": {},
+ "hostname": null,
+ "reinstall_os": true,
+ "owner": "admin@huawei.com",
+ "port": "4",
+ "location": {},
+ "os_name": "CentOS-6.5-x86_64",
+ "reinstall_distributed_system": true,
+ "mac": "00:0c:29:2b:c9:d4",
+ "host_id": 2,
+ "distributed_system_installed": false,
+ "name": "None.cluster_new",
+ "roles": [
+ {
+ "display_name": "all in one compute",
+ "description": "all in one compute",
+ "adapter_id": 3,
+ "optional": true,
+ "id": 35,
+ "name": "allinone-compute"
+ }
+ ],
+ "clustername": "cluster_new",
+ "created_at": "2014-10-18 23:47:47",
+ "machine_id": 2
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: set host properties of a cluster
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ patch:
+ body:
+ application/json:
+ schema: |
+ {
+ "roles": "os-controller"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "os_installer": {
+ "id": 1,
+ "alias": "cobbler",
+ "name": "cobbler",
+ "settings": {
+ "credentials": {
+ "username": "cobbler",
+ "password": "cobbler"
+ },
+ "cobbler_url": "http://10.145.88.211/cobbler_api"
+ }
+ },
+ "ip": null,
+ "clusterhost_id": 2,
+ "updated_at": "2014-10-19 00:10:43",
+ "switches": [
+ {
+ "switch_ip": "172.29.8.40",
+ "vlans": [
+ 88
+ ],
+ "port": "4"
+ }
+ ],
+ "os_installed": false,
+ "tag": {},
+ "cluster_id": 2,
+ "id": 2,
+ "switch_ip": "172.29.8.40",
+ "networks": {},
+ "hostname": null,
+ "reinstall_os": true,
+ "owner": "admin@huawei.com",
+ "port": "4",
+ "location": {},
+ "os_name": "CentOS-6.5-x86_64",
+ "reinstall_distributed_system": true,
+ "mac": "00:0c:29:2b:c9:d4",
+ "host_id": 2,
+ "distributed_system_installed": false,
+ "name": "None.cluster_new",
+ "roles": [
+ {
+ "display_name": "all in one compute",
+ "description": "all in one compute",
+ "adapter_id": 3,
+ "optional": true,
+ "id": 35,
+ "name": "allinone-compute"
+ },
+ {
+ "name": "new-role",
+ ...
+ }
+ ],
+ "clustername": "cluster_new",
+ "created_at": "2014-10-18 23:47:47",
+ "machine_id": 2
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: update host properties of a cluster
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ delete:
+ description: delete host from a cluster
+ /config:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "os_config": {
+ ...
+ },
+ "package_config": {
+ ...
+ }
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: get config of a host
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "os_config": {
+ "general": {
+ "language": "EN",
+ "timezone": "UTC",
+ "http_proxy": "http://127.0.0.1:3128",
+ "https_proxy": "http://127.0.0.1:3128",
+ "no_proxy": [
+ "127.0.0.1",
+ "compass"
+ ],
+ "ntp_server": "127.0.0.1",
+ "dns_servers": [
+ "127.0.0.1"
+ ],
+ "domain": "ods.com",
+ "search_path": [
+ "ods.com"
+ ],
+ "default_gateway": "127.0.0.1"
+ },
+ "server_credentials": {
+ "username": "root",
+ "password": "root"
+ },
+ "partition": {
+ "/var": {
+ "max_size": "100G",
+ "percentage": 10,
+ "size": "1G"
+ }
+ }
+ },
+ "package_config": {
+ "network_mapping": {
+ "management": {
+ "interface": "eth0"
+ },
+ "tenant": {
+ "interface": "eth1"
+ },
+ "storage": {
+ "interface":"eth2"
+ },
+ "public": {
+ "interface": "eth3"
+ }
+ },
+ "services_credentials": {
+ "image": {
+ "username": "xxx",
+ "password": "xxx"
+ },
+ "metering": {
+ "username": "xxx",
+ "password": "xxx"
+ }
+ }
+ }
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ …..
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: set host config
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ patch:
+ body:
+ application/json:
+ schema: |
+ {
+ "os_config": {
+ "general": {
+ "language": "EN",
+ "timezone": "UTC",
+ "http_proxy": "http://127.0.0.1:3128",
+ "https_proxy": "http://127.0.0.1:3128",
+ "no_proxy": [
+ "127.0.0.1",
+ "compass"
+ ],
+ "ntp_server": "127.0.0.1",
+ "dns_servers": [
+ "127.0.0.1"
+ ],
+ "domain": "ods.com",
+ "search_path": [
+ "ods.com"
+ ],
+ "default_gateway": "127.0.0.1"
+ },
+ "server_credentials": {
+ "username": "root",
+ "password": "root"
+ },
+ "partition": {
+ "/var": {
+ "max_size": "100G",
+ "percentage": 10,
+ "size": "1G"
+ }
+ }
+ },
+ "package_config": {
+ "network_mapping": {
+ "management": {
+ "interface": "eth0"
+ },
+ "tenant": {
+ "interface": "eth1"
+ },
+ "storage": {
+ "interface":"eth2"
+ },
+ "public": {
+ "interface": "eth3"
+ }
+ },
+ "services_credentials": {
+ "image": {
+ "username": "xxx",
+ "password": "xxx"
+ },
+ "metering": {
+ "username": "xxx",
+ "password": "xxx"
+ }
+ }
+ }
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "os_config": {
+ ...//the same as PATCH cluster config
+ }
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: update host config
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ delete:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "os_config": {
+ ...//the same as PATCH cluster config
+ }
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: delete host config
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /state:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "cluster_id" : 1,
+ "host_id": 10
+ "state": "INSTALLING",
+ "percentage": 0.5,
+ "severity": "INFO",
+ "message": "-----some--message-----",
+ "updated_at": "---timestamp---"
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: get host state of a cluster
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "state": "INSTALLING"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "cluster_id" : 1,
+ "host_id": 10
+ "state": "SUCCESSFUL",
+ "percentage": 1,
+ "severity": "INFO",
+ "message": "-----some--message-----",
+ "updated_at": "---timestamp---"
+ }
+ OR
+ {
+ "cluster_id" : 1,
+ "host_id": 10
+ "state": "ERROR",
+ "percentage": 0.7,
+ "severity": "ERROR",
+ "message": "---some-error-message---",
+ "updated_at": "---timestamp---"
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: set host state properties of a cluster
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /action:
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "add_hosts": {
+ "machines": [{
+ "machine_id": 1,
+ "host_id": 1,
+ "reinstall_os": "True"
+ },{
+ "machine_id": 2,
+ "host_id": 2
+ }]
+ },
+ "set_hosts": {
+ "machines": [{
+ "machine_id": 3
+ },{
+ "machine_id": 4
+ }]
+ },
+ "remove_hosts": {
+ "hosts": [1]
+ },
+ "review": {
+ "hosts": [1,2,3]
+ },
+ "deploy": {
+ "hosts": [1,2,3]
+ }
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "hosts": [
+ {
+ "id" : 5,
+ "machine_id": 10
+ },
+ {
+ "id" : 6,
+ "machine_id": 11
+ },
+ {
+ "id" : 7,
+ "machine_id": 12
+ }
+ ]
+ }
+
+ OR
+
+ {
+ "hosts": [
+ {
+ "id" : 1,
+ "machine_id": 13
+ },
+ {
+ "id" : 2,
+ "machine_id": 14
+ },
+ {
+ "id" : 3,
+ "machine_id": 15
+ }
+ ]
+ }
+
+ OR
+
+ {
+ "hosts": [
+ {
+ "id" : 1,
+ "machine_id": 13
+ }
+ ]
+ }
+
+ OR
+ {
+ "hosts": [
+ {
+ "id" : 1,
+ "machine_id": 10
+ },
+ {
+ "id" : 2,
+ "machine_id": 11
+ },
+ {
+ "id" : 3,
+ "machine_id": 12
+ }
+ ]
+ }
+
+ OR
+
+ {
+ "cluster": {"id": 1},
+ "hosts": [{"id": 1}, {"id": 2}, {"id": 3}]
+ }
+
+ OR
+
+ {
+ "status": "deploy action sent",
+ "cluster": {
+ "id": 1,
+ },
+ "hosts": [
+ {
+ "id": 3
+ }
+ ]
+ }
+
+
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cluster with id 'some_id' cannot be found!"
+ }
+ description: Takes an action for a specific cluster
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /metadata:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "package_config": {
+ },
+ "os_config": {
+ }
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cluster with id 'some_id' cannot be found!"
+ }
+ description: Get metadata of a specific cluster
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+
+/hosts:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ [
+ {
+ "id” : 1,
+ "name": "host_01",
+ "machine_id": 1,
+ "mac": "---MAC-address--",
+ "ip": "192.168.1.2",
+ "os": "CentOS",
+ "os_installed": false,
+ "clusters": ["cluster_01"],
+ "created_by": "user1@email.com",
+ "created_at": "---timestamp---",
+ "updated_at": "---timestamp---",
+ "links”: [
+ {
+ "href" : "/hosts/1",
+ "rel": "self
+ }
+ ]
+ },
+ ...
+ ]
+ queryParameters:
+ name:
+ os_name:
+ owner:
+ mac:
+ description: Lists information for all hosts
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /{host_id}:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "id" : 1,
+ "name": "host_01",
+ "machine_id": 1,
+ "mac": "---MAC-address--”,
+ "ip": "192.168.1.2"
+ "os": "CentOs",
+ "os_installed": false,
+ "domain": "xxx",
+ "dns": "xxx",
+ "created_by": "user1@email.com",
+ "created_at": "---timestamp---",
+ "updated_at": "---timestamp---"
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: Lists information for a specified host
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "name": "update_host_name"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "id" : 1,
+ "name": "host1"
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: set host properties.
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ delete:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "id" : 1,
+ "name": "host_01_new",
+ "mac": "---MAC-address--",
+ "os_name": "CentOs",
+ "os_installed": false
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "type": "itemNotFound",
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: Deletes a host (admin only). The host must be not in any cluster.
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /action:
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "poweron": [1],
+ "poweroff": [1],
+ "reset": [1]
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "status": "host <host_id> power<on|off|reset> action sent",
+ "host": {...}
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The host witch ID '$host_id' cannot be found!"
+ }
+ 400:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "The host didnot set IPMI info!"
+ }
+ description: Poweron, poweroff, reset this host by IPMI
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /clusters:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ [
+ {
+ "os_name": "CentOS-6.5-x86_64",
+ "name": "cluster_new",
+ "reinstall_distributed_system": true,
+ "created_at": "2014-10-18 23:16:02",
+ "adapter_id": 3,
+ "updated_at": "2014-10-18 23:16:39",
+ "owner": "admin@huawei.com",
+ "distributed_system_installed": false,
+ "id": 2
+ }
+ ]
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: Lists clusters which the host belongs to
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /config:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "os_config": {
+ "global": {
+ "language": "EN",
+ "timezone": "PDT",
+ }
+ "partition": {
+ "/var": {
+ "max_size": "20",
+ "size_percentage": "30"
+ },
+ "/home": {
+ "max_size": "20",
+ "size_percentage": "40"
+ }
+ }
+ }
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: Lists config information for a specified host
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "os_config": {
+ "general": {
+ "language": "EN",
+ "timezone": "UTC",
+ "http_proxy": "http://127.0.0.1:3128",
+ "https_proxy": "http://127.0.0.1:3128",
+ "no_proxy": [
+ "127.0.0.1",
+ "compass"
+ ],
+ "ntp_server": "127.0.0.1",
+ "dns_servers": [
+ "127.0.0.1"
+ ],
+ "domain": "ods.com",
+ "search_path": [
+ "ods.com"
+ ],
+ "default_gateway": "127.0.0.1"
+ },
+ "server_credentials": {
+ "username": "root",
+ "password": "root"
+ },
+ "partition": {
+ "/var": {
+ "max_size": "100G",
+ "percentage": 10,
+ "size": "1G"
+ }
+ }
+ }
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "os_config": {
+ …
+ }
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: set config properties for a specified host
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ patch:
+ body:
+ application/json:
+ schema: |
+ {
+ "os_config": {
+ "general": {
+ "language": "EN",
+ "timezone": "UTC",
+ "http_proxy": "http://127.0.0.1:3128",
+ "https_proxy": "http://127.0.0.1:3128",
+ "no_proxy": [
+ "127.0.0.1",
+ "compass"
+ ],
+ "ntp_server": "127.0.0.1",
+ "dns_servers": [
+ "127.0.0.1"
+ ],
+ "domain": "ods.com",
+ "search_path": [
+ "ods.com"
+ ],
+ "default_gateway": "127.0.0.1"
+ },
+ "server_credentials": {
+ "username": "root",
+ "password": "root"
+ },
+ "partition": {
+ "/var": {
+ "max_size": "100G",
+ "percentage": 10,
+ "size": "1G"
+ }
+ }
+ }
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ ....
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: update host config properties
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ delete:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "os_config": {
+ ...
+ }
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: delete host config
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /state:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "state": "INSTALLING",
+ "percentage": 0.5,
+ "severity": "INFO",
+ "message": "-----some--message-----",
+ "updated_at": "---timestamp---"
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: get host state
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "state": "INSTALLING"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "cluster_id" : 1,
+ "host_id": 10
+ "state": "SUCCESSFUL",
+ "percentage": 1,
+ "severity": "INFO",
+ "message": "-----some--message-----",
+ "updated_at": "---timestamp---"
+ }
+
+ OR
+
+ {
+ "cluster_id" : 1,
+ "host_id": 10
+ "state": "ERROR",
+ "percentage": 0.7,
+ "severity": "ERROR",
+ "message": "---some-error-message---",
+ "updated_at": "---timestamp---"
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: set host state properties
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /network:
+ get:
+ body:
+ application/json:
+ schema: |
+ [
+ {
+ "interface": "eth0",
+ "ip": "10.172.20.91",
+ "subnet_id": 1,
+ "is_mgmt": "False",
+ "is_promiscuous": "False"
+ },
+ {
+ "interface": "eth1",
+ "ip": "10.172.20.110",
+ "subnet_id": 1,
+ "is_mgmt": "False",
+ "is_promiscuous": "False"
+ }
+ ]
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "eth0": {
+ "id": 1,
+ "interface": "eth0",
+ "ip": "192.168.10.1",
+ "is_mgmt": true,
+ "is_promiscuous": false,
+ "subnet_id": 1,
+ },
+ "eth1": {
+ "id": 2,
+ "interface": "eth1",
+ "ip": "10.12.123.1",
+ "is_promiscuous": true,
+ "subnet_id": 2,
+ },
+ …..
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: Lists network info for a specified host
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "interface": "eth0",
+ "ip": "10.145.89.152",
+ "subnet_id": 1,
+ "is_mgmt": "True",
+ "is_promiscuous": "False"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "id": 3,
+ "interface": "eth3",
+ "ip": "12.140.10.1",
+ "is_promiscuous": true,
+ "is_mgmt": false,
+ "subnet_id": 3,
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id ‘some_id’ cannot be found!"
+ }
+ description: Creates an interface config entry
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /{interface}:
+ get:
+ description: list host network information
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "interface": "eth1",
+ "ip": "10.145.89.155",
+ "subnet_id": 1,
+ "is_mgmt": "True",
+ "is_promiscuous": "False"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "id": 3,
+ "interface": "eth3",
+ "ip": "12.140.10.2",
+ "is_promiscuous": true,
+ "is_mgmt": false,
+ "subnet_id": 4,
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: set host network properties
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ delete:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "id": 3,
+ "interface": "eth3",
+ "ip": "12.140.10.1",
+ "is_promiscuous”: true,
+ "is_mgmt": false,
+ "subnet_id": 3
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": " Host with id 'some_id' cannot be found!"
+ }
+ description: delete a host network
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+/proxy/{path}:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ [
+ {
+ "created_at": "2014-10-19 10:50:04",
+ "updated_at": "2014-10-19 10:50:04",
+ "email": "admin@huawei.com",
+ "is_admin": true,
+ "active": true,
+ "id": 1
+ }
+ ]
+ queryParameters:
+ URL:
+ example: http://10.145.88.211/api/proxy/users
+ description: proxy get request
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ post:
+ body:
+ application/json:
+ schema: |
+ {
+ "url": "http://10.145.88.211/api/proxy/subnets"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "subnet": "10.145.86.0/23",
+ "created_at": "2014-10-19 11:25:33",
+ "updated_at": "2014-10-19 11:25:33",
+ "name": "10.145.86.0/23",
+ "id": 3
+ }
+ description: proxy post request
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "url": "http://10.145.88.211/api/proxy/subnets/3"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "subnet": "10.145.84.0/23",
+ "created_at": "2014-10-19 11:25:33",
+ "updated_at": "2014-10-19 11:29:08",
+ "name": "10.145.84.0/23",
+ "id": 3
+ }
+ description: proxy put request
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ patch:
+ body:
+ application/json:
+ schema: |
+ {
+ "url": "http://10.145.88.211/api/proxy/subnets/3"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "ip": "172.29.8.42",
+ "created_at": "2014-10-19 11:31:40",
+ "updated_at": "2014-10-19 11:33:46",
+ "state": "initialized",
+ "filters": "",
+ "credentials": {
+ "version": "2c",
+ "community": "private"
+ },
+ "id": 3
+ }
+ description: proxy patch request
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ delete:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "ip": "172.29.8.42",
+ "created_at": "2014-10-19 11:31:40",
+ "updated_at": "2014-10-19 11:33:46",
+ "state": "initialized",
+ "filters": "",
+ "credentials": {
+ "version": "2c",
+ "community": "private"
+ },
+ "id": 3
+ }
+ queryParameters:
+ URL:
+ example: http://10.145.88.211/api/proxy/switches/3
+ description: proxy delete request
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+/host/networks:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "eth1": {
+ "ip": "192.168.100.155",
+ "created_at": "2015-04-17 14:55:55",
+ "is_promiscuous": true,
+ "updated_at": "2015-04-17 14:55:55",
+ "netmask": "255.255.254.0",
+ "is_mgmt": false,
+ "interface": "eth1",
+ "id": 1
+ },
+ "eth0": {
+ "ip": "10.145.89.155",
+ "created_at": "2015-04-17 14:55:55",
+ "is_promiscuous": false,
+ "updated_at": "2015-04-17 14:55:55",
+ "netmask": "255.255.254.0",
+ "is_mgmt": true,
+ "interface": "eth0",
+ "id": 2
+ }
+ }
+ description: List all host networks
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ /{host_network_id}:
+ get:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "ip": "192.168.100.155",
+ "created_at": "2015-04-17 14:55:55",
+ "is_promiscuous": true,
+ "updated_at: "2015-04-17 14:55:55",
+ "netmask": "255.255.254.0",
+ "is_mgmt": false,
+ "interface": "eth1",
+ "id": 1
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ "message": "Cannot find the record in table HostNetwork: {'id': <host_network_id>}",
+ }
+ description: List specifig host network info
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+/host-networks/{host_network_id}:
+ put:
+ body:
+ application/json:
+ schema: |
+ {
+ "interface": "eth0",
+ "ip": "10.145.88.10"
+ }
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "ip": "192.168.100.159",
+ "created_at": "2015-04-17 14:55:55",
+ "is_promiscuous": true,
+ "updated_at: "2015-04-17 14:55:55",
+ "netmask": "255.255.254.0",
+ "is_mgmt": false,
+ "interface": "eth1",
+ "id": 1
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ message: "Cannot find the record in table HostNetwork: {'id': <host_network_id>}"
+ }
+ description: Update a specific host network info.
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+ delete:
+ responses:
+ 200:
+ body:
+ application/json:
+ example: |
+ {
+ "ip: "10.145.89.155",
+ "created_at": "2015-04-17 15:44:54"
+ "is_promiscuous": false,
+ "updated_at": "2015-04-17 15:44:54",
+ "netmask": "255.255.254.0",
+ "is_mgmt": false
+ "interface": "eth0",
+ "id": 1
+ }
+ 404:
+ body:
+ application/json:
+ example: |
+ {
+ message: "Cannot find the record in table HostNetwork: {'id': <host_network_id>}"
+ }
+ description: Delete a host network.
+ headers:
+ Access-token:
+ displayName: X-Auth-Header
+ required: true
+ example: $1$fCD2zLIa$hikkNkqDe0qAXgKHDzw0E0
+
+
+