【问题标题】:How can I find the gcp service name related with the cost on google account?如何在 google 帐户上找到与费用相关的 gcp 服务名称?
【发布时间】:2020-06-24 20:13:58
【问题描述】:

使用 bq 数据,我们可以像这样列出

  {
    "svc_desc": "Cloud function",
    "service_id": "6F81-5220-406A",
    "labels": "null",
    "final_cost": "10.0"
  },
  {
    "svc_desc": "Cloud function",
    "service_id": "5490-F789-0DF2",
    "labels": "null",
    "final_cost": "20.0"
  }

如果我请求 Google 计费端点传递 service_id,例如 https://cloudbilling.googleapis.com/v1/services/6F81-5220-456A/skus?key={api_key}

这将显示一个 skus 列表,但这没有资源的真实名称,只是显示“它是一个云功能”。有人知道我们如何获得与这些成本相关的云功能的名称。

谢谢

【问题讨论】:

    标签: google-cloud-platform billing


    【解决方案1】:

    我写了一篇关于帐单目录 API 的文章。

    Google Cloud Billing Catalog API

    此 displayName 是 .skus[].category.serviceDisplayName

    示例:

    curl https://cloudbilling.googleapis.com/v1/services/6F81-5844-456A/skus?key=API_KEY
    

    输出:

    {
      "skus": [
        {
          "name": "services/6F81-5844-456A/skus/0009-EA63-4404",
          "skuId": "0009-EA63-4404",
          "description": "Licensing Fee for Bitnami RabbitMQ (CPU cost)",
          "category": {
            "serviceDisplayName": "Compute Engine",
            "resourceFamily": "License",
            "resourceGroup": "BitnamiRabbitMQ",
            "usageType": "OnDemand"
          },
          "serviceRegions": [
            "global"
          ],
          "pricingInfo": [
            {
              "summary": "",
              "pricingExpression": {
                "usageUnit": "h",
                "usageUnitDescription": "hour",
                "baseUnit": "s",
                "baseUnitDescription": "second",
                "baseUnitConversionFactor": 3600,
                "displayQuantity": 1,
                "tieredRates": [
                  {
                    "startUsageAmount": 0,
                    "unitPrice": {
                      "currencyCode": "USD",
                      "units": "0",
                      "nanos": 0
                    }
                  }
                ]
              },
              "currencyConversionRate": 1,
              "effectiveTime": "2018-10-28T03:11:58.735Z"
            }
          ],
          "serviceProviderName": "Google"
        },
    

    【讨论】:

    • 您好 John 感谢您的回答,是的,我也有这些信息,就像您的回答一样,这是一个计算引擎,但您知道是哪一个吗?我的意思是我知道它是显示名称上的“云功能”,但我想知道那是哪个云功能。资源的真实名称,例如“test-function”
    • 你看我的文章了吗?编辑您的问题以包含有关您拥有什么以及您正在寻找什么的信息。计费目录 API 没有关于您的资源名称的信息,只有资源。例如,您提到real resources name。这到底是什么意思?改进您的问题以获得好的答案。
    • 您好感谢您的建议,我已经编辑了我的问题。我想知道与成本相关的云功能名称。我的帐户上有一大串云功能,其中一些没有标签,我无法确定哪个缺少标签。所以我想用这个成本来识别函数的名称,或者我如何识别哪个 gcf 在我的帐户上没有标签
    • 您需要使用 Billing API 而不是 Billing Catalog API
    猜你喜欢
    • 2021-12-01
    • 2018-04-10
    • 1970-01-01
    • 2020-11-07
    • 1970-01-01
    • 1970-01-01
    • 2020-11-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多