Modifying an Environment Based on the Environment ID
Function
This API is used to modify an environment based on the environment ID.
Authorization Information
Each account has all of the permissions required to call all APIs, but IAM users must have the required permissions specifically assigned.
- If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
- If you are using identity policy-based authorization, the permission listed below is required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
servicestage:environment:modify
write
environment *
-
-
-
URI
PUT /v3/{project_id}/cas/environments/{environment_id}
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Tenant's project ID. See Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
| environment_id | Yes | String | Definition Environment ID. See Obtaining All Environments. Constraints N/A Range N/A Default Value N/A |
Request
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| Content-Type | Yes | String | Definition Message body type (or format). Constraints N/A Range application/json;charset=utf8 Default Value N/A |
| X-Auth-Token | Yes | String | Definition API calling can be authenticated using a token or AK/SK. If you use a token, this parameter is mandatory and must be set to the token. For details about how to obtain the token, see Authentication. Constraints N/A Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Definition Environment name. Range The value contains 2 to 64 characters consisting of letters, digits, hyphens (-), or underscores (_). It starts with a letter and ends with a letter or digit. Letters are case sensitive. Default Value N/A |
| description | No | String | Definition Environment description. Range The value can contain up to 128 characters. Default Value N/A |
| labels | No | Array of objects | Definition Label. You can use TMS to filter resources by labels. See Table 4. Constraints Each environment can have a maximum of 20 labels. Range N/A Default Value N/A |
| enterprise_project_id | No | String | Definition Enterprise project ID. Constraints An enterprise project can be configured only after the enterprise project function is enabled. Range N/A Default Value N/A |
| configuration | No | Object | Definition Environment variable of the environment. See Table 5. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| key | Yes | String | Definition Label name. Labels are used to identify cloud resources. When you have multiple cloud resources of the same type, you can use labels to classify them based on usage, owner, or environment. Range The value contains 1 to 36 characters, including digits, letters, underscores (_), or hyphens (-). Default Value N/A |
| value | Yes | String | Definition Label value. Range The value contains 1 to 43 characters, including digits, letters, underscores (_), periods (.), or hyphens (-). Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| resource_envs | No | Array of objects | Definition Resource variable bound to the environment. See Table 6. |
| envs | No | Array of objects | Definition Environment variable of the environment. See Table 7. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| resource_id | Yes | String | Definition ID of the resource associated with the resource variable bound to the environment. Range N/A Default Value N/A |
| resource_name | Yes | String | Definition Name of the resource associated with the resource variable bound to the environment. Range N/A Default Value N/A |
| resource_type | Yes | String | Definition Type of the resource associated with the resource variable bound to the environment. Range
Default Value N/A |
| envs | Yes | Array of objects | Definition Resource variable bound to the environment. See Table 7. |
Response
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Environment ID. Range N/A |
| name | String | Definition Environment name. Range N/A |
| description | String | Definition Environment description. Range N/A |
| project_id | String | Definition Project ID. Range N/A |
| enterprise_project_id | String | Definition Enterprise project ID. Range N/A |
| deploy_mode | String | Definition Environment type. Range N/A |
| vpc_id | String | Definition VPC ID. Range N/A |
| creator | String | Definition Environment creator. Range N/A |
| create_time | Integer | Definition Environment creation time. Range N/A |
| update_time | Integer | Definition Environment update time. Range N/A |
| labels | Array of objects | Definition Label. You can use TMS to filter resources by labels. See Table 9. |
| resources | Array of objects | Definition Resource. See Table 10. |
| resource_create_mode | String | Definition Resource configuration mode. Range
|
| config_mode | String | Definition Configuration mode. Range
|
| configuration | Object | Definition Environment variable of the environment. See Table 12. |
| Parameter | Type | Description |
|---|---|---|
| key | String | Definition Label name. Range N/A |
| value | String | Definition Label value. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Resource ID. Range N/A |
| name | String | Definition Resource name. Range N/A |
| type | String | Definition Resource type. Range
|
| ip | String | Definition IP address of the custom server when the resource type is set to customServer. Range N/A |
| parameters | Map<String, String> | Definition Resource parameters. See Table 11. |
| alias | String | Definition Resource alias. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| kube_config | String | Definition Kubernetes connection configuration file. This parameter is returned when the resource type is custom_k8s. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| resource_envs | Array of objects | Definition Resource variable bound to the environment. See Table 13. |
| envs | Array of objects | Definition Environment variable of the environment. See Table 14. |
| Parameter | Type | Description |
|---|---|---|
| resource_id | String | Definition ID of the resource associated with the resource variable bound to the environment. Range N/A |
| resource_name | String | Definition Name of the resource associated with the resource variable bound to the environment. Range N/A |
| resource_type | String | Definition Type of the resource associated with the resource variable bound to the environment. Range
|
| envs | Array of objects | Definition Resource variable bound to the environment. See Table 14. |
Example Request
Modify the environment name to development-env, leave the description blank, and add a label whose key-value pair is "test": "value" to the environment.
{
"name": "development-env",
"description": "",
"labels": [
{
"key": "test",
"value": "value"
}
]
} Example Response
{
"id": "00078e9d-a61c-476e-ac63-a10c9cb2638e",
"name": "development-env",
"description": "",
"project_id": "e7d2e9c589e5445e808a8ff0d1235aca",
"enterprise_project_id": "0",
"deploy_mode": "virtualmachine",
"vpc_id": "29d55020-ae0e-4a18-871c-93e6976ee7bd",
"creator": "ss-test",
"create_time": 1610418873730,
"update_time": 1610418873730,
"resources": [
{
"id": "329b135e-7b31-4ea6-afb9-b69017bd0a80",
"type": "ecs",
"name": "ecs-test"
}
],
"labels": [
{
"key": "test",
"value": "value"
}
]
} Status Code
| Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Bad Request |
| 404 | Not Found |
| 500 | Internal Server Error |
Error Code
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot