全部产品
Search
文档中心

资源编排:ALIYUN::OOS::StateConfiguration

更新时间:Jan 31, 2024

ALIYUN::OOS::StateConfiguration类型用于创建终态配置。

语法

{
  "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
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

ConfigureMode

String

配置模式。

取值:

  • ApplyOnly:配置只应用一次(更新配置后重新应用)。

  • ApplyAndMonitor: 配置只应用一次,成功应用后,后续只检查配置是否漂移。

  • ApplyAndAutoCorrect:总是应用配置。

ScheduleExpression

String

调度表达式。

调度间隔不得小于30分钟。

ScheduleType

String

调度类型。

可选值:rate。

Description

String

终态配置的描述信息。

Parameters

String

参数。

示例值:

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

ResourceGroupId

String

资源组ID。

TemplateName

String

模板名称。

内容限制为字母、数字、中划线、下划线,长度200字符。

TemplateVersion

String

版本号。

如不填默认为最新的版本号。

Targets

String

目标资源。

Tags

Map

标签。

标签的键数最多可达20个。 示例值:

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

返回值

Fn::GetAtt

StateConfigurationId:创建生成的配置ID。

示例

  • YAML格式

    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格式

    {
      "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"
            ]
          }
        }
      }
    }