步驟 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:混合型服務會使用此 API 驗證服務帳戶。
  • Compute Engine API:用於叢集管理 (僅限以 GKE 為基礎的叢集)。
  • Kubernetes Engine API:如果您打算使用 Google Kubernetes Engine (GKE) 或 GKE 內部部署 (Anthos) 內部部署混合式執行階段,請啟用這項功能。

為 Google Cloud 專案啟用必要的 API:

您可以使用 CLI 或 Google Cloud 控制台 UI 啟用 API。

Google Cloud 使用者介面

如要使用 UI 啟用 API,請執行下列步驟:

  1. 開啟 Google Cloud 控制台,然後使用您在步驟 1:建立 Google Cloud 帳戶中建立的帳戶登入。
  2. 選取您在步驟 2:建立 Google Cloud 專案中建立的專案。
  3. 如要啟用 Apigee API,請按照下列步驟操作:
    1. 在「導覽選單」中,依序選取「API 和服務」>「程式庫」

      醒目顯示導覽選單

      點選「API 和服務」後選取「程式庫」

    2. 在「API Library」檢視畫面中搜尋「Apigee」。

      API 程式庫搜尋方塊

      Google Cloud 會顯示與「Apigee」相符的 API 清單

    3. 找到 Apigee API 服務,然後按一下。
    4. Apigee API 服務選項

    5. 在 Apigee API 檢視畫面中,按一下「Enable」

      Google Cloud 會為您的 Google Cloud 專案啟用 Apigee API

  4. 啟用 Apigee Connect API
    1. 在「API Library」檢視畫面中,搜尋「Apigee Connect」。
    2. 找出 Apigee Connect API 並啟用。

      Google Cloud 會為您的 Google Cloud 專案啟用 Apigee Connect API

  5. 啟用 Cloud DNS API
    1. 在「API Library」檢視畫面中,搜尋「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 地端部署環境 (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

    如果您要在 AWS 上的 GKE 中執行叢集,請使用下列指令啟用 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 3