Documentation
¶
Overview ¶
The CDK Construct Library for AWS::IoTEvents
Index ¶
- func DetectorModel_IsConstruct(x interface{}) *bool
- func DetectorModel_IsOwnedResource(construct constructs.IConstruct) *bool
- func DetectorModel_IsResource(construct constructs.IConstruct) *bool
- func Input_IsConstruct(x interface{}) *bool
- func Input_IsOwnedResource(construct constructs.IConstruct) *bool
- func Input_IsResource(construct constructs.IConstruct) *bool
- func NewDetectorModel_Override(d DetectorModel, scope constructs.Construct, id *string, ...)
- func NewExpression_Override(e Expression)
- func NewInput_Override(i Input, scope constructs.Construct, id *string, props *InputProps)
- func NewState_Override(s State, props *StateProps)
- type ActionBindOptions
- type ActionConfig
- type DetectorModel
- type DetectorModelProps
- type Event
- type EventEvaluation
- type Expression
- func Expression_Add(left Expression, right Expression) Expression
- func Expression_And(left Expression, right Expression) Expression
- func Expression_BitwiseAnd(left Expression, right Expression) Expression
- func Expression_BitwiseOr(left Expression, right Expression) Expression
- func Expression_BitwiseXor(left Expression, right Expression) Expression
- func Expression_Concat(left Expression, right Expression) Expression
- func Expression_CurrentInput(input IInput) Expression
- func Expression_Divide(left Expression, right Expression) Expression
- func Expression_Eq(left Expression, right Expression) Expression
- func Expression_FromString(value *string) Expression
- func Expression_Gt(left Expression, right Expression) Expression
- func Expression_Gte(left Expression, right Expression) Expression
- func Expression_InputAttribute(input IInput, path *string) Expression
- func Expression_Lt(left Expression, right Expression) Expression
- func Expression_Lte(left Expression, right Expression) Expression
- func Expression_Multiply(left Expression, right Expression) Expression
- func Expression_Neq(left Expression, right Expression) Expression
- func Expression_Or(left Expression, right Expression) Expression
- func Expression_Subtract(left Expression, right Expression) Expression
- func Expression_Timeout(timerName *string) Expression
- type IAction
- type IDetectorModel
- type IInput
- type Input
- type InputProps
- type State
- type StateProps
- type TransitionOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectorModel_IsConstruct ¶
func DetectorModel_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.
func DetectorModel_IsOwnedResource ¶
func DetectorModel_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise. Experimental.
func DetectorModel_IsResource ¶
func DetectorModel_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource. Experimental.
func Input_IsConstruct ¶
func Input_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`. Experimental.
func Input_IsOwnedResource ¶
func Input_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise. Experimental.
func Input_IsResource ¶
func Input_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource. Experimental.
func NewDetectorModel_Override ¶
func NewDetectorModel_Override(d DetectorModel, scope constructs.Construct, id *string, props *DetectorModelProps)
Experimental.
func NewInput_Override ¶
func NewInput_Override(i Input, scope constructs.Construct, id *string, props *InputProps)
Experimental.
Types ¶
type ActionBindOptions ¶
type ActionBindOptions struct { // The IAM role assumed by IoT Events to perform the action. // Experimental. Role awsiam.IRole `field:"required" json:"role" yaml:"role"` }
Options when binding a Action to a detector model.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import iotevents_alpha "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import "github.com/aws/aws-cdk-go/awscdk" var role role actionBindOptions := &ActionBindOptions{ Role: role, }
Experimental.
type ActionConfig ¶
type ActionConfig struct { // The configuration for this action. // Experimental. Configuration *awsiotevents.CfnDetectorModel_ActionProperty `field:"required" json:"configuration" yaml:"configuration"` }
Properties for a AWS IoT Events action.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import iotevents_alpha "github.com/aws/aws-cdk-go/awscdkioteventsalpha" actionConfig := &ActionConfig{ Configuration: &ActionProperty{ ClearTimer: &ClearTimerProperty{ TimerName: jsii.String("timerName"), }, DynamoDb: &DynamoDBProperty{ HashKeyField: jsii.String("hashKeyField"), HashKeyValue: jsii.String("hashKeyValue"), TableName: jsii.String("tableName"), // the properties below are optional HashKeyType: jsii.String("hashKeyType"), Operation: jsii.String("operation"), Payload: &PayloadProperty{ ContentExpression: jsii.String("contentExpression"), Type: jsii.String("type"), }, PayloadField: jsii.String("payloadField"), RangeKeyField: jsii.String("rangeKeyField"), RangeKeyType: jsii.String("rangeKeyType"), RangeKeyValue: jsii.String("rangeKeyValue"), }, DynamoDBv2: &DynamoDBv2Property{ TableName: jsii.String("tableName"), // the properties below are optional Payload: &PayloadProperty{ ContentExpression: jsii.String("contentExpression"), Type: jsii.String("type"), }, }, Firehose: &FirehoseProperty{ DeliveryStreamName: jsii.String("deliveryStreamName"), // the properties below are optional Payload: &PayloadProperty{ ContentExpression: jsii.String("contentExpression"), Type: jsii.String("type"), }, Separator: jsii.String("separator"), }, IotEvents: &IotEventsProperty{ InputName: jsii.String("inputName"), // the properties below are optional Payload: &PayloadProperty{ ContentExpression: jsii.String("contentExpression"), Type: jsii.String("type"), }, }, IotSiteWise: &IotSiteWiseProperty{ PropertyValue: &AssetPropertyValueProperty{ Value: &AssetPropertyVariantProperty{ BooleanValue: jsii.String("booleanValue"), DoubleValue: jsii.String("doubleValue"), IntegerValue: jsii.String("integerValue"), StringValue: jsii.String("stringValue"), }, // the properties below are optional Quality: jsii.String("quality"), Timestamp: &AssetPropertyTimestampProperty{ TimeInSeconds: jsii.String("timeInSeconds"), // the properties below are optional OffsetInNanos: jsii.String("offsetInNanos"), }, }, // the properties below are optional AssetId: jsii.String("assetId"), EntryId: jsii.String("entryId"), PropertyAlias: jsii.String("propertyAlias"), PropertyId: jsii.String("propertyId"), }, IotTopicPublish: &IotTopicPublishProperty{ MqttTopic: jsii.String("mqttTopic"), // the properties below are optional Payload: &PayloadProperty{ ContentExpression: jsii.String("contentExpression"), Type: jsii.String("type"), }, }, Lambda: &LambdaProperty{ FunctionArn: jsii.String("functionArn"), // the properties below are optional Payload: &PayloadProperty{ ContentExpression: jsii.String("contentExpression"), Type: jsii.String("type"), }, }, ResetTimer: &ResetTimerProperty{ TimerName: jsii.String("timerName"), }, SetTimer: &SetTimerProperty{ TimerName: jsii.String("timerName"), // the properties below are optional DurationExpression: jsii.String("durationExpression"), Seconds: jsii.Number(123), }, SetVariable: &SetVariableProperty{ Value: jsii.String("value"), VariableName: jsii.String("variableName"), }, Sns: &SnsProperty{ TargetArn: jsii.String("targetArn"), // the properties below are optional Payload: &PayloadProperty{ ContentExpression: jsii.String("contentExpression"), Type: jsii.String("type"), }, }, Sqs: &SqsProperty{ QueueUrl: jsii.String("queueUrl"), // the properties below are optional Payload: &PayloadProperty{ ContentExpression: jsii.String("contentExpression"), Type: jsii.String("type"), }, UseBase64: jsii.Boolean(false), }, }, }
Experimental.
type DetectorModel ¶
type DetectorModel interface { awscdk.Resource IDetectorModel // The name of the detector model. // Experimental. DetectorModelName() *string // 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. // Experimental. Env() *awscdk.ResourceEnvironment // The tree node. // Experimental. Node() constructs.Node // Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource. // // This value will resolve to one of the following: // - a concrete value (e.g. `"my-awesome-bucket"`) // - `undefined`, when a name should be generated by CloudFormation // - a concrete name generated automatically during synthesis, in // cross-environment scenarios. // Experimental. PhysicalName() *string // The stack in which this resource is defined. // Experimental. Stack() awscdk.Stack // Apply the given removal policy to this resource. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). // Experimental. ApplyRemovalPolicy(policy awscdk.RemovalPolicy) // Experimental. GeneratePhysicalName() *string // Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`). // // Normally, this token will resolve to `arnAttr`, but if the resource is // referenced across environments, `arnComponents` will be used to synthesize // a concrete ARN with the resource's physical name. Make sure to reference // `this.physicalName` in `arnComponents`. // Experimental. GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string // Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`). // // Normally, this token will resolve to `nameAttr`, but if the resource is // referenced across environments, it will be resolved to `this.physicalName`, // which will be a concrete name. // Experimental. GetResourceNameAttribute(nameAttr *string) *string // Returns a string representation of this construct. // Experimental. ToString() *string }
Defines an AWS IoT Events detector model in this stack.
Example:
import "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import "github.com/aws/aws-cdk-go/awscdkioteventsactionsalpha" import lambda "github.com/aws/aws-cdk-go/awscdk" var func iFunction input := iotevents.NewInput(this, jsii.String("MyInput"), &InputProps{ InputName: jsii.String("my_input"), // optional AttributeJsonPaths: []*string{ jsii.String("payload.deviceId"), jsii.String("payload.temperature"), }, }) warmState := iotevents.NewState(&StateProps{ StateName: jsii.String("warm"), OnEnter: []event{ &event{ EventName: jsii.String("test-enter-event"), Condition: iotevents.Expression_CurrentInput(input), Actions: []iAction{ actions.NewLambdaInvokeAction(func), }, }, }, OnInput: []*event{ &event{ // optional EventName: jsii.String("test-input-event"), Actions: []*iAction{ actions.NewLambdaInvokeAction(func), }, }, }, OnExit: []*event{ &event{ // optional EventName: jsii.String("test-exit-event"), Actions: []*iAction{ actions.NewLambdaInvokeAction(func), }, }, }, }) coldState := iotevents.NewState(&StateProps{ StateName: jsii.String("cold"), }) // transit to coldState when temperature is less than 15 warmState.TransitionTo(coldState, &TransitionOptions{ EventName: jsii.String("to_coldState"), // optional property, default by combining the names of the States When: iotevents.Expression_Lt(iotevents.Expression_InputAttribute(input, jsii.String("payload.temperature")), iotevents.Expression_FromString(jsii.String("15"))), Executing: []*iAction{ actions.NewLambdaInvokeAction(func), }, }) // transit to warmState when temperature is greater than or equal to 15 coldState.TransitionTo(warmState, &TransitionOptions{ When: iotevents.Expression_Gte(iotevents.Expression_*InputAttribute(input, jsii.String("payload.temperature")), iotevents.Expression_*FromString(jsii.String("15"))), }) iotevents.NewDetectorModel(this, jsii.String("MyDetectorModel"), &DetectorModelProps{ DetectorModelName: jsii.String("test-detector-model"), // optional Description: jsii.String("test-detector-model-description"), // optional property, default is none EvaluationMethod: iotevents.EventEvaluation_SERIAL, // optional property, default is iotevents.EventEvaluation.BATCH DetectorKey: jsii.String("payload.deviceId"), // optional property, default is none and single detector instance will be created and all inputs will be routed to it InitialState: warmState, })
Experimental.
func NewDetectorModel ¶
func NewDetectorModel(scope constructs.Construct, id *string, props *DetectorModelProps) DetectorModel
Experimental.
type DetectorModelProps ¶
type DetectorModelProps struct { // The state that is entered at the creation of each detector. // Experimental. InitialState State `field:"required" json:"initialState" yaml:"initialState"` // A brief description of the detector model. // Experimental. Description *string `field:"optional" json:"description" yaml:"description"` // The value used to identify a detector instance. // // When a device or system sends input, a new // detector instance with a unique key value is created. AWS IoT Events can continue to route // input to its corresponding detector instance based on this identifying information. // // This parameter uses a JSON-path expression to select the attribute-value pair in the message // payload that is used for identification. To route the message to the correct detector instance, // the device must send a message payload that contains the same attribute-value. // Experimental. DetectorKey *string `field:"optional" json:"detectorKey" yaml:"detectorKey"` // The name of the detector model. // Experimental. DetectorModelName *string `field:"optional" json:"detectorModelName" yaml:"detectorModelName"` // Information about the order in which events are evaluated and how actions are executed. // // When setting to SERIAL, variables are updated and event conditions are evaluated in the order // that the events are defined. // When setting to BATCH, variables within a state are updated and events within a state are // performed only after all event conditions are evaluated. // Experimental. EvaluationMethod EventEvaluation `field:"optional" json:"evaluationMethod" yaml:"evaluationMethod"` // The role that grants permission to AWS IoT Events to perform its operations. // Experimental. Role awsiam.IRole `field:"optional" json:"role" yaml:"role"` }
Properties for defining an AWS IoT Events detector model.
Example:
import "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import "github.com/aws/aws-cdk-go/awscdkioteventsactionsalpha" import lambda "github.com/aws/aws-cdk-go/awscdk" var func iFunction input := iotevents.NewInput(this, jsii.String("MyInput"), &InputProps{ InputName: jsii.String("my_input"), // optional AttributeJsonPaths: []*string{ jsii.String("payload.deviceId"), jsii.String("payload.temperature"), }, }) warmState := iotevents.NewState(&StateProps{ StateName: jsii.String("warm"), OnEnter: []event{ &event{ EventName: jsii.String("test-enter-event"), Condition: iotevents.Expression_CurrentInput(input), Actions: []iAction{ actions.NewLambdaInvokeAction(func), }, }, }, OnInput: []*event{ &event{ // optional EventName: jsii.String("test-input-event"), Actions: []*iAction{ actions.NewLambdaInvokeAction(func), }, }, }, OnExit: []*event{ &event{ // optional EventName: jsii.String("test-exit-event"), Actions: []*iAction{ actions.NewLambdaInvokeAction(func), }, }, }, }) coldState := iotevents.NewState(&StateProps{ StateName: jsii.String("cold"), }) // transit to coldState when temperature is less than 15 warmState.TransitionTo(coldState, &TransitionOptions{ EventName: jsii.String("to_coldState"), // optional property, default by combining the names of the States When: iotevents.Expression_Lt(iotevents.Expression_InputAttribute(input, jsii.String("payload.temperature")), iotevents.Expression_FromString(jsii.String("15"))), Executing: []*iAction{ actions.NewLambdaInvokeAction(func), }, }) // transit to warmState when temperature is greater than or equal to 15 coldState.TransitionTo(warmState, &TransitionOptions{ When: iotevents.Expression_Gte(iotevents.Expression_*InputAttribute(input, jsii.String("payload.temperature")), iotevents.Expression_*FromString(jsii.String("15"))), }) iotevents.NewDetectorModel(this, jsii.String("MyDetectorModel"), &DetectorModelProps{ DetectorModelName: jsii.String("test-detector-model"), // optional Description: jsii.String("test-detector-model-description"), // optional property, default is none EvaluationMethod: iotevents.EventEvaluation_SERIAL, // optional property, default is iotevents.EventEvaluation.BATCH DetectorKey: jsii.String("payload.deviceId"), // optional property, default is none and single detector instance will be created and all inputs will be routed to it InitialState: warmState, })
Experimental.
type Event ¶
type Event struct { // The name of the event. // Experimental. EventName *string `field:"required" json:"eventName" yaml:"eventName"` // The actions to be performed. // Experimental. Actions *[]IAction `field:"optional" json:"actions" yaml:"actions"` // The Boolean expression that, when `true`, causes the actions to be performed. // Experimental. Condition Expression `field:"optional" json:"condition" yaml:"condition"` }
Specifies the actions to be performed when the condition evaluates to `true`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import iotevents_alpha "github.com/aws/aws-cdk-go/awscdkioteventsalpha" var action iAction var expression expression event := &Event{ EventName: jsii.String("eventName"), // the properties below are optional Actions: []*iAction{ action, }, Condition: expression, }
Experimental.
type EventEvaluation ¶
type EventEvaluation string
Information about the order in which events are evaluated and how actions are executed.
Example:
import "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import "github.com/aws/aws-cdk-go/awscdkioteventsactionsalpha" import lambda "github.com/aws/aws-cdk-go/awscdk" var func iFunction input := iotevents.NewInput(this, jsii.String("MyInput"), &InputProps{ InputName: jsii.String("my_input"), // optional AttributeJsonPaths: []*string{ jsii.String("payload.deviceId"), jsii.String("payload.temperature"), }, }) warmState := iotevents.NewState(&StateProps{ StateName: jsii.String("warm"), OnEnter: []event{ &event{ EventName: jsii.String("test-enter-event"), Condition: iotevents.Expression_CurrentInput(input), Actions: []iAction{ actions.NewLambdaInvokeAction(func), }, }, }, OnInput: []*event{ &event{ // optional EventName: jsii.String("test-input-event"), Actions: []*iAction{ actions.NewLambdaInvokeAction(func), }, }, }, OnExit: []*event{ &event{ // optional EventName: jsii.String("test-exit-event"), Actions: []*iAction{ actions.NewLambdaInvokeAction(func), }, }, }, }) coldState := iotevents.NewState(&StateProps{ StateName: jsii.String("cold"), }) // transit to coldState when temperature is less than 15 warmState.TransitionTo(coldState, &TransitionOptions{ EventName: jsii.String("to_coldState"), // optional property, default by combining the names of the States When: iotevents.Expression_Lt(iotevents.Expression_InputAttribute(input, jsii.String("payload.temperature")), iotevents.Expression_FromString(jsii.String("15"))), Executing: []*iAction{ actions.NewLambdaInvokeAction(func), }, }) // transit to warmState when temperature is greater than or equal to 15 coldState.TransitionTo(warmState, &TransitionOptions{ When: iotevents.Expression_Gte(iotevents.Expression_*InputAttribute(input, jsii.String("payload.temperature")), iotevents.Expression_*FromString(jsii.String("15"))), }) iotevents.NewDetectorModel(this, jsii.String("MyDetectorModel"), &DetectorModelProps{ DetectorModelName: jsii.String("test-detector-model"), // optional Description: jsii.String("test-detector-model-description"), // optional property, default is none EvaluationMethod: iotevents.EventEvaluation_SERIAL, // optional property, default is iotevents.EventEvaluation.BATCH DetectorKey: jsii.String("payload.deviceId"), // optional property, default is none and single detector instance will be created and all inputs will be routed to it InitialState: warmState, })
Experimental.
const ( // When setting to BATCH, variables within a state are updated and events within a state are performed only after all event conditions are evaluated. // Experimental. EventEvaluation_BATCH EventEvaluation = "BATCH" // When setting to SERIAL, variables are updated and event conditions are evaluated in the order that the events are defined. // Experimental. EventEvaluation_SERIAL EventEvaluation = "SERIAL" )
type Expression ¶
type Expression interface { // This is called to evaluate the expression. // Experimental. Evaluate(parentPriority *float64) *string }
Expression for events in Detector Model state.
Example:
// Example automatically generated from non-compiling source. May contain errors. import "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import actions "github.com/aws/aws-cdk-go/awscdkioteventsactionsalpha" var input iInput state := iotevents.NewState(&StateProps{ StateName: jsii.String("MyState"), OnEnter: []event{ &event{ EventName: jsii.String("test-event"), Condition: iotevents.Expression_CurrentInput(input), Actions: []iAction{ actions.NewSetTimerAction(jsii.String("MyTimer"), map[string]interface{}{ "duration": cdk.Duration_seconds(jsii.Number(60)), }), }, }, }, })
See: https://docs.aws.amazon.com/iotevents/latest/developerguide/iotevents-expressions.html
Experimental.
func Expression_Add ¶
func Expression_Add(left Expression, right Expression) Expression
Create a expression for the Addition operator. Experimental.
func Expression_And ¶
func Expression_And(left Expression, right Expression) Expression
Create a expression for the AND operator. Experimental.
func Expression_BitwiseAnd ¶
func Expression_BitwiseAnd(left Expression, right Expression) Expression
Create a expression for the Bitwise AND operator. Experimental.
func Expression_BitwiseOr ¶
func Expression_BitwiseOr(left Expression, right Expression) Expression
Create a expression for the Bitwise OR operator. Experimental.
func Expression_BitwiseXor ¶
func Expression_BitwiseXor(left Expression, right Expression) Expression
Create a expression for the Bitwise XOR operator. Experimental.
func Expression_Concat ¶
func Expression_Concat(left Expression, right Expression) Expression
Create a expression for the String Concatenation operator. Experimental.
func Expression_CurrentInput ¶
func Expression_CurrentInput(input IInput) Expression
Create a expression for function `currentInput()`.
It is evaluated to true if the specified input message was received. Experimental.
func Expression_Divide ¶
func Expression_Divide(left Expression, right Expression) Expression
Create a expression for the Division operator. Experimental.
func Expression_Eq ¶
func Expression_Eq(left Expression, right Expression) Expression
Create a expression for the Equal operator. Experimental.
func Expression_FromString ¶
func Expression_FromString(value *string) Expression
Create a expression from the given string. Experimental.
func Expression_Gt ¶
func Expression_Gt(left Expression, right Expression) Expression
Create a expression for the Greater Than operator. Experimental.
func Expression_Gte ¶
func Expression_Gte(left Expression, right Expression) Expression
Create a expression for the Greater Than Or Equal operator. Experimental.
func Expression_InputAttribute ¶
func Expression_InputAttribute(input IInput, path *string) Expression
Create a expression for get an input attribute as `$input.TemperatureInput.temperatures[2]`. Experimental.
func Expression_Lt ¶
func Expression_Lt(left Expression, right Expression) Expression
Create a expression for the Less Than operator. Experimental.
func Expression_Lte ¶
func Expression_Lte(left Expression, right Expression) Expression
Create a expression for the Less Than Or Equal operator. Experimental.
func Expression_Multiply ¶
func Expression_Multiply(left Expression, right Expression) Expression
Create a expression for the Multiplication operator. Experimental.
func Expression_Neq ¶
func Expression_Neq(left Expression, right Expression) Expression
Create a expression for the Not Equal operator. Experimental.
func Expression_Or ¶
func Expression_Or(left Expression, right Expression) Expression
Create a expression for the OR operator. Experimental.
func Expression_Subtract ¶
func Expression_Subtract(left Expression, right Expression) Expression
Create a expression for the Subtraction operator. Experimental.
func Expression_Timeout ¶
func Expression_Timeout(timerName *string) Expression
Create a expression for function `timeout("timer-name")`.
It is evaluated to true if the specified timer has elapsed. You can define a timer only using the `setTimer` action. Experimental.
type IDetectorModel ¶
type IDetectorModel interface { awscdk.IResource // The name of the detector model. // Experimental. DetectorModelName() *string }
Represents an AWS IoT Events detector model. Experimental.
func DetectorModel_FromDetectorModelName ¶
func DetectorModel_FromDetectorModelName(scope constructs.Construct, id *string, detectorModelName *string) IDetectorModel
Import an existing detector model. Experimental.
type IInput ¶
type IInput interface { awscdk.IResource // Grant the indicated permissions on this input to the given IAM principal (Role/Group/User). // Experimental. Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant // Grant write permissions on this input and its contents to an IAM principal (Role/Group/User). // Experimental. GrantWrite(grantee awsiam.IGrantable) awsiam.Grant // The ARN of the input. // Experimental. InputArn() *string // The name of the input. // Experimental. InputName() *string }
Represents an AWS IoT Events input. Experimental.
func Input_FromInputName ¶
Import an existing input. Experimental.
type Input ¶
type Input interface { awscdk.Resource IInput // 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. // Experimental. Env() *awscdk.ResourceEnvironment // The ARN of the input. // Experimental. InputArn() *string // The name of the input. // Experimental. InputName() *string // The tree node. // Experimental. Node() constructs.Node // Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource. // // This value will resolve to one of the following: // - a concrete value (e.g. `"my-awesome-bucket"`) // - `undefined`, when a name should be generated by CloudFormation // - a concrete name generated automatically during synthesis, in // cross-environment scenarios. // Experimental. PhysicalName() *string // The stack in which this resource is defined. // Experimental. Stack() awscdk.Stack // Apply the given removal policy to this resource. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). // Experimental. ApplyRemovalPolicy(policy awscdk.RemovalPolicy) // Experimental. GeneratePhysicalName() *string // Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`). // // Normally, this token will resolve to `arnAttr`, but if the resource is // referenced across environments, `arnComponents` will be used to synthesize // a concrete ARN with the resource's physical name. Make sure to reference // `this.physicalName` in `arnComponents`. // Experimental. GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string // Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`). // // Normally, this token will resolve to `nameAttr`, but if the resource is // referenced across environments, it will be resolved to `this.physicalName`, // which will be a concrete name. // Experimental. GetResourceNameAttribute(nameAttr *string) *string // Grant the indicated permissions on this input to the given IAM principal (Role/Group/User). // Experimental. Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant // Grant write permissions on this input and its contents to an IAM principal (Role/Group/User). // Experimental. GrantWrite(grantee awsiam.IGrantable) awsiam.Grant // Returns a string representation of this construct. // Experimental. ToString() *string }
Defines an AWS IoT Events input in this stack.
Example:
import iotevents "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import iam "github.com/aws/aws-cdk-go/awscdk" var role iRole input := iotevents.NewInput(this, jsii.String("MyInput"), &InputProps{ AttributeJsonPaths: []*string{ jsii.String("payload.temperature"), jsii.String("payload.transactionId"), }, }) topicRule := iot.NewTopicRule(this, jsii.String("TopicRule"), &TopicRuleProps{ Sql: iot.IotSql_FromStringAsVer20160323(jsii.String("SELECT * FROM 'device/+/data'")), Actions: []iAction{ actions.NewIotEventsPutMessageAction(input, &IotEventsPutMessageActionProps{ BatchMode: jsii.Boolean(true), // optional property, default is 'false' MessageId: jsii.String("${payload.transactionId}"), // optional property, default is a new UUID Role: role, }), }, })
Experimental.
func NewInput ¶
func NewInput(scope constructs.Construct, id *string, props *InputProps) Input
Experimental.
type InputProps ¶
type InputProps struct { // An expression that specifies an attribute-value pair in a JSON structure. // // Use this to specify an attribute from the JSON payload that is made available // by the input. Inputs are derived from messages sent to AWS IoT Events (BatchPutMessage). // Each such message contains a JSON payload. The attribute (and its paired value) // specified here are available for use in the condition expressions used by detectors. // Experimental. AttributeJsonPaths *[]*string `field:"required" json:"attributeJsonPaths" yaml:"attributeJsonPaths"` // The name of the input. // Experimental. InputName *string `field:"optional" json:"inputName" yaml:"inputName"` }
Properties for defining an AWS IoT Events input.
Example:
import "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import "github.com/aws/aws-cdk-go/awscdkioteventsactionsalpha" import lambda "github.com/aws/aws-cdk-go/awscdk" var func iFunction input := iotevents.NewInput(this, jsii.String("MyInput"), &InputProps{ InputName: jsii.String("my_input"), // optional AttributeJsonPaths: []*string{ jsii.String("payload.deviceId"), jsii.String("payload.temperature"), }, }) warmState := iotevents.NewState(&StateProps{ StateName: jsii.String("warm"), OnEnter: []event{ &event{ EventName: jsii.String("test-enter-event"), Condition: iotevents.Expression_CurrentInput(input), Actions: []iAction{ actions.NewLambdaInvokeAction(func), }, }, }, OnInput: []*event{ &event{ // optional EventName: jsii.String("test-input-event"), Actions: []*iAction{ actions.NewLambdaInvokeAction(func), }, }, }, OnExit: []*event{ &event{ // optional EventName: jsii.String("test-exit-event"), Actions: []*iAction{ actions.NewLambdaInvokeAction(func), }, }, }, }) coldState := iotevents.NewState(&StateProps{ StateName: jsii.String("cold"), }) // transit to coldState when temperature is less than 15 warmState.TransitionTo(coldState, &TransitionOptions{ EventName: jsii.String("to_coldState"), // optional property, default by combining the names of the States When: iotevents.Expression_Lt(iotevents.Expression_InputAttribute(input, jsii.String("payload.temperature")), iotevents.Expression_FromString(jsii.String("15"))), Executing: []*iAction{ actions.NewLambdaInvokeAction(func), }, }) // transit to warmState when temperature is greater than or equal to 15 coldState.TransitionTo(warmState, &TransitionOptions{ When: iotevents.Expression_Gte(iotevents.Expression_*InputAttribute(input, jsii.String("payload.temperature")), iotevents.Expression_*FromString(jsii.String("15"))), }) iotevents.NewDetectorModel(this, jsii.String("MyDetectorModel"), &DetectorModelProps{ DetectorModelName: jsii.String("test-detector-model"), // optional Description: jsii.String("test-detector-model-description"), // optional property, default is none EvaluationMethod: iotevents.EventEvaluation_SERIAL, // optional property, default is iotevents.EventEvaluation.BATCH DetectorKey: jsii.String("payload.deviceId"), // optional property, default is none and single detector instance will be created and all inputs will be routed to it InitialState: warmState, })
Experimental.
type State ¶
type State interface { // The name of the state. // Experimental. StateName() *string // Add a transition event to the state. // // The transition event will be triggered if condition is evaluated to `true`. // Experimental. TransitionTo(targetState State, options *TransitionOptions) }
Defines a state of a detector.
Example:
// Example automatically generated from non-compiling source. May contain errors. import "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import actions "github.com/aws/aws-cdk-go/awscdkioteventsactionsalpha" var input iInput state := iotevents.NewState(&StateProps{ StateName: jsii.String("MyState"), OnEnter: []event{ &event{ EventName: jsii.String("test-event"), Condition: iotevents.Expression_CurrentInput(input), Actions: []iAction{ actions.NewSetTimerAction(jsii.String("MyTimer"), map[string]interface{}{ "duration": cdk.Duration_seconds(jsii.Number(60)), }), }, }, }, })
Experimental.
type StateProps ¶
type StateProps struct { // The name of the state. // Experimental. StateName *string `field:"required" json:"stateName" yaml:"stateName"` // Specifies the events on enter. // // The conditions of the events will be evaluated when entering this state. // If the condition of the event evaluates to `true`, the actions of the event will be executed. // Experimental. OnEnter *[]*Event `field:"optional" json:"onEnter" yaml:"onEnter"` // Specifies the events on exit. // // The conditions of the events are evaluated when an exiting this state. // If the condition evaluates to `true`, the actions of the event will be executed. // Experimental. OnExit *[]*Event `field:"optional" json:"onExit" yaml:"onExit"` // Specifies the events on input. // // The conditions of the events will be evaluated when any input is received. // If the condition of the event evaluates to `true`, the actions of the event will be executed. // Experimental. OnInput *[]*Event `field:"optional" json:"onInput" yaml:"onInput"` }
Properties for defining a state of a detector.
Example:
// Example automatically generated from non-compiling source. May contain errors. import "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import actions "github.com/aws/aws-cdk-go/awscdkioteventsactionsalpha" var input iInput state := iotevents.NewState(&StateProps{ StateName: jsii.String("MyState"), OnEnter: []event{ &event{ EventName: jsii.String("test-event"), Condition: iotevents.Expression_CurrentInput(input), Actions: []iAction{ actions.NewSetTimerAction(jsii.String("MyTimer"), map[string]interface{}{ "duration": cdk.Duration_seconds(jsii.Number(60)), }), }, }, }, })
Experimental.
type TransitionOptions ¶
type TransitionOptions struct { // The condition that is used to determine to cause the state transition and the actions. // // When this was evaluated to `true`, the state transition and the actions are triggered. // Experimental. When Expression `field:"required" json:"when" yaml:"when"` // The name of the event. // Experimental. EventName *string `field:"optional" json:"eventName" yaml:"eventName"` // The actions to be performed with the transition. // Experimental. Executing *[]IAction `field:"optional" json:"executing" yaml:"executing"` }
Properties for options of state transition.
Example:
import "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import "github.com/aws/aws-cdk-go/awscdkioteventsactionsalpha" import lambda "github.com/aws/aws-cdk-go/awscdk" var func iFunction input := iotevents.NewInput(this, jsii.String("MyInput"), &InputProps{ InputName: jsii.String("my_input"), // optional AttributeJsonPaths: []*string{ jsii.String("payload.deviceId"), jsii.String("payload.temperature"), }, }) warmState := iotevents.NewState(&StateProps{ StateName: jsii.String("warm"), OnEnter: []event{ &event{ EventName: jsii.String("test-enter-event"), Condition: iotevents.Expression_CurrentInput(input), Actions: []iAction{ actions.NewLambdaInvokeAction(func), }, }, }, OnInput: []*event{ &event{ // optional EventName: jsii.String("test-input-event"), Actions: []*iAction{ actions.NewLambdaInvokeAction(func), }, }, }, OnExit: []*event{ &event{ // optional EventName: jsii.String("test-exit-event"), Actions: []*iAction{ actions.NewLambdaInvokeAction(func), }, }, }, }) coldState := iotevents.NewState(&StateProps{ StateName: jsii.String("cold"), }) // transit to coldState when temperature is less than 15 warmState.TransitionTo(coldState, &TransitionOptions{ EventName: jsii.String("to_coldState"), // optional property, default by combining the names of the States When: iotevents.Expression_Lt(iotevents.Expression_InputAttribute(input, jsii.String("payload.temperature")), iotevents.Expression_FromString(jsii.String("15"))), Executing: []*iAction{ actions.NewLambdaInvokeAction(func), }, }) // transit to warmState when temperature is greater than or equal to 15 coldState.TransitionTo(warmState, &TransitionOptions{ When: iotevents.Expression_Gte(iotevents.Expression_*InputAttribute(input, jsii.String("payload.temperature")), iotevents.Expression_*FromString(jsii.String("15"))), }) iotevents.NewDetectorModel(this, jsii.String("MyDetectorModel"), &DetectorModelProps{ DetectorModelName: jsii.String("test-detector-model"), // optional Description: jsii.String("test-detector-model-description"), // optional property, default is none EvaluationMethod: iotevents.EventEvaluation_SERIAL, // optional property, default is iotevents.EventEvaluation.BATCH DetectorKey: jsii.String("payload.deviceId"), // optional property, default is none and single detector instance will be created and all inputs will be routed to it InitialState: warmState, })
Experimental.
Source Files
¶
- ActionBindOptions.go
- ActionConfig.go
- DetectorModel.go
- DetectorModelProps.go
- DetectorModel__checks.go
- Event.go
- EventEvaluation.go
- Expression.go
- Expression__checks.go
- IAction.go
- IDetectorModel.go
- IInput.go
- IInput__checks.go
- Input.go
- InputProps.go
- Input__checks.go
- State.go
- StateProps.go
- State__checks.go
- TransitionOptions.go
- main.go