Gerenciar APIs e bibliotecas do Cloud no Cloud Code para IntelliJ
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Acesse os produtos e serviços do Google Cloud pelo seu código usando as
APIs do Cloud. Essas APIs do Cloud expõem uma interface REST JSON simples que podem ser chamadas por meio de bibliotecas de cliente.
Neste documento, descrevemos como procurar APIs disponíveis, ativar APIs do Cloud e adicionar
bibliotecas de cliente do Cloud ao projeto e configurar a autenticação, dependendo
das suas necessidades de desenvolvimento.
Como procurar APIs do Cloud
Para explorar todas as APIs do Google Cloud disponíveis no seu ambiente de desenvolvimento integrado, siga estas etapas:
Selecione Ferramentas > Cloud Code > Adicionar bibliotecas do Cloud e gerenciar APIs do Cloud.
Expanda a árvore do explorador de APIs do Google Cloud para visualizar todas as APIs disponíveis.
O explorador agrupa as APIs do Cloud por categoria. Também é possível procurar uma API específica
usando a barra de pesquisa das APIs da Pesquisa Google.
Clique em uma API para ver mais detalhes, como o status,
instruções de instalação específicas da linguagem para suas bibliotecas de cliente
correspondentes e documentação relevante.
Como ativar APIs do Cloud
Para ativar rapidamente as APIs do Cloud em um projeto usando os detalhes da API, siga estas etapas:
Na visualização de detalhes da API Cloud, escolha um projeto do Google Cloud para o qual você
quer ativar a API do Cloud.
Clique no botão Ativar API.
Depois que a API for ativada, você verá uma mensagem confirmando essa alteração.
Como adicionar as bibliotecas de cliente do Cloud
Para adicionar bibliotecas ao seu projeto no IntelliJ, siga estas etapas:
Para projetos Java Maven
Selecione Ferramentas > Cloud Code > APIs do Cloud.
A caixa de diálogo Gerenciar APIs do Google Cloud mostra as bibliotecas compatíveis.
Selecione o tipo de biblioteca de sua preferência na biblioteca de cliente do
Google Cloud (recomendado) ou na biblioteca de Java Spring Google Cloud.
No menu suspenso Módulo, selecione o módulo ao qual você quer adicionar a biblioteca.
Clique em Adicionar dependência do Maven para adicionar BOM e biblioteca de cliente ao seu projeto.
Para todos os outros projetos
Selecione Ferramentas > Cloud Code > Adicionar bibliotecas do Cloud e gerenciar APIs do Cloud.
A caixa de diálogo Adicionar bibliotecas do Cloud mostra as bibliotecas compatíveis.
Instale a API seguindo as instruções de instalação listadas na página de detalhes da API para o idioma de sua preferência.
Como configurar a autenticação
Depois de ativar as APIs necessárias e adicionar as bibliotecas de cliente
necessárias, configure o aplicativo para que ele seja autenticado
com sucesso. A configuração depende do seu tipo de desenvolvimento e da
plataforma em que você está executando.
Depois de concluir as etapas de autenticação relevantes, seu aplicativo
poderá se autenticar e estar pronto para ser implantado.
Desenvolvimento remoto com o Secret Manager ativado
Se você estiver desenvolvendo remotamente com uma conta de serviço para autenticação
e seu aplicativo usar secrets,
será necessário seguir mais algumas etapas para atribuir à sua conta de serviço do Google
o papel necessário para acessar um secret do Secret Manager específico:
Abra o painel do Gerenciador de secrets e selecione o secret que você quer acessar no seu
código.
Alterne para a guia "Permissões" e, em seguida, configure as permissões do secret clicando em editarEditar permissão. A página de configuração do Secret Manager é aberta no
navegador da Web.
No console Google Cloud , clique em Mostrar painel de informações e em Adicionar principal.
Atribua o papel Acessador de secrets do Gerenciador de secrets à sua conta de serviço.
A conta de serviço tem permissão para acessar este secret.
Receber suporte
Para enviar um feedback ou informar um problema no ambiente de desenvolvimento integrado do IntelliJ, acesse
Tools > Cloud Code > Help / About > Envie
feedback ou informe um problema para informar um problema no GitHub.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-04 UTC."],[[["\u003cp\u003eGoogle Cloud APIs can be accessed via a JSON REST interface and client libraries, allowing developers to integrate Google Cloud products and services into their code.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can browse and enable Google Cloud APIs directly within their IDE using Cloud Code, which groups APIs by category and provides details on each API's status and documentation.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code facilitates adding client libraries to projects, supporting both Google Cloud Client Library and Java Spring Google Cloud Library, and managing dependencies using the Google Cloud Java Bill of Materials (BOM).\u003c/p\u003e\n"],["\u003cp\u003eAuthentication setup for applications varies based on the development environment, such as local development with minikube or remote deployment on Google Kubernetes Engine or Cloud Run, often requiring Application Default Credentials (ADC) and sometimes service account configuration.\u003c/p\u003e\n"],["\u003cp\u003eFor remote development with Secret Manager, service accounts must be granted the "Secret Manager Secret Accessor" role to allow access to specific secrets, ensuring secure handling of sensitive information within applications.\u003c/p\u003e\n"]]],[],null,["# Manage Cloud APIs and libraries in Cloud Code for IntelliJ\n\nYou can access Google Cloud products and services from your code using\n[Cloud APIs](/apis/docs/overview). These Cloud APIs expose a simple JSON REST\ninterface that you can call via client libraries.\n\nThis document describes how to browse available APIs, enable Cloud APIs and\nadd Cloud Client Libraries to your project, and set up authentication depending\non your development needs.\n| **Note:** For projects that don't use both Java and Maven, Cloud Code does not add the Cloud Client Libraries to your build automatically, but does support the other features described here and provides build snippets for your build system.\n\nBrowsing Cloud APIs\n-------------------\n\nTo explore all available Google Cloud APIs in your IDE, follow these steps:\n\n1. Select **Tools** \\\u003e **Cloud Code** \\\u003e **Add Cloud Libraries and Manage Cloud APIs**.\n2. Expand the Google Cloud APIs explorer tree to view all available APIs. The explorer groups Cloud APIs by category. You can also look for a specific API using the Search APIs search bar.\n3. Click an API to view more details, such as its status, language-specific installation instructions for its corresponding client libraries, and relevant documentation.\n\n\u003cbr /\u003e\n\nEnabling Cloud APIs\n-------------------\n\nTo quickly enable Cloud APIs for a project using the API details, follow these steps:\n\n1. In the Cloud API details view, choose a Google Cloud project that you'd like to enable the Cloud API for.\n2. Click the **Enable API** button.\n\n\n Once the API has been enabled you'll see a message confirming this change.\n\n\u003cbr /\u003e\n\nAdding the Cloud Client Libraries\n---------------------------------\n\nTo add libraries to your project in IntelliJ, follow these steps: \n\n### For Java Maven projects\n\n1. Select **Tools** \\\u003e **Cloud Code** \\\u003e **Cloud APIs**.\n2. The **Manage Google Cloud APIs** dialog displays the supported libraries.\n3. Select your preferred library type from the choice of Google Cloud Client Library (recommended) or Java Spring Google Cloud Library.\n4. In the **Module** drop-down menu, select the module that you want to add the library to.\n| **Note:** **Google Cloud Java** solves version conflicts between libraries by adding the [Google Cloud Java Bill of Materials (BOM)](https://github.com/googleapis/google-cloud-java#version-management) to the `pom.xml` file of your projects.\n5. Click **Add Maven Dependency** to add BOM and client library to your project.\n\n### For all other projects\n\n1. Select **Tools** \\\u003e **Cloud Code** \\\u003e **Add Cloud Libraries and Manage Cloud APIs**.\n2. The **Add Google Cloud Libraries** dialog displays the supported libraries.\n3. Install the API using the installation instructions listed on the API details page for your preferred language. If you're developing a Java application, you need to also specify your library preference, Google Cloud Client Library (recommended) or Java Spring Google Cloud Library.\n\nSetting up authentication\n-------------------------\n\nAfter you've enabled the required APIs and added the necessary client libraries,\nyou need to configure your application in order for it to be successfully\nauthenticated. Your configuration depends on your type of development and\nthe platform you're running on.\n\nOnce you complete the relevant authentication steps, your application can\nauthenticate and is ready to be deployed.\n\n### Local development\n\n### minikube\n\n\n1. Ensure that you have Application Default Credentials (ADC) set by running `gcloud auth application-default login`. This lets minikube find your ADC to authenticate with.\n\n\u003cbr /\u003e\n\n### minikube\n\n\n1. Ensure that you have Application Default Credentials (ADC) set by running `gcloud auth application-default login`. This lets minikube find your ADC to authenticate with.\n2. Start minikube with `minikube start --addons gcp-auth`. This mounts your ADC in your pods. For a detailed minikube auth guide for Google Cloud, refer to the [minikube gcp-auth docs](https://minikube.sigs.k8s.io/docs/handbook/addons/gcp-auth/).\n\n\u003cbr /\u003e\n\n### Local Kubernetes cluster\n\n\n1. Ensure that you have Application Default Credentials (ADC) set by running `gcloud auth application-default login`.\n2. Mount your local `gcloud` directory in your Kubernetes pods by editing the deployment manifests, so that the Google Cloud client libraries can find your credentials. Kubernetes pod configuration example: \n\n apiVersion: v1\n kind: Pod\n metadata:\n name: my-app\n labels:\n name: my-app\n spec:\n containers:\n - name: my-app\n image: gcr.io/google-containers/busybox\n ports:\n - containerPort: 8080\n volumeMounts:\n - mountPath: /root/.config/gcloud\n name: gcloud-volume\n volumes:\n - name: gcloud-volume\n hostPath:\n path: /path/to/home/.config/gcloud\n\n\u003cbr /\u003e\n\n### Cloud Run\n\n\n1. Ensure that you have Application Default Credentials (ADC) set by running `gcloud auth application-default login`. This lets the Cloud Run local simulated environment find your ADC to authenticate with.\n\n\u003cbr /\u003e\n\n### Remote development\n\n### Google Kubernetes Engine\n\n\n1. [Configure your GKE cluster and application with Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity) to authenticate Google Cloud services on GKE. This associates your Kubernetes service account with your Google service account.\n2. If the Google Cloud service you're trying to access requires additional roles, grant them for the Google service account you're using to develop your app. \n For a list of IAM role types and predefined roles you can grant to identities, see the [Understanding roles guide](https://cloud.google.com/iam/docs/understanding-roles). For steps to grant the roles, see [Granting, changing, and revoking access to resources](/iam/docs/granting-changing-revoking-access).\n3. Configure your Kubernetes Deployment to reference the Kubernetes service account by setting the `.spec.serviceAccountName` field in your Kubernetes Deployment YAML file. \n If you're working on an app created from a Cloud Code template, this file is located under the kubernetes-manifests folder.\n\n\u003cbr /\u003e\n\n### Cloud Run\n\n\n1. To create a new unique service account for deploying your Cloud Run application, on the Service Accounts page, select the project that your secret is stored in. [Go to the Service Accounts\n page](https://console.cloud.google.com/iam-admin/serviceaccounts)\n\n2. Click **Create service account**.\n3. In the **Create service account** dialog, enter a descriptive name for the service account.\n4. Change the **Service account ID** to a unique, recognizable value and then click **Create**.\n5. If the Google Cloud service you're trying to access requires additional roles, grant them, click **Continue** , and then click **Done**.\n6. To add your service account to your deploy configuration, navigate to your **Cloud Run: Deploy** run configuration, expand the **Advanced revision settings** section, and then specify your service account in the **Service Account** field. \n\n\u003cbr /\u003e\n\n### Cloud Run\n\n\n1. [Configure your GKE cluster and application with Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity) to authenticate Google Cloud services on GKE. This associates your Kubernetes service account with your Google service account.\n2. If the Google Cloud service you're trying to access requires additional roles, grant them for the Google service account you're using to develop your app. \n The [Understanding roles guide](https://cloud.google.com/iam/docs/understanding-roles) describes IAM role types and lists available predefined roles you can grant to identities.\n3. To add your Kubernetes service account to your deploy configuration, navigate to your **Cloud Run: Deploy** run configuration, expand the **Advanced revision settings** section, and then specify your Kubernetes service account in the **Service\n Account** field. \n\n\u003cbr /\u003e\n\n### Remote development with Secret Manager enabled\n\nIf you're developing remotely, using a service account for authentication,\nand your application uses [secrets](/code/docs/intellij/secret-manager-ux), you\nneed to complete a few more steps to assign your Google service account\nthe role required to access a particular Secret Manager secret:\n\n1. Open the Secret Manager panel and select the secret you want to access in your\n code.\n\n2. Switch to the Permissions tab and then configure your secret's permissions\n by clicking edit\n **Edit Permission**. The Secret Manager configuration page for\n the secret opens in your web browser.\n\n3. In Google Cloud console, click **Show Info Panel** and then click **Add principal**.\n\n4. Assign your service account the **Secret Manager Secret Accessor** role.\n\n Your service account has permission to access this secret.\n\nGet support\n-----------\n\nTo submit feedback or report an issue in your IntelliJ IDE, go to **Tools** \\\u003e **Cloud Code** \\\u003e **Help / About** \\\u003e **Submit\nfeedback or report an issue** to report an issue on [GitHub](https://github.com/GoogleCloudPlatform/cloud-code-intellij/issues)."]]