:original_name: UpdateWorkspace.html
.. _UpdateWorkspace:
Modifying a Workspace
=====================
Function
--------
This API is used to modify a workspace.
URI
---
PUT /v1/{project_id}/workspaces/{workspace_id}
.. table:: **Table 1** Path parameters
+--------------+-----------+--------+--------------------------------------------------------------------------------------------------------------------+
| Parameter | Mandatory | Type | Description |
+==============+===========+========+====================================================================================================================+
| project_id | Yes | String | Project ID. For details about how to obtain the project ID, see :ref:`Obtaining a Project ID `. |
+--------------+-----------+--------+--------------------------------------------------------------------------------------------------------------------+
| workspace_id | Yes | String | Workspace ID. |
+--------------+-----------+--------+--------------------------------------------------------------------------------------------------------------------+
Request Parameters
------------------
.. table:: **Table 2** Request body parameters
+-----------------+-----------------+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Parameter | Mandatory | Type | Description |
+=================+=================+==================================================================+==========================================================================================================================================================================================================================================================================================================================+
| name | No | String | Workspace name, encoded using UTF-8. |
| | | | |
| | | | Enter 4 to 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. In addition, **default** is the name of the default workspace reserved by the system. You are not allowed to change the name of an existing workspace to **default**. The name of the default workspace cannot be changed. |
+-----------------+-----------------+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| description | No | String | Workspace description. By default, this parameter is left blank. Enter 0 to 256 characters. |
+-----------------+-----------------+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| auth_type | No | String | Authorization type. Options: |
| | | | |
| | | | - **PUBLIC**: public access of tenants (default value) |
| | | | |
| | | | - **PRIVATE**: accessible only to the creator and primary account |
| | | | |
| | | | - **INTERNAL**: accessible to the creator, primary account, and specified IAM users. This parameter must be used together with **grants**. |
+-----------------+-----------------+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| grants | No | Array of :ref:`grants ` objects | List of authorized users, which is left blank by default. This parameter must be used together with **auth_type** and takes effect only when **auth_type** is set to **INTERNAL**. |
+-----------------+-----------------+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. _updateworkspace__request_grants:
.. table:: **Table 3** grants
+-----------+-----------+--------+---------------------------------------------------------------------------------------------------------------------------+
| Parameter | Mandatory | Type | Description |
+===========+===========+========+===========================================================================================================================+
| user_id | No | String | User ID. Either this parameter or **user_name** must be set. If both of them are set, **user_id** is used preferentially. |
+-----------+-----------+--------+---------------------------------------------------------------------------------------------------------------------------+
| user_name | No | String | IAM username. Either this parameter or **user_id** must be set. |
+-----------+-----------+--------+---------------------------------------------------------------------------------------------------------------------------+
Response Parameters
-------------------
**Status code: 200**
.. table:: **Table 4** Response body parameters
+--------------+--------+-----------------------------------------------------------------------------------------------------------------------------+
| Parameter | Type | Description |
+==============+========+=============================================================================================================================+
| workspace_id | String | Workspace ID, which is a 32-bit UUID generated by the system without hyphens (-). The ID of the default workspace is **0**. |
+--------------+--------+-----------------------------------------------------------------------------------------------------------------------------+
Example Requests
----------------
Modifying a Workspace
.. code-block:: text
PUT https://{endpoint}/v1/{project_id}/workspaces/{workspace_id}
{
"name" : "my_workspace",
"description" : "It is my workspace",
"auth_type" : "INTERNAL",
"grants" : [ {
"user_name" : "my_iam_user"
} ]
}
Example Responses
-----------------
**Status code: 200**
OK
.. code-block::
{
"workspace_id" : "***05d1a553b4e188ea878e7dcb85***"
}
Status Codes
------------
=========== ===================
Status Code Description
=========== ===================
200 OK
400 BadRequest
403 Forbidden
500 InternalServerError
=========== ===================
Error Codes
-----------
See :ref:`Error Codes `.