@aws-cdk/aws-iotevents-actions-alpha 2.13.0-alpha.0 → 2.16.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +125 -4
- package/.jsii.tabl.json +142 -0
- package/.warnings.jsii.js +3 -1
- package/README.md +30 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +12 -4
- package/lib/lambda-invoke-action.d.ts +14 -0
- package/lib/lambda-invoke-action.js +30 -0
- package/package.json +10 -8
package/.jsii
CHANGED
|
@@ -8,10 +8,42 @@
|
|
|
8
8
|
"url": "https://aws.amazon.com"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"aws-cdk-
|
|
11
|
+
"@aws-cdk/aws-iotevents-alpha": "2.16.0-alpha.0",
|
|
12
|
+
"aws-cdk-lib": "^2.16.0",
|
|
12
13
|
"constructs": "^10.0.0"
|
|
13
14
|
},
|
|
14
15
|
"dependencyClosure": {
|
|
16
|
+
"@aws-cdk/aws-iotevents-alpha": {
|
|
17
|
+
"targets": {
|
|
18
|
+
"dotnet": {
|
|
19
|
+
"iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/master/logo/default-256-dark.png",
|
|
20
|
+
"namespace": "Amazon.CDK.AWS.IoTEvents.Alpha",
|
|
21
|
+
"packageId": "Amazon.CDK.AWS.IoTEvents.Alpha"
|
|
22
|
+
},
|
|
23
|
+
"go": {
|
|
24
|
+
"moduleName": "github.com/aws/aws-cdk-go",
|
|
25
|
+
"packageName": "awscdkioteventsalpha"
|
|
26
|
+
},
|
|
27
|
+
"java": {
|
|
28
|
+
"maven": {
|
|
29
|
+
"artifactId": "iotevents-alpha",
|
|
30
|
+
"groupId": "software.amazon.awscdk"
|
|
31
|
+
},
|
|
32
|
+
"package": "software.amazon.awscdk.services.iotevents.alpha"
|
|
33
|
+
},
|
|
34
|
+
"js": {
|
|
35
|
+
"npm": "@aws-cdk/aws-iotevents-alpha"
|
|
36
|
+
},
|
|
37
|
+
"python": {
|
|
38
|
+
"classifiers": [
|
|
39
|
+
"Framework :: AWS CDK",
|
|
40
|
+
"Framework :: AWS CDK :: 1"
|
|
41
|
+
],
|
|
42
|
+
"distName": "aws-cdk.aws-iotevents-alpha",
|
|
43
|
+
"module": "aws_cdk.aws_iotevents_alpha"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
15
47
|
"aws-cdk-lib": {
|
|
16
48
|
"submodules": {
|
|
17
49
|
"aws-cdk-lib.alexa_ask": {
|
|
@@ -2861,6 +2893,19 @@
|
|
|
2861
2893
|
"module": "aws_cdk.region_info"
|
|
2862
2894
|
}
|
|
2863
2895
|
}
|
|
2896
|
+
},
|
|
2897
|
+
"aws-cdk-lib.triggers": {
|
|
2898
|
+
"targets": {
|
|
2899
|
+
"dotnet": {
|
|
2900
|
+
"namespace": "Amazon.CDK.Triggers"
|
|
2901
|
+
},
|
|
2902
|
+
"java": {
|
|
2903
|
+
"package": "software.amazon.awscdk.triggers"
|
|
2904
|
+
},
|
|
2905
|
+
"python": {
|
|
2906
|
+
"module": "aws_cdk.triggers"
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2864
2909
|
}
|
|
2865
2910
|
},
|
|
2866
2911
|
"targets": {
|
|
@@ -2939,7 +2984,7 @@
|
|
|
2939
2984
|
},
|
|
2940
2985
|
"name": "@aws-cdk/aws-iotevents-actions-alpha",
|
|
2941
2986
|
"readme": {
|
|
2942
|
-
"markdown": "# Actions for AWS::IoTEvents Detector Model\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n\n<!--END STABILITY BANNER-->\n\nThis library contains integration classes to specify actions of state events of Detector Model in `@aws-cdk/aws-iotevents`.\nInstances of these classes should be passed to `State` defined in `@aws-cdk/aws-iotevents`\nYou can define built-in actions to use a timer or set a variable, or send data to other AWS resources.\n"
|
|
2987
|
+
"markdown": "# Actions for AWS::IoTEvents Detector Model\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n\n<!--END STABILITY BANNER-->\n\nThis library contains integration classes to specify actions of state events of Detector Model in `@aws-cdk/aws-iotevents`.\nInstances of these classes should be passed to `State` defined in `@aws-cdk/aws-iotevents`\nYou can define built-in actions to use a timer or set a variable, or send data to other AWS resources.\n\nThis library contains integration classes to use a timer or set a variable, or send data to other AWS resources.\nAWS IoT Events can trigger actions when it detects a specified event or transition event.\n\nCurrently supported are:\n\n- Invoke a Lambda function\n\n## Invoke a Lambda function\n\nThe code snippet below creates an Action that invoke a Lambda function\nwhen it is triggered.\n\n```ts\nimport * as iotevents from '@aws-cdk/aws-iotevents-alpha';\nimport * as actions from '@aws-cdk/aws-iotevents-actions-alpha';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\n\ndeclare const input: iotevents.IInput;\ndeclare const func: lambda.IFunction;\n\nconst state = new iotevents.State({\n stateName: 'MyState',\n onEnter: [{\n eventName: 'test-event',\n condition: iotevents.Expression.currentInput(input),\n actions: [new actions.LambdaInvokeAction(func)],\n }],\n});\n```\n"
|
|
2943
2988
|
},
|
|
2944
2989
|
"repository": {
|
|
2945
2990
|
"directory": "packages/individual-packages/aws-iotevents-actions",
|
|
@@ -2976,7 +3021,83 @@
|
|
|
2976
3021
|
"module": "aws_cdk.aws_iotevents_actions_alpha"
|
|
2977
3022
|
}
|
|
2978
3023
|
},
|
|
2979
|
-
"types": {
|
|
2980
|
-
|
|
3024
|
+
"types": {
|
|
3025
|
+
"@aws-cdk/aws-iotevents-actions-alpha.LambdaInvokeAction": {
|
|
3026
|
+
"assembly": "@aws-cdk/aws-iotevents-actions-alpha",
|
|
3027
|
+
"docs": {
|
|
3028
|
+
"custom": {
|
|
3029
|
+
"exampleMetadata": "infused"
|
|
3030
|
+
},
|
|
3031
|
+
"example": "import * as iotevents from '@aws-cdk/aws-iotevents-alpha';\nimport * as actions from '@aws-cdk/aws-iotevents-actions-alpha';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\n\ndeclare const func: lambda.IFunction;\n\nconst input = new iotevents.Input(this, 'MyInput', {\n inputName: 'my_input', // optional\n attributeJsonPaths: ['payload.deviceId', 'payload.temperature'],\n});\n\nconst warmState = new iotevents.State({\n stateName: 'warm',\n onEnter: [{\n eventName: 'test-enter-event',\n condition: iotevents.Expression.currentInput(input),\n actions: [new actions.LambdaInvokeAction(func)], // optional\n }],\n onInput: [{ // optional\n eventName: 'test-input-event',\n actions: [new actions.LambdaInvokeAction(func)],\n }],\n onExit: [{ // optional\n eventName: 'test-exit-event',\n actions: [new actions.LambdaInvokeAction(func)],\n }],\n});\nconst coldState = new iotevents.State({\n stateName: 'cold',\n});\n\n// transit to coldState when temperature is 10\nwarmState.transitionTo(coldState, {\n eventName: 'to_coldState', // optional property, default by combining the names of the States\n when: iotevents.Expression.eq(\n iotevents.Expression.inputAttribute(input, 'payload.temperature'),\n iotevents.Expression.fromString('10'),\n ),\n executing: [new actions.LambdaInvokeAction(func)], // optional\n});\n// transit to warmState when temperature is 20\ncoldState.transitionTo(warmState, {\n when: iotevents.Expression.eq(\n iotevents.Expression.inputAttribute(input, 'payload.temperature'),\n iotevents.Expression.fromString('20'),\n ),\n});\n\nnew iotevents.DetectorModel(this, 'MyDetectorModel', {\n detectorModelName: 'test-detector-model', // optional\n description: 'test-detector-model-description', // optional property, default is none\n evaluationMethod: iotevents.EventEvaluation.SERIAL, // optional property, default is iotevents.EventEvaluation.BATCH\n detectorKey: 'payload.deviceId', // optional property, default is none and single detector instance will be created and all inputs will be routed to it\n initialState: warmState,\n});",
|
|
3032
|
+
"stability": "experimental",
|
|
3033
|
+
"summary": "The action to write the data to an AWS Lambda function."
|
|
3034
|
+
},
|
|
3035
|
+
"fqn": "@aws-cdk/aws-iotevents-actions-alpha.LambdaInvokeAction",
|
|
3036
|
+
"initializer": {
|
|
3037
|
+
"docs": {
|
|
3038
|
+
"stability": "experimental"
|
|
3039
|
+
},
|
|
3040
|
+
"locationInModule": {
|
|
3041
|
+
"filename": "lib/lambda-invoke-action.ts",
|
|
3042
|
+
"line": 12
|
|
3043
|
+
},
|
|
3044
|
+
"parameters": [
|
|
3045
|
+
{
|
|
3046
|
+
"docs": {
|
|
3047
|
+
"summary": "the AWS Lambda function to be invoked by this action."
|
|
3048
|
+
},
|
|
3049
|
+
"name": "func",
|
|
3050
|
+
"type": {
|
|
3051
|
+
"fqn": "aws-cdk-lib.aws_lambda.IFunction"
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
3054
|
+
]
|
|
3055
|
+
},
|
|
3056
|
+
"interfaces": [
|
|
3057
|
+
"@aws-cdk/aws-iotevents-alpha.IAction"
|
|
3058
|
+
],
|
|
3059
|
+
"kind": "class",
|
|
3060
|
+
"locationInModule": {
|
|
3061
|
+
"filename": "lib/lambda-invoke-action.ts",
|
|
3062
|
+
"line": 8
|
|
3063
|
+
},
|
|
3064
|
+
"methods": [
|
|
3065
|
+
{
|
|
3066
|
+
"docs": {
|
|
3067
|
+
"stability": "experimental",
|
|
3068
|
+
"summary": "Returns the AWS IoT Events action specification."
|
|
3069
|
+
},
|
|
3070
|
+
"locationInModule": {
|
|
3071
|
+
"filename": "lib/lambda-invoke-action.ts",
|
|
3072
|
+
"line": 15
|
|
3073
|
+
},
|
|
3074
|
+
"name": "bind",
|
|
3075
|
+
"overrides": "@aws-cdk/aws-iotevents-alpha.IAction",
|
|
3076
|
+
"parameters": [
|
|
3077
|
+
{
|
|
3078
|
+
"name": "_scope",
|
|
3079
|
+
"type": {
|
|
3080
|
+
"fqn": "constructs.Construct"
|
|
3081
|
+
}
|
|
3082
|
+
},
|
|
3083
|
+
{
|
|
3084
|
+
"name": "options",
|
|
3085
|
+
"type": {
|
|
3086
|
+
"fqn": "@aws-cdk/aws-iotevents-alpha.ActionBindOptions"
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
],
|
|
3090
|
+
"returns": {
|
|
3091
|
+
"type": {
|
|
3092
|
+
"fqn": "@aws-cdk/aws-iotevents-alpha.ActionConfig"
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
],
|
|
3097
|
+
"name": "LambdaInvokeAction",
|
|
3098
|
+
"symbolId": "lib/lambda-invoke-action:LambdaInvokeAction"
|
|
3099
|
+
}
|
|
3100
|
+
},
|
|
3101
|
+
"version": "2.16.0-alpha.0",
|
|
2981
3102
|
"fingerprint": "**********"
|
|
2982
3103
|
}
|
package/.jsii.tabl.json
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2",
|
|
3
|
+
"toolVersion": "1.54.0",
|
|
4
|
+
"snippets": {
|
|
5
|
+
"37d0a214abe7a2298a1ab5db51ef8090274727e97df91f78ab2f8b40d06216ba": {
|
|
6
|
+
"translations": {
|
|
7
|
+
"python": {
|
|
8
|
+
"source": "import aws_cdk.aws_iotevents_alpha as iotevents\nimport aws_cdk.aws_iotevents_actions_alpha as actions\nimport aws_cdk.aws_lambda as lambda_\n\n# input: iotevents.IInput\n# func: lambda.IFunction\n\nstate = iotevents.State(\n state_name=\"MyState\",\n on_enter=[iotevents.Event(\n event_name=\"test-event\",\n condition=iotevents.Expression.current_input(input),\n actions=[actions.LambdaInvokeAction(func)]\n )]\n)",
|
|
9
|
+
"version": "2"
|
|
10
|
+
},
|
|
11
|
+
"csharp": {
|
|
12
|
+
"source": "using Amazon.CDK.AWS.IoTEvents.Alpha;\nusing Amazon.CDK.AWS.IoTEvents.Actions.Alpha;\nusing Amazon.CDK.AWS.Lambda;\n\nIInput input;\nIFunction func;\n\nState state = new State(new StateProps {\n StateName = \"MyState\",\n OnEnter = new [] { new Event {\n EventName = \"test-event\",\n Condition = Expression.CurrentInput(input),\n Actions = new [] { new LambdaInvokeAction(func) }\n } }\n});",
|
|
13
|
+
"version": "1"
|
|
14
|
+
},
|
|
15
|
+
"java": {
|
|
16
|
+
"source": "import software.amazon.awscdk.services.iotevents.alpha.*;\nimport software.amazon.awscdk.services.iotevents.actions.alpha.*;\nimport software.amazon.awscdk.services.lambda.*;\n\nIInput input;\nIFunction func;\n\nState state = State.Builder.create()\n .stateName(\"MyState\")\n .onEnter(List.of(Event.builder()\n .eventName(\"test-event\")\n .condition(Expression.currentInput(input))\n .actions(List.of(new LambdaInvokeAction(func)))\n .build()))\n .build();",
|
|
17
|
+
"version": "1"
|
|
18
|
+
},
|
|
19
|
+
"$": {
|
|
20
|
+
"source": "import * as iotevents from '@aws-cdk/aws-iotevents-alpha';\nimport * as actions from '@aws-cdk/aws-iotevents-actions-alpha';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\n\ndeclare const input: iotevents.IInput;\ndeclare const func: lambda.IFunction;\n\nconst state = new iotevents.State({\n stateName: 'MyState',\n onEnter: [{\n eventName: 'test-event',\n condition: iotevents.Expression.currentInput(input),\n actions: [new actions.LambdaInvokeAction(func)],\n }],\n});",
|
|
21
|
+
"version": "0"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"location": {
|
|
25
|
+
"api": {
|
|
26
|
+
"api": "moduleReadme",
|
|
27
|
+
"moduleFqn": "@aws-cdk/aws-iotevents-actions-alpha"
|
|
28
|
+
},
|
|
29
|
+
"field": {
|
|
30
|
+
"field": "markdown",
|
|
31
|
+
"line": 34
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"didCompile": true,
|
|
35
|
+
"fqnsReferenced": [
|
|
36
|
+
"@aws-cdk/aws-iotevents-actions-alpha.LambdaInvokeAction",
|
|
37
|
+
"@aws-cdk/aws-iotevents-alpha.Expression",
|
|
38
|
+
"@aws-cdk/aws-iotevents-alpha.Expression#currentInput",
|
|
39
|
+
"@aws-cdk/aws-iotevents-alpha.IInput",
|
|
40
|
+
"@aws-cdk/aws-iotevents-alpha.State",
|
|
41
|
+
"@aws-cdk/aws-iotevents-alpha.StateProps",
|
|
42
|
+
"aws-cdk-lib.aws_lambda.IFunction"
|
|
43
|
+
],
|
|
44
|
+
"fullSource": "import * as iotevents from '@aws-cdk/aws-iotevents-alpha';\nimport * as actions from '@aws-cdk/aws-iotevents-actions-alpha';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\n\ndeclare const input: iotevents.IInput;\ndeclare const func: lambda.IFunction;\n\nconst state = new iotevents.State({\n stateName: 'MyState',\n onEnter: [{\n eventName: 'test-event',\n condition: iotevents.Expression.currentInput(input),\n actions: [new actions.LambdaInvokeAction(func)],\n }],\n});",
|
|
45
|
+
"syntaxKindCounter": {
|
|
46
|
+
"10": 5,
|
|
47
|
+
"75": 24,
|
|
48
|
+
"130": 2,
|
|
49
|
+
"153": 2,
|
|
50
|
+
"169": 2,
|
|
51
|
+
"192": 2,
|
|
52
|
+
"193": 2,
|
|
53
|
+
"194": 4,
|
|
54
|
+
"196": 1,
|
|
55
|
+
"197": 2,
|
|
56
|
+
"225": 3,
|
|
57
|
+
"242": 3,
|
|
58
|
+
"243": 3,
|
|
59
|
+
"254": 3,
|
|
60
|
+
"255": 3,
|
|
61
|
+
"256": 3,
|
|
62
|
+
"281": 5,
|
|
63
|
+
"290": 1
|
|
64
|
+
},
|
|
65
|
+
"fqnsFingerprint": "34d1f6d754089c9f97d07cfe1de41c795dbb8f26f8e68819987875b50ee6abf2"
|
|
66
|
+
},
|
|
67
|
+
"608e7356ead228295bdedba3dffba3109fb96bfcb4b8bc6de21bd9faca41a9b5": {
|
|
68
|
+
"translations": {
|
|
69
|
+
"python": {
|
|
70
|
+
"source": "import aws_cdk.aws_iotevents_alpha as iotevents\nimport aws_cdk.aws_iotevents_actions_alpha as actions\nimport aws_cdk.aws_lambda as lambda_\n\n# func: lambda.IFunction\n\n\ninput = iotevents.Input(self, \"MyInput\",\n input_name=\"my_input\", # optional\n attribute_json_paths=[\"payload.deviceId\", \"payload.temperature\"]\n)\n\nwarm_state = iotevents.State(\n state_name=\"warm\",\n on_enter=[iotevents.Event(\n event_name=\"test-enter-event\",\n condition=iotevents.Expression.current_input(input),\n actions=[actions.LambdaInvokeAction(func)]\n )],\n on_input=[iotevents.Event( # optional\n event_name=\"test-input-event\",\n actions=[actions.LambdaInvokeAction(func)])],\n on_exit=[iotevents.Event( # optional\n event_name=\"test-exit-event\",\n actions=[actions.LambdaInvokeAction(func)])]\n)\ncold_state = iotevents.State(\n state_name=\"cold\"\n)\n\n# transit to coldState when temperature is 10\nwarm_state.transition_to(cold_state,\n event_name=\"to_coldState\", # optional property, default by combining the names of the States\n when=iotevents.Expression.eq(\n iotevents.Expression.input_attribute(input, \"payload.temperature\"),\n iotevents.Expression.from_string(\"10\")),\n executing=[actions.LambdaInvokeAction(func)]\n)\n# transit to warmState when temperature is 20\ncold_state.transition_to(warm_state,\n when=iotevents.Expression.eq(\n iotevents.Expression.input_attribute(input, \"payload.temperature\"),\n iotevents.Expression.from_string(\"20\"))\n)\n\niotevents.DetectorModel(self, \"MyDetectorModel\",\n detector_model_name=\"test-detector-model\", # optional\n description=\"test-detector-model-description\", # optional property, default is none\n evaluation_method=iotevents.EventEvaluation.SERIAL, # optional property, default is iotevents.EventEvaluation.BATCH\n detector_key=\"payload.deviceId\", # optional property, default is none and single detector instance will be created and all inputs will be routed to it\n initial_state=warm_state\n)",
|
|
71
|
+
"version": "2"
|
|
72
|
+
},
|
|
73
|
+
"csharp": {
|
|
74
|
+
"source": "using Amazon.CDK.AWS.IoTEvents.Alpha;\nusing Amazon.CDK.AWS.IoTEvents.Actions.Alpha;\nusing Amazon.CDK.AWS.Lambda;\n\nIFunction func;\n\n\nInput input = new Input(this, \"MyInput\", new InputProps {\n InputName = \"my_input\", // optional\n AttributeJsonPaths = new [] { \"payload.deviceId\", \"payload.temperature\" }\n});\n\nState warmState = new State(new StateProps {\n StateName = \"warm\",\n OnEnter = new [] { new Event {\n EventName = \"test-enter-event\",\n Condition = Expression.CurrentInput(input),\n Actions = new [] { new LambdaInvokeAction(func) }\n } },\n OnInput = new [] { new Event { // optional\n EventName = \"test-input-event\",\n Actions = new [] { new LambdaInvokeAction(func) } } },\n OnExit = new [] { new Event { // optional\n EventName = \"test-exit-event\",\n Actions = new [] { new LambdaInvokeAction(func) } } }\n});\nState coldState = new State(new StateProps {\n StateName = \"cold\"\n});\n\n// transit to coldState when temperature is 10\nwarmState.TransitionTo(coldState, new TransitionOptions {\n EventName = \"to_coldState\", // optional property, default by combining the names of the States\n When = Expression.Eq(Expression.InputAttribute(input, \"payload.temperature\"), Expression.FromString(\"10\")),\n Executing = new [] { new LambdaInvokeAction(func) }\n});\n// transit to warmState when temperature is 20\ncoldState.TransitionTo(warmState, new TransitionOptions {\n When = Expression.Eq(Expression.InputAttribute(input, \"payload.temperature\"), Expression.FromString(\"20\"))\n});\n\nnew DetectorModel(this, \"MyDetectorModel\", new DetectorModelProps {\n DetectorModelName = \"test-detector-model\", // optional\n Description = \"test-detector-model-description\", // optional property, default is none\n EvaluationMethod = EventEvaluation.SERIAL, // optional property, default is iotevents.EventEvaluation.BATCH\n DetectorKey = \"payload.deviceId\", // optional property, default is none and single detector instance will be created and all inputs will be routed to it\n InitialState = warmState\n});",
|
|
75
|
+
"version": "1"
|
|
76
|
+
},
|
|
77
|
+
"java": {
|
|
78
|
+
"source": "import software.amazon.awscdk.services.iotevents.alpha.*;\nimport software.amazon.awscdk.services.iotevents.actions.alpha.*;\nimport software.amazon.awscdk.services.lambda.*;\n\nIFunction func;\n\n\nInput input = Input.Builder.create(this, \"MyInput\")\n .inputName(\"my_input\") // optional\n .attributeJsonPaths(List.of(\"payload.deviceId\", \"payload.temperature\"))\n .build();\n\nState warmState = State.Builder.create()\n .stateName(\"warm\")\n .onEnter(List.of(Event.builder()\n .eventName(\"test-enter-event\")\n .condition(Expression.currentInput(input))\n .actions(List.of(new LambdaInvokeAction(func)))\n .build()))\n .onInput(List.of(Event.builder() // optional\n .eventName(\"test-input-event\")\n .actions(List.of(new LambdaInvokeAction(func))).build()))\n .onExit(List.of(Event.builder() // optional\n .eventName(\"test-exit-event\")\n .actions(List.of(new LambdaInvokeAction(func))).build()))\n .build();\nState coldState = State.Builder.create()\n .stateName(\"cold\")\n .build();\n\n// transit to coldState when temperature is 10\nwarmState.transitionTo(coldState, TransitionOptions.builder()\n .eventName(\"to_coldState\") // optional property, default by combining the names of the States\n .when(Expression.eq(Expression.inputAttribute(input, \"payload.temperature\"), Expression.fromString(\"10\")))\n .executing(List.of(new LambdaInvokeAction(func)))\n .build());\n// transit to warmState when temperature is 20\ncoldState.transitionTo(warmState, TransitionOptions.builder()\n .when(Expression.eq(Expression.inputAttribute(input, \"payload.temperature\"), Expression.fromString(\"20\")))\n .build());\n\nDetectorModel.Builder.create(this, \"MyDetectorModel\")\n .detectorModelName(\"test-detector-model\") // optional\n .description(\"test-detector-model-description\") // optional property, default is none\n .evaluationMethod(EventEvaluation.SERIAL) // optional property, default is iotevents.EventEvaluation.BATCH\n .detectorKey(\"payload.deviceId\") // optional property, default is none and single detector instance will be created and all inputs will be routed to it\n .initialState(warmState)\n .build();",
|
|
79
|
+
"version": "1"
|
|
80
|
+
},
|
|
81
|
+
"$": {
|
|
82
|
+
"source": "import * as iotevents from '@aws-cdk/aws-iotevents-alpha';\nimport * as actions from '@aws-cdk/aws-iotevents-actions-alpha';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\n\ndeclare const func: lambda.IFunction;\n\nconst input = new iotevents.Input(this, 'MyInput', {\n inputName: 'my_input', // optional\n attributeJsonPaths: ['payload.deviceId', 'payload.temperature'],\n});\n\nconst warmState = new iotevents.State({\n stateName: 'warm',\n onEnter: [{\n eventName: 'test-enter-event',\n condition: iotevents.Expression.currentInput(input),\n actions: [new actions.LambdaInvokeAction(func)], // optional\n }],\n onInput: [{ // optional\n eventName: 'test-input-event',\n actions: [new actions.LambdaInvokeAction(func)],\n }],\n onExit: [{ // optional\n eventName: 'test-exit-event',\n actions: [new actions.LambdaInvokeAction(func)],\n }],\n});\nconst coldState = new iotevents.State({\n stateName: 'cold',\n});\n\n// transit to coldState when temperature is 10\nwarmState.transitionTo(coldState, {\n eventName: 'to_coldState', // optional property, default by combining the names of the States\n when: iotevents.Expression.eq(\n iotevents.Expression.inputAttribute(input, 'payload.temperature'),\n iotevents.Expression.fromString('10'),\n ),\n executing: [new actions.LambdaInvokeAction(func)], // optional\n});\n// transit to warmState when temperature is 20\ncoldState.transitionTo(warmState, {\n when: iotevents.Expression.eq(\n iotevents.Expression.inputAttribute(input, 'payload.temperature'),\n iotevents.Expression.fromString('20'),\n ),\n});\n\nnew iotevents.DetectorModel(this, 'MyDetectorModel', {\n detectorModelName: 'test-detector-model', // optional\n description: 'test-detector-model-description', // optional property, default is none\n evaluationMethod: iotevents.EventEvaluation.SERIAL, // optional property, default is iotevents.EventEvaluation.BATCH\n detectorKey: 'payload.deviceId', // optional property, default is none and single detector instance will be created and all inputs will be routed to it\n initialState: warmState,\n});",
|
|
83
|
+
"version": "0"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"location": {
|
|
87
|
+
"api": {
|
|
88
|
+
"api": "type",
|
|
89
|
+
"fqn": "@aws-cdk/aws-iotevents-actions-alpha.LambdaInvokeAction"
|
|
90
|
+
},
|
|
91
|
+
"field": {
|
|
92
|
+
"field": "example"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"didCompile": true,
|
|
96
|
+
"fqnsReferenced": [
|
|
97
|
+
"@aws-cdk/aws-iotevents-actions-alpha.LambdaInvokeAction",
|
|
98
|
+
"@aws-cdk/aws-iotevents-alpha.DetectorModel",
|
|
99
|
+
"@aws-cdk/aws-iotevents-alpha.DetectorModelProps",
|
|
100
|
+
"@aws-cdk/aws-iotevents-alpha.EventEvaluation",
|
|
101
|
+
"@aws-cdk/aws-iotevents-alpha.EventEvaluation#SERIAL",
|
|
102
|
+
"@aws-cdk/aws-iotevents-alpha.Expression",
|
|
103
|
+
"@aws-cdk/aws-iotevents-alpha.Expression#currentInput",
|
|
104
|
+
"@aws-cdk/aws-iotevents-alpha.Expression#eq",
|
|
105
|
+
"@aws-cdk/aws-iotevents-alpha.Expression#fromString",
|
|
106
|
+
"@aws-cdk/aws-iotevents-alpha.Expression#inputAttribute",
|
|
107
|
+
"@aws-cdk/aws-iotevents-alpha.IInput",
|
|
108
|
+
"@aws-cdk/aws-iotevents-alpha.Input",
|
|
109
|
+
"@aws-cdk/aws-iotevents-alpha.InputProps",
|
|
110
|
+
"@aws-cdk/aws-iotevents-alpha.State",
|
|
111
|
+
"@aws-cdk/aws-iotevents-alpha.State#transitionTo",
|
|
112
|
+
"@aws-cdk/aws-iotevents-alpha.StateProps",
|
|
113
|
+
"@aws-cdk/aws-iotevents-alpha.TransitionOptions",
|
|
114
|
+
"aws-cdk-lib.aws_lambda.IFunction"
|
|
115
|
+
],
|
|
116
|
+
"fullSource": "// Hoisted imports begin after !show marker below\n/// !show\nimport * as iotevents from '@aws-cdk/aws-iotevents-alpha';\nimport * as actions from '@aws-cdk/aws-iotevents-actions-alpha';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\n\ndeclare const func: lambda.IFunction;\n/// !hide\n// Hoisted imports ended before !hide marker above\n// Fixture with packages imported, but nothing else\nimport { Stack } from 'aws-cdk-lib';\nimport { Construct } from 'constructs';\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n // Code snippet begins after !show marker below\n/// !show\n\n\nconst input = new iotevents.Input(this, 'MyInput', {\n inputName: 'my_input', // optional\n attributeJsonPaths: ['payload.deviceId', 'payload.temperature'],\n});\n\nconst warmState = new iotevents.State({\n stateName: 'warm',\n onEnter: [{\n eventName: 'test-enter-event',\n condition: iotevents.Expression.currentInput(input),\n actions: [new actions.LambdaInvokeAction(func)], // optional\n }],\n onInput: [{ // optional\n eventName: 'test-input-event',\n actions: [new actions.LambdaInvokeAction(func)],\n }],\n onExit: [{ // optional\n eventName: 'test-exit-event',\n actions: [new actions.LambdaInvokeAction(func)],\n }],\n});\nconst coldState = new iotevents.State({\n stateName: 'cold',\n});\n\n// transit to coldState when temperature is 10\nwarmState.transitionTo(coldState, {\n eventName: 'to_coldState', // optional property, default by combining the names of the States\n when: iotevents.Expression.eq(\n iotevents.Expression.inputAttribute(input, 'payload.temperature'),\n iotevents.Expression.fromString('10'),\n ),\n executing: [new actions.LambdaInvokeAction(func)], // optional\n});\n// transit to warmState when temperature is 20\ncoldState.transitionTo(warmState, {\n when: iotevents.Expression.eq(\n iotevents.Expression.inputAttribute(input, 'payload.temperature'),\n iotevents.Expression.fromString('20'),\n ),\n});\n\nnew iotevents.DetectorModel(this, 'MyDetectorModel', {\n detectorModelName: 'test-detector-model', // optional\n description: 'test-detector-model-description', // optional property, default is none\n evaluationMethod: iotevents.EventEvaluation.SERIAL, // optional property, default is iotevents.EventEvaluation.BATCH\n detectorKey: 'payload.deviceId', // optional property, default is none and single detector instance will be created and all inputs will be routed to it\n initialState: warmState,\n});\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}",
|
|
117
|
+
"syntaxKindCounter": {
|
|
118
|
+
"10": 21,
|
|
119
|
+
"75": 86,
|
|
120
|
+
"104": 2,
|
|
121
|
+
"130": 1,
|
|
122
|
+
"153": 1,
|
|
123
|
+
"169": 1,
|
|
124
|
+
"192": 8,
|
|
125
|
+
"193": 9,
|
|
126
|
+
"194": 26,
|
|
127
|
+
"196": 9,
|
|
128
|
+
"197": 8,
|
|
129
|
+
"225": 4,
|
|
130
|
+
"226": 3,
|
|
131
|
+
"242": 4,
|
|
132
|
+
"243": 4,
|
|
133
|
+
"254": 3,
|
|
134
|
+
"255": 3,
|
|
135
|
+
"256": 3,
|
|
136
|
+
"281": 23,
|
|
137
|
+
"290": 1
|
|
138
|
+
},
|
|
139
|
+
"fqnsFingerprint": "658afec51a3d6c7dc2d92525fd6212704345425598e407de7b9ccaa5b779567b"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
package/.warnings.jsii.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function _aws_cdk_aws_iotevents_actions_alpha_LambdaInvokeAction(p) {
|
|
2
|
+
}
|
|
1
3
|
function print(name, deprecationMessage) {
|
|
2
4
|
const deprecated = process.env.JSII_DEPRECATED;
|
|
3
5
|
const deprecationMode = ["warn", "fail", "quiet"].includes(deprecated) ? deprecated : "warn";
|
|
@@ -13,5 +15,5 @@ function print(name, deprecationMessage) {
|
|
|
13
15
|
const visitedObjects = new Set();
|
|
14
16
|
class DeprecationError extends Error {
|
|
15
17
|
}
|
|
16
|
-
module.exports = { print };
|
|
18
|
+
module.exports = { print, _aws_cdk_aws_iotevents_actions_alpha_LambdaInvokeAction };
|
|
17
19
|
module.exports.DeprecationError = DeprecationError;
|
package/README.md
CHANGED
|
@@ -18,3 +18,33 @@
|
|
|
18
18
|
This library contains integration classes to specify actions of state events of Detector Model in `@aws-cdk/aws-iotevents`.
|
|
19
19
|
Instances of these classes should be passed to `State` defined in `@aws-cdk/aws-iotevents`
|
|
20
20
|
You can define built-in actions to use a timer or set a variable, or send data to other AWS resources.
|
|
21
|
+
|
|
22
|
+
This library contains integration classes to use a timer or set a variable, or send data to other AWS resources.
|
|
23
|
+
AWS IoT Events can trigger actions when it detects a specified event or transition event.
|
|
24
|
+
|
|
25
|
+
Currently supported are:
|
|
26
|
+
|
|
27
|
+
- Invoke a Lambda function
|
|
28
|
+
|
|
29
|
+
## Invoke a Lambda function
|
|
30
|
+
|
|
31
|
+
The code snippet below creates an Action that invoke a Lambda function
|
|
32
|
+
when it is triggered.
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import * as iotevents from '@aws-cdk/aws-iotevents-alpha';
|
|
36
|
+
import * as actions from '@aws-cdk/aws-iotevents-actions-alpha';
|
|
37
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
38
|
+
|
|
39
|
+
declare const input: iotevents.IInput;
|
|
40
|
+
declare const func: lambda.IFunction;
|
|
41
|
+
|
|
42
|
+
const state = new iotevents.State({
|
|
43
|
+
stateName: 'MyState',
|
|
44
|
+
onEnter: [{
|
|
45
|
+
eventName: 'test-event',
|
|
46
|
+
condition: iotevents.Expression.currentInput(input),
|
|
47
|
+
actions: [new actions.LambdaInvokeAction(func)],
|
|
48
|
+
}],
|
|
49
|
+
});
|
|
50
|
+
```
|
package/lib/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './lambda-invoke-action';
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
exports.dummy = true;
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxrQ0FBa0M7QUFDckIsUUFBQSxLQUFLLEdBQUcsSUFBSSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLy8gdGhpcyBpcyBwbGFjZWhvbGRlciBmb3IgbW9ub2Nka1xuZXhwb3J0IGNvbnN0IGR1bW15ID0gdHJ1ZTtcbiJdfQ==
|
|
13
|
+
__exportStar(require("./lambda-invoke-action"), exports);
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSx5REFBdUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2xhbWJkYS1pbnZva2UtYWN0aW9uJztcbiJdfQ==
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as iotevents from '@aws-cdk/aws-iotevents-alpha';
|
|
2
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
3
|
+
import { Construct } from 'constructs';
|
|
4
|
+
/**
|
|
5
|
+
* The action to write the data to an AWS Lambda function.
|
|
6
|
+
*/
|
|
7
|
+
export declare class LambdaInvokeAction implements iotevents.IAction {
|
|
8
|
+
private readonly func;
|
|
9
|
+
/**
|
|
10
|
+
* @param func the AWS Lambda function to be invoked by this action
|
|
11
|
+
*/
|
|
12
|
+
constructor(func: lambda.IFunction);
|
|
13
|
+
bind(_scope: Construct, options: iotevents.ActionBindOptions): iotevents.ActionConfig;
|
|
14
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.LambdaInvokeAction = void 0;
|
|
5
|
+
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
|
6
|
+
/**
|
|
7
|
+
* The action to write the data to an AWS Lambda function.
|
|
8
|
+
*/
|
|
9
|
+
class LambdaInvokeAction {
|
|
10
|
+
/**
|
|
11
|
+
* @param func the AWS Lambda function to be invoked by this action
|
|
12
|
+
*/
|
|
13
|
+
constructor(func) {
|
|
14
|
+
this.func = func;
|
|
15
|
+
}
|
|
16
|
+
bind(_scope, options) {
|
|
17
|
+
this.func.grantInvoke(options.role);
|
|
18
|
+
return {
|
|
19
|
+
configuration: {
|
|
20
|
+
lambda: {
|
|
21
|
+
functionArn: this.func.functionArn,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.LambdaInvokeAction = LambdaInvokeAction;
|
|
28
|
+
_a = JSII_RTTI_SYMBOL_1;
|
|
29
|
+
LambdaInvokeAction[_a] = { fqn: "@aws-cdk/aws-iotevents-actions-alpha.LambdaInvokeAction", version: "2.16.0-alpha.0" };
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGFtYmRhLWludm9rZS1hY3Rpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJsYW1iZGEtaW52b2tlLWFjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUlBOztHQUVHO0FBQ0gsTUFBYSxrQkFBa0I7SUFDN0I7O09BRUc7SUFDSCxZQUE2QixJQUFzQjtRQUF0QixTQUFJLEdBQUosSUFBSSxDQUFrQjtLQUNsRDtJQUVELElBQUksQ0FBQyxNQUFpQixFQUFFLE9BQW9DO1FBQzFELElBQUksQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUNwQyxPQUFPO1lBQ0wsYUFBYSxFQUFFO2dCQUNiLE1BQU0sRUFBRTtvQkFDTixXQUFXLEVBQUUsSUFBSSxDQUFDLElBQUksQ0FBQyxXQUFXO2lCQUNuQzthQUNGO1NBQ0YsQ0FBQztLQUNIOztBQWhCSCxnREFpQkMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpb3RldmVudHMgZnJvbSAnQGF3cy1jZGsvYXdzLWlvdGV2ZW50cy1hbHBoYSc7XG5pbXBvcnQgKiBhcyBsYW1iZGEgZnJvbSAnYXdzLWNkay1saWIvYXdzLWxhbWJkYSc7XG5pbXBvcnQgeyBDb25zdHJ1Y3QgfSBmcm9tICdjb25zdHJ1Y3RzJztcblxuLyoqXG4gKiBUaGUgYWN0aW9uIHRvIHdyaXRlIHRoZSBkYXRhIHRvIGFuIEFXUyBMYW1iZGEgZnVuY3Rpb24uXG4gKi9cbmV4cG9ydCBjbGFzcyBMYW1iZGFJbnZva2VBY3Rpb24gaW1wbGVtZW50cyBpb3RldmVudHMuSUFjdGlvbiB7XG4gIC8qKlxuICAgKiBAcGFyYW0gZnVuYyB0aGUgQVdTIExhbWJkYSBmdW5jdGlvbiB0byBiZSBpbnZva2VkIGJ5IHRoaXMgYWN0aW9uXG4gICAqL1xuICBjb25zdHJ1Y3Rvcihwcml2YXRlIHJlYWRvbmx5IGZ1bmM6IGxhbWJkYS5JRnVuY3Rpb24pIHtcbiAgfVxuXG4gIGJpbmQoX3Njb3BlOiBDb25zdHJ1Y3QsIG9wdGlvbnM6IGlvdGV2ZW50cy5BY3Rpb25CaW5kT3B0aW9ucyk6IGlvdGV2ZW50cy5BY3Rpb25Db25maWcge1xuICAgIHRoaXMuZnVuYy5ncmFudEludm9rZShvcHRpb25zLnJvbGUpO1xuICAgIHJldHVybiB7XG4gICAgICBjb25maWd1cmF0aW9uOiB7XG4gICAgICAgIGxhbWJkYToge1xuICAgICAgICAgIGZ1bmN0aW9uQXJuOiB0aGlzLmZ1bmMuZnVuY3Rpb25Bcm4sXG4gICAgICAgIH0sXG4gICAgICB9LFxuICAgIH07XG4gIH1cbn1cbiJdfQ==
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-cdk/aws-iotevents-actions-alpha",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0-alpha.0",
|
|
4
4
|
"description": "Receipt Detector Model actions for AWS IoT Events",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -74,18 +74,20 @@
|
|
|
74
74
|
},
|
|
75
75
|
"license": "Apache-2.0",
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@aws-cdk/cdk-build-tools": "2.
|
|
78
|
-
"@aws-cdk/cdk-integ-tools": "2.
|
|
79
|
-
"@aws-cdk/pkglint": "2.
|
|
80
|
-
"@types/jest": "^27.4.
|
|
77
|
+
"@aws-cdk/cdk-build-tools": "2.16.0",
|
|
78
|
+
"@aws-cdk/cdk-integ-tools": "2.16.0",
|
|
79
|
+
"@aws-cdk/pkglint": "2.16.0",
|
|
80
|
+
"@types/jest": "^27.4.1",
|
|
81
81
|
"jest": "^27.5.1",
|
|
82
|
-
"aws-cdk-lib": "2.
|
|
83
|
-
"constructs": "^10.0.0"
|
|
82
|
+
"aws-cdk-lib": "2.16.0",
|
|
83
|
+
"constructs": "^10.0.0",
|
|
84
|
+
"@aws-cdk/aws-iotevents-alpha": "2.16.0-alpha.0"
|
|
84
85
|
},
|
|
85
86
|
"dependencies": {},
|
|
86
87
|
"homepage": "https://github.com/aws/aws-cdk",
|
|
87
88
|
"peerDependencies": {
|
|
88
|
-
"aws-cdk-
|
|
89
|
+
"@aws-cdk/aws-iotevents-alpha": "2.16.0-alpha.0",
|
|
90
|
+
"aws-cdk-lib": "^2.16.0",
|
|
89
91
|
"constructs": "^10.0.0"
|
|
90
92
|
},
|
|
91
93
|
"engines": {
|