

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Izin dan contoh untuk Pemberitahuan AWS CodeStar
<a name="security_iam_id-based-policy-examples-notifications"></a>

Pernyataan dan contoh kebijakan berikut dapat membantu Anda mengelola AWS CodeStar Pemberitahuan.

## Izin yang terkait dengan notifikasi dalam kebijakan terkelola akses penuh
<a name="notifications-fullaccess"></a>

Kebijakan **AWSCodeCommitFullAccess**, **AWSCodeBuildAdminAccess**AWSCodeDeployFullAccess****, dan **AWSCodePipeline\_FullAccess**terkelola menyertakan pernyataan berikut untuk mengizinkan akses penuh ke notifikasi di konsol Alat Pengembang. Pengguna dengan salah satu kebijakan terkelola yang diterapkan ini juga dapat membuat dan mengelola topik Amazon SNS untuk notifikasi, berlangganan dan berhenti berlangganan pengguna ke topik, dan daftar topik untuk dipilih sebagai target untuk aturan notifikasi.

**catatan**  
Dalam kebijakan dikelola, kunci syarat `codestar-notifications:NotificationsForResource` akan memiliki nilai khusus untuk jenis sumber daya untuk layanan. Misalnya, dalam kebijakan akses penuh untuk CodeCommit, nilainya adalah`arn:aws:codecommit:*`.

```
    {
        "Sid": "CodeStarNotificationsReadWriteAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:CreateNotificationRule",
            "codestar-notifications:DescribeNotificationRule",
            "codestar-notifications:UpdateNotificationRule",
            "codestar-notifications:DeleteNotificationRule",
            "codestar-notifications:Subscribe",
            "codestar-notifications:Unsubscribe"
        ],
        "Resource": "*",
        "Condition" : {
            "StringLike" : {"codestar-notifications:NotificationsForResource" : "arn:aws:<vendor-code>:*"} 
        }
    },    
    {
        "Sid": "CodeStarNotificationsListAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:ListNotificationRules",
            "codestar-notifications:ListTargets",
            "codestar-notifications:ListTagsforResource",
            "codestar-notifications:ListEventTypes"
        ],
        "Resource": "*"
    },
    {
        "Sid": "CodeStarNotificationsSNSTopicCreateAccess",
        "Effect": "Allow",
        "Action": [
            "sns:CreateTopic",
            "sns:SetTopicAttributes"
        ],
        "Resource": "arn:aws:sns:*:*:codestar-notifications*"
    },
    {
        "Sid": "SNSTopicListAccess",
        "Effect": "Allow",
        "Action": [
            "sns:ListTopics"
        ],
        "Resource": "*"
    },
    {
        "Sid": "CodeStarNotificationsChatbotAccess",
        "Effect": "Allow",
        "Action": [
            "chatbot:DescribeSlackChannelConfigurations",
            "chatbot:ListMicrosoftTeamsChannelConfigurations"
          ],
       "Resource": "*"
    }
```

## Izin yang terkait dengan notifikasi dalam kebijakan terkelola hanya-baca
<a name="notifications-readonly"></a>

Kebijakan **AWSCodeCommitReadOnlyAccess**, **AWSCodeBuildReadOnlyAccess**AWSCodeDeployReadOnlyAccess****, dan **AWSCodePipeline\_ReadOnlyAccess**terkelola menyertakan pernyataan berikut untuk mengizinkan akses hanya-baca ke notifikasi. Misalnya, mereka dapat melihat notifikasi untuk sumber daya di konsol Alat Developer, tetapi tidak dapat membuat, mengelola, atau berlangganan notifikasi. 

**catatan**  
Dalam kebijakan dikelola, kunci syarat `codestar-notifications:NotificationsForResource` akan memiliki nilai khusus untuk jenis sumber daya untuk layanan. Misalnya, dalam kebijakan akses penuh untuk CodeCommit, nilainya adalah`arn:aws:codecommit:*`.

```
   {
        "Sid": "CodeStarNotificationsPowerUserAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:DescribeNotificationRule"
        ],
        "Resource": "*",
        "Condition" : {
            "StringLike" : {"codestar-notifications:NotificationsForResource" : "arn:aws:<vendor-code>:*"} 
        }
    },    
    {
        "Sid": "CodeStarNotificationsListAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:ListNotificationRules",
            "codestar-notifications:ListEventTypes",
            "codestar-notifications:ListTargets"
        ],
        "Resource": "*"
    }
```

## Izin terkait notifikasi dalam kebijakan terkelola lainnya
<a name="notifications-otheraccess"></a>

Kebijakan **AWSCodeCommitPowerUser**, **AWSCodeBuildDeveloperAccess**, dan **AWSCodeBuildDeveloperAccess**terkelola mencakup pernyataan berikut untuk mengizinkan pengembang menggunakan salah satu kebijakan terkelola ini yang diterapkan untuk membuat, mengedit, dan berlangganan notifikasi. Mereka tidak dapat menghapus aturan notifikasi atau mengelola tanda untuk sumber daya.

**catatan**  
Dalam kebijakan dikelola, kunci syarat `codestar-notifications:NotificationsForResource` akan memiliki nilai khusus untuk jenis sumber daya untuk layanan. Misalnya, dalam kebijakan akses penuh untuk CodeCommit, nilainya adalah`arn:aws:codecommit:*`.

```
    {
        "Sid": "CodeStarNotificationsReadWriteAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:CreateNotificationRule",
            "codestar-notifications:DescribeNotificationRule",
            "codestar-notifications:UpdateNotificationRule",
            "codestar-notifications:Subscribe",
            "codestar-notifications:Unsubscribe"
        ],
        "Resource": "*",
        "Condition" : {
            "StringLike" : {"codestar-notifications:NotificationsForResource" : "arn:aws:<vendor-code>:*"} 
        }
    },    
    {
        "Sid": "CodeStarNotificationsListAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:ListNotificationRules",
            "codestar-notifications:ListTargets",
            "codestar-notifications:ListTagsforResource",
            "codestar-notifications:ListEventTypes"
        ],
        "Resource": "*"
    },
    {
        "Sid": "SNSTopicListAccess",
        "Effect": "Allow",
        "Action": [
            "sns:ListTopics"
        ],
        "Resource": "*"
    },
    {
        "Sid": "CodeStarNotificationsChatbotAccess",
        "Effect": "Allow",
        "Action": [
            "chatbot:DescribeSlackChannelConfigurations",
            "chatbot:ListMicrosoftTeamsChannelConfigurations"
          ],
       "Resource": "*"
    }
```

## Contoh: Kebijakan tingkat administrator untuk mengelola Pemberitahuan AWS CodeStar
<a name="security_iam_id-based-policy-examples-notifications-full-access"></a>

Dalam contoh ini, Anda ingin memberi pengguna IAM di AWS akun Anda akses penuh ke AWS CodeStar Notifikasi sehingga pengguna dapat meninjau detail aturan notifikasi dan daftar aturan pemberitahuan, target, dan jenis acara. Anda juga ingin mengizinkan pengguna untuk menambahkan, memperbarui, dan menghapus aturan notifikasi. Ini adalah kebijakan akses penuh, setara dengan izin pemberitahuan yang disertakan sebagai bagian dari **AWSCodeBuildAdminAccess**,, **AWSCodeCommitFullAccess**AWSCodeDeployFullAccess****, dan kebijakan **AWSCodePipeline\_FullAccess**terkelola. Seperti kebijakan terkelola tersebut, Anda hanya boleh melampirkan pernyataan kebijakan semacam ini ke pengguna, grup, atau peran IAM yang memerlukan akses administratif penuh ke pemberitahuan dan aturan notifikasi di seluruh AWS akun Anda.

**catatan**  
Kebijakan ini berisi izin `CreateNotificationRule`. Setiap pengguna dengan kebijakan ini yang diterapkan pada pengguna atau peran IAM mereka akan dapat membuat aturan pemberitahuan untuk setiap dan semua jenis sumber daya yang didukung oleh AWS CodeStar Pemberitahuan di AWS akun, bahkan jika pengguna tersebut tidak memiliki akses ke sumber daya itu sendiri. Misalnya, pengguna dengan kebijakan ini dapat membuat aturan notifikasi untuk CodeCommit repositori tanpa izin untuk mengaksesnya sendiri. CodeCommit

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
      {
        "Sid": "AWSCodeStarNotificationsFullAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:CreateNotificationRule",
            "codestar-notifications:DeleteNotificationRule",
            "codestar-notifications:DescribeNotificationRule",
            "codestar-notifications:ListNotificationRules",
            "codestar-notifications:UpdateNotificationRule",
            "codestar-notifications:Subscribe",
            "codestar-notifications:Unsubscribe",
            "codestar-notifications:DeleteTarget",
            "codestar-notifications:ListTargets",
            "codestar-notifications:ListTagsforResource",
            "codestar-notifications:TagResource",
            "codestar-notifications:UntagResource"
        ],
        "Resource": "*"
     }
   ]
}
```

------

## Contoh: Kebijakan tingkat kontributor untuk menggunakan Notifikasi AWS CodeStar
<a name="security_iam_id-based-policy-examples-notifications-contributor"></a>

Dalam contoh ini, Anda ingin memberikan akses ke day-to-day penggunaan AWS CodeStar Notifikasi, seperti membuat dan berlangganan notifikasi, tetapi tidak untuk tindakan yang lebih merusak, seperti menghapus aturan atau target notifikasi. Ini setara dengan akses yang disediakan dalam **AWSCodeBuildDeveloperAccess**, **AWSCodeDeployDeveloperAccess**, dan kebijakan **AWSCodeCommitPowerUser**terkelola.

**catatan**  
Kebijakan ini berisi izin `CreateNotificationRule`. Setiap pengguna dengan kebijakan ini yang diterapkan pada pengguna atau peran IAM mereka akan dapat membuat aturan pemberitahuan untuk setiap dan semua jenis sumber daya yang didukung oleh AWS CodeStar Pemberitahuan di AWS akun, bahkan jika pengguna tersebut tidak memiliki akses ke sumber daya itu sendiri. Misalnya, pengguna dengan kebijakan ini dapat membuat aturan notifikasi untuk CodeCommit repositori tanpa izin untuk mengaksesnya sendiri. CodeCommit

```
{
    "Version": "2012-10-17",		 	 	 
    "Sid": "AWSCodeStarNotificationsPowerUserAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:CreateNotificationRule",
            "codestar-notifications:DescribeNotificationRule",
            "codestar-notifications:ListNotificationRules",
            "codestar-notifications:UpdateNotificationRule",
            "codestar-notifications:Subscribe",
            "codestar-notifications:Unsubscribe",
            "codestar-notifications:ListTargets",
            "codestar-notifications:ListTagsforResource"
        ],
        "Resource": "*"
        }
    ]
}
```

## Contoh: read-only-level Kebijakan untuk menggunakan AWS CodeStar Notifikasi
<a name="security_iam_id-based-policy-examples-notifications-read-only"></a>

Dalam contoh ini, Anda ingin memberi pengguna IAM di akun Anda akses hanya baca ke aturan notifikasi, target, dan jenis peristiwa di akun AWS Anda. Contoh ini menunjukkan bagaimana Anda dapat membuat kebijakan yang memungkinkan melihat item ini. Ini setara dengan izin yang disertakan sebagai bagian dari **AWSCodeBuildReadOnlyAccess**, **AWSCodeCommitReadOnly**, dan kebijakan **AWSCodePipeline\_ReadOnlyAccess**terkelola.

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Id": "CodeNotificationforReadOnly",
    "Statement": [
        {
            "Sid": "ReadsAccess",
            "Effect": "Allow",
            "Action": [
                "codestar-notifications:DescribeNotificationRule",
                "codestar-notifications:ListNotificationRules",
                "codestar-notifications:ListTargets",
                "codestar-notifications:ListEventTypes"
            ],
            "Resource": "*"
        }
    ]
}
```

------