本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
Amazon CodeBuild 权限参考
在设置访问控制和编写您可挂载到 IAM 身份的权限策略(基于身份的策略)时,可以使用下表作为参考。
您可以在 Amazon CodeBuild 策略中使用 Amazon 范围的条件键来表示条件。有关列表,请参阅 IAM 用户指南中的可用密钥。
请在策略的 Action
字段中指定这些操作。要指定操作,请在 API 操作名称之前使用 codebuild:
前缀(例如,codebuild:CreateProject
和 codebuild:StartBuild
)。要在单个语句中指定多项操作,请使用逗号将它们隔开(例如,"Action": [
"codebuild:CreateProject", "codebuild:StartBuild" ]
)。
使用通配符
您可以在策略的 Resource
字段中指定带或不带通配符 (*) 的 ARN 作为资源值。您可以使用通配符指定多个操作或资源。例如,codebuild:*
指定所有 CodeBuild 操作并codebuild:Batch*
指定所有以单词开头的 CodeBuild 操作Batch
。以下示例授予对以 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
需要删除一组包含有关 GitHub 企业服务器或 Bitbucke GitHub t 存储库凭证信息的
SourceCredentialsInfo
对象。资源:
*
- 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
需要导入一组包含有关 GitHub 企业服务器或 Bitbucke GitHub t 存储库凭证信息的
SourceCredentialsInfo
对象。资源:
*
- 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
是获取由 Amazon CodeBuild 管理的所有 Docker 映像的相关信息所必需的。
资源:
*
(必需,但不引用可寻址的 Amazon 资源) - 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。