全部产品
Search
文档中心

资源编排:ALIYUN::CMS::DynamicTagGroup

更新时间:Sep 18, 2024

ALIYUN::CMS::DynamicTagGroup类型用于云产品自动创建应用分组。

说明

目前只支持云服务器ECS(Elastic Compute Service)、阿里云关系型数据库RDS(Relational Database Service)、负载均衡SLB(Server Load Balancer)。

语法

{
  "Type": "ALIYUN::CMS::DynamicTagGroup",
  "Properties": {
    "ContactGroupList": List,
    "MatchExpressFilterRelation": String,
    "EnableSubscribeEvent": Boolean,
    "TemplateIdList": List,
    "TagKey": String,
    "EnableInstallAgent": Boolean,
    "MatchExpress": List
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

ContactGroupList

List

报警联系人。

TagKey

String

标签键。

EnableInstallAgent

Boolean

是否启用初始化安装监控插件。

取值:

  • true:启用。

  • false(默认值):不启用。

说明

如果生成应用分组的ECS实例没有安装监控插件则会尝试自动安装。

EnableSubscribeEvent

Boolean

是否启用事件订阅。

取值:

  • true:启用。

  • false:不启用。

MatchExpress

List

条件表达式。

最多支持配置三个条件表达式。

更多信息,请参见MatchExpress属性

MatchExpressFilterRelation

String

条件表达式之间的关系。

取值:

  • and:与的关系。

  • or:或的关系。

TemplateIdList

List

报警模板ID。

MatchExpress语法

"MatchExpress": [
  {
    "TagValue": String,
    "TagValueMatchFunction": String
  }
]

MatchExpress属性

属性名称

类型

必须

允许更新

描述

约束

TagValue

String

标签值。

TagValueMatchFunction

String

标签值的匹配方法。

取值:

  • contains:包含。

  • startWith:前缀。

  • endWith:后缀。

  • notContains:不包含。

  • equals:等于。

  • all:全部。

返回值

Fn::GetAtt

  • DynamicTagRuleId:智能标签规则ID。

  • TagKey:标签键。

示例

重要

下方代码存在脱敏内容,请替换为您实际的参数。

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  MatchExpressFilterRelation:
    Type: String
    Description: |-
      The relationship between the conditional expressions. Values are:
      and: the relationship between
      or: the relationship or the
      Description currently supports only one combination of conditions, the follow-up Ali cloud will support a variety of combinations of conditions.
    AllowedValues:
      - and
      - or
    Default: or
  EnableSubscribeEvent:
    Type: Boolean
    Description: |-
      Whether the event subscription is enabled. Values are
      :true: enable event subscription
      false: disable event subscription
    AllowedValues:
      - true
      - false
    Default: false
  ContactGroupList:
    Type: Json
    Description: Alarm contacts.
    Default:
      - ros-ut-group
Resources:
  DynamicTagGroup:
    Type: ALIYUN::CMS::DynamicTagGroup
    Properties:
      ContactGroupList:
        Ref: ContactGroupList
      MatchExpressFilterRelation:
        Ref: MatchExpressFilterRelation
      EnableSubscribeEvent:
        Ref: EnableSubscribeEvent
      TemplateIdList: Null
      TagKey: test1
      EnableInstallAgent: false
      MatchExpress:
        - TagValue: '1'
          TagValueMatchFunction: all
        - TagValue: '2'
          TagValueMatchFunction: equals
Outputs:
  DynamicTagRuleId:
    Value:
      Fn::GetAtt:
        - DynamicTagGroup
        - DynamicTagRuleId
  TagKey:
    Value:
      Fn::GetAtt:
        - DynamicTagGroup
        - TagKey

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "MatchExpressFilterRelation": {
      "Type": "String",
      "Description": "The relationship between the conditional expressions. Values are:\nand: the relationship between\nor: the relationship or the\nDescription currently supports only one combination of conditions, the follow-up Ali cloud will support a variety of combinations of conditions.",
      "AllowedValues": [
        "and",
        "or"
      ],
      "Default": "or"
    },
    "EnableSubscribeEvent": {
      "Type": "Boolean",
      "Description": "Whether the event subscription is enabled. Values are\n:true: enable event subscription\nfalse: disable event subscription",
      "AllowedValues": [
        true,
        false
      ],
      "Default": false
    },
    "ContactGroupList": {
      "Type": "Json",
      "Description": "Alarm contacts.",
      "Default": ["ros-ut-***"]
    }
  },
  "Resources": {
    "DynamicTagGroup": {
      "Type": "ALIYUN::CMS::DynamicTagGroup",
      "Properties": {
        "ContactGroupList": {
          "Ref": "ContactGroupList"
        },
        "MatchExpressFilterRelation": {
          "Ref": "MatchExpressFilterRelation"
        },
        "EnableSubscribeEvent": {
          "Ref": "EnableSubscribeEvent"
        },
        "TemplateIdList": null,
        "TagKey": "test1",
        "EnableInstallAgent": false,
        "MatchExpress": [
          {
            "TagValue": "1",
            "TagValueMatchFunction": "all"
          },
          {
            "TagValue": "2",
            "TagValueMatchFunction": "equals"
          }
        ]
      }
    }
  },
  "Outputs": {
    "DynamicTagRuleId": {
      "Value": {
        "Fn::GetAtt": [
          "DynamicTagGroup",
          "DynamicTagRuleId"
        ]
      }
    },
    "TagKey": {
      "Value": {
        "Fn::GetAtt": [
          "DynamicTagGroup",
          "TagKey"
        ]
      }
    }
  }
}