Adding an Environment Resource Based on the Environment ID
Function
This API is used to add an environment resource based on the environment ID.
URI
POST /v3/{project_id}/cas/environments/{environment_id}/iac-resources
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Tenant's project ID. See Obtaining a Project ID. |
environment_id |
Yes |
String |
Environment ID. See Obtaining All Environments. |
Request
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
Yes |
String |
Message body type (format). Default value: application/json;charset=utf8. |
X-Auth-Token |
Yes |
String |
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. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
iac_resources |
Yes |
Array of objects |
IAC resource template. See Table 4. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
id |
Yes |
String |
Resource ID. |
name |
Yes |
String |
Resource name. |
type |
Yes |
String |
Resource type.
|
resource_id |
No |
String |
Resource instance ID. |
status |
No |
String |
Resource status. |
custom_tf |
No |
String |
Terraform template. |
vars_structure |
No |
Array of objects |
Variable structure. See Table 5. |
vars_body |
No |
Map<String, Object> |
Variable request body. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
var_key |
No |
String |
Variable name. |
var_value |
No |
String |
Variable value. |
Response
Parameter |
Type |
Description |
---|---|---|
id |
String |
Environment ID. |
name |
String |
Environment name. |
description |
String |
Environment description. |
project_id |
String |
Project ID. |
enterprise_project_id |
String |
Enterprise project ID. |
deploy_mode |
String |
Environment type.
|
vpc_id |
String |
VPC ID. |
creator |
String |
Creator. |
create_time |
Integer |
Creation time. |
update_time |
Integer |
Update time. |
labels |
Array of objects |
Label. You can use TMS to query resources by labels. See Table 8. |
type |
String |
Whether the Kubernetes environment is of the HA type.
|
resource_create_mode |
String |
Resource configuration mode.
|
iac_resources |
Array of objects |
Resource template. See Table 7. |
iac_task_status |
String |
Task status.
|
availability_zone |
Array of String |
List of AZs. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Resource ID. |
name |
String |
Resource name. |
type |
String |
Resource type.
|
status |
String |
Status of an environment resource.
|
resource_id |
String |
Resource instance ID. |
custom_tf |
String |
Terraform template. |
vars_body |
Map<String, Object> |
Resource variable. |
vars_structure |
Array of objects |
Variable structure. See Table 9. |
Example Request
Add an RDS instance named iac_resources_test to the current environment.
{ "iac_resources": [ { "id": "iac_resources_test", "name": "rdfqw2we232", "type": "rds", "custom_tf": "string", "vars_structure": [ { "var_key": "", "var_value": "" } ], "vars_body": { "var_key": "123" } } ] }
Example Response
{ "id" : "17a5baa0-8352-4fa9-94e7-fad2569a20a2", "name" : "hldtest1", "alias" : null, "description" : "", "project_id" : "0ada17d53d00d5cc2f8ac00ca4b5b119", "enterprise_project_id" : "0", "charge_mode" : "provided", "vpc_id" : "0000653d-e8b9-47ce-91d2-2c728f3338a4", "base_resources" : [], "optional_resources" : null, "creator" : "paas_roma_c00283024", "create_time" : 1708915381226, "update_time" : 1709103342541, "deploy_mode" : "virtualmachine", "vm_cluster_size" : 50, "status" : null, "broker_id" : null, "labels" : [], "offline_hosts" : null, "alert_status" : null, "resource_create_mode" : "iac", "iac_resources" : [{ "id" : "a12345", "name" : "cce12323qq", "type" : "rds", "status" : "INIT", "vars_structure" : [{ "var_key" : "www", "var_value" : "" } ], "vars_body" : { "var_key" : "11qwqqw" } } ], "iac_task_status" : null, "component_count" : 0 }
Status Code
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
404 |
Not Found |
500 |
Internal Server Error |
Error Code
The error code format is SVCSTG.00100.[Error_ID], for example, SVCSTG.00100400. For details, see ServiceStage Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank 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