Skip to content

Commit

Permalink
feat(client-lambda): Adds support for metrics for event source mappin…
Browse files Browse the repository at this point in the history
…gs for AWS Lambda
  • Loading branch information
awstools committed Nov 21, 2024
1 parent 074cf4e commit fb9ea84
Show file tree
Hide file tree
Showing 13 changed files with 219 additions and 30 deletions.
2 changes: 1 addition & 1 deletion clients/client-lambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ response. </p>
line tools to access the API. For installation instructions, see <a href="http://aws.amazon.com/tools/">Tools for
Amazon Web Services</a>. </p>
<p>For a list of Region-specific endpoints that Lambda supports,
see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html/">Lambda
see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html">Lambda
endpoints and quotas </a> in the <i>Amazon Web Services General Reference.</i>. </p>
<p>When making the API calls, you will need to
authenticate your request by providing a signature. Lambda supports signature version 4. For more information,
Expand Down
2 changes: 1 addition & 1 deletion clients/client-lambda/src/Lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ export interface Lambda {
* line tools to access the API. For installation instructions, see <a href="http://aws.amazon.com/tools/">Tools for
* Amazon Web Services</a>. </p>
* <p>For a list of Region-specific endpoints that Lambda supports,
* see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html/">Lambda
* see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html">Lambda
* endpoints and quotas </a> in the <i>Amazon Web Services General Reference.</i>. </p>
* <p>When making the API calls, you will need to
* authenticate your request by providing a signature. Lambda supports signature version 4. For more information,
Expand Down
2 changes: 1 addition & 1 deletion clients/client-lambda/src/LambdaClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ export interface LambdaClientResolvedConfig extends LambdaClientResolvedConfigTy
* line tools to access the API. For installation instructions, see <a href="http://aws.amazon.com/tools/">Tools for
* Amazon Web Services</a>. </p>
* <p>For a list of Region-specific endpoints that Lambda supports,
* see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html/">Lambda
* see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html">Lambda
* endpoints and quotas </a> in the <i>Amazon Web Services General Reference.</i>. </p>
* <p>When making the API calls, you will need to
* authenticate your request by providing a signature. Lambda supports signature version 4. For more information,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,14 @@ export interface CreateEventSourceMappingCommandOutput extends EventSourceMappin
* </p>
* </li>
* </ul>
* <p>The following error handling options are available only for stream sources (DynamoDB and Kinesis):</p>
* <p>The following error handling options are available only for DynamoDB and Kinesis event sources:</p>
* <ul>
* <li>
* <p>
* <code>BisectBatchOnFunctionError</code> – If the function returns an error, split the batch in two and retry.</p>
* </li>
* <li>
* <p>
* <code>DestinationConfig</code> – Send discarded records to an Amazon SQS queue or Amazon SNS topic.</p>
* </li>
* <li>
* <p>
* <code>MaximumRecordAgeInSeconds</code> – Discard records older than the specified age. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires</p>
* </li>
* <li>
Expand All @@ -97,6 +93,14 @@ export interface CreateEventSourceMappingCommandOutput extends EventSourceMappin
* <code>ParallelizationFactor</code> – Process multiple batches from each shard concurrently.</p>
* </li>
* </ul>
* <p>For stream sources (DynamoDB, Kinesis, Amazon MSK, and self-managed Apache Kafka), the following option is also available:</p>
* <ul>
* <li>
* <p>
* <code>DestinationConfig</code> – Send discarded records to an Amazon SQS queue, Amazon SNS topic, or
* Amazon S3 bucket.</p>
* </li>
* </ul>
* <p>For information about which configuration parameters apply to each event source, see the following topics.</p>
* <ul>
* <li>
Expand Down Expand Up @@ -216,6 +220,11 @@ export interface CreateEventSourceMappingCommandOutput extends EventSourceMappin
* FullDocument: "UpdateLookup" || "Default",
* },
* KMSKeyArn: "STRING_VALUE",
* MetricsConfig: { // EventSourceMappingMetricsConfig
* Metrics: [ // EventSourceMappingMetricList
* "EventCount",
* ],
* },
* };
* const command = new CreateEventSourceMappingCommand(input);
* const response = await client.send(command);
Expand Down Expand Up @@ -293,6 +302,11 @@ export interface CreateEventSourceMappingCommandOutput extends EventSourceMappin
* // Message: "STRING_VALUE",
* // },
* // EventSourceMappingArn: "STRING_VALUE",
* // MetricsConfig: { // EventSourceMappingMetricsConfig
* // Metrics: [ // EventSourceMappingMetricList
* // "EventCount",
* // ],
* // },
* // };
*
* ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ export interface DeleteEventSourceMappingCommandOutput extends EventSourceMappin
* // Message: "STRING_VALUE",
* // },
* // EventSourceMappingArn: "STRING_VALUE",
* // MetricsConfig: { // EventSourceMappingMetricsConfig
* // Metrics: [ // EventSourceMappingMetricList
* // "EventCount",
* // ],
* // },
* // };
*
* ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ export interface GetEventSourceMappingCommandOutput extends EventSourceMappingCo
* // Message: "STRING_VALUE",
* // },
* // EventSourceMappingArn: "STRING_VALUE",
* // MetricsConfig: { // EventSourceMappingMetricsConfig
* // Metrics: [ // EventSourceMappingMetricList
* // "EventCount",
* // ],
* // },
* // };
*
* ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ export interface ListEventSourceMappingsCommandOutput extends ListEventSourceMap
* // Message: "STRING_VALUE",
* // },
* // EventSourceMappingArn: "STRING_VALUE",
* // MetricsConfig: { // EventSourceMappingMetricsConfig
* // Metrics: [ // EventSourceMappingMetricList
* // "EventCount",
* // ],
* // },
* // },
* // ],
* // };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ export interface PutFunctionEventInvokeConfigCommandOutput extends FunctionEvent
* events in a queue for up to six hours. When an event fails all processing attempts or stays in the asynchronous
* invocation queue for too long, Lambda discards it. To retain discarded events, configure a dead-letter queue with
* <a>UpdateFunctionConfiguration</a>.</p>
* <p>To send an invocation record to a queue, topic, function, or event bus, specify a <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations">destination</a>. You can configure separate destinations for successful invocations (on-success) and events
* <p>To send an invocation record to a queue, topic, S3 bucket, function, or event bus, specify a <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations">destination</a>. You can configure separate destinations for successful invocations (on-success) and events
* that fail all processing attempts (on-failure). You can configure destinations in addition to or instead of a
* dead-letter queue.</p>
* <note>
* <p>S3 buckets are supported only for on-failure destinations. To retain records of successful invocations, use another destination type.</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,14 @@ export interface UpdateEventSourceMappingCommandOutput extends EventSourceMappin
* </p>
* </li>
* </ul>
* <p>The following error handling options are available only for stream sources (DynamoDB and Kinesis):</p>
* <p>The following error handling options are available only for DynamoDB and Kinesis event sources:</p>
* <ul>
* <li>
* <p>
* <code>BisectBatchOnFunctionError</code> – If the function returns an error, split the batch in two and retry.</p>
* </li>
* <li>
* <p>
* <code>DestinationConfig</code> – Send discarded records to an Amazon SQS queue or Amazon SNS topic.</p>
* </li>
* <li>
* <p>
* <code>MaximumRecordAgeInSeconds</code> – Discard records older than the specified age. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires</p>
* </li>
* <li>
Expand All @@ -98,6 +94,14 @@ export interface UpdateEventSourceMappingCommandOutput extends EventSourceMappin
* <code>ParallelizationFactor</code> – Process multiple batches from each shard concurrently.</p>
* </li>
* </ul>
* <p>For stream sources (DynamoDB, Kinesis, Amazon MSK, and self-managed Apache Kafka), the following option is also available:</p>
* <ul>
* <li>
* <p>
* <code>DestinationConfig</code> – Send discarded records to an Amazon SQS queue, Amazon SNS topic, or
* Amazon S3 bucket.</p>
* </li>
* </ul>
* <p>For information about which configuration parameters apply to each event source, see the following topics.</p>
* <ul>
* <li>
Expand Down Expand Up @@ -193,6 +197,11 @@ export interface UpdateEventSourceMappingCommandOutput extends EventSourceMappin
* FullDocument: "UpdateLookup" || "Default",
* },
* KMSKeyArn: "STRING_VALUE",
* MetricsConfig: { // EventSourceMappingMetricsConfig
* Metrics: [ // EventSourceMappingMetricList
* "EventCount",
* ],
* },
* };
* const command = new UpdateEventSourceMappingCommand(input);
* const response = await client.send(command);
Expand Down Expand Up @@ -270,6 +279,11 @@ export interface UpdateEventSourceMappingCommandOutput extends EventSourceMappin
* // Message: "STRING_VALUE",
* // },
* // EventSourceMappingArn: "STRING_VALUE",
* // MetricsConfig: { // EventSourceMappingMetricsConfig
* // Metrics: [ // EventSourceMappingMetricList
* // "EventCount",
* // ],
* // },
* // };
*
* ```
Expand Down
2 changes: 1 addition & 1 deletion clients/client-lambda/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* line tools to access the API. For installation instructions, see <a href="http://aws.amazon.com/tools/">Tools for
* Amazon Web Services</a>. </p>
* <p>For a list of Region-specific endpoints that Lambda supports,
* see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html/">Lambda
* see <a href="https://docs.aws.amazon.com/general/latest/gr/lambda-service.html">Lambda
* endpoints and quotas </a> in the <i>Amazon Web Services General Reference.</i>. </p>
* <p>When making the API calls, you will need to
* authenticate your request by providing a signature. Lambda supports signature version 4. For more information,
Expand Down
83 changes: 77 additions & 6 deletions clients/client-lambda/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -755,13 +755,11 @@ export interface CreateCodeSigningConfigResponse {
export interface OnFailure {
/**
* <p>The Amazon Resource Name (ARN) of the destination resource.</p>
* <p>To retain records of <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations">asynchronous invocations</a>,
* you can configure an Amazon SNS topic, Amazon SQS queue, Lambda function,
* <p>To retain records of unsuccessful <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations">asynchronous invocations</a>,
* you can configure an Amazon SNS topic, Amazon SQS queue, Amazon S3 bucket, Lambda function,
* or Amazon EventBridge event bus as the destination.</p>
* <p>To retain records of failed invocations from <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventsourcemapping.html#event-source-mapping-destinations">Kinesis and
* DynamoDB event sources</a>, you can configure an Amazon SNS topic or
* Amazon SQS queue as the destination.</p>
* <p>To retain records of failed invocations from <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kafka.html#services-smaa-onfailure-destination">self-managed Kafka</a> or
* <p>To retain records of failed invocations from <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html">Kinesis</a>,
* <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html">DynamoDB</a>, <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kafka.html#services-smaa-onfailure-destination">self-managed Kafka</a> or
* <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html#services-msk-onfailure-destination">Amazon MSK</a>,
* you can configure an Amazon SNS topic, Amazon SQS queue, or Amazon S3 bucket as the destination.</p>
* @public
Expand All @@ -771,6 +769,9 @@ export interface OnFailure {

/**
* <p>A destination for events that were processed successfully.</p>
* <p>To retain records of successful <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations">asynchronous invocations</a>,
* you can configure an Amazon SNS topic, Amazon SQS queue, Lambda function,
* or Amazon EventBridge event bus as the destination.</p>
* @public
*/
export interface OnSuccess {
Expand Down Expand Up @@ -892,6 +893,37 @@ export const FunctionResponseType = {
*/
export type FunctionResponseType = (typeof FunctionResponseType)[keyof typeof FunctionResponseType];

/**
* @public
* @enum
*/
export const EventSourceMappingMetric = {
EventCount: "EventCount",
} as const;

/**
* @public
*/
export type EventSourceMappingMetric = (typeof EventSourceMappingMetric)[keyof typeof EventSourceMappingMetric];

/**
* <p>The metrics configuration for your event source. Use this configuration object to define which metrics you want your
* event source mapping to produce.</p>
* @public
*/
export interface EventSourceMappingMetricsConfig {
/**
* <p>
* The metrics you want your event source mapping to produce. Include <code>EventCount</code> to receive event source mapping
* metrics related to the number of events processed by your event source mapping. For more information about these metrics,
* see <a href="https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html#event-source-mapping-metrics">
* Event source mapping metrics</a>.
* </p>
* @public
*/
Metrics?: EventSourceMappingMetric[] | undefined;
}

/**
* <p>(Amazon SQS only) The scaling configuration for the event source. To remove the configuration, pass an empty value.</p>
* @public
Expand Down Expand Up @@ -1286,6 +1318,12 @@ export interface CreateEventSourceMappingRequest {
* @public
*/
KMSKeyArn?: string | undefined;

/**
* <p>The metrics configuration for your event source. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html#event-source-mapping-metrics">Event source mapping metrics</a>.</p>
* @public
*/
MetricsConfig?: EventSourceMappingMetricsConfig | undefined;
}

/**
Expand Down Expand Up @@ -1514,6 +1552,12 @@ export interface EventSourceMappingConfiguration {
* @public
*/
EventSourceMappingArn?: string | undefined;

/**
* <p>The metrics configuration for your event source. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html#event-source-mapping-metrics">Event source mapping metrics</a>.</p>
* @public
*/
MetricsConfig?: EventSourceMappingMetricsConfig | undefined;
}

/**
Expand Down Expand Up @@ -3647,13 +3691,20 @@ export interface FunctionEventInvokeConfig {
* </li>
* <li>
* <p>
* <b>Bucket</b> - The ARN of an Amazon S3 bucket.</p>
* </li>
* <li>
* <p>
* <b>Topic</b> - The ARN of a standard SNS topic.</p>
* </li>
* <li>
* <p>
* <b>Event Bus</b> - The ARN of an Amazon EventBridge event bus.</p>
* </li>
* </ul>
* <note>
* <p>S3 buckets are supported only for on-failure destinations. To retain records of successful invocations, use another destination type.</p>
* </note>
* @public
*/
DestinationConfig?: DestinationConfig | undefined;
Expand Down Expand Up @@ -6518,13 +6569,20 @@ export interface PutFunctionEventInvokeConfigRequest {
* </li>
* <li>
* <p>
* <b>Bucket</b> - The ARN of an Amazon S3 bucket.</p>
* </li>
* <li>
* <p>
* <b>Topic</b> - The ARN of a standard SNS topic.</p>
* </li>
* <li>
* <p>
* <b>Event Bus</b> - The ARN of an Amazon EventBridge event bus.</p>
* </li>
* </ul>
* <note>
* <p>S3 buckets are supported only for on-failure destinations. To retain records of successful invocations, use another destination type.</p>
* </note>
* @public
*/
DestinationConfig?: DestinationConfig | undefined;
Expand Down Expand Up @@ -7157,6 +7215,12 @@ export interface UpdateEventSourceMappingRequest {
* @public
*/
KMSKeyArn?: string | undefined;

/**
* <p>The metrics configuration for your event source. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html#event-source-mapping-metrics">Event source mapping metrics</a>.</p>
* @public
*/
MetricsConfig?: EventSourceMappingMetricsConfig | undefined;
}

/**
Expand Down Expand Up @@ -7495,13 +7559,20 @@ export interface UpdateFunctionEventInvokeConfigRequest {
* </li>
* <li>
* <p>
* <b>Bucket</b> - The ARN of an Amazon S3 bucket.</p>
* </li>
* <li>
* <p>
* <b>Topic</b> - The ARN of a standard SNS topic.</p>
* </li>
* <li>
* <p>
* <b>Event Bus</b> - The ARN of an Amazon EventBridge event bus.</p>
* </li>
* </ul>
* <note>
* <p>S3 buckets are supported only for on-failure destinations. To retain records of successful invocations, use another destination type.</p>
* </note>
* @public
*/
DestinationConfig?: DestinationConfig | undefined;
Expand Down
Loading

0 comments on commit fb9ea84

Please sign in to comment.