Cria uma categoria de tópico personalizada para um produto do IoT Platform.
Sintaxe
{
"Type": "ALIYUN::IOT::ProductTopic",
"Properties": {
"Desc": String,
"IotInstanceId": String,
"TopicShortName": String,
"Operation": String,
"ProductKey": String
}
}
Propriedades
| Propriedade | Tipo | Obrigatória | Editável | Descrição | Restrição |
| Desc | String | Não | Sim | Descrição da categoria de tópico. | Comprimento máximo: 100 caracteres. |
| IotInstanceId | String | Não | Não | ID da instância. | Obrigatório para instâncias Enterprise Edition; opcional para instâncias públicas. |
| TopicShortName | String | Sim | Sim | Hierarquia de categorias personalizadas na categoria de tópico. | Por padrão, a categoria de tópico contém as seguintes hierarquias definidas pelo sistema: _productKey_ e _deviceName_. Separe as hierarquias com barras (/). Formato da categoria de tópico: productKey/deviceName/topicShortName.O nome de cada hierarquia pode conter apenas letras, dígitos e sublinhados (_) e não pode estar vazio. |
| Operation | String | Sim | Sim | Permissões de operação dos dispositivos na categoria de tópico. | Valores válidos:
|
| ProductKey | String | Sim | Não | ProductKey do produto para o qual criar a categoria de tópico. | Nenhuma |
Parâmetros de resposta
Fn::GetAtt
TopicId: ID da categoria de tópico.
Exemplos
Formato JSON
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"Desc": {
"Type": "String",
"Description": "The description of the topic category. You can enter a description with up to 100 characters.",
"MaxLength": 100
},
"IotInstanceId": {
"Type": "String",
"Description": "Instance ID you purchased. Public instances do not need pass this property."
},
"TopicShortName": {
"Type": "String",
"Description": "The custom category hierarchy in the topic category. By default, a topic category contains two system defined category hierarchies: productKey and ${deviceName}. Forward slashes (/) are used to delimit the topic hierarchies. The format of a topic category is productKey/${deviceName}/topicShortName.\nNote The name of each category hierarchy can contain English letters, digits, and underscores (_), and cannot be empty."
},
"Operation": {
"Type": "String",
"Description": "Operation permissions of devices on the topic category. Value options:\nSUB: Subscribe. Devices can subscribe to the topics of this category.\nPUB: Publish. Devices can publish messages using the topics of this category.\nALL: Subscribe and publish. Devices can subscribe to and publish messages to the topics of this category.",
"AllowedValues": [
"ALL",
"PUB",
"SUB"
]
},
"ProductKey": {
"Type": "String",
"Description": "The unique identifier of the product for which you want to create a topic category."
}
},
"Resources": {
"ProductTopic": {
"Type": "ALIYUN::IOT::ProductTopic",
"Properties": {
"Desc": {
"Ref": "Desc"
},
"IotInstanceId": {
"Ref": "IotInstanceId"
},
"TopicShortName": {
"Ref": "TopicShortName"
},
"Operation": {
"Ref": "Operation"
},
"ProductKey": {
"Ref": "ProductKey"
}
}
}
},
"Outputs": {
"TopicId": {
"Description": "Topic ID",
"Value": {
"Fn::GetAtt": [
"ProductTopic",
"TopicId"
]
}
}
}
}
Formato YAML
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
Desc:
Type: String
Description: >-
The description of the topic category. You can enter a description with up
to 100 characters.
MaxLength: 100
IotInstanceId:
Type: String
Description: >-
Instance ID you purchased. Public instances do not need pass this
property.
TopicShortName:
Type: String
Description: >-
The custom category hierarchy in the topic category. By default, a topic
category contains two system defined category hierarchies: productKey and
${deviceName}. Forward slashes (/) are used to delimit the topic
hierarchies. The format of a topic category is
productKey/${deviceName}/topicShortName.
Note The name of each category hierarchy can contain English letters,
digits, and underscores (_), and cannot be empty.
Operation:
Type: String
Description: >-
Operation permissions of devices on the topic category. Value options:
SUB: Subscribe. Devices can subscribe to the topics of this category.
PUB: Publish. Devices can publish messages using the topics of this
category.
ALL: Subscribe and publish. Devices can subscribe to and publish messages
to the topics of this category.
AllowedValues:
- ALL
- PUB
- SUB
ProductKey:
Type: String
Description: >-
The unique identifier of the product for which you want to create a topic
category.
Resources:
ProductTopic:
Type: 'ALIYUN::IOT::ProductTopic'
Properties:
Desc:
Ref: Desc
IotInstanceId:
Ref: IotInstanceId
TopicShortName:
Ref: TopicShortName
Operation:
Ref: Operation
ProductKey:
Ref: ProductKey
Outputs:
TopicId:
Description: Topic ID
Value:
'Fn::GetAtt':
- ProductTopic
- TopicId