Update USB Device

PUT/zstack/v1/usb-device/usb-devices/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateUsbDevice": {
    "name": "usb",
    "description": "this is a usb device",
    "state": "Enabled"
  },
  "systemTags": [],
  "userTags": []
}

The systemTags and userTags fields can be omitted in the above example. They are listed to indicate that the body can contain these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateUsbDevice":{"name":"usb","description":"this is a usb device","state":"Enabled"}}' \
http://localhost:8080/zstack/v1/usb-device/usb-devices/9d1ab4950ce933edabbaf8e73ca7e879/actions

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

uuid

String

url

UUID of the resource, uniquely identifies the resource

 

2.2

name (Optional)

String

body(contained in updateUsbDevice structure)

Resource name

 

2.2

description (Optional)

String

body(contained in updateUsbDevice structure)

Resource description

 

2.2

state (Optional)

String

body(contained in updateUsbDevice structure)

USB device state

  • Enabled
  • Disabled

2.2

systemTags (Optional)

List

body

System tags

 

2.2

userTags (Optional)

List

body

User tags

 

2.2

API Response

Response Example

{
  "inventory": {
    "uuid": "2695f7ce0bda4587bbabbbfaad080554",
    "description": "test usb",
    "hostUuid": "4261ceb358ce473fa62c137c1ba8d3ef",
    "vmInstanceUuid": "4c059c5e0a834d86984d3141d8ec42cb",
    "state": "Disabled",
    "idVendor": "10de",
    "idProduct": "0e0f",
    "iManufacturer": "SanDisk",
    "iProduct": "USB Storage",
    "iSerial": "000000000001",
    "usbVersion": "3.0",
    "attachType": "PassThrough"
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. See error2.2
inventoryUsbDeviceInventorySee inventory2.2

error

NameTypeDescriptionStarting Version
codeStringError code, a globally unique identifier of the error, e.g. SYS.1000, HOST.10012.2
descriptionStringBrief description of the error2.2
detailsStringDetailed error information2.2
elaborationStringReserved field, defaults to null2.2
opaqueLinkedHashMapReserved field, defaults to null2.2
causeErrorCodeRoot cause, the source error that caused the current error, null if no original error2.2

inventory

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifies the resource2.2
nameStringResource name2.2
descriptionStringResource description2.2
hostUuidStringHost UUID2.2
vmInstanceUuidStringVirtual Machine UUID2.2
busNumStringBus number2.2
devNumStringDevice number2.2
idVendorStringVendorID2.2
idProductStringProductID2.2
iManufacturerStringManufacturer2.2
iProductStringDevice type2.2
iSerialStringSerial number2.2
usbVersionStringUSB version2.2
attachTypeStringAttach method3.6.0
createDateTimestampCreate date2.2
lastOpDateTimestampLast update date2.2
stateUsbDeviceStateSee state2.2

state

NameTypeDescriptionStarting Version
nameStringResource name2.2
ordinalint 2.2

SDK Examples

Java SDK

UpdateUsbDeviceAction action = new UpdateUsbDeviceAction();
action.uuid = "86d05b807cfa47a7969745f0ffe8ee4b";
action.name = "usb";
action.description = "this is a usb device";
action.state = "Enabled";
action.sessionId = "86600ceaed5642ad810828129fe0e4a0";
UpdateUsbDeviceAction.Result res = action.call();

Python SDK

UpdateUsbDeviceAction action = UpdateUsbDeviceAction()
action.uuid = "f16940abc205404bb17b00367f5b6a8d"
action.name = "usb"
action.description = "this is a usb device"
action.state = "Enabled"
action.sessionId = "a65b10bd9a164d33a42d8bacfab5acd6"
UpdateUsbDeviceAction.Result res = action.call()