Rule
This class encapsulates and extends the ROS resource type ALIYUN::IOT::Rule
, which is used to create a rule for a specific topic.
Initializers
import ros_cdk_iot
ros_cdk_iot.Rule(
scope: Construct,
id: str,
name: typing.Union[str, IResolvable],
data_type: typing.Union[str, IResolvable] = None,
iot_instance_id: typing.Union[str, IResolvable] = None,
product_key: typing.Union[str, IResolvable] = None,
resource_group_id: typing.Union[str, IResolvable] = None,
rule_action: typing.Union[IResolvable, typing.List[typing.Union[IResolvable, RuleActionProperty]]] = None,
rule_desc: typing.Union[str, IResolvable] = None,
select: typing.Union[str, IResolvable] = None,
short_topic: typing.Union[str, IResolvable] = None,
start_rule: typing.Union[bool, IResolvable] = None,
topic_type: typing.Union[typing.Union[int, float], IResolvable] = None,
where: typing.Union[str, IResolvable] = None,
enable_resource_property_constraint: bool = None
)
Name | Type | Description |
---|---|---|
scope |
ros_cdk_core.Construct |
No description. |
id |
str |
No description. |
name |
typing.Union[str, ros_cdk_core.IResolvable] |
Property name: The name of the rule. |
data_type |
typing.Union[str, ros_cdk_core.IResolvable] |
Property dataType: The format of the data to be processed by the rule. |
iot_instance_id |
typing.Union[str, ros_cdk_core.IResolvable] |
Property iotInstanceId: The ID of the instance. |
product_key |
typing.Union[str, ros_cdk_core.IResolvable] |
Property productKey: The ProductKey of the product to which the rule applies. |
resource_group_id |
typing.Union[str, ros_cdk_core.IResolvable] |
Property resourceGroupId: The ID of the resource group to which the rule is assigned. |
rule_action |
typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[ros_cdk_core.IResolvable, RuleActionProperty]]] |
Property ruleAction:. |
rule_desc |
typing.Union[str, ros_cdk_core.IResolvable] |
Property ruleDesc: The description of the rule. |
select |
typing.Union[str, ros_cdk_core.IResolvable] |
Property select: The SQL SELECT statement that you want to execute. |
short_topic |
typing.Union[str, ros_cdk_core.IResolvable] |
Property shortTopic: The topic to which this rule is applied. |
start_rule |
typing.Union[bool, ros_cdk_core.IResolvable] |
Property startRule: Start the rule. |
topic_type |
typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] |
Property topicType: 0: The topic is a basic communication topic or TSL-based communication topic. |
where |
typing.Union[str, ros_cdk_core.IResolvable] |
Property where: The condition that is used to trigger the rule. |
enable_resource_property_constraint |
bool |
No description. |
scope
Required
- Type: ros_cdk_core.Construct
id
Required
- Type: str
name
Required
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property name: The name of the rule.
The name must be 1 to 30 characters in length and can contain English letters, digits, underscores (_), and hyphens (-). Chinese language is also supported. Each Chinese symbol occupies 2 characters.
data_type
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property dataType: The format of the data to be processed by the rule.
You must specify the format of device data to be processed for this parameter. Valid values: JSON: JSON data BINARY: binary data Note If you specifyBINARY, you cannot set the TopicType parameter to 0 and forward data to Table Store, Time Series Database (TSDB), or ApsaradDB for RDS. Default value: JSON.
iot_instance_id
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property iotInstanceId: 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.
product_key
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property productKey: The ProductKey of the product to which the rule applies.
resource_group_id
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property resourceGroupId: The ID of the resource group to which the rule is assigned.
You can view the resource group information in the Resource Management console. If you do not specify this parameter, the rule is assigned to the default resource group.
rule_action
Optional
- Type: typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[ros_cdk_core.IResolvable, RuleActionProperty]]]
Property ruleAction:.
rule_desc
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property ruleDesc: The description of the rule.
The description can be up to 100 characters in length. Each Chinese symbol occupies 1 characters.
select
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property select: The SQL SELECT statement that you want to execute.
For more information, seeSQL expressions. Note Specify the fields that follow the Select keyword for this parameter. For example, if the Select statement is Select a,b,c, specify a,b,c for this parameter.
short_topic
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property shortTopic: The topic to which this rule is applied.
Syntax: ${deviceName}/topicShortName. ${deviceName}specifies the name of the device, and topicShortNamespecifies the custom name of the topic. Basic communication topics or Thing Specification Language (TSL)-based communication topics. Syntax: ${deviceName}/topicShortName. You can replace ${deviceName} with the + wildcard. The wildcard indicates that the topic applies to all devices under the product. Valid values of topicShortName: /thing/event/property/post: submits the property data of a device. /thing/event/${tsl.event.identifier}/post: submits the event data of a device.${tsl.event.identifier} specifies the identifier of an event in the TSL. /thing/lifecycle: submits device lifecycle changes. /thing/downlink/reply/message: sends a response to a request from IoT Platform. /thing/list/found: submits the data when a gateway detects a new sub-device. /thing/topo/lifecycle: submits device topology changes. /thing/event/property/history/post: submits historical property data of a device. /thing/event/${tsl.event.identifier}/post: submits the historical event data of a device.${tsl.event.identifier}specifies the identifier of an event in the TSL. /ota/upgrade: submits OTA update status. /ota/version/post: submits OTA module versions. /thing/deviceinfo/update: submits device tag changes. /edge/driver/${driver_id}/point_post: submits pass-through data from Link IoT Edge.${driver_id} specifies the ID of the driver that a device uses to access Link IoT Edge. ${packageId}/${jobId}/ota/job/status: submits the status of OTA update batches. This topic is a basic communication topic. ${packageId}specifies the ID of the firmware. ${jobId}specifies the ID of the update batch. Custom topics. Example:${deviceName}/user/get. You can call theQueryProductTopicoperation to view all custom topics of the product. When you specify a custom topic, you can use the + and # wildcards. You can replace ${deviceName} with the+ wildcard. The wildcard indicates that the topic applies to all devices under the product. You can replace the fields that follow ${deviceName} with /user/#. The # wildcard indicates that the topic applies whatever values are specified for the fields that follow/user. For more information about how to use wildcards, see Wildcards in topics. Topic that is used to submit device status changes: ${deviceName}. You can use the+wildcard. In this case, the status changes of all devices under the product are submitted.
start_rule
Optional
- Type: typing.Union[bool, ros_cdk_core.IResolvable]
Property startRule: Start the rule.
The rule at least contains one rule action with normal data forward.
topic_type
Optional
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
Property topicType: 0: The topic is a basic communication topic or TSL-based communication topic.
1: The topic is a custom topic. 2: The topic is used to submit device status changes. Syntax: /as/mqtt/status/${productKey}/${deviceName}.
where
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property where: The condition that is used to trigger the rule.
For more information, seeSQL expressions. Note Specify the fields that follow theWherekeyword for this parameter. For example, if the Where statement is Where a>10, specify a>10 for this parameter.
enable_resource_property_constraint
Optional
- Type: bool
Methods
Name | Description |
---|---|
to_string |
Returns a string representation of this construct. |
synthesize |
Allows this construct to emit artifacts into the cloud assembly during synthesis. |
add_condition |
No description. |
add_count |
No description. |
add_dependency |
No description. |
add_resource_desc |
No description. |
apply_removal_policy |
No description. |
get_att |
No description. |
set_metadata |
No description. |
to_string
def to_string() -> str
Returns a string representation of this construct.
synthesize
def synthesize(
session: ISynthesisSession
) -> None
Allows this construct to emit artifacts into the cloud assembly during synthesis.
This method is usually implemented by framework-level constructs such as Stack
and Asset
as they participate in synthesizing the cloud assembly.
- Type: ros_cdk_core.ISynthesisSession
The synthesis session.
add_condition
def add_condition(
condition: RosCondition
) -> None
- Type: ros_cdk_core.RosCondition
add_count
def add_count(
count: typing.Union[typing.Union[int, float], IResolvable]
) -> None
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
add_dependency
def add_dependency(
resource: Resource
) -> None
- Type: ros_cdk_core.Resource
add_resource_desc
def add_resource_desc(
desc: str
) -> None
- Type: str
apply_removal_policy
def apply_removal_policy(
policy: RemovalPolicy
) -> None
- Type: ros_cdk_core.RemovalPolicy
get_att
def get_att(
name: str
) -> IResolvable
- Type: str
set_metadata
def set_metadata(
key: str,
value: typing.Any
) -> None
- Type: str
- Type: typing.Any
Static Functions
Name | Description |
---|---|
is_construct |
Return whether the given object is a Construct. |
is_construct
import ros_cdk_iot
ros_cdk_iot.Rule.is_construct(
x: typing.Any
)
Return whether the given object is a Construct.
- Type: typing.Any
Properties
Name | Type | Description |
---|---|---|
node |
ros_cdk_core.ConstructNode |
The construct tree node associated with this construct. |
ref |
str |
No description. |
stack |
ros_cdk_core.Stack |
The stack in which this resource is defined. |
resource |
ros_cdk_core.RosResource |
No description. |
attr_action_id |
ros_cdk_core.IResolvable |
Attribute ActionId: The ID of the rule action. |
attr_rule_id |
ros_cdk_core.IResolvable |
Attribute RuleId: The ID of the rule. |
node
Required
node: ConstructNode
- Type: ros_cdk_core.ConstructNode
The construct tree node associated with this construct.
ref
Required
ref: str
- Type: str
stack
Required
stack: Stack
- Type: ros_cdk_core.Stack
The stack in which this resource is defined.
resource
Optional
resource: RosResource
- Type: ros_cdk_core.RosResource
attr_action_id
Required
attr_action_id: IResolvable
- Type: ros_cdk_core.IResolvable
Attribute ActionId: The ID of the rule action.
attr_rule_id
Required
attr_rule_id: IResolvable
- Type: ros_cdk_core.IResolvable
Attribute RuleId: The ID of the rule.