SetServiceTypeOnHostNetworkInterface
API Request
URLs
POST zstack/v1/hosts/nics/service-typesHeaders
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": {
"interfaceUuids": [
"2894f52c7d84366c85dd115b3bc193ca"
]
},
"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 b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"interfaceUuids":["2894f52c7d84366c85dd115b3bc193ca"]}}' \
http://localhost:8080/zstack/v1/hosts/nics/service-typesRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| interfaceUuids | List | body (contained in the params structure) | The physical NIC port UUID list. | 4.7.11 | |
| vlanIds | List | body (contained in the params structure) | Optional. The VLAN interface ID list. | 4.7.11 | |
| serviceTypes | List | body (contained in the params structure) | Optional. The network type. |
|
4.7.11 |
| systemTags | List | body | Optional. The system tags. | 4.7.11 | |
| userTags | List | body | Optional. The user tags. | 4.7.11 |
API Response
Sample
Response
{
"inventory": [
{
"id": 0,
"interfaceUuid": "8534263f624a3962b7603c99a3e44eb2",
"vlanId": 10,
"serviceType": "BackupNetwork"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.7.11 | |
| inventory | List | See inventory. | 4.7.11 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 4.7.11 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| interfaceUuid | String | The physical NIC port UUID. | 4.7.11 |
| vlanId | Integer | The VLAN interface id. | 4.7.11 |
| createDate | Timestamp | The creation date. | 4.7.11 |
| lastOpDate | Timestamp | The last operation date. | 4.7.11 |
| serviceType | HostNetworkInterfaceServiceType | See serviceType. | 4.7.11 |
#serviceType
| Name | Type | Description | Starting Version |
|---|---|---|---|
| ManagementNetwork | HostNetworkInterfaceServiceType | The management network. | 4.7.11 |
| TenantNetwork | HostNetworkInterfaceServiceType | The business network. | 4.7.11 |
| StorageNetwork | HostNetworkInterfaceServiceType | The storage network. | 4.7.11 |
| BackupNetwork | HostNetworkInterfaceServiceType | The backup network. | 4.7.11 |
| MigrationNetwork | HostNetworkInterfaceServiceType | The migration network. | 4.7.11 |
#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.7.11 |
| description | String | The brief description of the error. | 4.7.11 |
| details | String | The details about the error. | 4.7.11 |
| elaboration | String | The reserved field. Default value: null. | 4.7.11 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 4.7.11 |
| 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.7.11 |
SDK Sample
Java
SDK
SetServiceTypeOnHostNetworkInterfaceAction action = new SetServiceTypeOnHostNetworkInterfaceAction();
action.interfaceUuids = asList("2894f52c7d84366c85dd115b3bc193ca");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetServiceTypeOnHostNetworkInterfaceAction.Result res = action.call();Python
SDK
SetServiceTypeOnHostNetworkInterfaceAction action = SetServiceTypeOnHostNetworkInterfaceAction()
action.interfaceUuids = [2894f52c7d84366c85dd115b3bc193ca]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SetServiceTypeOnHostNetworkInterfaceAction.Result res = action.call()