All Products
Search
Document Center

CloudOps Orchestration Service:CreateStateConfiguration

Last Updated:Mar 03, 2024

Creates 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.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
oos:CreateStateConfigurationWrite
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringNo

The region ID.

cn-hangzhou
DescriptionstringNo

The description of the desired-state configuration.

The region ID.
TemplateNamestringYes

The name of the template. The name must be 1 to 200 characters in length and can contain letters, digits, hyphens (-), and underscores (_).

ACS-ECS-InventoryDataCollection
TemplateVersionstringNo

The version number of the template. If you do not specify this parameter, the latest version of the template is used.

v1
ParametersstringNo

The parameters.

{ "policy": { "ACS:Application": { "Collection": "Enabled" }, "ACS:Network": { "Collection": "Enabled" } } }
ConfigureModestringNo

The configuration mode. Valid values: 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.

ApplyOnce
ScheduleTypestringYes

The schedule type. Set the value to rate.

rate
ScheduleExpressionstringYes

The schedule expression. The interval between two schedules must be a minimum of 30 minutes.

The ID of the resource group.
TargetsstringYes

The resources to be queried.

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

The client token that is used to ensure the idempotence of the request.

DASKJJLKADS-AHKLJHJSAKL-AJK
TagsobjectNo

The tags to be added to the configuration.

{"Key": "oos", "Value": "inventory"}
ResourceGroupIdstringNo

The resource group ID.

rg-acfmxsn4m4******

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

1306108F-610C-40FD-AAD5-DA13E8B00BE9
StateConfigurationobject

The information about the desired-state configuration.

CreateTimestring

The time when the desired-state configuration was created.

2021-03-22T03:13:32Z
Targetsstring

The queried resources.

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

The tags added to the configuration.

{"Key": "oos", "Value": "inventory"}
StateConfigurationIdstring

The ID of the desired-state configuration.

sc-a538febe18fabcdef
ScheduleExpressionstring

The schedule expression.

1 hour
TemplateNamestring

The name of the template.

ACS-ECS-InventoryDataCollection
TemplateVersionstring

The name of the template version.

v1
ConfigureModestring

The configuration mode. Valid values:

ApplyAndAutoCorrect
ScheduleTypestring

The schedule type.

rate
Parametersobject

The parameters.

{"policy": {"ACS:Network": {"Collection": "Enabled"}, "ACS:Application": {"Collection": "Enabled"}}}
Descriptionstring

The description.

collect inventory data
ResourceGroupIdstring

The resource group ID.

rg-acfmxsn4m4******
TemplateIdstring

The template ID.

t-1234asadf

Examples

Sample success responses

JSONformat

{
  "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\n",
    "ResourceGroupId": "rg-acfmxsn4m4******",
    "TemplateId": "t-1234asadf"
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history