

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 「偏離偵測狀態變更」事件詳細資訊
<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":""
    }
}
```