Google 會運用 AI 技術將內容翻譯成你偏好的語言,但可能會出錯。
使用 IAM 控管存取權
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Cloud Tasks 使用 Identity and Access Management (IAM) 控管存取權。如要瞭解 IAM 及其功能,請參閱「IAM 總覽」。如要瞭解如何授予及撤銷存取權,請參閱「管理專案、資料夾和機構的存取權」。
您可以在專案層級和佇列層級設定存取控管選項。
舉例來說,您可以授予使用者在佇列中建立及新增工作的權限,但不允許刪除佇列。或者,您也可以將專案中所有 Cloud Tasks 資源的存取權授予一群使用者。詳情請參閱「安全佇列設定」。
每個 Cloud Tasks 方法都需要呼叫端具備必要的權限。本頁面說明 Cloud Tasks 支援的權限和角色。更新 queue.yaml (或舊版 queue.xml 檔案) 時,或使用 Google Cloud 控制台時,系統也會檢查權限。
啟用 Cloud Tasks API
如要查看及指派 Cloud Tasks 的 IAM 角色,請為專案啟用 Cloud Tasks API。啟用 API 後,您才能在 Google Cloud 控制台看到 Cloud Tasks 角色。
控制台
如果尚未啟用,請啟用 Cloud Tasks API。
啟用 API 時所需的角色
如要啟用 API,您必須具備 serviceusage.services.enable 權限。如果您建立了專案,可能已透過「擁有者」角色 (roles/owner) 取得這項權限。否則,您可以透過「服務使用情形管理員」角色 (roles/serviceusage.serviceUsageAdmin) 取得這項權限。瞭解如何授予角色。
啟用 API
gcloud
如尚未啟用,請啟用 Cloud Tasks API:
啟用 API 時所需的角色
如要啟用 API,您必須具備 serviceusage.services.enable 權限。如果您建立了專案,可能已透過「擁有者」角色 (roles/owner) 取得這項權限。否則,您可以透過「服務使用情形管理員」角色 (roles/serviceusage.serviceUsageAdmin) 取得這項權限。瞭解如何授予角色。
gcloud services enable cloudtasks.googleapis.com
預先定義的角色
下表列出 Cloud Tasks 預先定義的 IAM 角色和對應權限。
預先定義的角色可因應大多數一般用途,如果預先定義的角色無法滿足您的用途,可以建立 IAM 自訂角色。
| Role |
Permissions |
Cloud Tasks Admin
(roles/cloudtasks.admin)
Full access to queues and tasks.
|
cloudtasks.*
cloudtasks.cmekConfig.get
cloudtasks.cmekConfig.update
cloudtasks.locations.get
cloudtasks.locations.list
cloudtasks.operations.get
cloudtasks.queues.create
cloudtasks.queues.delete
cloudtasks.queues.get
cloudtasks.queues.getIamPolicy
cloudtasks.queues.list
cloudtasks.queues.pause
cloudtasks.queues.purge
cloudtasks.queues.resume
cloudtasks.queues.setIamPolicy
cloudtasks.queues.update
cloudtasks.tasks.create
cloudtasks.tasks.delete
cloudtasks.tasks.fullView
cloudtasks.tasks.get
cloudtasks.tasks.list
cloudtasks.tasks.run
monitoring.timeSeries.list
resourcemanager.projects.get
resourcemanager.projects.list
|
Cloud Tasks Editor
(roles/cloudtasks.editor)
Editor role for cloudtasks
|
cloudtasks.cmekConfig.get
cloudtasks.locations.*
cloudtasks.locations.get
cloudtasks.locations.list
cloudtasks.operations.get
cloudtasks.queues.create
cloudtasks.queues.delete
cloudtasks.queues.get
cloudtasks.queues.list
cloudtasks.queues.pause
cloudtasks.queues.purge
cloudtasks.queues.resume
cloudtasks.queues.update
cloudtasks.tasks.*
cloudtasks.tasks.create
cloudtasks.tasks.delete
cloudtasks.tasks.fullView
cloudtasks.tasks.get
cloudtasks.tasks.list
cloudtasks.tasks.run
monitoring.timeSeries.list
resourcemanager.projects.get
resourcemanager.projects.list
|
Cloud Tasks Viewer
(roles/cloudtasks.viewer)
Get and list access to tasks, queues, and locations.
|
cloudtasks.cmekConfig.get
cloudtasks.locations.*
cloudtasks.locations.get
cloudtasks.locations.list
cloudtasks.operations.get
cloudtasks.queues.get
cloudtasks.queues.list
cloudtasks.tasks.fullView
cloudtasks.tasks.get
cloudtasks.tasks.list
monitoring.timeSeries.list
resourcemanager.projects.get
resourcemanager.projects.list
|
Cloud Tasks Enqueuer
Beta
(roles/cloudtasks.enqueuer)
Access to create tasks.
|
cloudtasks.operations.get
cloudtasks.tasks.create
cloudtasks.tasks.fullView
resourcemanager.projects.get
resourcemanager.projects.list
|
Cloud Tasks Queue Admin
(roles/cloudtasks.queueAdmin)
Admin access to queues.
|
cloudtasks.locations.*
cloudtasks.locations.get
cloudtasks.locations.list
cloudtasks.queues.*
cloudtasks.queues.create
cloudtasks.queues.delete
cloudtasks.queues.get
cloudtasks.queues.getIamPolicy
cloudtasks.queues.list
cloudtasks.queues.pause
cloudtasks.queues.purge
cloudtasks.queues.resume
cloudtasks.queues.setIamPolicy
cloudtasks.queues.update
resourcemanager.projects.get
resourcemanager.projects.list
|
Cloud Tasks Task Deleter
(roles/cloudtasks.taskDeleter)
Access to delete tasks.
|
cloudtasks.tasks.delete
resourcemanager.projects.get
resourcemanager.projects.list
|
Cloud Tasks Task Runner
Beta
(roles/cloudtasks.taskRunner)
Access to run tasks.
|
cloudtasks.tasks.fullView
cloudtasks.tasks.run
resourcemanager.projects.get
resourcemanager.projects.list
|
Service agent roles
Service agent roles should only be granted to service agents.
| Role |
Permissions |
Cloud Tasks Service Agent
(roles/cloudtasks.serviceAgent)
Grants Cloud Tasks Service Account access to manage resources.
|
iam.serviceAccounts.getAccessToken
iam.serviceAccounts.getOpenIdToken
logging.logEntries.create
|
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2026-09-26 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2026-09-26 (世界標準時間)。"],[],[]]