

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

# 檢視通知規則
<a name="notification-rule-view"></a>

您可以使用開發人員工具主控台或 AWS CLI 檢視 AWS 區域中所有資源的所有通知規則。您也可以檢視每個通知規則的詳細資訊。與建立通知規則的程序不同，您不必前往資源的資源頁面。<a name="notification-rule-view-console"></a>

# 檢視通知規則 (主控台)
<a name="notification-rule-view-console"></a>

1. 開啟位於 https：//[https://console.aws.amazon.com/codesuite/settings/notifications](https://console.aws.amazon.com/codesuite/settings/notifications/) 的 AWS 開發人員工具主控台。

1. 在導覽列中，展開 **Settings (設定)**，然後選擇 **Notification rules (通知規則)**。

1. 在**通知規則**中，檢閱 AWS 帳戶 AWS 區域 您目前登入所在 中 的資源所設定的規則清單。使用選擇器變更 AWS 區域。

1. 若要檢視通知規則的詳細資訊，請從清單中選擇它，然後選擇 **View details (檢視詳細資訊)**。您也可以簡單地在清單中選擇其名稱。<a name="notification-rule-view-list-cli"></a>

# 檢視通知規則清單 (AWS CLI)
<a name="notification-rule-view-list-cli"></a>

1. 在終端機或命令提示字元中，執行 **list-notification-rules**命令以檢視指定 AWS 區域的所有通知規則。

   ```
   aws codestar-notifications list-notification-rules --region {{us-east-1}}
   ```

1. 如果成功，此命令會傳回 AWS 區域中每個通知規則的 ID 和 ARN，如下所示。

   ```
   {
       "NotificationRules": [
           {
               "Id": "dc82df7a-EXAMPLE",
               "Arn": "arn:aws:codestar-notifications:{{us-east-1}}:{{123456789012}}:notificationrule/dc82df7a-EXAMPLE"
           },
           {
               "Id": "8d1f0983-EXAMPLE",
               "Arn": "arn:aws:codestar-notifications:{{us-east-1}}:{{123456789012}}:notificationrule/8d1f0983-EXAMPLE"
           }
       ]
   }
   ```<a name="notification-rule-view-details-cli"></a>

# 檢視通知規則的詳細資訊 (AWS CLI)
<a name="notification-rule-view-details-cli"></a>

1. 在終端機或命令提示字元中，執行 **describe-notification-rule** 命令，並指定通知規則的 ARN。

   ```
   aws codestar-notifications describe-notification-rule --arn arn:aws:codestar-notifications:{{us-east-1}}:{{123456789012}}:notificationrule/dc82df7a-EXAMPLE
   ```

1. 如果成功，此命令傳回的輸出會類似如下。

   ```
   {
       "LastModifiedTimestamp": 1569199844.857,
       "EventTypes": [
           {
               "ServiceName": "CodeCommit",
               "EventTypeName": "Branches and tags: Created",
               "ResourceType": "Repository",
               "EventTypeId": "codecommit-repository-branches-and-tags-created"
           }
       ],
       "Status": "ENABLED",
       "DetailType": "FULL",
       "Resource": "arn:aws:codecommit:{{us-east-1}}:{{123456789012}}:{{MyDemoRepo}}",
       "Arn": "arn:aws:codestar-notifications:{{us-east-1}}:{{123456789012}}:notificationrule/dc82df7a-EXAMPLE",
       "Targets": [
           {
               "TargetStatus": "ACTIVE",
               "TargetAddress": "arn:aws:sns:{{us-east-1}}:{{123456789012}}:{{MyNotificationTopic}}",
               "TargetType": "SNS"
           }
       ],
       "Name": "{{MyNotificationRule}}",
       "CreatedTimestamp": 1569199844.857,
       "CreatedBy": "arn:aws:iam::123456789012:user/Mary_Major"
   }
   ```<a name="notification-rule-view-tags-cli"></a>

# 檢視通知規則的標籤清單 (AWS CLI)
<a name="notification-rule-view-tags-cli"></a>

1. 在終端機或命令提示字元中，執行 **list-tags-for-resource** 命令來檢視所指定通知規則 ARN 的所有標籤。

   ```
   aws codestar-notifications list-tags-for-resource --arn arn:aws:codestar-notifications:us-east-1:123456789012:notificationrule/fe1efd35-EXAMPLE
   ```

1. 如果成功，此命令傳回的輸出會類似如下。

   ```
   {
       "Tags": {
           "Team": "Li_Juan"
       }
   }
   ```