-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
chore(kinesisfirehose-alpha): refactor encryption property to combine encryptionKey #31430
chore(kinesisfirehose-alpha): refactor encryption property to combine encryptionKey #31430
Conversation
/** | ||
* Constructor for StreamEncryption. | ||
* | ||
* @param type The type of server-side encryption for the Kinesis Firehose delivery stream. | ||
* @param encryptionKey Optional KMS key used for customer managed encryption. | ||
*/ |
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.
Added to deal with awslint errors:
error: [awslint:docs-public-apis:@aws-cdk/aws-kinesisfirehose-alpha.StreamEncryption.type] Public API element must have a docstring
error: [awslint:docs-public-apis:@aws-cdk/aws-kinesisfirehose-alpha.StreamEncryption.encryptionKey] Public API element must have a docstring
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.
What's the purpose for this change? Is there an issue about the current usage?
packages/@aws-cdk/aws-kinesisfirehose-alpha/lib/delivery-stream.ts
Outdated
Show resolved
Hide resolved
const key = new kms.Key(stack, 'Key'); | ||
|
||
new firehose.DeliveryStream(stack, 'Delivery Stream', { | ||
destinations: [mockS3Destination], | ||
encryptionKey: key, | ||
encryption: StreamEncryption.customerManagedKey(key), |
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.
This pattern feels a bit off to me. StreamEncryption
usage sounds like a ENUM to me but the actual usage is calling a statis method.
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.
This is the same pattern that's being used for TableV2's encryption here.
@GavinZZ the main issue with the current usage is that it requires the user to know when it is appropriate to pass in an i.e. passing in an |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
Reason for this change
The previous
encryption
andencryptionKey
properties required error handling to enforce when anencryptionKey
could be specified and when it was invalid (only valid when usingCUSTOMER_MANAGED_KEY
).The properties should be combined to make this user experience more straightforward and only allow a KMS key to be passed in when using a customer-managed key.
Description of changes
BREAKING CHANGE:
encryptionKey
property is removed andencryption
property type has changed from theStreamEncryption
enum to theStreamEncryption
class.To pass in a KMS key for the customer managed key case, use
StreamEncryption.customerManagedKey(key)
Details
Replaced
encryption
andencryptionKey
properties with a single propertyencryption
of typeStreamEncryption
and is used by calling one of the 3 methods:This makes it so it's not longer possible to pass in a key when the encryption type is AWS owned or unencrypted. The
key
is an optional parameter inStreamEncryption.customerManagedKey(key?: IKey)
so following the previous behaviour, if a key is provided it will be used, otherwise a key will be created for the user.Description of how you validated changes
Generated templates do not change so behaviour remains the same.
Updated integ/unit tests.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license