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

chore(kinesisfirehose-alpha): replacedestinations property with destination and change type from array to single IDestination #31630

Merged
merged 10 commits into from
Oct 4, 2024
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-iot-actions-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ import * as destinations from '@aws-cdk/aws-kinesisfirehose-destinations-alpha';

const bucket = new s3.Bucket(this, 'MyBucket');
const stream = new firehose.DeliveryStream(this, 'MyStream', {
destinations: [new destinations.S3Bucket(bucket)],
destination: new destinations.S3Bucket(bucket),
});

const topicRule = new iot.TopicRule(this, 'TopicRule', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TestStack extends cdk.Stack {
removalPolicy: cdk.RemovalPolicy.DESTROY,
});
const stream = new firehose.DeliveryStream(this, 'MyStream', {
destinations: [new destinations.S3Bucket(bucket)],
destination: new destinations.S3Bucket(bucket),
});
topicRule.addAction(
new actions.FirehosePutRecordAction(stream, {
Expand Down
37 changes: 17 additions & 20 deletions packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ used as a destination. More supported destinations are covered [below](#destinat
```ts
const bucket = new s3.Bucket(this, 'Bucket');
new firehose.DeliveryStream(this, 'Delivery Stream', {
destinations: [new destinations.S3Bucket(bucket)],
destination: new destinations.S3Bucket(bucket),
});
```

Expand Down Expand Up @@ -71,7 +71,7 @@ declare const destination: firehose.IDestination;
const sourceStream = new kinesis.Stream(this, 'Source Stream');
new firehose.DeliveryStream(this, 'Delivery Stream', {
sourceStream: sourceStream,
destinations: [destination],
destination: destination,
});
```

Expand Down Expand Up @@ -108,7 +108,7 @@ declare const bucket: s3.Bucket;
const s3Destination = new destinations.S3Bucket(bucket);

new firehose.DeliveryStream(this, 'Delivery Stream', {
destinations: [s3Destination],
destination: s3Destination,
});
```

Expand Down Expand Up @@ -154,18 +154,18 @@ declare const destination: firehose.IDestination;
// SSE with an AWS-owned key
new firehose.DeliveryStream(this, 'Delivery Stream AWS Owned', {
encryption: firehose.StreamEncryption.awsOwnedKey(),
destinations: [destination],
destination: destination,
});
// SSE with an customer-managed key that is created automatically by the CDK
new firehose.DeliveryStream(this, 'Delivery Stream Implicit Customer Managed', {
encryption: firehose.StreamEncryption.customerManagedKey(),
destinations: [destination],
destination: destination,
});
// SSE with an customer-managed key that is explicitly specified
declare const key: kms.Key;
new firehose.DeliveryStream(this, 'Delivery Stream Explicit Customer Managed', {
encryption: firehose.StreamEncryption.customerManagedKey(key),
destinations: [destination],
destination: destination,
});
```

Expand Down Expand Up @@ -196,7 +196,7 @@ const destination = new destinations.S3Bucket(bucket, {
});

new firehose.DeliveryStream(this, 'Delivery Stream', {
destinations: [destination],
destination: destination,
});
```

Expand All @@ -208,7 +208,7 @@ const destination = new destinations.S3Bucket(bucket, {
loggingConfig: new destinations.DisableLogging(),
});
new firehose.DeliveryStream(this, 'Delivery Stream', {
destinations: [destination],
destination: destination,
});
```

Expand Down Expand Up @@ -271,7 +271,7 @@ const s3Destination = new destinations.S3Bucket(bucket, {
compression: destinations.Compression.SNAPPY,
});
new firehose.DeliveryStream(this, 'Delivery Stream', {
destinations: [s3Destination],
destination: s3Destination,
});
```

Expand All @@ -292,7 +292,7 @@ const destination = new destinations.S3Bucket(bucket, {
bufferingSize: Size.mebibytes(8),
});
new firehose.DeliveryStream(this, 'Delivery Stream', {
destinations: [destination],
destination: destination,
});
```

Expand All @@ -309,7 +309,7 @@ const destination = new destinations.S3Bucket(bucket, {
bufferingInterval: Duration.seconds(0),
});
new firehose.DeliveryStream(this, 'ZeroBufferDeliveryStream', {
destinations: [destination],
destination: destination,
});
```

Expand All @@ -332,7 +332,7 @@ const destination = new destinations.S3Bucket(bucket, {
encryptionKey: key,
});
new firehose.DeliveryStream(this, 'Delivery Stream', {
destinations: [destination],
destination: destination,
});
```

Expand All @@ -350,35 +350,32 @@ backed up to S3.
// Enable backup of all source records (to an S3 bucket created by CDK).
declare const bucket: s3.Bucket;
new firehose.DeliveryStream(this, 'Delivery Stream Backup All', {
destinations: [
destination:
new destinations.S3Bucket(bucket, {
s3Backup: {
mode: destinations.BackupMode.ALL,
},
}),
],
});
// Explicitly provide an S3 bucket to which all source records will be backed up.
declare const backupBucket: s3.Bucket;
new firehose.DeliveryStream(this, 'Delivery Stream Backup All Explicit Bucket', {
destinations: [
destination:
new destinations.S3Bucket(bucket, {
s3Backup: {
bucket: backupBucket,
},
}),
],
});
// Explicitly provide an S3 prefix under which all source records will be backed up.
new firehose.DeliveryStream(this, 'Delivery Stream Backup All Explicit Prefix', {
destinations: [
destination:
new destinations.S3Bucket(bucket, {
s3Backup: {
mode: destinations.BackupMode.ALL,
dataOutputPrefix: 'mybackup',
},
}),
],
});
```

Expand Down Expand Up @@ -431,7 +428,7 @@ const s3Destination = new destinations.S3Bucket(bucket, {
processor: lambdaProcessor,
});
new firehose.DeliveryStream(this, 'Delivery Stream', {
destinations: [s3Destination],
destination: s3Destination,
});
```

Expand Down Expand Up @@ -473,7 +470,7 @@ const destinationRole = new iam.Role(this, 'Destination Role', {
declare const bucket: s3.Bucket;
const destination = new destinations.S3Bucket(bucket, { role: destinationRole });
new firehose.DeliveryStream(this, 'Delivery Stream', {
destinations: [destination],
destination: destination,
role: deliveryStreamRole,
});
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,9 @@ export enum StreamEncryptionType {
*/
export interface DeliveryStreamProps {
/**
* The destinations that this delivery stream will deliver data to.
*
* Only a singleton array is supported at this time.
* The destination that this delivery stream will deliver data to.
*/
readonly destinations: IDestination[];
readonly destination: IDestination;

/**
* A name for the delivery stream.
Expand Down Expand Up @@ -324,10 +322,6 @@ export class DeliveryStream extends DeliveryStreamBase {

this._role = props.role;

if (props.destinations.length !== 1) {
throw new Error(`Only one destination is allowed per delivery stream, given ${props.destinations.length}`);
}

if (props.encryption?.encryptionKey || props.sourceStream) {
this._role = this._role ?? new iam.Role(this, 'Service Role', {
assumedBy: new iam.ServicePrincipal('firehose.amazonaws.com'),
Expand Down Expand Up @@ -369,7 +363,7 @@ export class DeliveryStream extends DeliveryStreamBase {
readStreamGrant = props.sourceStream.grantRead(this._role);
}

const destinationConfig = props.destinations[0].bind(this, {});
const destinationConfig = props.destination.bind(this, {});

const resource = new CfnDeliveryStream(this, 'Resource', {
deliveryStreamEncryptionConfigurationInput: encryptionConfig,
Expand Down
Loading