Cloud Commerce Consumer Procurement API를 사용하여 약정 오퍼 구매

Cloud Marketplace 구매용 API인 Cloud Commerce Consumer Procurement API를 사용하여 오퍼를 구매할 수 있습니다.

현재는 API를 통해 선택한 제품에 대한 지출 기반 약정만 구매할 수 있습니다. 이 사용 안내에서는 지출 기반 약정을 구매하는 방법을 설명합니다.

시작하기 전에

구매하려는 오퍼 식별

지출 기반 약정을 구매하려면 구매하려는 제품 및 할인 조건을 나타내는 오퍼 이름을 사용합니다.

구매할 수 있는 오퍼는 다음과 같습니다.

제품 조건 오퍼 이름
VMWare Engine 1년 services/vmwareengine.googleapis.com/standardOffers/094acb28-d4fc-49fb-9490-0c469cc7048e
VMWare Engine 3년 services/vmwareengine.googleapis.com/standardOffers/f179581e-c899-4271-9462-9f9e0ed1526c
Compute Engine 가변형 약정 1년 services/compute.googleapis.com/standardOffers/ffe0f6a3-2f98-437e-8d49-fc443a05d3c2
Compute Engine 가변형 약정 3년 services/compute.googleapis.com/standardOffers/062a285d-8989-4ce7-8f9a-bed8d183236f
PostgreSQL용 AlloyDB 1년 services/alloydb.googleapis.com/standardOffers/adbca020-a973-48c9-b9b6-f5d70527790c
PostgreSQL용 AlloyDB 3년 services/alloydb.googleapis.com/standardOffers/56e5948f-f1ed-45ce-84d6-a8408092e7d5
Cloud Bigtable 1년 services/bigtable.googleapis.com/standardOffers/5a0a5567-1552-445e-9f1b-f1ac69fb0f39
Cloud Bigtable 3년 services/bigtable.googleapis.com/standardOffers/26e8485e-acef-4e73-9a13-f0b2109befff
Cloud Run 1년 services/run.googleapis.com/standardOffers/55435965-baf5-485f-baea-3fde53566e5e
Cloud Run 3년 services/run.googleapis.com/standardOffers/a8b22b6c-2992-48d3-9b73-98fc7a47d61c
Cloud Spanner 1년 services/spanner.googleapis.com/standardOffers/29829e5f-681c-4810-a471-8e4611a8042b
Cloud Spanner 3년 services/spanner.googleapis.com/standardOffers/709f6c69-8a49-4032-97f7-ce21fe340603
Cloud SQL 1년 services/cloudsql.googleapis.com/standardOffers/266e6a8c-2a0d-4b92-af9c-5795760f1fc9
Cloud SQL 3년 services/cloudsql.googleapis.com/standardOffers/4998bf0a-51dd-4ce0-8405-aa529dd86d33
Kubernetes Engine 1년 services/container.googleapis.com/standardOffers/ae2672e6-47a8-41dc-9448-6956d7f4fbc1
Kubernetes Engine 3년 services/container.googleapis.com/standardOffers/fcf378c1-fbe0-4aaa-b05e-9597f8b45578
Memorystore 1년 services/redis.googleapis.com/standardOffers/fe93270a-f338-4a76-b303-c323608a9d37
Memorystore 3년 services/redis.googleapis.com/standardOffers/8f20579e-7630-4592-8fa6-0d7d3b749354

오퍼 매개변수 식별

약정에는 2개의 매개변수가 있습니다.

  • 약정 금액(hourly_commit): 이 약정을 구매한 후 매 시간 Cloud Billing 계정에 적용되는 크레딧입니다.
  • 리전(region): 이 약정의 크레딧이 적용되는 리전입니다.

약정을 구매할 때는 매개변수를 둘 다 지정해야 합니다.

제품에는 해당 매개변수에 대해 특정 값 및 제약조건이 있습니다. 예를 들어 VMWare Engine을 구매하려면 다음 값 및 제약조건을 참조할 수 있습니다.

제품 최소 약정 최대 약정 리전
VMWare Engine 시간당 $5 시간당 $10,000 asia-northeast1
asia-south1
asia-southeast1
australia-southeast1
europe-west2
europe-west3
europe-west4
northamerica-northeast
northamerica-northeast1
southamerica-east1
us-central1
us-east4
us-west2

오퍼 구매

오퍼를 구매하려면 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'

장기 실행 작업은 1초 이내에 완료되어야 합니다.

주문 보기

Google Cloud Console에서 직접 또는 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'

Console

  1. https://console.cloud.google.com/billing으로 이동합니다.
  2. Cloud Billing 계정을 선택합니다.
  3. 사이드바에서 약정을 선택합니다.
  4. 구매한 약정이 표시된 테이블에 나타납니다.