Updated on 2026-07-24 GMT+08:00

Creating an Upgrade Policy

Function

Creates an upgrade policy and associates it with an application object.

  • The policy name must be unique in the current project.

  • After the policy is created, it is used for upgrade matching by priority by default.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    workspace:upgradeStrategy:create

    Write

    -

    -

    -

    -

URI

POST /v2/{project_id}/upgrade-strategy

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

strategy_type

Yes

Integer

Policy type. The value can be 0 (server) or 1 (client).

strategy_name

Yes

String

Policy name.

is_force_upgrade

Yes

Integer

Whether to forcibly upgrade the version. The value can be 0 (no) or 1 (yes).

min_version

Yes

String

Upgrade is required if the version is earlier than this version.

target_version

Yes

String

Target version.

strategy_desc

No

String

Policy description.

strategy_priority

No

Integer

Priority. A smaller value indicates a higher priority.

status

No

Integer

Status. The value can be 0 (disabled) or 1 (enabled).

apply_objects

No

Array of ApplyObjectInfo objects

Application object list.

Table 3 ApplyObjectInfo

Parameter

Mandatory

Type

Description

object_type

No

String

Application object type. The value can be DESKTOP (single desktop), ALL_DESKTOPS (all desktops), DESKTOP_POOL (desktop pool), DESKTOP_TAG (desktop tag), ALL_USERS (all users), USER (single user), and USER_GROUP (user group).

object_id

No

String

Object ID. This value can be null when object_type is set to ALL_DESKTOPS or ALL_USERS.

Response Parameters

Status code: 200

ok

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Service error code.

error_msg

String

Service error message.

Status code: 500

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Service error code.

error_msg

String

Service error message.

Example Requests

{
  "strategy_type" : 1,
  "strategy_name" : "name",
  "is_force_upgrade" : 0,
  "min_version" : "23.0.0",
  "target_version" : "26.6.0",
  "strategy_desc" : "test",
  "strategy_priority" : 1,
  "status" : 1,
  "apply_objects" : [ {
    "object_type" : "DESKTOP",
    "object_id" : "desktop-001"
  } ]
}

Example Responses

None

Status Codes

Status Code

Description

200

ok

400

Invalid request parameter.

500

Internal server error.

Error Codes

See Error Codes.