-
Notifications
You must be signed in to change notification settings - Fork 4k
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
aws-cdk-kinesis: Implement Kinesis Stream L2 construct. #86
Conversation
…or generated/user-supplied KMS encryption keys, and import/export across stacks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks 🥇 - minor fixes and merge!
packages/aws-cdk-kinesis/.gitignore
Outdated
*.d.ts | ||
node_modules | ||
dist | ||
tsconfig.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add tslint.json (new)
packages/aws-cdk-kinesis/README.md
Outdated
assert(stream.encryptionKey === myKmsKey); | ||
``` | ||
|
||
### Importing and Exporting Streams |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be redundant to describe this idiom in every README.
@Doug-AWS can you create a doc topic on "importing and exporting constructs across stacks" and have that content there?
); | ||
} | ||
|
||
private grant(identity: IIdentityResource, streamActions: string[], keyActions: string[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve the readability at the call site, I would bundle these into an interface:
grant(identity: IIdentityResource, actions: { streamActions: string[], keyActions: string[] }) {
// ...
}
Then, the call site will look like this:
grant(role, {
streamActions: [ ... ],
keyActions: [ ... ]
});
/** | ||
* An arbitrary set of tags (key–value pairs) to associate with the Kinesis stream. | ||
*/ | ||
tags?: Array<Token | Tag> | Token; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove for now, we will introduce tags across the board (#91)
this.streamName = this.stream.ref; | ||
this.encryptionKey = encryptionKey; | ||
|
||
if (props.streamName) { this.addMetadata('aws:cdk:hasPhysicalName', props.streamName); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Streams should also implement Take a look at the events framework. |
From what I can understand, I also need to add support for AWS::Lambda::EventSourceMapping so it's easy to attach a function to it. Would this belong in the stream package or lambda? |
That's interesting and sounds like a the design of our CWE programming model. The ability to include a specifier when adding a target sounds like something we should add to the framework and not special-case for Kinesis. Let's punt that to a subsequent PR and discuss over as issue. Can you open one?
It should probably be layered. Lambda should have a polymorphic method (i.e. anything that implements lambda.addEventSource(source) And then, stream.attachToLambda(lambda) // or streamToLambda or invokeLambda, use the same terminology as the one in Kinesis docs? Which will Do The Right Thing:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job, looks awesome!
Implement a L2 construct for a Kinesis stream:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.