azure_mgmt_batch 0.6.0 → 0.7.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.
@@ -0,0 +1,428 @@
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
+ # ApplicationPackageOperations
9
+ #
10
+ class ApplicationPackageOperations
11
+ include Azure::ARM::Batch::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the ApplicationPackageOperations class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [BatchManagementClient] 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 application_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(resource_group_name, account_name, application_id, version, parameters, custom_headers = nil)
40
+ response = activate_async(resource_group_name, account_name, application_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 application_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_with_http_info(resource_group_name, account_name, application_id, version, parameters, custom_headers = nil)
60
+ activate_async(resource_group_name, account_name, application_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 application_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_async(resource_group_name, account_name, application_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, 'application_id is nil' if application_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/{applicationId}/versions/{version}/activate'
102
+
103
+ request_url = @base_url || @client.base_url
104
+
105
+ options = {
106
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
107
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'applicationId' => application_id,'version' => version,'subscriptionId' => @client.subscription_id},
108
+ query_params: {'api-version' => @client.api_version},
109
+ body: request_content,
110
+ headers: request_headers.merge(custom_headers || {}),
111
+ base_url: request_url
112
+ }
113
+ promise = @client.make_request_async(:post, path_template, options)
114
+
115
+ promise = promise.then do |result|
116
+ http_response = result.response
117
+ status_code = http_response.status
118
+ response_content = http_response.body
119
+ unless status_code == 204
120
+ error_model = JSON.load(response_content)
121
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
122
+ end
123
+
124
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
125
+
126
+ result
127
+ end
128
+
129
+ promise.execute
130
+ end
131
+
132
+ #
133
+ # Creates an application package record.
134
+ #
135
+ # @param resource_group_name [String] The name of the resource group that
136
+ # contains the Batch account.
137
+ # @param account_name [String] The name of the Batch account.
138
+ # @param application_id [String] The id of the application.
139
+ # @param version [String] The version of the application.
140
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
141
+ # will be added to the HTTP request.
142
+ #
143
+ # @return [ApplicationPackage] operation results.
144
+ #
145
+ def create(resource_group_name, account_name, application_id, version, custom_headers = nil)
146
+ response = create_async(resource_group_name, account_name, application_id, version, custom_headers).value!
147
+ response.body unless response.nil?
148
+ end
149
+
150
+ #
151
+ # Creates an application package record.
152
+ #
153
+ # @param resource_group_name [String] The name of the resource group that
154
+ # contains the Batch account.
155
+ # @param account_name [String] The name of the Batch account.
156
+ # @param application_id [String] The id of the application.
157
+ # @param version [String] The version of the application.
158
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
159
+ # will be added to the HTTP request.
160
+ #
161
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
162
+ #
163
+ def create_with_http_info(resource_group_name, account_name, application_id, version, custom_headers = nil)
164
+ create_async(resource_group_name, account_name, application_id, version, custom_headers).value!
165
+ end
166
+
167
+ #
168
+ # Creates an application package record.
169
+ #
170
+ # @param resource_group_name [String] The name of the resource group that
171
+ # contains the Batch account.
172
+ # @param account_name [String] The name of the Batch account.
173
+ # @param application_id [String] The id of the application.
174
+ # @param version [String] The version of the application.
175
+ # @param [Hash{String => String}] A hash of custom headers that will be added
176
+ # to the HTTP request.
177
+ #
178
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
179
+ #
180
+ def create_async(resource_group_name, account_name, application_id, version, custom_headers = nil)
181
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
182
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
183
+ fail ArgumentError, 'application_id is nil' if application_id.nil?
184
+ fail ArgumentError, 'version is nil' if version.nil?
185
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
186
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
187
+
188
+
189
+ request_headers = {}
190
+
191
+ # Set Headers
192
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
193
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
194
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}'
195
+
196
+ request_url = @base_url || @client.base_url
197
+
198
+ options = {
199
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
200
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'applicationId' => application_id,'version' => version,'subscriptionId' => @client.subscription_id},
201
+ query_params: {'api-version' => @client.api_version},
202
+ headers: request_headers.merge(custom_headers || {}),
203
+ base_url: request_url
204
+ }
205
+ promise = @client.make_request_async(:put, path_template, options)
206
+
207
+ promise = promise.then do |result|
208
+ http_response = result.response
209
+ status_code = http_response.status
210
+ response_content = http_response.body
211
+ unless status_code == 201
212
+ error_model = JSON.load(response_content)
213
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
214
+ end
215
+
216
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
217
+ # Deserialize Response
218
+ if status_code == 201
219
+ begin
220
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
221
+ result_mapper = ApplicationPackage.mapper()
222
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
223
+ rescue Exception => e
224
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
225
+ end
226
+ end
227
+
228
+ result
229
+ end
230
+
231
+ promise.execute
232
+ end
233
+
234
+ #
235
+ # Deletes an application package record and its associated binary file.
236
+ #
237
+ # @param resource_group_name [String] The name of the resource group that
238
+ # contains the Batch account.
239
+ # @param account_name [String] The name of the Batch account.
240
+ # @param application_id [String] The id of the application.
241
+ # @param version [String] The version of the application to delete.
242
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
243
+ # will be added to the HTTP request.
244
+ #
245
+ #
246
+ def delete(resource_group_name, account_name, application_id, version, custom_headers = nil)
247
+ response = delete_async(resource_group_name, account_name, application_id, version, custom_headers).value!
248
+ nil
249
+ end
250
+
251
+ #
252
+ # Deletes an application package record and its associated binary file.
253
+ #
254
+ # @param resource_group_name [String] The name of the resource group that
255
+ # contains the Batch account.
256
+ # @param account_name [String] The name of the Batch account.
257
+ # @param application_id [String] The id of the application.
258
+ # @param version [String] The version of the application to delete.
259
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
260
+ # will be added to the HTTP request.
261
+ #
262
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
263
+ #
264
+ def delete_with_http_info(resource_group_name, account_name, application_id, version, custom_headers = nil)
265
+ delete_async(resource_group_name, account_name, application_id, version, custom_headers).value!
266
+ end
267
+
268
+ #
269
+ # Deletes an application package record and its associated binary file.
270
+ #
271
+ # @param resource_group_name [String] The name of the resource group that
272
+ # contains the Batch account.
273
+ # @param account_name [String] The name of the Batch account.
274
+ # @param application_id [String] The id of the application.
275
+ # @param version [String] The version of the application to delete.
276
+ # @param [Hash{String => String}] A hash of custom headers that will be added
277
+ # to the HTTP request.
278
+ #
279
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
280
+ #
281
+ def delete_async(resource_group_name, account_name, application_id, version, custom_headers = nil)
282
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
283
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
284
+ fail ArgumentError, 'application_id is nil' if application_id.nil?
285
+ fail ArgumentError, 'version is nil' if version.nil?
286
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
287
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
288
+
289
+
290
+ request_headers = {}
291
+
292
+ # Set Headers
293
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
294
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
295
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}'
296
+
297
+ request_url = @base_url || @client.base_url
298
+
299
+ options = {
300
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
301
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'applicationId' => application_id,'version' => version,'subscriptionId' => @client.subscription_id},
302
+ query_params: {'api-version' => @client.api_version},
303
+ headers: request_headers.merge(custom_headers || {}),
304
+ base_url: request_url
305
+ }
306
+ promise = @client.make_request_async(:delete, path_template, options)
307
+
308
+ promise = promise.then do |result|
309
+ http_response = result.response
310
+ status_code = http_response.status
311
+ response_content = http_response.body
312
+ unless status_code == 204
313
+ error_model = JSON.load(response_content)
314
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
315
+ end
316
+
317
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
318
+
319
+ result
320
+ end
321
+
322
+ promise.execute
323
+ end
324
+
325
+ #
326
+ # Gets information about the specified application package.
327
+ #
328
+ # @param resource_group_name [String] The name of the resource group that
329
+ # contains the Batch account.
330
+ # @param account_name [String] The name of the Batch account.
331
+ # @param application_id [String] The id of the application.
332
+ # @param version [String] The version of the application.
333
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
334
+ # will be added to the HTTP request.
335
+ #
336
+ # @return [ApplicationPackage] operation results.
337
+ #
338
+ def get(resource_group_name, account_name, application_id, version, custom_headers = nil)
339
+ response = get_async(resource_group_name, account_name, application_id, version, custom_headers).value!
340
+ response.body unless response.nil?
341
+ end
342
+
343
+ #
344
+ # Gets information about the specified application package.
345
+ #
346
+ # @param resource_group_name [String] The name of the resource group that
347
+ # contains the Batch account.
348
+ # @param account_name [String] The name of the Batch account.
349
+ # @param application_id [String] The id of the application.
350
+ # @param version [String] The version of the application.
351
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
352
+ # will be added to the HTTP request.
353
+ #
354
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
355
+ #
356
+ def get_with_http_info(resource_group_name, account_name, application_id, version, custom_headers = nil)
357
+ get_async(resource_group_name, account_name, application_id, version, custom_headers).value!
358
+ end
359
+
360
+ #
361
+ # Gets information about the specified application package.
362
+ #
363
+ # @param resource_group_name [String] The name of the resource group that
364
+ # contains the Batch account.
365
+ # @param account_name [String] The name of the Batch account.
366
+ # @param application_id [String] The id of the application.
367
+ # @param version [String] The version of the application.
368
+ # @param [Hash{String => String}] A hash of custom headers that will be added
369
+ # to the HTTP request.
370
+ #
371
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
372
+ #
373
+ def get_async(resource_group_name, account_name, application_id, version, custom_headers = nil)
374
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
375
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
376
+ fail ArgumentError, 'application_id is nil' if application_id.nil?
377
+ fail ArgumentError, 'version is nil' if version.nil?
378
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
379
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
380
+
381
+
382
+ request_headers = {}
383
+
384
+ # Set Headers
385
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
386
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
387
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationId}/versions/{version}'
388
+
389
+ request_url = @base_url || @client.base_url
390
+
391
+ options = {
392
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
393
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'applicationId' => application_id,'version' => version,'subscriptionId' => @client.subscription_id},
394
+ query_params: {'api-version' => @client.api_version},
395
+ headers: request_headers.merge(custom_headers || {}),
396
+ base_url: request_url
397
+ }
398
+ promise = @client.make_request_async(:get, path_template, options)
399
+
400
+ promise = promise.then do |result|
401
+ http_response = result.response
402
+ status_code = http_response.status
403
+ response_content = http_response.body
404
+ unless status_code == 200
405
+ error_model = JSON.load(response_content)
406
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
407
+ end
408
+
409
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
410
+ # Deserialize Response
411
+ if status_code == 200
412
+ begin
413
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
414
+ result_mapper = ApplicationPackage.mapper()
415
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
416
+ rescue Exception => e
417
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
418
+ end
419
+ end
420
+
421
+ result
422
+ end
423
+
424
+ promise.execute
425
+ end
426
+
427
+ end
428
+ end
@@ -5,14 +5,14 @@
5
5
 
6
6
  module Azure::ARM::Batch
7
7
  #
8
- # Account
8
+ # BatchAccountOperations
9
9
  #
10
- class Account
10
+ class BatchAccountOperations
11
11
  include Azure::ARM::Batch::Models
12
12
  include MsRestAzure
13
13
 
14
14
  #
15
- # Creates and initializes a new instance of the Account class.
15
+ # Creates and initializes a new instance of the BatchAccountOperations class.
16
16
  # @param client service class for accessing basic functionality.
17
17
  #
18
18
  def initialize(client)
@@ -40,7 +40,7 @@ module Azure::ARM::Batch
40
40
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
41
  # will be added to the HTTP request.
42
42
  #
43
- # @return [AccountResource] operation results.
43
+ # @return [BatchAccount] operation results.
44
44
  #
45
45
  def create(resource_group_name, account_name, parameters, custom_headers = nil)
46
46
  response = create_async(resource_group_name, account_name, parameters, custom_headers).value!
@@ -71,7 +71,7 @@ module Azure::ARM::Batch
71
71
  promise = promise.then do |response|
72
72
  # Defining deserialization method.
73
73
  deserialize_method = lambda do |parsed_response|
74
- result_mapper = AccountResource.mapper()
74
+ result_mapper = BatchAccount.mapper()
75
75
  parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
76
76
  end
77
77
 
@@ -100,7 +100,7 @@ module Azure::ARM::Batch
100
100
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
101
101
  # will be added to the HTTP request.
102
102
  #
103
- # @return [AccountResource] operation results.
103
+ # @return [BatchAccount] operation results.
104
104
  #
105
105
  def begin_create(resource_group_name, account_name, parameters, custom_headers = nil)
106
106
  response = begin_create_async(resource_group_name, account_name, parameters, custom_headers).value!
@@ -173,37 +173,34 @@ module Azure::ARM::Batch
173
173
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
174
174
 
175
175
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'
176
+
177
+ request_url = @base_url || @client.base_url
178
+
176
179
  options = {
177
180
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
178
181
  path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
179
182
  query_params: {'api-version' => @client.api_version},
180
183
  body: request_content,
181
- headers: request_headers.merge(custom_headers || {})
184
+ headers: request_headers.merge(custom_headers || {}),
185
+ base_url: request_url
182
186
  }
187
+ promise = @client.make_request_async(:put, path_template, options)
183
188
 
184
- request_url = @base_url || @client.base_url
185
-
186
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
187
- promise = request.run_promise do |req|
188
- @client.credentials.sign_request(req) unless @client.credentials.nil?
189
- end
190
-
191
- promise = promise.then do |http_response|
189
+ promise = promise.then do |result|
190
+ http_response = result.response
192
191
  status_code = http_response.status
193
192
  response_content = http_response.body
194
193
  unless status_code == 202 || status_code == 200
195
194
  error_model = JSON.load(response_content)
196
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
195
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
197
196
  end
198
197
 
199
- # Create Result
200
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
201
198
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
202
199
  # Deserialize Response
203
200
  if status_code == 200
204
201
  begin
205
202
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
206
- result_mapper = AccountResource.mapper()
203
+ result_mapper = BatchAccount.mapper()
207
204
  result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
208
205
  rescue Exception => e
209
206
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
@@ -227,7 +224,7 @@ module Azure::ARM::Batch
227
224
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
228
225
  # will be added to the HTTP request.
229
226
  #
230
- # @return [AccountResource] operation results.
227
+ # @return [BatchAccount] operation results.
231
228
  #
232
229
  def update(resource_group_name, account_name, parameters, custom_headers = nil)
233
230
  response = update_async(resource_group_name, account_name, parameters, custom_headers).value!
@@ -286,37 +283,34 @@ module Azure::ARM::Batch
286
283
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
287
284
 
288
285
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'
286
+
287
+ request_url = @base_url || @client.base_url
288
+
289
289
  options = {
290
290
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
291
291
  path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
292
292
  query_params: {'api-version' => @client.api_version},
293
293
  body: request_content,
294
- headers: request_headers.merge(custom_headers || {})
294
+ headers: request_headers.merge(custom_headers || {}),
295
+ base_url: request_url
295
296
  }
297
+ promise = @client.make_request_async(:patch, path_template, options)
296
298
 
297
- request_url = @base_url || @client.base_url
298
-
299
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
300
- promise = request.run_promise do |req|
301
- @client.credentials.sign_request(req) unless @client.credentials.nil?
302
- end
303
-
304
- promise = promise.then do |http_response|
299
+ promise = promise.then do |result|
300
+ http_response = result.response
305
301
  status_code = http_response.status
306
302
  response_content = http_response.body
307
303
  unless status_code == 200
308
304
  error_model = JSON.load(response_content)
309
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
305
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
310
306
  end
311
307
 
312
- # Create Result
313
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
314
308
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
315
309
  # Deserialize Response
316
310
  if status_code == 200
317
311
  begin
318
312
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
319
- result_mapper = AccountResource.mapper()
313
+ result_mapper = BatchAccount.mapper()
320
314
  result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
321
315
  rescue Exception => e
322
316
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
@@ -423,30 +417,27 @@ module Azure::ARM::Batch
423
417
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
424
418
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
425
419
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'
420
+
421
+ request_url = @base_url || @client.base_url
422
+
426
423
  options = {
427
424
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
428
425
  path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
429
426
  query_params: {'api-version' => @client.api_version},
430
- headers: request_headers.merge(custom_headers || {})
427
+ headers: request_headers.merge(custom_headers || {}),
428
+ base_url: request_url
431
429
  }
430
+ promise = @client.make_request_async(:delete, path_template, options)
432
431
 
433
- request_url = @base_url || @client.base_url
434
-
435
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
436
- promise = request.run_promise do |req|
437
- @client.credentials.sign_request(req) unless @client.credentials.nil?
438
- end
439
-
440
- promise = promise.then do |http_response|
432
+ promise = promise.then do |result|
433
+ http_response = result.response
441
434
  status_code = http_response.status
442
435
  response_content = http_response.body
443
436
  unless status_code == 202 || status_code == 204 || status_code == 200
444
437
  error_model = JSON.load(response_content)
445
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
438
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
446
439
  end
447
440
 
448
- # Create Result
449
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
450
441
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
451
442
 
452
443
  result
@@ -464,7 +455,7 @@ module Azure::ARM::Batch
464
455
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
465
456
  # will be added to the HTTP request.
466
457
  #
467
- # @return [AccountResource] operation results.
458
+ # @return [BatchAccount] operation results.
468
459
  #
469
460
  def get(resource_group_name, account_name, custom_headers = nil)
470
461
  response = get_async(resource_group_name, account_name, custom_headers).value!
@@ -510,36 +501,33 @@ module Azure::ARM::Batch
510
501
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
511
502
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
512
503
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'
504
+
505
+ request_url = @base_url || @client.base_url
506
+
513
507
  options = {
514
508
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
515
509
  path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
516
510
  query_params: {'api-version' => @client.api_version},
517
- headers: request_headers.merge(custom_headers || {})
511
+ headers: request_headers.merge(custom_headers || {}),
512
+ base_url: request_url
518
513
  }
514
+ promise = @client.make_request_async(:get, path_template, options)
519
515
 
520
- request_url = @base_url || @client.base_url
521
-
522
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, 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|
516
+ promise = promise.then do |result|
517
+ http_response = result.response
528
518
  status_code = http_response.status
529
519
  response_content = http_response.body
530
520
  unless status_code == 200
531
521
  error_model = JSON.load(response_content)
532
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
522
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
533
523
  end
534
524
 
535
- # Create Result
536
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
537
525
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
538
526
  # Deserialize Response
539
527
  if status_code == 200
540
528
  begin
541
529
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
542
- result_mapper = AccountResource.mapper()
530
+ result_mapper = BatchAccount.mapper()
543
531
  result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
544
532
  rescue Exception => e
545
533
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
@@ -565,8 +553,8 @@ module Azure::ARM::Batch
565
553
  response = list_async(custom_headers).value!
566
554
  unless response.nil?
567
555
  page = response.body
568
- page.next_method = Proc.new do |next_link|
569
- list_next_async(next_link, custom_headers)
556
+ page.next_method = Proc.new do |next_page_link|
557
+ list_next_async(next_page_link, custom_headers)
570
558
  end
571
559
  page
572
560
  end
@@ -578,7 +566,7 @@ module Azure::ARM::Batch
578
566
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
579
567
  # will be added to the HTTP request.
580
568
  #
581
- # @return [Array<AccountResource>] operation results.
569
+ # @return [Array<BatchAccount>] operation results.
582
570
  #
583
571
  def list(custom_headers = nil)
584
572
  first_page = list_as_lazy(custom_headers)
@@ -616,30 +604,27 @@ module Azure::ARM::Batch
616
604
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
617
605
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
618
606
  path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts'
607
+
608
+ request_url = @base_url || @client.base_url
609
+
619
610
  options = {
620
611
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
621
612
  path_params: {'subscriptionId' => @client.subscription_id},
622
613
  query_params: {'api-version' => @client.api_version},
623
- headers: request_headers.merge(custom_headers || {})
614
+ headers: request_headers.merge(custom_headers || {}),
615
+ base_url: request_url
624
616
  }
617
+ promise = @client.make_request_async(:get, path_template, options)
625
618
 
626
- request_url = @base_url || @client.base_url
627
-
628
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
629
- promise = request.run_promise do |req|
630
- @client.credentials.sign_request(req) unless @client.credentials.nil?
631
- end
632
-
633
- promise = promise.then do |http_response|
619
+ promise = promise.then do |result|
620
+ http_response = result.response
634
621
  status_code = http_response.status
635
622
  response_content = http_response.body
636
623
  unless status_code == 200
637
624
  error_model = JSON.load(response_content)
638
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
625
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
639
626
  end
640
627
 
641
- # Create Result
642
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
643
628
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
644
629
  # Deserialize Response
645
630
  if status_code == 200
@@ -674,8 +659,8 @@ module Azure::ARM::Batch
674
659
  response = list_by_resource_group_async(resource_group_name, custom_headers).value!
675
660
  unless response.nil?
676
661
  page = response.body
677
- page.next_method = Proc.new do |next_link|
678
- list_by_resource_group_next_async(next_link, custom_headers)
662
+ page.next_method = Proc.new do |next_page_link|
663
+ list_by_resource_group_next_async(next_page_link, custom_headers)
679
664
  end
680
665
  page
681
666
  end
@@ -690,7 +675,7 @@ module Azure::ARM::Batch
690
675
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
691
676
  # will be added to the HTTP request.
692
677
  #
693
- # @return [Array<AccountResource>] operation results.
678
+ # @return [Array<BatchAccount>] operation results.
694
679
  #
695
680
  def list_by_resource_group(resource_group_name, custom_headers = nil)
696
681
  first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
@@ -735,30 +720,27 @@ module Azure::ARM::Batch
735
720
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
736
721
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
737
722
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts'
723
+
724
+ request_url = @base_url || @client.base_url
725
+
738
726
  options = {
739
727
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
740
728
  path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
741
729
  query_params: {'api-version' => @client.api_version},
742
- headers: request_headers.merge(custom_headers || {})
730
+ headers: request_headers.merge(custom_headers || {}),
731
+ base_url: request_url
743
732
  }
733
+ promise = @client.make_request_async(:get, path_template, options)
744
734
 
745
- request_url = @base_url || @client.base_url
746
-
747
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
748
- promise = request.run_promise do |req|
749
- @client.credentials.sign_request(req) unless @client.credentials.nil?
750
- end
751
-
752
- promise = promise.then do |http_response|
735
+ promise = promise.then do |result|
736
+ http_response = result.response
753
737
  status_code = http_response.status
754
738
  response_content = http_response.body
755
739
  unless status_code == 200
756
740
  error_model = JSON.load(response_content)
757
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
741
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
758
742
  end
759
743
 
760
- # Create Result
761
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
762
744
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
763
745
  # Deserialize Response
764
746
  if status_code == 200
@@ -834,30 +816,27 @@ module Azure::ARM::Batch
834
816
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
835
817
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
836
818
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys'
819
+
820
+ request_url = @base_url || @client.base_url
821
+
837
822
  options = {
838
823
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
839
824
  path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
840
825
  query_params: {'api-version' => @client.api_version},
841
- headers: request_headers.merge(custom_headers || {})
826
+ headers: request_headers.merge(custom_headers || {}),
827
+ base_url: request_url
842
828
  }
829
+ promise = @client.make_request_async(:post, path_template, options)
843
830
 
844
- request_url = @base_url || @client.base_url
845
-
846
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
847
- promise = request.run_promise do |req|
848
- @client.credentials.sign_request(req) unless @client.credentials.nil?
849
- end
850
-
851
- promise = promise.then do |http_response|
831
+ promise = promise.then do |result|
832
+ http_response = result.response
852
833
  status_code = http_response.status
853
834
  response_content = http_response.body
854
835
  unless status_code == 204
855
836
  error_model = JSON.load(response_content)
856
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
837
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
857
838
  end
858
839
 
859
- # Create Result
860
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
861
840
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
862
841
 
863
842
  result
@@ -877,7 +856,7 @@ module Azure::ARM::Batch
877
856
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
878
857
  # will be added to the HTTP request.
879
858
  #
880
- # @return [BatchAccountRegenerateKeyResult] operation results.
859
+ # @return [BatchAccountKeys] operation results.
881
860
  #
882
861
  def regenerate_key(resource_group_name, account_name, parameters, custom_headers = nil)
883
862
  response = regenerate_key_async(resource_group_name, account_name, parameters, custom_headers).value!
@@ -936,37 +915,34 @@ module Azure::ARM::Batch
936
915
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
937
916
 
938
917
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys'
918
+
919
+ request_url = @base_url || @client.base_url
920
+
939
921
  options = {
940
922
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
941
923
  path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
942
924
  query_params: {'api-version' => @client.api_version},
943
925
  body: request_content,
944
- headers: request_headers.merge(custom_headers || {})
926
+ headers: request_headers.merge(custom_headers || {}),
927
+ base_url: request_url
945
928
  }
929
+ promise = @client.make_request_async(:post, path_template, options)
946
930
 
947
- request_url = @base_url || @client.base_url
948
-
949
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
950
- promise = request.run_promise do |req|
951
- @client.credentials.sign_request(req) unless @client.credentials.nil?
952
- end
953
-
954
- promise = promise.then do |http_response|
931
+ promise = promise.then do |result|
932
+ http_response = result.response
955
933
  status_code = http_response.status
956
934
  response_content = http_response.body
957
935
  unless status_code == 200
958
936
  error_model = JSON.load(response_content)
959
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
937
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
960
938
  end
961
939
 
962
- # Create Result
963
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
964
940
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
965
941
  # Deserialize Response
966
942
  if status_code == 200
967
943
  begin
968
944
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
969
- result_mapper = BatchAccountRegenerateKeyResult.mapper()
945
+ result_mapper = BatchAccountKeys.mapper()
970
946
  result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
971
947
  rescue Exception => e
972
948
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
@@ -980,7 +956,7 @@ module Azure::ARM::Batch
980
956
  end
981
957
 
982
958
  #
983
- # Lists the account keys for the specified Batch account.
959
+ # Gets the account keys for the specified Batch account.
984
960
  #
985
961
  # @param resource_group_name [String] The name of the resource group that
986
962
  # contains the Batch account.
@@ -988,15 +964,15 @@ module Azure::ARM::Batch
988
964
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
989
965
  # will be added to the HTTP request.
990
966
  #
991
- # @return [BatchAccountListKeyResult] operation results.
967
+ # @return [BatchAccountKeys] operation results.
992
968
  #
993
- def list_keys(resource_group_name, account_name, custom_headers = nil)
994
- response = list_keys_async(resource_group_name, account_name, custom_headers).value!
969
+ def get_keys(resource_group_name, account_name, custom_headers = nil)
970
+ response = get_keys_async(resource_group_name, account_name, custom_headers).value!
995
971
  response.body unless response.nil?
996
972
  end
997
973
 
998
974
  #
999
- # Lists the account keys for the specified Batch account.
975
+ # Gets the account keys for the specified Batch account.
1000
976
  #
1001
977
  # @param resource_group_name [String] The name of the resource group that
1002
978
  # contains the Batch account.
@@ -1006,12 +982,12 @@ module Azure::ARM::Batch
1006
982
  #
1007
983
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1008
984
  #
1009
- def list_keys_with_http_info(resource_group_name, account_name, custom_headers = nil)
1010
- list_keys_async(resource_group_name, account_name, custom_headers).value!
985
+ def get_keys_with_http_info(resource_group_name, account_name, custom_headers = nil)
986
+ get_keys_async(resource_group_name, account_name, custom_headers).value!
1011
987
  end
1012
988
 
1013
989
  #
1014
- # Lists the account keys for the specified Batch account.
990
+ # Gets the account keys for the specified Batch account.
1015
991
  #
1016
992
  # @param resource_group_name [String] The name of the resource group that
1017
993
  # contains the Batch account.
@@ -1021,7 +997,7 @@ module Azure::ARM::Batch
1021
997
  #
1022
998
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1023
999
  #
1024
- def list_keys_async(resource_group_name, account_name, custom_headers = nil)
1000
+ def get_keys_async(resource_group_name, account_name, custom_headers = nil)
1025
1001
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1026
1002
  fail ArgumentError, 'account_name is nil' if account_name.nil?
1027
1003
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
@@ -1034,36 +1010,33 @@ module Azure::ARM::Batch
1034
1010
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1035
1011
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1036
1012
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys'
1013
+
1014
+ request_url = @base_url || @client.base_url
1015
+
1037
1016
  options = {
1038
1017
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1039
1018
  path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
1040
1019
  query_params: {'api-version' => @client.api_version},
1041
- headers: request_headers.merge(custom_headers || {})
1020
+ headers: request_headers.merge(custom_headers || {}),
1021
+ base_url: request_url
1042
1022
  }
1023
+ promise = @client.make_request_async(:post, path_template, options)
1043
1024
 
1044
- request_url = @base_url || @client.base_url
1045
-
1046
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
1047
- promise = request.run_promise do |req|
1048
- @client.credentials.sign_request(req) unless @client.credentials.nil?
1049
- end
1050
-
1051
- promise = promise.then do |http_response|
1025
+ promise = promise.then do |result|
1026
+ http_response = result.response
1052
1027
  status_code = http_response.status
1053
1028
  response_content = http_response.body
1054
1029
  unless status_code == 200
1055
1030
  error_model = JSON.load(response_content)
1056
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
1031
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1057
1032
  end
1058
1033
 
1059
- # Create Result
1060
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1061
1034
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1062
1035
  # Deserialize Response
1063
1036
  if status_code == 200
1064
1037
  begin
1065
1038
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1066
- result_mapper = BatchAccountListKeyResult.mapper()
1039
+ result_mapper = BatchAccountKeys.mapper()
1067
1040
  result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1068
1041
  rescue Exception => e
1069
1042
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
@@ -1125,29 +1098,26 @@ module Azure::ARM::Batch
1125
1098
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1126
1099
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1127
1100
  path_template = '{nextLink}'
1101
+
1102
+ request_url = @base_url || @client.base_url
1103
+
1128
1104
  options = {
1129
1105
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1130
1106
  skip_encoding_path_params: {'nextLink' => next_page_link},
1131
- headers: request_headers.merge(custom_headers || {})
1107
+ headers: request_headers.merge(custom_headers || {}),
1108
+ base_url: request_url
1132
1109
  }
1110
+ promise = @client.make_request_async(:get, path_template, options)
1133
1111
 
1134
- request_url = @base_url || @client.base_url
1135
-
1136
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
1137
- promise = request.run_promise do |req|
1138
- @client.credentials.sign_request(req) unless @client.credentials.nil?
1139
- end
1140
-
1141
- promise = promise.then do |http_response|
1112
+ promise = promise.then do |result|
1113
+ http_response = result.response
1142
1114
  status_code = http_response.status
1143
1115
  response_content = http_response.body
1144
1116
  unless status_code == 200
1145
1117
  error_model = JSON.load(response_content)
1146
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
1118
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1147
1119
  end
1148
1120
 
1149
- # Create Result
1150
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1151
1121
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1152
1122
  # Deserialize Response
1153
1123
  if status_code == 200
@@ -1218,29 +1188,26 @@ module Azure::ARM::Batch
1218
1188
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1219
1189
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1220
1190
  path_template = '{nextLink}'
1191
+
1192
+ request_url = @base_url || @client.base_url
1193
+
1221
1194
  options = {
1222
1195
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1223
1196
  skip_encoding_path_params: {'nextLink' => next_page_link},
1224
- headers: request_headers.merge(custom_headers || {})
1197
+ headers: request_headers.merge(custom_headers || {}),
1198
+ base_url: request_url
1225
1199
  }
1200
+ promise = @client.make_request_async(:get, path_template, options)
1226
1201
 
1227
- request_url = @base_url || @client.base_url
1228
-
1229
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
1230
- promise = request.run_promise do |req|
1231
- @client.credentials.sign_request(req) unless @client.credentials.nil?
1232
- end
1233
-
1234
- promise = promise.then do |http_response|
1202
+ promise = promise.then do |result|
1203
+ http_response = result.response
1235
1204
  status_code = http_response.status
1236
1205
  response_content = http_response.body
1237
1206
  unless status_code == 200
1238
1207
  error_model = JSON.load(response_content)
1239
- fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
1208
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1240
1209
  end
1241
1210
 
1242
- # Create Result
1243
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1244
1211
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1245
1212
  # Deserialize Response
1246
1213
  if status_code == 200