forked from docs/modelarts
![otcbot[bot]](/assets/img/avatar_default.png)
Changes to ma_api from doc-exports#1 This is an automatically created Pull Request for changes to ma_api in opentelekomcloud-docs/doc-exports#1. Please do not edit it manually, since update to the original PR will overwrite local changes. Original patch file, as well as complete rst archive, can be found in the artifacts of the opentelekomcloud-docs/doc-exports#1 Reviewed-by: Vineet Pruthi <None>
26 KiB
26 KiB
- original_name
CreateWorkspace.html
Creating a Workspace
Function
This API is used to create a workspace. The name of the created workspace cannot be default, which is the name of the default workspace reserved by the system.
URI
POST /v1/{project_id}/workspaces
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID. For details about how to obtain the project ID, see Obtaining a Project ID <modelarts_03_0147> . |
Request Parameters
Parameter | Mandatory | Type | Description |
---|---|---|---|
name | Yes | 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 create a workspace named default. |
description | No | String | Workspace description. By default, this parameter is left blank. Enter 0 to 256 characters. |
enterprise_project_id | No | String | Enterprise project ID. The method of obtaining an enterprise project ID is the same as that of obtaining a project ID. Default: 0 |
auth_type | No | String | Authorization type. Options:
|
grants | No | Array of grants <createworkspace__request_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. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
user_id | No | String | User ID. For details about how to obtain a user ID, see Obtaining a User ID <modelarts_03_0006> . 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
Parameter | Type | Description |
---|---|---|
id | String | Workspace ID, which is a 32-bit UUID generated by the system without hyphens (-). The ID of the default workspace is 0. |
name | String | Workspace name |
description | String | Workspace description. Enter 0 to 256 characters. |
owner | String | Creator name. Enter 0 to 64 characters. |
create_time | Number | Time when a workspace was created, in UTC format |
update_time | Number | Last modification time, in UTC format |
auth_type | String | Authorization type. Options:
|
enterprise_project_id | String | Enterprise project ID |
enterprise_project_name | String | Name of an enterprise project |
status | String | Workspace status. Options:
|
status_info | String | Status description. By default, this parameter is left blank. This parameter is used to show detailed information about a status. If a deletion failed, you can use this parameter to obtain the failure cause. |
grants | Array of grants <createworkspace__response_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. |
Parameter | Type | Description |
---|---|---|
user_id | 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 | String | IAM username. Either this parameter or user_id must be set. |
Example Requests
Creating a Workspace
POST https://{endpoint}/v1/{project_id}/workspaces
{
"name" : "test-workspace",
"description" : "It is a test project",
"enterprise_project_id" : "***b0091-887f-4839-9929-cbc884f1e***",
"auth_type" : "internal",
"grants" : [ {
"user_name" : "test"
} ]
}
Example Responses
Status code: 200
OK
{
"id" : "**d05d1a553b4e188ea878e7dcb85e**",
"name" : "test-workspace",
"description" : "It is a test project'",
"owner" : "testUser",
"create_time" : 1470000020000,
"update_time" : 1470000030000,
"enterprise_project_id" : "***b0091-887f-4839-9929-cbc884f1e***",
"enterprise_project_name" : "test-eps",
"auth_type" : "public",
"status" : "NORMAL",
"status_info" : ""
}
Status Codes
Status Code | Description |
---|---|
200 | OK |
400 | BadRequest |
403 | Forbidden |
500 | InternalServerError |
Error Codes
See Error Codes <modelarts_03_0095>
.