google-api - 谷歌价格计算器 API (GCP)

标签 google-api google-cloud-platform

我正在寻找使用谷歌价格计算器为云资源构建简单的计费应用程序 https://cloud.google.com/products/calculator/

Google 是否提供任何用于与 Google 价格计算器交互的 API?

我试过了,但没找到!

最佳答案

您可以使用 Cloud Billing Catalog API ,根据官方文档:

  • 获取服务中所有公共(public) SKU 的列表,包括:
    • 人类可读的 SKU 描述。
    • SKU 的公开定价。
    • 可以购买 SKU 的区域。
    • 有关 SKU 的分类数据。

一个例子:

要求:

GET https://cloudbilling.googleapis.com/v1/services/SERVICE_ID/skus?key=API_KEY

其中 SERVICE_ID 是父服务的标识符。

响应:

{
  "skus": [
    {
        "name": "[SKU_NAME]",
        "skuId": "[SKU_ID]",
        "description": "[SKU_DESCRIPTION]",
        "category": {
            "serviceDisplayName": "[SVC_DISPLAY_NAME]",
            "resourceFamily": "[FAMILY]",
            "resourceGroup": "[GROUP]",
            "usageType": "[USAGE]",
        },
        "serviceRegions": [
          "[REGION]"
        ],
        "pricingInfo": [
          {
              "effectiveTime": "[TIME]",
              "summary": "[SUMMARY]",
              "pricingExpression": {
                  "usageUnit": "[UNIT]",
                  "usageUnitDescription": "[UNIT_DESCRIPTION]",
                  "displayQuantity": [DISPLAY_QUANTITY],
                  "tieredRates": [
                    {
                        "startUsageAmount": [START_AMOUNT],
                        "unitPrice": {
                            "currencyCode": "[CURRENCY_CODE]",
                            "units": [UNITS],
                            "nanos": [NANOS],
                        },
                    }
                  ],
              },
              "aggregationInfo": {
                  "aggregationLevel": enum("[AGGREGATION_LEVEL]"),
                  "aggregationInterval": enum("[AGGREGATION_INTERVAL]"),
                  "aggregationCount": [AGGREGATION_COUNT],
              },
              "currencyConversionRate": [CONVERSION_RATE],
          }
        ],
        "serviceProviderName": "[SERVICE_PROVIDER]",
    }
  ]
}

根据您的问题,您可能希望使用这些响应对象:

  • [UNIT] 是指定定价的使用单位的简写。例如,GiBy的usageUnit表示使用量以“Gibibytes”为单位。
  • [DISPLAY_QUANTITY] 是显示定价信息的推荐单位数量。显示定价信息时,建议显示:(unitPrice * displayQuantity) per displayQuantity usageUnit。该字段不影响定价公式,仅用于显示目的。例如,如果 unitPrice 是“0.0001 USD”,usageUnit 是“GB”,displayQuantity 是“1000”,那么显示定价信息的推荐方式是“0.10 USD per 1000 GB” .

关于google-api - 谷歌价格计算器 API (GCP),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47974869/

相关文章:

google-cloud-platform - 服务帐号的 GCP 项目配额问题

postgresql - 如何转储 Google Cloud SQL for PostgreSQL DB 以导入回常规 PostgreSQL 数据库?

spring-boot - GCP 上的 Spring Cloud Consul 健康检查和状态配置

python - Google Cloud Functions - 我可以将来自不同 GCP 项目存储库的代码部署到 Cloud Functions 中吗?

google-cloud-platform - 使用 gcloud 工具时,我可以在 Google Cloud Speech-to-Text api 中指定模型(例如 "video")吗?

android - 如何在设备启动时使用 BroadcastReceivers 启动 Google API - ActivityRecognitionAPI?

node.js - NodeJS,如何使用 google api 使用刷新 token 获取新 token ?

python - 在新的 Gmail API 中批量提取电子邮件

google-analytics - 可以从 Google Analytics Reporting API V4 中提取客户 ID 吗?

google-cloud-platform - 谷歌端点 + grpc-web