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): add Action to forward message attributes to Location #24060

Closed
wants to merge 36 commits into from

Conversation

sthuber90
Copy link

Aims to add IoT action to integrate with Location service through L2 construct.

The construct depends on CfnTracker from aws_location. I tried to import it with import { CfnTracker } from '@aws-cdk/aws-location' but without the following exclude in package.json yarn build failed.

{
   // ...
   "pkglint": {
       "exclude": [
         "no-experimental-dependencies"
       ]
    }
}

According to the docs the location module is not experimental but there is a location-alpha module. So any info on how I need to import the location module to get rid of the include is greatly appreciated.

Closes #24035.


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 Feb 7, 2023

@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels Feb 7, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team February 7, 2023 22:13
Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! Overall this looks great, I just have some comments inline.

For a second opinion, @yamatatsu, you've been leading the charge on IoT modules, could you take a look through this and provide feedback as well? I think you understand the service much better than I do.

@mergify mergify bot dismissed TheRealAmazonKendra’s stale review February 10, 2023 08:38

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@sthuber90
Copy link
Author

@yamatatsu would be great if we could merge this soon so that I don't have to update the PR after another refactor again

Copy link
Contributor

@yamatatsu yamatatsu left a comment

Choose a reason for hiding this comment

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

@TheRealAmazonKendra
Thanks for the mention!! And so sorry for the delay 🙇🏻.

@sthuber90
Thanks for the re-mention!! 🙏🏻
I have made some comments including minor style comments, learning from comments I have received from maintainers in the past😉.

packages/@aws-cdk/aws-iot-actions/lib/location-action.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-iot-actions/lib/location-action.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-iot-actions/lib/location-action.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-iot-actions/lib/location-action.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-iot-actions/lib/location-action.ts Outdated Show resolved Hide resolved
Comment on lines 140 to 145
Timestamp: this.timestamp
? { Value: this.timestamp.value, Unit: this.timestamp.unit }
: {
Value: '${timestamp()}',
Unit: LocationTimestampUnit.MILLISECONDS,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Timestamp has the default behabior defined by AWS as written in CFn documentation:

The default value is the time the MQTT message was processed.

So I would prefer not to define the cdk original default behabior. Otherwise, if user want to use the default behaior, the user will have to set as Timestamp: {}.

Copy link
Author

Choose a reason for hiding this comment

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

Hope I moved this more into the direction that you envisioned. Hope to get rid of this override soon

packages/@aws-cdk/aws-iot-actions/lib/location-action.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-iot-actions/lib/location-action.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-iot-actions/lib/location-action.ts Outdated Show resolved Hide resolved
Comment on lines 133 to 134
const topicRule = rule.node.defaultChild as CfnTopicRule;
topicRule.addOverride('Properties.TopicRulePayload.Actions.0', {
Copy link
Contributor

Choose a reason for hiding this comment

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

This workaround will probably not work when using this action for second action of TopicRile because of Actions.0.

But I don’t know alternative…

Copy link
Contributor

Choose a reason for hiding this comment

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

It is maybe difficult to implement this action without fixing this issue I think...

Copy link
Author

Choose a reason for hiding this comment

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

Fully agree with you but also couldn't come up with a better workaround

Copy link
Author

Choose a reason for hiding this comment

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

Thank you very much for your review. I really appreciate all your feedback

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

1 similar comment
@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

* @param tracker The Amazon Location tracker to which to write data.
* @param props Optional properties to not use default
*/
constructor(private readonly tracker: location.CfnTracker, props: LocationActionProps) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't want to expose any L1s in an L2. For this PR we will need to implement an L2 for CfnTracker as well.

Copy link
Author

Choose a reason for hiding this comment

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

I will try to add a L2 for the Location Tracker but will that be ok? The contribution guideline says that a new L2 must reference a RFC

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like location tracker is a pretty simple resource and we already have an alpha module for location so we can skip the RFC.

@mergify mergify bot dismissed corymhall’s stale review May 4, 2023 21:38

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label May 4, 2023
Copy link
Contributor

@corymhall corymhall left a comment

Choose a reason for hiding this comment

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

putting back in request changes. Feel free to also change this to a draft if you don't plan on working on it soon.

@corymhall corymhall removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label May 24, 2023
@sthuber90 sthuber90 marked this pull request as draft June 13, 2023 08:03
@mergify mergify bot dismissed corymhall’s stale review June 13, 2023 08:03

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 8850a6e
  • Result: FAILED
  • Build Logs (available for 30 days)

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

@sthuber90 sthuber90 closed this Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(iot): TopicRule action for Location
5 participants