Identity and Access Management (IAM) 可讓您將特定角色和權限授予主體,控管 Eventarc 資源的存取權。您可以指派預先定義或自訂角色,確保主體僅具備管理資源和轉送事件所需的權限。
總覽
Eventarc 使用 IAM 控管存取權。
如需 IAM 及其功能的簡介,請參閱「IAM 總覽」。
如要瞭解如何使用允許政策授予及撤銷存取權,請參閱「管理專案、資料夾和組織的存取權」。
如要查看 Eventarc 支援的權限和角色清單,請參閱下列各節。
Eventarc 服務代理
部分 Google Cloud 服務具有服務代理,只要授予適當權限,服務就能存取您的資源。如果 API 需要服務代理, Google Cloud 會在您啟用並使用 API 後的某個時間點建立服務代理。
Eventarc 採用佈建模型,只有在首次需要時 (例如首次建立 Eventarc 資源時) 才會建立服務代理,而非在 API 首次啟用時建立。佈建服務代理並在系統中套用變更可能需要幾分鐘的時間。如要進一步瞭解這項延遲,請參閱「權限遭拒錯誤」。
啟用 Eventarc API
如要查看及指派 Eventarc 的 IAM 角色,您必須為專案啟用 Eventarc API。在啟用 API 之前,您無法在 Google Cloud 控制台中查看 Eventarc 角色。
控制台
- 登入 Google Cloud 帳戶。如果您未曾使用過 Google Cloud,歡迎建立帳戶,親自體驗實際使用我們產品的成效。新客戶還能獲得價值 $300 美元的免費抵免額,用於執行、測試及部署工作負載。
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Eventarc and Eventarc Publishing APIs, if any are not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Eventarc and Eventarc Publishing APIs, if any are not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.
gcloud
- 登入 Google Cloud 帳戶。如果您未曾使用過 Google Cloud,歡迎建立帳戶,親自體驗實際使用我們產品的成效。新客戶還能獲得價值 $300 美元的免費抵免額,用於執行、測試及部署工作負載。
-
安裝 Google Cloud CLI。
-
若您採用的是外部識別資訊提供者 (IdP),請先使用聯合身分登入 gcloud CLI。
-
執行下列指令,初始化 gcloud CLI:
gcloud init -
選取或建立專案所需的角色
- 選取專案:選取專案時,不需具備特定 IAM 角色,只要您已獲派角色,即可選取任何專案。
-
建立專案:如要建立專案,您必須具備專案建立者角色 (
roles/resourcemanager.projectCreator),其中包含resourcemanager.projects.create權限。瞭解如何授予角色。
-
建立 Google Cloud 專案:
gcloud projects create PROJECT_ID
將
PROJECT_ID替換為您要建立的 Google Cloud 專案名稱。 -
選取您建立的 Google Cloud 專案:
gcloud config set project PROJECT_ID
將
PROJECT_ID替換為 Google Cloud 專案名稱。
-
確認 Google Cloud 專案已啟用計費功能。
啟用 Eventarc 和 Eventarc Publishing API (如果尚未啟用):
啟用 API 所需的角色
如要啟用 API,您必須具備
serviceusage.services.enable權限。如果您建立了專案,可能已透過擁有者角色 (roles/owner) 取得這項權限。否則,您可以透過 Service Usage 管理員角色 (roles/serviceusage.serviceUsageAdmin) 取得這項權限。瞭解如何授予角色。gcloud services enable eventarc.googleapis.com
eventarcpublishing.googleapis.com -
安裝 Google Cloud CLI。
-
若您採用的是外部識別資訊提供者 (IdP),請先使用聯合身分登入 gcloud CLI。
-
執行下列指令,初始化 gcloud CLI:
gcloud init -
選取或建立專案所需的角色
- 選取專案:選取專案時,不需具備特定 IAM 角色,只要您已獲派角色,即可選取任何專案。
-
建立專案:如要建立專案,您必須具備專案建立者角色 (
roles/resourcemanager.projectCreator),其中包含resourcemanager.projects.create權限。瞭解如何授予角色。
-
建立 Google Cloud 專案:
gcloud projects create PROJECT_ID
將
PROJECT_ID替換為您要建立的 Google Cloud 專案名稱。 -
選取您建立的 Google Cloud 專案:
gcloud config set project PROJECT_ID
將
PROJECT_ID替換為 Google Cloud 專案名稱。
-
確認 Google Cloud 專案已啟用計費功能。
啟用 Eventarc 和 Eventarc Publishing API (如果尚未啟用):
啟用 API 所需的角色
如要啟用 API,您必須具備
serviceusage.services.enable權限。如果您建立了專案,可能已透過擁有者角色 (roles/owner) 取得這項權限。否則,您可以透過 Service Usage 管理員角色 (roles/serviceusage.serviceUsageAdmin) 取得這項權限。瞭解如何授予角色。gcloud services enable eventarc.googleapis.com
eventarcpublishing.googleapis.com
預先定義的角色
下表列出 Eventarc 預先定義的 IAM 角色,以及各角色具備的所有權限對應清單。
預先定義的角色可因應大多數常見用途。如果預先定義的角色不適用於您的用途,可以建立 IAM 自訂角色。
Eventarc 角色
| Role | Permissions |
|---|---|
Eventarc Admin( Full control over all Eventarc resources. Lowest-level resources where you can grant this role:
|
|
Eventarc Editor( Editor role for eventarc |
|
Eventarc Event Receiver( Can receive events from all event providers. Lowest-level resources where you can grant this role:
|
|
Eventarc Viewer( Can view the state of all Eventarc resources, including IAM policies. Lowest-level resources where you can grant this role:
|
|
Eventarc Connection Publisher Beta( Can publish events to Eventarc channel connections. Lowest-level resources where you can grant this role:
|
|
Eventarc Developer( Access to read and write Eventarc resources. Lowest-level resources where you can grant this role:
|
|
Eventarc Message Bus Admin( Full control over Message Buses resources. |
|
Eventarc Message Bus User( Access to publish to or bind to a Message Bus. |
|
Eventarc Event Collector Beta( Can collect events from multiple projects in an org for a source resource. |
|
Eventarc Publisher Beta( Can publish events to Eventarc channels. Lowest-level resources where you can grant this role:
|
|
Service agent roles
Service agent roles should only be granted to service agents.
| Role | Permissions |
|---|---|
Eventarc Service Agent( Gives Eventarc service account access to managed resources. |
|
專案層級的 IAM 管理
在專案層級,您可以使用 Google Cloud 控制台、IAM API 或 Google Cloud CLI 授予、變更及撤銷 IAM 角色。如需操作說明,請參閱「管理專案、資料夾和組織的存取權」。