如何从consumption.usage_details.list()过滤对象?

时间:2019-02-13 12:25:10

标签: python azure sdk azure-sdk-python

我试图仅过滤掉符合给定日期条件的那些对象。但是我做不到!

consumption = ConsumptionManagementClient(credentials, subscription_id, base_url=None)
for obj in list(consumption.usage_details.list(filter=date_filter))
print(obj.usage_start)

我尝试过:

date_filter = 'usage_start ge 2019-02-11T23:59:59Z'  
date_filter = 'properties/usage_start ge 2019-02-11T23:59:59Z'       
date_filter = 'usageStart ge 2019-02-11T23:59:59Z'    
date_filter = 'properties/usageStart ge 2019-02-11T23:59:59Z'    
date_filter = 'properties/UsageStart ge 2019-02-11T23:59:59Z'    
date_filter = 'UsageStart ge 2019-02-11'    
date_filter = 'usage_start ge 2019-02-11'    
date_filter = 'properties/usage_start ge 2019-02-11'    
date_filter = 'usageStart ge 2019-02-11'   
date_filter = 'properties/usageStart ge 2019-02-11'    
date_filter = 'properties/UsageStart ge 2019-02-11'    
date_filter = 'UsageStart ge 2019-02-11' 

1 个答案:

答案 0 :(得分:0)

我在github中找到了use_details.list()的测试方法。您可以尝试阅读该文章。

日期定义:

enter image description here

然后应用以下过滤器:date_filter ='usageEnd le '+ str(endDate)

enter image description here

希望有帮助。