

# GetEventSourceMapping
<a name="API_GetEventSourceMapping"></a>

返回有关事件源映射的详细信息。您可以从 [ListEventSourceMappings](API_ListEventSourceMappings.md) 的输出中获取映射的标识符。

## 请求语法
<a name="API_GetEventSourceMapping_RequestSyntax"></a>

```
GET /2015-03-31/event-source-mappings/UUID HTTP/1.1
```

## URI 请求参数
<a name="API_GetEventSourceMapping_RequestParameters"></a>

请求使用以下 URI 参数。

 ** [UUID](#API_GetEventSourceMapping_RequestSyntax) **   <a name="lambda-GetEventSourceMapping-request-UUID"></a>
事件源映射的标识符。  
必需：是

## 请求体
<a name="API_GetEventSourceMapping_RequestBody"></a>

该请求没有请求正文。

## 响应语法
<a name="API_GetEventSourceMapping_ResponseSyntax"></a>

```
HTTP/1.1 200
Content-type: application/json

{
   "AmazonManagedKafkaEventSourceConfig": { 
      "ConsumerGroupId": "string"
   },
   "BatchSize": number,
   "BisectBatchOnFunctionError": boolean,
   "DestinationConfig": { 
      "OnFailure": { 
         "Destination": "string"
      },
      "OnSuccess": { 
         "Destination": "string"
      }
   },
   "DocumentDBEventSourceConfig": { 
      "CollectionName": "string",
      "DatabaseName": "string",
      "FullDocument": "string"
   },
   "EventSourceArn": "string",
   "FilterCriteria": { 
      "Filters": [ 
         { 
            "Pattern": "string"
         }
      ]
   },
   "FunctionArn": "string",
   "FunctionResponseTypes": [ "string" ],
   "LastModified": number,
   "LastProcessingResult": "string",
   "MaximumBatchingWindowInSeconds": number,
   "MaximumRecordAgeInSeconds": number,
   "MaximumRetryAttempts": number,
   "ParallelizationFactor": number,
   "Queues": [ "string" ],
   "ScalingConfig": { 
      "MaximumConcurrency": number
   },
   "SelfManagedEventSource": { 
      "Endpoints": { 
         "string" : [ "string" ]
      }
   },
   "SelfManagedKafkaEventSourceConfig": { 
      "ConsumerGroupId": "string"
   },
   "SourceAccessConfigurations": [ 
      { 
         "Type": "string",
         "URI": "string"
      }
   ],
   "StartingPosition": "string",
   "StartingPositionTimestamp": number,
   "State": "string",
   "StateTransitionReason": "string",
   "Topics": [ "string" ],
   "TumblingWindowInSeconds": number,
   "UUID": "string"
}
```

## 响应元素
<a name="API_GetEventSourceMapping_ResponseElements"></a>

如果此操作成功，则该服务将会发送回 HTTP 200 响应。

服务以 JSON 格式返回以下数据。

 ** [AmazonManagedKafkaEventSourceConfig](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-AmazonManagedKafkaEventSourceConfig"></a>
Amazon Managed Streaming for Apache Kafka (Amazon MSK) 事件源的特定配置设置。  
类型：[AmazonManagedKafkaEventSourceConfig](API_AmazonManagedKafkaEventSourceConfig.md) 对象

 ** [BatchSize](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-BatchSize"></a>
Lambda 从流或队列中提取并发送到函数的每个批处理中的最大记录数。Lambda 在单次调用中将批处理中的所有记录传递给函数，最高可传递同步调用的负载上限 (6 MB)。  
默认值：因服务而异。对于 Amazon SQS，默认值为 10。对于所有其他服务，默认值为 100。  
相关设置：当将 `BatchSize` 设置为一个大于 10 的值时，必须至少将 `MaximumBatchingWindowInSeconds` 设置为 1。  
类型：整数  
有效范围：最小值为 1。最大值为 10000。

 ** [BisectBatchOnFunctionError](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-BisectBatchOnFunctionError"></a>
（仅限 Kinesis 和 DynamoDB Streams）如果函数返回错误，则将分处理拆分为两个并重试。默认值为 False。  
类型：布尔值

 ** [DestinationConfig](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-DestinationConfig"></a>
（仅限 Kinesis、DynamoDB Streams、Amazon MSK 和自行管理的 Apache Kafka 事件源）用于在 Lambda 处理事件后指定事件目标的配置对象。  
类型：[DestinationConfig](API_DestinationConfig.md) 对象

 ** [DocumentDBEventSourceConfig](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-DocumentDBEventSourceConfig"></a>
DocumentB 事件源的特定配置设置。  
类型：[DocumentDBEventSourceConfig](API_DocumentDBEventSourceConfig.md) 对象

 ** [EventSourceArn](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-EventSourceArn"></a>
事件源的 Amazon Resource Name (ARN)。  
类型：字符串  
模式：`arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\-])+:([a-z]{2}(-gov)?-[a-z]+-\d{1})?:(\d{12})?:(.*)`

 ** [FilterCriteria](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-FilterCriteria"></a>
定义用于确定 Lambda 是否应处理事件的筛选条件的对象。有关更多信息，请参阅 [Lambda 事件筛选](https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html)。  
类型：[FilterCriteria](API_FilterCriteria.md) 对象

 ** [FunctionArn](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-FunctionArn"></a>
Lambda 函数的 ARN。  
类型：字符串  
模式：`arn:(aws[a-zA-Z-]*)?:lambda:[a-z]{2}(-gov)?-[a-z]+-\d{1}:\d{12}:function:[a-zA-Z0-9-_]+(:(\$LATEST|[a-zA-Z0-9-_]+))?`

 ** [FunctionResponseTypes](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-FunctionResponseTypes"></a>
（Kinesis、DynamoDB Streams 和 Amazon SQS）应用于事件源映射的当前响应类型枚举的列表。  
类型：字符串数组  
数组成员：最少 0 项。最多 1 项。  
有效值：`ReportBatchItemFailures`

 ** [LastModified](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-LastModified"></a>
上次更新事件源映射或其状态更改的日期（以 Unix 时间秒为单位）。  
类型：时间戳

 ** [LastProcessingResult](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-LastProcessingResult"></a>
函数的最后一次 Lambda 调用结果。  
类型：字符串

 ** [MaximumBatchingWindowInSeconds](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-MaximumBatchingWindowInSeconds"></a>
Lambda 在调用函数之前收集记录的最长时间，以秒为单位。您可以将 `MaximumBatchingWindowInSeconds` 配置为介于 0 秒到 300 秒之间的任意值，以秒的整数倍调整。  
对于流和 Amazon SQS 事件源，默认批处理时段为 0 秒。对于 Amazon MSK、自行管理的 Apache Kafka、Amazon MQ 和 DocumentDB 事件源，默认批处理时间窗口为 500 毫秒。请注意，由于您只能以秒为增量更改 `MaximumBatchingWindowInSeconds`，所以在更改后无法恢复到 500 毫秒的默认批处理时段。要恢复原定设置的批处理时段，必须创建新的事件源映射。  
相关设置：对于流和 Amazon SQS 事件源，当将 `BatchSize` 设置为大于 10 的值时，必须将 `MaximumBatchingWindowInSeconds` 至少设置为 1。  
类型：整数  
有效范围：最小值为 0。最大值为 300。

 ** [MaximumRecordAgeInSeconds](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-MaximumRecordAgeInSeconds"></a>
（仅限 Kinesis 和 DynamoDB Streams）丢弃超过指定龄期的记录。原定设置值为 -1，该值将最大年龄设置为无限。将该值设置为无限后，Lambda 永远不会删除旧记录。  
最长记录期限的最小有效值为 60 秒。尽管小于 60 和大于 -1 的值都在参数的绝对范围内，但不允许使用它们
类型：整数  
有效范围：最小值为 -1。最大值为 604800。

 ** [MaximumRetryAttempts](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-MaximumRetryAttempts"></a>
（仅限 Kinesis 和 DynamoDB Streams）在指定重试次数后丢弃记录。原定设置值为 -1，该值将最大重试次数设置为无限。将 MaximumRetryAttempts 设置为无限后，Lambda 会重试失败的记录，直到事件源中的记录过期为止。  
类型：整数  
有效范围：最小值为 -1。最大值为 10000。

 ** [ParallelizationFactor](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-ParallelizationFactor"></a>
（仅限 Kinesis 和 DynamoDB Streams）每个分片中同时处理的批处理数。默认值是 1。  
类型：整数  
有效范围：最小值为 1。最大值为 10。

 ** [Queues](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-Queues"></a>
 (Amazon MQ) 要使用的 Amazon MQ 代理目标队列的名称。  
类型：字符串数组  
数组成员：固定数量为 1 项。  
长度限制：最小长度为 1。最大长度为 1000。  
模式：`[\s\S]*`

 ** [ScalingConfig](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-ScalingConfig"></a>
（仅限 Amazon SQS）事件源的扩缩配置。有关更多信息，请参阅[为 Amazon SQS 事件源配置最大并发](https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#events-sqs-max-concurrency)。  
类型：[ScalingConfig](API_ScalingConfig.md) 对象

 ** [SelfManagedEventSource](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-SelfManagedEventSource"></a>
适用于事件源的自行管理 Apache Kafka 集群。  
类型：[SelfManagedEventSource](API_SelfManagedEventSource.md) 对象

 ** [SelfManagedKafkaEventSourceConfig](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-SelfManagedKafkaEventSourceConfig"></a>
自行管理的 Apache Kafka 事件源的特定配置设置。  
类型：[SelfManagedKafkaEventSourceConfig](API_SelfManagedKafkaEventSourceConfig.md) 对象

 ** [SourceAccessConfigurations](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-SourceAccessConfigurations"></a>
用于保护与定义事件源的身份验证协议数组 VPC 组件或虚拟化主机。  
类型：[SourceAccessConfiguration](API_SourceAccessConfiguration.md) 对象数组  
数组成员：最少 0 项。最多 22 项。

 ** [StartingPosition](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-StartingPosition"></a>
在流中开始读取数据的位置。对于 Amazon Kinesis 和 Amazon DynamoDB Streams 事件源，为必需项。仅 Amazon Kinesis 流、Amazon DocumentDB、Amazon MSK 和自行管理的 Apache Kafka 支持 `AT_TIMESTAMP`。  
类型：字符串  
有效值：`TRIM_HORIZON | LATEST | AT_TIMESTAMP`

 ** [StartingPositionTimestamp](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-StartingPositionTimestamp"></a>
将 `StartingPosition` 设置为 `AT_TIMESTAMP` 时，即开始读取的时间（以 Unix 时间秒为单位）。`StartingPositionTimestamp` 不能是未来时间。  
类型：时间戳

 ** [State](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-State"></a>
事件源映射的状态。此状态可以是以下值之一：`Creating`、`Enabling`、`Enabled`、`Disabling`、`Disabled`、`Updating` 或 `Deleting`。  
类型：字符串

 ** [StateTransitionReason](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-StateTransitionReason"></a>
表明是用户还是 Lambda 对事件源映射进行了最后一次更改。  
类型：字符串

 ** [Topics](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-Topics"></a>
Kafka 主题的名称。  
类型：字符串数组  
数组成员：固定数量为 1 项。  
长度限制：最小长度为 1。长度上限为 249。  
模式：`^[^.]([a-zA-Z0-9\-_.]+)`

 ** [TumblingWindowInSeconds](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-TumblingWindowInSeconds"></a>
（仅限 Kinesis 和 DynamoDB Streams）DynamoDB 和 Kinesis Streams 事件源的处理时间窗口（以秒为单位）。值为 0 秒表示无滑动时间窗口。  
类型：整数  
有效范围：最小值为 0。最大值为 900。

 ** [UUID](#API_GetEventSourceMapping_ResponseSyntax) **   <a name="lambda-GetEventSourceMapping-response-UUID"></a>
事件源映射的标识符。  
类型：字符串

## 错误
<a name="API_GetEventSourceMapping_Errors"></a>

有关所有操作返回的常见错误的信息，请参阅 [常见错误](CommonErrors.md)。

 ** InvalidParameterValueException **   
请求中的参数之一无效。  
HTTP 状态代码：400

 ** ResourceNotFoundException **   
请求中指定的资源不存在。  
HTTP 状态代码：404

 ** ServiceException **   
AWS Lambda 服务遇到了内部错误。  
HTTP 状态代码：500

 ** TooManyRequestsException **   
超出了请求吞吐量限制。有关更多信息，请参阅 [Lambda 限额](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html#api-requests)。  
HTTP 状态代码：429

## 另请参阅
<a name="API_GetEventSourceMapping_SeeAlso"></a>

有关在特定语言的 AWS SDK 中使用此 API 的更多信息，请参阅以下内容：
+  [AWS 命令行界面](https://docs.aws.amazon.com/goto/aws-cli/lambda-2015-03-31/GetEventSourceMapping) 
+  [适用于 .NET 的 AWS SDK](https://docs.aws.amazon.com/goto/DotNetSDKV3/lambda-2015-03-31/GetEventSourceMapping) 
+  [适用于 C\$1\$1 的 AWS SDK](https://docs.aws.amazon.com/goto/SdkForCpp/lambda-2015-03-31/GetEventSourceMapping) 
+  [适用于 Go 的 AWS SDK](https://docs.aws.amazon.com/goto/SdkForGoV1/lambda-2015-03-31/GetEventSourceMapping) 
+  [适用于 Java V2 的 AWS SDK](https://docs.aws.amazon.com/goto/SdkForJavaV2/lambda-2015-03-31/GetEventSourceMapping) 
+  [AWS 适用于 JavaScript 的开发工具包 V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/lambda-2015-03-31/GetEventSourceMapping) 
+  [适用于 PHP V3 的 AWS SDK](https://docs.aws.amazon.com/goto/SdkForPHPV3/lambda-2015-03-31/GetEventSourceMapping) 
+  [适用于 Python 的 AWS SDK](https://docs.aws.amazon.com/goto/boto3/lambda-2015-03-31/GetEventSourceMapping) 
+  [适用于 Ruby V3 的 AWS SDK](https://docs.aws.amazon.com/goto/SdkForRubyV3/lambda-2015-03-31/GetEventSourceMapping) 