ALIYUN::DATAHUB::Topic

更新时间:
复制 MD 格式

Creates a DataHub topic.

Topics are supported in the following regions:

  • China (Hangzhou)

  • China (Shanghai)

  • China (Beijing)

  • China (Zhangjiakou)

  • China (Shenzhen)

  • Singapore

  • Malaysia (Kuala Lumpur)

  • Germany (Frankfurt)

Syntax

{
  "Type": "ALIYUN::DATAHUB::Topic",
  "Properties": {
    "Comment": String,
    "RecordType": String,
    "ProjectName": String,
    "RecordSchema": String,
    "TopicName": String,
    "ShardCount": Integer,
    "Lifecycle": Integer
  }
}

Properties

Property Name

Type

Required

Update allowed

Description

Constraints

Comment

String

Yes

No

The topic description.

3 to 1,024 characters.

RecordType

String

Yes

No

The record type.

Valid values:

  • TUPLE: structured data

  • BLOB: unstructured data

ProjectName

String

Yes

No

The project name.

None

RecordSchema

String

No

No

The record schema.

Set this parameter for TUPLE topics. Leave it unset for BLOB topics.

TopicName

String

Yes

No

The topic name.

3 to 64 characters. Must start with a letter. Can contain letters (case-sensitive), digits, and underscores (_).

ShardCount

Integer

No

No

The initial shard count.

None

Lifecycle

Integer

No

No

The data retention period.

None

Return values

Fn::GetAtt

  • ProjectName: the project name.

  • TopicName: the topic name.

Examples

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Description: Test DataHub Topic
Parameters:
  RecordType:
    Type: String
    Default: BLOB
    AllowedValues:
      - TUPLE
      - BLOB
  ProjectName:
    Type: String
    Default: mytest
  TopicName:
    Type: String
    Default: mytest
Resources:
  Topic:
    Type: ALIYUN::DATAHUB::Topic
    Properties:
      Comment: Test Create Topic
      RecordType:
        Ref: RecordType
      ProjectName:
        Ref: ProjectName
      TopicName:
        Ref: TopicName
Outputs:
  ProjectName:
    Value:
      Fn::GetAtt:
        - Topic
        - ProjectName
  TopicName:
    Value:
      Fn::GetAtt:
        - Topic
        - TopicName

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Test DataHub Topic",
  "Parameters": {
    "RecordType": {
      "Type": "String",
      "Default": "BLOB",
      "AllowedValues": [
        "TUPLE",
        "BLOB"
      ]
    },
    "ProjectName": {
      "Type": "String",
      "Default": "mytest"
    },
    "TopicName": {
      "Type": "String",
      "Default": "mytest"
    }
  },
  "Resources": {
    "Topic": {
      "Type": "ALIYUN::DATAHUB::Topic",
      "Properties": {
        "Comment": "Test Create Topic",
        "RecordType": {
          "Ref": "RecordType"
        },
        "ProjectName": {
          "Ref": "ProjectName"
        },
        "TopicName": {
          "Ref": "TopicName"
        }
      }
    }
  },
  "Outputs": {
    "ProjectName": {
      "Value": {
        "Fn::GetAtt": [
          "Topic",
          "ProjectName"
        ]
      }
    },
    "TopicName": {
      "Value": {
        "Fn::GetAtt": [
          "Topic",
          "TopicName"
        ]
      }
    }
  }
}