AWS CodeBuild 权限参考
您可以在 AWS CodeBuild 策略中使用 AWS 范围的条件键来表示条件。有关列表,请参阅《IAM 用户指南》中的可用键。
请在策略的 Action
字段中指定这些操作。要指定操作,请在 API 操作名称之前使用 codebuild:
前缀(例如,codebuild:CreateProject
和 codebuild:StartBuild
)。要在单个语句中指定多项操作,请使用逗号将它们隔开(例如,"Action": [
"codebuild:CreateProject", "codebuild:StartBuild" ]
)。
使用通配符
您可以在策略的 Resource
字段中指定带或不带通配符(*)的 ARN 作为资源值。您可以使用通配符指定多个操作或资源。例如,codebuild:*
指定所有 CodeBuild 操作,codebuild:Batch*
指定以单词 Batch
开头的所有 CodeBuild 操作。以下示例授予对以 my
名称开头的所有构建项目的访问权限:
arn:aws:codebuild:us-east-2:123456789012:project/my*
CodeBuild API 操作和必需的操作权限
- BatchDeleteBuilds
-
操作:
codebuild:BatchDeleteBuilds
删除构建所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
- BatchGetBuilds
-
操作:
codebuild:BatchGetBuilds
获取有关构建项目的信息所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
- BatchGetProjects
-
操作:
codebuild:BatchGetProjects
获取有关构建项目的信息所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
- BatchGetReportGroups
-
操作:
codebuild:BatchGetReportGroups
获取有关报告组的信息所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:report-group/report-group-name
- BatchGetReports
-
操作:
codebuild:BatchGetReports
获取有关报告的信息所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:report-group/report-group-name
- BatchPutTestCases ¹
-
操作:
codebuild:BatchPutTestCases
创建或更新测试报告所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:report-group/report-group-name
- CreateProject
-
操作:
codebuild:CreateProject
、iam:PassRole
创建构建项目所必需的。
资源:
-
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
-
arn:aws:iam::
account-ID
:role/role-name
-
- CreateReport ¹
-
操作:
codebuild:CreateReport
创建测试报告所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:report-group/report-group-name
- CreateReportGroup
-
操作:
codebuild:CreateReportGroup
创建报告组所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:report-group/report-group-name
- CreateWebhook
-
操作:
codebuild:CreateWebhook
创建 Webhook 所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
- DeleteProject
-
操作:
codebuild:DeleteProject
删除 CodeBuild 项目所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
- DeleteReport
-
操作:
codebuild:DeleteReport
删除报告所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:report-group/report-group-name
- DeleteReportGroup
-
操作:
codebuild:DeleteReportGroup
删除报告组所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:report-group/report-group-name
- DeleteSourceCredentials
-
操作:
codebuild:DeleteSourceCredentials
要求删除一组
SourceCredentialsInfo
对象,其中包含有关 GitHub、GitHub Enterprise Server 或 Bitbucket 存储库的凭证的信息。资源:
*
- DeleteWebhook
-
操作:
codebuild:DeleteWebhook
创建 Webhook 所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
- DescribeTestCases
-
操作:
codebuild:DescribeTestCases
返回测试用例的分页列表所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:report-group/report-group-name
- ImportSourceCredentials
-
操作:
codebuild:ImportSourceCredentials
要求导入一组
SourceCredentialsInfo
对象,其中包含有关 GitHub、GitHub Enterprise Server 或 Bitbucket 存储库的凭证的信息。资源:
*
- InvalidateProjectCache
-
操作:
codebuild:InvalidateProjectCache
重置项目缓存所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
- ListBuildBatches
-
操作:
codebuild:ListBuildBatches
获取构建批处理 ID 的列表所必需的。
资源:
*
- ListBuildBatchesForProject
-
操作:
codebuild:ListBuildBatchesForProject
获取特定项目的构建批处理 ID 列表所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
- ListBuilds
-
操作:
codebuild:ListBuilds
获取构建 ID 的列表所必需的。
资源:
*
- ListBuildsForProject
-
操作:
codebuild:ListBuildsForProject
获取构建项目的构建 ID 列表所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
- ListCuratedEnvironmentImages
-
操作:
codebuild:ListCuratedEnvironmentImages
获取由 AWS CodeBuild 管理的所有 Docker 映像的相关信息所必需的。
资源:
*
(必需,但不引用可寻址的 AWS 资源) - ListProjects
-
操作:
codebuild:ListProjects
获取构建项目名称的列表所必需的。
资源:
*
- ListReportGroups
-
操作:
codebuild:ListReportGroups
获取报告组列表所必需的。
资源:
*
- ListReports
-
操作:
codebuild:ListReports
获取报告列表所必需的。
资源:
*
- ListReportsForReportGroup
-
操作:
codebuild:ListReportsForReportGroup
获取报告组的报告列表所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:report-group/report-group-name
- RetryBuild
-
操作:
codebuild:RetryBuild
重试构建所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
- StartBuild
-
操作:
codebuild:StartBuild
开始运行构建项目所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
- StopBuild
-
操作:
codebuild:StopBuild
尝试停止运行中构建项目所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
- UpdateProject
-
操作:
codebuild:UpdateProject
、iam:PassRole
更改构建项目的相关信息所必需的。
资源:
-
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
-
arn:aws:iam::
account-ID
:role/role-name
-
- UpdateProjectVisibility
-
操作:
codebuild:UpdateProjectVisibility
、iam:PassRole
更改项目构建的公共可见性所必需的。
资源:
-
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
-
arn:aws:iam::
account-ID
:role/role-name
-
- UpdateReport ¹
-
操作:
codebuild:UpdateReport
创建或更新测试报告所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:report-group/report-group-name
- UpdateReportGroup
-
操作:
codebuild:UpdateReportGroup
更新报告组所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:report-group/report-group-name
- UpdateWebhook
-
操作:
codebuild:UpdateWebhook
更新 Webhook 所必需的。
资源:
arn:aws:codebuild:
region-ID
:account-ID
:project/project-name
¹ 仅用于权限。对于此操作没有 API。