AddBareMetal2Gateway
API Request
URLs
POST zstack/v1/baremetal2/gateways
Headers
Authorization: OAuth the-session-uuid
Body
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"username": "userName",
"password": "password",
"sshPort": 22.0,
"name": "gateway",
"managementIp": "127.0.0.1",
"clusterUuid": "5b08798053343ec686244dc3a36bbccf"
},
"systemTags": [],
"userTags": []
}

Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"username":"userName","password":"password","sshPort":22.0,"name":"gateway","managementIp":"127.0.0.1","clusterUuid":"5b08798053343ec686244dc3a36bbccf"}}' http://localhost:8080/zstack/v1/baremetal2/gateways
Request Parameters
Name | Type | Location | Description | Valid Value | Starting Version |
---|---|---|---|---|---|
username | String | body(contained in the params structure) | The username of the gateway. | 4.0.0 | |
password | String | body(contained in the params structure) | The password of the gateway. | 4.0.0 | |
sshPort | int | body(contained in the params structure) | Optional. The SSH port of the gateway. | 4.0.0 | |
name | String | body(contained in the params structure) | The name of the gateway. | 4.0.0 | |
description | String | body(contained in the params structure) | Optional. The detailed description of the gateway. | 4.0.0 | |
managementIp | String | body(contained in the params structure) | The IP address of the management node. | 4.0.0 | |
clusterUuid | String | body(contained in the params structure) | The cluster UUID. | 4.0.0 | |
resourceUuid | String | body(contained in the params structure) | Optional. The UUID of the gateway. | 4.0.0 | |
tagUuids | List | body(contained in the params structure) | Optional. The tag UUIDs. | 4.0.0 | |
systemTags | List | body | Optional. The system tags. | 4.0.0 | |
userTags | List | body | Optional. The user tags. | 4.0.0 |
API Response
Sample Response
{
"inventory": {
"zoneUuid": "24b761ab09f7349684387fdf822aaee7",
"name": "example",
"uuid": "f893fe1c941939738a0ec271880d8e53",
"clusterUuid": "4191157f33ab34d0a55b8e30444a1367",
"description": "example",
"managementIp": "192.168.0.1",
"hypervisorType": "KVM",
"state": "Enabled",
"status": "Connected",
"totalCpuCapacity": 4.0,
"availableCpuCapacity": 2.0,
"totalMemoryCapacity": 4.0,
"availableMemoryCapacity": 4.0
}
}
Name | Type | Description | Starting Version |
---|---|---|---|
error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.0.0 |
inventory | BareMetal2ChassisOfferingInventory | See inventory. | 4.0.0 |
#error
Name | Type | Description | Starting Version |
---|---|---|---|
code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 4.0.0 |
description | String | The brief description of the error. | 4.0.0 |
details | String | The details about the error. | 4.0.0 |
elaboration | String | The reserved field. Default value: null. | 4.0.0 |
opaque | LinkedHashMap | The reserved field. Default value: null. | 4.0.0 |
cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 4.0.0 |
#inventory
Name | Type | Description | Starting Version |
---|---|---|---|
zoneUuid | String | The zone UUID. | 4.0.0 |
name | String | The name of the gateway. | 4.0.0 |
uuid | String | The UUID of the gateway. | 4.0.0 |
clusterUuid | String | The cluster UUID. | 4.0.0 |
description | String | The detailed description of the gateway. | 4.0.0 |
managementIp | String | 4.0.0 | |
hypervisorType | String | 4.0.0 | |
state | String | 4.0.0 | |
status | String | 4.0.0 | |
totalCpuCapacity | Long | 4.0.0 | |
availableCpuCapacity | Long | 4.0.0 | |
totalMemoryCapacity | Long | 4.0.0 | |
availableMemoryCapacity | Long | 4.0.0 | |
createDate | Timestamp | The time when the gateway was added. | 4.0.0 |
lastOpDate | Timestamp | The time when the gateway was last modified. | 4.0.0 |
SDK Sample
Java
SDK
AddBareMetal2GatewayAction action = new AddBareMetal2GatewayAction();
action.username = "userName";
action.password = "password";
action.sshPort = 22.0;
action.name = "gateway";
action.managementIp = "127.0.0.1";
action.clusterUuid = "5b08798053343ec686244dc3a36bbccf";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddBareMetal2GatewayAction.Result res = action.call();
Python
SDK
AddBareMetal2GatewayAction action = AddBareMetal2GatewayAction()
action.username = "userName"
action.password = "password"
action.sshPort = 22.0
action.name = "gateway"
action.managementIp = "127.0.0.1"
action.clusterUuid = "5b08798053343ec686244dc3a36bbccf"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddBareMetal2GatewayAction.Result res = action.call()