ALIYUN::OOS::Template类型用于创建模板。

语法

{
  "Type": "ALIYUN::OOS::Template",
  "Properties": {
    "Content": String,
    "TemplateName": String,
    "Tags": Map,
    "ResourceGroupId": String
  }
}

属性

属性名称类型必须允许更新描述约束
ContentString模板内容。JSON或YAML格式,长度限制为 64 KB。
TemplateNameString模板名称。内容限制为字母、数字、中划线、下划线,最大长度200个字符,且不能以ALIYUN、ACS、ALIBABA、ALICLOUD开头。
TagsMap标签,由键值对组成。例如:{“k1”:”v1”,”k2”:”v2”}。最多支持20个键值对。
ResourceGroupIdString资源组ID。

返回值

Fn::GetAtt

  • TemplateId:模板ID。
  • TemplateName:模板名称。
  • ExecutionPolicy:执行策略。

示例

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Resources:
      Template:
        Type: ALIYUN::OOS::Template
        Properties:
          Content:
            Fn::Join:
              - '"'
              - - '{"FormatVersion":"OOS-2019-06-01","Description":"automaticly delete black hole.","Parameters":{"OOSAssumeRole":{"Description":"The RAM role to be assumed by OOS.","Type":"String","Default":'
                - Ref: RoleName
                - '}},"RamRole":"{{OOSAssumeRole}}","Tasks":[{"Name":"ddosbgp_event_blackhole","Action":"ACS::EventTrigger","Properties":{"Product":"ddosbgp","Name":["ddosbgp_event_blackhole"],"Level":["CRITICAL"],"Content":{"action":["add"]}},"Outputs":{"InstanceId":{"ValueSelector":".content.instanceId","Type":"String"},"Ip":{"ValueSelector":".content.ip","Type":"String"}}},{"Name":"DeleteBlackhole","Action":"ACS::ExecuteAPI","Properties":{"Service":"ddosbgp","API":"DeleteBlackhole","Parameters":{"InstanceId":"{{ ddosbgp_event_blackhole.InstanceId }}","Ip":"{{ddosbgp_event_blackhole.Ip}}"}},"Description":"DeleteBlackhole."}],"Outputs":{"InstanceId":{"Value":"{{ ddosbgp_event_blackhole.InstanceId }}","Type":"String"},"Ip":{"Value":"{{ ddosbgp_event_blackhole.Ip }}","Type":"String"}}}'
          TemplateName: TestTemplate
    Parameters: {}
    Outputs:
      ExecutionPolicy:
        Description: Execution Policy
        Value:
          Fn::GetAtt:
            - Template
            - ExecutionPolicy
      TemplateName:
        Description: Template Name
        Value:
          Fn::GetAtt:
            - Template
            - TemplateName
      TemplateId:
        Description: Template ID
        Value:
          Fn::GetAtt:
            - Template
            - TemplateId
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Resources": {
        "Template": {
          "Type": "ALIYUN::OOS::Template",
          "Properties": {
            "Content": {
              "Fn::Join": [
                "\"",
                [
                  "{\"FormatVersion\":\"OOS-2019-06-01\",\"Description\":\"automaticly delete black hole.\",\"Parameters\":{\"OOSAssumeRole\":{\"Description\":\"The RAM role to be assumed by OOS.\",\"Type\":\"String\",\"Default\":",
                  {
                    "Ref": "RoleName"
                  },
                  "}},\"RamRole\":\"{{OOSAssumeRole}}\",\"Tasks\":[{\"Name\":\"ddosbgp_event_blackhole\",\"Action\":\"ACS::EventTrigger\",\"Properties\":{\"Product\":\"ddosbgp\",\"Name\":[\"ddosbgp_event_blackhole\"],\"Level\":[\"CRITICAL\"],\"Content\":{\"action\":[\"add\"]}},\"Outputs\":{\"InstanceId\":{\"ValueSelector\":\".content.instanceId\",\"Type\":\"String\"},\"Ip\":{\"ValueSelector\":\".content.ip\",\"Type\":\"String\"}}},{\"Name\":\"DeleteBlackhole\",\"Action\":\"ACS::ExecuteAPI\",\"Properties\":{\"Service\":\"ddosbgp\",\"API\":\"DeleteBlackhole\",\"Parameters\":{\"InstanceId\":\"{{ ddosbgp_event_blackhole.InstanceId }}\",\"Ip\":\"{{ddosbgp_event_blackhole.Ip}}\"}},\"Description\":\"DeleteBlackhole.\"}],\"Outputs\":{\"InstanceId\":{\"Value\":\"{{ ddosbgp_event_blackhole.InstanceId }}\",\"Type\":\"String\"},\"Ip\":{\"Value\":\"{{ ddosbgp_event_blackhole.Ip }}\",\"Type\":\"String\"}}}"
                ]
              ]
            },
            "TemplateName": "TestTemplate"
          }
        }
      },
      "Parameters": {
      },
      "Outputs": {
        "ExecutionPolicy": {
          "Description": "Execution Policy",
          "Value": {
            "Fn::GetAtt": [
              "Template",
              "ExecutionPolicy"
            ]
          }
        },
        "TemplateName": {
          "Description": "Template Name",
          "Value": {
            "Fn::GetAtt": [
              "Template",
              "TemplateName"
            ]
          }
        },
        "TemplateId": {
          "Description": "Template ID",
          "Value": {
            "Fn::GetAtt": [
              "Template",
              "TemplateId"
            ]
          }
        }
      }
    }