Skip to content

Commit

Permalink
Rename to kafkaSecret and change type
Browse files Browse the repository at this point in the history
  • Loading branch information
bracki committed Jan 18, 2021
1 parent e7c1eb6 commit c90691f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-lambda-event-sources/lib/kafka.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class ManagedKafkaEventSource extends StreamEventSource {
this.enrichMappingOptions({
eventSourceArn: this.clusterArn,
startingPosition: this.props.startingPosition,
kafkaSecretArn: this.secret.secretArn,
kafkaSecret: this.secret,
kafkaTopic: this.topic,
}),
);
Expand Down Expand Up @@ -75,7 +75,7 @@ export class SelfManagedKafkaEventSource extends StreamEventSource {
kafkaBootstrapServers: this.bootstrapServers,
kafkaTopic: this.topic,
startingPosition: this.props.startingPosition,
kafkaSecretArn: this.secret.secretArn,
kafkaSecret: this.secret,
}),
);
this.secret.grantRead(target);
Expand Down
5 changes: 3 additions & 2 deletions packages/@aws-cdk/aws-lambda/lib/event-source-mapping.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ISecret } from '@aws-cdk/aws-secretsmanager';
import * as cdk from '@aws-cdk/core';
import { Construct } from 'constructs';
import { IEventSourceDlq } from './dlq';
Expand Down Expand Up @@ -109,7 +110,7 @@ export interface EventSourceMappingOptions {
*
* @default - no configuration
*/
readonly kafkaSecretArn?: string
readonly kafkaSecret?: ISecret

/**
* A list of Kafka bootstrap servers to connect to your self managed Kafka cluster
Expand Down Expand Up @@ -212,7 +213,7 @@ export class EventSourceMapping extends cdk.Resource implements IEventSourceMapp
maximumRetryAttempts: props.retryAttempts,
parallelizationFactor: props.parallelizationFactor,
topics: props.kafkaTopic !== undefined ? [props.kafkaTopic] : undefined,
sourceAccessConfigurations: props.kafkaSecretArn !== undefined ? [{ type: 'BASIC_AUTH', uri: props.kafkaSecretArn }] : undefined,
sourceAccessConfigurations: props.kafkaSecret !== undefined ? [{ type: 'BASIC_AUTH', uri: props.kafkaSecret.secretArn }] : undefined,
// eslint-disable-next-line max-len
selfManagedEventSource: props.kafkaBootstrapServers !== undefined ? { endpoints: { kafkaBootstrapServers: props.kafkaBootstrapServers } } : undefined,
});
Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"@aws-cdk/aws-logs": "0.0.0",
"@aws-cdk/aws-s3": "0.0.0",
"@aws-cdk/aws-s3-assets": "0.0.0",
"@aws-cdk/aws-secretsmanager": "0.0.0",
"@aws-cdk/aws-sqs": "0.0.0",
"@aws-cdk/core": "0.0.0",
"@aws-cdk/cx-api": "0.0.0",
Expand All @@ -121,6 +122,7 @@
"@aws-cdk/aws-logs": "0.0.0",
"@aws-cdk/aws-s3": "0.0.0",
"@aws-cdk/aws-s3-assets": "0.0.0",
"@aws-cdk/aws-secretsmanager": "0.0.0",
"@aws-cdk/aws-sqs": "0.0.0",
"@aws-cdk/core": "0.0.0",
"@aws-cdk/cx-api": "0.0.0",
Expand Down

0 comments on commit c90691f

Please sign in to comment.