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