

# CloudFormation 事件详细信息参考
<a name="events-detail-reference"></a>

来自 AWS 服务的所有事件都有一组公共字段，其中包含有关事件的元数据，例如作为事件源的 AWS 服务、事件的生成时间、事件发生的账户和区域等。有关这些常规字段的定义，请参阅《AWS Events Reference》**中的 [AWS service event metadata](https://docs.aws.amazon.com/eventbridge/latest/ref/events-structure.html)。

此外，每个事件都有一个 `detail` 字段，其中包该特定事件专有的数据。下面的参考定义了各种 CloudFormation 事件的详细信息字段。

在使用 EventBridge 选择和管理 CloudFormation 事件时，请记住以下几点：
+ `source` 字段指定事件源。

  例如，`aws.cloudformation` 或 `aws.codeconnections`。
+ `detail-type` 字段指定事件类型。

  例如，`CloudFormation Resource Status Change` 或 `CloudFormation Drift Detection Status Change`。
+ `detail` 字段包含该特定事件专有的数据。

  例如，堆栈 ID、涉及的资源、各种资源的状态以及与特定类型事件相关的其他数据。

有关如何构造使规则能够匹配 CloudFormation 事件的事件模式的信息，请参阅《Amazon EventBridge 用户指南》中的[事件模式](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html)**。

有关事件以及 EventBridge 如何处理事件的更多信息，请参阅《Amazon EventBridge 用户指南》**中的 [EventBridge 事件](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-events.html)。

**Topics**
+ [

# 资源状态更改事件详细信息
](event-detail-resource-status-change.md)
+ [

# 堆栈状态更改事件详细信息
](event-detail-stack-status-change.md)
+ [

# 偏差检测状态更改事件详细信息
](event-detail-stack-drift-detection-change.md)
+ [

# StackSet 状态更改事件详细信息
](event-detail-stackset-status-change.md)
+ [

# StackSet 堆栈实例状态更改事件详细信息
](event-detail-stackset-stack-instance-status-change.md)
+ [

# StackSet 操作状态更改事件详细信息
](event-detail-stackset-operation-status-change.md)
+ [

# 存储库同步状态更改事件详细信息
](event-detail-respository-sync-status-change.md)
+ [

# 资源同步状态更改事件详细信息
](event-detail-resource-sync-status-change.md)

# 资源状态更改事件详细信息
<a name="event-detail-resource-status-change"></a>

以下是资源状态更改事件的详细信息字段。

之所以包含 `source` 和 `detail-type` 字段，是因为其包含事件的特定值。

```
{
  . . .,
  "detail-type": "CloudFormation Resource Status Change",
  "source": "aws.cloudformation",
  . . .,
  "detail": {
    "stack-id" : "string",
    "logical-resource-id" : "string",
    "physical-resource-id": "string",
    "status-details": {
        "status": "string",
        "status-reason": "string"
    },
     "resource-type": "string",
     "client-request-token": "string"
  }
}
```

`detail-type`  <a name="resource-status-change-detail-type"></a>
标识事件的类型。  
对于资源状态事件，此值为 `CloudFormation Resource Status Change`。

`source`  <a name="resource-status-change-source"></a>
标识生成事件的服务。对于 CloudFormation 事件，此值为 `aws.cloudformation`。

`detail`  <a name="resource-status-change-detail"></a>
包含关于事件信息的 JSON 对象。生成事件的服务决定该字段的内容。  
对于资源状态事件，这些数据包括：    
`stack-id`  <a name="resource-status-change-stack-id"></a>
与堆栈关联的唯一堆栈 ID。  
`logical-resource-id`  <a name="resource-status-change-logical-resource-id"></a>
资源的逻辑名称，如模板中所规定。  
`physical-resource-id`  <a name="resource-status-change-physical-resource-id"></a>
与 CloudFormation 所支持资源的物理实例 ID 对应的名称或唯一标识符。  
`status-details`  <a name="resource-status-change-status-details"></a>  
`status`  <a name="resource-status-change-status"></a>
资源的状态。  
`status-reason`  <a name="resource-status-change-status-reason"></a>
资源的状态原因。  
`resource-type`  <a name="resource-status-change-resource-type"></a>
资源的类型。例如 `AWS::S3::Bucket`。  
`client-request-token`  <a name="resource-status-change-client-request-token"></a>
用于调用 API 的访问令牌。由给定堆栈操作启动的所有事件分配的客户端请求令牌都是相同的，可使用此令牌跟踪操作。从控制台发起的堆栈操作使用令牌格式 *Console-StackOperation-ID*，这有助于您轻松识别堆栈操作。例如，如果使用控制台创建堆栈，则将向每个生成的堆栈事件分配以下格式的相同令牌：`Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002`。

**Example 示例：资源状态更改事件**  <a name="event-detail-resource-status-change.example"></a>
以下是资源状态事件的示例。此事件详细说明了 CloudFormation 已在指定堆栈中成功创建所请求的资源，即 Amazon S3 存储桶。  

```
{
    "version":"0",
    "id":"6a7e8feb-b491-4cf7-a9f1-bf3703467718",
    "detail-type":"CloudFormation Resource Status Change",
    "source":"aws.cloudformation",
    "account":"111122223333",
    "time":"2017-12-22T18:43:48Z",
    "region":"us-west-1",
    "resources":[
        "arn:aws:cloudformation:us-west-1:111122223333:stack/teststack"
    ],
    "detail":{
        "stack-id":"arn:aws:cloudformation:us-west-1:111122223333:stack/teststack",
        "logical-resource-id":"my-s3-bucket",
        "physical-resource-id":"arn:aws:s3:::my-s3-bucket-us-east-1",
        "status-details":{
            "status":"CREATE_COMPLETE",
            "status-reason":""
        },
        "resource-type":"AWS::S3::Bucket",
        "client-request-token":""
    }
}
```

# 堆栈状态更改事件详细信息
<a name="event-detail-stack-status-change"></a>

以下是堆栈状态更改事件的详细信息字段。

之所以包含 `source` 和 `detail-type` 字段，是因为其包含事件的特定值。

```
{
  . . .,
  "detail-type":"CloudFormation Stack Status Change",
  "source":"aws.cloudformation",
  . . .,
  "detail":{
    "stack-id":"string",
    "status-details":{
      "status":"string",
      "status-reason":"string"
    },
    "client-request-token":"string"
  }
}
```

`detail-type`  <a name="stack-status-change-detail-type"></a>
标识事件的类型。  
对于堆栈状态事件，此值为 `CloudFormation Stack Status Change`。

`source`  <a name="stack-status-change-source"></a>
标识生成事件的服务。对于 CloudFormation 事件，此值为 `aws.cloudformation`。

`detail`  <a name="stack-status-change-detail"></a>
包含关于事件信息的 JSON 对象。生成事件的服务决定该字段的内容。  
对于堆栈状态事件，这些数据包括：    
`stack-id`  <a name="stack-status-change-stack-id"></a>
与堆栈关联的唯一堆栈 ID。  
`status-details`  <a name="stack-status-change-status-details"></a>  
`status`  <a name="stack-status-change-status"></a>
堆栈的状态。  
有关堆栈状态代码的完整列表，请参阅 [堆栈状态代码](view-stack-events.md#cfn-console-view-stack-data-resources-status-codes)。  
`status-reason`  <a name="stack-status-change-status-reason"></a>
资源的状态原因。  
`client-request-token`  <a name="stack-status-change-client-request-token"></a>
用于调用 API 的访问令牌。由给定堆栈操作启动的所有事件分配的客户端请求令牌都是相同的，可使用此令牌跟踪操作。从控制台发起的堆栈操作使用令牌格式 *Console-StackOperation-ID*，这有助于您轻松识别堆栈操作。例如，如果使用控制台创建堆栈，则将向每个生成的堆栈事件分配以下格式的相同令牌：`Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002`。

**Example 示例：堆栈状态事件**  <a name="event-detail-stack-status-change.example"></a>
以下是示例堆栈状态事件，其中 CloudFormation 已成功创建所请求的堆栈 `teststack`。  

```
{
    "version":"0",
    "id":"6a7e8feb-b491-4cf7-a9f1-bf3703467718",
    "detail-type":"CloudFormation Stack Status Change",
    "source":"aws.cloudformation",
    "account":"111122223333",
    "time":"2017-12-22T18:43:48Z",
    "region":"us-west-1",
    "resources":[
        "arn:aws:cloudformation:us-west-1:111122223333:stack/teststack"
    ],
    "detail":{
        "stack-id":"arn:aws:cloudformation:us-west-1:111122223333:stack/teststack",
        "status-details":{
            "status":"CREATE_COMPLETE",
            "status-reason":""
        },
        "client-request-token":""
    }
}
```

# 偏差检测状态更改事件详细信息
<a name="event-detail-stack-drift-detection-change"></a>

以下是堆栈偏差检测事件的详细信息字段。

之所以包含 `source` 和 `detail-type` 字段，是因为其包含事件的特定值。

```
{
  . . .,
  "detail-type":"CloudFormation Drift Detection Status Change",
  "source":"aws.cloudformation",
  . . .,
  "detail":{
    "stack-id":"string",
    "stack-drift-detection-id":"string",
    "status-details":{
      "stack-drift-status":"string",
      "detection-status":"string"
    },
      "drift-detection-details":{
        "drifted-stack-resource-count":integer
      },
    "client-request-token":"string"
  }
}
```

`detail-type`  <a name="drift-detection-status-change-detail-type"></a>
标识事件的类型。  
对于堆栈偏差检测事件，此值为 `CloudFormation Drift Detection Status Change`。

`source`  <a name="drift-detection-status-change-source"></a>
标识生成事件的服务。对于 CloudFormation 事件，此值为 `aws.cloudformation`。

`detail`  <a name="drift-detection-status-change-detail"></a>
包含关于事件信息的 JSON 对象。生成事件的服务决定该字段的内容。  
对于堆栈偏差检测事件，这些数据包括：    
`stack-id`  <a name="drift-detection-status-change-stack-id"></a>
与堆栈关联的唯一堆栈 ID。  
`stack-drift-detection-id`  <a name="drift-detection-status-change-stack-drift-detection-id"></a>
堆栈偏差检测 ID。  
`status-details`  <a name="drift-detection-status-change-status-details"></a>  
`stack-drift-status`  <a name="drift-detection-status-change-stack-drift-status"></a>
堆栈的偏差状态。  
`detection-status`  <a name="drift-detection-status-change-detection-status"></a>
偏差检测操作的状态。  
`drift-detection-details`  <a name="drift-detection-status-change-drift-detection-details"></a>  
`drifted-stack-resource-count`  <a name="drift-detection-status-change-drifted-stack-resource-count"></a>
资源数量偏差。值为 `-1` 时，偏差检测正在进行。所有其他非负整数均表示偏差资源的实际数量。  
`client-request-token`  <a name="drift-detection-status-change-client-request-token"></a>
用于调用 API 的访问令牌。由给定堆栈操作启动的所有事件分配的客户端请求令牌都是相同的，可使用此令牌跟踪操作。从控制台发起的堆栈操作使用令牌格式 *Console-StackOperation-ID*，这有助于您轻松识别堆栈操作。例如，如果使用控制台创建堆栈，则将向每个生成的堆栈事件分配以下格式的相同令牌：`Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002`。

**Example 示例：堆栈偏差检测事件**  <a name="event-detail-stack-drift-detection-change.example"></a>
下面展示的是堆栈偏差检测事件的示例。此事件详细说明了 CloudFormation 已完成对指定堆栈的偏差检测，且因一个资源出现偏差，堆栈当前偏差状态为 `DRIFTED`。  

```
{
    "version":"0",
    "id":"6a7e8feb-b491-4cf7-a9f1-bf3703467718",
    "detail-type":"CloudFormation Drift Detection Status Change",
    "source":"aws.cloudformation",
    "account":"111122223333",
    "time":"2017-12-22T18:43:48Z",
    "region":"us-west-1",
    "resources": ["string"],
    "detail":{
        "stack-id":"arn:aws:cloudformation:us-west-1:111122223333:stack/teststack",
        "stack-drift-detection-id":"624af370-311a-11e8-b6b7-500cexample",
        "status-details":{
            "stack-drift-status":"DRIFTED",
            "detection-status":"DETECTION_COMPLETE"
        },
        "drift-detection-details":{
            "drifted-stack-resource-count":1
        },
    "client-request-token":""
    }
}
```

# StackSet 状态更改事件详细信息
<a name="event-detail-stackset-status-change"></a>

以下是 StackSet 状态更改事件的详细信息字段。

之所以包含 `source` 和 `detail-type` 字段，是因为其包含事件的特定值。

```
{
  . . .,
  "detail-type": "CloudFormation StackSet Status Change",
  "source": "aws.cloudformation",
  . . .,
  "detail": {
    "stack-set-arn" : "string",
    "status-details": {
        "status":"string"
    }
  }
}
```

`detail-type`  <a name="stackset-status-change-detail-type"></a>
标识事件的类型。  
对于 StackSet 状态事件，此值为 `CloudFormation StackSet Status Change`。

`source`  <a name="stackset-status-change-source"></a>
标识生成事件的服务。对于 CloudFormation 事件，此值为 `aws.cloudformation`。

`detail`  <a name="stackset-status-change-detail"></a>
包含关于事件信息的 JSON 对象。生成事件的服务决定该字段的内容。  
对于 StackSet 状态事件，这些数据包括：    
`stack-set-arn`  <a name="stackset-status-change-stack-set-arn"></a>
与堆栈集关联的 Amazon 资源名称（ARN）。  
`status-details`  <a name="stackset-status-change-status-details"></a>  
`status`  <a name="stackset-status-change-status"></a>
StackSet 状态。  
*有效值*：`ACTIVE` \$1 `DELETED`

**Example 示例：StackSet 状态更改事件**  <a name="event-detail-stackset-status-change.example"></a>
以下是 StackSet 状态更改事件的示例。此事件详细说明了 CloudFormation 已删除指定的堆栈集。  

```
{
  "version": "0",
  "id": "42h6hb90-hg0w-11op-b01v-0xhnh0934z09",
  "detail-type": "CloudFormation StackSet Status Change",
  "source": "aws.cloudformation",
  "account": "111122223333",
  "time": "2021-09-23T17:06:18Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:cloudformation:us-east-1:111122223333:stackset/test12345:3f3a3fbe-c937-4eb3-a87d-e36a0af3f663"
  ],
  "detail": {
    "stack-set-arn" : "arn:aws:cloudformation:us-east-1:111122223333:stackset/test12345:3f3a3fbe-c937-4eb3-a87d-e36a0af3f663",
    "status-details": {
        "status":"DELETED"
    }
  }
}
```

# StackSet 堆栈实例状态更改事件详细信息
<a name="event-detail-stackset-stack-instance-status-change"></a>

以下是 StackSet 堆栈实例状态事件的详细信息字段。

之所以包含 `source` 和 `detail-type` 字段，是因为其包含事件的特定值。

```
{
  . . .,
  "detail-type": "CloudFormation StackSet StackInstance Status Change",
  "source": "aws.cloudformation",
  . . .,
  "detail": {
    "stack-set-arn" : "string",
    "stack-id" : "string",
    "action" : "string",       
    "status-details": {
        "status": "string",
        "status-reason": "string",
        "detailed-status": "string"
      }
    }
  }
}
```

`detail-type`  <a name="stackset-stack-instance-status-detail-type"></a>
标识事件的类型。  
对于 StackSet 堆栈实例状态事件，此值为 `CloudFormation StackSet StackInstance Status Change`。

`source`  <a name="stackset-stack-instance-status-source"></a>
标识生成事件的服务。对于 CloudFormation 事件，此值为 `aws.cloudformation`。

`detail`  <a name="stackset-stack-instance-status-detail"></a>
包含关于事件信息的 JSON 对象。生成事件的服务决定该字段的内容。  
对于 StackSet 堆栈实例状态事件，这些数据包括：    
`stack-set-arn`  <a name="stackset-stack-instance-status-stack-set-arn"></a>
与 StackSet 关联的 Amazon 资源名称（ARN）。  
`stack-id`  <a name="stackset-stack-instance-status-stack-id"></a>
与堆栈实例关联的唯一堆栈 ID。  
`action`  <a name="stackset-stack-instance-status-action"></a>
堆栈集操作的类型。  
*有效值*：`CREATE` \$1 `UPDATE` \$1 `DELETE` \$1 `DETECT_DRIFT`  
`status-details`  <a name="stackset-stack-instance-status-status-details"></a>  
`status`  <a name="stackset-stack-instance-status-status"></a>
StackSet 实例的状态。  
有关更多详细信息，请参阅[堆栈实例状态代码](stacksets-concepts.md#stack-instance-status-codes)。  
*有效值*：`CURRENT` \$1 `OUTDATED`\$1 `INOPERABLE`  
`status-reason`  <a name="stackset-stack-instance-status-status-reason"></a>
StackSet 实例的状态原因。  
`detailed-status`  <a name="stackset-stack-instance-status-detailed-status"></a>
详细 StackSet 实例的详细状态。  
*有效值*：`CANCELLED` \$1 `FAILED` \$1 `FAILED_IMPORT` \$1 `INOPERABLE` \$1 `PENDING` \$1 `RUNNING` \$1 `SKIPPED_SUSPENDED_ACCOUNT` \$1 `SUCCEEDED`

**Example 示例：StackSet 堆栈实例状态更改事件**  <a name="event-detail-stackset-stack-instance-status-change.example"></a>
以下是 StackSet 堆栈实例状态更改事件的示例。  

```
{
  "version": "0",
  "id": "42h6hb90-hg0w-11op-b01v-0xhnh0934z09",
  "detail-type": "CloudFormation StackSet StackInstance Status Change",
  "source": "aws.cloudformation",
  "account": "111122223333",
  "time": "2021-09-22T19:19:23Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:cloudformation:us-east-1:111122223333:stackset/test1234:e5f54eea-d041-44ad-94f8-b8268aca1e59"
  ],
  "detail": {
     "stack-set-arn": "arn:aws:cloudformation:us-east-1:111122223333:stackset/test1234:e5f54eea-d041-44ad-94f8-b8268aca1e59",
    "stack-id": "arn:aws:cloudformation:us-west-1:111122223333:stack/teststack",
    "status-details": {
        "status": "OUTDATED",
        "status-reason": "User Initiated",
        "detailed-status": "PENDING"
    }
  }
}
```

# StackSet 操作状态更改事件详细信息
<a name="event-detail-stackset-operation-status-change"></a>

以下是 StackSet 操作状态更改事件的详细信息字段。

之所以包含 `source` 和 `detail-type` 字段，是因为其包含事件的特定值。

```
{
  . . .,
  "detail-type": "CloudFormation StackSet Operation Status Change",
  "source": "aws.cloudformation",
  . . .,
  "detail": {
    "stack-set-arn" : "string",
    "stack-set-operation-id" : "string",
    "status-details": {
        "status": "string"
      }
    }
  }
}
```

`detail-type`  <a name="stackset-operation-status-change-detail-type"></a>
标识事件的类型。  
对于 StackSet 操作状态事件，此值为 `CloudFormation StackSet Operation Status Change`。

`source`  <a name="stackset-operation-status-change-source"></a>
标识生成事件的服务。对于 CloudFormation 事件，此值为 `aws.cloudformation`。

`detail`  <a name="stackset-operation-status-change-detail"></a>
包含关于事件信息的 JSON 对象。生成事件的服务决定该字段的内容。  
对于 StackSet 操作状态事件，这些数据包括：    
`stack-set-arn`  <a name="stackset-operation-status-change-stack-set-arn"></a>
与 StackSet 关联的 Amazon 资源名称（ARN）。  
`stack-set-operation-id`  <a name="stackset-operation-status-change-stack-set-operation-id"></a>
与 StackSet 操作关联的唯一 ID。  
`status-details`  <a name="stackset-operation-status-change-status-details"></a>  
`status`  <a name="stackset-operation-status-change-status"></a>
StackSet 操作状态。  
有关更多详细信息，请参阅[StackSets 状态代码](stacksets-concepts.md#stackset-status-codes)。  
*有效值*：`RUNNING` \$1 `SUCCEEDED` \$1 `FAILED` \$1 `STOPPING` \$1 `STOPPED` \$1 `QUEUED`

**Example 示例：StackSet 操作状态更改事件**  <a name="event-detail-stackset-operation-status-change.example"></a>
以下是 StackSet 操作状态更改事件的示例。事件详细说明了 CloudFormation 已成功完成对指定堆栈集所请求的操作。  

```
{
  "version": "0",
  "id": "4de89905-fd92-6a6b-9509-23c04bcb6a21",
  "detail-type": "CloudFormation StackSet Operation Status Change",
  "source": "aws.cloudformation",
  "account": "111122223333",
  "time": "2021-09-22T05:46:24Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:cloudformation:us-east-1:111122223333:stackset/test1234:e5f54eea-d041-44ad-94f8-b8268aca1e59"
  ],
  "detail": {
    "stack-set-arn": "arn:aws:cloudformation:us-east-1:111122223333:stackset/test1234:e5f54eea-d041-44ad-94f8-b8268aca1e59",
    "stack-set-operation-id": "ce69adce-2221-4483-8c4b-c51f284f25e8",
    "status-details": {
        "status": "SUCCEEDED"
    }
  }
}
```

# 存储库同步状态更改事件详细信息
<a name="event-detail-respository-sync-status-change"></a>

以下是存储库同步状态更改事件的详细信息字段。

之所以包含 `source` 和 `detail-type` 字段，是因为其包含事件的特定值。

```
{
  . . .,
  "detail-type": "Git Sync Repository Sync Status Change",
  "source": "aws.codeconnections",
  . . .,
  "detail": {
    "connectionArn" : "string",
    "providerType" : "string",
    "repositoryName": "string",
    "providerType": "string",
    "repositoryName": "string",
    "repositoryArn": "string",
    "repositoryLinkId": "string",
    "ownerId": "string",
    "commit": "string",
    "branch": "string",
    "syncType": "string",
    "status": "string",
    "previousSync": "string"
    }
  }
}
```

`detail-type`  <a name="respository-sync-status-change-detail-type"></a>
标识事件的类型。  
对于存储库同步状态事件，此值为 `Git Sync Repository Sync Status Change`。

`source`  <a name="respository-sync-status-change-source"></a>
标识生成事件的服务。对于 Git 同步事件，此值为 `aws.codeconnections`。

`detail`  <a name="respository-sync-status-change-detail"></a>
包含关于事件信息的 JSON 对象。生成事件的服务决定该字段的内容。  
对于存储库同步状态事件，此数据包括：    
`connectionArn`  <a name="respository-sync-status-change-connection-arn"></a>
与 CodeConnections 关联的 Amazon 资源名称（ARN）。  
`providerType`  <a name="respository-sync-status-change-provider-type"></a>
连接到 CloudFormation 的 Git 提供程序。  
*有效值*：`GitHub` \$1 `GitHub Enterprise` \$1 `GitLab` \$1 `BitBucket`  
`repositoryName`  <a name="respository-sync-status-change-repository-name"></a>
Git 存储库名称。  
`repositoryArn`  <a name="respository-sync-status-change-repository-arn"></a>
与 Git 存储库关联的 ARN。  
`repositoryLinkId`  <a name="respository-sync-status-change-repository-link-id"></a>
与存储库链接关联的唯一 ID。  
`ownerId`  <a name="respository-sync-status-change-owner-id"></a>
与存储库所有者关联的唯一 ID。  
`commit`  <a name="respository-sync-status-change-commit"></a>
与存储库提交关联的唯一 ID。  
`branch`  <a name="respository-sync-status-change-branch"></a>
与存储库分支关联的唯一 ID。  
`syncType`  <a name="respository-sync-status-change-sync-type"></a>
所执行的同步的类型。  
`status`  <a name="respository-sync-status-change-status"></a>
当前存储库同步状态。  
*有效值*：`FAILED` \$1 `INITIATED` \$1 `IN_PROGRESS` \$1 `SUCCEEDED`  
`previousSync`  <a name="respository-sync-status-change-previous-sync"></a>
当前状态之前的同步状态。  
*有效值*：`FAILED` \$1 `INITIATED` \$1 `IN_PROGRESS` \$1 `SUCCEEDED`

**Example 示例：存储库同步状态更改事件**  <a name="event-detail-respository-sync-status-change.example"></a>
以下是存储库同步状态更改事件的示例。该事件详细说明了 CodeConnections 已成功同步存储库。  

```
{
  "version": "0",
  "id": "1b5d8feb-agbv-4cf7-a9f1-bf3703467718",
  "detail-type": "GitSync Repository Sync Status Change",
  "source": "aws.codeconnections",
  "account": "111122223333",
  "time": "2023-12-22T18:43:48Z",
  "region": "us-east-1",
  "resources": ["arn:aws:aws:codestar-connections:us-east-1:111122223333:repository-link/550e8400-e29b-41d4-a716-446655440000",],
  "detail": {
    "connectionArn": "arn:aws:codestar-connections:us-east-1:111122223333:connection/sample-connection-id",
    "providerType": "GitHub",
    "repositoryName": "sample-repository-name",
    "repositoryArn": "arn:aws:aws:codestar-connections:us-east-1:111122223333:repository-link/550e8400-e29b-41d4-a716-446655440000"
    "repositoryLinkId": "550e8400-e29b-41d4-a716-446655440000"
    "ownerId": "sample-owner-id",
    "commit": "sample-commit-id",
    "branch": "main",
    "syncType": "CFN_STACK_SYNC",
    "status": "SUCCEEDED",
    "previousStatus": "IN_PROGRESS",
  }
}
```

# 资源同步状态更改事件详细信息
<a name="event-detail-resource-sync-status-change"></a>

以下是资源同步状态更改事件的详细信息字段。

之所以包含 `source` 和 `detail-type` 字段，是因为其包含事件的特定值。

```
{
  . . .,
  "detail-type": "Git Sync Resource Sync Status Change",
  "source": "aws.codeconnections",
  . . .,
  "detail": {
    "providerType" : "string",
    "commit" : "string",
    "repositoryName": "string",
    "branch": "string",
    "syncType": "string",
    "syncTarget": "string",
    "status": "string",
    "previousSync": "string"
  }
}
```

`detail-type`  <a name="resource-sync-status-change-detail-type"></a>
标识事件的类型。  
对于存储库同步状态事件，此值为 `Git Sync Repository Sync Status Change`。

`source`  <a name="resource-sync-status-change-source"></a>
标识生成事件的服务。对于 Git 同步事件，此值为 `aws.codeconnections`。

`detail`  <a name="resource-sync-status-change-detail"></a>
包含关于事件信息的 JSON 对象。生成事件的服务决定该字段的内容。  
对于资源同步状态事件，这些数据包括：    
`providerType`  <a name="resource-sync-status-change-provider-type"></a>
连接到 CloudFormation 的 Git 提供程序。  
*有效值*：`GitHub` \$1 `GitHub Enterprise` \$1 `GitLab` \$1 `BitBucket`  
`commit`  <a name="resource-sync-status-change-commit"></a>
与存储库提交关联的唯一 ID。  
`repositoryName`  <a name="resource-sync-status-change-repository-name"></a>
Git 存储库名称。  
`branch`  <a name="resource-sync-status-change-branch"></a>
与存储库分支关联的唯一 ID。  
`syncType`  <a name="resource-sync-status-change-sync-type"></a>
所执行的同步的类型。  
`syncTarget`  <a name="resource-sync-status-change-sync-target"></a>
资源同步的目标堆栈。  
`status`  <a name="resource-sync-status-change-status"></a>
当前存储库同步状态。  
*有效值*：`FAILED` \$1 `INITIATED` \$1 `IN_PROGRESS` \$1 `SUCCEEDED`  
`previousSync`  <a name="resource-sync-status-change-previous-sync"></a>
当前状态之前的同步状态。  
*有效值*：`FAILED` \$1 `INITIATED` \$1 `IN_PROGRESS` \$1 `SUCCEEDED`

**Example 示例：资源同步状态更改事件**  <a name="event-detail-resource-sync-status-change.example"></a>
以下是资源同步状态更改事件的示例。该事件详细说明了 CodeConnections 已成功同步资源。  

```
{
  "version": "0",
  "id": "1b5d8feb-agbv-4cf7-a9f1-bf3703467718",
  "detail-type": "Git Sync Resource Sync Status Change",
  "source": "aws.codeconnections",
  "account": "111122223333",
  "time": "2023-12-22T18:43:48Z",
  "region": "us-east-1",
  "resources": ["arn:aws:aws:cloudformation:us-east-1:111122223333:stack/targetStack1"],
  "detail": {
    "providerType": "GitHub",
    "commit": "sample-commit-id",
    "repositoryName": "sample-repository-name",
    "branch": "main",
    "syncType": "CFN_STACK_SYNC",
    "syncTarget": "arn:aws:aws:cloudformation:us-east-1:111122223333:stack/targetStack1",
    "status": "SUCCEEDED",
    "previousStatus": "IN_PROGRESS"
  }
}
```