第 3 步:启用 API

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

  • Apigee API:提供您的项目与其他混合服务和 Google Cloud API 之间的通信。
  • Apigee Connect API:提供 Apigee 管理层面与运行时层面中的 MART 服务之间的通信。
  • 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 控制台 API 库,然后使用您在第 1 步:创建 Google Cloud 账号中创建的账号进行登录。
  2. 选择您在第 2 步:创建 Google Cloud 项目中创建的项目。
  3. 启用 Apigee API,如下所示:
    1. 如果您没有看到 API 库页面,请从导航菜单中选择 API 和服务 > 库

      导航菜单已突出显示

    2. 确保选择了正确的项目。

      Google Cloud Platform 项目选择器

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

      API 库搜索框

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

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

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

      Google Cloud 为您的 Google Cloud 项目启用 Apigee API。重复这些步骤以启用其他 API。

  4. 启用 Apigee Connect API
  5. 启用 Cloud Pub/Sub API
  6. 启用 Cloud Resource Manager API
  7. 仅基于 GKE 的集群)启用 Google Kubernetes Engine API
  8. (仅限基于 GKE 的集群和基于 OpenShift 的集群)启用 Compute Engine API
  9. 仅限基于 OpenShift 的集群)启用以下 API:
    • Google Cloud API
    • Cloud DNS API
    • Identity and Access Management (IAM) API
    • IAM 服务账号凭据 API
    • Service Management API
    • Service Usage API
    • Google Cloud Storage JSON API
    • Cloud Storage
  10. 要确认您已启用 API,请选择 API 和服务 > 信息中心。您刚添加的 API 会显示在已启用 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 \
        cloudresourcemanager.googleapis.com \
        compute.googleapis.com \
        container.googleapis.com \
        pubsub.googleapis.com --project $PROJECT_ID
    

    OpenShift

    如果您要在 OpenShift 上运行集群,请使用以下命令启用 API:

    gcloud services enable \
        apigee.googleapis.com \
        apigeeconnect.googleapis.com \
        cloudapis.googleapis.com \
        cloudresourcemanager.googleapis.com \
        compute.googleapis.com \
        dns.googleapis.com \
        iam.googleapis.com \
        iamcredentials.googleapis.com \
        pubsub.googleapis.com  --project $PROJECT_ID
        servicemanagement.googleapis.com \
        serviceusage.googleapis.com \
        storage-api.googleapis.com \
        storage-component.googleapis.com  --project $PROJECT_ID
    

    其他平台

    如果您要在其他 Kubernetes 平台(例如下面列出的平台)上运行集群,请使用以下命令启用 API。

    • GKE On-Prem
    • Anthos on Bare Metal
    • AKS
    • GKE on AWS
    • EKS
    gcloud services enable \
        apigee.googleapis.com \
        apigeeconnect.googleapis.com \
        cloudresourcemanager.googleapis.com \
        pubsub.googleapis.com  --project $PROJECT_ID
    
  5. 使用以下命令验证是否已启用所有 API:
    gcloud services list --project $PROJECT_ID

    输出应包含您刚启用的所有 API,在此示例中:

    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
    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