GCP:如何在Catalog API中获取缺失区域的磁盘价格

时间:2018-05-04 06:41:24

标签: google-cloud-platform google-compute-engine

我们正在其中一个客户模块中工作。在此模块的帮助下,我们正在计算谷歌云组件的价格,如图像,启动盘,区域,快照,网络,VPC,入口,出口,负载平衡,转发规则,Pubsub等。

我们知道JSON link已从GCP calculator页面

中删除

因此,其中一个堆栈溢出answer建议我们使用Catalog APIS

如Catalog API中所述,我们通过在URL中放置服务ID(计算引擎)和api密钥来创建URL:https://cloudbilling.googleapis.com/v1/services/<<service_id>>/skus?key=<<API_key>> 我们正在获得JSON。但我们观察到JSON中缺少数据。

我们发现他们只覆盖了资源组的9个区域 - PDStandard(用于服务的<资源系列存储计算引擎) 我们仅为以下9个PDStandard区域找到了定价数据:

"asia-southeast1"
"asia-south1"
"australia-southeast1"
"europe-west3"
"us-east4"
"northamerica-northeast1"
"asia-northeast1"
"europe-west4"
"europe-west2"

我们还观察到它们仅覆盖资源组的11个区域 - SSD(用于服务计算引擎的资源族存储) 我们发现仅针对SSD的11个区域的定价数据:

"southamerica-east1"
"europe-west4"
"europe-west3"
"europe-west2"
"asia-northeast1"
"us-east4"
 "us-central1",
"us-east1",
"us-west1",
"asia-east1",
"europe-west1"
"australia-southeast1"
"northamerica-northeast1"

根据region list的GCP文件,全球共有15个地区 我们在哪里可以找到剩余地区的定价数据以获得磁盘价格?

1 个答案:

答案 0 :(得分:1)

我发现GCP以分页格式显示结果。

"nextPageToken": "<<some key>>"

如果我们在页面末尾看到nextPageToken键,可能GCP会在下一页显示剩余数据。

要获取下一页数据,我们必须修改网址,并在以前的网址中附加下一页令牌密钥:

https://cloudbilling.googleapis.com/v1/services/<<service_id>>/skus?key=<<API_key>>&pageToken=<<nextpagetoken key>>

所以我们得到了完整的结果。