azure_mgmt_reservations 0.19.0 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-11-01/generated/azure_mgmt_reservations/reservations_management_client.rb +1 -1
  3. data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/reservations_management_client.rb +1 -1
  4. data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/reservations_management_client.rb +1 -1
  5. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations.rb +58 -0
  6. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/auto_quota_increase.rb +241 -0
  7. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/aqi_settings.rb +46 -0
  8. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/auto_quota_increase_detail.rb +119 -0
  9. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/create_generic_quota_request_parameters.rb +55 -0
  10. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/current_quota_limit.rb +144 -0
  11. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/current_quota_limit_base.rb +120 -0
  12. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/current_quota_limit_base_name.rb +59 -0
  13. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/email_action.rb +46 -0
  14. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/email_actions.rb +56 -0
  15. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/exception_response.rb +47 -0
  16. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/on_failure.rb +61 -0
  17. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/on_failure_email_actions.rb +55 -0
  18. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/on_failure_phone_actions.rb +55 -0
  19. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/phone_action.rb +57 -0
  20. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_limits.rb +99 -0
  21. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_limits_response.rb +68 -0
  22. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_details.rb +128 -0
  23. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_details_list.rb +99 -0
  24. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_one_resource_submit_response.rb +194 -0
  25. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_properties.rb +92 -0
  26. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_submit_response.rb +83 -0
  27. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_submit_response201.rb +96 -0
  28. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/service_error.rb +78 -0
  29. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/service_error_detail.rb +59 -0
  30. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/sub_request.rb +118 -0
  31. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/sub_request_name.rb +59 -0
  32. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/support_request_action.rb +153 -0
  33. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/module_definition.rb +9 -0
  34. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/quota.rb +144 -0
  35. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/quota_request.rb +519 -0
  36. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/quota_requests.rb +441 -0
  37. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/quotas.rb +269 -0
  38. data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/reservations_management_client.rb +144 -0
  39. data/lib/azure_mgmt_reservations.rb +1 -0
  40. data/lib/profiles/latest/modules/reservations_profile_module.rb +124 -2
  41. data/lib/version.rb +1 -1
  42. metadata +36 -2
@@ -0,0 +1,441 @@
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::Reservations::Mgmt::V2019_07_19_preview
7
+ #
8
+ # Microsoft Azure Quota Resource Provider.
9
+ #
10
+ class QuotaRequests
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the QuotaRequests class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ReservationsManagementClient] reference to the ReservationsManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets the Quota request status by requestId, for the specified resource
26
+ # provider at specified location.
27
+ #
28
+ # Gets the QuotaRequest details and status by the quota requestId for the
29
+ # resources for the resource provider at a specific location. The requestId is
30
+ # returned as response to the Put requests for serviceLimits.
31
+ #
32
+ # @param subscription_id [String] Azure subscription id.
33
+ # @param provider_id [String] Azure resource Provider id.
34
+ # @param location [String] Azure region.
35
+ # @param id [String] Quota Request id.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [QuotaRequestDetails] operation results.
40
+ #
41
+ def get_status(subscription_id, provider_id, location, id, custom_headers:nil)
42
+ response = get_status_async(subscription_id, provider_id, location, id, custom_headers:custom_headers).value!
43
+ response.body unless response.nil?
44
+ end
45
+
46
+ #
47
+ # Gets the Quota request status by requestId, for the specified resource
48
+ # provider at specified location.
49
+ #
50
+ # Gets the QuotaRequest details and status by the quota requestId for the
51
+ # resources for the resource provider at a specific location. The requestId is
52
+ # returned as response to the Put requests for serviceLimits.
53
+ #
54
+ # @param subscription_id [String] Azure subscription id.
55
+ # @param provider_id [String] Azure resource Provider id.
56
+ # @param location [String] Azure region.
57
+ # @param id [String] Quota Request id.
58
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
59
+ # will be added to the HTTP request.
60
+ #
61
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
62
+ #
63
+ def get_status_with_http_info(subscription_id, provider_id, location, id, custom_headers:nil)
64
+ get_status_async(subscription_id, provider_id, location, id, custom_headers:custom_headers).value!
65
+ end
66
+
67
+ #
68
+ # Gets the Quota request status by requestId, for the specified resource
69
+ # provider at specified location.
70
+ #
71
+ # Gets the QuotaRequest details and status by the quota requestId for the
72
+ # resources for the resource provider at a specific location. The requestId is
73
+ # returned as response to the Put requests for serviceLimits.
74
+ #
75
+ # @param subscription_id [String] Azure subscription id.
76
+ # @param provider_id [String] Azure resource Provider id.
77
+ # @param location [String] Azure region.
78
+ # @param id [String] Quota Request id.
79
+ # @param [Hash{String => String}] A hash of custom headers that will be added
80
+ # to the HTTP request.
81
+ #
82
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
83
+ #
84
+ def get_status_async(subscription_id, provider_id, location, id, custom_headers:nil)
85
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
86
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
87
+ fail ArgumentError, 'provider_id is nil' if provider_id.nil?
88
+ fail ArgumentError, 'location is nil' if location.nil?
89
+ fail ArgumentError, 'id is nil' if id.nil?
90
+
91
+
92
+ request_headers = {}
93
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
94
+
95
+ # Set Headers
96
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
97
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
98
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests/{id}'
99
+
100
+ request_url = @base_url || @client.base_url
101
+
102
+ options = {
103
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
104
+ path_params: {'subscriptionId' => subscription_id,'providerId' => provider_id,'location' => location,'id' => id},
105
+ query_params: {'api-version' => @client.api_version},
106
+ headers: request_headers.merge(custom_headers || {}),
107
+ base_url: request_url
108
+ }
109
+ promise = @client.make_request_async(:get, path_template, options)
110
+
111
+ promise = promise.then do |result|
112
+ http_response = result.response
113
+ status_code = http_response.status
114
+ response_content = http_response.body
115
+ unless status_code == 200
116
+ error_model = JSON.load(response_content)
117
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
118
+ end
119
+
120
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
121
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
122
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
123
+ # Deserialize Response
124
+ if status_code == 200
125
+ begin
126
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
127
+ result_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::QuotaRequestDetails.mapper()
128
+ result.body = @client.deserialize(result_mapper, parsed_response)
129
+ rescue Exception => e
130
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
131
+ end
132
+ end
133
+
134
+ result
135
+ end
136
+
137
+ promise.execute
138
+ end
139
+
140
+ #
141
+ # For the specified location and resource Provider, gets the quota requests
142
+ # under the subscription over the time
143
+ # period of one year ago from now to one year back, based on the filter
144
+ # specified.
145
+ #
146
+ # For the specified location and Resource provider gets the current quota
147
+ # requests under the subscription over the time period of one year ago from now
148
+ # to one year back. oData filter can be used to select quota requests.
149
+ #
150
+ # @param subscription_id [String] Azure subscription id.
151
+ # @param provider_id [String] Azure resource Provider id.
152
+ # @param location [String] Azure region.
153
+ # @param filter [String] | Field | Supported operators
154
+ # |---------------------|------------------------
155
+ #
156
+ # |requestSubmitTime | ge, le, eq, gt, lt
157
+ #
158
+ # @param top [Integer] Number of records to return.
159
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
160
+ # returned a partial result. If a previous response contains a nextLink
161
+ # element, the value of the nextLink element will include a skiptoken parameter
162
+ # that specifies a starting point to use for subsequent calls
163
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
164
+ # will be added to the HTTP request.
165
+ #
166
+ # @return [Array<QuotaRequestDetails>] operation results.
167
+ #
168
+ def list_status(subscription_id, provider_id, location, filter:nil, top:nil, skiptoken:nil, custom_headers:nil)
169
+ first_page = list_status_as_lazy(subscription_id, provider_id, location, filter:filter, top:top, skiptoken:skiptoken, custom_headers:custom_headers)
170
+ first_page.get_all_items
171
+ end
172
+
173
+ #
174
+ # For the specified location and resource Provider, gets the quota requests
175
+ # under the subscription over the time
176
+ # period of one year ago from now to one year back, based on the filter
177
+ # specified.
178
+ #
179
+ # For the specified location and Resource provider gets the current quota
180
+ # requests under the subscription over the time period of one year ago from now
181
+ # to one year back. oData filter can be used to select quota requests.
182
+ #
183
+ # @param subscription_id [String] Azure subscription id.
184
+ # @param provider_id [String] Azure resource Provider id.
185
+ # @param location [String] Azure region.
186
+ # @param filter [String] | Field | Supported operators
187
+ # |---------------------|------------------------
188
+ #
189
+ # |requestSubmitTime | ge, le, eq, gt, lt
190
+ #
191
+ # @param top [Integer] Number of records to return.
192
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
193
+ # returned a partial result. If a previous response contains a nextLink
194
+ # element, the value of the nextLink element will include a skiptoken parameter
195
+ # that specifies a starting point to use for subsequent calls
196
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
197
+ # will be added to the HTTP request.
198
+ #
199
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
200
+ #
201
+ def list_status_with_http_info(subscription_id, provider_id, location, filter:nil, top:nil, skiptoken:nil, custom_headers:nil)
202
+ list_status_async(subscription_id, provider_id, location, filter:filter, top:top, skiptoken:skiptoken, custom_headers:custom_headers).value!
203
+ end
204
+
205
+ #
206
+ # For the specified location and resource Provider, gets the quota requests
207
+ # under the subscription over the time
208
+ # period of one year ago from now to one year back, based on the filter
209
+ # specified.
210
+ #
211
+ # For the specified location and Resource provider gets the current quota
212
+ # requests under the subscription over the time period of one year ago from now
213
+ # to one year back. oData filter can be used to select quota requests.
214
+ #
215
+ # @param subscription_id [String] Azure subscription id.
216
+ # @param provider_id [String] Azure resource Provider id.
217
+ # @param location [String] Azure region.
218
+ # @param filter [String] | Field | Supported operators
219
+ # |---------------------|------------------------
220
+ #
221
+ # |requestSubmitTime | ge, le, eq, gt, lt
222
+ #
223
+ # @param top [Integer] Number of records to return.
224
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
225
+ # returned a partial result. If a previous response contains a nextLink
226
+ # element, the value of the nextLink element will include a skiptoken parameter
227
+ # that specifies a starting point to use for subsequent calls
228
+ # @param [Hash{String => String}] A hash of custom headers that will be added
229
+ # to the HTTP request.
230
+ #
231
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
232
+ #
233
+ def list_status_async(subscription_id, provider_id, location, filter:nil, top:nil, skiptoken:nil, custom_headers:nil)
234
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
235
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
236
+ fail ArgumentError, 'provider_id is nil' if provider_id.nil?
237
+ fail ArgumentError, 'location is nil' if location.nil?
238
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
239
+
240
+
241
+ request_headers = {}
242
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
243
+
244
+ # Set Headers
245
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
246
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
247
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests'
248
+
249
+ request_url = @base_url || @client.base_url
250
+
251
+ options = {
252
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
253
+ path_params: {'subscriptionId' => subscription_id,'providerId' => provider_id,'location' => location},
254
+ query_params: {'api-version' => @client.api_version,'$filter' => filter,'$top' => top,'$skiptoken' => skiptoken},
255
+ headers: request_headers.merge(custom_headers || {}),
256
+ base_url: request_url
257
+ }
258
+ promise = @client.make_request_async(:get, path_template, options)
259
+
260
+ promise = promise.then do |result|
261
+ http_response = result.response
262
+ status_code = http_response.status
263
+ response_content = http_response.body
264
+ unless status_code == 200
265
+ error_model = JSON.load(response_content)
266
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
267
+ end
268
+
269
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
270
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
271
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
272
+ # Deserialize Response
273
+ if status_code == 200
274
+ begin
275
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
276
+ result_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::QuotaRequestDetailsList.mapper()
277
+ result.body = @client.deserialize(result_mapper, parsed_response)
278
+ rescue Exception => e
279
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
280
+ end
281
+ end
282
+
283
+ result
284
+ end
285
+
286
+ promise.execute
287
+ end
288
+
289
+ #
290
+ # For the specified location and resource Provider, gets the quota requests
291
+ # under the subscription over the time
292
+ # period of one year ago from now to one year back, based on the filter
293
+ # specified.
294
+ #
295
+ # For the specified location and Resource provider gets the current quota
296
+ # requests under the subscription over the time period of one year ago from now
297
+ # to one year back. oData filter can be used to select quota requests.
298
+ #
299
+ # @param next_page_link [String] The NextLink from the previous successful call
300
+ # to List operation.
301
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
302
+ # will be added to the HTTP request.
303
+ #
304
+ # @return [QuotaRequestDetailsList] operation results.
305
+ #
306
+ def list_status_next(next_page_link, custom_headers:nil)
307
+ response = list_status_next_async(next_page_link, custom_headers:custom_headers).value!
308
+ response.body unless response.nil?
309
+ end
310
+
311
+ #
312
+ # For the specified location and resource Provider, gets the quota requests
313
+ # under the subscription over the time
314
+ # period of one year ago from now to one year back, based on the filter
315
+ # specified.
316
+ #
317
+ # For the specified location and Resource provider gets the current quota
318
+ # requests under the subscription over the time period of one year ago from now
319
+ # to one year back. oData filter can be used to select quota requests.
320
+ #
321
+ # @param next_page_link [String] The NextLink from the previous successful call
322
+ # to List operation.
323
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
324
+ # will be added to the HTTP request.
325
+ #
326
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
327
+ #
328
+ def list_status_next_with_http_info(next_page_link, custom_headers:nil)
329
+ list_status_next_async(next_page_link, custom_headers:custom_headers).value!
330
+ end
331
+
332
+ #
333
+ # For the specified location and resource Provider, gets the quota requests
334
+ # under the subscription over the time
335
+ # period of one year ago from now to one year back, based on the filter
336
+ # specified.
337
+ #
338
+ # For the specified location and Resource provider gets the current quota
339
+ # requests under the subscription over the time period of one year ago from now
340
+ # to one year back. oData filter can be used to select quota requests.
341
+ #
342
+ # @param next_page_link [String] The NextLink from the previous successful call
343
+ # to List operation.
344
+ # @param [Hash{String => String}] A hash of custom headers that will be added
345
+ # to the HTTP request.
346
+ #
347
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
348
+ #
349
+ def list_status_next_async(next_page_link, custom_headers:nil)
350
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
351
+
352
+
353
+ request_headers = {}
354
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
355
+
356
+ # Set Headers
357
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
358
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
359
+ path_template = '{nextLink}'
360
+
361
+ request_url = @base_url || @client.base_url
362
+
363
+ options = {
364
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
365
+ skip_encoding_path_params: {'nextLink' => next_page_link},
366
+ headers: request_headers.merge(custom_headers || {}),
367
+ base_url: request_url
368
+ }
369
+ promise = @client.make_request_async(:get, path_template, options)
370
+
371
+ promise = promise.then do |result|
372
+ http_response = result.response
373
+ status_code = http_response.status
374
+ response_content = http_response.body
375
+ unless status_code == 200
376
+ error_model = JSON.load(response_content)
377
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
378
+ end
379
+
380
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
381
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
382
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
383
+ # Deserialize Response
384
+ if status_code == 200
385
+ begin
386
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
387
+ result_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::QuotaRequestDetailsList.mapper()
388
+ result.body = @client.deserialize(result_mapper, parsed_response)
389
+ rescue Exception => e
390
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
391
+ end
392
+ end
393
+
394
+ result
395
+ end
396
+
397
+ promise.execute
398
+ end
399
+
400
+ #
401
+ # For the specified location and resource Provider, gets the quota requests
402
+ # under the subscription over the time
403
+ # period of one year ago from now to one year back, based on the filter
404
+ # specified.
405
+ #
406
+ # For the specified location and Resource provider gets the current quota
407
+ # requests under the subscription over the time period of one year ago from now
408
+ # to one year back. oData filter can be used to select quota requests.
409
+ #
410
+ # @param subscription_id [String] Azure subscription id.
411
+ # @param provider_id [String] Azure resource Provider id.
412
+ # @param location [String] Azure region.
413
+ # @param filter [String] | Field | Supported operators
414
+ # |---------------------|------------------------
415
+ #
416
+ # |requestSubmitTime | ge, le, eq, gt, lt
417
+ #
418
+ # @param top [Integer] Number of records to return.
419
+ # @param skiptoken [String] Skiptoken is only used if a previous operation
420
+ # returned a partial result. If a previous response contains a nextLink
421
+ # element, the value of the nextLink element will include a skiptoken parameter
422
+ # that specifies a starting point to use for subsequent calls
423
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
424
+ # will be added to the HTTP request.
425
+ #
426
+ # @return [QuotaRequestDetailsList] which provide lazy access to pages of the
427
+ # response.
428
+ #
429
+ def list_status_as_lazy(subscription_id, provider_id, location, filter:nil, top:nil, skiptoken:nil, custom_headers:nil)
430
+ response = list_status_async(subscription_id, provider_id, location, filter:filter, top:top, skiptoken:skiptoken, custom_headers:custom_headers).value!
431
+ unless response.nil?
432
+ page = response.body
433
+ page.next_method = Proc.new do |next_page_link|
434
+ list_status_next_async(next_page_link, custom_headers:custom_headers)
435
+ end
436
+ page
437
+ end
438
+ end
439
+
440
+ end
441
+ end
@@ -0,0 +1,269 @@
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::Reservations::Mgmt::V2019_07_19_preview
7
+ #
8
+ # Microsoft Azure Quota Resource Provider.
9
+ #
10
+ class Quotas
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Quotas class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ReservationsManagementClient] reference to the ReservationsManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets the current quota limit and usages for all the resources by the resource
26
+ # provider at the specified location.
27
+ #
28
+ # This API gets the current quota limits and usages for the resource provider
29
+ # for the specified location. This response can be used to submit
30
+ # quotaRequests.
31
+ #
32
+ # @param subscription_id [String] Azure subscription id.
33
+ # @param provider_id [String] Azure resource Provider id.
34
+ # @param location [String] Azure region.
35
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
36
+ # will be added to the HTTP request.
37
+ #
38
+ # @return [Array<CurrentQuotaLimitBase>] operation results.
39
+ #
40
+ def list_status(subscription_id, provider_id, location, custom_headers:nil)
41
+ first_page = list_status_as_lazy(subscription_id, provider_id, location, custom_headers:custom_headers)
42
+ first_page.get_all_items
43
+ end
44
+
45
+ #
46
+ # Gets the current quota limit and usages for all the resources by the resource
47
+ # provider at the specified location.
48
+ #
49
+ # This API gets the current quota limits and usages for the resource provider
50
+ # for the specified location. This response can be used to submit
51
+ # quotaRequests.
52
+ #
53
+ # @param subscription_id [String] Azure subscription id.
54
+ # @param provider_id [String] Azure resource Provider id.
55
+ # @param location [String] Azure region.
56
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
57
+ # will be added to the HTTP request.
58
+ #
59
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
60
+ #
61
+ def list_status_with_http_info(subscription_id, provider_id, location, custom_headers:nil)
62
+ list_status_async(subscription_id, provider_id, location, custom_headers:custom_headers).value!
63
+ end
64
+
65
+ #
66
+ # Gets the current quota limit and usages for all the resources by the resource
67
+ # provider at the specified location.
68
+ #
69
+ # This API gets the current quota limits and usages for the resource provider
70
+ # for the specified location. This response can be used to submit
71
+ # quotaRequests.
72
+ #
73
+ # @param subscription_id [String] Azure subscription id.
74
+ # @param provider_id [String] Azure resource Provider id.
75
+ # @param location [String] Azure region.
76
+ # @param [Hash{String => String}] A hash of custom headers that will be added
77
+ # to the HTTP request.
78
+ #
79
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
80
+ #
81
+ def list_status_async(subscription_id, provider_id, location, custom_headers:nil)
82
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
83
+ fail ArgumentError, 'provider_id is nil' if provider_id.nil?
84
+ fail ArgumentError, 'location is nil' if location.nil?
85
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
86
+
87
+
88
+ request_headers = {}
89
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
90
+
91
+ # Set Headers
92
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
93
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
94
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits'
95
+
96
+ request_url = @base_url || @client.base_url
97
+
98
+ options = {
99
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
100
+ path_params: {'subscriptionId' => subscription_id,'providerId' => provider_id,'location' => location},
101
+ query_params: {'api-version' => @client.api_version},
102
+ headers: request_headers.merge(custom_headers || {}),
103
+ base_url: request_url
104
+ }
105
+ promise = @client.make_request_async(:get, path_template, options)
106
+
107
+ promise = promise.then do |result|
108
+ http_response = result.response
109
+ status_code = http_response.status
110
+ response_content = http_response.body
111
+ unless status_code == 200
112
+ error_model = JSON.load(response_content)
113
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
114
+ end
115
+
116
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
117
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
118
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
119
+ # Deserialize Response
120
+ if status_code == 200
121
+ begin
122
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
123
+ result_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::QuotaLimits.mapper()
124
+ result.body = @client.deserialize(result_mapper, parsed_response)
125
+ rescue Exception => e
126
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
127
+ end
128
+ end
129
+
130
+ result
131
+ end
132
+
133
+ promise.execute
134
+ end
135
+
136
+ #
137
+ # Gets the current quota limit and usages for all the resources by the resource
138
+ # provider at the specified location.
139
+ #
140
+ # This API gets the current quota limits and usages for the resource provider
141
+ # for the specified location. This response can be used to submit
142
+ # quotaRequests.
143
+ #
144
+ # @param next_page_link [String] The NextLink from the previous successful call
145
+ # to List operation.
146
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
147
+ # will be added to the HTTP request.
148
+ #
149
+ # @return [QuotaLimits] operation results.
150
+ #
151
+ def list_status_next(next_page_link, custom_headers:nil)
152
+ response = list_status_next_async(next_page_link, custom_headers:custom_headers).value!
153
+ response.body unless response.nil?
154
+ end
155
+
156
+ #
157
+ # Gets the current quota limit and usages for all the resources by the resource
158
+ # provider at the specified location.
159
+ #
160
+ # This API gets the current quota limits and usages for the resource provider
161
+ # for the specified location. This response can be used to submit
162
+ # quotaRequests.
163
+ #
164
+ # @param next_page_link [String] The NextLink from the previous successful call
165
+ # to List operation.
166
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
167
+ # will be added to the HTTP request.
168
+ #
169
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
170
+ #
171
+ def list_status_next_with_http_info(next_page_link, custom_headers:nil)
172
+ list_status_next_async(next_page_link, custom_headers:custom_headers).value!
173
+ end
174
+
175
+ #
176
+ # Gets the current quota limit and usages for all the resources by the resource
177
+ # provider at the specified location.
178
+ #
179
+ # This API gets the current quota limits and usages for the resource provider
180
+ # for the specified location. This response can be used to submit
181
+ # quotaRequests.
182
+ #
183
+ # @param next_page_link [String] The NextLink from the previous successful call
184
+ # to List operation.
185
+ # @param [Hash{String => String}] A hash of custom headers that will be added
186
+ # to the HTTP request.
187
+ #
188
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
189
+ #
190
+ def list_status_next_async(next_page_link, custom_headers:nil)
191
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
192
+
193
+
194
+ request_headers = {}
195
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
196
+
197
+ # Set Headers
198
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
199
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
200
+ path_template = '{nextLink}'
201
+
202
+ request_url = @base_url || @client.base_url
203
+
204
+ options = {
205
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
206
+ skip_encoding_path_params: {'nextLink' => next_page_link},
207
+ headers: request_headers.merge(custom_headers || {}),
208
+ base_url: request_url
209
+ }
210
+ promise = @client.make_request_async(:get, path_template, options)
211
+
212
+ promise = promise.then do |result|
213
+ http_response = result.response
214
+ status_code = http_response.status
215
+ response_content = http_response.body
216
+ unless status_code == 200
217
+ error_model = JSON.load(response_content)
218
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
219
+ end
220
+
221
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
222
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
223
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
224
+ # Deserialize Response
225
+ if status_code == 200
226
+ begin
227
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
228
+ result_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::QuotaLimits.mapper()
229
+ result.body = @client.deserialize(result_mapper, parsed_response)
230
+ rescue Exception => e
231
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
232
+ end
233
+ end
234
+
235
+ result
236
+ end
237
+
238
+ promise.execute
239
+ end
240
+
241
+ #
242
+ # Gets the current quota limit and usages for all the resources by the resource
243
+ # provider at the specified location.
244
+ #
245
+ # This API gets the current quota limits and usages for the resource provider
246
+ # for the specified location. This response can be used to submit
247
+ # quotaRequests.
248
+ #
249
+ # @param subscription_id [String] Azure subscription id.
250
+ # @param provider_id [String] Azure resource Provider id.
251
+ # @param location [String] Azure region.
252
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
253
+ # will be added to the HTTP request.
254
+ #
255
+ # @return [QuotaLimits] which provide lazy access to pages of the response.
256
+ #
257
+ def list_status_as_lazy(subscription_id, provider_id, location, custom_headers:nil)
258
+ response = list_status_async(subscription_id, provider_id, location, custom_headers:custom_headers).value!
259
+ unless response.nil?
260
+ page = response.body
261
+ page.next_method = Proc.new do |next_page_link|
262
+ list_status_next_async(next_page_link, custom_headers:custom_headers)
263
+ end
264
+ page
265
+ end
266
+ end
267
+
268
+ end
269
+ end