1

有什么方法可以让我们使用 Azure Python SDK [ https://docs.microsoft.com/en-us/python/api/overview/azure/?view=azure-python]获取单个资源的成本?

我使用了 RateCard [ https://docs.microsoft.com/en-us/python/api/azure-mgmt-commerce/azure.mgmt.commerce.operations.ratecardoperations?view=azure-python]和用法 [ https: //docs.microsoft.com/en-us/python/api/azure-mgmt-commerce/azure.mgmt.commerce.operations.usageaggregatesoperations?view=azure-python] API 来计算成本。但正在寻找更好的解决方案。

query = "OfferDurableId eq '" + offer_id + \
                "' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'"
ratecard = usage_client.rate_card.get(filter=query)

usage = usage_client.usage_aggregates.list(reported_start_time=start,
                                                                 reported_end_time=end,
                                                                 show_details=True,
                                                                 aggregation_granularity="Daily"):

使用 Azure SDK 获取过去 30 天的单个资源成本。

4

0 回答 0