azure_mgmt_batch 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-12-01/generated/azure_mgmt_batch.rb +50 -0
  3. data/lib/2015-12-01/generated/azure_mgmt_batch/application_operations.rb +635 -0
  4. data/lib/{generated → 2015-12-01/generated}/azure_mgmt_batch/application_package_operations.rb +4 -4
  5. data/lib/2015-12-01/generated/azure_mgmt_batch/batch_account_operations.rb +1229 -0
  6. data/lib/2015-12-01/generated/azure_mgmt_batch/batch_management_client.rb +142 -0
  7. data/lib/2015-12-01/generated/azure_mgmt_batch/location.rb +115 -0
  8. data/lib/{generated → 2015-12-01/generated}/azure_mgmt_batch/models/account_key_type.rb +1 -1
  9. data/lib/2015-12-01/generated/azure_mgmt_batch/models/activate_application_package_parameters.rb +45 -0
  10. data/lib/2015-12-01/generated/azure_mgmt_batch/models/add_application_parameters.rb +55 -0
  11. data/lib/{generated → 2015-12-01/generated}/azure_mgmt_batch/models/application.rb +1 -1
  12. data/lib/2015-12-01/generated/azure_mgmt_batch/models/application_package.rb +110 -0
  13. data/lib/2015-12-01/generated/azure_mgmt_batch/models/auto_storage_base_properties.rb +45 -0
  14. data/lib/2015-12-01/generated/azure_mgmt_batch/models/auto_storage_properties.rb +57 -0
  15. data/lib/2015-12-01/generated/azure_mgmt_batch/models/batch_account.rb +147 -0
  16. data/lib/2015-12-01/generated/azure_mgmt_batch/models/batch_account_create_parameters.rb +74 -0
  17. data/lib/2015-12-01/generated/azure_mgmt_batch/models/batch_account_keys.rb +54 -0
  18. data/lib/2015-12-01/generated/azure_mgmt_batch/models/batch_account_list_result.rb +95 -0
  19. data/lib/{generated → 2015-12-01/generated}/azure_mgmt_batch/models/batch_account_regenerate_key_parameters.rb +1 -1
  20. data/lib/2015-12-01/generated/azure_mgmt_batch/models/batch_account_update_parameters.rb +64 -0
  21. data/lib/2015-12-01/generated/azure_mgmt_batch/models/batch_location_quota.rb +45 -0
  22. data/lib/2015-12-01/generated/azure_mgmt_batch/models/list_applications_result.rb +94 -0
  23. data/lib/{generated → 2015-12-01/generated}/azure_mgmt_batch/models/package_state.rb +1 -1
  24. data/lib/{generated → 2015-12-01/generated}/azure_mgmt_batch/models/provisioning_state.rb +1 -1
  25. data/lib/2015-12-01/generated/azure_mgmt_batch/models/resource.rb +94 -0
  26. data/lib/2015-12-01/generated/azure_mgmt_batch/models/update_application_parameters.rb +66 -0
  27. data/lib/2015-12-01/generated/azure_mgmt_batch/module_definition.rb +9 -0
  28. data/lib/{generated → 2015-12-01/generated}/azure_mgmt_batch/version.rb +2 -2
  29. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch.rb +35 -35
  30. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/application_operations.rb +7 -7
  31. data/lib/2017-05-01/generated/azure_mgmt_batch/application_package_operations.rb +427 -0
  32. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/batch_account_operations.rb +14 -14
  33. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/batch_management_client.rb +3 -3
  34. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/location.rb +4 -4
  35. data/lib/2017-05-01/generated/azure_mgmt_batch/models/account_key_type.rb +16 -0
  36. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/activate_application_package_parameters.rb +1 -1
  37. data/lib/2017-05-01/generated/azure_mgmt_batch/models/application.rb +96 -0
  38. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/application_create_parameters.rb +1 -1
  39. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/application_package.rb +1 -1
  40. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/application_update_parameters.rb +1 -1
  41. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/auto_storage_base_properties.rb +1 -1
  42. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/auto_storage_properties.rb +1 -1
  43. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/batch_account.rb +1 -1
  44. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/batch_account_create_parameters.rb +1 -1
  45. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/batch_account_keys.rb +1 -1
  46. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/batch_account_list_result.rb +1 -1
  47. data/lib/2017-05-01/generated/azure_mgmt_batch/models/batch_account_regenerate_key_parameters.rb +46 -0
  48. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/batch_account_update_parameters.rb +1 -1
  49. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/batch_location_quota.rb +1 -1
  50. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/check_name_availability_parameters.rb +1 -1
  51. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/check_name_availability_result.rb +1 -1
  52. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/key_vault_reference.rb +1 -1
  53. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/list_applications_result.rb +1 -1
  54. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/name_availability_reason.rb +1 -1
  55. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/operation.rb +1 -1
  56. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/operation_display.rb +1 -1
  57. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/operation_list_result.rb +1 -1
  58. data/lib/2017-05-01/generated/azure_mgmt_batch/models/package_state.rb +17 -0
  59. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/pool_allocation_mode.rb +1 -1
  60. data/lib/2017-05-01/generated/azure_mgmt_batch/models/provisioning_state.rb +20 -0
  61. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/models/resource.rb +1 -1
  62. data/lib/2017-05-01/generated/azure_mgmt_batch/module_definition.rb +9 -0
  63. data/lib/{generated → 2017-05-01/generated}/azure_mgmt_batch/operations.rb +3 -3
  64. data/lib/{generated/azure_mgmt_batch/module_definition.rb → 2017-05-01/generated/azure_mgmt_batch/version.rb} +3 -3
  65. data/lib/azure_mgmt_batch.rb +3 -1
  66. data/lib/module_definition.rb +7 -0
  67. data/lib/profiles/common/configurable.rb +73 -0
  68. data/lib/profiles/common/default.rb +68 -0
  69. data/lib/profiles/latest/batch_latest_profile_client.rb +33 -0
  70. data/lib/profiles/latest/batch_module_definition.rb +9 -0
  71. data/lib/profiles/latest/modules/batch_profile_module.rb +158 -0
  72. data/lib/version.rb +7 -0
  73. metadata +72 -38
@@ -3,7 +3,7 @@
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
6
- module Azure::ARM::Batch
6
+ module Azure::Batch::Mgmt::V2015_12_01
7
7
  #
8
8
  # ApplicationPackageOperations
9
9
  #
@@ -93,7 +93,7 @@ module Azure::ARM::Batch
93
93
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
94
94
 
95
95
  # Serialize Request
96
- request_mapper = Azure::ARM::Batch::Models::ActivateApplicationPackageParameters.mapper()
96
+ request_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::ActivateApplicationPackageParameters.mapper()
97
97
  request_content = @client.serialize(request_mapper, parameters)
98
98
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
99
99
 
@@ -217,7 +217,7 @@ module Azure::ARM::Batch
217
217
  if status_code == 201
218
218
  begin
219
219
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
220
- result_mapper = Azure::ARM::Batch::Models::ApplicationPackage.mapper()
220
+ result_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::ApplicationPackage.mapper()
221
221
  result.body = @client.deserialize(result_mapper, parsed_response)
222
222
  rescue Exception => e
223
223
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
@@ -410,7 +410,7 @@ module Azure::ARM::Batch
410
410
  if status_code == 200
411
411
  begin
412
412
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
413
- result_mapper = Azure::ARM::Batch::Models::ApplicationPackage.mapper()
413
+ result_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::ApplicationPackage.mapper()
414
414
  result.body = @client.deserialize(result_mapper, parsed_response)
415
415
  rescue Exception => e
416
416
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
@@ -0,0 +1,1229 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Batch::Mgmt::V2015_12_01
7
+ #
8
+ # BatchAccountOperations
9
+ #
10
+ class BatchAccountOperations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the BatchAccountOperations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [BatchManagementClient] reference to the BatchManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Creates a new Batch account with the specified parameters. Existing accounts
26
+ # cannot be updated with this API and should instead be updated with the Update
27
+ # Batch Account API.
28
+ #
29
+ # @param resource_group_name [String] The name of the resource group that
30
+ # contains the new Batch account.
31
+ # @param account_name [String] A name for the Batch account which must be
32
+ # unique within the region. Batch account names must be between 3 and 24
33
+ # characters in length and must use only numbers and lowercase letters. This
34
+ # name is used as part of the DNS name that is used to access the Batch service
35
+ # in the region in which the account is created. For example:
36
+ # http://accountname.region.batch.azure.com/.
37
+ # @param parameters [BatchAccountCreateParameters] Additional parameters for
38
+ # account creation.
39
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
40
+ # will be added to the HTTP request.
41
+ #
42
+ # @return [BatchAccount] operation results.
43
+ #
44
+ def create(resource_group_name, account_name, parameters, custom_headers = nil)
45
+ response = create_async(resource_group_name, account_name, parameters, custom_headers).value!
46
+ response.body unless response.nil?
47
+ end
48
+
49
+ #
50
+ # @param resource_group_name [String] The name of the resource group that
51
+ # contains the new Batch account.
52
+ # @param account_name [String] A name for the Batch account which must be
53
+ # unique within the region. Batch account names must be between 3 and 24
54
+ # characters in length and must use only numbers and lowercase letters. This
55
+ # name is used as part of the DNS name that is used to access the Batch service
56
+ # in the region in which the account is created. For example:
57
+ # http://accountname.region.batch.azure.com/.
58
+ # @param parameters [BatchAccountCreateParameters] Additional parameters for
59
+ # account creation.
60
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
61
+ # will be added to the HTTP request.
62
+ #
63
+ # @return [Concurrent::Promise] promise which provides async access to http
64
+ # response.
65
+ #
66
+ def create_async(resource_group_name, account_name, parameters, custom_headers = nil)
67
+ # Send request
68
+ promise = begin_create_async(resource_group_name, account_name, parameters, custom_headers)
69
+
70
+ promise = promise.then do |response|
71
+ # Defining deserialization method.
72
+ deserialize_method = lambda do |parsed_response|
73
+ result_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::BatchAccount.mapper()
74
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
75
+ end
76
+
77
+ # Waiting for response.
78
+ @client.get_long_running_operation_result(response, deserialize_method)
79
+ end
80
+
81
+ promise
82
+ end
83
+
84
+ #
85
+ # Updates the properties of an existing Batch account.
86
+ #
87
+ # @param resource_group_name [String] The name of the resource group that
88
+ # contains the Batch account.
89
+ # @param account_name [String] The name of the account.
90
+ # @param parameters [BatchAccountUpdateParameters] Additional parameters for
91
+ # account update.
92
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
93
+ # will be added to the HTTP request.
94
+ #
95
+ # @return [BatchAccount] operation results.
96
+ #
97
+ def update(resource_group_name, account_name, parameters, custom_headers = nil)
98
+ response = update_async(resource_group_name, account_name, parameters, custom_headers).value!
99
+ response.body unless response.nil?
100
+ end
101
+
102
+ #
103
+ # Updates the properties of an existing Batch account.
104
+ #
105
+ # @param resource_group_name [String] The name of the resource group that
106
+ # contains the Batch account.
107
+ # @param account_name [String] The name of the account.
108
+ # @param parameters [BatchAccountUpdateParameters] Additional parameters for
109
+ # account update.
110
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
111
+ # will be added to the HTTP request.
112
+ #
113
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
114
+ #
115
+ def update_with_http_info(resource_group_name, account_name, parameters, custom_headers = nil)
116
+ update_async(resource_group_name, account_name, parameters, custom_headers).value!
117
+ end
118
+
119
+ #
120
+ # Updates the properties of an existing Batch account.
121
+ #
122
+ # @param resource_group_name [String] The name of the resource group that
123
+ # contains the Batch account.
124
+ # @param account_name [String] The name of the account.
125
+ # @param parameters [BatchAccountUpdateParameters] Additional parameters for
126
+ # account update.
127
+ # @param [Hash{String => String}] A hash of custom headers that will be added
128
+ # to the HTTP request.
129
+ #
130
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
131
+ #
132
+ def update_async(resource_group_name, account_name, parameters, custom_headers = nil)
133
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
134
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
135
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
136
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
137
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
138
+
139
+
140
+ request_headers = {}
141
+
142
+ # Set Headers
143
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
144
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
145
+
146
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
147
+
148
+ # Serialize Request
149
+ request_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::BatchAccountUpdateParameters.mapper()
150
+ request_content = @client.serialize(request_mapper, parameters)
151
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
152
+
153
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'
154
+
155
+ request_url = @base_url || @client.base_url
156
+
157
+ options = {
158
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
159
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
160
+ query_params: {'api-version' => @client.api_version},
161
+ body: request_content,
162
+ headers: request_headers.merge(custom_headers || {}),
163
+ base_url: request_url
164
+ }
165
+ promise = @client.make_request_async(:patch, path_template, options)
166
+
167
+ promise = promise.then do |result|
168
+ http_response = result.response
169
+ status_code = http_response.status
170
+ response_content = http_response.body
171
+ unless status_code == 200
172
+ error_model = JSON.load(response_content)
173
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
174
+ end
175
+
176
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
177
+ # Deserialize Response
178
+ if status_code == 200
179
+ begin
180
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
181
+ result_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::BatchAccount.mapper()
182
+ result.body = @client.deserialize(result_mapper, parsed_response)
183
+ rescue Exception => e
184
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
185
+ end
186
+ end
187
+
188
+ result
189
+ end
190
+
191
+ promise.execute
192
+ end
193
+
194
+ #
195
+ # Deletes the specified Batch account.
196
+ #
197
+ # @param resource_group_name [String] The name of the resource group that
198
+ # contains the Batch account to be deleted.
199
+ # @param account_name [String] The name of the account to be deleted.
200
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
201
+ # will be added to the HTTP request.
202
+ #
203
+ def delete(resource_group_name, account_name, custom_headers = nil)
204
+ response = delete_async(resource_group_name, account_name, custom_headers).value!
205
+ nil
206
+ end
207
+
208
+ #
209
+ # @param resource_group_name [String] The name of the resource group that
210
+ # contains the Batch account to be deleted.
211
+ # @param account_name [String] The name of the account to be deleted.
212
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
213
+ # will be added to the HTTP request.
214
+ #
215
+ # @return [Concurrent::Promise] promise which provides async access to http
216
+ # response.
217
+ #
218
+ def delete_async(resource_group_name, account_name, custom_headers = nil)
219
+ # Send request
220
+ promise = begin_delete_async(resource_group_name, account_name, custom_headers)
221
+
222
+ promise = promise.then do |response|
223
+ # Defining deserialization method.
224
+ deserialize_method = lambda do |parsed_response|
225
+ end
226
+
227
+ # Waiting for response.
228
+ @client.get_long_running_operation_result(response, deserialize_method)
229
+ end
230
+
231
+ promise
232
+ end
233
+
234
+ #
235
+ # Gets information about the specified Batch account.
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 account.
240
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
241
+ # will be added to the HTTP request.
242
+ #
243
+ # @return [BatchAccount] operation results.
244
+ #
245
+ def get(resource_group_name, account_name, custom_headers = nil)
246
+ response = get_async(resource_group_name, account_name, custom_headers).value!
247
+ response.body unless response.nil?
248
+ end
249
+
250
+ #
251
+ # Gets information about the specified Batch account.
252
+ #
253
+ # @param resource_group_name [String] The name of the resource group that
254
+ # contains the Batch account.
255
+ # @param account_name [String] The name of the account.
256
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
257
+ # will be added to the HTTP request.
258
+ #
259
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
260
+ #
261
+ def get_with_http_info(resource_group_name, account_name, custom_headers = nil)
262
+ get_async(resource_group_name, account_name, custom_headers).value!
263
+ end
264
+
265
+ #
266
+ # Gets information about the specified Batch account.
267
+ #
268
+ # @param resource_group_name [String] The name of the resource group that
269
+ # contains the Batch account.
270
+ # @param account_name [String] The name of the account.
271
+ # @param [Hash{String => String}] A hash of custom headers that will be added
272
+ # to the HTTP request.
273
+ #
274
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
275
+ #
276
+ def get_async(resource_group_name, account_name, custom_headers = nil)
277
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
278
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
279
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
280
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
281
+
282
+
283
+ request_headers = {}
284
+
285
+ # Set Headers
286
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
287
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
288
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'
289
+
290
+ request_url = @base_url || @client.base_url
291
+
292
+ options = {
293
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
294
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
295
+ query_params: {'api-version' => @client.api_version},
296
+ headers: request_headers.merge(custom_headers || {}),
297
+ base_url: request_url
298
+ }
299
+ promise = @client.make_request_async(:get, path_template, options)
300
+
301
+ promise = promise.then do |result|
302
+ http_response = result.response
303
+ status_code = http_response.status
304
+ response_content = http_response.body
305
+ unless status_code == 200
306
+ error_model = JSON.load(response_content)
307
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
308
+ end
309
+
310
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
311
+ # Deserialize Response
312
+ if status_code == 200
313
+ begin
314
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
315
+ result_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::BatchAccount.mapper()
316
+ result.body = @client.deserialize(result_mapper, parsed_response)
317
+ rescue Exception => e
318
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
319
+ end
320
+ end
321
+
322
+ result
323
+ end
324
+
325
+ promise.execute
326
+ end
327
+
328
+ #
329
+ # Gets information about the Batch accounts associated with the subscription.
330
+ #
331
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
332
+ # will be added to the HTTP request.
333
+ #
334
+ # @return [Array<BatchAccount>] operation results.
335
+ #
336
+ def list(custom_headers = nil)
337
+ first_page = list_as_lazy(custom_headers)
338
+ first_page.get_all_items
339
+ end
340
+
341
+ #
342
+ # Gets information about the Batch accounts associated with the subscription.
343
+ #
344
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
345
+ # will be added to the HTTP request.
346
+ #
347
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
348
+ #
349
+ def list_with_http_info(custom_headers = nil)
350
+ list_async(custom_headers).value!
351
+ end
352
+
353
+ #
354
+ # Gets information about the Batch accounts associated with the subscription.
355
+ #
356
+ # @param [Hash{String => String}] A hash of custom headers that will be added
357
+ # to the HTTP request.
358
+ #
359
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
360
+ #
361
+ def list_async(custom_headers = nil)
362
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
363
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
364
+
365
+
366
+ request_headers = {}
367
+
368
+ # Set Headers
369
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
370
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
371
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts'
372
+
373
+ request_url = @base_url || @client.base_url
374
+
375
+ options = {
376
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
377
+ path_params: {'subscriptionId' => @client.subscription_id},
378
+ query_params: {'api-version' => @client.api_version},
379
+ headers: request_headers.merge(custom_headers || {}),
380
+ base_url: request_url
381
+ }
382
+ promise = @client.make_request_async(:get, path_template, options)
383
+
384
+ promise = promise.then do |result|
385
+ http_response = result.response
386
+ status_code = http_response.status
387
+ response_content = http_response.body
388
+ unless status_code == 200
389
+ error_model = JSON.load(response_content)
390
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
391
+ end
392
+
393
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
394
+ # Deserialize Response
395
+ if status_code == 200
396
+ begin
397
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
398
+ result_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::BatchAccountListResult.mapper()
399
+ result.body = @client.deserialize(result_mapper, parsed_response)
400
+ rescue Exception => e
401
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
402
+ end
403
+ end
404
+
405
+ result
406
+ end
407
+
408
+ promise.execute
409
+ end
410
+
411
+ #
412
+ # Gets information about the Batch accounts associated within the specified
413
+ # resource group.
414
+ #
415
+ # @param resource_group_name [String] The name of the resource group whose
416
+ # Batch accounts to list.
417
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
418
+ # will be added to the HTTP request.
419
+ #
420
+ # @return [Array<BatchAccount>] operation results.
421
+ #
422
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
423
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
424
+ first_page.get_all_items
425
+ end
426
+
427
+ #
428
+ # Gets information about the Batch accounts associated within the specified
429
+ # resource group.
430
+ #
431
+ # @param resource_group_name [String] The name of the resource group whose
432
+ # Batch accounts to list.
433
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
434
+ # will be added to the HTTP request.
435
+ #
436
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
437
+ #
438
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
439
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
440
+ end
441
+
442
+ #
443
+ # Gets information about the Batch accounts associated within the specified
444
+ # resource group.
445
+ #
446
+ # @param resource_group_name [String] The name of the resource group whose
447
+ # Batch accounts to list.
448
+ # @param [Hash{String => String}] A hash of custom headers that will be added
449
+ # to the HTTP request.
450
+ #
451
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
452
+ #
453
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
454
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
455
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
456
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
457
+
458
+
459
+ request_headers = {}
460
+
461
+ # Set Headers
462
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
463
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
464
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts'
465
+
466
+ request_url = @base_url || @client.base_url
467
+
468
+ options = {
469
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
470
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
471
+ query_params: {'api-version' => @client.api_version},
472
+ headers: request_headers.merge(custom_headers || {}),
473
+ base_url: request_url
474
+ }
475
+ promise = @client.make_request_async(:get, path_template, options)
476
+
477
+ promise = promise.then do |result|
478
+ http_response = result.response
479
+ status_code = http_response.status
480
+ response_content = http_response.body
481
+ unless status_code == 200
482
+ error_model = JSON.load(response_content)
483
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
484
+ end
485
+
486
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
487
+ # Deserialize Response
488
+ if status_code == 200
489
+ begin
490
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
491
+ result_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::BatchAccountListResult.mapper()
492
+ result.body = @client.deserialize(result_mapper, parsed_response)
493
+ rescue Exception => e
494
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
495
+ end
496
+ end
497
+
498
+ result
499
+ end
500
+
501
+ promise.execute
502
+ end
503
+
504
+ #
505
+ # Synchronizes access keys for the auto storage account configured for the
506
+ # specified Batch account.
507
+ #
508
+ # @param resource_group_name [String] The name of the resource group that
509
+ # contains the Batch account.
510
+ # @param account_name [String] The name of the Batch account.
511
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
512
+ # will be added to the HTTP request.
513
+ #
514
+ #
515
+ def synchronize_auto_storage_keys(resource_group_name, account_name, custom_headers = nil)
516
+ response = synchronize_auto_storage_keys_async(resource_group_name, account_name, custom_headers).value!
517
+ nil
518
+ end
519
+
520
+ #
521
+ # Synchronizes access keys for the auto storage account configured for the
522
+ # specified Batch account.
523
+ #
524
+ # @param resource_group_name [String] The name of the resource group that
525
+ # contains the Batch account.
526
+ # @param account_name [String] The name of the Batch account.
527
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
528
+ # will be added to the HTTP request.
529
+ #
530
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
531
+ #
532
+ def synchronize_auto_storage_keys_with_http_info(resource_group_name, account_name, custom_headers = nil)
533
+ synchronize_auto_storage_keys_async(resource_group_name, account_name, custom_headers).value!
534
+ end
535
+
536
+ #
537
+ # Synchronizes access keys for the auto storage account configured for the
538
+ # specified Batch account.
539
+ #
540
+ # @param resource_group_name [String] The name of the resource group that
541
+ # contains the Batch account.
542
+ # @param account_name [String] The name of the Batch account.
543
+ # @param [Hash{String => String}] A hash of custom headers that will be added
544
+ # to the HTTP request.
545
+ #
546
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
547
+ #
548
+ def synchronize_auto_storage_keys_async(resource_group_name, account_name, custom_headers = nil)
549
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
550
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
551
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
552
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
553
+
554
+
555
+ request_headers = {}
556
+
557
+ # Set Headers
558
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
559
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
560
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys'
561
+
562
+ request_url = @base_url || @client.base_url
563
+
564
+ options = {
565
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
566
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
567
+ query_params: {'api-version' => @client.api_version},
568
+ headers: request_headers.merge(custom_headers || {}),
569
+ base_url: request_url
570
+ }
571
+ promise = @client.make_request_async(:post, path_template, options)
572
+
573
+ promise = promise.then do |result|
574
+ http_response = result.response
575
+ status_code = http_response.status
576
+ response_content = http_response.body
577
+ unless status_code == 204
578
+ error_model = JSON.load(response_content)
579
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
580
+ end
581
+
582
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
583
+
584
+ result
585
+ end
586
+
587
+ promise.execute
588
+ end
589
+
590
+ #
591
+ # Regenerates the specified account key for the Batch account.
592
+ #
593
+ # @param resource_group_name [String] The name of the resource group that
594
+ # contains the Batch account.
595
+ # @param account_name [String] The name of the account.
596
+ # @param parameters [BatchAccountRegenerateKeyParameters] The type of key to
597
+ # regenerate.
598
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
599
+ # will be added to the HTTP request.
600
+ #
601
+ # @return [BatchAccountKeys] operation results.
602
+ #
603
+ def regenerate_key(resource_group_name, account_name, parameters, custom_headers = nil)
604
+ response = regenerate_key_async(resource_group_name, account_name, parameters, custom_headers).value!
605
+ response.body unless response.nil?
606
+ end
607
+
608
+ #
609
+ # Regenerates the specified account key for the Batch account.
610
+ #
611
+ # @param resource_group_name [String] The name of the resource group that
612
+ # contains the Batch account.
613
+ # @param account_name [String] The name of the account.
614
+ # @param parameters [BatchAccountRegenerateKeyParameters] The type of key to
615
+ # regenerate.
616
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
617
+ # will be added to the HTTP request.
618
+ #
619
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
620
+ #
621
+ def regenerate_key_with_http_info(resource_group_name, account_name, parameters, custom_headers = nil)
622
+ regenerate_key_async(resource_group_name, account_name, parameters, custom_headers).value!
623
+ end
624
+
625
+ #
626
+ # Regenerates the specified account key for the Batch account.
627
+ #
628
+ # @param resource_group_name [String] The name of the resource group that
629
+ # contains the Batch account.
630
+ # @param account_name [String] The name of the account.
631
+ # @param parameters [BatchAccountRegenerateKeyParameters] The type of key to
632
+ # regenerate.
633
+ # @param [Hash{String => String}] A hash of custom headers that will be added
634
+ # to the HTTP request.
635
+ #
636
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
637
+ #
638
+ def regenerate_key_async(resource_group_name, account_name, parameters, custom_headers = nil)
639
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
640
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
641
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
642
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
643
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
644
+
645
+
646
+ request_headers = {}
647
+
648
+ # Set Headers
649
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
650
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
651
+
652
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
653
+
654
+ # Serialize Request
655
+ request_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::BatchAccountRegenerateKeyParameters.mapper()
656
+ request_content = @client.serialize(request_mapper, parameters)
657
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
658
+
659
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys'
660
+
661
+ request_url = @base_url || @client.base_url
662
+
663
+ options = {
664
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
665
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
666
+ query_params: {'api-version' => @client.api_version},
667
+ body: request_content,
668
+ headers: request_headers.merge(custom_headers || {}),
669
+ base_url: request_url
670
+ }
671
+ promise = @client.make_request_async(:post, path_template, options)
672
+
673
+ promise = promise.then do |result|
674
+ http_response = result.response
675
+ status_code = http_response.status
676
+ response_content = http_response.body
677
+ unless status_code == 200
678
+ error_model = JSON.load(response_content)
679
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
680
+ end
681
+
682
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
683
+ # Deserialize Response
684
+ if status_code == 200
685
+ begin
686
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
687
+ result_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::BatchAccountKeys.mapper()
688
+ result.body = @client.deserialize(result_mapper, parsed_response)
689
+ rescue Exception => e
690
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
691
+ end
692
+ end
693
+
694
+ result
695
+ end
696
+
697
+ promise.execute
698
+ end
699
+
700
+ #
701
+ # Gets the account keys for the specified Batch account.
702
+ #
703
+ # @param resource_group_name [String] The name of the resource group that
704
+ # contains the Batch account.
705
+ # @param account_name [String] The name of the account.
706
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
707
+ # will be added to the HTTP request.
708
+ #
709
+ # @return [BatchAccountKeys] operation results.
710
+ #
711
+ def get_keys(resource_group_name, account_name, custom_headers = nil)
712
+ response = get_keys_async(resource_group_name, account_name, custom_headers).value!
713
+ response.body unless response.nil?
714
+ end
715
+
716
+ #
717
+ # Gets the account keys for the specified Batch account.
718
+ #
719
+ # @param resource_group_name [String] The name of the resource group that
720
+ # contains the Batch account.
721
+ # @param account_name [String] The name of the account.
722
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
723
+ # will be added to the HTTP request.
724
+ #
725
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
726
+ #
727
+ def get_keys_with_http_info(resource_group_name, account_name, custom_headers = nil)
728
+ get_keys_async(resource_group_name, account_name, custom_headers).value!
729
+ end
730
+
731
+ #
732
+ # Gets the account keys for the specified Batch account.
733
+ #
734
+ # @param resource_group_name [String] The name of the resource group that
735
+ # contains the Batch account.
736
+ # @param account_name [String] The name of the account.
737
+ # @param [Hash{String => String}] A hash of custom headers that will be added
738
+ # to the HTTP request.
739
+ #
740
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
741
+ #
742
+ def get_keys_async(resource_group_name, account_name, custom_headers = nil)
743
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
744
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
745
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
746
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
747
+
748
+
749
+ request_headers = {}
750
+
751
+ # Set Headers
752
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
753
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
754
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys'
755
+
756
+ request_url = @base_url || @client.base_url
757
+
758
+ options = {
759
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
760
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
761
+ query_params: {'api-version' => @client.api_version},
762
+ headers: request_headers.merge(custom_headers || {}),
763
+ base_url: request_url
764
+ }
765
+ promise = @client.make_request_async(:post, path_template, options)
766
+
767
+ promise = promise.then do |result|
768
+ http_response = result.response
769
+ status_code = http_response.status
770
+ response_content = http_response.body
771
+ unless status_code == 200
772
+ error_model = JSON.load(response_content)
773
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
774
+ end
775
+
776
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
777
+ # Deserialize Response
778
+ if status_code == 200
779
+ begin
780
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
781
+ result_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::BatchAccountKeys.mapper()
782
+ result.body = @client.deserialize(result_mapper, parsed_response)
783
+ rescue Exception => e
784
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
785
+ end
786
+ end
787
+
788
+ result
789
+ end
790
+
791
+ promise.execute
792
+ end
793
+
794
+ #
795
+ # Creates a new Batch account with the specified parameters. Existing accounts
796
+ # cannot be updated with this API and should instead be updated with the Update
797
+ # Batch Account API.
798
+ #
799
+ # @param resource_group_name [String] The name of the resource group that
800
+ # contains the new Batch account.
801
+ # @param account_name [String] A name for the Batch account which must be
802
+ # unique within the region. Batch account names must be between 3 and 24
803
+ # characters in length and must use only numbers and lowercase letters. This
804
+ # name is used as part of the DNS name that is used to access the Batch service
805
+ # in the region in which the account is created. For example:
806
+ # http://accountname.region.batch.azure.com/.
807
+ # @param parameters [BatchAccountCreateParameters] Additional parameters for
808
+ # account creation.
809
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
810
+ # will be added to the HTTP request.
811
+ #
812
+ # @return [BatchAccount] operation results.
813
+ #
814
+ def begin_create(resource_group_name, account_name, parameters, custom_headers = nil)
815
+ response = begin_create_async(resource_group_name, account_name, parameters, custom_headers).value!
816
+ response.body unless response.nil?
817
+ end
818
+
819
+ #
820
+ # Creates a new Batch account with the specified parameters. Existing accounts
821
+ # cannot be updated with this API and should instead be updated with the Update
822
+ # Batch Account API.
823
+ #
824
+ # @param resource_group_name [String] The name of the resource group that
825
+ # contains the new Batch account.
826
+ # @param account_name [String] A name for the Batch account which must be
827
+ # unique within the region. Batch account names must be between 3 and 24
828
+ # characters in length and must use only numbers and lowercase letters. This
829
+ # name is used as part of the DNS name that is used to access the Batch service
830
+ # in the region in which the account is created. For example:
831
+ # http://accountname.region.batch.azure.com/.
832
+ # @param parameters [BatchAccountCreateParameters] Additional parameters for
833
+ # account creation.
834
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
835
+ # will be added to the HTTP request.
836
+ #
837
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
838
+ #
839
+ def begin_create_with_http_info(resource_group_name, account_name, parameters, custom_headers = nil)
840
+ begin_create_async(resource_group_name, account_name, parameters, custom_headers).value!
841
+ end
842
+
843
+ #
844
+ # Creates a new Batch account with the specified parameters. Existing accounts
845
+ # cannot be updated with this API and should instead be updated with the Update
846
+ # Batch Account API.
847
+ #
848
+ # @param resource_group_name [String] The name of the resource group that
849
+ # contains the new Batch account.
850
+ # @param account_name [String] A name for the Batch account which must be
851
+ # unique within the region. Batch account names must be between 3 and 24
852
+ # characters in length and must use only numbers and lowercase letters. This
853
+ # name is used as part of the DNS name that is used to access the Batch service
854
+ # in the region in which the account is created. For example:
855
+ # http://accountname.region.batch.azure.com/.
856
+ # @param parameters [BatchAccountCreateParameters] Additional parameters for
857
+ # account creation.
858
+ # @param [Hash{String => String}] A hash of custom headers that will be added
859
+ # to the HTTP request.
860
+ #
861
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
862
+ #
863
+ def begin_create_async(resource_group_name, account_name, parameters, custom_headers = nil)
864
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
865
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
866
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
867
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
868
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
869
+
870
+
871
+ request_headers = {}
872
+
873
+ # Set Headers
874
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
875
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
876
+
877
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
878
+
879
+ # Serialize Request
880
+ request_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::BatchAccountCreateParameters.mapper()
881
+ request_content = @client.serialize(request_mapper, parameters)
882
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
883
+
884
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'
885
+
886
+ request_url = @base_url || @client.base_url
887
+
888
+ options = {
889
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
890
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
891
+ query_params: {'api-version' => @client.api_version},
892
+ body: request_content,
893
+ headers: request_headers.merge(custom_headers || {}),
894
+ base_url: request_url
895
+ }
896
+ promise = @client.make_request_async(:put, path_template, options)
897
+
898
+ promise = promise.then do |result|
899
+ http_response = result.response
900
+ status_code = http_response.status
901
+ response_content = http_response.body
902
+ unless status_code == 200 || status_code == 202
903
+ error_model = JSON.load(response_content)
904
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
905
+ end
906
+
907
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
908
+ # Deserialize Response
909
+ if status_code == 200
910
+ begin
911
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
912
+ result_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::BatchAccount.mapper()
913
+ result.body = @client.deserialize(result_mapper, parsed_response)
914
+ rescue Exception => e
915
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
916
+ end
917
+ end
918
+
919
+ result
920
+ end
921
+
922
+ promise.execute
923
+ end
924
+
925
+ #
926
+ # Deletes the specified Batch account.
927
+ #
928
+ # @param resource_group_name [String] The name of the resource group that
929
+ # contains the Batch account to be deleted.
930
+ # @param account_name [String] The name of the account to be deleted.
931
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
932
+ # will be added to the HTTP request.
933
+ #
934
+ #
935
+ def begin_delete(resource_group_name, account_name, custom_headers = nil)
936
+ response = begin_delete_async(resource_group_name, account_name, custom_headers).value!
937
+ nil
938
+ end
939
+
940
+ #
941
+ # Deletes the specified Batch account.
942
+ #
943
+ # @param resource_group_name [String] The name of the resource group that
944
+ # contains the Batch account to be deleted.
945
+ # @param account_name [String] The name of the account to be deleted.
946
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
947
+ # will be added to the HTTP request.
948
+ #
949
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
950
+ #
951
+ def begin_delete_with_http_info(resource_group_name, account_name, custom_headers = nil)
952
+ begin_delete_async(resource_group_name, account_name, custom_headers).value!
953
+ end
954
+
955
+ #
956
+ # Deletes the specified Batch account.
957
+ #
958
+ # @param resource_group_name [String] The name of the resource group that
959
+ # contains the Batch account to be deleted.
960
+ # @param account_name [String] The name of the account to be deleted.
961
+ # @param [Hash{String => String}] A hash of custom headers that will be added
962
+ # to the HTTP request.
963
+ #
964
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
965
+ #
966
+ def begin_delete_async(resource_group_name, account_name, custom_headers = nil)
967
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
968
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
969
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
970
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
971
+
972
+
973
+ request_headers = {}
974
+
975
+ # Set Headers
976
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
977
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
978
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'
979
+
980
+ request_url = @base_url || @client.base_url
981
+
982
+ options = {
983
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
984
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
985
+ query_params: {'api-version' => @client.api_version},
986
+ headers: request_headers.merge(custom_headers || {}),
987
+ base_url: request_url
988
+ }
989
+ promise = @client.make_request_async(:delete, path_template, options)
990
+
991
+ promise = promise.then do |result|
992
+ http_response = result.response
993
+ status_code = http_response.status
994
+ response_content = http_response.body
995
+ unless status_code == 200 || status_code == 202
996
+ error_model = JSON.load(response_content)
997
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
998
+ end
999
+
1000
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1001
+
1002
+ result
1003
+ end
1004
+
1005
+ promise.execute
1006
+ end
1007
+
1008
+ #
1009
+ # Gets information about the Batch accounts associated with the subscription.
1010
+ #
1011
+ # @param next_page_link [String] The NextLink from the previous successful call
1012
+ # to List operation.
1013
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1014
+ # will be added to the HTTP request.
1015
+ #
1016
+ # @return [BatchAccountListResult] operation results.
1017
+ #
1018
+ def list_next(next_page_link, custom_headers = nil)
1019
+ response = list_next_async(next_page_link, custom_headers).value!
1020
+ response.body unless response.nil?
1021
+ end
1022
+
1023
+ #
1024
+ # Gets information about the Batch accounts associated with the subscription.
1025
+ #
1026
+ # @param next_page_link [String] The NextLink from the previous successful call
1027
+ # to List operation.
1028
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1029
+ # will be added to the HTTP request.
1030
+ #
1031
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1032
+ #
1033
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
1034
+ list_next_async(next_page_link, custom_headers).value!
1035
+ end
1036
+
1037
+ #
1038
+ # Gets information about the Batch accounts associated with the subscription.
1039
+ #
1040
+ # @param next_page_link [String] The NextLink from the previous successful call
1041
+ # to List operation.
1042
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1043
+ # to the HTTP request.
1044
+ #
1045
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1046
+ #
1047
+ def list_next_async(next_page_link, custom_headers = nil)
1048
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1049
+
1050
+
1051
+ request_headers = {}
1052
+
1053
+ # Set Headers
1054
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1055
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1056
+ path_template = '{nextLink}'
1057
+
1058
+ request_url = @base_url || @client.base_url
1059
+
1060
+ options = {
1061
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1062
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1063
+ headers: request_headers.merge(custom_headers || {}),
1064
+ base_url: request_url
1065
+ }
1066
+ promise = @client.make_request_async(:get, path_template, options)
1067
+
1068
+ promise = promise.then do |result|
1069
+ http_response = result.response
1070
+ status_code = http_response.status
1071
+ response_content = http_response.body
1072
+ unless status_code == 200
1073
+ error_model = JSON.load(response_content)
1074
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1075
+ end
1076
+
1077
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1078
+ # Deserialize Response
1079
+ if status_code == 200
1080
+ begin
1081
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1082
+ result_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::BatchAccountListResult.mapper()
1083
+ result.body = @client.deserialize(result_mapper, parsed_response)
1084
+ rescue Exception => e
1085
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1086
+ end
1087
+ end
1088
+
1089
+ result
1090
+ end
1091
+
1092
+ promise.execute
1093
+ end
1094
+
1095
+ #
1096
+ # Gets information about the Batch accounts associated within the specified
1097
+ # resource group.
1098
+ #
1099
+ # @param next_page_link [String] The NextLink from the previous successful call
1100
+ # to List operation.
1101
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1102
+ # will be added to the HTTP request.
1103
+ #
1104
+ # @return [BatchAccountListResult] operation results.
1105
+ #
1106
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
1107
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
1108
+ response.body unless response.nil?
1109
+ end
1110
+
1111
+ #
1112
+ # Gets information about the Batch accounts associated within the specified
1113
+ # resource group.
1114
+ #
1115
+ # @param next_page_link [String] The NextLink from the previous successful call
1116
+ # to List operation.
1117
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1118
+ # will be added to the HTTP request.
1119
+ #
1120
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1121
+ #
1122
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
1123
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
1124
+ end
1125
+
1126
+ #
1127
+ # Gets information about the Batch accounts associated within the specified
1128
+ # resource group.
1129
+ #
1130
+ # @param next_page_link [String] The NextLink from the previous successful call
1131
+ # to List operation.
1132
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1133
+ # to the HTTP request.
1134
+ #
1135
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1136
+ #
1137
+ def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
1138
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1139
+
1140
+
1141
+ request_headers = {}
1142
+
1143
+ # Set Headers
1144
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1145
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1146
+ path_template = '{nextLink}'
1147
+
1148
+ request_url = @base_url || @client.base_url
1149
+
1150
+ options = {
1151
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1152
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1153
+ headers: request_headers.merge(custom_headers || {}),
1154
+ base_url: request_url
1155
+ }
1156
+ promise = @client.make_request_async(:get, path_template, options)
1157
+
1158
+ promise = promise.then do |result|
1159
+ http_response = result.response
1160
+ status_code = http_response.status
1161
+ response_content = http_response.body
1162
+ unless status_code == 200
1163
+ error_model = JSON.load(response_content)
1164
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1165
+ end
1166
+
1167
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1168
+ # Deserialize Response
1169
+ if status_code == 200
1170
+ begin
1171
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1172
+ result_mapper = Azure::Batch::Mgmt::V2015_12_01::Models::BatchAccountListResult.mapper()
1173
+ result.body = @client.deserialize(result_mapper, parsed_response)
1174
+ rescue Exception => e
1175
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1176
+ end
1177
+ end
1178
+
1179
+ result
1180
+ end
1181
+
1182
+ promise.execute
1183
+ end
1184
+
1185
+ #
1186
+ # Gets information about the Batch accounts associated with the subscription.
1187
+ #
1188
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1189
+ # will be added to the HTTP request.
1190
+ #
1191
+ # @return [BatchAccountListResult] which provide lazy access to pages of the
1192
+ # response.
1193
+ #
1194
+ def list_as_lazy(custom_headers = nil)
1195
+ response = list_async(custom_headers).value!
1196
+ unless response.nil?
1197
+ page = response.body
1198
+ page.next_method = Proc.new do |next_page_link|
1199
+ list_next_async(next_page_link, custom_headers)
1200
+ end
1201
+ page
1202
+ end
1203
+ end
1204
+
1205
+ #
1206
+ # Gets information about the Batch accounts associated within the specified
1207
+ # resource group.
1208
+ #
1209
+ # @param resource_group_name [String] The name of the resource group whose
1210
+ # Batch accounts to list.
1211
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1212
+ # will be added to the HTTP request.
1213
+ #
1214
+ # @return [BatchAccountListResult] which provide lazy access to pages of the
1215
+ # response.
1216
+ #
1217
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
1218
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
1219
+ unless response.nil?
1220
+ page = response.body
1221
+ page.next_method = Proc.new do |next_page_link|
1222
+ list_by_resource_group_next_async(next_page_link, custom_headers)
1223
+ end
1224
+ page
1225
+ end
1226
+ end
1227
+
1228
+ end
1229
+ end