Skip to content

feat(iotevents): support SetVariable action#19305

Merged
mergify[bot] merged 4 commits intoaws:masterfrom
yamatatsu:iotevents-variable
Mar 11, 2022
Merged

feat(iotevents): support SetVariable action#19305
mergify[bot] merged 4 commits intoaws:masterfrom
yamatatsu:iotevents-variable

Conversation

@yamatatsu
Copy link
Copy Markdown
Contributor

This PR implememts SetVariable actions.
This action allow to set variable to detector instanse.

If use this action as following and deploy it:

actions: [
  new actions.IoteventsSetVariableAction(
    'MyVariable',
    iotevents.Expression.inputAttribute(input, 'payload.temperature'),
  ),
],

And send message via cli as following:

aws iotevents-data batch-put-message --messages=messageId=(date | md5),inputName=test_input,payload=(echo '{"payload":{"deviceId":"000","temperature":18.5}}' | base64)

You can see the created detector instanse on web console:
image


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented Mar 9, 2022

@github-actions github-actions bot added the @aws-cdk/aws-iotevents Related to AWS IoT Events label Mar 9, 2022
Copy link
Copy Markdown
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @yamatatsu, let's just settle on a good name!

/**
* The action to create a variable with a specified value.
*/
export class IoteventsSetVariableAction implements iotevents.IAction {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's with the weird name? Why the weird Iotevents prefix?

I think this should be called just SetVariableAction.

I could be convinced to IotSetVariableAction or IotEventsSetVariableAction, but in my opinion, the Iot / IotEvents prefix doesn't add anything here.

@mergify mergify bot dismissed skinny85’s stale review March 10, 2022 10:28

Pull request has been modified.

@yamatatsu yamatatsu requested a review from skinny85 March 10, 2022 13:31
Copy link
Copy Markdown
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tiny change 🙂.

skinny85
skinny85 previously approved these changes Mar 11, 2022
@mergify mergify bot dismissed skinny85’s stale review March 11, 2022 01:21

Pull request has been modified.

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 11, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 154f68e
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit c222b12 into aws:master Mar 11, 2022
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 11, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

TheRealAmazonKendra pushed a commit to TheRealAmazonKendra/aws-cdk that referenced this pull request Mar 11, 2022
This PR implememts `SetVariable` actions.
This action allow to set variable to detector instanse.

If use this action as following and deploy it:
```ts
actions: [
  new actions.IoteventsSetVariableAction(
    'MyVariable',
    iotevents.Expression.inputAttribute(input, 'payload.temperature'),
  ),
],
```

And send message via cli as following:
```
aws iotevents-data batch-put-message --messages=messageId=(date | md5),inputName=test_input,payload=(echo '{"payload":{"deviceId":"000","temperature":18.5}}' | base64)
```

You can see the created detector instanse on web console:
![image](https://user-images.githubusercontent.com/11013683/157444640-c93e4229-ba75-46dd-8d35-cd171fed6145.png)


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@yamatatsu yamatatsu deleted the iotevents-variable branch April 6, 2022 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@aws-cdk/aws-iotevents Related to AWS IoT Events

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants