שימוש ב-API לרכישת התחייבות להוצאה

במאמר הזה מוסבר איך לרכוש התחייבות להוצאה באמצעות Cloud Commerce Consumer Procurement API לרכישות ב-Cloud Marketplace.

ה-API הזה תומך רק ברכישת התחייבויות להוצאה, ולא בהתחייבויות לשימוש במשאבים.

לפני שמתחילים

מזהים את המבצע שרוצים לרכוש.

כדי לרכוש התחייבות להוצאה, צריך להשתמש בשם מבצע שמציין את המוצר שרוכשים ואת תקופת ההנחה.

במודל החדש של הנחות ה-CUD יש שמות חדשים למוצרים קיימים עם הנחות CUD. בטבלה הבאה מוצגים שמות המוצרים לפני ואחרי המעבר למודל החדש של הנחות CUD שמבוסס על הוצאות. צריך להשתמש בשם המבצע שתואם למודל של החשבון לחיוב ב-Cloud.

המבצעים המעודכנים הבאים זמינים לרכישה:

מוצר מונח שם המבצע אחרי המיגרציה שם המבצע לפני ההעברה
‫AlloyDB ל-PostgreSQL שנה אחת services/alloydb.googleapis.com/standardOffers/ff04ec3e-278c-4ec8-8278-12f875a8cea2 services/alloydb.googleapis.com/standardOffers/adbca020-a973-48c9-b9b6-f5d70527790c
‫AlloyDB ל-PostgreSQL 3 שנים services/alloydb.googleapis.com/standardOffers/9522b4d8-bff7-4141-81d6-b71d9113c69a services/alloydb.googleapis.com/standardOffers/56e5948f-f1ed-45ce-84d6-a8408092e7d5
‫Backup and DR (Oracle) שנה אחת services/backupdr.googleapis.com/standardOffers/16e6132e-8a72-4a7f-8941-bf52246afc82 services/backupdr.googleapis.com/standardOffers/5b446c4d-ce38-4d1a-8c76-e8b04ad50069
‫Backup and DR (Oracle) 3 שנים services/backupdr.googleapis.com/standardOffers/1e028b05-4344-4bca-87e7-235ee3536354 services/backupdr.googleapis.com/standardOffers/0dba7aa1-3215-4d44-9581-e1c34ca94471
BigQuery שנה אחת services/bigqueryreservation.googleapis.com/standardOffers/d73ae4d8-d096-4c9b-9c20-cd92c3c53724 services/bigqueryreservation.googleapis.com/standardOffers/6e72d4d4-5591-4c7f-aa9f-88d277d9280c
BigQuery 3 שנים services/bigqueryreservation.googleapis.com/standardOffers/f43d480d-3e77-4079-946c-e1b2ab640a8a services/bigqueryreservation.googleapis.com/standardOffers/ad5539c4-a0d9-4abd-82c9-1104a7c8ad64
Bigtable שנה אחת services/bigtable.googleapis.com/standardOffers/c0bf8ba5-65ee-4f7d-9e1e-3953433cf193 services/bigtable.googleapis.com/standardOffers/5a0a5567-1552-445e-9f1b-f1ac69fb0f39
Bigtable 3 שנים services/bigtable.googleapis.com/standardOffers/460fb2ef-456d-4263-a070-4f993fa37996 services/bigtable.googleapis.com/standardOffers/26e8485e-acef-4e73-9a13-f0b2109befff
Cloud Run שנה אחת services/run.googleapis.com/standardOffers/392802d4-e57b-40d3-9684-a1e8cdca6fb5 services/run.googleapis.com/standardOffers/55435965-baf5-485f-baea-3fde53566e5e
Cloud Run 3 שנים services/run.googleapis.com/standardOffers/88a5fc51-d63b-4865-bf3b-c49e05a8c5c0 services/run.googleapis.com/standardOffers/a8b22b6c-2992-48d3-9b73-98fc7a47d61c
התחייבות גמישה לשימוש ב-Compute Engine שנה אחת services/compute.googleapis.com/standardOffers/1b2601a4-9d76-462d-bd5b-5b835d245f93 services/compute.googleapis.com/standardOffers/ffe0f6a3-2f98-437e-8d49-fc443a05d3c2
התחייבות גמישה לשימוש ב-Compute Engine 3 שנים services/compute.googleapis.com/standardOffers/61612674-a9a9-4687-8449-baca71fbd0d1 services/compute.googleapis.com/standardOffers/062a285d-8989-4ce7-8f9a-bed8d183236f
Google Kubernetes Engine שנה אחת services/container.googleapis.com/standardOffers/2f48e468-a86a-452d-88df-edacd94a3c44 services/container.googleapis.com/standardOffers/ae2672e6-47a8-41dc-9448-6956d7f4fbc1
Google Kubernetes Engine 3 שנים services/container.googleapis.com/standardOffers/89027902-6f83-40aa-8861-7c2446b11015 services/container.googleapis.com/standardOffers/fcf378c1-fbe0-4aaa-b05e-9597f8b45578
Dataflow שנה אחת services/dataflow.googleapis.com/standardOffers/127d79e4-1d52-48b0-9f31-8ba02586ff95 services/dataflow.googleapis.com/standardOffers/42ae4415-0361-404f-8bc5-1e7c041c2d82
Dataflow 3 שנים services/dataflow.googleapis.com/standardOffers/03f4d3b1-44b8-4e88-9e75-b1d4e2d04573 services/dataflow.googleapis.com/standardOffers/cac998b8-3d49-4672-ae5b-e5b3c56e05f2
Firestore שנה אחת services/firestore.googleapis.com/standardOffers/de6aa077-3170-4250-89b6-0ccd470f9e21 services/firestore.googleapis.com/standardOffers/f8485012-b340-4562-8302-7e27d48f8cfd
Firestore 3 שנים services/firestore.googleapis.com/standardOffers/e8f59240-c088-4a22-87c3-e58722cca300 services/firestore.googleapis.com/standardOffers/0b48b55a-1fa6-48bc-a3de-2d88f0b99e15
שירות מנוהל ל-Apache Kafka שנה אחת services/managedkafka.googleapis.com/standardOffers/647db981-009c-4e95-b62e-6aff19384956 services/managedkafka.googleapis.com/standardOffers/e1636f7d-1a29-4d53-a89e-c1f60e8dadcf
שירות מנוהל ל-Apache Kafka 3 שנים services/managedkafka.googleapis.com/standardOffers/9a7ed994-d3df-4680-b4e6-7c3d932add66 services/managedkafka.googleapis.com/standardOffers/31d79333-0c0e-4208-9b20-c6e4f27e5d1d
Memorystore for Redis שנה אחת services/redis.googleapis.com/standardOffers/8e0da7cb-196b-4351-bc32-6a6ba94f1456 services/redis.googleapis.com/standardOffers/fe93270a-f338-4a76-b303-c323608a9d37
Memorystore 3 שנים services/redis.googleapis.com/standardOffers/2a3729ac-1e38-4a34-bc96-bd988028351f services/redis.googleapis.com/standardOffers/8f20579e-7630-4592-8fa6-0d7d3b749354
Spanner שנה אחת services/spanner.googleapis.com/standardOffers/359db5c2-8c2c-49e3-a21d-26176c4cd403 services/spanner.googleapis.com/standardOffers/29829e5f-681c-4810-a471-8e4611a8042b
Spanner 3 שנים services/spanner.googleapis.com/standardOffers/a6a32e10-1d76-4df8-8485-eee10d08a1cf services/spanner.googleapis.com/standardOffers/709f6c69-8a49-4032-97f7-ce21fe340603
Cloud SQL שנה אחת services/cloudsql.googleapis.com/standardOffers/d31cf078-36a2-4a8a-a2e6-b23caec0e7a3 services/cloudsql.googleapis.com/standardOffers/266e6a8c-2a0d-4b92-af9c-5795760f1fc9
Cloud SQL 3 שנים services/cloudsql.googleapis.com/standardOffers/48960309-1646-4fa2-9bf8-d7e72090d2b8 services/cloudsql.googleapis.com/standardOffers/4998bf0a-51dd-4ce0-8405-aa529dd86d33

המוצרים הבאים לא מושפעים ממודל ה-CUD החדש וזמינים לרכישה:

מוצר מונח שם המבצע
גיבוי ל-GKE שנה אחת services/gkebackup.googleapis.com/standardOffers/89852607-f073-4696-94cc-de7ed85f27c7
גיבוי ל-GKE 3 שנים services/gkebackup.googleapis.com/standardOffers/25d2877b-2868-4312-b54e-880896a119c5
‫Backup and DR (VMWare) שנה אחת services/backupdr.googleapis.com/standardOffers/30c7e770-724f-4a7d-8369-b726a397b53a
‫Backup and DR (VMWare) 3 שנים services/backupdr.googleapis.com/standardOffers/6748e93c-4114-4fa2-bf3e-cb4d3534bb48
NetApp Volumes שנה אחת services/netapp.googleapis.com/standardOffers/90520cfa-14b6-42ae-92b9-129671bf2aca
NetApp Volumes 3 שנים services/netapp.googleapis.com/standardOffers/c852fef8-e699-4524-90f4-e7b89edeb33c

זיהוי הפרמטרים של המבצע

להתחייבויות יש שני פרמטרים:

  • סכום ההתחייבות (hourly_commit): הזיכוי שמוחל על החשבון לחיוב ב-Cloud בכל שעה אחרי שרוכשים את ההתחייבות הזו.

  • Region (region): האזור שבו חלים היתרונות של ההתחייבות הזו.

כשרוכשים התחייבות, צריך לציין את שני הפרמטרים.

רכישת המבצע

כדי לרכוש מבצע, צריך להתקשר אל billingAccounts.orders.place ולספק את הפרמטרים הבאים:

  • הסמל hourly_commit שמציין את ערך ההתחייבות בדולרים.

  • הסכום region לרכישת ההתחייבות.

כדי לבצע הזמנה, מריצים את הפקודה הבאה:

curl 'https://cloudcommerceconsumerprocurement.googleapis.com/v1alpha1/billingAccounts/BILLING_ACCOUNT_ID/orders:place' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer ACCESS_TOKEN' \
    --header 'X-Goog-User-Project: CONSUMER_PROJECT_ID' \
    -d '@-' <<EOF
    {
    "displayName": "DISPLAY_NAME",
    "lineItemInfo": [{
        "parameters": [{
        "name": "hourly_commit",
        "value": {
            "doubleValue": HOURLY_COMMIT
        }
        }, {
        "name": "region",
        "value": {
            "stringValue": "REGION"
        }
        }],
        "offer": "OFFER_NAME"
    }]
    }
EOF

הפעולה הזו מחזירה את השם של פעולה ממושכת:

{
    "name": "OPERATION_NAME"
}

כדי לוודא שהפעולה הממושכת שהוחזרה הושלמה בהצלחה, מריצים את הפקודה הבאה:

curl 'https://cloudcommerceconsumerprocurement.googleapis.com/v1alpha1/OPERATION_NAME' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer ACCESS_TOKEN' \
    --header 'X-Goog-User-Project: CONSUMER_PROJECT_ID'

הפעולה ארוכת הטווח אמורה להסתיים תוך פחות משנייה אחת.

צפייה בהזמנה

אפשר לראות את המצב הנוכחי של ההתחייבות ישירות במסוף Google Cloud או באמצעות קריאה ל-billingAccounts.orders.get. השדה name של ההזמנה שנוצרה מציין את שם ההזמנה.

cURL

כדי להציג הזמנה, מריצים את הפקודה הבאה:

curl 'https://cloudcommerceconsumerprocurement.googleapis.com/v1alpha1/ORDER_NAME' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer ACCESS_TOKEN' \
    --header 'X-Goog-User-Project: CONSUMER_PROJECT_ID'

המסוף

  1. נכנסים לחשבון לחיוב ב-Cloud במסוף Google Cloud .

    כניסה לחשבון לחיוב ב-Cloud

  2. בסרגל הצד, בוחרים באפשרות Committed use discounts (CUDs).

  3. ההתחייבויות שרכשתם מוצגות.