

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# AWS CodeStar Notifications のアクセス許可と例
<a name="security_iam_id-based-policy-examples-notifications"></a>

次のポリシーステートメントと例は、 AWS CodeStar Notifications の管理に役立ちます。

## フルアクセスマネージドポリシーの通知に関連するアクセス許可
<a name="notifications-fullaccess"></a>

**AWSCodeCommitFullAccess**、**AWSCodeBuildAdminAccess**、**AWSCodeDeployFullAccess**、および **AWSCodePipeline\$1FullAccess** マネージドポリシーには、デベロッパーツールコンソールの通知へのフルアクセスを許可するために以下のステートメントが含まれています。これらの管理ポリシーのいずれかが適用されたユーザーは、通知の Amazon SNS トピックの作成と管理、トピックに対するユーザーのサブスクライブとサブスクライブ解除、通知ルールのターゲットとして選択するトピックの一覧表示を行うこともできます。

**注記**  
管理ポリシーでは、条件キー `codestar-notifications:NotificationsForResource` はサービスのリソースタイプに固有の値を持ちます。例えば、CodeCommit のフルアクセスポリシーでは、値は `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": "*"
    }
```

## 読み取り専用マネージドポリシーの通知に関連するアクセス許可
<a name="notifications-readonly"></a>

**AWSCodeCommitReadOnlyAccess**、**AWSCodeBuildReadOnlyAccess**、**AWSCodeDeployReadOnlyAccess**、および **AWSCodePipeline\$1ReadOnlyAccess** マネージドポリシーには、通知への読み取り専用アクセスを許可するために以下のステートメントが含まれています。例えば、デベロッパーツールコンソールでリソースの通知を表示することはできますが、リソースを作成、管理、サブスクライブすることはできません。

**注記**  
管理ポリシーでは、条件キー `codestar-notifications:NotificationsForResource` はサービスのリソースタイプに固有の値を持ちます。例えば、CodeCommit のフルアクセスポリシーでは、値は `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": "*"
    }
```

## その他の管理ポリシーの通知に関連するアクセス許可
<a name="notifications-otheraccess"></a>

**AWSCodeCommitPowerUser**、**AWSCodeBuildDeveloperAccess**、および **AWSCodeBuildDeveloperAccess** 管理ポリシーには、これらの管理ポリシーのいずれかが適用された開発者が、通知を作成、編集、およびサブスクライブできるように、以下のステートメントが含まれています。通知ルールを削除したり、リソースのタグを管理したりすることはできません。

**注記**  
管理ポリシーでは、条件キー `codestar-notifications:NotificationsForResource` はサービスのリソースタイプに固有の値を持ちます。例えば、CodeCommit のフルアクセスポリシーでは、値は `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": "*"
    }
```

## 例: AWS CodeStar Notifications を管理するための管理者レベルのポリシー
<a name="security_iam_id-based-policy-examples-notifications-full-access"></a>

この例では、 AWS アカウントの IAM ユーザーに AWS CodeStar Notifications へのフルアクセスを付与して、ユーザーが通知ルールの詳細を確認し、通知ルール、ターゲット、イベントタイプを一覧表示できるようにします。また、通知ルールの追加、更新、および削除をユーザーに許可します。これは、**AWSCodeBuildAdminAccess**、**AWSCodeCommitFullAccess**, **AWSCodeDeployFullAccess**、および **AWSCodePipeline\$1FullAccess** マネージドポリシーの一部として含まれる通知アクセス許可に相当する、フルアクセスポリシーです。これらの管理ポリシーと同様に、この種のポリシーステートメントは、 AWS アカウント全体の通知および通知ルールへの完全な管理アクセスを必要とする IAM ユーザー、グループ、またはロールにのみアタッチする必要があります。

**注記**  
このポリシーには、許可として `CreateNotificationRule` が含まれています。このポリシーが IAM ユーザーまたはロールに適用されているユーザーは、そのユーザーがそれらのリソース自体にアクセスできない場合でも、 AWS アカウントで AWS CodeStar Notifications でサポートされているすべてのリソースタイプの通知ルールを作成できます。例えば、このポリシーを持つユーザーは、CodeCommit 自体にアクセスする権限を持たなくても 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": "*"
     }
   ]
}
```

------

## 例: AWS CodeStar Notifications を使用するためのコントリビューターレベルのポリシー
<a name="security_iam_id-based-policy-examples-notifications-contributor"></a>

この例では、通知の作成やサブスクライブなど、 AWS CodeStar Notifications day-to-day使用状況へのアクセスを許可しますが、通知ルールやターゲットの削除など、より破壊的なアクションへのアクセスは許可しません。これは、**AWSCodeBuildDeveloperAccess**、**AWSCodeDeployDeveloperAccess**、および **AWSCodeCommitPowerUser** 管理ポリシーで提供されるアクセスに相当します。

**注記**  
このポリシーには、許可として `CreateNotificationRule` が含まれています。このポリシーが IAM ユーザーまたはロールに適用されているユーザーは、そのユーザーがそれらのリソース自体にアクセスできない場合でも、 AWS アカウントで AWS CodeStar Notifications でサポートされているすべてのリソースタイプの通知ルールを作成できます。例えば、このポリシーを持つユーザーは、CodeCommit 自体にアクセスする権限を持たなくても 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": "*"
        }
    ]
}
```

## 例: AWS CodeStar Notifications を使用するためのread-only-levelポリシー
<a name="security_iam_id-based-policy-examples-notifications-read-only"></a>

次の例では、アカウントの IAM ユーザーに対して、 AWS アカウントで通知ルール、ターゲット、およびイベントタイプへの読み取り専用アクセスを付与します。この例は、これらの項目の表示を許可するポリシーの作成方法を示しています。これは、**AWSCodeBuildReadOnlyAccess**、**AWSCodeCommitReadOnly**、および **AWSCodePipeline\$1ReadOnlyAccess** 管理ポリシーの一部として含まれるアクセス許可に相当します。

------
#### [ 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": "*"
        }
    ]
}
```

------