azure_mgmt_batch 0.4.0

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 (35) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/Rakefile +5 -0
  5. data/azure_mgmt_batch.gemspec +34 -0
  6. data/lib/azure_mgmt_batch.rb +5 -0
  7. data/lib/generated/azure_mgmt_batch.rb +51 -0
  8. data/lib/generated/azure_mgmt_batch/account.rb +1263 -0
  9. data/lib/generated/azure_mgmt_batch/application_operations.rb +1068 -0
  10. data/lib/generated/azure_mgmt_batch/batch_management_client.rb +75 -0
  11. data/lib/generated/azure_mgmt_batch/models/account_key_type.rb +16 -0
  12. data/lib/generated/azure_mgmt_batch/models/account_provisioning_state.rb +20 -0
  13. data/lib/generated/azure_mgmt_batch/models/account_resource.rb +146 -0
  14. data/lib/generated/azure_mgmt_batch/models/activate_application_package_parameters.rb +45 -0
  15. data/lib/generated/azure_mgmt_batch/models/add_application_package_result.rb +75 -0
  16. data/lib/generated/azure_mgmt_batch/models/add_application_parameters.rb +55 -0
  17. data/lib/generated/azure_mgmt_batch/models/application.rb +96 -0
  18. data/lib/generated/azure_mgmt_batch/models/application_package.rb +78 -0
  19. data/lib/generated/azure_mgmt_batch/models/auto_storage_base_properties.rb +45 -0
  20. data/lib/generated/azure_mgmt_batch/models/auto_storage_properties.rb +57 -0
  21. data/lib/generated/azure_mgmt_batch/models/batch_account_create_parameters.rb +74 -0
  22. data/lib/generated/azure_mgmt_batch/models/batch_account_list_key_result.rb +54 -0
  23. data/lib/generated/azure_mgmt_batch/models/batch_account_list_result.rb +94 -0
  24. data/lib/generated/azure_mgmt_batch/models/batch_account_regenerate_key_parameters.rb +46 -0
  25. data/lib/generated/azure_mgmt_batch/models/batch_account_regenerate_key_result.rb +54 -0
  26. data/lib/generated/azure_mgmt_batch/models/batch_account_update_parameters.rb +64 -0
  27. data/lib/generated/azure_mgmt_batch/models/get_application_package_result.rb +109 -0
  28. data/lib/generated/azure_mgmt_batch/models/list_applications_result.rb +93 -0
  29. data/lib/generated/azure_mgmt_batch/models/package_state.rb +17 -0
  30. data/lib/generated/azure_mgmt_batch/models/subscription_quotas_get_result.rb +45 -0
  31. data/lib/generated/azure_mgmt_batch/models/update_application_parameters.rb +66 -0
  32. data/lib/generated/azure_mgmt_batch/module_definition.rb +8 -0
  33. data/lib/generated/azure_mgmt_batch/subscription.rb +116 -0
  34. data/lib/generated/azure_mgmt_batch/version.rb +8 -0
  35. metadata +147 -0
@@ -0,0 +1,1068 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Batch
7
+ #
8
+ # ApplicationOperations
9
+ #
10
+ class ApplicationOperations
11
+ include Azure::ARM::Batch::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the ApplicationOperations class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return reference to the BatchManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Activates the specified application package.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group that
29
+ # contains the Batch account.
30
+ # @param account_name [String] The name of the Batch account.
31
+ # @param id [String] The id of the application.
32
+ # @param version [String] The version of the application to activate.
33
+ # @param parameters [ActivateApplicationPackageParameters] The parameters for
34
+ # the request.
35
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
36
+ # will be added to the HTTP request.
37
+ #
38
+ #
39
+ def activate_application_package(resource_group_name, account_name, id, version, parameters, custom_headers = nil)
40
+ response = activate_application_package_async(resource_group_name, account_name, id, version, parameters, custom_headers).value!
41
+ nil
42
+ end
43
+
44
+ #
45
+ # Activates the specified application package.
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group that
48
+ # contains the Batch account.
49
+ # @param account_name [String] The name of the Batch account.
50
+ # @param id [String] The id of the application.
51
+ # @param version [String] The version of the application to activate.
52
+ # @param parameters [ActivateApplicationPackageParameters] The parameters for
53
+ # the request.
54
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
55
+ # will be added to the HTTP request.
56
+ #
57
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
58
+ #
59
+ def activate_application_package_with_http_info(resource_group_name, account_name, id, version, parameters, custom_headers = nil)
60
+ activate_application_package_async(resource_group_name, account_name, id, version, parameters, custom_headers).value!
61
+ end
62
+
63
+ #
64
+ # Activates the specified application package.
65
+ #
66
+ # @param resource_group_name [String] The name of the resource group that
67
+ # contains the Batch account.
68
+ # @param account_name [String] The name of the Batch account.
69
+ # @param id [String] The id of the application.
70
+ # @param version [String] The version of the application to activate.
71
+ # @param parameters [ActivateApplicationPackageParameters] The parameters for
72
+ # the request.
73
+ # @param [Hash{String => String}] A hash of custom headers that will be added
74
+ # to the HTTP request.
75
+ #
76
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
77
+ #
78
+ def activate_application_package_async(resource_group_name, account_name, id, version, parameters, custom_headers = nil)
79
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
80
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
81
+ fail ArgumentError, 'id is nil' if id.nil?
82
+ fail ArgumentError, 'version is nil' if version.nil?
83
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
84
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
85
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
86
+
87
+
88
+ request_headers = {}
89
+
90
+ # Set Headers
91
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
92
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
93
+
94
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
95
+
96
+ # Serialize Request
97
+ request_mapper = ActivateApplicationPackageParameters.mapper()
98
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
99
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
100
+
101
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{id}/versions/{version}/activate'
102
+ options = {
103
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
104
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'id' => id,'version' => version,'subscriptionId' => @client.subscription_id},
105
+ query_params: {'api-version' => @client.api_version},
106
+ body: request_content,
107
+ headers: request_headers.merge(custom_headers || {})
108
+ }
109
+
110
+ request_url = @base_url || @client.base_url
111
+
112
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
113
+ promise = request.run_promise do |req|
114
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
115
+ end
116
+
117
+ promise = promise.then do |http_response|
118
+ status_code = http_response.status
119
+ response_content = http_response.body
120
+ unless status_code == 204
121
+ error_model = JSON.load(response_content)
122
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
123
+ end
124
+
125
+ # Create Result
126
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
127
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
128
+
129
+ result
130
+ end
131
+
132
+ promise.execute
133
+ end
134
+
135
+ #
136
+ # Adds an application to the specified Batch account.
137
+ #
138
+ # @param resource_group_name [String] The name of the resource group that
139
+ # contains the Batch account.
140
+ # @param account_name [String] The name of the Batch account.
141
+ # @param application_id [String] The id of the application.
142
+ # @param parameters [AddApplicationParameters] The parameters for the request.
143
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
144
+ # will be added to the HTTP request.
145
+ #
146
+ # @return [Application] operation results.
147
+ #
148
+ def add_application(resource_group_name, account_name, application_id, parameters = nil, custom_headers = nil)
149
+ response = add_application_async(resource_group_name, account_name, application_id, parameters, custom_headers).value!
150
+ response.body unless response.nil?
151
+ end
152
+
153
+ #
154
+ # Adds an application to the specified Batch account.
155
+ #
156
+ # @param resource_group_name [String] The name of the resource group that
157
+ # contains the Batch account.
158
+ # @param account_name [String] The name of the Batch account.
159
+ # @param application_id [String] The id of the application.
160
+ # @param parameters [AddApplicationParameters] The parameters for the request.
161
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
162
+ # will be added to the HTTP request.
163
+ #
164
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
165
+ #
166
+ def add_application_with_http_info(resource_group_name, account_name, application_id, parameters = nil, custom_headers = nil)
167
+ add_application_async(resource_group_name, account_name, application_id, parameters, custom_headers).value!
168
+ end
169
+
170
+ #
171
+ # Adds an application to the specified Batch account.
172
+ #
173
+ # @param resource_group_name [String] The name of the resource group that
174
+ # contains the Batch account.
175
+ # @param account_name [String] The name of the Batch account.
176
+ # @param application_id [String] The id of the application.
177
+ # @param parameters [AddApplicationParameters] The parameters for the request.
178
+ # @param [Hash{String => String}] A hash of custom headers that will be added
179
+ # to the HTTP request.
180
+ #
181
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
182
+ #
183
+ def add_application_async(resource_group_name, account_name, application_id, parameters = nil, custom_headers = nil)
184
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
185
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
186
+ fail ArgumentError, 'application_id is nil' if application_id.nil?
187
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
188
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
189
+
190
+
191
+ request_headers = {}
192
+
193
+ # Set Headers
194
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
195
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
196
+
197
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
198
+
199
+ # Serialize Request
200
+ request_mapper = AddApplicationParameters.mapper()
201
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
202
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
203
+
204
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}'
205
+ options = {
206
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
207
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'applicationId' => application_id,'subscriptionId' => @client.subscription_id},
208
+ query_params: {'api-version' => @client.api_version},
209
+ body: request_content,
210
+ headers: request_headers.merge(custom_headers || {})
211
+ }
212
+
213
+ request_url = @base_url || @client.base_url
214
+
215
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
216
+ promise = request.run_promise do |req|
217
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
218
+ end
219
+
220
+ promise = promise.then do |http_response|
221
+ status_code = http_response.status
222
+ response_content = http_response.body
223
+ unless status_code == 201
224
+ error_model = JSON.load(response_content)
225
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
226
+ end
227
+
228
+ # Create Result
229
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
230
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
231
+ # Deserialize Response
232
+ if status_code == 201
233
+ begin
234
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
235
+ result_mapper = Application.mapper()
236
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
237
+ rescue Exception => e
238
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
239
+ end
240
+ end
241
+
242
+ result
243
+ end
244
+
245
+ promise.execute
246
+ end
247
+
248
+ #
249
+ # Deletes an application.
250
+ #
251
+ # @param resource_group_name [String] The name of the resource group that
252
+ # contains the Batch account.
253
+ # @param account_name [String] The name of the Batch account.
254
+ # @param application_id [String] The id of the application.
255
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
256
+ # will be added to the HTTP request.
257
+ #
258
+ #
259
+ def delete_application(resource_group_name, account_name, application_id, custom_headers = nil)
260
+ response = delete_application_async(resource_group_name, account_name, application_id, custom_headers).value!
261
+ nil
262
+ end
263
+
264
+ #
265
+ # Deletes an application.
266
+ #
267
+ # @param resource_group_name [String] The name of the resource group that
268
+ # contains the Batch account.
269
+ # @param account_name [String] The name of the Batch account.
270
+ # @param application_id [String] The id of the application.
271
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
272
+ # will be added to the HTTP request.
273
+ #
274
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
275
+ #
276
+ def delete_application_with_http_info(resource_group_name, account_name, application_id, custom_headers = nil)
277
+ delete_application_async(resource_group_name, account_name, application_id, custom_headers).value!
278
+ end
279
+
280
+ #
281
+ # Deletes an application.
282
+ #
283
+ # @param resource_group_name [String] The name of the resource group that
284
+ # contains the Batch account.
285
+ # @param account_name [String] The name of the Batch account.
286
+ # @param application_id [String] The id of the application.
287
+ # @param [Hash{String => String}] A hash of custom headers that will be added
288
+ # to the HTTP request.
289
+ #
290
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
291
+ #
292
+ def delete_application_async(resource_group_name, account_name, application_id, custom_headers = nil)
293
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
294
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
295
+ fail ArgumentError, 'application_id is nil' if application_id.nil?
296
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
297
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
298
+
299
+
300
+ request_headers = {}
301
+
302
+ # Set Headers
303
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
304
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
305
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}'
306
+ options = {
307
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
308
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'applicationId' => application_id,'subscriptionId' => @client.subscription_id},
309
+ query_params: {'api-version' => @client.api_version},
310
+ headers: request_headers.merge(custom_headers || {})
311
+ }
312
+
313
+ request_url = @base_url || @client.base_url
314
+
315
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
316
+ promise = request.run_promise do |req|
317
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
318
+ end
319
+
320
+ promise = promise.then do |http_response|
321
+ status_code = http_response.status
322
+ response_content = http_response.body
323
+ unless status_code == 204
324
+ error_model = JSON.load(response_content)
325
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
326
+ end
327
+
328
+ # Create Result
329
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
330
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
331
+
332
+ result
333
+ end
334
+
335
+ promise.execute
336
+ end
337
+
338
+ #
339
+ # Gets information about the specified application.
340
+ #
341
+ # @param resource_group_name [String] The name of the resource group that
342
+ # contains the Batch account.
343
+ # @param account_name [String] The name of the Batch account.
344
+ # @param application_id [String] The id of the application.
345
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
346
+ # will be added to the HTTP request.
347
+ #
348
+ # @return [Application] operation results.
349
+ #
350
+ def get_application(resource_group_name, account_name, application_id, custom_headers = nil)
351
+ response = get_application_async(resource_group_name, account_name, application_id, custom_headers).value!
352
+ response.body unless response.nil?
353
+ end
354
+
355
+ #
356
+ # Gets information about the specified application.
357
+ #
358
+ # @param resource_group_name [String] The name of the resource group that
359
+ # contains the Batch account.
360
+ # @param account_name [String] The name of the Batch account.
361
+ # @param application_id [String] The id of the application.
362
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
363
+ # will be added to the HTTP request.
364
+ #
365
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
366
+ #
367
+ def get_application_with_http_info(resource_group_name, account_name, application_id, custom_headers = nil)
368
+ get_application_async(resource_group_name, account_name, application_id, custom_headers).value!
369
+ end
370
+
371
+ #
372
+ # Gets information about the specified application.
373
+ #
374
+ # @param resource_group_name [String] The name of the resource group that
375
+ # contains the Batch account.
376
+ # @param account_name [String] The name of the Batch account.
377
+ # @param application_id [String] The id of the application.
378
+ # @param [Hash{String => String}] A hash of custom headers that will be added
379
+ # to the HTTP request.
380
+ #
381
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
382
+ #
383
+ def get_application_async(resource_group_name, account_name, application_id, custom_headers = nil)
384
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
385
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
386
+ fail ArgumentError, 'application_id is nil' if application_id.nil?
387
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
388
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
389
+
390
+
391
+ request_headers = {}
392
+
393
+ # Set Headers
394
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
395
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
396
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}'
397
+ options = {
398
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
399
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'applicationId' => application_id,'subscriptionId' => @client.subscription_id},
400
+ query_params: {'api-version' => @client.api_version},
401
+ headers: request_headers.merge(custom_headers || {})
402
+ }
403
+
404
+ request_url = @base_url || @client.base_url
405
+
406
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
407
+ promise = request.run_promise do |req|
408
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
409
+ end
410
+
411
+ promise = promise.then do |http_response|
412
+ status_code = http_response.status
413
+ response_content = http_response.body
414
+ unless status_code == 200
415
+ error_model = JSON.load(response_content)
416
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
417
+ end
418
+
419
+ # Create Result
420
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
421
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
422
+ # Deserialize Response
423
+ if status_code == 200
424
+ begin
425
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
426
+ result_mapper = Application.mapper()
427
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
428
+ rescue Exception => e
429
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
430
+ end
431
+ end
432
+
433
+ result
434
+ end
435
+
436
+ promise.execute
437
+ end
438
+
439
+ #
440
+ # Updates settings for the specified application.
441
+ #
442
+ # @param resource_group_name [String] The name of the resource group that
443
+ # contains the Batch account.
444
+ # @param account_name [String] The name of the Batch account.
445
+ # @param application_id [String] The id of the application.
446
+ # @param parameters [UpdateApplicationParameters] The parameters for the
447
+ # request.
448
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
449
+ # will be added to the HTTP request.
450
+ #
451
+ #
452
+ def update_application(resource_group_name, account_name, application_id, parameters, custom_headers = nil)
453
+ response = update_application_async(resource_group_name, account_name, application_id, parameters, custom_headers).value!
454
+ nil
455
+ end
456
+
457
+ #
458
+ # Updates settings for the specified application.
459
+ #
460
+ # @param resource_group_name [String] The name of the resource group that
461
+ # contains the Batch account.
462
+ # @param account_name [String] The name of the Batch account.
463
+ # @param application_id [String] The id of the application.
464
+ # @param parameters [UpdateApplicationParameters] The parameters for the
465
+ # request.
466
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
467
+ # will be added to the HTTP request.
468
+ #
469
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
470
+ #
471
+ def update_application_with_http_info(resource_group_name, account_name, application_id, parameters, custom_headers = nil)
472
+ update_application_async(resource_group_name, account_name, application_id, parameters, custom_headers).value!
473
+ end
474
+
475
+ #
476
+ # Updates settings for the specified application.
477
+ #
478
+ # @param resource_group_name [String] The name of the resource group that
479
+ # contains the Batch account.
480
+ # @param account_name [String] The name of the Batch account.
481
+ # @param application_id [String] The id of the application.
482
+ # @param parameters [UpdateApplicationParameters] The parameters for the
483
+ # request.
484
+ # @param [Hash{String => String}] A hash of custom headers that will be added
485
+ # to the HTTP request.
486
+ #
487
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
488
+ #
489
+ def update_application_async(resource_group_name, account_name, application_id, parameters, custom_headers = nil)
490
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
491
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
492
+ fail ArgumentError, 'application_id is nil' if application_id.nil?
493
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
494
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
495
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
496
+
497
+
498
+ request_headers = {}
499
+
500
+ # Set Headers
501
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
502
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
503
+
504
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
505
+
506
+ # Serialize Request
507
+ request_mapper = UpdateApplicationParameters.mapper()
508
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
509
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
510
+
511
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}'
512
+ options = {
513
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
514
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'applicationId' => application_id,'subscriptionId' => @client.subscription_id},
515
+ query_params: {'api-version' => @client.api_version},
516
+ body: request_content,
517
+ headers: request_headers.merge(custom_headers || {})
518
+ }
519
+
520
+ request_url = @base_url || @client.base_url
521
+
522
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
523
+ promise = request.run_promise do |req|
524
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
525
+ end
526
+
527
+ promise = promise.then do |http_response|
528
+ status_code = http_response.status
529
+ response_content = http_response.body
530
+ unless status_code == 204
531
+ error_model = JSON.load(response_content)
532
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
533
+ end
534
+
535
+ # Create Result
536
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
537
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
538
+
539
+ result
540
+ end
541
+
542
+ promise.execute
543
+ end
544
+
545
+ #
546
+ # Creates an application package record.
547
+ #
548
+ # @param resource_group_name [String] The name of the resource group that
549
+ # contains the Batch account.
550
+ # @param account_name [String] The name of the Batch account.
551
+ # @param application_id [String] The id of the application.
552
+ # @param version [String] The version of the application.
553
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
554
+ # will be added to the HTTP request.
555
+ #
556
+ # @return [AddApplicationPackageResult] operation results.
557
+ #
558
+ def add_application_package(resource_group_name, account_name, application_id, version, custom_headers = nil)
559
+ response = add_application_package_async(resource_group_name, account_name, application_id, version, custom_headers).value!
560
+ response.body unless response.nil?
561
+ end
562
+
563
+ #
564
+ # Creates an application package record.
565
+ #
566
+ # @param resource_group_name [String] The name of the resource group that
567
+ # contains the Batch account.
568
+ # @param account_name [String] The name of the Batch account.
569
+ # @param application_id [String] The id of the application.
570
+ # @param version [String] The version of the application.
571
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
572
+ # will be added to the HTTP request.
573
+ #
574
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
575
+ #
576
+ def add_application_package_with_http_info(resource_group_name, account_name, application_id, version, custom_headers = nil)
577
+ add_application_package_async(resource_group_name, account_name, application_id, version, custom_headers).value!
578
+ end
579
+
580
+ #
581
+ # Creates an application package record.
582
+ #
583
+ # @param resource_group_name [String] The name of the resource group that
584
+ # contains the Batch account.
585
+ # @param account_name [String] The name of the Batch account.
586
+ # @param application_id [String] The id of the application.
587
+ # @param version [String] The version of the application.
588
+ # @param [Hash{String => String}] A hash of custom headers that will be added
589
+ # to the HTTP request.
590
+ #
591
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
592
+ #
593
+ def add_application_package_async(resource_group_name, account_name, application_id, version, custom_headers = nil)
594
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
595
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
596
+ fail ArgumentError, 'application_id is nil' if application_id.nil?
597
+ fail ArgumentError, 'version is nil' if version.nil?
598
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
599
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
600
+
601
+
602
+ request_headers = {}
603
+
604
+ # Set Headers
605
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
606
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
607
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}'
608
+ options = {
609
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
610
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'applicationId' => application_id,'version' => version,'subscriptionId' => @client.subscription_id},
611
+ query_params: {'api-version' => @client.api_version},
612
+ headers: request_headers.merge(custom_headers || {})
613
+ }
614
+
615
+ request_url = @base_url || @client.base_url
616
+
617
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
618
+ promise = request.run_promise do |req|
619
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
620
+ end
621
+
622
+ promise = promise.then do |http_response|
623
+ status_code = http_response.status
624
+ response_content = http_response.body
625
+ unless status_code == 201
626
+ error_model = JSON.load(response_content)
627
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
628
+ end
629
+
630
+ # Create Result
631
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
632
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
633
+ # Deserialize Response
634
+ if status_code == 201
635
+ begin
636
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
637
+ result_mapper = AddApplicationPackageResult.mapper()
638
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
639
+ rescue Exception => e
640
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
641
+ end
642
+ end
643
+
644
+ result
645
+ end
646
+
647
+ promise.execute
648
+ end
649
+
650
+ #
651
+ # Deletes an application package record and its associated binary file.
652
+ #
653
+ # @param resource_group_name [String] The name of the resource group that
654
+ # contains the Batch account.
655
+ # @param account_name [String] The name of the Batch account.
656
+ # @param application_id [String] The id of the application.
657
+ # @param version [String] The version of the application to delete.
658
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
659
+ # will be added to the HTTP request.
660
+ #
661
+ #
662
+ def delete_application_package(resource_group_name, account_name, application_id, version, custom_headers = nil)
663
+ response = delete_application_package_async(resource_group_name, account_name, application_id, version, custom_headers).value!
664
+ nil
665
+ end
666
+
667
+ #
668
+ # Deletes an application package record and its associated binary file.
669
+ #
670
+ # @param resource_group_name [String] The name of the resource group that
671
+ # contains the Batch account.
672
+ # @param account_name [String] The name of the Batch account.
673
+ # @param application_id [String] The id of the application.
674
+ # @param version [String] The version of the application to delete.
675
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
676
+ # will be added to the HTTP request.
677
+ #
678
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
679
+ #
680
+ def delete_application_package_with_http_info(resource_group_name, account_name, application_id, version, custom_headers = nil)
681
+ delete_application_package_async(resource_group_name, account_name, application_id, version, custom_headers).value!
682
+ end
683
+
684
+ #
685
+ # Deletes an application package record and its associated binary file.
686
+ #
687
+ # @param resource_group_name [String] The name of the resource group that
688
+ # contains the Batch account.
689
+ # @param account_name [String] The name of the Batch account.
690
+ # @param application_id [String] The id of the application.
691
+ # @param version [String] The version of the application to delete.
692
+ # @param [Hash{String => String}] A hash of custom headers that will be added
693
+ # to the HTTP request.
694
+ #
695
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
696
+ #
697
+ def delete_application_package_async(resource_group_name, account_name, application_id, version, custom_headers = nil)
698
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
699
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
700
+ fail ArgumentError, 'application_id is nil' if application_id.nil?
701
+ fail ArgumentError, 'version is nil' if version.nil?
702
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
703
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
704
+
705
+
706
+ request_headers = {}
707
+
708
+ # Set Headers
709
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
710
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
711
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}'
712
+ options = {
713
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
714
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'applicationId' => application_id,'version' => version,'subscriptionId' => @client.subscription_id},
715
+ query_params: {'api-version' => @client.api_version},
716
+ headers: request_headers.merge(custom_headers || {})
717
+ }
718
+
719
+ request_url = @base_url || @client.base_url
720
+
721
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
722
+ promise = request.run_promise do |req|
723
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
724
+ end
725
+
726
+ promise = promise.then do |http_response|
727
+ status_code = http_response.status
728
+ response_content = http_response.body
729
+ unless status_code == 204
730
+ error_model = JSON.load(response_content)
731
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
732
+ end
733
+
734
+ # Create Result
735
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
736
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
737
+
738
+ result
739
+ end
740
+
741
+ promise.execute
742
+ end
743
+
744
+ #
745
+ # Gets information about the specified application package.
746
+ #
747
+ # @param resource_group_name [String] The name of the resource group that
748
+ # contains the Batch account.
749
+ # @param account_name [String] The name of the Batch account.
750
+ # @param application_id [String] The id of the application.
751
+ # @param version [String] The version of the application.
752
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
753
+ # will be added to the HTTP request.
754
+ #
755
+ # @return [GetApplicationPackageResult] operation results.
756
+ #
757
+ def get_application_package(resource_group_name, account_name, application_id, version, custom_headers = nil)
758
+ response = get_application_package_async(resource_group_name, account_name, application_id, version, custom_headers).value!
759
+ response.body unless response.nil?
760
+ end
761
+
762
+ #
763
+ # Gets information about the specified application package.
764
+ #
765
+ # @param resource_group_name [String] The name of the resource group that
766
+ # contains the Batch account.
767
+ # @param account_name [String] The name of the Batch account.
768
+ # @param application_id [String] The id of the application.
769
+ # @param version [String] The version of the application.
770
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
771
+ # will be added to the HTTP request.
772
+ #
773
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
774
+ #
775
+ def get_application_package_with_http_info(resource_group_name, account_name, application_id, version, custom_headers = nil)
776
+ get_application_package_async(resource_group_name, account_name, application_id, version, custom_headers).value!
777
+ end
778
+
779
+ #
780
+ # Gets information about the specified application package.
781
+ #
782
+ # @param resource_group_name [String] The name of the resource group that
783
+ # contains the Batch account.
784
+ # @param account_name [String] The name of the Batch account.
785
+ # @param application_id [String] The id of the application.
786
+ # @param version [String] The version of the application.
787
+ # @param [Hash{String => String}] A hash of custom headers that will be added
788
+ # to the HTTP request.
789
+ #
790
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
791
+ #
792
+ def get_application_package_async(resource_group_name, account_name, application_id, version, custom_headers = nil)
793
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
794
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
795
+ fail ArgumentError, 'application_id is nil' if application_id.nil?
796
+ fail ArgumentError, 'version is nil' if version.nil?
797
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
798
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
799
+
800
+
801
+ request_headers = {}
802
+
803
+ # Set Headers
804
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
805
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
806
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}'
807
+ options = {
808
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
809
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'applicationId' => application_id,'version' => version,'subscriptionId' => @client.subscription_id},
810
+ query_params: {'api-version' => @client.api_version},
811
+ headers: request_headers.merge(custom_headers || {})
812
+ }
813
+
814
+ request_url = @base_url || @client.base_url
815
+
816
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
817
+ promise = request.run_promise do |req|
818
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
819
+ end
820
+
821
+ promise = promise.then do |http_response|
822
+ status_code = http_response.status
823
+ response_content = http_response.body
824
+ unless status_code == 200
825
+ error_model = JSON.load(response_content)
826
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
827
+ end
828
+
829
+ # Create Result
830
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
831
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
832
+ # Deserialize Response
833
+ if status_code == 200
834
+ begin
835
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
836
+ result_mapper = GetApplicationPackageResult.mapper()
837
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
838
+ rescue Exception => e
839
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
840
+ end
841
+ end
842
+
843
+ result
844
+ end
845
+
846
+ promise.execute
847
+ end
848
+
849
+ #
850
+ # Lists all of the applications in the specified account.
851
+ #
852
+ # @param resource_group_name [String] The name of the resource group that
853
+ # contains the Batch account.
854
+ # @param account_name [String] The name of the Batch account.
855
+ # @param maxresults [Integer] The maximum number of items to return in the
856
+ # response.
857
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
858
+ # will be added to the HTTP request.
859
+ #
860
+ # @return [ListApplicationsResult] which provide lazy access to pages of the
861
+ # response.
862
+ #
863
+ def list_as_lazy(resource_group_name, account_name, maxresults = nil, custom_headers = nil)
864
+ response = list_async(resource_group_name, account_name, maxresults, custom_headers).value!
865
+ unless response.nil?
866
+ page = response.body
867
+ page.next_method = Proc.new do |next_link|
868
+ list_next_async(next_link, custom_headers)
869
+ end
870
+ page
871
+ end
872
+ end
873
+
874
+ #
875
+ # Lists all of the applications in the specified account.
876
+ #
877
+ # @param resource_group_name [String] The name of the resource group that
878
+ # contains the Batch account.
879
+ # @param account_name [String] The name of the Batch account.
880
+ # @param maxresults [Integer] The maximum number of items to return in the
881
+ # response.
882
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
883
+ # will be added to the HTTP request.
884
+ #
885
+ # @return [Array<Application>] operation results.
886
+ #
887
+ def list(resource_group_name, account_name, maxresults = nil, custom_headers = nil)
888
+ first_page = list_as_lazy(resource_group_name, account_name, maxresults, custom_headers)
889
+ first_page.get_all_items
890
+ end
891
+
892
+ #
893
+ # Lists all of the applications in the specified account.
894
+ #
895
+ # @param resource_group_name [String] The name of the resource group that
896
+ # contains the Batch account.
897
+ # @param account_name [String] The name of the Batch account.
898
+ # @param maxresults [Integer] The maximum number of items to return in the
899
+ # response.
900
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
901
+ # will be added to the HTTP request.
902
+ #
903
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
904
+ #
905
+ def list_with_http_info(resource_group_name, account_name, maxresults = nil, custom_headers = nil)
906
+ list_async(resource_group_name, account_name, maxresults, custom_headers).value!
907
+ end
908
+
909
+ #
910
+ # Lists all of the applications in the specified account.
911
+ #
912
+ # @param resource_group_name [String] The name of the resource group that
913
+ # contains the Batch account.
914
+ # @param account_name [String] The name of the Batch account.
915
+ # @param maxresults [Integer] The maximum number of items to return in the
916
+ # response.
917
+ # @param [Hash{String => String}] A hash of custom headers that will be added
918
+ # to the HTTP request.
919
+ #
920
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
921
+ #
922
+ def list_async(resource_group_name, account_name, maxresults = nil, custom_headers = nil)
923
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
924
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
925
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
926
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
927
+
928
+
929
+ request_headers = {}
930
+
931
+ # Set Headers
932
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
933
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
934
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications'
935
+ options = {
936
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
937
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
938
+ query_params: {'maxresults' => maxresults,'api-version' => @client.api_version},
939
+ headers: request_headers.merge(custom_headers || {})
940
+ }
941
+
942
+ request_url = @base_url || @client.base_url
943
+
944
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
945
+ promise = request.run_promise do |req|
946
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
947
+ end
948
+
949
+ promise = promise.then do |http_response|
950
+ status_code = http_response.status
951
+ response_content = http_response.body
952
+ unless status_code == 200
953
+ error_model = JSON.load(response_content)
954
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
955
+ end
956
+
957
+ # Create Result
958
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
959
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
960
+ # Deserialize Response
961
+ if status_code == 200
962
+ begin
963
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
964
+ result_mapper = ListApplicationsResult.mapper()
965
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
966
+ rescue Exception => e
967
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
968
+ end
969
+ end
970
+
971
+ result
972
+ end
973
+
974
+ promise.execute
975
+ end
976
+
977
+ #
978
+ # Lists all of the applications in the specified account.
979
+ #
980
+ # @param next_page_link [String] The NextLink from the previous successful
981
+ # call to List operation.
982
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
983
+ # will be added to the HTTP request.
984
+ #
985
+ # @return [ListApplicationsResult] operation results.
986
+ #
987
+ def list_next(next_page_link, custom_headers = nil)
988
+ response = list_next_async(next_page_link, custom_headers).value!
989
+ response.body unless response.nil?
990
+ end
991
+
992
+ #
993
+ # Lists all of the applications in the specified account.
994
+ #
995
+ # @param next_page_link [String] The NextLink from the previous successful
996
+ # call to List operation.
997
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
998
+ # will be added to the HTTP request.
999
+ #
1000
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1001
+ #
1002
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
1003
+ list_next_async(next_page_link, custom_headers).value!
1004
+ end
1005
+
1006
+ #
1007
+ # Lists all of the applications in the specified account.
1008
+ #
1009
+ # @param next_page_link [String] The NextLink from the previous successful
1010
+ # call to List operation.
1011
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1012
+ # to the HTTP request.
1013
+ #
1014
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1015
+ #
1016
+ def list_next_async(next_page_link, custom_headers = nil)
1017
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1018
+
1019
+
1020
+ request_headers = {}
1021
+
1022
+ # Set Headers
1023
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1024
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1025
+ path_template = '{nextLink}'
1026
+ options = {
1027
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1028
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1029
+ headers: request_headers.merge(custom_headers || {})
1030
+ }
1031
+
1032
+ request_url = @base_url || @client.base_url
1033
+
1034
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
1035
+ promise = request.run_promise do |req|
1036
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1037
+ end
1038
+
1039
+ promise = promise.then do |http_response|
1040
+ status_code = http_response.status
1041
+ response_content = http_response.body
1042
+ unless status_code == 200
1043
+ error_model = JSON.load(response_content)
1044
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
1045
+ end
1046
+
1047
+ # Create Result
1048
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1049
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1050
+ # Deserialize Response
1051
+ if status_code == 200
1052
+ begin
1053
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1054
+ result_mapper = ListApplicationsResult.mapper()
1055
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1056
+ rescue Exception => e
1057
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1058
+ end
1059
+ end
1060
+
1061
+ result
1062
+ end
1063
+
1064
+ promise.execute
1065
+ end
1066
+
1067
+ end
1068
+ end