Skip to content

Commit fdd8bd3

Browse files
author
awstools
committed
feat(client-lambda): Support Schema Registry feature for Kafka Event Source Mapping. Customers can now configure a Schema Registry to enable schema validation and filtering for Avro, Protobuf, and JSON-formatted events in Lambda for Kafka Event Source.
1 parent 60a7e91 commit fdd8bd3

10 files changed

+816
-21
lines changed

clients/client-lambda/src/commands/CreateEventSourceMappingCommand.ts

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ export interface CreateEventSourceMappingCommandOutput extends EventSourceMappin
9797
* <ul>
9898
* <li>
9999
* <p>
100-
* <code>DestinationConfig</code> – Send discarded records to an Amazon SQS queue, Amazon SNS topic, or
101-
* Amazon S3 bucket.</p>
100+
* <code>OnFailure</code> – Send discarded records to an Amazon SQS queue, Amazon SNS topic, or
101+
* Amazon S3 bucket. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async-retain-records.html#invocation-async-destinations">Adding a destination</a>.</p>
102102
* </li>
103103
* </ul>
104104
* <p>For information about which configuration parameters apply to each event source, see the following topics.</p>
@@ -207,9 +207,39 @@ export interface CreateEventSourceMappingCommandOutput extends EventSourceMappin
207207
* ],
208208
* AmazonManagedKafkaEventSourceConfig: { // AmazonManagedKafkaEventSourceConfig
209209
* ConsumerGroupId: "STRING_VALUE",
210+
* SchemaRegistryConfig: { // KafkaSchemaRegistryConfig
211+
* SchemaRegistryURI: "STRING_VALUE",
212+
* EventRecordFormat: "JSON" || "SOURCE",
213+
* AccessConfigs: [ // KafkaSchemaRegistryAccessConfigList
214+
* { // KafkaSchemaRegistryAccessConfig
215+
* Type: "BASIC_AUTH" || "CLIENT_CERTIFICATE_TLS_AUTH" || "SERVER_ROOT_CA_CERTIFICATE",
216+
* URI: "STRING_VALUE",
217+
* },
218+
* ],
219+
* SchemaValidationConfigs: [ // KafkaSchemaValidationConfigList
220+
* { // KafkaSchemaValidationConfig
221+
* Attribute: "KEY" || "VALUE",
222+
* },
223+
* ],
224+
* },
210225
* },
211226
* SelfManagedKafkaEventSourceConfig: { // SelfManagedKafkaEventSourceConfig
212227
* ConsumerGroupId: "STRING_VALUE",
228+
* SchemaRegistryConfig: {
229+
* SchemaRegistryURI: "STRING_VALUE",
230+
* EventRecordFormat: "JSON" || "SOURCE",
231+
* AccessConfigs: [
232+
* {
233+
* Type: "BASIC_AUTH" || "CLIENT_CERTIFICATE_TLS_AUTH" || "SERVER_ROOT_CA_CERTIFICATE",
234+
* URI: "STRING_VALUE",
235+
* },
236+
* ],
237+
* SchemaValidationConfigs: [
238+
* {
239+
* Attribute: "KEY" || "VALUE",
240+
* },
241+
* ],
242+
* },
213243
* },
214244
* ScalingConfig: { // ScalingConfig
215245
* MaximumConcurrency: Number("int"),
@@ -288,9 +318,39 @@ export interface CreateEventSourceMappingCommandOutput extends EventSourceMappin
288318
* // ],
289319
* // AmazonManagedKafkaEventSourceConfig: { // AmazonManagedKafkaEventSourceConfig
290320
* // ConsumerGroupId: "STRING_VALUE",
321+
* // SchemaRegistryConfig: { // KafkaSchemaRegistryConfig
322+
* // SchemaRegistryURI: "STRING_VALUE",
323+
* // EventRecordFormat: "JSON" || "SOURCE",
324+
* // AccessConfigs: [ // KafkaSchemaRegistryAccessConfigList
325+
* // { // KafkaSchemaRegistryAccessConfig
326+
* // Type: "BASIC_AUTH" || "CLIENT_CERTIFICATE_TLS_AUTH" || "SERVER_ROOT_CA_CERTIFICATE",
327+
* // URI: "STRING_VALUE",
328+
* // },
329+
* // ],
330+
* // SchemaValidationConfigs: [ // KafkaSchemaValidationConfigList
331+
* // { // KafkaSchemaValidationConfig
332+
* // Attribute: "KEY" || "VALUE",
333+
* // },
334+
* // ],
335+
* // },
291336
* // },
292337
* // SelfManagedKafkaEventSourceConfig: { // SelfManagedKafkaEventSourceConfig
293338
* // ConsumerGroupId: "STRING_VALUE",
339+
* // SchemaRegistryConfig: {
340+
* // SchemaRegistryURI: "STRING_VALUE",
341+
* // EventRecordFormat: "JSON" || "SOURCE",
342+
* // AccessConfigs: [
343+
* // {
344+
* // Type: "BASIC_AUTH" || "CLIENT_CERTIFICATE_TLS_AUTH" || "SERVER_ROOT_CA_CERTIFICATE",
345+
* // URI: "STRING_VALUE",
346+
* // },
347+
* // ],
348+
* // SchemaValidationConfigs: [
349+
* // {
350+
* // Attribute: "KEY" || "VALUE",
351+
* // },
352+
* // ],
353+
* // },
294354
* // },
295355
* // ScalingConfig: { // ScalingConfig
296356
* // MaximumConcurrency: Number("int"),

clients/client-lambda/src/commands/DeleteEventSourceMappingCommand.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,39 @@ export interface DeleteEventSourceMappingCommandOutput extends EventSourceMappin
9999
* // ],
100100
* // AmazonManagedKafkaEventSourceConfig: { // AmazonManagedKafkaEventSourceConfig
101101
* // ConsumerGroupId: "STRING_VALUE",
102+
* // SchemaRegistryConfig: { // KafkaSchemaRegistryConfig
103+
* // SchemaRegistryURI: "STRING_VALUE",
104+
* // EventRecordFormat: "JSON" || "SOURCE",
105+
* // AccessConfigs: [ // KafkaSchemaRegistryAccessConfigList
106+
* // { // KafkaSchemaRegistryAccessConfig
107+
* // Type: "BASIC_AUTH" || "CLIENT_CERTIFICATE_TLS_AUTH" || "SERVER_ROOT_CA_CERTIFICATE",
108+
* // URI: "STRING_VALUE",
109+
* // },
110+
* // ],
111+
* // SchemaValidationConfigs: [ // KafkaSchemaValidationConfigList
112+
* // { // KafkaSchemaValidationConfig
113+
* // Attribute: "KEY" || "VALUE",
114+
* // },
115+
* // ],
116+
* // },
102117
* // },
103118
* // SelfManagedKafkaEventSourceConfig: { // SelfManagedKafkaEventSourceConfig
104119
* // ConsumerGroupId: "STRING_VALUE",
120+
* // SchemaRegistryConfig: {
121+
* // SchemaRegistryURI: "STRING_VALUE",
122+
* // EventRecordFormat: "JSON" || "SOURCE",
123+
* // AccessConfigs: [
124+
* // {
125+
* // Type: "BASIC_AUTH" || "CLIENT_CERTIFICATE_TLS_AUTH" || "SERVER_ROOT_CA_CERTIFICATE",
126+
* // URI: "STRING_VALUE",
127+
* // },
128+
* // ],
129+
* // SchemaValidationConfigs: [
130+
* // {
131+
* // Attribute: "KEY" || "VALUE",
132+
* // },
133+
* // ],
134+
* // },
105135
* // },
106136
* // ScalingConfig: { // ScalingConfig
107137
* // MaximumConcurrency: Number("int"),
@@ -159,6 +189,27 @@ export interface DeleteEventSourceMappingCommandOutput extends EventSourceMappin
159189
* <p>Base exception class for all service exceptions from Lambda service.</p>
160190
*
161191
*
192+
* @example To delete a Lambda function event source mapping
193+
* ```javascript
194+
* // The following example deletes an event source mapping. To get a mapping's UUID, use ListEventSourceMappings.
195+
* const input = {
196+
* UUID: "14e0db71-xmpl-4eb5-b481-8945cf9d10c2"
197+
* };
198+
* const command = new DeleteEventSourceMappingCommand(input);
199+
* const response = await client.send(command);
200+
* /* response is
201+
* {
202+
* BatchSize: 5,
203+
* EventSourceArn: "arn:aws:sqs:us-west-2:123456789012:my-queue",
204+
* FunctionArn: "arn:aws:lambda:us-east-2:123456789012:function:my-function",
205+
* LastModified: "2016-11-21T19:49:20.006Z",
206+
* State: "Enabled",
207+
* StateTransitionReason: "USER_INITIATED",
208+
* UUID: "14e0db71-xmpl-4eb5-b481-8945cf9d10c2"
209+
* }
210+
* *\/
211+
* ```
212+
*
162213
* @public
163214
*/
164215
export class DeleteEventSourceMappingCommand extends $Command

clients/client-lambda/src/commands/GetEventSourceMappingCommand.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,39 @@ export interface GetEventSourceMappingCommandOutput extends EventSourceMappingCo
9797
* // ],
9898
* // AmazonManagedKafkaEventSourceConfig: { // AmazonManagedKafkaEventSourceConfig
9999
* // ConsumerGroupId: "STRING_VALUE",
100+
* // SchemaRegistryConfig: { // KafkaSchemaRegistryConfig
101+
* // SchemaRegistryURI: "STRING_VALUE",
102+
* // EventRecordFormat: "JSON" || "SOURCE",
103+
* // AccessConfigs: [ // KafkaSchemaRegistryAccessConfigList
104+
* // { // KafkaSchemaRegistryAccessConfig
105+
* // Type: "BASIC_AUTH" || "CLIENT_CERTIFICATE_TLS_AUTH" || "SERVER_ROOT_CA_CERTIFICATE",
106+
* // URI: "STRING_VALUE",
107+
* // },
108+
* // ],
109+
* // SchemaValidationConfigs: [ // KafkaSchemaValidationConfigList
110+
* // { // KafkaSchemaValidationConfig
111+
* // Attribute: "KEY" || "VALUE",
112+
* // },
113+
* // ],
114+
* // },
100115
* // },
101116
* // SelfManagedKafkaEventSourceConfig: { // SelfManagedKafkaEventSourceConfig
102117
* // ConsumerGroupId: "STRING_VALUE",
118+
* // SchemaRegistryConfig: {
119+
* // SchemaRegistryURI: "STRING_VALUE",
120+
* // EventRecordFormat: "JSON" || "SOURCE",
121+
* // AccessConfigs: [
122+
* // {
123+
* // Type: "BASIC_AUTH" || "CLIENT_CERTIFICATE_TLS_AUTH" || "SERVER_ROOT_CA_CERTIFICATE",
124+
* // URI: "STRING_VALUE",
125+
* // },
126+
* // ],
127+
* // SchemaValidationConfigs: [
128+
* // {
129+
* // Attribute: "KEY" || "VALUE",
130+
* // },
131+
* // ],
132+
* // },
103133
* // },
104134
* // ScalingConfig: { // ScalingConfig
105135
* // MaximumConcurrency: Number("int"),
@@ -150,6 +180,32 @@ export interface GetEventSourceMappingCommandOutput extends EventSourceMappingCo
150180
* <p>Base exception class for all service exceptions from Lambda service.</p>
151181
*
152182
*
183+
* @example To get a Lambda function's event source mapping
184+
* ```javascript
185+
* // The following example returns details about an event source mapping. To get a mapping's UUID, use ListEventSourceMappings.
186+
* const input = {
187+
* UUID: "14e0db71-xmpl-4eb5-b481-8945cf9d10c2"
188+
* };
189+
* const command = new GetEventSourceMappingCommand(input);
190+
* const response = await client.send(command);
191+
* /* response is
192+
* {
193+
* BatchSize: 500,
194+
* BisectBatchOnFunctionError: false,
195+
* DestinationConfig: { /* empty *\/ },
196+
* EventSourceArn: "arn:aws:sqs:us-east-2:123456789012:mySQSqueue",
197+
* FunctionArn: "arn:aws:lambda:us-east-2:123456789012:function:myFunction",
198+
* LastModified: "2016-11-21T19:49:20.006Z",
199+
* LastProcessingResult: "No records processed",
200+
* MaximumRecordAgeInSeconds: 604800,
201+
* MaximumRetryAttempts: 10000,
202+
* State: "Creating",
203+
* StateTransitionReason: "User action",
204+
* UUID: "14e0db71-xmpl-4eb5-b481-8945cf9d10c2"
205+
* }
206+
* *\/
207+
* ```
208+
*
153209
* @public
154210
*/
155211
export class GetEventSourceMappingCommand extends $Command

clients/client-lambda/src/commands/GetFunctionEventInvokeConfigCommand.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,31 @@ export interface GetFunctionEventInvokeConfigCommandOutput extends FunctionEvent
8484
* <p>Base exception class for all service exceptions from Lambda service.</p>
8585
*
8686
*
87+
* @example To get an asynchronous invocation configuration
88+
* ```javascript
89+
* // The following example returns the asynchronous invocation configuration for the BLUE alias of a function named my-function.
90+
* const input = {
91+
* FunctionName: "my-function",
92+
* Qualifier: "BLUE"
93+
* };
94+
* const command = new GetFunctionEventInvokeConfigCommand(input);
95+
* const response = await client.send(command);
96+
* /* response is
97+
* {
98+
* DestinationConfig: {
99+
* OnFailure: {
100+
* Destination: "arn:aws:sqs:us-east-2:123456789012:failed-invocations"
101+
* },
102+
* OnSuccess: { /* empty *\/ }
103+
* },
104+
* FunctionArn: "arn:aws:lambda:us-east-2:123456789012:function:my-function:BLUE",
105+
* LastModified: "2016-11-21T19:49:20.006Z",
106+
* MaximumEventAgeInSeconds: 3600,
107+
* MaximumRetryAttempts: 0
108+
* }
109+
* *\/
110+
* ```
111+
*
87112
* @public
88113
*/
89114
export class GetFunctionEventInvokeConfigCommand extends $Command

clients/client-lambda/src/commands/ListEventSourceMappingsCommand.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,39 @@ export interface ListEventSourceMappingsCommandOutput extends ListEventSourceMap
103103
* // ],
104104
* // AmazonManagedKafkaEventSourceConfig: { // AmazonManagedKafkaEventSourceConfig
105105
* // ConsumerGroupId: "STRING_VALUE",
106+
* // SchemaRegistryConfig: { // KafkaSchemaRegistryConfig
107+
* // SchemaRegistryURI: "STRING_VALUE",
108+
* // EventRecordFormat: "JSON" || "SOURCE",
109+
* // AccessConfigs: [ // KafkaSchemaRegistryAccessConfigList
110+
* // { // KafkaSchemaRegistryAccessConfig
111+
* // Type: "BASIC_AUTH" || "CLIENT_CERTIFICATE_TLS_AUTH" || "SERVER_ROOT_CA_CERTIFICATE",
112+
* // URI: "STRING_VALUE",
113+
* // },
114+
* // ],
115+
* // SchemaValidationConfigs: [ // KafkaSchemaValidationConfigList
116+
* // { // KafkaSchemaValidationConfig
117+
* // Attribute: "KEY" || "VALUE",
118+
* // },
119+
* // ],
120+
* // },
106121
* // },
107122
* // SelfManagedKafkaEventSourceConfig: { // SelfManagedKafkaEventSourceConfig
108123
* // ConsumerGroupId: "STRING_VALUE",
124+
* // SchemaRegistryConfig: {
125+
* // SchemaRegistryURI: "STRING_VALUE",
126+
* // EventRecordFormat: "JSON" || "SOURCE",
127+
* // AccessConfigs: [
128+
* // {
129+
* // Type: "BASIC_AUTH" || "CLIENT_CERTIFICATE_TLS_AUTH" || "SERVER_ROOT_CA_CERTIFICATE",
130+
* // URI: "STRING_VALUE",
131+
* // },
132+
* // ],
133+
* // SchemaValidationConfigs: [
134+
* // {
135+
* // Attribute: "KEY" || "VALUE",
136+
* // },
137+
* // ],
138+
* // },
109139
* // },
110140
* // ScalingConfig: { // ScalingConfig
111141
* // MaximumConcurrency: Number("int"),

clients/client-lambda/src/commands/PutFunctionEventInvokeConfigCommand.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,30 @@ export interface PutFunctionEventInvokeConfigCommandOutput extends FunctionEvent
109109
* <p>Base exception class for all service exceptions from Lambda service.</p>
110110
*
111111
*
112+
* @example To configure error handling for asynchronous invocation
113+
* ```javascript
114+
* // The following example sets a maximum event age of one hour and disables retries for the specified function.
115+
* const input = {
116+
* FunctionName: "my-function",
117+
* MaximumEventAgeInSeconds: 3600,
118+
* MaximumRetryAttempts: 0
119+
* };
120+
* const command = new PutFunctionEventInvokeConfigCommand(input);
121+
* const response = await client.send(command);
122+
* /* response is
123+
* {
124+
* DestinationConfig: {
125+
* OnFailure: { /* empty *\/ },
126+
* OnSuccess: { /* empty *\/ }
127+
* },
128+
* FunctionArn: "arn:aws:lambda:us-east-2:123456789012:function:my-function:$LATEST",
129+
* LastModified: "2016-11-21T19:49:20.006Z",
130+
* MaximumEventAgeInSeconds: 3600,
131+
* MaximumRetryAttempts: 0
132+
* }
133+
* *\/
134+
* ```
135+
*
112136
* @public
113137
*/
114138
export class PutFunctionEventInvokeConfigCommand extends $Command

0 commit comments

Comments
 (0)