问题描述
我们正在处理一个客户模块.借助此模块,我们正在计算Google云组件的价格,例如图像,启动磁盘,区域,快照,网络,VPC,Ingress,Egress,负载平衡,前发规则,Pubsub等.
We are working in one of the customer module. With the help of this module, we are calculating price for google cloud components like images, boot disk, region, snapshot, Network, VPC, Ingress, Egress, load balance, forwording rule, Pubsub etc.
我们知道已从 GCP计算器页
因此堆栈溢出之一建议我们使用目录APIS .
So one of the stack overflow answer suggested us to use Catalog APIS.
如Catalog API中所述,我们通过将服务ID(计算引擎)和api键放在URL中来创建URL:https://cloudbilling.googleapis.com/v1/services/<<service_id>>/skus?key=<<API_key>>
我们正在获取JSON.但是我们发现JSON中缺少数据.
As mentioned in Catalog API, we created a URL by putting service id (compute engine) and api key in URL : https://cloudbilling.googleapis.com/v1/services/<<service_id>>/skus?key=<<API_key>>
We are getting a JSONs. But we observed data is missing in the JSON.
我们观察到它们仅覆盖9个资源组区域-PDStandard(在服务计算引擎的资源族存储中)我们仅找到PDStandard的以下9个地区的价格数据:
We observed they are covering only 9 regions for resource group - PDStandard (in resource family storage for service compute engine)We found pricing data only for following 9 regions for PDStandard :
"asia-southeast1"
"asia-south1"
"australia-southeast1"
"europe-west3"
"us-east4"
"northamerica-northeast1"
"asia-northeast1"
"europe-west4"
"europe-west2"
我们还观察到它们仅覆盖资源组的11个区域-SSD(在服务计算引擎的资源族存储中)我们仅找到以下11个地区的SSD定价数据:
We also observed they are covering only 11 regions for resource group - SSD (in resource family storage for service compute engine)We found pricing data only for following 11 regions for SSD :
"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"
根据区域列表的GCP文档,全球共有15个区域一个>我们在哪里可以找到其余地区的价格数据以获取磁盘价格?
There are total 15 regions across the globe as per GCP document of region listWhere can we find pricing data for remaining regions to get disk price?
推荐答案
我发现GCP以分页格式显示结果.
I found that GCP is showing result in pagination format.
"nextPageToken": "<<some key>>"
如果我们在页面末尾看到nextPageToken
键,则可能是GCP在下一页显示了剩余数据.
If we are seeing nextPageToken
key at the end of page, probably GCP showing remaining data in next page.
要获取下一页数据,我们必须修改URL,并在上一个URL中附加下一个页面令牌密钥:
For getting next page data, we have to modify URL with appending next page token key in previous URL as:
https://cloudbilling.googleapis.com/v1/services/<<service_id>>/skus?key=<<API_key>>&pageToken=<<nextpagetoken key>>
所以我们得到了完整的结果.
So we are getting complete result.
这篇关于GCP:如何获取目录API中缺少区域的磁盘价格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!