diff --git a/packages/@aws-cdk/aws-pipes-targets-alpha/lib/kinesis.ts b/packages/@aws-cdk/aws-pipes-targets-alpha/lib/kinesis.ts index ffa4dc4eb8a28..6325d953f507d 100644 --- a/packages/@aws-cdk/aws-pipes-targets-alpha/lib/kinesis.ts +++ b/packages/@aws-cdk/aws-pipes-targets-alpha/lib/kinesis.ts @@ -10,21 +10,12 @@ export interface KinesisTargetParameters { * The input transformation to apply to the message before sending it to the target. * * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipetargetparameters.html#cfn-pipes-pipe-pipetargetparameters-inputtemplate - * @default none + * @default - none */ readonly inputTransformation?: IInputTransformation; /** - * Determines which shard in the stream the data record is assigned to. Partition keys are - * Unicode strings with a maximum length limit of 256 characters for each key. Amazon Kinesis - * Data Streams uses the partition key as input to a hash function that maps the partition key - * and associated data to a specific shard. Specifically, an MD5 hash function is used to map - * partition keys to 128-bit integer values and to map associated data records to shards. As a - * result of this hashing mechanism, all data records with the same partition key map to the - * same shard within the stream. - * - * Minimum: 0 - * Maximum: 256 + * Determines which shard in the stream the data record is assigned to. * * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipetargetkinesisstreamparameters.html#cfn-pipes-pipe-pipetargetkinesisstreamparameters-partitionkey */ @@ -46,9 +37,11 @@ export class KinesisTarget implements ITarget { validatePartitionKey(parameters.partitionKey); } + grantPush(grantee: IRole): void { this.stream.grantWrite(grantee); } + bind(pipe: IPipe): TargetConfig { if (!this.streamParameters) { return { @@ -66,7 +59,7 @@ export class KinesisTarget implements ITarget { } function validatePartitionKey(pk: string) { - if (pk.length < 0 || pk.length > 256) { - throw new Error(`Partition key must be between 0 and 256 characters, received ${pk.length}`); + if (pk.length > 256) { + throw new Error(`Partition key must be less than or equal to 256 characters, received ${pk.length}`); } } diff --git a/packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.kinesis.ts b/packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.kinesis.ts index 818cf9c0af9a7..d5aa8477bf274 100644 --- a/packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.kinesis.ts +++ b/packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.kinesis.ts @@ -44,6 +44,6 @@ test.assertions.awsApiCall('SQS', 'sendMessage', { // It is nontrivial to read from a Kinesis data stream. // Manual verification was done to ensure the record made -// it from the SQS to Kinesis via the pipe. +// it from SQS to Kinesis via the pipe. app.synth(); diff --git a/packages/@aws-cdk/aws-pipes-targets-alpha/test/kinesis.test.ts b/packages/@aws-cdk/aws-pipes-targets-alpha/test/kinesis.test.ts index f2ca5a2db62e3..9ecbd8f661e54 100644 --- a/packages/@aws-cdk/aws-pipes-targets-alpha/test/kinesis.test.ts +++ b/packages/@aws-cdk/aws-pipes-targets-alpha/test/kinesis.test.ts @@ -106,6 +106,6 @@ describe('Kinesis source parameters validation', () => { new KinesisTarget(stream, { partitionKey: 'x'.repeat(257), }); - }).toThrow('Partition key must be between 0 and 256 characters, received 257'); + }).toThrow('Partition key must be less than or equal to 256 characters, received 257'); }); });