Kontrol akses dengan IAM

Cloud Tasks menggunakan Identity and Access Management (IAM) untuk kontrol akses. Untuk mengetahui pengantar tentang IAM dan fitur-fiturnya, lihat Ringkasan IAM. Untuk mempelajari cara memberikan dan mencabut akses, lihat Mengelola akses ke project, folder, dan organisasi.

Anda dapat mengonfigurasi kontrol akses di level project dan di level antrean. Misalnya, Anda dapat memberikan izin kepada pengguna untuk membuat dan menambahkan tugas ke antrean, tetapi tidak menghapus antrean. Atau, Anda dapat memberikan akses ke semua resource Cloud Tasks dalam project kepada sekelompok pengguna. Untuk mengetahui informasi selengkapnya, lihat Konfigurasi antrean yang aman.

Setiap metode Cloud Tasks mengharuskan pemanggil memiliki izin yang diperlukan. Halaman ini menjelaskan izin dan peran yang didukung Cloud Tasks. Izin juga diperiksa saat queue.yaml atau queue.xml diperbarui atau saat konsol Google Cloud digunakan.

Aktifkan Cloud Tasks API

Untuk melihat dan menetapkan peran IAM untuk Cloud Tasks, Anda harus mengaktifkan Cloud Tasks API untuk project Anda. Anda tidak akan dapat melihat peran Cloud Tasks di konsol hingga Anda mengaktifkan API. Google Cloud

Konsol

Enable the Cloud Tasks API.

Roles required to enable APIs

To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

Enable the API

gcloud

Enable the Cloud Tasks API:

Roles required to enable APIs

To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

gcloud services enable cloudtasks.googleapis.com

Peran yang telah ditetapkan

Tabel berikut mencantumkan peran IAM bawaan Cloud Tasks dan izin yang sesuai.

Peran bawaan ini mencakup sebagian besar kasus penggunaan umum. Jika kasus penggunaan Anda tidak tercakup oleh peran standar, Anda dapat membuat peran IAM kustom.

Role Permissions

(roles/cloudtasks.admin)

Full access to queues and tasks.

cloudtasks.*

  • cloudtasks.cmekConfig.get
  • cloudtasks.cmekConfig.update
  • cloudtasks.locations.get
  • cloudtasks.locations.list
  • 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

(roles/cloudtasks.enqueuer)

Access to create tasks.

cloudtasks.tasks.create

cloudtasks.tasks.fullView

resourcemanager.projects.get

resourcemanager.projects.list

(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

(roles/cloudtasks.serviceAgent)

Grants Cloud Tasks Service Account access to manage resources.

iam.serviceAccounts.getAccessToken

iam.serviceAccounts.getOpenIdToken

logging.logEntries.create

(roles/cloudtasks.taskDeleter)

Access to delete tasks.

cloudtasks.tasks.delete

resourcemanager.projects.get

resourcemanager.projects.list

(roles/cloudtasks.taskRunner)

Access to run tasks.

cloudtasks.tasks.fullView

cloudtasks.tasks.run

resourcemanager.projects.get

resourcemanager.projects.list

(roles/cloudtasks.viewer)

Get and list access to tasks, queues, and locations.

cloudtasks.cmekConfig.get

cloudtasks.locations.*

  • cloudtasks.locations.get
  • cloudtasks.locations.list

cloudtasks.queues.get

cloudtasks.queues.list

cloudtasks.tasks.fullView

cloudtasks.tasks.get

cloudtasks.tasks.list

monitoring.timeSeries.list

resourcemanager.projects.get

resourcemanager.projects.list

Langkah berikutnya