You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(kinesisfirehose-alpha): refactor encryption property to combine encryptionKey (#31430)
### Reason for this change
The previous `encryption` and `encryptionKey` properties required error handling to enforce when an `encryptionKey` could be specified and when it was invalid (only valid when using `CUSTOMER_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 and `encryption` property type has changed from the `StreamEncryption` enum to the `StreamEncryption` class.
To pass in a KMS key for the customer managed key case, use `StreamEncryption.customerManagedKey(key)`
#### Details
Replaced `encryption` and `encryptionKey` properties with a single property `encryption` of type `StreamEncryption` and is used by calling one of the 3 methods:
```ts
SreamEncryption.unencrypted()
StreamEncryption.awsOwnedKey()
StreamEncryption.customerManagedKey(key?: IKey)
```
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 in `StreamEncryption.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
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
* Indicates the type of customer master key (CMK) to use for server-side encryption, if any.
218
219
*
219
-
* @default StreamEncryption.UNENCRYPTED - unless `encryptionKey` is provided, in which case this will be implicitly set to `StreamEncryption.CUSTOMER_MANAGED`
220
+
* @default StreamEncryption.unencrypted()
220
221
*/
221
222
readonlyencryption?: StreamEncryption;
222
-
223
-
/**
224
-
* Customer managed key to server-side encrypt data in the stream.
225
-
*
226
-
* @default - no KMS key will be used; if `encryption` is set to `CUSTOMER_MANAGED`, a KMS key will be created for you
227
-
*/
228
-
readonlyencryptionKey?: kms.IKey;
229
223
}
230
224
231
225
/**
@@ -334,23 +328,20 @@ export class DeliveryStream extends DeliveryStreamBase {
334
328
thrownewError(`Only one destination is allowed per delivery stream, given ${props.destinations.length}`);
thrownewError('Requested server-side encryption but delivery stream source is a Kinesis data stream. Specify server-side encryption on the data stream instead.');
})).toThrowError('Requested server-side encryption but delivery stream source is a Kinesis data stream. Specify server-side encryption on the data stream instead.');
})).toThrowError('Requested server-side encryption but delivery stream source is a Kinesis data stream. Specify server-side encryption on the data stream instead.');
})).toThrowError('Requested server-side encryption but delivery stream source is a Kinesis data stream. Specify server-side encryption on the data stream instead.');
0 commit comments