Documentation
¶
Overview ¶
The CDK Construct Library for AWS::IoTEvents
Index ¶
- func DetectorModel_IsConstruct(x interface{}) *bool
- func DetectorModel_IsResource(construct constructs.IConstruct) *bool
- func Input_IsConstruct(x interface{}) *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_And(left Expression, right Expression) Expression
- func Expression_CurrentInput(input IInput) 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_Neq(left Expression, right Expression) Expression
- func Expression_Or(left Expression, right Expression) 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.
Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.
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.
Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.
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 iotevents "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import actions "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 iotevents "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import actions "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 iotevents "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import actions "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 iotevents "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, []interface{}{ actions.NewSetVariableAction(jsii.String("MyVariable"), iotevents.*expression.inputAttribute(input, jsii.String("payload.temperature"))), }, }, }, }, })
See: https://docs.aws.amazon.com/iotevents/latest/developerguide/iotevents-expressions.html
Experimental.
func Expression_And ¶
func Expression_And(left Expression, right Expression) Expression
Create a expression for the AND 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_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_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.
type IAction ¶
type IAction interface { // Returns the AWS IoT Events action specification. // Experimental. Bind(scope constructs.Construct, options *ActionBindOptions) *ActionConfig }
An abstract action for DetectorModel. 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 actions "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 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 iotevents "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import actions "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 iotevents "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, []interface{}{ actions.NewSetVariableAction(jsii.String("MyVariable"), iotevents.*expression.inputAttribute(input, jsii.String("payload.temperature"))), }, }, }, }, })
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 iotevents "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, []interface{}{ actions.NewSetVariableAction(jsii.String("MyVariable"), iotevents.*expression.inputAttribute(input, jsii.String("payload.temperature"))), }, }, }, }, })
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 iotevents "github.com/aws/aws-cdk-go/awscdkioteventsalpha" import actions "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.