שלב 3: הפעלת ממשקי API

כדי להשתמש ב-Apigee hybrid, צריך להפעיל את ממשקי ה-API הבאים לפרויקט במסוף Google Cloud:

  • Apigee API: מספק תקשורת בין הפרויקט שלכם לבין שירותים היברידיים אחרים ולבין Google Cloud APIs.
  • Apigee Connect API: מספק תקשורת בין מישור הניהול של Apigee לבין שירות MART במישור זמן הריצה.
  • Cloud Pub/Sub API: נדרש כדי שהמכסה תפעל.
  • Cloud Resource Manager API: משמש את Hybrid לאימות חשבונות שירות.
  • Compute Engine API: משמש לניהול אשכולות (אשכולות מבוססי GKE בלבד).
  • Kubernetes Engine API: צריך להפעיל את ה-API הזה אם מתכננים להשתמש ב-Google Kubernetes Engine‏ (GKE) או ב-GKE on-prem (Anthos) on-prem להתקנת זמן ריצה היברידי.

מפעילים את ממשקי ה-API הנדרשים בפרויקט ב-Google Cloud:

אפשר להפעיל את ממשקי ה-API באמצעות ה-CLI או ממשק המשתמש של מסוף Google Cloud.

ממשק המשתמש של Google Cloud

כדי להפעיל את ממשקי ה-API באמצעות ממשק המשתמש, מבצעים את השלבים הבאים:

  1. פותחים את מסוף Google Cloud ונכנסים לחשבון שיצרתם בשלב 1: יצירת חשבון Google Cloud.
  2. בוחרים את הפרויקט שיצרתם בשלב 2: יצירת פרויקט ב-Google Cloud.
  3. מפעילים את Apigee API באופן הבא:
    1. בתפריט הניווט, בוחרים באפשרות APIs & Services > Library.

      תפריט הניווט מודגש

      האפשרות Library (ספרייה) נבחרה אחרי שלוחצים על APIs & Services (ממשקי API ושירותים)

    2. בתצוגה API Library (ספריית ה-API), מחפשים את Apigee.

      תיבת חיפוש בספריית ה-API

      ב-Google Cloud מוצגת רשימה של ממשקי API שתואמים ל-Apigee

    3. מחפשים את השירות Apigee API ולוחצים עליו.
    4. אפשרות לשירות Apigee API

    5. בתצוגת Apigee API, לוחצים על Enable.

      מערכת Google Cloud מפעילה את Apigee API בפרויקט שלכם ב-Google Cloud.

  4. מפעילים את Apigee Connect API:
    1. בתצוגה API Library, מחפשים את Apigee Connect.
    2. מאתרים את Apigee Connect API ומפעילים אותו.

      מערכת Google Cloud מפעילה את Apigee Connect API בפרויקט שלכם ב-Google Cloud.

  5. מפעילים את Cloud Pub/Sub API:
    1. בתצוגה API Library, מחפשים את Cloud Pub/Sub API.
    2. מאתרים את Cloud Pub/Sub API ומפעילים אותו.

      מערכת Google Cloud מפעילה את Cloud Pub/Sub API בפרויקט בענן שלכם ב-Google Cloud.

  6. מפעילים את Cloud Resource Manager API:
    1. בתצוגה API Library, מחפשים את Cloud Resource Manager.
    2. מאתרים את Cloud Resource Manager ומפעילים אותו.

      מערכת Google Cloud מפעילה את Cloud Resource Manager API עבור הפרויקט שלכם ב-Google Cloud.

  7. (לאשכולות שמבוססים על GKE בלבד) מפעילים את Compute Engine API:
    1. בתצוגה API Library, מחפשים את Compute Engine.
    2. מאתרים את Compute Engine API ומפעילים אותו.

      מערכת Google Cloud מפעילה את Compute Engine API בפרויקט שלכם ב-Google Cloud.

  8. (רק באשכולות שמבוססים על GKE) מפעילים את Google Kubernetes Engine API:
    1. בתצוגה API Library, מחפשים את Google Kubernetes Engine.
    2. מאתרים את Google Kubernetes API ומפעילים אותו.

      ‫Google Cloud מאפשרת את Google Kubernetes API בפרויקט בענן שלכם ב-Google Cloud.

  9. כדי לוודא שהפעלתם את ממשקי ה-API, בוחרים באפשרות APIs & Services > Dashboard.

    ממשקי ה-API שהוספתם מוצגים ברשימת ממשקי ה-API המופעלים:

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

‫CLI של gcloud

כדי להפעיל את ממשקי ה-API באמצעות ה-CLI, מבצעים את השלבים הבאים:

  1. פותחים חלון טרמינל במכשיר שבו משתמשים לניהול Apigee.
  2. כדי לוודא שכלי gcloud מותקן במעטפת המקומית, מריצים את הפקודה הבאה. כלי gcloud מספק את ממשק שורת הפקודה העיקרי ל-Cloud.
    gcloud -h

    אם gcloud לא מותקן, צריך להתקין את Cloud SDK.

  3. מוודאים שהמשתנה PROJECT_ID מוגדר עם מזהה הפרויקט שיצרתם בשלב 2: יצירת פרויקט בענן ב-Google Cloud:
    echo $PROJECT_ID

    אם לא, מגדירים את משתנה הסביבה PROJECT_ID באמצעות הפקודה הבאה:

    export PROJECT_ID=your_project_id
    שם מזהה הפרויקט עם נקודה בסוף
  4. בוחרים את הכרטיסייה של ההתקנה הרצויה כדי לראות את הפקודה להפעלת ממשקי ה-API:

    GKE

    אם אתם מריצים את האשכולות ב-Google Cloud‏ (GKE), מפעילים את ממשקי ה-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
    

    GKE On-Prem

    אם אתם מריצים את האשכולות ב-GKE on-prem ‏ (Anthos), מפעילים את ממשקי ה-API באמצעות הפקודה הבאה:

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

    AKS

    אם אתם מתכוונים להריץ את האשכולות שלכם ב-Azure Kubernetes Service‏ (AKS), אתם צריכים להפעיל את ממשקי ה-API באמצעות הפקודה הבאה:

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

    ‫GKE ב-AWS

    אם אתם מריצים את האשכולות שלכם ב-GKE ב-AWS, אתם צריכים להפעיל את ממשקי ה-API באמצעות הפקודה הבאה:

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

    EKS

    אם אתם מריצים את האשכולות ב-Amazon EKS, מפעילים את ממשקי ה-API באמצעות הפקודה הבאה:

    gcloud services enable \
        apigee.googleapis.com \
        apigeeconnect.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
    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

מידע נוסף על הפעלת ממשקי API במסוף Google Cloud זמין במאמר בנושא הפעלת API בפרויקט בענן של Google Cloud במסמכי התיעוד של Cloud.

1 2 3 (NEXT) Step 4: Create an organization 5