第 3 步:启用 API

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

  • Apigee API:提供您的项目与其他 Hybrid 服务和 Google Cloud Platform API 之间的通信。
  • Apigee Connect API:提供 Apigee 管理层面与运行时层面中的 MART 服务之间的通信。
  • Cloud Pub/Sub API:需要配额才能运行
  • Cloud Resource Manager API:混合使用,用于验证服务账号
  • Compute Engine API:用于集群管理(仅限基于 GKE 的集群)
  • Kubernetes Engine API:如果您计划使用 Google Kubernetes Engine (GKE) 或 GKE On-Prem(仅限基于 GKE 的集群)进行混合运行时安装,则启用此 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. 搜索“Apigee”。

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

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

    4. 点击启用

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

    5. 从屏幕左上角的导航菜单中,选择 API 和服务 > 库,以返回 API 选择页面。
  4. 启用 Apigee Connect API
    1. API 库视图中,搜索“Apigee Connect”。
    2. 找到 Apigee Connect 服务并点击它。
    3. 点击启用

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

    4. 从屏幕左上角的导航菜单中,选择 API 和服务 > 库,以返回 API 选择页面。
  5. 启用 Cloud Pub/Sub API
    1. API 库视图中,搜索“Cloud Pub/Sub API”。
    2. 找到 Cloud Pub/Sub API 服务并点击它。
    3. 点击启用

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

  6. 启用 Cloud Resource Manager API
    1. API 库视图中,搜索“Cloud Resource Manager”。
    2. 找到 Cloud Resource Manager 服务并点击它。
    3. 点击启用

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

    4. 从屏幕左上角的导航菜单中,选择 API 和服务 > 库,以返回 API 选择页面。
  7. (仅限基于 GKE 的集群)启用 Compute Engine API
    1. API 库视图中,搜索“Compute Engine”。
    2. 找到 Compute Engine API 服务并点击它。
    3. 点击启用

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

    4. 从屏幕左上角的导航菜单中,选择 API 和服务 > 库,以返回 API 选择页面。
  8. (仅限基于 GKE 的集群)启用 Kubernetes Engine API
    1. API 库视图中,搜索“Kubernetes Engine”。
    2. 找到 Kubernetes Engine API 服务并点击它。
    3. 点击启用

      Google Cloud Platform 会为您的项目启用 Kubernetes Engine API

    4. 从屏幕左上角的导航菜单中,选择 API 和服务 > 库,以返回 API 选择页面。
  9. 要确认您已启用 API,请选择 API 和服务 > 信息中心

gcloud CLI

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

  1. 在您用来管理 Apigee 的设备上打开终端窗口。
  2. 使用以下命令定义第 2 步:创建 Google Cloud 项目中的 PROJECT_ID 环境变量:
    export PROJECT_ID=your_project_id
    末尾带有英文句点的项目 ID 名称
  3. 如果要在 Google Cloud (GKE) 中运行集群,而不是在 GKE On-Prem (Anthos) 或 AKS 中运行集群,请使用以下命令启用这些 API:

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

    或者,使用以下命令启用 API:

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

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

下一步

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