Esta página descreve as opções de controlo de acesso disponíveis no Eventarc.
Vista geral
O Eventarc usa a gestão de identidade e de acesso (IAM) para o controlo de acesso.
Para uma introdução ao IAM e às respetivas funcionalidades, consulte a vista geral do IAM.
Para saber como conceder e revogar o acesso através de políticas de permissão, consulte o artigo Gerir o acesso a projetos, pastas e organizações.
- Para controlar o acesso à publicação no Eventarc Advanced através de políticas de acesso, consulte o artigo Controlar o acesso à publicação.
Para ver listas das autorizações e funções suportadas pelo Eventarc, consulte as secções seguintes.
Agente de serviço do Eventarc
Alguns Google Cloud serviços têm agentes de serviço que permitem que o serviço aceda aos seus recursos se lhe forem concedidas as autorizações adequadas. Se uma API exigir um agente de serviço, o Google Cloud cria o agente de serviço em algum momento após a ativação e utilização da API. Google Cloud
O Eventarc usa um modelo de aprovisionamento que cria o respetivo agente de serviço apenas quando é necessário pela primeira vez, por exemplo, quando cria um recurso do Eventarc pela primeira vez, e não quando a API é ativada inicialmente. O aprovisionamento do agente de serviço e a propagação das alterações através do sistema podem demorar vários minutos. Para mais informações acerca deste atraso, consulte o artigo Autorização recusada ao usar o agente do serviço Eventarc.
Ative as APIs Eventarc
Para ver e atribuir funções da IAM para o Eventarc, tem de ativar as APIs Eventarc para o seu projeto. Não vai poder ver as funções do Eventarc na Google Cloud consola até ativar as APIs.
Consola
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
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.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. 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.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.
gcloud
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init -
Create or select 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.
-
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace
PROJECT_IDwith a name for the Google Cloud project you are creating. -
Select the Google Cloud project that you created:
gcloud config set project PROJECT_ID
Replace
PROJECT_IDwith your Google Cloud project name.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Eventarc and Eventarc Publishing APIs:
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.gcloud services enable eventarc.googleapis.com
eventarcpublishing.googleapis.com -
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init -
Create or select 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.
-
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace
PROJECT_IDwith a name for the Google Cloud project you are creating. -
Select the Google Cloud project that you created:
gcloud config set project PROJECT_ID
Replace
PROJECT_IDwith your Google Cloud project name.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Eventarc and Eventarc Publishing APIs:
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.gcloud services enable eventarc.googleapis.com
eventarcpublishing.googleapis.com
Funções predefinidas
A tabela seguinte apresenta as funções de IAM predefinidas do Eventarc com uma lista correspondente de todas as autorizações que cada função inclui.
As funções predefinidas abordam os exemplos de utilização mais típicos. Se o seu exemplo de utilização não estiver coberto pelas funções predefinidas, pode criar uma função personalizada do IAM.
Funções do Eventarc
| Role | Permissions |
|---|---|
Eventarc Admin( Full control over all Eventarc resources. 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 Event Receiver( Can receive events from all event providers. 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:
|
|
Eventarc Service Agent( Gives Eventarc service account access to managed resources. |
|
Eventarc Viewer( Can view the state of all Eventarc resources, including IAM policies. Lowest-level resources where you can grant this role:
|
|
Gestão de IAM ao nível do projeto
Ao nível do projeto, pode conceder, alterar e revogar funções do IAM através da Google Cloud consola, da API IAM ou da CLI Google Cloud. Para ver instruções, consulte o artigo Faça a gestão do acesso a projetos, pastas e organizações.