Todos os produtos
Search
Central de documentação

Resource Orchestration Service:ALIYUN::IOT::RuleAction

Última atualização: Aug 20, 2026

Use ALIYUN::IOT::RuleAction para criar uma ação de regra para uma regra específica.

Sintaxe

{
  "Type": "ALIYUN::IOT::RuleAction",
  "Properties": {
    "ErrorActionFlag": Boolean,
    "Type": String,
    "IotInstanceId": String,
    "Configuration": String,
    "RuleId": Integer
  }
}

Propriedades

Nome da propriedade

Tipo

Obrigatório

Atualização permitida

Descrição

Restrições

ErrorActionFlag

Boolean

Não

Não

Defina se os dados de operações com falha serão encaminhados. Uma operação com falha ocorre quando o encaminhamento de dados para outro service cloud falha após todas as tentativas.

Valores válidos:

  • true: encaminha dados de operações com falha.

  • false (padrão): não encaminha dados de operações com falha.

Type

String

Sim

Sim

Tipo da ação de regra. O Tablestore não aceita encaminhamento de dados se o formato de dados da regra for binário (parâmetro DataType definido como BINARY).

Valores válidos:

  • REPUBLISH: encaminha dados do tópico processados pela regra para outro tópico do IoT Platform.

  • AMQP: encaminha dados para um grupo de consumidores AMQP.

  • DATAHUB: encaminha dados do tópico processados pela regra para o Alibaba Cloud DataHub para processamento de fluxo.

  • ONS: encaminha dados do tópico processados pela regra para o Alibaba Cloud Message Queue for Apache RocketMQ para distribuição de mensagens.

  • SMQ: encaminha dados do tópico processados pela regra para o Alibaba Cloud Message Service para transmissão de mensagens.

  • FC: encaminha dados do tópico processados pela regra para o Alibaba Cloud Function Compute para computação orientada a eventos.

  • OTS: encaminha dados do tópico processados pela regra para o Alibaba Cloud Tablestore para armazenamento de dados NoSQL.

IotInstanceId

String

Não

Não

ID da instância.

Especifique este parâmetro para instâncias públicas e instâncias Enterprise.

Configuration

String

Sim

Sim

Informações de configuração da ação de regra.

O valor deve ser uma string JSON. O conteúdo necessário varia conforme o tipo da ação de regra. Para mais informações, consulte CreateRuleAction.

RuleId

Integer

Sim

Não

ID da regra para a qual você deseja criar uma ação.

Nenhuma

Valor de retorno

Fn::GetAtt

ActionId: ID da ação de regra.

Exemplos

Formato JSON

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "ErrorActionFlag": {
      "Type": "Boolean",
      "Description": "Indicates whether the rule action forwarded error operation data. Error operation\ndata indicates that the rule engine failed to forward data from the IoT Platform topic\nto the destination cloud service. A data forwarding failure indicates that forwarding\nretries also failed. Valid values:\ntrue: forwards error operation data.\nfalse: forwards normal data instead of error operation data.\nDefault value: false.",
      "AllowedValues": [
        "True",
        "true",
        "False",
        "false"
      ]
    },
    "Type": {
      "Type": "String",
      "Description": "The type of the rule action. Valid values:\nSMQ: forwards data in the topics that have been processed by the rule engine to Message\nService (SMQ) for message transmission.\nFC: forwards data in the topics that have been processed by the rule engine to Function\nCompute for event computing.\nREPUBLISH: forwards data in the topics that have been processed by the rule engine to another\nIoT Platform topic.\nAMQP: forwards data to AMQP consumer groups.\nOTS: forwards data in the topics that have been processed by the rule engine to Table\nStore for NoSQL data storage.\nNote\nRules of the binary data format (the DataType parameter is set toBINARY) do not support forwarding data to Table Store.\nDestination Alibaba Cloud services that are supported by the rule engine vary based\non regions. For more information about the regions and destination cloud services\nthat are supported by the rule engine, see Regions and zones.",
      "AllowedValues": [
        "AMQP",
        "DATAHUB",
        "FC",
        "SMQ",
        "ONS",
        "OTS",
        "REPUBLISH"
      ]
    },
    "Configuration": {
      "Type": "String",
      "Description": "The configurations of the rule action. You must specify a JSON string. The configurations\nfor different types of rule actions are different. For more information about required\nsyntax and examples, see the following tables."
    },
    "IotInstanceId": {
      "Type": "String",
      "Description": "The ID of the instance. This parameter is not required for public instances. However,\nthe parameter is required for the instances that you have purchased."
    },
    "RuleId": {
      "Type": "Number",
      "Description": "The ID of the rule for which you want to create an action. You can use either of the\nfollowing methods to view the rule ID: 1. Log on to the IoT Platform console and choose Rules>Data Forwarding. 2. Call the ListRule operation."
    }
  },
  "Resources": {
    "RuleAction": {
      "Type": "ALIYUN::IOT::RuleAction",
      "Properties": {
        "ErrorActionFlag": {
          "Ref": "ErrorActionFlag"
        },
        "Type": {
          "Ref": "Type"
        },
        "Configuration": {
          "Ref": "Configuration"
        },
        "IotInstanceId": {
          "Ref": "IotInstanceId"
        },
        "RuleId": {
          "Ref": "RuleId"
        }
      }
    }
  },
  "Outputs": {
    "ActionId": {
      "Description": "The ID of the rule action. ",
      "Value": {
        "Fn::GetAtt": [
          "RuleAction",
          "ActionId"
        ]
      }
    }
  }
}

Formato YAML

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
 ErrorActionFlag:
  Type: Boolean
  Description: >-
   Indicates whether the rule action forwarded error operation data. Error
   operation

   data indicates that the rule engine failed to forward data from the IoT
   Platform topic

   to the destination cloud service. A data forwarding failure indicates that
   forwarding

   retries also failed. Valid values:

   true: forwards error operation data.

   false: forwards normal data instead of error operation data.

   Default value: false.
  AllowedValues:
   - 'True'
   - 'true'
   - 'False'
   - 'false'
 Type:
  Type: String
  Description: >-
   The type of the rule action. Valid values:

   SMQ: forwards data in the topics that have been processed by the rule
   engine to Message

   Service (SMQ) for message transmission.

   FC: forwards data in the topics that have been processed by the rule
   engine to Function

   Compute for event computing.

   REPUBLISH: forwards data in the topics that have been processed by the
   rule engine to another

   IoT Platform topic.

   AMQP: forwards data to AMQP consumer groups.

   OTS: forwards data in the topics that have been processed by the rule
   engine to Table

   Store for NoSQL data storage.

   Note

   Rules of the binary data format (the DataType parameter is set toBINARY)
   do not support forwarding data to Table Store.

   Destination Alibaba Cloud services that are supported by the rule engine
   vary based

   on regions. For more information about the regions and destination cloud
   services

   that are supported by the rule engine, see Regions and zones.
  AllowedValues:
   - AMQP
   - DATAHUB
   - FC
   - SMQ
   - ONS
   - OTS
   - REPUBLISH
 Configuration:
  Type: String
  Description: >-
   The configurations of the rule action. You must specify a JSON string. The
   configurations

   for different types of rule actions are different. For more information
   about required

   syntax and examples, see the following tables.
 IotInstanceId:
  Type: String
  Description: >-
   The ID of the instance. This parameter is not required for public
   instances. However,

   the parameter is required for the instances that you have purchased.
 RuleId:
  Type: Number
  Description: >-
   The ID of the rule for which you want to create an action. You can use
   either of the

   following methods to view the rule ID: 1. Log on to the IoT Platform
   console and choose Rules>Data Forwarding. 2. Call the ListRule operation.
Resources:
 RuleAction:
  Type: 'ALIYUN::IOT::RuleAction'
  Properties:
   ErrorActionFlag:
    Ref: ErrorActionFlag
   Type:
    Ref: Type
   Configuration:
    Ref: Configuration
   IotInstanceId:
    Ref: IotInstanceId
   RuleId:
    Ref: RuleId
Outputs:
 ActionId:
  Description: 'The ID of the rule action. '
  Value:
   'Fn::GetAtt':
    - RuleAction
    - ActionId