Help Center/ ServiceStage/ API Reference/ Application Management V3 APIs/ Environment/ Enabling an Environment Resource Based on the Environment ID
Updated on 2024-12-16 GMT+08:00

Enabling an Environment Resource Based on the Environment ID

Function

This API is used to enable an environment resource based on the environment ID.

URI

POST /v3/{project_id}/cas/environments/{environment_id}/iac-resources/provision

Table 1 Path parameters

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

Table 2 Request header parameters

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.

Response

Table 3 Response parameters

Parameter

Type

Description

status

String

Status of an environment resource.

  • CREATION_IN_PROGRESS: The environment resource is being created.
  • CREATION_FAILED: The environment resource fails to be created.
  • CREATION_COMPLETE: The environment resource is created.
  • UPDATE_IN_PROGRESS: The environment resource is being updated.
  • UPDATE_FAILED: The environment resource fails to be updated.
  • UPDATE_COMPLETE: The environment resource is updated.
  • DELETION_IN_PROGRESS: The environment resource is being deleted.
  • DELETION_FAILED: The environment resource fails to be deleted.
  • DELETION_COMPLETE: The environment resource is deleted.

status_message

String

Displayed message.

When status is CREATION_FAILED, an error message is displayed for troubleshooting.

create_time

Integer

Creation time.

execution_plan_item

Array of objects

List of execution plan items. See Table 4.

Table 4 ExecutionPlanItem

Parameter

Type

Description

resource_type

String

Resource type.

resource_name

String

Resource name. The default value is the logical name of a resource.

index

String

Resource index.

action

String

Resource change type.

action_reason

String

Reason for triggering the change.

mode

String

Resource mode.

  • DATA: Query the attributes and information of existing resources during template parsing.
  • RESOURCE: Infrastructure component abstraction defined by services and managed by templates. There can be physical or logical resources.

drifted

Boolean

Whether the resource change is caused by deviation.

  • true: Yes.
  • false: No.

imported

Boolean

Whether the resource change is imported.

  • true: Yes.
  • false: No.

resource_id

String

Physical ID of a resource.

attributes

Array of objects

Changed attributes of execution plan items. If no attribute is changed, the list is empty. See Table 5.

Table 5 ExecutionPlanDiffAttribute

Parameter

Type

Description

name

String

Name of the to-be-modified parameter of the current resource.

previous_value

String

Original value of the to-be-modified parameter of the current resource.

target_value

String

Target value of the to-be-modified parameter of the current resource.

Example Request

None

Example Response

{
    "status": "CREATION_COMPLETE",
    "status_message": null,
    "execution_plan_items": [
	{
            "resource_type": "hcs_vpc_subnet",
	    "resource_name": "subnet",
	    "action": "ADD",
	    "attributes": [
		{
		    "name": "cidr",
		    "target_value": "172.16.0.0/16"
		}
	     ],
	     "mode": "RESOURCE",
	 }
     ]
}

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.