Creating an Environment
Function
Environment is a collection of infrastructures, covering computing, storage, and networks, used for application deployment and running. ServiceStage enables you to add multiple Elastic Load Balance (ELB), Relational Database Service (RDS), and Distributed Cache Service (DCS) instances to Cloud Container Engine (CCE) clusters in the same Virtual Private Cloud (VPC) to set up an environment, such as the development environment, test environment, production-like environment, and production environment. Networks in an environment can communicate with each other. You can manage resources and deploy services by environment, simplifying infrastructure O&M.
This API is used to create an environment.
URI
POST /v2/{project_id}/cas/environments
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| project_id | String | Yes | Tenant's project ID. |
Request Parameters
Request parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| name | String | Yes | Environment name. |
| alias | String | No | Environment alias. |
| description | String | No | Environment description. |
| enterprise_project_id | String | No | Enterprise project ID. |
| charge_mode | String | No | Billing mode. Value: provided, on_demanded, and monthly. Default: provided, indicating that provided resources are used and no fees are charged. |
| vpc_id | String | Yes | VPC ID. |
| base_resources | Array of objects | Yes | Basic resources. See Table 3. |
| optional_resources | Array of objects | No | Optional resources. See Table 3. |
Response Parameters
Response parameters
| Parameter | Type | Description |
|---|---|---|
| id | String | Environment ID. |
| name | String | Environment name. |
| alias | String | Environment alias. |
| description | String | Environment description. |
| project_id | String | Project ID. |
| enterprise_project_id | String | Enterprise project ID. |
| charge_mode | String | Billing mode. |
| vpc_id | String | VPC ID. |
| base_resources | Array of objects | Basic resources. See Table 5. |
| optional_resources | Array of objects | Optional resources. See Table 5. |
| creator | String | Creator. |
| create_time | Integer | Creation time. |
| update_time | Integer | Update time. |
Example
Example request
{
"name": "dev-env",
"description": "develop environment",
"enterprise_project_id": "0",
"charge_mode": "provided",
"vpc_id": "b9b8f9ad-1a2e-403d-83f1-cb71a3c06df8",
"base_resources": [
{
"id": "b6862a62-d916-11e9-bdf1-0255ac101fd9",
"type": "cce"
}
],
"optional_resources": [
{
"id": "default",
"type": "cse"
}
]
} Example response
{
"id": "ea011e01-2eb5-453f-87bf-874e4a855abe",
"name": " environment_name",
"alias": null,
"description": "develop environment",
"project_id": "bf8523d898b64e4eb956e3be3555ca16",
"enterprise_project_id": "0",
"charge_mode": "provided",
"vpc_id": "b9b8f9ad-1a2e-403d-83f1-cb71a3c06df8",
"base_resources": [
{
"id": "b6862a62-d916-11e9-bdf1-0255ac101fd9",
"type": "cce"
}
],
"optional_resources": [
{
"id": "default",
"type": "cse"
}
],
"creator": "string",
"create_time": 1578984198394,
"update_time": 1578984198394
} Status Code
| HTTP Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Bad Request |
| 404 | Not Found |
| 500 | Internal Server Error |
Error code must be in the format of SVCSTG.00100.[Error_ID]. Example: SVCSTG.00100400. See Error Codes of Application Management APIs.
Last Article: Environments
Next Article: Obtaining All Environments
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.