CreateEip
API Request
URLs
POST zstack/v1/eipsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"name": "Test-EIP",
"vipUuid": "7fdf1752627948afb2418f93825c478b",
"vmNicUuid": "be5532b08b7a48949667b654468dc5a5"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth c0bd88f213cf42bc8b8fd42d1b269d50" \
-X POST -d '{"params":{"name":"Test-EIP","vipUuid":"f1b1901cefa939d7bf5775ec71735637","vmNicUuid":"bb64d3fc676b3b5cbdf0d768eb7d05a1"}}' \
http://localhost:8080/zstack/v1/eips
Request Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The EIP name. | 0.6 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the EIP. | 0.6 | |
| vipUuid | String | body (contained in the params structure) | The VIP UUID. | 0.6 | |
| vmNicUuid | String | body (contained in the params structure) | Optional. The VM NIC UUID. | 0.6 | |
| usedIpUuid | String | body (contained in the params structure) | Optional. The IP UUID. | 3.1.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. If specified, the VM instance will use the specified value as the UUID. | 0.6 | |
| systemTags | List | body | Optional. The EIP system tags. | 0.6 | |
| userTags | List | body | Optional. The EIP user tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"name": "Test-EIP",
"vmNicUuid": "07f9715b85da40d9bd17e5f4277304bd",
"vipUuid": "acc6dc9271f54e58ab94e4a1069bc7e5"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
| inventory | EipInventory | See inventory. | 0.6 |
#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. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| vmNicUuid | String | The VM NIC UUID. | 0.6 |
| vipUuid | String | The VIP UUID. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| state | String | 0.6 | |
| vipIp | String | 0.6 | |
| guestIp | String | 0.6 |
SDK Sample
Java
SDK
CreateEipAction action = new CreateEipAction();
action.name = "Test-EIP";
action.vipUuid = "a600144228904c709d9d36a7d8e7bc50";
action.vmNicUuid = "c6ef3b3fc5c54033ad07514e3ee71199";
action.sessionId = "284027438a4e46d4abb185a30eaac6ff";
CreateEipAction.Result res = action.call();Python
SDK
CreateEipAction action = CreateEipAction()
action.name = "Test-EIP"
action.vipUuid = "8e6507f39d6f40479f48a974a9d6afd2"
action.vmNicUuid = "91ad47c708e140fd83348182a3f098a6"
action.sessionId = "9bdd3970d72144c8899edb0158a4ed6d"
CreateEipAction.Result res = action.call()