Creates a desired state configuration.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
oos:CreateStateConfiguration |
create |
*StateConfiguration
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
No |
The region ID. |
cn-hangzhou |
| Description |
string |
No |
The description of the desired state configuration. |
collect inventory data |
| TemplateName |
string |
Yes |
The template name. The name can contain letters, digits, hyphens (-), and underscores (_), and can be up to 200 characters in length. |
ACS-ECS-InventoryDataCollection |
| TemplateVersion |
string |
No |
The version number. If you do not specify this parameter, the latest version is used by default. |
v1 |
| Parameters |
string |
No |
The parameters. |
{ "policy": { "ACS:Application": { "Collection": "Enabled" }, "ACS:Network": { "Collection": "Enabled" } } } |
| ConfigureMode |
string |
No |
The configuration mode. Valid values:
|
ApplyOnce |
| ScheduleType |
string |
Yes |
The schedule type. Valid values: rate. |
rate |
| ScheduleExpression |
string |
Yes |
The schedule expression. The scheduling interval must be at least 30 minutes. |
1 hour |
| Targets |
string |
Yes |
The target resources. |
{ "ResourceType": "ALIYUN::ECS::Instance", "Filters": [ { "Type": "All", "RegionId": "cn-hangzhou", "Parameters": { "RegionId": "cn-hangzhou", "Status": "Running" } } ] } |
| ClientToken |
string |
No |
The idempotence token. |
DASKJJLKADS-AHKLJHJSAKL-AJK |
| Tags |
object |
No |
The tags. |
{"Key": "oos", "Value": "inventory"} |
| ResourceGroupId |
string |
No |
The resource group ID. |
rg-acfmxsn4m4****** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
1306108F-610C-40FD-AAD5-DA13E8B00BE9 |
| StateConfiguration |
object |
The desired state configuration. |
|
| CreateTime |
string |
The time when the configuration was created. The time is in ISO 8601 format and in UTC. |
2021-03-22T03:13:32Z |
| Targets |
string |
The target resources. |
{ "ResourceType": "ALIYUN::ECS::Instance", "Filters": [ { "Type": "All", "RegionId": "cn-hangzhou", "Parameters": { "RegionId": "cn-hangzhou", "Status": "Running" } } ] } |
| Tags |
object |
The tags. |
{"Key": "oos", "Value": "inventory"} |
| StateConfigurationId |
string |
The configuration ID that is generated upon creation. |
sc-a538febe18fabcdef |
| ScheduleExpression |
string |
The schedule expression. |
1 hour |
| TemplateName |
string |
The template name. |
ACS-ECS-InventoryDataCollection |
| TemplateVersion |
string |
The template version. |
v1 |
| ConfigureMode |
string |
The configuration mode. |
ApplyAndAutoCorrect |
| ScheduleType |
string |
The schedule type. |
rate |
| Parameters |
object |
The parameters. |
{"policy": {"ACS:Network": {"Collection": "Enabled"}, "ACS:Application": {"Collection": "Enabled"}}} |
| Description |
string |
The description. |
collect inventory data |
| ResourceGroupId |
string |
The resource group ID. |
rg-acfmxsn4m4****** |
| TemplateId |
string |
The template ID. |
t-1234asadf |
Examples
Success response
JSON format
{
"RequestId": "1306108F-610C-40FD-AAD5-DA13E8B00BE9",
"StateConfiguration": {
"CreateTime": "2021-03-22T03:13:32Z",
"Targets": "{ \"ResourceType\": \"ALIYUN::ECS::Instance\", \"Filters\": [ { \"Type\": \"All\", \"RegionId\": \"cn-hangzhou\", \"Parameters\": { \"RegionId\": \"cn-hangzhou\", \"Status\": \"Running\" } } ] }",
"Tags": {
"Key": "oos",
"Value": "inventory"
},
"StateConfigurationId": "sc-a538febe18fabcdef",
"ScheduleExpression": "1 hour",
"TemplateName": "ACS-ECS-InventoryDataCollection",
"TemplateVersion": "v1",
"ConfigureMode": "ApplyAndAutoCorrect",
"ScheduleType": "rate",
"Parameters": {
"policy": {
"ACS:Network": {
"Collection": "Enabled"
},
"ACS:Application": {
"Collection": "Enabled"
}
}
},
"Description": "collect inventory data",
"ResourceGroupId": "rg-acfmxsn4m4******",
"TemplateId": "t-1234asadf"
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.