全部產品
Search
文件中心

:ALIYUN::CMS::DynamicTagGroup

更新時間:Sep 19, 2024

ALIYUN::CMS::DynamicTagGroup類型用於雲產品自動建立應用分組。

說明

目前只支援Elastic Compute Service(Elastic Compute Service)、阿里雲關係型資料庫RDS(Relational Database Service)、Server Load Balancer(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"
        ]
      }
    }
  }
}