azure_mgmt_consumption 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/consumption_management_client.rb +7 -6
  3. data/lib/2017-11-30/generated/azure_mgmt_consumption/consumption_management_client.rb +7 -6
  4. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/consumption_management_client.rb +7 -6
  5. data/lib/2018-01-31/generated/azure_mgmt_consumption/consumption_management_client.rb +7 -6
  6. data/lib/2018-01-31/generated/azure_mgmt_consumption/price_sheet.rb +28 -12
  7. data/lib/2018-03-31/generated/azure_mgmt_consumption.rb +84 -0
  8. data/lib/2018-03-31/generated/azure_mgmt_consumption/budgets.rb +993 -0
  9. data/lib/2018-03-31/generated/azure_mgmt_consumption/consumption_management_client.rb +289 -0
  10. data/lib/2018-03-31/generated/azure_mgmt_consumption/cost_tags_operations.rb +233 -0
  11. data/lib/2018-03-31/generated/azure_mgmt_consumption/get_balances_by_billing_account.rb +120 -0
  12. data/lib/2018-03-31/generated/azure_mgmt_consumption/marketplaces.rb +528 -0
  13. data/lib/2018-03-31/generated/azure_mgmt_consumption/marketplaces_by_billing_account.rb +536 -0
  14. data/lib/2018-03-31/generated/azure_mgmt_consumption/marketplaces_by_department.rb +536 -0
  15. data/lib/2018-03-31/generated/azure_mgmt_consumption/marketplaces_by_enrollment_accounts.rb +536 -0
  16. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/balance.rb +281 -0
  17. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/balance_properties_adjustment_details_item.rb +60 -0
  18. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/balance_properties_new_purchases_details_item.rb +60 -0
  19. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/billing_frequency.rb +17 -0
  20. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/budget.rb +171 -0
  21. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/budget_time_period.rb +58 -0
  22. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/budgets_list_result.rb +101 -0
  23. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/category_type.rb +16 -0
  24. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/cost_tag.rb +46 -0
  25. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/cost_tags.rb +90 -0
  26. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/current_spend.rb +59 -0
  27. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/datagrain.rb +16 -0
  28. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/error_details.rb +59 -0
  29. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/error_response.rb +48 -0
  30. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/filters.rb +134 -0
  31. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/marketplace.rb +375 -0
  32. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/marketplaces_list_result.rb +101 -0
  33. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/meter_details.rb +122 -0
  34. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/notification.rb +139 -0
  35. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/operation.rb +59 -0
  36. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/operation_display.rb +72 -0
  37. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/operation_list_result.rb +103 -0
  38. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/operator_type.rb +17 -0
  39. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/price_sheet_properties.rb +134 -0
  40. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/price_sheet_result.rb +112 -0
  41. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/proxy_resource.rb +84 -0
  42. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/query_options.rb +45 -0
  43. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_details.rb +187 -0
  44. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_details_list_result.rb +100 -0
  45. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_recommendations.rb +224 -0
  46. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_recommendations_list_result.rb +101 -0
  47. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_summaries.rb +205 -0
  48. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/reservation_summaries_list_result.rb +101 -0
  49. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/resource.rb +91 -0
  50. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/resource_attributes.rb +59 -0
  51. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/tag.rb +46 -0
  52. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/tags.rb +90 -0
  53. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/time_grain_type.rb +17 -0
  54. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/usage_detail.rb +355 -0
  55. data/lib/2018-03-31/generated/azure_mgmt_consumption/models/usage_details_list_result.rb +101 -0
  56. data/lib/2018-03-31/generated/azure_mgmt_consumption/module_definition.rb +9 -0
  57. data/lib/2018-03-31/generated/azure_mgmt_consumption/operations.rb +216 -0
  58. data/lib/2018-03-31/generated/azure_mgmt_consumption/price_sheet.rb +262 -0
  59. data/lib/2018-03-31/generated/azure_mgmt_consumption/reservation_recommendations_operations.rb +226 -0
  60. data/lib/2018-03-31/generated/azure_mgmt_consumption/reservations_details.rb +449 -0
  61. data/lib/2018-03-31/generated/azure_mgmt_consumption/reservations_summaries.rb +465 -0
  62. data/lib/2018-03-31/generated/azure_mgmt_consumption/tags_operations.rb +113 -0
  63. data/lib/2018-03-31/generated/azure_mgmt_consumption/usage_details.rb +577 -0
  64. data/lib/2018-03-31/generated/azure_mgmt_consumption/usage_details_by_billing_account.rb +599 -0
  65. data/lib/2018-03-31/generated/azure_mgmt_consumption/usage_details_by_department.rb +592 -0
  66. data/lib/2018-03-31/generated/azure_mgmt_consumption/usage_details_by_enrollment_account.rb +599 -0
  67. data/lib/2018-05-31/generated/azure_mgmt_consumption.rb +49 -0
  68. data/lib/2018-05-31/generated/azure_mgmt_consumption/consumption_management_client.rb +144 -0
  69. data/lib/2018-05-31/generated/azure_mgmt_consumption/forecasts.rb +122 -0
  70. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/bound.rb +16 -0
  71. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/charge_type.rb +16 -0
  72. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/error_details.rb +59 -0
  73. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/error_response.rb +48 -0
  74. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/forecast.rb +163 -0
  75. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/forecast_properties_confidence_levels_item.rb +72 -0
  76. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/forecasts_list_result.rb +56 -0
  77. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/grain.rb +17 -0
  78. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/meter_details.rb +122 -0
  79. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/operation.rb +59 -0
  80. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/operation_display.rb +72 -0
  81. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/operation_list_result.rb +103 -0
  82. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/price_sheet_properties.rb +146 -0
  83. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/price_sheet_result.rb +112 -0
  84. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/query_options.rb +45 -0
  85. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/resource.rb +91 -0
  86. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/usage_detail.rb +403 -0
  87. data/lib/2018-05-31/generated/azure_mgmt_consumption/models/usage_details_list_result.rb +101 -0
  88. data/lib/2018-05-31/generated/azure_mgmt_consumption/module_definition.rb +9 -0
  89. data/lib/2018-05-31/generated/azure_mgmt_consumption/operations.rb +216 -0
  90. data/lib/2018-05-31/generated/azure_mgmt_consumption/price_sheet.rb +262 -0
  91. data/lib/2018-05-31/generated/azure_mgmt_consumption/usage_details.rb +2289 -0
  92. data/lib/2018-06-30/generated/azure_mgmt_consumption.rb +85 -0
  93. data/lib/2018-06-30/generated/azure_mgmt_consumption/balances.rb +210 -0
  94. data/lib/2018-06-30/generated/azure_mgmt_consumption/budgets.rb +993 -0
  95. data/lib/2018-06-30/generated/azure_mgmt_consumption/consumption_management_client.rb +176 -0
  96. data/lib/2018-06-30/generated/azure_mgmt_consumption/cost_tags.rb +233 -0
  97. data/lib/2018-06-30/generated/azure_mgmt_consumption/forecasts.rb +122 -0
  98. data/lib/2018-06-30/generated/azure_mgmt_consumption/marketplaces.rb +2058 -0
  99. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/balance.rb +281 -0
  100. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/balance_properties_adjustment_details_item.rb +60 -0
  101. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/balance_properties_new_purchases_details_item.rb +60 -0
  102. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/billing_frequency.rb +17 -0
  103. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/bound.rb +16 -0
  104. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/budget.rb +171 -0
  105. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/budget_time_period.rb +58 -0
  106. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/budgets_list_result.rb +101 -0
  107. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/category_type.rb +16 -0
  108. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/charge_type.rb +16 -0
  109. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/cost_tag.rb +90 -0
  110. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/cost_tag_properties.rb +46 -0
  111. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/current_spend.rb +59 -0
  112. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/datagrain.rb +16 -0
  113. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/error_details.rb +59 -0
  114. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/error_response.rb +48 -0
  115. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/filters.rb +134 -0
  116. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/forecast.rb +163 -0
  117. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/forecast_properties_confidence_levels_item.rb +72 -0
  118. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/forecasts_list_result.rb +56 -0
  119. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/grain.rb +17 -0
  120. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/marketplace.rb +375 -0
  121. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/marketplaces_list_result.rb +101 -0
  122. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/meter_details.rb +146 -0
  123. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/notification.rb +139 -0
  124. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/operation.rb +59 -0
  125. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/operation_display.rb +72 -0
  126. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/operation_list_result.rb +103 -0
  127. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/operator_type.rb +17 -0
  128. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/price_sheet_properties.rb +146 -0
  129. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/price_sheet_result.rb +112 -0
  130. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/proxy_resource.rb +84 -0
  131. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/query_options.rb +45 -0
  132. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_detail.rb +187 -0
  133. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_details_list_result.rb +100 -0
  134. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_recommendation.rb +224 -0
  135. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_recommendations_list_result.rb +101 -0
  136. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_summaries_list_result.rb +100 -0
  137. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/reservation_summary.rb +205 -0
  138. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/resource.rb +91 -0
  139. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/resource_attributes.rb +59 -0
  140. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/tag.rb +46 -0
  141. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/tags_result.rb +90 -0
  142. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/time_grain_type.rb +17 -0
  143. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/usage_detail.rb +415 -0
  144. data/lib/2018-06-30/generated/azure_mgmt_consumption/models/usage_details_list_result.rb +101 -0
  145. data/lib/2018-06-30/generated/azure_mgmt_consumption/module_definition.rb +9 -0
  146. data/lib/2018-06-30/generated/azure_mgmt_consumption/operations.rb +216 -0
  147. data/lib/2018-06-30/generated/azure_mgmt_consumption/price_sheet.rb +262 -0
  148. data/lib/2018-06-30/generated/azure_mgmt_consumption/reservation_recommendations.rb +226 -0
  149. data/lib/2018-06-30/generated/azure_mgmt_consumption/reservations_details.rb +449 -0
  150. data/lib/2018-06-30/generated/azure_mgmt_consumption/reservations_summaries.rb +465 -0
  151. data/lib/2018-06-30/generated/azure_mgmt_consumption/tags.rb +113 -0
  152. data/lib/2018-06-30/generated/azure_mgmt_consumption/usage_details.rb +2289 -0
  153. data/lib/azure_mgmt_consumption.rb +4 -1
  154. data/lib/profiles/latest/modules/consumption_profile_module.rb +160 -78
  155. data/lib/version.rb +1 -1
  156. metadata +150 -4
@@ -0,0 +1,113 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Consumption::Mgmt::V2018_06_30
7
+ #
8
+ # Consumption management client provides access to consumption resources for
9
+ # Azure Enterprise Subscriptions.
10
+ #
11
+ class Tags
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Tags class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [ConsumptionManagementClient] reference to the ConsumptionManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Get all available tag keys for a billing account.
27
+ #
28
+ # @param billing_account_id [String] BillingAccount ID
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [TagsResult] operation results.
33
+ #
34
+ def get(billing_account_id, custom_headers:nil)
35
+ response = get_async(billing_account_id, custom_headers:custom_headers).value!
36
+ response.body unless response.nil?
37
+ end
38
+
39
+ #
40
+ # Get all available tag keys for a billing account.
41
+ #
42
+ # @param billing_account_id [String] BillingAccount ID
43
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
44
+ # will be added to the HTTP request.
45
+ #
46
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
47
+ #
48
+ def get_with_http_info(billing_account_id, custom_headers:nil)
49
+ get_async(billing_account_id, custom_headers:custom_headers).value!
50
+ end
51
+
52
+ #
53
+ # Get all available tag keys for a billing account.
54
+ #
55
+ # @param billing_account_id [String] BillingAccount ID
56
+ # @param [Hash{String => String}] A hash of custom headers that will be added
57
+ # to the HTTP request.
58
+ #
59
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
60
+ #
61
+ def get_async(billing_account_id, custom_headers:nil)
62
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
63
+ fail ArgumentError, 'billing_account_id is nil' if billing_account_id.nil?
64
+
65
+
66
+ request_headers = {}
67
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
68
+
69
+ # Set Headers
70
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
71
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
72
+ path_template = 'providers/Microsoft.CostManagement/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/tags'
73
+
74
+ request_url = @base_url || @client.base_url
75
+
76
+ options = {
77
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
78
+ path_params: {'billingAccountId' => billing_account_id},
79
+ query_params: {'api-version' => @client.api_version},
80
+ headers: request_headers.merge(custom_headers || {}),
81
+ base_url: request_url
82
+ }
83
+ promise = @client.make_request_async(:get, path_template, options)
84
+
85
+ promise = promise.then do |result|
86
+ http_response = result.response
87
+ status_code = http_response.status
88
+ response_content = http_response.body
89
+ unless status_code == 200
90
+ error_model = JSON.load(response_content)
91
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
92
+ end
93
+
94
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
95
+ # Deserialize Response
96
+ if status_code == 200
97
+ begin
98
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
99
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::TagsResult.mapper()
100
+ result.body = @client.deserialize(result_mapper, parsed_response)
101
+ rescue Exception => e
102
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
103
+ end
104
+ end
105
+
106
+ result
107
+ end
108
+
109
+ promise.execute
110
+ end
111
+
112
+ end
113
+ end
@@ -0,0 +1,2289 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Consumption::Mgmt::V2018_06_30
7
+ #
8
+ # Consumption management client provides access to consumption resources for
9
+ # Azure Enterprise Subscriptions.
10
+ #
11
+ class UsageDetails
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the UsageDetails class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [ConsumptionManagementClient] reference to the ConsumptionManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Lists the usage details for a scope by current billing period. Usage details
27
+ # are available via this API only for May 1, 2014 or later.
28
+ #
29
+ # @param expand [String] May be used to expand the
30
+ # properties/additionalProperties or properties/meterDetails within a list of
31
+ # usage details. By default, these fields are not included when listing usage
32
+ # details.
33
+ # @param filter [String] May be used to filter usageDetails by
34
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
35
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
36
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
37
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
38
+ # string where key and value is separated by a colon (:).
39
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
40
+ # returned a partial result. If a previous response contains a nextLink
41
+ # element, the value of the nextLink element will include a skiptoken parameter
42
+ # that specifies a starting point to use for subsequent calls.
43
+ # @param top [Integer] May be used to limit the number of results to the most
44
+ # recent N usageDetails.
45
+ # @param query_options [QueryOptions] Additional parameters for the operation
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [Array<UsageDetail>] operation results.
50
+ #
51
+ def list(expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
52
+ first_page = list_as_lazy(expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers)
53
+ first_page.get_all_items
54
+ end
55
+
56
+ #
57
+ # Lists the usage details for a scope by current billing period. Usage details
58
+ # are available via this API only for May 1, 2014 or later.
59
+ #
60
+ # @param expand [String] May be used to expand the
61
+ # properties/additionalProperties or properties/meterDetails within a list of
62
+ # usage details. By default, these fields are not included when listing usage
63
+ # details.
64
+ # @param filter [String] May be used to filter usageDetails by
65
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
66
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
67
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
68
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
69
+ # string where key and value is separated by a colon (:).
70
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
71
+ # returned a partial result. If a previous response contains a nextLink
72
+ # element, the value of the nextLink element will include a skiptoken parameter
73
+ # that specifies a starting point to use for subsequent calls.
74
+ # @param top [Integer] May be used to limit the number of results to the most
75
+ # recent N usageDetails.
76
+ # @param query_options [QueryOptions] Additional parameters for the operation
77
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
78
+ # will be added to the HTTP request.
79
+ #
80
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
81
+ #
82
+ def list_with_http_info(expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
83
+ list_async(expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
84
+ end
85
+
86
+ #
87
+ # Lists the usage details for a scope by current billing period. Usage details
88
+ # are available via this API only for May 1, 2014 or later.
89
+ #
90
+ # @param expand [String] May be used to expand the
91
+ # properties/additionalProperties or properties/meterDetails within a list of
92
+ # usage details. By default, these fields are not included when listing usage
93
+ # details.
94
+ # @param filter [String] May be used to filter usageDetails by
95
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
96
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
97
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
98
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
99
+ # string where key and value is separated by a colon (:).
100
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
101
+ # returned a partial result. If a previous response contains a nextLink
102
+ # element, the value of the nextLink element will include a skiptoken parameter
103
+ # that specifies a starting point to use for subsequent calls.
104
+ # @param top [Integer] May be used to limit the number of results to the most
105
+ # recent N usageDetails.
106
+ # @param query_options [QueryOptions] Additional parameters for the operation
107
+ # @param [Hash{String => String}] A hash of custom headers that will be added
108
+ # to the HTTP request.
109
+ #
110
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
111
+ #
112
+ def list_async(expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
113
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
114
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
115
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
116
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
117
+
118
+ apply = nil
119
+ unless query_options.nil?
120
+ apply = query_options.Apply
121
+ end
122
+
123
+ request_headers = {}
124
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
125
+
126
+ # Set Headers
127
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
128
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
129
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Consumption/usageDetails'
130
+
131
+ request_url = @base_url || @client.base_url
132
+
133
+ options = {
134
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
135
+ path_params: {'subscriptionId' => @client.subscription_id},
136
+ query_params: {'$expand' => expand,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version,'$apply' => apply},
137
+ headers: request_headers.merge(custom_headers || {}),
138
+ base_url: request_url
139
+ }
140
+ promise = @client.make_request_async(:get, path_template, options)
141
+
142
+ promise = promise.then do |result|
143
+ http_response = result.response
144
+ status_code = http_response.status
145
+ response_content = http_response.body
146
+ unless status_code == 200
147
+ error_model = JSON.load(response_content)
148
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
149
+ end
150
+
151
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
152
+ # Deserialize Response
153
+ if status_code == 200
154
+ begin
155
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
156
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
157
+ result.body = @client.deserialize(result_mapper, parsed_response)
158
+ rescue Exception => e
159
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
160
+ end
161
+ end
162
+
163
+ result
164
+ end
165
+
166
+ promise.execute
167
+ end
168
+
169
+ #
170
+ # Lists the usage details for a scope by billing period. Usage details are
171
+ # available via this API only for May 1, 2014 or later.
172
+ #
173
+ # @param billing_period_name [String] Billing Period Name.
174
+ # @param expand [String] May be used to expand the
175
+ # properties/additionalProperties or properties/meterDetails within a list of
176
+ # usage details. By default, these fields are not included when listing usage
177
+ # details.
178
+ # @param filter [String] May be used to filter usageDetails by
179
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
180
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
181
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
182
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
183
+ # where key and value is separated by a colon (:).
184
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
185
+ # returned a partial result. If a previous response contains a nextLink
186
+ # element, the value of the nextLink element will include a skiptoken parameter
187
+ # that specifies a starting point to use for subsequent calls.
188
+ # @param top [Integer] May be used to limit the number of results to the most
189
+ # recent N usageDetails.
190
+ # @param query_options [QueryOptions] Additional parameters for the operation
191
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
192
+ # will be added to the HTTP request.
193
+ #
194
+ # @return [Array<UsageDetail>] operation results.
195
+ #
196
+ def list_by_billing_period(billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
197
+ first_page = list_by_billing_period_as_lazy(billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers)
198
+ first_page.get_all_items
199
+ end
200
+
201
+ #
202
+ # Lists the usage details for a scope by billing period. Usage details are
203
+ # available via this API only for May 1, 2014 or later.
204
+ #
205
+ # @param billing_period_name [String] Billing Period Name.
206
+ # @param expand [String] May be used to expand the
207
+ # properties/additionalProperties or properties/meterDetails within a list of
208
+ # usage details. By default, these fields are not included when listing usage
209
+ # details.
210
+ # @param filter [String] May be used to filter usageDetails by
211
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
212
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
213
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
214
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
215
+ # where key and value is separated by a colon (:).
216
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
217
+ # returned a partial result. If a previous response contains a nextLink
218
+ # element, the value of the nextLink element will include a skiptoken parameter
219
+ # that specifies a starting point to use for subsequent calls.
220
+ # @param top [Integer] May be used to limit the number of results to the most
221
+ # recent N usageDetails.
222
+ # @param query_options [QueryOptions] Additional parameters for the operation
223
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
224
+ # will be added to the HTTP request.
225
+ #
226
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
227
+ #
228
+ def list_by_billing_period_with_http_info(billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
229
+ list_by_billing_period_async(billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
230
+ end
231
+
232
+ #
233
+ # Lists the usage details for a scope by billing period. Usage details are
234
+ # available via this API only for May 1, 2014 or later.
235
+ #
236
+ # @param billing_period_name [String] Billing Period Name.
237
+ # @param expand [String] May be used to expand the
238
+ # properties/additionalProperties or properties/meterDetails within a list of
239
+ # usage details. By default, these fields are not included when listing usage
240
+ # details.
241
+ # @param filter [String] May be used to filter usageDetails by
242
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
243
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
244
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
245
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
246
+ # where key and value is separated by a colon (:).
247
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
248
+ # returned a partial result. If a previous response contains a nextLink
249
+ # element, the value of the nextLink element will include a skiptoken parameter
250
+ # that specifies a starting point to use for subsequent calls.
251
+ # @param top [Integer] May be used to limit the number of results to the most
252
+ # recent N usageDetails.
253
+ # @param query_options [QueryOptions] Additional parameters for the operation
254
+ # @param [Hash{String => String}] A hash of custom headers that will be added
255
+ # to the HTTP request.
256
+ #
257
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
258
+ #
259
+ def list_by_billing_period_async(billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
260
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
261
+ fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
262
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
263
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
264
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
265
+
266
+ apply = nil
267
+ unless query_options.nil?
268
+ apply = query_options.Apply
269
+ end
270
+
271
+ request_headers = {}
272
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
273
+
274
+ # Set Headers
275
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
276
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
277
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'
278
+
279
+ request_url = @base_url || @client.base_url
280
+
281
+ options = {
282
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
283
+ path_params: {'subscriptionId' => @client.subscription_id,'billingPeriodName' => billing_period_name},
284
+ query_params: {'$expand' => expand,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version,'$apply' => apply},
285
+ headers: request_headers.merge(custom_headers || {}),
286
+ base_url: request_url
287
+ }
288
+ promise = @client.make_request_async(:get, path_template, options)
289
+
290
+ promise = promise.then do |result|
291
+ http_response = result.response
292
+ status_code = http_response.status
293
+ response_content = http_response.body
294
+ unless status_code == 200
295
+ error_model = JSON.load(response_content)
296
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
297
+ end
298
+
299
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
300
+ # Deserialize Response
301
+ if status_code == 200
302
+ begin
303
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
304
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
305
+ result.body = @client.deserialize(result_mapper, parsed_response)
306
+ rescue Exception => e
307
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
308
+ end
309
+ end
310
+
311
+ result
312
+ end
313
+
314
+ promise.execute
315
+ end
316
+
317
+ #
318
+ # Lists the usage details by billingAccountId for a scope by current billing
319
+ # period. Usage details are available via this API only for May 1, 2014 or
320
+ # later.
321
+ #
322
+ # @param billing_account_id [String] BillingAccount ID
323
+ # @param expand [String] May be used to expand the
324
+ # properties/additionalProperties or properties/meterDetails within a list of
325
+ # usage details. By default, these fields are not included when listing usage
326
+ # details.
327
+ # @param filter [String] May be used to filter usageDetails by
328
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
329
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
330
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
331
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
332
+ # string where key and value is separated by a colon (:).
333
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
334
+ # returned a partial result. If a previous response contains a nextLink
335
+ # element, the value of the nextLink element will include a skiptoken parameter
336
+ # that specifies a starting point to use for subsequent calls.
337
+ # @param top [Integer] May be used to limit the number of results to the most
338
+ # recent N usageDetails.
339
+ # @param query_options [QueryOptions] Additional parameters for the operation
340
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
341
+ # will be added to the HTTP request.
342
+ #
343
+ # @return [Array<UsageDetail>] operation results.
344
+ #
345
+ def list_by_billing_account(billing_account_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
346
+ first_page = list_by_billing_account_as_lazy(billing_account_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers)
347
+ first_page.get_all_items
348
+ end
349
+
350
+ #
351
+ # Lists the usage details by billingAccountId for a scope by current billing
352
+ # period. Usage details are available via this API only for May 1, 2014 or
353
+ # later.
354
+ #
355
+ # @param billing_account_id [String] BillingAccount ID
356
+ # @param expand [String] May be used to expand the
357
+ # properties/additionalProperties or properties/meterDetails within a list of
358
+ # usage details. By default, these fields are not included when listing usage
359
+ # details.
360
+ # @param filter [String] May be used to filter usageDetails by
361
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
362
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
363
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
364
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
365
+ # string where key and value is separated by a colon (:).
366
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
367
+ # returned a partial result. If a previous response contains a nextLink
368
+ # element, the value of the nextLink element will include a skiptoken parameter
369
+ # that specifies a starting point to use for subsequent calls.
370
+ # @param top [Integer] May be used to limit the number of results to the most
371
+ # recent N usageDetails.
372
+ # @param query_options [QueryOptions] Additional parameters for the operation
373
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
374
+ # will be added to the HTTP request.
375
+ #
376
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
377
+ #
378
+ def list_by_billing_account_with_http_info(billing_account_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
379
+ list_by_billing_account_async(billing_account_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
380
+ end
381
+
382
+ #
383
+ # Lists the usage details by billingAccountId for a scope by current billing
384
+ # period. Usage details are available via this API only for May 1, 2014 or
385
+ # later.
386
+ #
387
+ # @param billing_account_id [String] BillingAccount ID
388
+ # @param expand [String] May be used to expand the
389
+ # properties/additionalProperties or properties/meterDetails within a list of
390
+ # usage details. By default, these fields are not included when listing usage
391
+ # details.
392
+ # @param filter [String] May be used to filter usageDetails by
393
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
394
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
395
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
396
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
397
+ # string where key and value is separated by a colon (:).
398
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
399
+ # returned a partial result. If a previous response contains a nextLink
400
+ # element, the value of the nextLink element will include a skiptoken parameter
401
+ # that specifies a starting point to use for subsequent calls.
402
+ # @param top [Integer] May be used to limit the number of results to the most
403
+ # recent N usageDetails.
404
+ # @param query_options [QueryOptions] Additional parameters for the operation
405
+ # @param [Hash{String => String}] A hash of custom headers that will be added
406
+ # to the HTTP request.
407
+ #
408
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
409
+ #
410
+ def list_by_billing_account_async(billing_account_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
411
+ fail ArgumentError, 'billing_account_id is nil' if billing_account_id.nil?
412
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
413
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
414
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
415
+
416
+ apply = nil
417
+ unless query_options.nil?
418
+ apply = query_options.Apply
419
+ end
420
+
421
+ request_headers = {}
422
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
423
+
424
+ # Set Headers
425
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
426
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
427
+ path_template = 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/usageDetails'
428
+
429
+ request_url = @base_url || @client.base_url
430
+
431
+ options = {
432
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
433
+ path_params: {'billingAccountId' => billing_account_id},
434
+ query_params: {'$expand' => expand,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version,'$apply' => apply},
435
+ headers: request_headers.merge(custom_headers || {}),
436
+ base_url: request_url
437
+ }
438
+ promise = @client.make_request_async(:get, path_template, options)
439
+
440
+ promise = promise.then do |result|
441
+ http_response = result.response
442
+ status_code = http_response.status
443
+ response_content = http_response.body
444
+ unless status_code == 200
445
+ error_model = JSON.load(response_content)
446
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
447
+ end
448
+
449
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
450
+ # Deserialize Response
451
+ if status_code == 200
452
+ begin
453
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
454
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
455
+ result.body = @client.deserialize(result_mapper, parsed_response)
456
+ rescue Exception => e
457
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
458
+ end
459
+ end
460
+
461
+ result
462
+ end
463
+
464
+ promise.execute
465
+ end
466
+
467
+ #
468
+ # Lists the usage details based on billingAccountId for a scope by billing
469
+ # period. Usage details are available via this API only for May 1, 2014 or
470
+ # later.
471
+ #
472
+ # @param billing_account_id [String] BillingAccount ID
473
+ # @param billing_period_name [String] Billing Period Name.
474
+ # @param expand [String] May be used to expand the
475
+ # properties/additionalProperties or properties/meterDetails within a list of
476
+ # usage details. By default, these fields are not included when listing usage
477
+ # details.
478
+ # @param filter [String] May be used to filter usageDetails by
479
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
480
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
481
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
482
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
483
+ # where key and value is separated by a colon (:).
484
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
485
+ # returned a partial result. If a previous response contains a nextLink
486
+ # element, the value of the nextLink element will include a skiptoken parameter
487
+ # that specifies a starting point to use for subsequent calls.
488
+ # @param top [Integer] May be used to limit the number of results to the most
489
+ # recent N usageDetails.
490
+ # @param query_options [QueryOptions] Additional parameters for the operation
491
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
492
+ # will be added to the HTTP request.
493
+ #
494
+ # @return [Array<UsageDetail>] operation results.
495
+ #
496
+ def list_for_billing_period_by_billing_account(billing_account_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
497
+ first_page = list_for_billing_period_by_billing_account_as_lazy(billing_account_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers)
498
+ first_page.get_all_items
499
+ end
500
+
501
+ #
502
+ # Lists the usage details based on billingAccountId for a scope by billing
503
+ # period. Usage details are available via this API only for May 1, 2014 or
504
+ # later.
505
+ #
506
+ # @param billing_account_id [String] BillingAccount ID
507
+ # @param billing_period_name [String] Billing Period Name.
508
+ # @param expand [String] May be used to expand the
509
+ # properties/additionalProperties or properties/meterDetails within a list of
510
+ # usage details. By default, these fields are not included when listing usage
511
+ # details.
512
+ # @param filter [String] May be used to filter usageDetails by
513
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
514
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
515
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
516
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
517
+ # where key and value is separated by a colon (:).
518
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
519
+ # returned a partial result. If a previous response contains a nextLink
520
+ # element, the value of the nextLink element will include a skiptoken parameter
521
+ # that specifies a starting point to use for subsequent calls.
522
+ # @param top [Integer] May be used to limit the number of results to the most
523
+ # recent N usageDetails.
524
+ # @param query_options [QueryOptions] Additional parameters for the operation
525
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
526
+ # will be added to the HTTP request.
527
+ #
528
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
529
+ #
530
+ def list_for_billing_period_by_billing_account_with_http_info(billing_account_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
531
+ list_for_billing_period_by_billing_account_async(billing_account_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
532
+ end
533
+
534
+ #
535
+ # Lists the usage details based on billingAccountId for a scope by billing
536
+ # period. Usage details are available via this API only for May 1, 2014 or
537
+ # later.
538
+ #
539
+ # @param billing_account_id [String] BillingAccount ID
540
+ # @param billing_period_name [String] Billing Period Name.
541
+ # @param expand [String] May be used to expand the
542
+ # properties/additionalProperties or properties/meterDetails within a list of
543
+ # usage details. By default, these fields are not included when listing usage
544
+ # details.
545
+ # @param filter [String] May be used to filter usageDetails by
546
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
547
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
548
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
549
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
550
+ # where key and value is separated by a colon (:).
551
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
552
+ # returned a partial result. If a previous response contains a nextLink
553
+ # element, the value of the nextLink element will include a skiptoken parameter
554
+ # that specifies a starting point to use for subsequent calls.
555
+ # @param top [Integer] May be used to limit the number of results to the most
556
+ # recent N usageDetails.
557
+ # @param query_options [QueryOptions] Additional parameters for the operation
558
+ # @param [Hash{String => String}] A hash of custom headers that will be added
559
+ # to the HTTP request.
560
+ #
561
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
562
+ #
563
+ def list_for_billing_period_by_billing_account_async(billing_account_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
564
+ fail ArgumentError, 'billing_account_id is nil' if billing_account_id.nil?
565
+ fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
566
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
567
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
568
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
569
+
570
+ apply = nil
571
+ unless query_options.nil?
572
+ apply = query_options.Apply
573
+ end
574
+
575
+ request_headers = {}
576
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
577
+
578
+ # Set Headers
579
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
580
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
581
+ path_template = 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'
582
+
583
+ request_url = @base_url || @client.base_url
584
+
585
+ options = {
586
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
587
+ path_params: {'billingAccountId' => billing_account_id,'billingPeriodName' => billing_period_name},
588
+ query_params: {'$expand' => expand,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version,'$apply' => apply},
589
+ headers: request_headers.merge(custom_headers || {}),
590
+ base_url: request_url
591
+ }
592
+ promise = @client.make_request_async(:get, path_template, options)
593
+
594
+ promise = promise.then do |result|
595
+ http_response = result.response
596
+ status_code = http_response.status
597
+ response_content = http_response.body
598
+ unless status_code == 200
599
+ error_model = JSON.load(response_content)
600
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
601
+ end
602
+
603
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
604
+ # Deserialize Response
605
+ if status_code == 200
606
+ begin
607
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
608
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
609
+ result.body = @client.deserialize(result_mapper, parsed_response)
610
+ rescue Exception => e
611
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
612
+ end
613
+ end
614
+
615
+ result
616
+ end
617
+
618
+ promise.execute
619
+ end
620
+
621
+ #
622
+ # Lists the usage details by departmentId for a scope by current billing
623
+ # period. Usage details are available via this API only for May 1, 2014 or
624
+ # later.
625
+ #
626
+ # @param department_id [String] Department ID
627
+ # @param expand [String] May be used to expand the
628
+ # properties/additionalProperties or properties/meterDetails within a list of
629
+ # usage details. By default, these fields are not included when listing usage
630
+ # details.
631
+ # @param filter [String] May be used to filter usageDetails by
632
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
633
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
634
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
635
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
636
+ # string where key and value is separated by a colon (:).
637
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
638
+ # returned a partial result. If a previous response contains a nextLink
639
+ # element, the value of the nextLink element will include a skiptoken parameter
640
+ # that specifies a starting point to use for subsequent calls.
641
+ # @param top [Integer] May be used to limit the number of results to the most
642
+ # recent N usageDetails.
643
+ # @param query_options [QueryOptions] Additional parameters for the operation
644
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
645
+ # will be added to the HTTP request.
646
+ #
647
+ # @return [Array<UsageDetail>] operation results.
648
+ #
649
+ def list_by_department(department_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
650
+ first_page = list_by_department_as_lazy(department_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers)
651
+ first_page.get_all_items
652
+ end
653
+
654
+ #
655
+ # Lists the usage details by departmentId for a scope by current billing
656
+ # period. Usage details are available via this API only for May 1, 2014 or
657
+ # later.
658
+ #
659
+ # @param department_id [String] Department ID
660
+ # @param expand [String] May be used to expand the
661
+ # properties/additionalProperties or properties/meterDetails within a list of
662
+ # usage details. By default, these fields are not included when listing usage
663
+ # details.
664
+ # @param filter [String] May be used to filter usageDetails by
665
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
666
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
667
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
668
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
669
+ # string where key and value is separated by a colon (:).
670
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
671
+ # returned a partial result. If a previous response contains a nextLink
672
+ # element, the value of the nextLink element will include a skiptoken parameter
673
+ # that specifies a starting point to use for subsequent calls.
674
+ # @param top [Integer] May be used to limit the number of results to the most
675
+ # recent N usageDetails.
676
+ # @param query_options [QueryOptions] Additional parameters for the operation
677
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
678
+ # will be added to the HTTP request.
679
+ #
680
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
681
+ #
682
+ def list_by_department_with_http_info(department_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
683
+ list_by_department_async(department_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
684
+ end
685
+
686
+ #
687
+ # Lists the usage details by departmentId for a scope by current billing
688
+ # period. Usage details are available via this API only for May 1, 2014 or
689
+ # later.
690
+ #
691
+ # @param department_id [String] Department ID
692
+ # @param expand [String] May be used to expand the
693
+ # properties/additionalProperties or properties/meterDetails within a list of
694
+ # usage details. By default, these fields are not included when listing usage
695
+ # details.
696
+ # @param filter [String] May be used to filter usageDetails by
697
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
698
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
699
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
700
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
701
+ # string where key and value is separated by a colon (:).
702
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
703
+ # returned a partial result. If a previous response contains a nextLink
704
+ # element, the value of the nextLink element will include a skiptoken parameter
705
+ # that specifies a starting point to use for subsequent calls.
706
+ # @param top [Integer] May be used to limit the number of results to the most
707
+ # recent N usageDetails.
708
+ # @param query_options [QueryOptions] Additional parameters for the operation
709
+ # @param [Hash{String => String}] A hash of custom headers that will be added
710
+ # to the HTTP request.
711
+ #
712
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
713
+ #
714
+ def list_by_department_async(department_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
715
+ fail ArgumentError, 'department_id is nil' if department_id.nil?
716
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
717
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
718
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
719
+
720
+ apply = nil
721
+ unless query_options.nil?
722
+ apply = query_options.Apply
723
+ end
724
+
725
+ request_headers = {}
726
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
727
+
728
+ # Set Headers
729
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
730
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
731
+ path_template = 'providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Consumption/usageDetails'
732
+
733
+ request_url = @base_url || @client.base_url
734
+
735
+ options = {
736
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
737
+ path_params: {'departmentId' => department_id},
738
+ query_params: {'$expand' => expand,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version,'$apply' => apply},
739
+ headers: request_headers.merge(custom_headers || {}),
740
+ base_url: request_url
741
+ }
742
+ promise = @client.make_request_async(:get, path_template, options)
743
+
744
+ promise = promise.then do |result|
745
+ http_response = result.response
746
+ status_code = http_response.status
747
+ response_content = http_response.body
748
+ unless status_code == 200
749
+ error_model = JSON.load(response_content)
750
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
751
+ end
752
+
753
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
754
+ # Deserialize Response
755
+ if status_code == 200
756
+ begin
757
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
758
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
759
+ result.body = @client.deserialize(result_mapper, parsed_response)
760
+ rescue Exception => e
761
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
762
+ end
763
+ end
764
+
765
+ result
766
+ end
767
+
768
+ promise.execute
769
+ end
770
+
771
+ #
772
+ # Lists the usage details based on departmentId for a scope by billing period.
773
+ # Usage details are available via this API only for May 1, 2014 or later.
774
+ #
775
+ # @param department_id [String] Department ID
776
+ # @param billing_period_name [String] Billing Period Name.
777
+ # @param expand [String] May be used to expand the
778
+ # properties/additionalProperties or properties/meterDetails within a list of
779
+ # usage details. By default, these fields are not included when listing usage
780
+ # details.
781
+ # @param filter [String] May be used to filter usageDetails by
782
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
783
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
784
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
785
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
786
+ # where key and value is separated by a colon (:).
787
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
788
+ # returned a partial result. If a previous response contains a nextLink
789
+ # element, the value of the nextLink element will include a skiptoken parameter
790
+ # that specifies a starting point to use for subsequent calls.
791
+ # @param top [Integer] May be used to limit the number of results to the most
792
+ # recent N usageDetails.
793
+ # @param query_options [QueryOptions] Additional parameters for the operation
794
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
795
+ # will be added to the HTTP request.
796
+ #
797
+ # @return [Array<UsageDetail>] operation results.
798
+ #
799
+ def list_for_billing_period_by_department(department_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
800
+ first_page = list_for_billing_period_by_department_as_lazy(department_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers)
801
+ first_page.get_all_items
802
+ end
803
+
804
+ #
805
+ # Lists the usage details based on departmentId for a scope by billing period.
806
+ # Usage details are available via this API only for May 1, 2014 or later.
807
+ #
808
+ # @param department_id [String] Department ID
809
+ # @param billing_period_name [String] Billing Period Name.
810
+ # @param expand [String] May be used to expand the
811
+ # properties/additionalProperties or properties/meterDetails within a list of
812
+ # usage details. By default, these fields are not included when listing usage
813
+ # details.
814
+ # @param filter [String] May be used to filter usageDetails by
815
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
816
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
817
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
818
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
819
+ # where key and value is separated by a colon (:).
820
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
821
+ # returned a partial result. If a previous response contains a nextLink
822
+ # element, the value of the nextLink element will include a skiptoken parameter
823
+ # that specifies a starting point to use for subsequent calls.
824
+ # @param top [Integer] May be used to limit the number of results to the most
825
+ # recent N usageDetails.
826
+ # @param query_options [QueryOptions] Additional parameters for the operation
827
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
828
+ # will be added to the HTTP request.
829
+ #
830
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
831
+ #
832
+ def list_for_billing_period_by_department_with_http_info(department_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
833
+ list_for_billing_period_by_department_async(department_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
834
+ end
835
+
836
+ #
837
+ # Lists the usage details based on departmentId for a scope by billing period.
838
+ # Usage details are available via this API only for May 1, 2014 or later.
839
+ #
840
+ # @param department_id [String] Department ID
841
+ # @param billing_period_name [String] Billing Period Name.
842
+ # @param expand [String] May be used to expand the
843
+ # properties/additionalProperties or properties/meterDetails within a list of
844
+ # usage details. By default, these fields are not included when listing usage
845
+ # details.
846
+ # @param filter [String] May be used to filter usageDetails by
847
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
848
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
849
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
850
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
851
+ # where key and value is separated by a colon (:).
852
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
853
+ # returned a partial result. If a previous response contains a nextLink
854
+ # element, the value of the nextLink element will include a skiptoken parameter
855
+ # that specifies a starting point to use for subsequent calls.
856
+ # @param top [Integer] May be used to limit the number of results to the most
857
+ # recent N usageDetails.
858
+ # @param query_options [QueryOptions] Additional parameters for the operation
859
+ # @param [Hash{String => String}] A hash of custom headers that will be added
860
+ # to the HTTP request.
861
+ #
862
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
863
+ #
864
+ def list_for_billing_period_by_department_async(department_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
865
+ fail ArgumentError, 'department_id is nil' if department_id.nil?
866
+ fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
867
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
868
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
869
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
870
+
871
+ apply = nil
872
+ unless query_options.nil?
873
+ apply = query_options.Apply
874
+ end
875
+
876
+ request_headers = {}
877
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
878
+
879
+ # Set Headers
880
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
881
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
882
+ path_template = 'providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'
883
+
884
+ request_url = @base_url || @client.base_url
885
+
886
+ options = {
887
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
888
+ path_params: {'departmentId' => department_id,'billingPeriodName' => billing_period_name},
889
+ query_params: {'$expand' => expand,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version,'$apply' => apply},
890
+ headers: request_headers.merge(custom_headers || {}),
891
+ base_url: request_url
892
+ }
893
+ promise = @client.make_request_async(:get, path_template, options)
894
+
895
+ promise = promise.then do |result|
896
+ http_response = result.response
897
+ status_code = http_response.status
898
+ response_content = http_response.body
899
+ unless status_code == 200
900
+ error_model = JSON.load(response_content)
901
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
902
+ end
903
+
904
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
905
+ # Deserialize Response
906
+ if status_code == 200
907
+ begin
908
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
909
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
910
+ result.body = @client.deserialize(result_mapper, parsed_response)
911
+ rescue Exception => e
912
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
913
+ end
914
+ end
915
+
916
+ result
917
+ end
918
+
919
+ promise.execute
920
+ end
921
+
922
+ #
923
+ # Lists the usage details by enrollmentAccountId for a scope by current billing
924
+ # period. Usage details are available via this API only for May 1, 2014 or
925
+ # later.
926
+ #
927
+ # @param enrollment_account_id [String] EnrollmentAccount ID
928
+ # @param expand [String] May be used to expand the
929
+ # properties/additionalProperties or properties/meterDetails within a list of
930
+ # usage details. By default, these fields are not included when listing usage
931
+ # details.
932
+ # @param filter [String] May be used to filter usageDetails by
933
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
934
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
935
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
936
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
937
+ # string where key and value is separated by a colon (:).
938
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
939
+ # returned a partial result. If a previous response contains a nextLink
940
+ # element, the value of the nextLink element will include a skiptoken parameter
941
+ # that specifies a starting point to use for subsequent calls.
942
+ # @param top [Integer] May be used to limit the number of results to the most
943
+ # recent N usageDetails.
944
+ # @param query_options [QueryOptions] Additional parameters for the operation
945
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
946
+ # will be added to the HTTP request.
947
+ #
948
+ # @return [Array<UsageDetail>] operation results.
949
+ #
950
+ def list_by_enrollment_account(enrollment_account_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
951
+ first_page = list_by_enrollment_account_as_lazy(enrollment_account_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers)
952
+ first_page.get_all_items
953
+ end
954
+
955
+ #
956
+ # Lists the usage details by enrollmentAccountId for a scope by current billing
957
+ # period. Usage details are available via this API only for May 1, 2014 or
958
+ # later.
959
+ #
960
+ # @param enrollment_account_id [String] EnrollmentAccount ID
961
+ # @param expand [String] May be used to expand the
962
+ # properties/additionalProperties or properties/meterDetails within a list of
963
+ # usage details. By default, these fields are not included when listing usage
964
+ # details.
965
+ # @param filter [String] May be used to filter usageDetails by
966
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
967
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
968
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
969
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
970
+ # string where key and value is separated by a colon (:).
971
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
972
+ # returned a partial result. If a previous response contains a nextLink
973
+ # element, the value of the nextLink element will include a skiptoken parameter
974
+ # that specifies a starting point to use for subsequent calls.
975
+ # @param top [Integer] May be used to limit the number of results to the most
976
+ # recent N usageDetails.
977
+ # @param query_options [QueryOptions] Additional parameters for the operation
978
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
979
+ # will be added to the HTTP request.
980
+ #
981
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
982
+ #
983
+ def list_by_enrollment_account_with_http_info(enrollment_account_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
984
+ list_by_enrollment_account_async(enrollment_account_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
985
+ end
986
+
987
+ #
988
+ # Lists the usage details by enrollmentAccountId for a scope by current billing
989
+ # period. Usage details are available via this API only for May 1, 2014 or
990
+ # later.
991
+ #
992
+ # @param enrollment_account_id [String] EnrollmentAccount ID
993
+ # @param expand [String] May be used to expand the
994
+ # properties/additionalProperties or properties/meterDetails within a list of
995
+ # usage details. By default, these fields are not included when listing usage
996
+ # details.
997
+ # @param filter [String] May be used to filter usageDetails by
998
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
999
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
1000
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
1001
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
1002
+ # string where key and value is separated by a colon (:).
1003
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
1004
+ # returned a partial result. If a previous response contains a nextLink
1005
+ # element, the value of the nextLink element will include a skiptoken parameter
1006
+ # that specifies a starting point to use for subsequent calls.
1007
+ # @param top [Integer] May be used to limit the number of results to the most
1008
+ # recent N usageDetails.
1009
+ # @param query_options [QueryOptions] Additional parameters for the operation
1010
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1011
+ # to the HTTP request.
1012
+ #
1013
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1014
+ #
1015
+ def list_by_enrollment_account_async(enrollment_account_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
1016
+ fail ArgumentError, 'enrollment_account_id is nil' if enrollment_account_id.nil?
1017
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
1018
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
1019
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1020
+
1021
+ apply = nil
1022
+ unless query_options.nil?
1023
+ apply = query_options.Apply
1024
+ end
1025
+
1026
+ request_headers = {}
1027
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1028
+
1029
+ # Set Headers
1030
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1031
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1032
+ path_template = 'providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Consumption/usageDetails'
1033
+
1034
+ request_url = @base_url || @client.base_url
1035
+
1036
+ options = {
1037
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1038
+ path_params: {'enrollmentAccountId' => enrollment_account_id},
1039
+ query_params: {'$expand' => expand,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version,'$apply' => apply},
1040
+ headers: request_headers.merge(custom_headers || {}),
1041
+ base_url: request_url
1042
+ }
1043
+ promise = @client.make_request_async(:get, path_template, options)
1044
+
1045
+ promise = promise.then do |result|
1046
+ http_response = result.response
1047
+ status_code = http_response.status
1048
+ response_content = http_response.body
1049
+ unless status_code == 200
1050
+ error_model = JSON.load(response_content)
1051
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1052
+ end
1053
+
1054
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1055
+ # Deserialize Response
1056
+ if status_code == 200
1057
+ begin
1058
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1059
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
1060
+ result.body = @client.deserialize(result_mapper, parsed_response)
1061
+ rescue Exception => e
1062
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1063
+ end
1064
+ end
1065
+
1066
+ result
1067
+ end
1068
+
1069
+ promise.execute
1070
+ end
1071
+
1072
+ #
1073
+ # Lists the usage details based on enrollmentAccountId for a scope by billing
1074
+ # period. Usage details are available via this API only for May 1, 2014 or
1075
+ # later.
1076
+ #
1077
+ # @param enrollment_account_id [String] EnrollmentAccount ID
1078
+ # @param billing_period_name [String] Billing Period Name.
1079
+ # @param expand [String] May be used to expand the
1080
+ # properties/additionalProperties or properties/meterDetails within a list of
1081
+ # usage details. By default, these fields are not included when listing usage
1082
+ # details.
1083
+ # @param filter [String] May be used to filter usageDetails by
1084
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
1085
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
1086
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
1087
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
1088
+ # where key and value is separated by a colon (:).
1089
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
1090
+ # returned a partial result. If a previous response contains a nextLink
1091
+ # element, the value of the nextLink element will include a skiptoken parameter
1092
+ # that specifies a starting point to use for subsequent calls.
1093
+ # @param top [Integer] May be used to limit the number of results to the most
1094
+ # recent N usageDetails.
1095
+ # @param query_options [QueryOptions] Additional parameters for the operation
1096
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1097
+ # will be added to the HTTP request.
1098
+ #
1099
+ # @return [Array<UsageDetail>] operation results.
1100
+ #
1101
+ def list_for_billing_period_by_enrollment_account(enrollment_account_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
1102
+ first_page = list_for_billing_period_by_enrollment_account_as_lazy(enrollment_account_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers)
1103
+ first_page.get_all_items
1104
+ end
1105
+
1106
+ #
1107
+ # Lists the usage details based on enrollmentAccountId for a scope by billing
1108
+ # period. Usage details are available via this API only for May 1, 2014 or
1109
+ # later.
1110
+ #
1111
+ # @param enrollment_account_id [String] EnrollmentAccount ID
1112
+ # @param billing_period_name [String] Billing Period Name.
1113
+ # @param expand [String] May be used to expand the
1114
+ # properties/additionalProperties or properties/meterDetails within a list of
1115
+ # usage details. By default, these fields are not included when listing usage
1116
+ # details.
1117
+ # @param filter [String] May be used to filter usageDetails by
1118
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
1119
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
1120
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
1121
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
1122
+ # where key and value is separated by a colon (:).
1123
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
1124
+ # returned a partial result. If a previous response contains a nextLink
1125
+ # element, the value of the nextLink element will include a skiptoken parameter
1126
+ # that specifies a starting point to use for subsequent calls.
1127
+ # @param top [Integer] May be used to limit the number of results to the most
1128
+ # recent N usageDetails.
1129
+ # @param query_options [QueryOptions] Additional parameters for the operation
1130
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1131
+ # will be added to the HTTP request.
1132
+ #
1133
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1134
+ #
1135
+ def list_for_billing_period_by_enrollment_account_with_http_info(enrollment_account_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
1136
+ list_for_billing_period_by_enrollment_account_async(enrollment_account_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
1137
+ end
1138
+
1139
+ #
1140
+ # Lists the usage details based on enrollmentAccountId for a scope by billing
1141
+ # period. Usage details are available via this API only for May 1, 2014 or
1142
+ # later.
1143
+ #
1144
+ # @param enrollment_account_id [String] EnrollmentAccount ID
1145
+ # @param billing_period_name [String] Billing Period Name.
1146
+ # @param expand [String] May be used to expand the
1147
+ # properties/additionalProperties or properties/meterDetails within a list of
1148
+ # usage details. By default, these fields are not included when listing usage
1149
+ # details.
1150
+ # @param filter [String] May be used to filter usageDetails by
1151
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
1152
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
1153
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
1154
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
1155
+ # where key and value is separated by a colon (:).
1156
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
1157
+ # returned a partial result. If a previous response contains a nextLink
1158
+ # element, the value of the nextLink element will include a skiptoken parameter
1159
+ # that specifies a starting point to use for subsequent calls.
1160
+ # @param top [Integer] May be used to limit the number of results to the most
1161
+ # recent N usageDetails.
1162
+ # @param query_options [QueryOptions] Additional parameters for the operation
1163
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1164
+ # to the HTTP request.
1165
+ #
1166
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1167
+ #
1168
+ def list_for_billing_period_by_enrollment_account_async(enrollment_account_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
1169
+ fail ArgumentError, 'enrollment_account_id is nil' if enrollment_account_id.nil?
1170
+ fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
1171
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
1172
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
1173
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1174
+
1175
+ apply = nil
1176
+ unless query_options.nil?
1177
+ apply = query_options.Apply
1178
+ end
1179
+
1180
+ request_headers = {}
1181
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1182
+
1183
+ # Set Headers
1184
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1185
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1186
+ path_template = 'providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'
1187
+
1188
+ request_url = @base_url || @client.base_url
1189
+
1190
+ options = {
1191
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1192
+ path_params: {'enrollmentAccountId' => enrollment_account_id,'billingPeriodName' => billing_period_name},
1193
+ query_params: {'$expand' => expand,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version,'$apply' => apply},
1194
+ headers: request_headers.merge(custom_headers || {}),
1195
+ base_url: request_url
1196
+ }
1197
+ promise = @client.make_request_async(:get, path_template, options)
1198
+
1199
+ promise = promise.then do |result|
1200
+ http_response = result.response
1201
+ status_code = http_response.status
1202
+ response_content = http_response.body
1203
+ unless status_code == 200
1204
+ error_model = JSON.load(response_content)
1205
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1206
+ end
1207
+
1208
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1209
+ # Deserialize Response
1210
+ if status_code == 200
1211
+ begin
1212
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1213
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
1214
+ result.body = @client.deserialize(result_mapper, parsed_response)
1215
+ rescue Exception => e
1216
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1217
+ end
1218
+ end
1219
+
1220
+ result
1221
+ end
1222
+
1223
+ promise.execute
1224
+ end
1225
+
1226
+ #
1227
+ # Lists the usage details for a scope by current billing period. Usage details
1228
+ # are available via this API only for May 1, 2014 or later.
1229
+ #
1230
+ # @param next_page_link [String] The NextLink from the previous successful call
1231
+ # to List operation.
1232
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1233
+ # will be added to the HTTP request.
1234
+ #
1235
+ # @return [UsageDetailsListResult] operation results.
1236
+ #
1237
+ def list_next(next_page_link, custom_headers:nil)
1238
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
1239
+ response.body unless response.nil?
1240
+ end
1241
+
1242
+ #
1243
+ # Lists the usage details for a scope by current billing period. Usage details
1244
+ # are available via this API only for May 1, 2014 or later.
1245
+ #
1246
+ # @param next_page_link [String] The NextLink from the previous successful call
1247
+ # to List operation.
1248
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1249
+ # will be added to the HTTP request.
1250
+ #
1251
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1252
+ #
1253
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
1254
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
1255
+ end
1256
+
1257
+ #
1258
+ # Lists the usage details for a scope by current billing period. Usage details
1259
+ # are available via this API only for May 1, 2014 or later.
1260
+ #
1261
+ # @param next_page_link [String] The NextLink from the previous successful call
1262
+ # to List operation.
1263
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1264
+ # to the HTTP request.
1265
+ #
1266
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1267
+ #
1268
+ def list_next_async(next_page_link, custom_headers:nil)
1269
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1270
+
1271
+
1272
+ request_headers = {}
1273
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1274
+
1275
+ # Set Headers
1276
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1277
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1278
+ path_template = '{nextLink}'
1279
+
1280
+ request_url = @base_url || @client.base_url
1281
+
1282
+ options = {
1283
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1284
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1285
+ headers: request_headers.merge(custom_headers || {}),
1286
+ base_url: request_url
1287
+ }
1288
+ promise = @client.make_request_async(:get, path_template, options)
1289
+
1290
+ promise = promise.then do |result|
1291
+ http_response = result.response
1292
+ status_code = http_response.status
1293
+ response_content = http_response.body
1294
+ unless status_code == 200
1295
+ error_model = JSON.load(response_content)
1296
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1297
+ end
1298
+
1299
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1300
+ # Deserialize Response
1301
+ if status_code == 200
1302
+ begin
1303
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1304
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
1305
+ result.body = @client.deserialize(result_mapper, parsed_response)
1306
+ rescue Exception => e
1307
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1308
+ end
1309
+ end
1310
+
1311
+ result
1312
+ end
1313
+
1314
+ promise.execute
1315
+ end
1316
+
1317
+ #
1318
+ # Lists the usage details for a scope by billing period. Usage details are
1319
+ # available via this API only for May 1, 2014 or later.
1320
+ #
1321
+ # @param next_page_link [String] The NextLink from the previous successful call
1322
+ # to List operation.
1323
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1324
+ # will be added to the HTTP request.
1325
+ #
1326
+ # @return [UsageDetailsListResult] operation results.
1327
+ #
1328
+ def list_by_billing_period_next(next_page_link, custom_headers:nil)
1329
+ response = list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers).value!
1330
+ response.body unless response.nil?
1331
+ end
1332
+
1333
+ #
1334
+ # Lists the usage details for a scope by billing period. Usage details are
1335
+ # available via this API only for May 1, 2014 or later.
1336
+ #
1337
+ # @param next_page_link [String] The NextLink from the previous successful call
1338
+ # to List operation.
1339
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1340
+ # will be added to the HTTP request.
1341
+ #
1342
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1343
+ #
1344
+ def list_by_billing_period_next_with_http_info(next_page_link, custom_headers:nil)
1345
+ list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers).value!
1346
+ end
1347
+
1348
+ #
1349
+ # Lists the usage details for a scope by billing period. Usage details are
1350
+ # available via this API only for May 1, 2014 or later.
1351
+ #
1352
+ # @param next_page_link [String] The NextLink from the previous successful call
1353
+ # to List operation.
1354
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1355
+ # to the HTTP request.
1356
+ #
1357
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1358
+ #
1359
+ def list_by_billing_period_next_async(next_page_link, custom_headers:nil)
1360
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1361
+
1362
+
1363
+ request_headers = {}
1364
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1365
+
1366
+ # Set Headers
1367
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1368
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1369
+ path_template = '{nextLink}'
1370
+
1371
+ request_url = @base_url || @client.base_url
1372
+
1373
+ options = {
1374
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1375
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1376
+ headers: request_headers.merge(custom_headers || {}),
1377
+ base_url: request_url
1378
+ }
1379
+ promise = @client.make_request_async(:get, path_template, options)
1380
+
1381
+ promise = promise.then do |result|
1382
+ http_response = result.response
1383
+ status_code = http_response.status
1384
+ response_content = http_response.body
1385
+ unless status_code == 200
1386
+ error_model = JSON.load(response_content)
1387
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1388
+ end
1389
+
1390
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1391
+ # Deserialize Response
1392
+ if status_code == 200
1393
+ begin
1394
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1395
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
1396
+ result.body = @client.deserialize(result_mapper, parsed_response)
1397
+ rescue Exception => e
1398
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1399
+ end
1400
+ end
1401
+
1402
+ result
1403
+ end
1404
+
1405
+ promise.execute
1406
+ end
1407
+
1408
+ #
1409
+ # Lists the usage details by billingAccountId for a scope by current billing
1410
+ # period. Usage details are available via this API only for May 1, 2014 or
1411
+ # later.
1412
+ #
1413
+ # @param next_page_link [String] The NextLink from the previous successful call
1414
+ # to List operation.
1415
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1416
+ # will be added to the HTTP request.
1417
+ #
1418
+ # @return [UsageDetailsListResult] operation results.
1419
+ #
1420
+ def list_by_billing_account_next(next_page_link, custom_headers:nil)
1421
+ response = list_by_billing_account_next_async(next_page_link, custom_headers:custom_headers).value!
1422
+ response.body unless response.nil?
1423
+ end
1424
+
1425
+ #
1426
+ # Lists the usage details by billingAccountId for a scope by current billing
1427
+ # period. Usage details are available via this API only for May 1, 2014 or
1428
+ # later.
1429
+ #
1430
+ # @param next_page_link [String] The NextLink from the previous successful call
1431
+ # to List operation.
1432
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1433
+ # will be added to the HTTP request.
1434
+ #
1435
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1436
+ #
1437
+ def list_by_billing_account_next_with_http_info(next_page_link, custom_headers:nil)
1438
+ list_by_billing_account_next_async(next_page_link, custom_headers:custom_headers).value!
1439
+ end
1440
+
1441
+ #
1442
+ # Lists the usage details by billingAccountId for a scope by current billing
1443
+ # period. Usage details are available via this API only for May 1, 2014 or
1444
+ # later.
1445
+ #
1446
+ # @param next_page_link [String] The NextLink from the previous successful call
1447
+ # to List operation.
1448
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1449
+ # to the HTTP request.
1450
+ #
1451
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1452
+ #
1453
+ def list_by_billing_account_next_async(next_page_link, custom_headers:nil)
1454
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1455
+
1456
+
1457
+ request_headers = {}
1458
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1459
+
1460
+ # Set Headers
1461
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1462
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1463
+ path_template = '{nextLink}'
1464
+
1465
+ request_url = @base_url || @client.base_url
1466
+
1467
+ options = {
1468
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1469
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1470
+ headers: request_headers.merge(custom_headers || {}),
1471
+ base_url: request_url
1472
+ }
1473
+ promise = @client.make_request_async(:get, path_template, options)
1474
+
1475
+ promise = promise.then do |result|
1476
+ http_response = result.response
1477
+ status_code = http_response.status
1478
+ response_content = http_response.body
1479
+ unless status_code == 200
1480
+ error_model = JSON.load(response_content)
1481
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1482
+ end
1483
+
1484
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1485
+ # Deserialize Response
1486
+ if status_code == 200
1487
+ begin
1488
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1489
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
1490
+ result.body = @client.deserialize(result_mapper, parsed_response)
1491
+ rescue Exception => e
1492
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1493
+ end
1494
+ end
1495
+
1496
+ result
1497
+ end
1498
+
1499
+ promise.execute
1500
+ end
1501
+
1502
+ #
1503
+ # Lists the usage details based on billingAccountId for a scope by billing
1504
+ # period. Usage details are available via this API only for May 1, 2014 or
1505
+ # later.
1506
+ #
1507
+ # @param next_page_link [String] The NextLink from the previous successful call
1508
+ # to List operation.
1509
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1510
+ # will be added to the HTTP request.
1511
+ #
1512
+ # @return [UsageDetailsListResult] operation results.
1513
+ #
1514
+ def list_for_billing_period_by_billing_account_next(next_page_link, custom_headers:nil)
1515
+ response = list_for_billing_period_by_billing_account_next_async(next_page_link, custom_headers:custom_headers).value!
1516
+ response.body unless response.nil?
1517
+ end
1518
+
1519
+ #
1520
+ # Lists the usage details based on billingAccountId for a scope by billing
1521
+ # period. Usage details are available via this API only for May 1, 2014 or
1522
+ # later.
1523
+ #
1524
+ # @param next_page_link [String] The NextLink from the previous successful call
1525
+ # to List operation.
1526
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1527
+ # will be added to the HTTP request.
1528
+ #
1529
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1530
+ #
1531
+ def list_for_billing_period_by_billing_account_next_with_http_info(next_page_link, custom_headers:nil)
1532
+ list_for_billing_period_by_billing_account_next_async(next_page_link, custom_headers:custom_headers).value!
1533
+ end
1534
+
1535
+ #
1536
+ # Lists the usage details based on billingAccountId for a scope by billing
1537
+ # period. Usage details are available via this API only for May 1, 2014 or
1538
+ # later.
1539
+ #
1540
+ # @param next_page_link [String] The NextLink from the previous successful call
1541
+ # to List operation.
1542
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1543
+ # to the HTTP request.
1544
+ #
1545
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1546
+ #
1547
+ def list_for_billing_period_by_billing_account_next_async(next_page_link, custom_headers:nil)
1548
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1549
+
1550
+
1551
+ request_headers = {}
1552
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1553
+
1554
+ # Set Headers
1555
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1556
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1557
+ path_template = '{nextLink}'
1558
+
1559
+ request_url = @base_url || @client.base_url
1560
+
1561
+ options = {
1562
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1563
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1564
+ headers: request_headers.merge(custom_headers || {}),
1565
+ base_url: request_url
1566
+ }
1567
+ promise = @client.make_request_async(:get, path_template, options)
1568
+
1569
+ promise = promise.then do |result|
1570
+ http_response = result.response
1571
+ status_code = http_response.status
1572
+ response_content = http_response.body
1573
+ unless status_code == 200
1574
+ error_model = JSON.load(response_content)
1575
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1576
+ end
1577
+
1578
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1579
+ # Deserialize Response
1580
+ if status_code == 200
1581
+ begin
1582
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1583
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
1584
+ result.body = @client.deserialize(result_mapper, parsed_response)
1585
+ rescue Exception => e
1586
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1587
+ end
1588
+ end
1589
+
1590
+ result
1591
+ end
1592
+
1593
+ promise.execute
1594
+ end
1595
+
1596
+ #
1597
+ # Lists the usage details by departmentId for a scope by current billing
1598
+ # period. Usage details are available via this API only for May 1, 2014 or
1599
+ # later.
1600
+ #
1601
+ # @param next_page_link [String] The NextLink from the previous successful call
1602
+ # to List operation.
1603
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1604
+ # will be added to the HTTP request.
1605
+ #
1606
+ # @return [UsageDetailsListResult] operation results.
1607
+ #
1608
+ def list_by_department_next(next_page_link, custom_headers:nil)
1609
+ response = list_by_department_next_async(next_page_link, custom_headers:custom_headers).value!
1610
+ response.body unless response.nil?
1611
+ end
1612
+
1613
+ #
1614
+ # Lists the usage details by departmentId for a scope by current billing
1615
+ # period. Usage details are available via this API only for May 1, 2014 or
1616
+ # later.
1617
+ #
1618
+ # @param next_page_link [String] The NextLink from the previous successful call
1619
+ # to List operation.
1620
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1621
+ # will be added to the HTTP request.
1622
+ #
1623
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1624
+ #
1625
+ def list_by_department_next_with_http_info(next_page_link, custom_headers:nil)
1626
+ list_by_department_next_async(next_page_link, custom_headers:custom_headers).value!
1627
+ end
1628
+
1629
+ #
1630
+ # Lists the usage details by departmentId for a scope by current billing
1631
+ # period. Usage details are available via this API only for May 1, 2014 or
1632
+ # later.
1633
+ #
1634
+ # @param next_page_link [String] The NextLink from the previous successful call
1635
+ # to List operation.
1636
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1637
+ # to the HTTP request.
1638
+ #
1639
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1640
+ #
1641
+ def list_by_department_next_async(next_page_link, custom_headers:nil)
1642
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1643
+
1644
+
1645
+ request_headers = {}
1646
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1647
+
1648
+ # Set Headers
1649
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1650
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1651
+ path_template = '{nextLink}'
1652
+
1653
+ request_url = @base_url || @client.base_url
1654
+
1655
+ options = {
1656
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1657
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1658
+ headers: request_headers.merge(custom_headers || {}),
1659
+ base_url: request_url
1660
+ }
1661
+ promise = @client.make_request_async(:get, path_template, options)
1662
+
1663
+ promise = promise.then do |result|
1664
+ http_response = result.response
1665
+ status_code = http_response.status
1666
+ response_content = http_response.body
1667
+ unless status_code == 200
1668
+ error_model = JSON.load(response_content)
1669
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1670
+ end
1671
+
1672
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1673
+ # Deserialize Response
1674
+ if status_code == 200
1675
+ begin
1676
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1677
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
1678
+ result.body = @client.deserialize(result_mapper, parsed_response)
1679
+ rescue Exception => e
1680
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1681
+ end
1682
+ end
1683
+
1684
+ result
1685
+ end
1686
+
1687
+ promise.execute
1688
+ end
1689
+
1690
+ #
1691
+ # Lists the usage details based on departmentId for a scope by billing period.
1692
+ # Usage details are available via this API only for May 1, 2014 or later.
1693
+ #
1694
+ # @param next_page_link [String] The NextLink from the previous successful call
1695
+ # to List operation.
1696
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1697
+ # will be added to the HTTP request.
1698
+ #
1699
+ # @return [UsageDetailsListResult] operation results.
1700
+ #
1701
+ def list_for_billing_period_by_department_next(next_page_link, custom_headers:nil)
1702
+ response = list_for_billing_period_by_department_next_async(next_page_link, custom_headers:custom_headers).value!
1703
+ response.body unless response.nil?
1704
+ end
1705
+
1706
+ #
1707
+ # Lists the usage details based on departmentId for a scope by billing period.
1708
+ # Usage details are available via this API only for May 1, 2014 or later.
1709
+ #
1710
+ # @param next_page_link [String] The NextLink from the previous successful call
1711
+ # to List operation.
1712
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1713
+ # will be added to the HTTP request.
1714
+ #
1715
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1716
+ #
1717
+ def list_for_billing_period_by_department_next_with_http_info(next_page_link, custom_headers:nil)
1718
+ list_for_billing_period_by_department_next_async(next_page_link, custom_headers:custom_headers).value!
1719
+ end
1720
+
1721
+ #
1722
+ # Lists the usage details based on departmentId for a scope by billing period.
1723
+ # Usage details are available via this API only for May 1, 2014 or later.
1724
+ #
1725
+ # @param next_page_link [String] The NextLink from the previous successful call
1726
+ # to List operation.
1727
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1728
+ # to the HTTP request.
1729
+ #
1730
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1731
+ #
1732
+ def list_for_billing_period_by_department_next_async(next_page_link, custom_headers:nil)
1733
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1734
+
1735
+
1736
+ request_headers = {}
1737
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1738
+
1739
+ # Set Headers
1740
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1741
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1742
+ path_template = '{nextLink}'
1743
+
1744
+ request_url = @base_url || @client.base_url
1745
+
1746
+ options = {
1747
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1748
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1749
+ headers: request_headers.merge(custom_headers || {}),
1750
+ base_url: request_url
1751
+ }
1752
+ promise = @client.make_request_async(:get, path_template, options)
1753
+
1754
+ promise = promise.then do |result|
1755
+ http_response = result.response
1756
+ status_code = http_response.status
1757
+ response_content = http_response.body
1758
+ unless status_code == 200
1759
+ error_model = JSON.load(response_content)
1760
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1761
+ end
1762
+
1763
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1764
+ # Deserialize Response
1765
+ if status_code == 200
1766
+ begin
1767
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1768
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
1769
+ result.body = @client.deserialize(result_mapper, parsed_response)
1770
+ rescue Exception => e
1771
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1772
+ end
1773
+ end
1774
+
1775
+ result
1776
+ end
1777
+
1778
+ promise.execute
1779
+ end
1780
+
1781
+ #
1782
+ # Lists the usage details by enrollmentAccountId for a scope by current billing
1783
+ # period. Usage details are available via this API only for May 1, 2014 or
1784
+ # later.
1785
+ #
1786
+ # @param next_page_link [String] The NextLink from the previous successful call
1787
+ # to List operation.
1788
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1789
+ # will be added to the HTTP request.
1790
+ #
1791
+ # @return [UsageDetailsListResult] operation results.
1792
+ #
1793
+ def list_by_enrollment_account_next(next_page_link, custom_headers:nil)
1794
+ response = list_by_enrollment_account_next_async(next_page_link, custom_headers:custom_headers).value!
1795
+ response.body unless response.nil?
1796
+ end
1797
+
1798
+ #
1799
+ # Lists the usage details by enrollmentAccountId for a scope by current billing
1800
+ # period. Usage details are available via this API only for May 1, 2014 or
1801
+ # later.
1802
+ #
1803
+ # @param next_page_link [String] The NextLink from the previous successful call
1804
+ # to List operation.
1805
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1806
+ # will be added to the HTTP request.
1807
+ #
1808
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1809
+ #
1810
+ def list_by_enrollment_account_next_with_http_info(next_page_link, custom_headers:nil)
1811
+ list_by_enrollment_account_next_async(next_page_link, custom_headers:custom_headers).value!
1812
+ end
1813
+
1814
+ #
1815
+ # Lists the usage details by enrollmentAccountId for a scope by current billing
1816
+ # period. Usage details are available via this API only for May 1, 2014 or
1817
+ # later.
1818
+ #
1819
+ # @param next_page_link [String] The NextLink from the previous successful call
1820
+ # to List operation.
1821
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1822
+ # to the HTTP request.
1823
+ #
1824
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1825
+ #
1826
+ def list_by_enrollment_account_next_async(next_page_link, custom_headers:nil)
1827
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1828
+
1829
+
1830
+ request_headers = {}
1831
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1832
+
1833
+ # Set Headers
1834
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1835
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1836
+ path_template = '{nextLink}'
1837
+
1838
+ request_url = @base_url || @client.base_url
1839
+
1840
+ options = {
1841
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1842
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1843
+ headers: request_headers.merge(custom_headers || {}),
1844
+ base_url: request_url
1845
+ }
1846
+ promise = @client.make_request_async(:get, path_template, options)
1847
+
1848
+ promise = promise.then do |result|
1849
+ http_response = result.response
1850
+ status_code = http_response.status
1851
+ response_content = http_response.body
1852
+ unless status_code == 200
1853
+ error_model = JSON.load(response_content)
1854
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1855
+ end
1856
+
1857
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1858
+ # Deserialize Response
1859
+ if status_code == 200
1860
+ begin
1861
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1862
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
1863
+ result.body = @client.deserialize(result_mapper, parsed_response)
1864
+ rescue Exception => e
1865
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1866
+ end
1867
+ end
1868
+
1869
+ result
1870
+ end
1871
+
1872
+ promise.execute
1873
+ end
1874
+
1875
+ #
1876
+ # Lists the usage details based on enrollmentAccountId for a scope by billing
1877
+ # period. Usage details are available via this API only for May 1, 2014 or
1878
+ # later.
1879
+ #
1880
+ # @param next_page_link [String] The NextLink from the previous successful call
1881
+ # to List operation.
1882
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1883
+ # will be added to the HTTP request.
1884
+ #
1885
+ # @return [UsageDetailsListResult] operation results.
1886
+ #
1887
+ def list_for_billing_period_by_enrollment_account_next(next_page_link, custom_headers:nil)
1888
+ response = list_for_billing_period_by_enrollment_account_next_async(next_page_link, custom_headers:custom_headers).value!
1889
+ response.body unless response.nil?
1890
+ end
1891
+
1892
+ #
1893
+ # Lists the usage details based on enrollmentAccountId for a scope by billing
1894
+ # period. Usage details are available via this API only for May 1, 2014 or
1895
+ # later.
1896
+ #
1897
+ # @param next_page_link [String] The NextLink from the previous successful call
1898
+ # to List operation.
1899
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1900
+ # will be added to the HTTP request.
1901
+ #
1902
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1903
+ #
1904
+ def list_for_billing_period_by_enrollment_account_next_with_http_info(next_page_link, custom_headers:nil)
1905
+ list_for_billing_period_by_enrollment_account_next_async(next_page_link, custom_headers:custom_headers).value!
1906
+ end
1907
+
1908
+ #
1909
+ # Lists the usage details based on enrollmentAccountId for a scope by billing
1910
+ # period. Usage details are available via this API only for May 1, 2014 or
1911
+ # later.
1912
+ #
1913
+ # @param next_page_link [String] The NextLink from the previous successful call
1914
+ # to List operation.
1915
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1916
+ # to the HTTP request.
1917
+ #
1918
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1919
+ #
1920
+ def list_for_billing_period_by_enrollment_account_next_async(next_page_link, custom_headers:nil)
1921
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1922
+
1923
+
1924
+ request_headers = {}
1925
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1926
+
1927
+ # Set Headers
1928
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1929
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1930
+ path_template = '{nextLink}'
1931
+
1932
+ request_url = @base_url || @client.base_url
1933
+
1934
+ options = {
1935
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1936
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1937
+ headers: request_headers.merge(custom_headers || {}),
1938
+ base_url: request_url
1939
+ }
1940
+ promise = @client.make_request_async(:get, path_template, options)
1941
+
1942
+ promise = promise.then do |result|
1943
+ http_response = result.response
1944
+ status_code = http_response.status
1945
+ response_content = http_response.body
1946
+ unless status_code == 200
1947
+ error_model = JSON.load(response_content)
1948
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1949
+ end
1950
+
1951
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1952
+ # Deserialize Response
1953
+ if status_code == 200
1954
+ begin
1955
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1956
+ result_mapper = Azure::Consumption::Mgmt::V2018_06_30::Models::UsageDetailsListResult.mapper()
1957
+ result.body = @client.deserialize(result_mapper, parsed_response)
1958
+ rescue Exception => e
1959
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1960
+ end
1961
+ end
1962
+
1963
+ result
1964
+ end
1965
+
1966
+ promise.execute
1967
+ end
1968
+
1969
+ #
1970
+ # Lists the usage details for a scope by current billing period. Usage details
1971
+ # are available via this API only for May 1, 2014 or later.
1972
+ #
1973
+ # @param expand [String] May be used to expand the
1974
+ # properties/additionalProperties or properties/meterDetails within a list of
1975
+ # usage details. By default, these fields are not included when listing usage
1976
+ # details.
1977
+ # @param filter [String] May be used to filter usageDetails by
1978
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
1979
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
1980
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
1981
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
1982
+ # string where key and value is separated by a colon (:).
1983
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
1984
+ # returned a partial result. If a previous response contains a nextLink
1985
+ # element, the value of the nextLink element will include a skiptoken parameter
1986
+ # that specifies a starting point to use for subsequent calls.
1987
+ # @param top [Integer] May be used to limit the number of results to the most
1988
+ # recent N usageDetails.
1989
+ # @param query_options [QueryOptions] Additional parameters for the operation
1990
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1991
+ # will be added to the HTTP request.
1992
+ #
1993
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
1994
+ # response.
1995
+ #
1996
+ def list_as_lazy(expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
1997
+ response = list_async(expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
1998
+ unless response.nil?
1999
+ page = response.body
2000
+ page.next_method = Proc.new do |next_page_link|
2001
+ list_next_async(next_page_link, custom_headers:custom_headers)
2002
+ end
2003
+ page
2004
+ end
2005
+ end
2006
+
2007
+ #
2008
+ # Lists the usage details for a scope by billing period. Usage details are
2009
+ # available via this API only for May 1, 2014 or later.
2010
+ #
2011
+ # @param billing_period_name [String] Billing Period Name.
2012
+ # @param expand [String] May be used to expand the
2013
+ # properties/additionalProperties or properties/meterDetails within a list of
2014
+ # usage details. By default, these fields are not included when listing usage
2015
+ # details.
2016
+ # @param filter [String] May be used to filter usageDetails by
2017
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
2018
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
2019
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
2020
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
2021
+ # where key and value is separated by a colon (:).
2022
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
2023
+ # returned a partial result. If a previous response contains a nextLink
2024
+ # element, the value of the nextLink element will include a skiptoken parameter
2025
+ # that specifies a starting point to use for subsequent calls.
2026
+ # @param top [Integer] May be used to limit the number of results to the most
2027
+ # recent N usageDetails.
2028
+ # @param query_options [QueryOptions] Additional parameters for the operation
2029
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2030
+ # will be added to the HTTP request.
2031
+ #
2032
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
2033
+ # response.
2034
+ #
2035
+ def list_by_billing_period_as_lazy(billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
2036
+ response = list_by_billing_period_async(billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
2037
+ unless response.nil?
2038
+ page = response.body
2039
+ page.next_method = Proc.new do |next_page_link|
2040
+ list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers)
2041
+ end
2042
+ page
2043
+ end
2044
+ end
2045
+
2046
+ #
2047
+ # Lists the usage details by billingAccountId for a scope by current billing
2048
+ # period. Usage details are available via this API only for May 1, 2014 or
2049
+ # later.
2050
+ #
2051
+ # @param billing_account_id [String] BillingAccount ID
2052
+ # @param expand [String] May be used to expand the
2053
+ # properties/additionalProperties or properties/meterDetails within a list of
2054
+ # usage details. By default, these fields are not included when listing usage
2055
+ # details.
2056
+ # @param filter [String] May be used to filter usageDetails by
2057
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
2058
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
2059
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
2060
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
2061
+ # string where key and value is separated by a colon (:).
2062
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
2063
+ # returned a partial result. If a previous response contains a nextLink
2064
+ # element, the value of the nextLink element will include a skiptoken parameter
2065
+ # that specifies a starting point to use for subsequent calls.
2066
+ # @param top [Integer] May be used to limit the number of results to the most
2067
+ # recent N usageDetails.
2068
+ # @param query_options [QueryOptions] Additional parameters for the operation
2069
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2070
+ # will be added to the HTTP request.
2071
+ #
2072
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
2073
+ # response.
2074
+ #
2075
+ def list_by_billing_account_as_lazy(billing_account_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
2076
+ response = list_by_billing_account_async(billing_account_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
2077
+ unless response.nil?
2078
+ page = response.body
2079
+ page.next_method = Proc.new do |next_page_link|
2080
+ list_by_billing_account_next_async(next_page_link, custom_headers:custom_headers)
2081
+ end
2082
+ page
2083
+ end
2084
+ end
2085
+
2086
+ #
2087
+ # Lists the usage details based on billingAccountId for a scope by billing
2088
+ # period. Usage details are available via this API only for May 1, 2014 or
2089
+ # later.
2090
+ #
2091
+ # @param billing_account_id [String] BillingAccount ID
2092
+ # @param billing_period_name [String] Billing Period Name.
2093
+ # @param expand [String] May be used to expand the
2094
+ # properties/additionalProperties or properties/meterDetails within a list of
2095
+ # usage details. By default, these fields are not included when listing usage
2096
+ # details.
2097
+ # @param filter [String] May be used to filter usageDetails by
2098
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
2099
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
2100
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
2101
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
2102
+ # where key and value is separated by a colon (:).
2103
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
2104
+ # returned a partial result. If a previous response contains a nextLink
2105
+ # element, the value of the nextLink element will include a skiptoken parameter
2106
+ # that specifies a starting point to use for subsequent calls.
2107
+ # @param top [Integer] May be used to limit the number of results to the most
2108
+ # recent N usageDetails.
2109
+ # @param query_options [QueryOptions] Additional parameters for the operation
2110
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2111
+ # will be added to the HTTP request.
2112
+ #
2113
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
2114
+ # response.
2115
+ #
2116
+ def list_for_billing_period_by_billing_account_as_lazy(billing_account_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
2117
+ response = list_for_billing_period_by_billing_account_async(billing_account_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
2118
+ unless response.nil?
2119
+ page = response.body
2120
+ page.next_method = Proc.new do |next_page_link|
2121
+ list_for_billing_period_by_billing_account_next_async(next_page_link, custom_headers:custom_headers)
2122
+ end
2123
+ page
2124
+ end
2125
+ end
2126
+
2127
+ #
2128
+ # Lists the usage details by departmentId for a scope by current billing
2129
+ # period. Usage details are available via this API only for May 1, 2014 or
2130
+ # later.
2131
+ #
2132
+ # @param department_id [String] Department ID
2133
+ # @param expand [String] May be used to expand the
2134
+ # properties/additionalProperties or properties/meterDetails within a list of
2135
+ # usage details. By default, these fields are not included when listing usage
2136
+ # details.
2137
+ # @param filter [String] May be used to filter usageDetails by
2138
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
2139
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
2140
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
2141
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
2142
+ # string where key and value is separated by a colon (:).
2143
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
2144
+ # returned a partial result. If a previous response contains a nextLink
2145
+ # element, the value of the nextLink element will include a skiptoken parameter
2146
+ # that specifies a starting point to use for subsequent calls.
2147
+ # @param top [Integer] May be used to limit the number of results to the most
2148
+ # recent N usageDetails.
2149
+ # @param query_options [QueryOptions] Additional parameters for the operation
2150
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2151
+ # will be added to the HTTP request.
2152
+ #
2153
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
2154
+ # response.
2155
+ #
2156
+ def list_by_department_as_lazy(department_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
2157
+ response = list_by_department_async(department_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
2158
+ unless response.nil?
2159
+ page = response.body
2160
+ page.next_method = Proc.new do |next_page_link|
2161
+ list_by_department_next_async(next_page_link, custom_headers:custom_headers)
2162
+ end
2163
+ page
2164
+ end
2165
+ end
2166
+
2167
+ #
2168
+ # Lists the usage details based on departmentId for a scope by billing period.
2169
+ # Usage details are available via this API only for May 1, 2014 or later.
2170
+ #
2171
+ # @param department_id [String] Department ID
2172
+ # @param billing_period_name [String] Billing Period Name.
2173
+ # @param expand [String] May be used to expand the
2174
+ # properties/additionalProperties or properties/meterDetails within a list of
2175
+ # usage details. By default, these fields are not included when listing usage
2176
+ # details.
2177
+ # @param filter [String] May be used to filter usageDetails by
2178
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
2179
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
2180
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
2181
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
2182
+ # where key and value is separated by a colon (:).
2183
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
2184
+ # returned a partial result. If a previous response contains a nextLink
2185
+ # element, the value of the nextLink element will include a skiptoken parameter
2186
+ # that specifies a starting point to use for subsequent calls.
2187
+ # @param top [Integer] May be used to limit the number of results to the most
2188
+ # recent N usageDetails.
2189
+ # @param query_options [QueryOptions] Additional parameters for the operation
2190
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2191
+ # will be added to the HTTP request.
2192
+ #
2193
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
2194
+ # response.
2195
+ #
2196
+ def list_for_billing_period_by_department_as_lazy(department_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
2197
+ response = list_for_billing_period_by_department_async(department_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
2198
+ unless response.nil?
2199
+ page = response.body
2200
+ page.next_method = Proc.new do |next_page_link|
2201
+ list_for_billing_period_by_department_next_async(next_page_link, custom_headers:custom_headers)
2202
+ end
2203
+ page
2204
+ end
2205
+ end
2206
+
2207
+ #
2208
+ # Lists the usage details by enrollmentAccountId for a scope by current billing
2209
+ # period. Usage details are available via this API only for May 1, 2014 or
2210
+ # later.
2211
+ #
2212
+ # @param enrollment_account_id [String] EnrollmentAccount ID
2213
+ # @param expand [String] May be used to expand the
2214
+ # properties/additionalProperties or properties/meterDetails within a list of
2215
+ # usage details. By default, these fields are not included when listing usage
2216
+ # details.
2217
+ # @param filter [String] May be used to filter usageDetails by
2218
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
2219
+ # properties/resourceGroup, properties/instanceName, properties/instanceId or
2220
+ # tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
2221
+ # not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
2222
+ # string where key and value is separated by a colon (:).
2223
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
2224
+ # returned a partial result. If a previous response contains a nextLink
2225
+ # element, the value of the nextLink element will include a skiptoken parameter
2226
+ # that specifies a starting point to use for subsequent calls.
2227
+ # @param top [Integer] May be used to limit the number of results to the most
2228
+ # recent N usageDetails.
2229
+ # @param query_options [QueryOptions] Additional parameters for the operation
2230
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2231
+ # will be added to the HTTP request.
2232
+ #
2233
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
2234
+ # response.
2235
+ #
2236
+ def list_by_enrollment_account_as_lazy(enrollment_account_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
2237
+ response = list_by_enrollment_account_async(enrollment_account_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
2238
+ unless response.nil?
2239
+ page = response.body
2240
+ page.next_method = Proc.new do |next_page_link|
2241
+ list_by_enrollment_account_next_async(next_page_link, custom_headers:custom_headers)
2242
+ end
2243
+ page
2244
+ end
2245
+ end
2246
+
2247
+ #
2248
+ # Lists the usage details based on enrollmentAccountId for a scope by billing
2249
+ # period. Usage details are available via this API only for May 1, 2014 or
2250
+ # later.
2251
+ #
2252
+ # @param enrollment_account_id [String] EnrollmentAccount ID
2253
+ # @param billing_period_name [String] Billing Period Name.
2254
+ # @param expand [String] May be used to expand the
2255
+ # properties/additionalProperties or properties/meterDetails within a list of
2256
+ # usage details. By default, these fields are not included when listing usage
2257
+ # details.
2258
+ # @param filter [String] May be used to filter usageDetails by
2259
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
2260
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
2261
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
2262
+ # currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string
2263
+ # where key and value is separated by a colon (:).
2264
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
2265
+ # returned a partial result. If a previous response contains a nextLink
2266
+ # element, the value of the nextLink element will include a skiptoken parameter
2267
+ # that specifies a starting point to use for subsequent calls.
2268
+ # @param top [Integer] May be used to limit the number of results to the most
2269
+ # recent N usageDetails.
2270
+ # @param query_options [QueryOptions] Additional parameters for the operation
2271
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2272
+ # will be added to the HTTP request.
2273
+ #
2274
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
2275
+ # response.
2276
+ #
2277
+ def list_for_billing_period_by_enrollment_account_as_lazy(enrollment_account_id, billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
2278
+ response = list_for_billing_period_by_enrollment_account_async(enrollment_account_id, billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
2279
+ unless response.nil?
2280
+ page = response.body
2281
+ page.next_method = Proc.new do |next_page_link|
2282
+ list_for_billing_period_by_enrollment_account_next_async(next_page_link, custom_headers:custom_headers)
2283
+ end
2284
+ page
2285
+ end
2286
+ end
2287
+
2288
+ end
2289
+ end