本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
CodeDeploy 触发器的 JSON 数据格式
您可以使用在自定义通知工作流程中激活部署或实例的触发器时创建的 JSON 输出,如发送消息到 Amazon SQS 队列或调用 Amazon Lambda中的函数。
注意
本指南不解决如何使用 JSON 配置通知的问题。有关使用 Amazon SNS 将消息发送到 Amazon SQS 队列的信息,请参阅将 Amazon SNS 消息发送至 Amazon SQS 队列。有关使用 Amazon SNS 调用 Lambda 函数的信息,请参阅使用 Amazon SNS 通知调用 Lambda 函数。
以下示例显示了 CodeDeploy触发器可用的 JSON 输出结构。
适用于基于实例的触发器的示例 JSON 输出
{ "region": "us-east-2", "accountId": "111222333444", "eventTriggerName": "trigger-group-us-east-instance-succeeded", "deploymentId": "d-75I7MBT7C", "instanceId": "arn:aws:ec2:us-east-2:444455556666:instance/i-496589f7", "lastUpdatedAt": "1446744207.564", "instanceStatus": "Succeeded", "lifecycleEvents": [ { "LifecycleEvent": "ApplicationStop", "LifecycleEventStatus": "Succeeded", "StartTime": "1446744188.595", "EndTime": "1446744188.711" }, { "LifecycleEvent": "BeforeInstall", "LifecycleEventStatus": "Succeeded", "StartTime": "1446744189.827", "EndTime": "1446744190.402" } //More lifecycle events might be listed here ] }
适用于基于部署的触发器的示例 JSON 输出
{ "region": "us-west-1", "accountId": "111222333444", "eventTriggerName": "Trigger-group-us-west-3-deploy-failed", "applicationName": "ProductionApp-us-west-3", "deploymentId": "d-75I7MBT7C", "deploymentGroupName": "dep-group-def-456", "createTime": "1446744188.595", "completeTime": "1446744190.402", "deploymentOverview": { "Failed": "10", "InProgress": "0", "Pending": "0", "Skipped": "0", "Succeeded": "0" }, "status": "Failed", "errorInformation": { "ErrorCode": "IAM_ROLE_MISSING", "ErrorMessage": "IAM Role is missing for deployment group: dep-group-def-456" } }