Modifying a Workspace

Function

This API is used to modify a workspace.

URI

PUT /v1/{project_id}/workspaces/{workspace_id}

Table 1 describes the required parameters.
Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

workspace_id

Yes

String

Workspace ID

Request Body

Table 2 describes the request parameters.
Table 2 Parameter description

Parameter

Mandatory

Type

Description

name

No

String

Workspace name, encoded using UTF-8.

The value is a string of 4 to 64 characters consisting of Chinese characters, uppercase and lowercase letters, digits, hyphens (-), and underscores (_). In addition, default is the default workspace name reserved by the system. You cannot create a workspace named default. The name of the default workspace cannot be modified.

description

No

String

Workspace description. By default, this parameter is left blank. The value is a string of 0 to 256 characters.

auth_type

No

String

Authorization type. Default value: PUBLIC

  • PUBLIC: public access of tenants
  • PRIVATE: accessible only to the creator and primary account
  • INTERNAL: accessible to the creator, main account, and specified IAM users. This parameter must be used together with grants.

grants

No

grant array

List of authorized users. By default, this parameter is left blank. This parameter must be used together with auth_type and takes effect only when auth_type is set to INTERNAL.

Table 3 grants parameters

Parameter

Mandatory

Type

Description

user_id

No

String

IAM user ID. Configure either this parameter or user_name. If both of them are available, user_id is preferred.

user_name

No

String

IAM username. Configure either this parameter or user_id.

Response Body

Table 4 describes the response parameters.

Table 4 Parameter description

Parameter

Type

Description

error_msg

String

Error message of a failed API call.

This parameter is not included when the API call succeeds.

error_code

String

Error code of a failed API call. For details, see Error Code.

This parameter is not included when the API call succeeds.

request_id

String

request_id information of a failed API call.

This parameter is not included when the API call succeeds.

workspace_id

String

Workspace ID

Samples

  • Sample request
    PUT  https://{endpoint}/v1/{project_id}/workspaces/ccd05d1a553b4e188ea878e7dcb85e47
    {
      "name": "new_name",
      "description": "update description",
      "auth_type":"INTERNAL",
      "grants": 
        [
          {"user_name" : "test-user1"}
        ]
    }
  • Successful sample response
    {
      "workspace_id": "ccd05d1a553b4e188ea878e7dcb85e47"
    }
  • Failed sample response
    {
      "error_msg": "Error message.",
      "error_code": "ModelArts.0104",
      "request_id": "32025f6d314647d1b4521810de139ada"
    }

Status Code

For details about the status code, see Table 1.