All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::OOS::StateConfiguration

Last Updated:Mar 20, 2024

ALIYUN::OOS::StateConfiguration is used to create a desired-state configuration.

Syntax

{
  "Type": "ALIYUN::OOS::StateConfiguration",
  "Properties": {
    "ConfigureMode": String,
    "ScheduleExpression": String,
    "ScheduleType": String,
    "Description": String,
    "Parameters": String,
    "ResourceGroupId": String,
    "TemplateName": String,
    "TemplateVersion": String,
    "Targets": String,
    "Tags": Map
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

ConfigureMode

String

No

Yes

The configuration mode.

Valid values:

  • ApplyOnce: applies the configuration only once. The configuration is applied after the original configuration is updated.

  • ApplyAndMonitor: applies the configuration only once. After the configuration is applied, the system checks only whether the configuration drifts.

  • ApplyAndAutoCorrect: applies the configuration all the time.

ScheduleExpression

String

Yes

Yes

The schedule expression.

The interval between two schedules must be at least 30 minutes.

ScheduleType

String

Yes

Yes

The schedule type.

Set the value to rate.

Description

String

No

Yes

The description of the desired-state configuration.

None.

Parameters

String

No

Yes

The parameters.

Example:

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

ResourceGroupId

String

No

Yes

The ID of the resource group.

None.

TemplateName

String

Yes

No

The template name.

The name can be up to 200 characters in length, and can contain letters, digits, hyphens (-), and underscores (_).

TemplateVersion

String

No

No

The version number.

If you do not specify this property, the latest version is used by default.

Targets

String

Yes

Yes

The resources to be queried.

None.

Tags

Map

No

Yes

The tags.

A tag can have up to 20 keys. Sample tag:

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

Return values

Fn::GetAtt

StateConfigurationId: the ID of the created desired-state configuration.

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      ConfigureMode:
        Description:
          en: '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.'
        Required: false
        Type: String
      Description:
        AssociationProperty: TextArea
        Description:
          en: The description of the desired-state configuration.
        Required: false
        Type: String
      Parameters:
        Description:
          en: The parameters.
        Required: false
        Type: String
      ResourceGroupId:
        AssociationProperty: ALIYUN::ECS::ResourceGroup::ResourceGroupId
        Description:
          en: The resource group ID.
        Required: false
        Type: String
      ScheduleExpression:
        Description:
          en: The schedule expression. The interval between two schedules must be a minimum
            of 30 minutes.
        Required: true
        Type: String
      ScheduleType:
        Description:
          en: The schedule type. Set the value to rate.
        Required: true
        Type: String
      Tags:
        Description:
          en: Tag value and the key mapping, the label of the key number can be up to
            20.
        Required: false
        Type: Json
      Targets:
        Description:
          en: The resources to be queried.
        Required: true
        Type: String
      TemplateName:
        Description:
          en: The name of the template. The name must be 1 to 200 characters in length
            and can contain letters, digits, hyphens (-), and underscores (_).
        Required: true
        Type: String
      TemplateVersion:
        Description:
          en: The version number of the template. If you do not specify this parameter,
            the latest version of the template is used.
        Required: false
        Type: String
    Resources:
      StateConfiguration:
        Properties:
          ConfigureMode:
            Ref: ConfigureMode
          Description:
            Ref: Description
          Parameters:
            Ref: Parameters
          ResourceGroupId:
            Ref: ResourceGroupId
          ScheduleExpression:
            Ref: ScheduleExpression
          ScheduleType:
            Ref: ScheduleType
          Tags:
            Ref: Tags
          Targets:
            Ref: Targets
          TemplateName:
            Ref: TemplateName
          TemplateVersion:
            Ref: TemplateVersion
        Type: ALIYUN::OOS::StateConfiguration
    Outputs:
      StateConfigurationId:
        Description: The ID of the desired-state configuration.
        Value:
          Fn::GetAtt:
          - StateConfiguration
          - StateConfigurationId
                            
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "ConfigureMode": {
          "Type": "String",
          "Description": {
            "en": "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."
          },
          "Required": false
        },
        "ScheduleExpression": {
          "Type": "String",
          "Description": {
            "en": "The schedule expression. The interval between two schedules must be a minimum of 30 minutes."
          },
          "Required": true
        },
        "ScheduleType": {
          "Type": "String",
          "Description": {
            "en": "The schedule type. Set the value to rate."
          },
          "Required": true
        },
        "Description": {
          "AssociationProperty": "TextArea",
          "Type": "String",
          "Description": {
            "en": "The description of the desired-state configuration."
          },
          "Required": false
        },
        "Parameters": {
          "Type": "String",
          "Description": {
            "en": "The parameters."
          },
          "Required": false
        },
        "ResourceGroupId": {
          "AssociationProperty": "ALIYUN::ECS::ResourceGroup::ResourceGroupId",
          "Type": "String",
          "Description": {
            "en": "The resource group ID."
          },
          "Required": false
        },
        "TemplateName": {
          "Type": "String",
          "Description": {
            "en": "The name of the template. The name must be 1 to 200 characters in length and can contain letters, digits, hyphens (-), and underscores (_)."
          },
          "Required": true
        },
        "TemplateVersion": {
          "Type": "String",
          "Description": {
            "en": "The version number of the template. If you do not specify this parameter, the latest version of the template is used."
          },
          "Required": false
        },
        "Targets": {
          "Type": "String",
          "Description": {
            "en": "The resources to be queried."
          },
          "Required": true
        },
        "Tags": {
          "Type": "Json",
          "Description": {
            "en": "Tag value and the key mapping, the label of the key number can be up to 20."
          },
          "Required": false
        }
      },
      "Resources": {
        "StateConfiguration": {
          "Type": "ALIYUN::OOS::StateConfiguration",
          "Properties": {
            "ConfigureMode": {
              "Ref": "ConfigureMode"
            },
            "ScheduleExpression": {
              "Ref": "ScheduleExpression"
            },
            "ScheduleType": {
              "Ref": "ScheduleType"
            },
            "Description": {
              "Ref": "Description"
            },
            "Parameters": {
              "Ref": "Parameters"
            },
            "ResourceGroupId": {
              "Ref": "ResourceGroupId"
            },
            "TemplateName": {
              "Ref": "TemplateName"
            },
            "TemplateVersion": {
              "Ref": "TemplateVersion"
            },
            "Targets": {
              "Ref": "Targets"
            },
            "Tags": {
              "Ref": "Tags"
            }
          }
        }
      },
      "Outputs": {
        "StateConfigurationId": {
          "Description": "The ID of the desired-state configuration.",
          "Value": {
            "Fn::GetAtt": [
              "StateConfiguration",
              "StateConfigurationId"
            ]
          }
        }
      }
    }