第 3 步:启用 API

如需使用 Apigee Hybrid,您必须在 Google Cloud 控制台中为项目启用以下 API:

  • Apigee API:提供您的项目与其他混合服务和 Google Cloud API 之间的通信。
  • Apigee Connect API:在运行时层面提供 Apigee 管理层面和 MART 服务之间的通信。
  • Cloud DNS API:用于与外部进程通信。
  • Cloud Pub/Sub API:需要配额才能运行。
  • Cloud Resource Manager API:由 Apigee Hybrid 使用,用于验证服务账号。
  • Compute Engine API:用于集群管理(仅限基于 GKE 的集群)
  • Kubernetes Engine API:如果您打算使用 Google Kubernetes Engine (GKE) 或 GKE On-Prem (Anthos) On-Prem 进行混合运行时安装,请启用。

为 Google Cloud 项目启用所需的 API:

您可以使用 CLI 或 Google Cloud 控制台界面来启用 API。

Google Cloud 界面

要使用界面启用 API,请执行以下步骤:

  1. 打开 Google Cloud 控制台,然后使用您在第 1 步:创建 Google Cloud 账号中创建的账号进行登录。
  2. 选择您在第 2 步:创建 Google Cloud 项目中创建的项目。
  3. 启用 Apigee API,如下所示:
    1. 导航菜单中,选择 API 和服务 > 库

      导航菜单已突出显示

      点击“API 和服务”后,选择了库选项

    2. API 库视图中,搜索“Apigee”。

      API 库搜索框

      Google Cloud 显示与“Apigee”匹配的 API 列表

    3. 找到 Apigee API 服务并点击它。
    4. Apigee API 服务选项

    5. 在 Apigee API 视图中,点击启用

      Google Cloud 为您的 Google Cloud 项目启用 Apigee API

  4. 启用 Apigee Connect API
    1. API 库视图中,搜索“Apigee Connect”。
    2. 找到 Apigee Connect API 并启用。

      Google Cloud 为您的 Google Cloud 项目启用 Apigee Connect API

  5. 启用 Cloud DNS API
    1. API 库视图中,搜索“Cloud DNS API”。
    2. 找到 Cloud DNS API 并启用。

      Google Cloud 为您的 Google Cloud 项目启用 Cloud DNS API

  6. 启用 Cloud Pub/Sub API
    1. API 库视图中,搜索“Cloud Pub/Sub API”。
    2. 找到 Cloud Pub/Sub API 并启用。

      Google Cloud 为您的 Google Cloud 项目启用 Cloud Pub/Sub API

  7. 启用 Cloud Resource Manager API
    1. API 库视图中,搜索“Cloud Resource Manager”。
    2. 找到 Cloud Resource Manager 并启用。

      Google Cloud 为您的 Google Cloud 项目启用 Cloud Resource Manager API

  8. (仅限基于 GKE 的集群)启用 Compute Engine API
    1. API 库视图中,搜索“Compute Engine”。
    2. 找到 Compute Engine API 并启用。

      Google Cloud 为您的 Google Cloud 项目启用 Compute Engine API

  9. (仅基于 GKE 的集群)启用 Google Kubernetes Engine API
    1. API 库视图中,搜索“Google Kubernetes Engine”。
    2. 找到 Google Kubernetes API 并启用。

      Google Cloud 为您的 Google Cloud 项目启用 Google Kubernetes API

  10. 要确认您已启用 API,请选择 API 和服务 > 信息中心

    您刚添加的 API 会显示在已启用 API 列表中:

    • Apigee API
    • Apigee Connect API
    • Cloud DNS API
    • Cloud Pub/Sub API
    • Cloud Resource Manager API
    • Compute Engine API
    • Kubernetes Engine API

gcloud CLI

要使用 CLI 启用 API,请执行以下步骤:

  1. 在您用来管理 Apigee 的设备上打开终端窗口。
  2. 通过运行以下命令,确保已在本地 shell 中安装 gcloudgcloud 工具提供 Cloud 的主要命令行界面。
    gcloud -h

    如果您未安装 gcloud,请安装 Cloud SDK

  3. 确保使用第 2 步:创建 Google Cloud 项目中创建的项目的 ID 来定义 PROJECT_ID 变量:
    echo $PROJECT_ID

    如果不是,请使用以下命令定义 PROJECT_ID 环境变量:

    export PROJECT_ID=your_project_id
    末尾带有英文句点的项目 ID 名称
  4. 选择目标安装的标签页以查看用于启用 API 的命令:

    GKE

    如果要在 Google Cloud (GKE) 中运行集群,请使用以下命令启用 API:

    gcloud services enable \
        apigee.googleapis.com \
        apigeeconnect.googleapis.com \
        dns.googleapis.com \
        pubsub.googleapis.com \
        cloudresourcemanager.googleapis.com \
        compute.googleapis.com \
        container.googleapis.com --project $PROJECT_ID
    

    GKE On-Prem

    如果要在 GKE On-Prem (Anthos) 中运行集群,请使用以下命令启用 API:

    gcloud services enable \
        apigee.googleapis.com \
        apigeeconnect.googleapis.com \
        cloudresourcemanager.googleapis.com \
        dns.googleapis.com \
        pubsub.googleapis.com  --project $PROJECT_ID
    

    AKS

    如果要在 Azure Kubernetes Service (AKS) 中运行集群,请使用以下命令启用 API:

    gcloud services enable \
        apigee.googleapis.com \
        apigeeconnect.googleapis.com \
        dns.googleapis.com \
        pubsub.googleapis.com \
        cloudresourcemanager.googleapis.com  --project $PROJECT_ID
    

    GKE on AWS

    如果要在 GKE on AWS 中运行集群,请使用以下命令启用 API:

    gcloud services enable \
        apigee.googleapis.com \
        apigeeconnect.googleapis.com \
        dns.googleapis.com \
        pubsub.googleapis.com \
        cloudresourcemanager.googleapis.com  --project $PROJECT_ID
    

    EKS

    如果要在 Amazon EKS 中运行集群,请使用以下命令启用 API:

    gcloud services enable \
        apigee.googleapis.com \
        apigeeconnect.googleapis.com \
        dns.googleapis.com \
        pubsub.googleapis.com \
        cloudresourcemanager.googleapis.com  --project $PROJECT_ID
    
  5. 使用以下命令验证是否已启用所有 API:
    gcloud services list

    返回以下内容:

    NAME                                 TITLE
    apigee.googleapis.com                Apigee API
    apigeeconnect.googleapis.com         Apigee Connect API
    bigquery.googleapis.com              BigQuery API
    bigquery.googleapis.com              BigQuery API
    bigquerystorage.googleapis.com       BigQuery Storage API
    cloudapis.googleapis.com             Google Cloud APIs
    clouddebugger.googleapis.com         Cloud Debugger API
    cloudresourcemanager.googleapis.com  Cloud Resource Manager API
    cloudtrace.googleapis.com            Cloud Trace API
    compute.googleapis.com               Compute Engine API
    container.googleapis.com             Kubernetes Engine API
    containeranalysis.googleapis.com     Container Analysis API
    containerregistry.googleapis.com     Container Registry API
    datastore.googleapis.com             Cloud Datastore API
    dns.googleapis.com                   Cloud DNS API
    iam.googleapis.com                   Identity and Access Management (IAM) API
    iamcredentials.googleapis.com        IAM Service Account Credentials API
    logging.googleapis.com               Cloud Logging API
    monitoring.googleapis.com            Cloud Monitoring API
    oslogin.googleapis.com               Cloud OS Login API
    pubsub.googleapis.com                Cloud Pub/Sub API
    servicemanagement.googleapis.com     Service Management API
    serviceusage.googleapis.com          Service Usage API
    sql-component.googleapis.com         Cloud SQL
    storage-api.googleapis.com           Google Cloud Storage JSON API
    storage-component.googleapis.com     Cloud Storage

如需详细了解如何在 Google Cloud 控制台中启用 API,请参阅 Cloud 文档中的在 Google Cloud 项目中启用 API

下一步

1 2 3 (下一步)第 4 步:创建组织 5 6