

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

# OnSuccess
<a name="sam-property-function-onsuccess"></a>

正常に処理されたイベントの送信先。

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

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

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

```
  [Destination](#sam-function-onsuccess-destination): String
  [Type](#sam-function-onsuccess-type): String
```

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

 `Destination`   <a name="sam-function-onsuccess-destination"></a>
送信先リソースの Amazon リソースネーム (ARN) です。  
*タイプ*: 文字列  
*必須*: 条件に応じて異なります  
*CloudFormation 互換性*: このプロパティは、 `AWS::Lambda::EventInvokeConfig`リソースの `[OnSuccess](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventinvokeconfig-onsuccess)`プロパティに似ています。SAM は、このプロパティで参照されるリソースにアクセスするために、この関数に関連付けられている自動生成された IAM ロールに必要な許可を追加します。  
*その他の注意点*: タイプが Lambda/EventBridge の場合、Destination は必須です。

 `Type`   <a name="sam-function-onsuccess-type"></a>
送信先で参照されるリソースのタイプです。サポートされているタイプは、`SQS`、`SNS`、`S3`、`Lambda`、および `EventBridge` です。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。  
*その他の注意点*: タイプが SQS/SNS で、`Destination` プロパティが空白のままになっている場合、SQS/SNS リソースは SAM によって自動生成されます。リソースを参照するには、SQS の場合は `<function-logical-id>.DestinationQueue`、SNS の場合は `<function-logical-id>.DestinationTopic` を使用します。タイプが Lambda/EventBridge の場合、`Destination` は必須です。

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

### SQS および Lambda 送信先を使用した EventInvoke 設定の例
<a name="sam-property-function-onsuccess--examples--eventinvoke-configuration-example-with-sqs-and-lambda-destinations"></a>

この例では、SQS OnSuccess 設定に Destination が指定されていないため、SAM は SQS キューを黙示的に作成し、必要な許可を追加します。また、この例では、テンプレートファイルで宣言された Lambda リソースの Destination が OnFailure 設定で指定されているため、SAM は、送信先の Lambda 関数を呼び出すために必要な許可をこの Lambda 関数に追加します。

#### YAML
<a name="sam-property-function-onsuccess--examples--eventinvoke-configuration-example-with-sqs-and-lambda-destinations--yaml"></a>

```
EventInvokeConfig:
  DestinationConfig:
    OnSuccess:
      Type: SQS
    OnFailure:
      Type: Lambda
      Destination: !GetAtt DestinationLambda.Arn  # Arn of a Lambda function declared in the template file.
```

### SNS 送信先を使用した EventInvoke 設定の例
<a name="sam-property-function-onsuccess--examples--eventinvoke-configuration-example-with-sns-destination"></a>

この例では、onSuccess 設定のテンプレートファイルで宣言された SNS トピックに Destination が指定されています。

#### YAML
<a name="sam-property-function-onsuccess--examples--eventinvoke-configuration-example-with-sns-destination--yaml"></a>

```
EventInvokeConfig:
  DestinationConfig:
    OnSuccess:
      Type: SNS
      Destination:
        Ref: DestinationSNS       # Arn of an SNS topic declared in the tempate file
```