

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# DocumentDB
<a name="sam-property-function-documentdb"></a>

`DocumentDB` イベントソースタイプを説明するオブジェクトです。詳細については、「 *AWS Lambda デベロッパーガイド*」の[Amazon DocumentDB AWS Lambda での の使用](https://docs.aws.amazon.com/lambda/latest/dg/with-documentdb.html)」を参照してください。

## 構文
<a name="sam-property-function-documentdb-syntax"></a>

 AWS SAM テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-function-documentdb-syntax-yaml"></a>

```
BatchSize: Integer
Cluster: [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventsourcemapping-filtercriteria.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventsourcemapping-filtercriteria.html)
CollectionName: String
DatabaseName: String
Enabled: Boolean
FilterCriteria: [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventsourcemapping-filtercriteria.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventsourcemapping-filtercriteria.html)
FullDocument: String
KmsKeyArn: String  
MaximumBatchingWindowInSeconds: Integer
SecretsManagerKmsKeyId: String
SourceAccessConfigurations: List
StartingPosition: String
StartingPositionTimestamp: Double
```

## プロパティ
<a name="sam-property-function-documentdb-properties"></a>

 `BatchSize`   <a name="sam-function-documentdb-batchsize"></a>
単一のバッチで取得する項目の最大数です。  
*タイプ:* 整数  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Lambda::EventSourceMapping`リソースの `[ BatchSize](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-batchsize)`プロパティに直接渡されます。

 `Cluster`   <a name="sam-function-documentdb-cluster"></a>
Amazon DocumentDB クラスターの Amazon リソースネーム (ARN)。  
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは、 `AWS::Lambda::EventSourceMapping`リソースの `[ EventSourceArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-eventsourcearn)`プロパティに直接渡されます。

 `CollectionName`   <a name="sam-function-documentdb-collectionname"></a>
データベース内で使用するコレクションの名前。コレクションを指定しない場合、Lambda はすべてのコレクションを使用します。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Lambda::EventSourceMapping` `DocumentDBEventSourceConfig` データ型の `[ CollectionName](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventsourcemapping-documentdbeventsourceconfig.html#cfn-lambda-eventsourcemapping-documentdbeventsourceconfig-collectionname)`プロパティに直接渡されます。

 `DatabaseName`   <a name="sam-function-documentdb-databasename"></a>
Amazon DocumentDB クラスター内で使用するデータベースの名前。  
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは、 `AWS::Lambda::EventSourceMapping` `DocumentDBEventSourceConfig`データ型の `[ DatabaseName](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventsourcemapping-documentdbeventsourceconfig.html#cfn-lambda-eventsourcemapping-documentdbeventsourceconfig-databasename)`プロパティに直接渡されます。

 `Enabled`   <a name="sam-function-documentdb-enabled"></a>
`true` の場合、イベントソースマッピングがアクティブになります。ポーリングと呼び出しを一時停止するには、`false` に設定します。  
型: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Lambda::EventSourceMapping`リソースの `[ Enabled](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-enabled)`プロパティに直接渡されます。

 `FilterCriteria`   <a name="sam-function-documentdb-filtercriteria"></a>
Lambda がイベントを処理する必要があるかどうかを判断する基準を定義するオブジェクト。詳細については、「AWS Lambda デベロッパーガイド」の「[Lambda イベントのフィルタリング](https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html)」を参照してください。  
*タイプ*: [FilterCriteria](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventsourcemapping-filtercriteria.html)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Lambda::EventSourceMapping`リソースの `[ FilterCriteria](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventsourcemapping-filtercriteria.html)`プロパティに直接渡されます。

 `FullDocument`   <a name="sam-function-documentdb-fulldocument"></a>
ドキュメントの更新オペレーション中に Amazon DocumentDB がイベントストリームに送信する内容を決定します。[`UpdateLookup`] に設定すると、Amazon DocumentDB は、ドキュメント全体のコピーとともに、変更について記述するデルタを送信します。それ以外の場合、Amazon DocumentDB は、変更を含む部分的なドキュメントのみを送信します。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Lambda::EventSourceMapping` `DocumentDBEventSourceConfig` データ型の `[ FullDocument](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventsourcemapping-documentdbeventsourceconfig.html#cfn-lambda-eventsourcemapping-documentdbeventsourceconfig-fulldocument)`プロパティに直接渡されます。

 `KmsKeyArn`   <a name="sam-function-documentdb-kmskeyarn"></a>
このイベントに関連する情報を暗号化するためのキーの Amazon リソースネーム (ARN)。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Lambda::EventSourceMapping`リソースの `[KmsKeyArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-kmskeyarn)`プロパティに直接渡されます。

 `MaximumBatchingWindowInSeconds`   <a name="sam-function-documentdb-maximumbatchingwindowinseconds"></a>
関数を呼び出すまでのレコード収集の最大時間 (秒) です。  
*タイプ:* 整数  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Lambda::EventSourceMapping`リソースの `[ MaximumBatchingWindowInSeconds](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-maximumbatchingwindowinseconds)`プロパティに直接渡されます。

 `SecretsManagerKmsKeyId`   <a name="sam-function-documentdb-secretsmanagerkmskeyid"></a>
 AWS Secrets Manager からのカスタマーマネージドキーの AWS Key Management Service (AWS KMS) キー ID。`kms:Decrypt` 許可が含まれていない Lambda 実行ロールを使用して Secrets Manager からのカスタマーマネージドキーを使用する場合に必要です。  
このプロパティの値は UUID です。例: `1abc23d4-567f-8ab9-cde0-1fab234c5d67`。  
*タイプ*: 文字列  
*必須*: 条件に応じて異なります  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、同等の CloudFormation ものはありません。

 `SourceAccessConfigurations`   <a name="sam-function-documentdb-sourceaccessconfigurations"></a>
認証プロトコルまたは仮想ホストの配列です。これは、[SourceAccessConfigurations](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventsourcemapping-sourceaccessconfiguration.html) データ型を使用して指定します。  
`DocumentDB` イベントソースタイプの場合、有効な設定タイプは `BASIC_AUTH` のみです。  
+ `BASIC_AUTH` – ブローカー認証情報を保存する Secrets Manager シークレットです。このタイプの場合、資格情報は `{"username": "your-username", "password": "your-password"}` 形式にする必要があります。`BASIC_AUTH` タイプのオブジェクトが 1 つだけ許可されます。
*タイプ*: リスト  
*必須:* はい  
*CloudFormation 互換性*: このプロパティは、 `AWS::Lambda::EventSourceMapping`リソースの `[ SourceAccessConfigurations](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-sourceaccessconfigurations)`プロパティに直接渡されます。

 `StartingPosition`   <a name="sam-function-documentdb-startingposition"></a>
読み取りを開始するストリームの場所です。  
+ `AT_TIMESTAMP` - レコードの読み取りを開始する時間を指定します。
+ `LATEST` - 新しいレコードのみを読み込みます。
+ `TRIM_HORIZON` - 使用可能なすべてのレコードを処理します。
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは、 `AWS::Lambda::EventSourceMapping`リソースの `[ StartingPosition](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-startingposition)`プロパティに直接渡されます。

 `StartingPositionTimestamp`   <a name="sam-function-documentdb-startingpositiontimestamp"></a>
Unix タイム秒単位で読み取りをスタートする時間。`StartingPosition` が `AT_TIMESTAMP` として指定されている場合の `StartingPositionTimestamp` を定義します。  
型: 倍精度  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Lambda::EventSourceMapping`リソースの `[ StartingPositionTimestamp](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-startingpositiontimestamp)`プロパティに直接渡されます。

## 例
<a name="sam-property-function-documentdb-examples"></a>

### Amazon DocumentDB イベントソース
<a name="sam-property-function-documentdb-examples-example1"></a>

```
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
...
Resources:
  MyFunction:
    Type: AWS::Serverless::Function
    Properties:
    ...
      Events:
        MyDDBEvent:
          Type: DocumentDB
          Properties:
            Cluster: "arn:aws:rds:us-west-2:123456789012:cluster:docdb-2023-01-01"
            BatchSize: 10
            MaximumBatchingWindowInSeconds: 5
            DatabaseName: "db1"
            CollectionName: "collection1"
            FullDocument: "UpdateLookup"
            SourceAccessConfigurations:
              - Type: BASIC_AUTH
                URI: "arn:aws:secretsmanager:us-west-2:123456789012:secret:doc-db"
```