Rule
- Implements: IRule
This class encapsulates and extends the ROS resource type ALIYUN::IOT::Rule.
Initializers
import com.aliyun.ros.cdk.iot.Rule;
Rule.Builder.create(Construct scope, java.lang.String id, java.lang.Boolean enableResourcePropertyConstraint)
.name(java.lang.String)
.name(IResolvable)
// .dataType(java.lang.String)
// .dataType(IResolvable)
// .iotInstanceId(java.lang.String)
// .iotInstanceId(IResolvable)
// .productKey(java.lang.String)
// .productKey(IResolvable)
// .resourceGroupId(java.lang.String)
// .resourceGroupId(IResolvable)
// .ruleAction(IResolvable)
// .ruleAction(java.util.List<IResolvable)
// .ruleAction(RuleActionProperty>)
// .ruleDesc(java.lang.String)
// .ruleDesc(IResolvable)
// .select(java.lang.String)
// .select(IResolvable)
// .shortTopic(java.lang.String)
// .shortTopic(IResolvable)
// .startRule(java.lang.Boolean)
// .startRule(IResolvable)
// .topicType(java.lang.Number)
// .topicType(IResolvable)
// .where(java.lang.String)
// .where(IResolvable)
.build();
| Name | Type | Description |
|---|---|---|
scope | com.aliyun.ros.cdk.core.Construct | No description. |
id | java.lang.String | No description. |
enableResourcePropertyConstraint | java.lang.Boolean | No description. |
name | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property name: The name of the data forwarding rule. |
dataType | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property dataType: The format of the data to be processed by the rule. |
iotInstanceId | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property iotInstanceId: The ID of the instance. |
productKey | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property productKey: The ProductKey of the product to which the rule applies. |
resourceGroupId | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property resourceGroupId: The ID of the resource group to which the rule is assigned. |
ruleAction | com.aliyun.ros.cdk.core.IResolvable OR java.util.List | Property ruleAction:. |
ruleDesc | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property ruleDesc: The description of the rule. |
select | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property select: The SQL SELECT statement that you want to execute. |
shortTopic | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property shortTopic: The topic to which this rule is applied. |
startRule | java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable | Property startRule: Start the rule. |
topicType | java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable | Property topicType: 0: The topic is a basic communication topic or TSL-based communication topic. |
where | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property where: The condition that is used to trigger the rule. |
scopeRequired
- Type: com.aliyun.ros.cdk.core.Construct
idRequired
- Type: java.lang.String
enableResourcePropertyConstraintOptional
- Type: java.lang.Boolean
nameRequired
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property name: The name of the data forwarding rule.
The rule name must be 1 to 30 characters in length, and can contain letters, digits, underscores (_), and hyphens (-).
dataTypeOptional
- Type: java.lang.String OR com.aliyun.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.
iotInstanceIdOptional
- Type: java.lang.String OR com.aliyun.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.
productKeyOptional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property productKey: The ProductKey of the product to which the rule applies.
resourceGroupIdOptional
- Type: java.lang.String OR com.aliyun.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.
You can specify a value for this parameter only if you have activated Resource Management. If you do not specify this parameter, the rule is assigned to the default resource group.
ruleActionOptional
- Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.List
RuleActionProperty>
Property ruleAction:.
ruleDescOptional
- Type: java.lang.String OR com.aliyun.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.
selectOptional
- Type: java.lang.String OR com.aliyun.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.
shortTopicOptional
- Type: java.lang.String OR com.aliyun.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.
startRuleOptional
- Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable
Property startRule: Start the rule.
The rule at least contains one rule action with normal data forward.
topicTypeOptional
- Type: java.lang.Number OR com.aliyun.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}.
whereOptional
- Type: java.lang.String OR com.aliyun.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.
Methods
| Name | Description |
|---|---|
toString | Returns a string representation of this construct. |
synthesize | Allows this construct to emit artifacts into the cloud assembly during synthesis. |
addCondition | No description. |
addCount | No description. |
addDependency | No description. |
addResourceDesc | No description. |
applyRemovalPolicy | No description. |
fetchCondition | No description. |
fetchDependency | No description. |
fetchResourceDesc | No description. |
getAtt | No description. |
setMetadata | No description. |
toString
public java.lang.String toString()
Returns a string representation of this construct.
synthesize
public void synthesize(ISynthesisSession session)
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: com.aliyun.ros.cdk.core.ISynthesisSession
The synthesis session.
addCondition
public void addCondition(RosCondition condition)
- Type: com.aliyun.ros.cdk.core.RosCondition
addCount
public void addCount(java.lang.Number OR IResolvable count)
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
addDependency
public void addDependency(Resource resource)
- Type: com.aliyun.ros.cdk.core.Resource
addResourceDesc
public void addResourceDesc(java.lang.String desc)
- Type: java.lang.String
applyRemovalPolicy
public void applyRemovalPolicy(RemovalPolicy policy)
- Type: com.aliyun.ros.cdk.core.RemovalPolicy
fetchCondition
public RosCondition fetchCondition()
fetchDependency
public java.util.List<java.lang.String> fetchDependency()
fetchResourceDesc
public java.lang.String fetchResourceDesc()
getAtt
public IResolvable getAtt(java.lang.String name)
- Type: java.lang.String
setMetadata
public void setMetadata(java.lang.String key, java.lang.Object value)
- Type: java.lang.String
- Type: java.lang.Object
Static Functions
| Name | Description |
|---|---|
isConstruct | Return whether the given object is a Construct. |
isConstruct
import com.aliyun.ros.cdk.iot.Rule;
Rule.isConstruct(java.lang.Object x)
Return whether the given object is a Construct.
- Type: java.lang.Object
Properties
| Name | Type | Description |
|---|---|---|
node | com.aliyun.ros.cdk.core.ConstructNode | The construct tree node associated with this construct. |
env | com.aliyun.ros.cdk.core.IResourceEnvironment | The environment this resource belongs to. |
ref | java.lang.String | No description. |
stack | com.aliyun.ros.cdk.core.Stack | The stack in which this resource is defined. |
resource | com.aliyun.ros.cdk.core.RosResource | No description. |
attrActionId | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Attribute ActionId: The ID of the rule action. |
attrRuleId | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Attribute RuleId: The ID of the rule. |
props | RuleProps | No description. |
nodeRequired
public ConstructNode getNode();
- Type: com.aliyun.ros.cdk.core.ConstructNode
The construct tree node associated with this construct.
envRequired
public IResourceEnvironment getEnv();
- Type: com.aliyun.ros.cdk.core.IResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
refRequired
public java.lang.String getRef();
- Type: java.lang.String
stackRequired
public Stack getStack();
- Type: com.aliyun.ros.cdk.core.Stack
The stack in which this resource is defined.
resourceOptional
public RosResource getResource();
- Type: com.aliyun.ros.cdk.core.RosResource
attrActionIdRequired
public java.lang.Object getAttrActionId();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Attribute ActionId: The ID of the rule action.
attrRuleIdRequired
public java.lang.Object getAttrRuleId();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Attribute RuleId: The ID of the rule.
propsRequired
public RuleProps getProps();
- Type: RuleProps