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(iot): Action to send messages to SQS queues #18087

Merged
merged 22 commits into from
Jan 4, 2022

Conversation

dyoshikawa
Copy link
Contributor

@dyoshikawa dyoshikawa commented Dec 19, 2021

Fixes #17699


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 Dec 19, 2021

@mergify
Copy link
Contributor

mergify bot commented Dec 19, 2021

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@skinny85
Copy link
Contributor

@dyoshikawa is this ready for a review, or are you still working on it?

@dyoshikawa
Copy link
Contributor Author

Sorry, I working now, so not ready for review.

@dyoshikawa dyoshikawa changed the title WIP aws-iot-actions sqs [WIP]feat(iot): Add Action to send messages in SQS queues #17699 Dec 31, 2021
@github-actions github-actions bot added the @aws-cdk/aws-iot Related to AWS IoT label Dec 31, 2021
@dyoshikawa dyoshikawa marked this pull request as ready for review December 31, 2021 15:21
@dyoshikawa dyoshikawa changed the title [WIP]feat(iot): Add Action to send messages in SQS queues #17699 feat(iot): Add Action to send messages in SQS queues #17699 Dec 31, 2021
@dyoshikawa
Copy link
Contributor Author

@skinny85 Ready for review now.

@dyoshikawa dyoshikawa changed the title feat(iot): Add Action to send messages in SQS queues #17699 feat(iot): Add Action to send messages in SQS queues Jan 1, 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 @dyoshikawa! I have one major comment about naming, and then a few minor ones, but this is great.

Comment on lines 225 to 227
const stream = new firehose.DeliveryStream(this, 'MyStream', {
destinations: [new destinations.S3Bucket(bucket)],
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this example contain a Firehose DeliveryStream? It's not used anywhere from what I can see.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I fixed.

/**
* Configuration properties of an action for s3.
*/
export interface SQSQueueActionProps extends CommonActionProps {
Copy link
Contributor

Choose a reason for hiding this comment

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

We camel-case acronyms in CDK:

Suggested change
export interface SQSQueueActionProps extends CommonActionProps {
export interface SqsQueueActionProps extends CommonActionProps {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I fixed.

/**
* The action to write the data from an MQTT message to an Amazon SQS queue.
*/
export class SQSQueueAction implements iot.IAction {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export class SQSQueueAction implements iot.IAction {
export class SqsQueueAction implements iot.IAction {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I fixed.

Comment on lines 22 to 24
topicRule.addAction(
new actions.SQSQueueAction(queue),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
topicRule.addAction(
new actions.SQSQueueAction(queue),
);
topicRule.addAction(new actions.SQSQueueAction(queue));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I fixed.

import * as cdk from '@aws-cdk/core';
import * as actions from '../../lib';

test('Default sqs queue action', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
test('Default sqs queue action', () => {
test('Default SQS queue action', () => {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I fixed.

Comment on lines 17 to 19
topicRule.addAction(
new actions.SQSQueueAction(queue),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
topicRule.addAction(
new actions.SQSQueueAction(queue),
);
topicRule.addAction(new actions.SQSQueueAction(queue));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I fixed.

Comment on lines 93 to 97
topicRule.addAction(
new actions.SQSQueueAction(queue, {
useBase64: true,
}),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
topicRule.addAction(
new actions.SQSQueueAction(queue, {
useBase64: true,
}),
);
topicRule.addAction(new actions.SQSQueueAction(queue, {
useBase64: true,
}));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I fixed.

Comment on lines 119 to 121
topicRule.addAction(
new actions.SQSQueueAction(queue, { role }),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
topicRule.addAction(
new actions.SQSQueueAction(queue, { role }),
);
topicRule.addAction(new actions.SQSQueueAction(queue, { role }));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I fixed.

@mergify mergify bot dismissed skinny85’s stale review January 4, 2022 02:06

Pull request has been modified.

@dyoshikawa
Copy link
Contributor Author

@skinny85 Thank you for your review. I fixed by your advices. Can you review one more time?

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 good @dyoshikawa! A few las tiny details, and we can get this merged in!

packages/@aws-cdk/aws-iot-actions/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-iot-actions/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-iot-actions/README.md Outdated Show resolved Hide resolved
const topicRule = new iot.TopicRule(stack, 'MyTopicRule', {
sql: iot.IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id FROM 'device/+/data'"),
});
const queue = sqs.Queue.fromQueueArn(stack, 'MyQueue', 'arn:aws:s3::123456789012:test-queue');
Copy link
Contributor

Choose a reason for hiding this comment

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

s3 is probably the wrong service name here 🙂.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I fixed.

@dyoshikawa
Copy link
Contributor Author

@skinny85 Thank you so much for your reviews. I fixed all, so can you review?

@skinny85 skinny85 changed the title feat(iot): Add Action to send messages in SQS queues feat(iot): Action to send messages to SQS queues Jan 4, 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.

Fantastic contribution, thanks for working on this @dyoshikawa!

@mergify mergify bot merged commit 37537fe into aws:master Jan 4, 2022
@mergify
Copy link
Contributor

mergify bot commented Jan 4, 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: a7e8542
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
Fixes aws#17699

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(iot): TopicRule action for SQS in AWS IoT
3 participants