Updates a desired-state configuration.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes UpdateStateConfiguration

The operation that you want to perform. Set the value to UpdateStateConfiguration.

StateConfigurationId String Yes sc-asfgdhj12345

The ID of the desired-state configuration.

RegionId String No cn-hangzhou

The ID of the region.

Description String No ACS-ECS-InventoryDataCollection

The description.

Parameters Json No { "policy": { "ACS:Application": { "Collection": "Enabled" }, "ACS:Network": { "Collection": "Enabled" } } }

The parameters.

ConfigureMode String No ApplyOnce

The configuration mode. ApplyOnce: The configuration is applied only once. After a configuration is updated, the new configuration is applied. ApplyAndMonitor: The configuration is applied only once. After the configuration is applied, the system only checks whether the configuration is migrated in the future. ApplyAndAutoCorrect: The configuration is always applied.

ScheduleType String No rate

The schedule type.

ScheduleExpression String No 1 hour

The schedule expression.

Targets String No { "ResourceType": "ALIYUN::ECS::Instance", "Filters": [ { "Type": "All", "RegionId": "cn-hangzhou", "Parameters": { "RegionId": "cn-hangzhou", "Status": "Running" } } ] }

The required resources.

ClientToken String No DASKJJLKADS-AHKLJHJSAKL-AJK

The idempotency token.

Tags Json No {"Key": "oos", "Value": "sc"}

The tag.

Response parameters

Parameter Type Example Description
RequestId String 1306108F-610C-40FD-AAD5-DA13E8B00BE9

The ID of the request.

StateConfiguration Array of StateConfiguration

The configuration list.

ConfigureMode String ApplyAndAutoCorrect

The configuration mode.

CreateTime String 2021-03-22T03:13:32Z

The creation time.

Description String Collect data that is specified in the configuration list.

The description of the desired-state configuration.

Parameters String {"policy": {"ACS:Network": {"Collection": "Enabled"}, "ACS:Application": {"Collection": "Enabled"}}}

The parameters.

ScheduleExpression String 1 hour

The schedule expression.

ScheduleType String rate

The schedule type.

StateConfigurationId String StateConfigurationId

The ID of the desired-state configuration.

Tags Map {"Key": "oos", "Value": "inventory"}

The tag.

Targets String { "ResourceType": "ALIYUN::ECS::Instance", "Filters": [ { "Type": "All", "RegionId": "cn-hangzhou", "Parameters": { "RegionId": "cn-hangzhou", "Status": "Running" } } ] }

The required resources.

TemplateId String t-1234asadf

The ID of the template.

TemplateName String ACS-ECS-InventoryDataCollection

The name of the template.

TemplateVersion String v1

The version of the template.

UpdateTime String 2021-03-22T03:13:32Z

The update time.

Examples

Sample requests

http(s)://[Endpoint]/?Action=UpdateStateConfiguration
&StateConfigurationId=sc-asfgdhj12345
&<Common request parameters>

Sample success responses

XML format

<RequestId>1306108F-610C-40FD-AAD5-DA13E8B00BE9</RequestId>
<StateConfiguration>
    <ConfigureMode>ApplyAndAutoCorrect</ConfigureMode>
    <ScheduleExpression>1 hour</ScheduleExpression>
    <ScheduleType>rate</ScheduleType>
    <Parameters>{"policy": {"ACS:Network": {"Collection": "Enabled"}, "ACS:Application": {"Collection": "Enabled"}}}</Parameters>
    <Description>test sc</Description>
    <StateConfigurationId>StateConfigurationId</StateConfigurationId>
    <CreateTime>2021-03-22T03:13:32Z</CreateTime>
    <UpdateTime>2021-03-22T03:13:32Z</UpdateTime>
    <TemplateVersion>v1</TemplateVersion>
    <TemplateName>ACS-ECS-InventoryDataCollection</TemplateName>
    <Targets>{ "ResourceType": "ALIYUN::ECS::Instance", "Filters": [ { "Type": "All", "RegionId": "cn-hangzhou", "Parameters": { "RegionId": "cn-hangzhou", "Status": "Running" } } ] }</Targets>
    <Tags>{"Key": "oos", "Value": "inventory"}</Tags>
    <TemplateId>t-1234asadf</TemplateId>
</StateConfiguration>

JSON format

{"RequestId":"1306108F-610C-40FD-AAD5-DA13E8B00BE9","StateConfiguration":[{"ConfigureMode":"ApplyAndAutoCorrect","ScheduleExpression":"1 hour","ScheduleType":"rate","Parameters":"{\"policy\": {\"ACS:Network\": {\"Collection\": \"Enabled\"}, \"ACS:Application\": {\"Collection\": \"Enabled\"}}}","Description":"test sc","StateConfigurationId":"StateConfigurationId","CreateTime":"2021-03-22T03:13:32Z","UpdateTime":"2021-03-22T03:13:32Z","TemplateVersion":"v1","TemplateName":"ACS-ECS-InventoryDataCollection","Targets":"{ \"ResourceType\": \"ALIYUN::ECS::Instance\", \"Filters\": [ { \"Type\": \"All\", \"RegionId\": \"cn-hangzhou\", \"Parameters\": { \"RegionId\": \"cn-hangzhou\", \"Status\": \"Running\" } } ] }","Tags":"{\"Key\": \"oos\", \"Value\": \"inventory\"}","TemplateId":"t-1234asadf"}]}

Error codes

For a list of error codes, visit the API Error Center.