Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(iotevents): support SetVariable action #19305

Merged
merged 4 commits into from
Mar 11, 2022

Conversation

yamatatsu
Copy link
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

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
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
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
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 🙂.

packages/@aws-cdk/aws-iotevents-actions/README.md Outdated Show resolved Hide resolved
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
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
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
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