azure_mgmt_consumption 0.15.2 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/consumption_management_client.rb +4 -1
  3. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/operations.rb +15 -13
  4. data/lib/2017-04-24-preview/generated/azure_mgmt_consumption/usage_details.rb +15 -13
  5. data/lib/2017-11-30/generated/azure_mgmt_consumption.rb +12 -5
  6. data/lib/2017-11-30/generated/azure_mgmt_consumption/consumption_management_client.rb +12 -1
  7. data/lib/2017-11-30/generated/azure_mgmt_consumption/models/datagrain.rb +16 -0
  8. data/lib/2017-11-30/generated/azure_mgmt_consumption/models/reservation_details.rb +187 -0
  9. data/lib/2017-11-30/generated/azure_mgmt_consumption/models/reservation_details_list_result.rb +56 -0
  10. data/lib/2017-11-30/generated/azure_mgmt_consumption/models/reservation_summaries.rb +205 -0
  11. data/lib/2017-11-30/generated/azure_mgmt_consumption/models/reservation_summaries_list_result.rb +57 -0
  12. data/lib/2017-11-30/generated/azure_mgmt_consumption/operations.rb +15 -13
  13. data/lib/2017-11-30/generated/azure_mgmt_consumption/reservations_details.rb +129 -0
  14. data/lib/2017-11-30/generated/azure_mgmt_consumption/reservations_summaries.rb +135 -0
  15. data/lib/2017-11-30/generated/azure_mgmt_consumption/usage_details.rb +15 -13
  16. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption.rb +42 -0
  17. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/budgets.rb +384 -0
  18. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/consumption_management_client.rb +138 -0
  19. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/budget.rb +160 -0
  20. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/budget_time_period.rb +58 -0
  21. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/budgets_list_result.rb +57 -0
  22. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/current_spend.rb +59 -0
  23. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/error_details.rb +59 -0
  24. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/error_response.rb +48 -0
  25. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/notification.rb +115 -0
  26. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/operation.rb +59 -0
  27. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/operation_display.rb +72 -0
  28. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/operation_list_result.rb +103 -0
  29. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/operator_type.rb +17 -0
  30. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/proxy_resource.rb +84 -0
  31. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/models/time_grain_type.rb +17 -0
  32. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/module_definition.rb +9 -0
  33. data/lib/2017-12-30-preview/generated/azure_mgmt_consumption/operations.rb +216 -0
  34. data/lib/2018-01-31/generated/azure_mgmt_consumption.rb +62 -0
  35. data/lib/2018-01-31/generated/azure_mgmt_consumption/budgets.rb +993 -0
  36. data/lib/2018-01-31/generated/azure_mgmt_consumption/consumption_management_client.rb +155 -0
  37. data/lib/2018-01-31/generated/azure_mgmt_consumption/marketplaces.rb +521 -0
  38. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/budget.rb +171 -0
  39. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/budget_time_period.rb +58 -0
  40. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/budgets_list_result.rb +101 -0
  41. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/category_type.rb +16 -0
  42. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/current_spend.rb +59 -0
  43. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/datagrain.rb +16 -0
  44. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/error_details.rb +59 -0
  45. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/error_response.rb +48 -0
  46. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/filters.rb +106 -0
  47. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/marketplace.rb +375 -0
  48. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/marketplaces_list_result.rb +101 -0
  49. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/meter_details.rb +122 -0
  50. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/notification.rb +139 -0
  51. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/operation.rb +59 -0
  52. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/operation_display.rb +72 -0
  53. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/operation_list_result.rb +103 -0
  54. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/operator_type.rb +17 -0
  55. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/price_sheet_properties.rb +134 -0
  56. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/price_sheet_result.rb +112 -0
  57. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/proxy_resource.rb +84 -0
  58. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/reservation_details.rb +187 -0
  59. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/reservation_details_list_result.rb +100 -0
  60. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/reservation_summaries.rb +205 -0
  61. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/reservation_summaries_list_result.rb +101 -0
  62. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/resource.rb +91 -0
  63. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/time_grain_type.rb +17 -0
  64. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/usage_detail.rb +355 -0
  65. data/lib/2018-01-31/generated/azure_mgmt_consumption/models/usage_details_list_result.rb +101 -0
  66. data/lib/2018-01-31/generated/azure_mgmt_consumption/module_definition.rb +9 -0
  67. data/lib/2018-01-31/generated/azure_mgmt_consumption/operations.rb +216 -0
  68. data/lib/2018-01-31/generated/azure_mgmt_consumption/price_sheet.rb +246 -0
  69. data/lib/2018-01-31/generated/azure_mgmt_consumption/reservations_details.rb +449 -0
  70. data/lib/2018-01-31/generated/azure_mgmt_consumption/reservations_summaries.rb +465 -0
  71. data/lib/2018-01-31/generated/azure_mgmt_consumption/usage_details.rb +553 -0
  72. data/lib/azure_mgmt_consumption.rb +2 -0
  73. data/lib/profiles/latest/consumption_latest_profile_client.rb +28 -9
  74. data/lib/profiles/latest/consumption_module_definition.rb +0 -1
  75. data/lib/profiles/latest/modules/consumption_profile_module.rb +153 -48
  76. data/lib/version.rb +1 -1
  77. metadata +65 -2
@@ -0,0 +1,553 @@
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_01_31
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 billing period. Usage details are
27
+ # 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 or properties/instanceId.
36
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
37
+ # currently support 'ne', 'or', or 'not'.
38
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
39
+ # returned a partial result. If a previous response contains a nextLink
40
+ # element, the value of the nextLink element will include a skiptoken parameter
41
+ # that specifies a starting point to use for subsequent calls.
42
+ # @param top [Integer] May be used to limit the number of results to the most
43
+ # recent N usageDetails.
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [Array<UsageDetail>] operation results.
48
+ #
49
+ def list(expand:nil, filter:nil, skiptoken:nil, top:nil, custom_headers:nil)
50
+ first_page = list_as_lazy(expand:expand, filter:filter, skiptoken:skiptoken, top:top, custom_headers:custom_headers)
51
+ first_page.get_all_items
52
+ end
53
+
54
+ #
55
+ # Lists the usage details for a scope by billing period. Usage details are
56
+ # available via this API only for May 1, 2014 or later.
57
+ #
58
+ # @param expand [String] May be used to expand the
59
+ # properties/additionalProperties or properties/meterDetails within a list of
60
+ # usage details. By default, these fields are not included when listing usage
61
+ # details.
62
+ # @param filter [String] May be used to filter usageDetails by
63
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
64
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
65
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
66
+ # currently support 'ne', 'or', or 'not'.
67
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
68
+ # returned a partial result. If a previous response contains a nextLink
69
+ # element, the value of the nextLink element will include a skiptoken parameter
70
+ # that specifies a starting point to use for subsequent calls.
71
+ # @param top [Integer] May be used to limit the number of results to the most
72
+ # recent N usageDetails.
73
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
74
+ # will be added to the HTTP request.
75
+ #
76
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
77
+ #
78
+ def list_with_http_info(expand:nil, filter:nil, skiptoken:nil, top:nil, custom_headers:nil)
79
+ list_async(expand:expand, filter:filter, skiptoken:skiptoken, top:top, custom_headers:custom_headers).value!
80
+ end
81
+
82
+ #
83
+ # Lists the usage details for a scope by billing period. Usage details are
84
+ # available via this API only for May 1, 2014 or later.
85
+ #
86
+ # @param expand [String] May be used to expand the
87
+ # properties/additionalProperties or properties/meterDetails within a list of
88
+ # usage details. By default, these fields are not included when listing usage
89
+ # details.
90
+ # @param filter [String] May be used to filter usageDetails by
91
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
92
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
93
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
94
+ # currently support 'ne', 'or', or 'not'.
95
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
96
+ # returned a partial result. If a previous response contains a nextLink
97
+ # element, the value of the nextLink element will include a skiptoken parameter
98
+ # that specifies a starting point to use for subsequent calls.
99
+ # @param top [Integer] May be used to limit the number of results to the most
100
+ # recent N usageDetails.
101
+ # @param [Hash{String => String}] A hash of custom headers that will be added
102
+ # to the HTTP request.
103
+ #
104
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
105
+ #
106
+ def list_async(expand:nil, filter:nil, skiptoken:nil, top:nil, custom_headers:nil)
107
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
108
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
109
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
110
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
111
+
112
+
113
+ request_headers = {}
114
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
115
+
116
+ # Set Headers
117
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
118
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
119
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Consumption/usageDetails'
120
+
121
+ request_url = @base_url || @client.base_url
122
+
123
+ options = {
124
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
125
+ path_params: {'subscriptionId' => @client.subscription_id},
126
+ query_params: {'$expand' => expand,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version},
127
+ headers: request_headers.merge(custom_headers || {}),
128
+ base_url: request_url
129
+ }
130
+ promise = @client.make_request_async(:get, path_template, options)
131
+
132
+ promise = promise.then do |result|
133
+ http_response = result.response
134
+ status_code = http_response.status
135
+ response_content = http_response.body
136
+ unless status_code == 200
137
+ error_model = JSON.load(response_content)
138
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
139
+ end
140
+
141
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
142
+ # Deserialize Response
143
+ if status_code == 200
144
+ begin
145
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
146
+ result_mapper = Azure::Consumption::Mgmt::V2018_01_31::Models::UsageDetailsListResult.mapper()
147
+ result.body = @client.deserialize(result_mapper, parsed_response)
148
+ rescue Exception => e
149
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
150
+ end
151
+ end
152
+
153
+ result
154
+ end
155
+
156
+ promise.execute
157
+ end
158
+
159
+ #
160
+ # Lists the usage details for a scope by billing period. Usage details are
161
+ # available via this API only for May 1, 2014 or later.
162
+ #
163
+ # @param billing_period_name [String] Billing Period Name.
164
+ # @param expand [String] May be used to expand the
165
+ # properties/additionalProperties or properties/meterDetails within a list of
166
+ # usage details. By default, these fields are not included when listing usage
167
+ # details.
168
+ # @param filter [String] May be used to filter usageDetails by
169
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
170
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
171
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
172
+ # currently support 'ne', 'or', or 'not'.
173
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
174
+ # returned a partial result. If a previous response contains a nextLink
175
+ # element, the value of the nextLink element will include a skiptoken parameter
176
+ # that specifies a starting point to use for subsequent calls.
177
+ # @param top [Integer] May be used to limit the number of results to the most
178
+ # recent N usageDetails.
179
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
180
+ # will be added to the HTTP request.
181
+ #
182
+ # @return [Array<UsageDetail>] operation results.
183
+ #
184
+ def list_by_billing_period(billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, custom_headers:nil)
185
+ first_page = list_by_billing_period_as_lazy(billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, custom_headers:custom_headers)
186
+ first_page.get_all_items
187
+ end
188
+
189
+ #
190
+ # Lists the usage details for a scope by billing period. Usage details are
191
+ # available via this API only for May 1, 2014 or later.
192
+ #
193
+ # @param billing_period_name [String] Billing Period Name.
194
+ # @param expand [String] May be used to expand the
195
+ # properties/additionalProperties or properties/meterDetails within a list of
196
+ # usage details. By default, these fields are not included when listing usage
197
+ # details.
198
+ # @param filter [String] May be used to filter usageDetails by
199
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
200
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
201
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
202
+ # currently support 'ne', 'or', or 'not'.
203
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
204
+ # returned a partial result. If a previous response contains a nextLink
205
+ # element, the value of the nextLink element will include a skiptoken parameter
206
+ # that specifies a starting point to use for subsequent calls.
207
+ # @param top [Integer] May be used to limit the number of results to the most
208
+ # recent N usageDetails.
209
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
210
+ # will be added to the HTTP request.
211
+ #
212
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
213
+ #
214
+ def list_by_billing_period_with_http_info(billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, custom_headers:nil)
215
+ list_by_billing_period_async(billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, custom_headers:custom_headers).value!
216
+ end
217
+
218
+ #
219
+ # Lists the usage details for a scope by billing period. Usage details are
220
+ # available via this API only for May 1, 2014 or later.
221
+ #
222
+ # @param billing_period_name [String] Billing Period Name.
223
+ # @param expand [String] May be used to expand the
224
+ # properties/additionalProperties or properties/meterDetails within a list of
225
+ # usage details. By default, these fields are not included when listing usage
226
+ # details.
227
+ # @param filter [String] May be used to filter usageDetails by
228
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
229
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
230
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
231
+ # currently support 'ne', 'or', or 'not'.
232
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
233
+ # returned a partial result. If a previous response contains a nextLink
234
+ # element, the value of the nextLink element will include a skiptoken parameter
235
+ # that specifies a starting point to use for subsequent calls.
236
+ # @param top [Integer] May be used to limit the number of results to the most
237
+ # recent N usageDetails.
238
+ # @param [Hash{String => String}] A hash of custom headers that will be added
239
+ # to the HTTP request.
240
+ #
241
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
242
+ #
243
+ def list_by_billing_period_async(billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, custom_headers:nil)
244
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
245
+ fail ArgumentError, 'billing_period_name is nil' if billing_period_name.nil?
246
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
247
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
248
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
249
+
250
+
251
+ request_headers = {}
252
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
253
+
254
+ # Set Headers
255
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
256
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
257
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'
258
+
259
+ request_url = @base_url || @client.base_url
260
+
261
+ options = {
262
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
263
+ path_params: {'subscriptionId' => @client.subscription_id,'billingPeriodName' => billing_period_name},
264
+ query_params: {'$expand' => expand,'$filter' => filter,'$skiptoken' => skiptoken,'$top' => top,'api-version' => @client.api_version},
265
+ headers: request_headers.merge(custom_headers || {}),
266
+ base_url: request_url
267
+ }
268
+ promise = @client.make_request_async(:get, path_template, options)
269
+
270
+ promise = promise.then do |result|
271
+ http_response = result.response
272
+ status_code = http_response.status
273
+ response_content = http_response.body
274
+ unless status_code == 200
275
+ error_model = JSON.load(response_content)
276
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
277
+ end
278
+
279
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
280
+ # Deserialize Response
281
+ if status_code == 200
282
+ begin
283
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
284
+ result_mapper = Azure::Consumption::Mgmt::V2018_01_31::Models::UsageDetailsListResult.mapper()
285
+ result.body = @client.deserialize(result_mapper, parsed_response)
286
+ rescue Exception => e
287
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
288
+ end
289
+ end
290
+
291
+ result
292
+ end
293
+
294
+ promise.execute
295
+ end
296
+
297
+ #
298
+ # Lists the usage details for a scope by billing period. Usage details are
299
+ # available via this API only for May 1, 2014 or later.
300
+ #
301
+ # @param next_page_link [String] The NextLink from the previous successful call
302
+ # to List operation.
303
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
304
+ # will be added to the HTTP request.
305
+ #
306
+ # @return [UsageDetailsListResult] operation results.
307
+ #
308
+ def list_next(next_page_link, custom_headers:nil)
309
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
310
+ response.body unless response.nil?
311
+ end
312
+
313
+ #
314
+ # Lists the usage details for a scope by billing period. Usage details are
315
+ # available via this API only for May 1, 2014 or later.
316
+ #
317
+ # @param next_page_link [String] The NextLink from the previous successful call
318
+ # to List operation.
319
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
320
+ # will be added to the HTTP request.
321
+ #
322
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
323
+ #
324
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
325
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
326
+ end
327
+
328
+ #
329
+ # Lists the usage details for a scope by billing period. Usage details are
330
+ # available via this API only for May 1, 2014 or later.
331
+ #
332
+ # @param next_page_link [String] The NextLink from the previous successful call
333
+ # to List operation.
334
+ # @param [Hash{String => String}] A hash of custom headers that will be added
335
+ # to the HTTP request.
336
+ #
337
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
338
+ #
339
+ def list_next_async(next_page_link, custom_headers:nil)
340
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
341
+
342
+
343
+ request_headers = {}
344
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
345
+
346
+ # Set Headers
347
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
348
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
349
+ path_template = '{nextLink}'
350
+
351
+ request_url = @base_url || @client.base_url
352
+
353
+ options = {
354
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
355
+ skip_encoding_path_params: {'nextLink' => next_page_link},
356
+ headers: request_headers.merge(custom_headers || {}),
357
+ base_url: request_url
358
+ }
359
+ promise = @client.make_request_async(:get, path_template, options)
360
+
361
+ promise = promise.then do |result|
362
+ http_response = result.response
363
+ status_code = http_response.status
364
+ response_content = http_response.body
365
+ unless status_code == 200
366
+ error_model = JSON.load(response_content)
367
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
368
+ end
369
+
370
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
371
+ # Deserialize Response
372
+ if status_code == 200
373
+ begin
374
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
375
+ result_mapper = Azure::Consumption::Mgmt::V2018_01_31::Models::UsageDetailsListResult.mapper()
376
+ result.body = @client.deserialize(result_mapper, parsed_response)
377
+ rescue Exception => e
378
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
379
+ end
380
+ end
381
+
382
+ result
383
+ end
384
+
385
+ promise.execute
386
+ end
387
+
388
+ #
389
+ # Lists the usage details for a scope by billing period. Usage details are
390
+ # available via this API only for May 1, 2014 or later.
391
+ #
392
+ # @param next_page_link [String] The NextLink from the previous successful call
393
+ # to List operation.
394
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
395
+ # will be added to the HTTP request.
396
+ #
397
+ # @return [UsageDetailsListResult] operation results.
398
+ #
399
+ def list_by_billing_period_next(next_page_link, custom_headers:nil)
400
+ response = list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers).value!
401
+ response.body unless response.nil?
402
+ end
403
+
404
+ #
405
+ # Lists the usage details for a scope by billing period. Usage details are
406
+ # available via this API only for May 1, 2014 or later.
407
+ #
408
+ # @param next_page_link [String] The NextLink from the previous successful call
409
+ # to List operation.
410
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
411
+ # will be added to the HTTP request.
412
+ #
413
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
414
+ #
415
+ def list_by_billing_period_next_with_http_info(next_page_link, custom_headers:nil)
416
+ list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers).value!
417
+ end
418
+
419
+ #
420
+ # Lists the usage details for a scope by billing period. Usage details are
421
+ # available via this API only for May 1, 2014 or later.
422
+ #
423
+ # @param next_page_link [String] The NextLink from the previous successful call
424
+ # to List operation.
425
+ # @param [Hash{String => String}] A hash of custom headers that will be added
426
+ # to the HTTP request.
427
+ #
428
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
429
+ #
430
+ def list_by_billing_period_next_async(next_page_link, custom_headers:nil)
431
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
432
+
433
+
434
+ request_headers = {}
435
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
436
+
437
+ # Set Headers
438
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
439
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
440
+ path_template = '{nextLink}'
441
+
442
+ request_url = @base_url || @client.base_url
443
+
444
+ options = {
445
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
446
+ skip_encoding_path_params: {'nextLink' => next_page_link},
447
+ headers: request_headers.merge(custom_headers || {}),
448
+ base_url: request_url
449
+ }
450
+ promise = @client.make_request_async(:get, path_template, options)
451
+
452
+ promise = promise.then do |result|
453
+ http_response = result.response
454
+ status_code = http_response.status
455
+ response_content = http_response.body
456
+ unless status_code == 200
457
+ error_model = JSON.load(response_content)
458
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
459
+ end
460
+
461
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
462
+ # Deserialize Response
463
+ if status_code == 200
464
+ begin
465
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
466
+ result_mapper = Azure::Consumption::Mgmt::V2018_01_31::Models::UsageDetailsListResult.mapper()
467
+ result.body = @client.deserialize(result_mapper, parsed_response)
468
+ rescue Exception => e
469
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
470
+ end
471
+ end
472
+
473
+ result
474
+ end
475
+
476
+ promise.execute
477
+ end
478
+
479
+ #
480
+ # Lists the usage details for a scope by billing period. Usage details are
481
+ # available via this API only for May 1, 2014 or later.
482
+ #
483
+ # @param expand [String] May be used to expand the
484
+ # properties/additionalProperties or properties/meterDetails within a list of
485
+ # usage details. By default, these fields are not included when listing usage
486
+ # details.
487
+ # @param filter [String] May be used to filter usageDetails by
488
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
489
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
490
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
491
+ # currently support 'ne', 'or', or 'not'.
492
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
493
+ # returned a partial result. If a previous response contains a nextLink
494
+ # element, the value of the nextLink element will include a skiptoken parameter
495
+ # that specifies a starting point to use for subsequent calls.
496
+ # @param top [Integer] May be used to limit the number of results to the most
497
+ # recent N usageDetails.
498
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
499
+ # will be added to the HTTP request.
500
+ #
501
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
502
+ # response.
503
+ #
504
+ def list_as_lazy(expand:nil, filter:nil, skiptoken:nil, top:nil, custom_headers:nil)
505
+ response = list_async(expand:expand, filter:filter, skiptoken:skiptoken, top:top, custom_headers:custom_headers).value!
506
+ unless response.nil?
507
+ page = response.body
508
+ page.next_method = Proc.new do |next_page_link|
509
+ list_next_async(next_page_link, custom_headers:custom_headers)
510
+ end
511
+ page
512
+ end
513
+ end
514
+
515
+ #
516
+ # Lists the usage details for a scope by billing period. Usage details are
517
+ # available via this API only for May 1, 2014 or later.
518
+ #
519
+ # @param billing_period_name [String] Billing Period Name.
520
+ # @param expand [String] May be used to expand the
521
+ # properties/additionalProperties or properties/meterDetails within a list of
522
+ # usage details. By default, these fields are not included when listing usage
523
+ # details.
524
+ # @param filter [String] May be used to filter usageDetails by
525
+ # properties/usageEnd (Utc time), properties/usageStart (Utc time),
526
+ # properties/resourceGroup, properties/instanceName or properties/instanceId.
527
+ # The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not
528
+ # currently support 'ne', 'or', or 'not'.
529
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
530
+ # returned a partial result. If a previous response contains a nextLink
531
+ # element, the value of the nextLink element will include a skiptoken parameter
532
+ # that specifies a starting point to use for subsequent calls.
533
+ # @param top [Integer] May be used to limit the number of results to the most
534
+ # recent N usageDetails.
535
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
536
+ # will be added to the HTTP request.
537
+ #
538
+ # @return [UsageDetailsListResult] which provide lazy access to pages of the
539
+ # response.
540
+ #
541
+ def list_by_billing_period_as_lazy(billing_period_name, expand:nil, filter:nil, skiptoken:nil, top:nil, custom_headers:nil)
542
+ response = list_by_billing_period_async(billing_period_name, expand:expand, filter:filter, skiptoken:skiptoken, top:top, custom_headers:custom_headers).value!
543
+ unless response.nil?
544
+ page = response.body
545
+ page.next_method = Proc.new do |next_page_link|
546
+ list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers)
547
+ end
548
+ page
549
+ end
550
+ end
551
+
552
+ end
553
+ end