Skip to main content
Resource Center/Hardware/Host Operations/USB Pass-through Operations
POSTUSB Pass-through OperationsSince 2.2SynchronousAuth Required

AttachUsbDeviceToVm

AttachUsbDeviceToVm

Execution Availability

Try It Out

Submit a mock request using the current auth context and example-driven inputs.

Path Parameters

Request Inputs

Path Parameters

  • usbDeviceUuidStringRequired

    The USB device UUID.

Body Fields

  • paramsObjectRequired

    Request body parameter object.

    • vmInstanceUuidStringRequired

      The VM instance UUID.

    • attachTypeString

      Optional. The attach type.

  • systemTagsList

    Optional. The system tags.

  • userTagsList

    Optional. The user tags.

Responses

200 OK

On success, this API returns the following response structure.

  • errorErrorCodeRequired

    The error code. If not null, the operation fails, or vice versa. For more information, see error.

    • codeStringRequired

      The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001.

    • descriptionStringRequired

      The brief description of the error.

    • detailsStringRequired

      The details about the error.

    • elaborationStringRequired

      The reserved field. Default value: null.

    • opaqueLinkedHashMapRequired

      The reserved field. Default value: null.

    • causeErrorCodeRequired

      The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null.

  • inventoryUsbDeviceInventoryRequired

    See inventory.

    • uuidStringRequired

      The resource UUID.

    • nameStringRequired

      The resource name.

    • descriptionStringRequired

      The detailed description of the resource.

    • hostUuidStringRequired

      The host UUID.

    • vmInstanceUuidStringRequired

      The VM instance UUID.

    • busNumStringRequired

      The bus No.

    • devNumStringRequired

      The device No.

    • idVendorStringRequired

      The vendor ID.

    • idProductStringRequired

      The device ID.

    • iManufacturerStringRequired

      The manufacturer.

    • iProductStringRequired

      The device type.

    • iSerialStringRequired

      The serial No.

    • usbVersionStringRequired

      The USB version.

    • attachTypeStringRequired

      The attach type.

    • createDateTimestampRequired

      The creation date.

    • lastOpDateTimestampRequired

      The last operation date.

    • stateUsbDeviceStateRequired

      See state.

      • nameStringRequired

        The resource name.

      • ordinalintRequired

        No description provided.

Endpoint

POST/zstack/v1/usb-device/usb-devices/{usbDeviceUuid}/attach

/zstack/v1/usb-device/usb-devices/{usbDeviceUuid}/attach

Operation ID

AttachUsbDeviceToVm

Permalink

Request Example

curl -X POST 'http://{host}/zstack/v1/usb-device/usb-devices/{usbDeviceUuid}/attach' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"params":{"vmInstanceUuid":"<vmInstanceUuid>","attachType":"<attachType>"},"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'

Response Example

200
{ "inventory": { "uuid": "dc782167a4853525848fd04bf606d072", "name": "usb", "hostUuid": "dea6020aae7b3244be45eee6ae1d4d0f", "vmInstanceUuid": "33471e0ae8a33b3b8b0f295eff6e4db4", "state": "Enabled", "busNum": "001", "devNum": "001", "idVendor": "0781", "idProduct": "5591", "iManufacturer": "SanDisk", "iProduct": "Ultra USB 3.0", "iSerial": "000000000001", "usbVersion": "3.0", "attachType": "PassThrough" } }

Change History

This API has no change history records yet.

View all change history