azure_mgmt_batch 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/Rakefile +5 -0
  5. data/azure_mgmt_batch.gemspec +34 -0
  6. data/lib/azure_mgmt_batch.rb +5 -0
  7. data/lib/generated/azure_mgmt_batch.rb +51 -0
  8. data/lib/generated/azure_mgmt_batch/account.rb +1263 -0
  9. data/lib/generated/azure_mgmt_batch/application_operations.rb +1068 -0
  10. data/lib/generated/azure_mgmt_batch/batch_management_client.rb +75 -0
  11. data/lib/generated/azure_mgmt_batch/models/account_key_type.rb +16 -0
  12. data/lib/generated/azure_mgmt_batch/models/account_provisioning_state.rb +20 -0
  13. data/lib/generated/azure_mgmt_batch/models/account_resource.rb +146 -0
  14. data/lib/generated/azure_mgmt_batch/models/activate_application_package_parameters.rb +45 -0
  15. data/lib/generated/azure_mgmt_batch/models/add_application_package_result.rb +75 -0
  16. data/lib/generated/azure_mgmt_batch/models/add_application_parameters.rb +55 -0
  17. data/lib/generated/azure_mgmt_batch/models/application.rb +96 -0
  18. data/lib/generated/azure_mgmt_batch/models/application_package.rb +78 -0
  19. data/lib/generated/azure_mgmt_batch/models/auto_storage_base_properties.rb +45 -0
  20. data/lib/generated/azure_mgmt_batch/models/auto_storage_properties.rb +57 -0
  21. data/lib/generated/azure_mgmt_batch/models/batch_account_create_parameters.rb +74 -0
  22. data/lib/generated/azure_mgmt_batch/models/batch_account_list_key_result.rb +54 -0
  23. data/lib/generated/azure_mgmt_batch/models/batch_account_list_result.rb +94 -0
  24. data/lib/generated/azure_mgmt_batch/models/batch_account_regenerate_key_parameters.rb +46 -0
  25. data/lib/generated/azure_mgmt_batch/models/batch_account_regenerate_key_result.rb +54 -0
  26. data/lib/generated/azure_mgmt_batch/models/batch_account_update_parameters.rb +64 -0
  27. data/lib/generated/azure_mgmt_batch/models/get_application_package_result.rb +109 -0
  28. data/lib/generated/azure_mgmt_batch/models/list_applications_result.rb +93 -0
  29. data/lib/generated/azure_mgmt_batch/models/package_state.rb +17 -0
  30. data/lib/generated/azure_mgmt_batch/models/subscription_quotas_get_result.rb +45 -0
  31. data/lib/generated/azure_mgmt_batch/models/update_application_parameters.rb +66 -0
  32. data/lib/generated/azure_mgmt_batch/module_definition.rb +8 -0
  33. data/lib/generated/azure_mgmt_batch/subscription.rb +116 -0
  34. data/lib/generated/azure_mgmt_batch/version.rb +8 -0
  35. metadata +147 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 787f5e47862b2d3bb0fabb7186ae963c0448aed5
4
+ data.tar.gz: dac00466bb85259fc68b67d0536712b393ede45e
5
+ SHA512:
6
+ metadata.gz: 5a90a00b9082b4206d030991a5ea6b0af3ce1e4598cbe23a8e0da51b47777c0cd17f459975f4ab66417442f86ec126296390897ecda316f0d4e96ccd05c85b5f
7
+ data.tar.gz: 5305d3e5ccd3bc230dadf6f0105241895a1fc699b2368c27d8a3abddb5f7746c4910bff782f93471050238ca8c0d31c136eede427d9414531728ae7470beec2f
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require "bundler/gem_tasks"
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ lib = File.expand_path('../lib', __FILE__)
6
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
+
8
+ require 'generated/azure_mgmt_batch/module_definition'
9
+ require 'generated/azure_mgmt_batch/version'
10
+
11
+ Gem::Specification.new do |spec|
12
+ spec.name = 'azure_mgmt_batch'
13
+ spec.version = Azure::ARM::Batch::VERSION
14
+ spec.authors = 'Microsoft Corporation'
15
+ spec.email = 'azrubyteam@microsoft.com'
16
+ spec.description = 'Microsoft Azure Batch Management Client Library for Ruby'
17
+ spec.summary = 'Official Ruby client library to consume Microsoft Azure Batch Management services.'
18
+ spec.homepage = 'https://aka.ms/azure-sdk-for-ruby'
19
+ spec.license = 'MIT'
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.bindir = 'bin'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.required_ruby_version = '>= 1.9.3'
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.9'
29
+ spec.add_development_dependency 'rake', '~> 10'
30
+ spec.add_development_dependency 'rspec', '~> 3'
31
+ spec.add_development_dependency 'dotenv', '~> 2'
32
+
33
+ spec.add_runtime_dependency 'ms_rest_azure', '~> 0.3.0'
34
+ end
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require 'generated/azure_mgmt_batch'
@@ -0,0 +1,51 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require 'generated/azure_mgmt_batch/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::ARM::Batch
23
+ autoload :Account, 'generated/azure_mgmt_batch/account.rb'
24
+ autoload :ApplicationOperations, 'generated/azure_mgmt_batch/application_operations.rb'
25
+ autoload :Subscription, 'generated/azure_mgmt_batch/subscription.rb'
26
+ autoload :BatchManagementClient, 'generated/azure_mgmt_batch/batch_management_client.rb'
27
+
28
+ module Models
29
+ autoload :AutoStorageBaseProperties, 'generated/azure_mgmt_batch/models/auto_storage_base_properties.rb'
30
+ autoload :BatchAccountCreateParameters, 'generated/azure_mgmt_batch/models/batch_account_create_parameters.rb'
31
+ autoload :AutoStorageProperties, 'generated/azure_mgmt_batch/models/auto_storage_properties.rb'
32
+ autoload :BatchAccountUpdateParameters, 'generated/azure_mgmt_batch/models/batch_account_update_parameters.rb'
33
+ autoload :BatchAccountListResult, 'generated/azure_mgmt_batch/models/batch_account_list_result.rb'
34
+ autoload :BatchAccountRegenerateKeyParameters, 'generated/azure_mgmt_batch/models/batch_account_regenerate_key_parameters.rb'
35
+ autoload :BatchAccountRegenerateKeyResult, 'generated/azure_mgmt_batch/models/batch_account_regenerate_key_result.rb'
36
+ autoload :BatchAccountListKeyResult, 'generated/azure_mgmt_batch/models/batch_account_list_key_result.rb'
37
+ autoload :ActivateApplicationPackageParameters, 'generated/azure_mgmt_batch/models/activate_application_package_parameters.rb'
38
+ autoload :AddApplicationParameters, 'generated/azure_mgmt_batch/models/add_application_parameters.rb'
39
+ autoload :AddApplicationPackageResult, 'generated/azure_mgmt_batch/models/add_application_package_result.rb'
40
+ autoload :ApplicationPackage, 'generated/azure_mgmt_batch/models/application_package.rb'
41
+ autoload :Application, 'generated/azure_mgmt_batch/models/application.rb'
42
+ autoload :GetApplicationPackageResult, 'generated/azure_mgmt_batch/models/get_application_package_result.rb'
43
+ autoload :ListApplicationsResult, 'generated/azure_mgmt_batch/models/list_applications_result.rb'
44
+ autoload :UpdateApplicationParameters, 'generated/azure_mgmt_batch/models/update_application_parameters.rb'
45
+ autoload :SubscriptionQuotasGetResult, 'generated/azure_mgmt_batch/models/subscription_quotas_get_result.rb'
46
+ autoload :AccountResource, 'generated/azure_mgmt_batch/models/account_resource.rb'
47
+ autoload :AccountProvisioningState, 'generated/azure_mgmt_batch/models/account_provisioning_state.rb'
48
+ autoload :AccountKeyType, 'generated/azure_mgmt_batch/models/account_key_type.rb'
49
+ autoload :PackageState, 'generated/azure_mgmt_batch/models/package_state.rb'
50
+ end
51
+ end
@@ -0,0 +1,1263 @@
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
+ # Account
9
+ #
10
+ class Account
11
+ include Azure::ARM::Batch::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Account class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return reference to the BatchManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Creates a new Batch account with the specified parameters. Existing accounts
27
+ # cannot be updated with this API and should instead be updated with the
28
+ # Update Batch Account API.
29
+ #
30
+ # @param resource_group_name [String] The name of the resource group that
31
+ # contains the new Batch account.
32
+ # @param account_name [String] A name for the Batch account which must be
33
+ # unique within the region. Batch account names must be between 3 and 24
34
+ # characters in length and must use only numbers and lowercase letters. This
35
+ # name is used as part of the DNS name that is used to access the Batch
36
+ # service in the region in which the account is created. For example:
37
+ # http://accountname.region.batch.azure.com/.
38
+ # @param parameters [BatchAccountCreateParameters] Additional parameters for
39
+ # account creation.
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [AccountResource] operation results.
44
+ #
45
+ def create(resource_group_name, account_name, parameters, custom_headers = nil)
46
+ response = create_async(resource_group_name, account_name, parameters, custom_headers).value!
47
+ response.body unless response.nil?
48
+ end
49
+
50
+ #
51
+ # @param resource_group_name [String] The name of the resource group that
52
+ # contains the new Batch account.
53
+ # @param account_name [String] A name for the Batch account which must be
54
+ # unique within the region. Batch account names must be between 3 and 24
55
+ # characters in length and must use only numbers and lowercase letters. This
56
+ # name is used as part of the DNS name that is used to access the Batch
57
+ # service in the region in which the account is created. For example:
58
+ # http://accountname.region.batch.azure.com/.
59
+ # @param parameters [BatchAccountCreateParameters] Additional parameters for
60
+ # account creation.
61
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
62
+ # will be added to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] promise which provides async access to http
65
+ # response.
66
+ #
67
+ def create_async(resource_group_name, account_name, parameters, custom_headers = nil)
68
+ # Send request
69
+ promise = begin_create_async(resource_group_name, account_name, parameters, custom_headers)
70
+
71
+ promise = promise.then do |response|
72
+ # Defining deserialization method.
73
+ deserialize_method = lambda do |parsed_response|
74
+ result_mapper = AccountResource.mapper()
75
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
76
+ end
77
+
78
+ # Waiting for response.
79
+ @client.get_long_running_operation_result(response, deserialize_method)
80
+ end
81
+
82
+ promise
83
+ end
84
+
85
+ #
86
+ # Creates a new Batch account with the specified parameters. Existing accounts
87
+ # cannot be updated with this API and should instead be updated with the
88
+ # Update Batch Account API.
89
+ #
90
+ # @param resource_group_name [String] The name of the resource group that
91
+ # contains the new Batch account.
92
+ # @param account_name [String] A name for the Batch account which must be
93
+ # unique within the region. Batch account names must be between 3 and 24
94
+ # characters in length and must use only numbers and lowercase letters. This
95
+ # name is used as part of the DNS name that is used to access the Batch
96
+ # service in the region in which the account is created. For example:
97
+ # http://accountname.region.batch.azure.com/.
98
+ # @param parameters [BatchAccountCreateParameters] Additional parameters for
99
+ # account creation.
100
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
101
+ # will be added to the HTTP request.
102
+ #
103
+ # @return [AccountResource] operation results.
104
+ #
105
+ def begin_create(resource_group_name, account_name, parameters, custom_headers = nil)
106
+ response = begin_create_async(resource_group_name, account_name, parameters, custom_headers).value!
107
+ response.body unless response.nil?
108
+ end
109
+
110
+ #
111
+ # Creates a new Batch account with the specified parameters. Existing accounts
112
+ # cannot be updated with this API and should instead be updated with the
113
+ # Update Batch Account API.
114
+ #
115
+ # @param resource_group_name [String] The name of the resource group that
116
+ # contains the new Batch account.
117
+ # @param account_name [String] A name for the Batch account which must be
118
+ # unique within the region. Batch account names must be between 3 and 24
119
+ # characters in length and must use only numbers and lowercase letters. This
120
+ # name is used as part of the DNS name that is used to access the Batch
121
+ # service in the region in which the account is created. For example:
122
+ # http://accountname.region.batch.azure.com/.
123
+ # @param parameters [BatchAccountCreateParameters] Additional parameters for
124
+ # account creation.
125
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
126
+ # will be added to the HTTP request.
127
+ #
128
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
129
+ #
130
+ def begin_create_with_http_info(resource_group_name, account_name, parameters, custom_headers = nil)
131
+ begin_create_async(resource_group_name, account_name, parameters, custom_headers).value!
132
+ end
133
+
134
+ #
135
+ # Creates a new Batch account with the specified parameters. Existing accounts
136
+ # cannot be updated with this API and should instead be updated with the
137
+ # Update Batch Account API.
138
+ #
139
+ # @param resource_group_name [String] The name of the resource group that
140
+ # contains the new Batch account.
141
+ # @param account_name [String] A name for the Batch account which must be
142
+ # unique within the region. Batch account names must be between 3 and 24
143
+ # characters in length and must use only numbers and lowercase letters. This
144
+ # name is used as part of the DNS name that is used to access the Batch
145
+ # service in the region in which the account is created. For example:
146
+ # http://accountname.region.batch.azure.com/.
147
+ # @param parameters [BatchAccountCreateParameters] Additional parameters for
148
+ # account creation.
149
+ # @param [Hash{String => String}] A hash of custom headers that will be added
150
+ # to the HTTP request.
151
+ #
152
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
153
+ #
154
+ def begin_create_async(resource_group_name, account_name, parameters, custom_headers = nil)
155
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
156
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
157
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
158
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
159
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
160
+
161
+
162
+ request_headers = {}
163
+
164
+ # Set Headers
165
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
166
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
167
+
168
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
169
+
170
+ # Serialize Request
171
+ request_mapper = BatchAccountCreateParameters.mapper()
172
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
173
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
174
+
175
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'
176
+ options = {
177
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
178
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
179
+ query_params: {'api-version' => @client.api_version},
180
+ body: request_content,
181
+ headers: request_headers.merge(custom_headers || {})
182
+ }
183
+
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|
192
+ status_code = http_response.status
193
+ response_content = http_response.body
194
+ unless status_code == 202 || status_code == 200
195
+ error_model = JSON.load(response_content)
196
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
197
+ end
198
+
199
+ # Create Result
200
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
201
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
202
+ # Deserialize Response
203
+ if status_code == 200
204
+ begin
205
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
206
+ result_mapper = AccountResource.mapper()
207
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
208
+ rescue Exception => e
209
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
210
+ end
211
+ end
212
+
213
+ result
214
+ end
215
+
216
+ promise.execute
217
+ end
218
+
219
+ #
220
+ # Updates the properties of an existing Batch account.
221
+ #
222
+ # @param resource_group_name [String] The name of the resource group that
223
+ # contains the Batch account.
224
+ # @param account_name [String] The name of the account.
225
+ # @param parameters [BatchAccountUpdateParameters] Additional parameters for
226
+ # account update.
227
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
228
+ # will be added to the HTTP request.
229
+ #
230
+ # @return [AccountResource] operation results.
231
+ #
232
+ def update(resource_group_name, account_name, parameters, custom_headers = nil)
233
+ response = update_async(resource_group_name, account_name, parameters, custom_headers).value!
234
+ response.body unless response.nil?
235
+ end
236
+
237
+ #
238
+ # Updates the properties of an existing Batch account.
239
+ #
240
+ # @param resource_group_name [String] The name of the resource group that
241
+ # contains the Batch account.
242
+ # @param account_name [String] The name of the account.
243
+ # @param parameters [BatchAccountUpdateParameters] Additional parameters for
244
+ # account update.
245
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
246
+ # will be added to the HTTP request.
247
+ #
248
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
249
+ #
250
+ def update_with_http_info(resource_group_name, account_name, parameters, custom_headers = nil)
251
+ update_async(resource_group_name, account_name, parameters, custom_headers).value!
252
+ end
253
+
254
+ #
255
+ # Updates the properties of an existing Batch account.
256
+ #
257
+ # @param resource_group_name [String] The name of the resource group that
258
+ # contains the Batch account.
259
+ # @param account_name [String] The name of the account.
260
+ # @param parameters [BatchAccountUpdateParameters] Additional parameters for
261
+ # account update.
262
+ # @param [Hash{String => String}] A hash of custom headers that will be added
263
+ # to the HTTP request.
264
+ #
265
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
266
+ #
267
+ def update_async(resource_group_name, account_name, parameters, custom_headers = nil)
268
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
269
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
270
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
271
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
272
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
273
+
274
+
275
+ request_headers = {}
276
+
277
+ # Set Headers
278
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
279
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
280
+
281
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
282
+
283
+ # Serialize Request
284
+ request_mapper = BatchAccountUpdateParameters.mapper()
285
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
286
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
287
+
288
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'
289
+ options = {
290
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
291
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
292
+ query_params: {'api-version' => @client.api_version},
293
+ body: request_content,
294
+ headers: request_headers.merge(custom_headers || {})
295
+ }
296
+
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|
305
+ status_code = http_response.status
306
+ response_content = http_response.body
307
+ unless status_code == 200
308
+ error_model = JSON.load(response_content)
309
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
310
+ end
311
+
312
+ # Create Result
313
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
314
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
315
+ # Deserialize Response
316
+ if status_code == 200
317
+ begin
318
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
319
+ result_mapper = AccountResource.mapper()
320
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
321
+ rescue Exception => e
322
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
323
+ end
324
+ end
325
+
326
+ result
327
+ end
328
+
329
+ promise.execute
330
+ end
331
+
332
+ #
333
+ # Deletes the specified Batch account.
334
+ #
335
+ # @param resource_group_name [String] The name of the resource group that
336
+ # contains the Batch account to be deleted.
337
+ # @param account_name [String] The name of the account to be deleted.
338
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
339
+ # will be added to the HTTP request.
340
+ #
341
+ def delete(resource_group_name, account_name, custom_headers = nil)
342
+ response = delete_async(resource_group_name, account_name, custom_headers).value!
343
+ nil
344
+ end
345
+
346
+ #
347
+ # @param resource_group_name [String] The name of the resource group that
348
+ # contains the Batch account to be deleted.
349
+ # @param account_name [String] The name of the account to be deleted.
350
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
351
+ # will be added to the HTTP request.
352
+ #
353
+ # @return [Concurrent::Promise] promise which provides async access to http
354
+ # response.
355
+ #
356
+ def delete_async(resource_group_name, account_name, custom_headers = nil)
357
+ # Send request
358
+ promise = begin_delete_async(resource_group_name, account_name, custom_headers)
359
+
360
+ promise = promise.then do |response|
361
+ # Defining deserialization method.
362
+ deserialize_method = lambda do |parsed_response|
363
+ end
364
+
365
+ # Waiting for response.
366
+ @client.get_long_running_operation_result(response, deserialize_method)
367
+ end
368
+
369
+ promise
370
+ end
371
+
372
+ #
373
+ # Deletes the specified Batch account.
374
+ #
375
+ # @param resource_group_name [String] The name of the resource group that
376
+ # contains the Batch account to be deleted.
377
+ # @param account_name [String] The name of the account to be deleted.
378
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
379
+ # will be added to the HTTP request.
380
+ #
381
+ #
382
+ def begin_delete(resource_group_name, account_name, custom_headers = nil)
383
+ response = begin_delete_async(resource_group_name, account_name, custom_headers).value!
384
+ nil
385
+ end
386
+
387
+ #
388
+ # Deletes the specified Batch account.
389
+ #
390
+ # @param resource_group_name [String] The name of the resource group that
391
+ # contains the Batch account to be deleted.
392
+ # @param account_name [String] The name of the account to be deleted.
393
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
394
+ # will be added to the HTTP request.
395
+ #
396
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
397
+ #
398
+ def begin_delete_with_http_info(resource_group_name, account_name, custom_headers = nil)
399
+ begin_delete_async(resource_group_name, account_name, custom_headers).value!
400
+ end
401
+
402
+ #
403
+ # Deletes the specified Batch account.
404
+ #
405
+ # @param resource_group_name [String] The name of the resource group that
406
+ # contains the Batch account to be deleted.
407
+ # @param account_name [String] The name of the account to be deleted.
408
+ # @param [Hash{String => String}] A hash of custom headers that will be added
409
+ # to the HTTP request.
410
+ #
411
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
412
+ #
413
+ def begin_delete_async(resource_group_name, account_name, custom_headers = nil)
414
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
415
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
416
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
417
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
418
+
419
+
420
+ request_headers = {}
421
+
422
+ # Set Headers
423
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
424
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
425
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'
426
+ options = {
427
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
428
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
429
+ query_params: {'api-version' => @client.api_version},
430
+ headers: request_headers.merge(custom_headers || {})
431
+ }
432
+
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|
441
+ status_code = http_response.status
442
+ response_content = http_response.body
443
+ unless status_code == 202 || status_code == 204 || status_code == 200
444
+ error_model = JSON.load(response_content)
445
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
446
+ end
447
+
448
+ # Create Result
449
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
450
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
451
+
452
+ result
453
+ end
454
+
455
+ promise.execute
456
+ end
457
+
458
+ #
459
+ # Gets information about the specified Batch account.
460
+ #
461
+ # @param resource_group_name [String] The name of the resource group that
462
+ # contains the Batch account.
463
+ # @param account_name [String] The name of the account.
464
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
465
+ # will be added to the HTTP request.
466
+ #
467
+ # @return [AccountResource] operation results.
468
+ #
469
+ def get(resource_group_name, account_name, custom_headers = nil)
470
+ response = get_async(resource_group_name, account_name, custom_headers).value!
471
+ response.body unless response.nil?
472
+ end
473
+
474
+ #
475
+ # Gets information about the specified Batch account.
476
+ #
477
+ # @param resource_group_name [String] The name of the resource group that
478
+ # contains the Batch account.
479
+ # @param account_name [String] The name of the account.
480
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
481
+ # will be added to the HTTP request.
482
+ #
483
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
484
+ #
485
+ def get_with_http_info(resource_group_name, account_name, custom_headers = nil)
486
+ get_async(resource_group_name, account_name, custom_headers).value!
487
+ end
488
+
489
+ #
490
+ # Gets information about the specified Batch account.
491
+ #
492
+ # @param resource_group_name [String] The name of the resource group that
493
+ # contains the Batch account.
494
+ # @param account_name [String] The name of the account.
495
+ # @param [Hash{String => String}] A hash of custom headers that will be added
496
+ # to the HTTP request.
497
+ #
498
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
499
+ #
500
+ def get_async(resource_group_name, account_name, custom_headers = nil)
501
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
502
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
503
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
504
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
505
+
506
+
507
+ request_headers = {}
508
+
509
+ # Set Headers
510
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
511
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
512
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}'
513
+ options = {
514
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
515
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
516
+ query_params: {'api-version' => @client.api_version},
517
+ headers: request_headers.merge(custom_headers || {})
518
+ }
519
+
520
+ request_url = @base_url || @client.base_url
521
+
522
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :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|
528
+ status_code = http_response.status
529
+ response_content = http_response.body
530
+ unless status_code == 200
531
+ error_model = JSON.load(response_content)
532
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
533
+ end
534
+
535
+ # Create Result
536
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
537
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
538
+ # Deserialize Response
539
+ if status_code == 200
540
+ begin
541
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
542
+ result_mapper = AccountResource.mapper()
543
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
544
+ rescue Exception => e
545
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
546
+ end
547
+ end
548
+
549
+ result
550
+ end
551
+
552
+ promise.execute
553
+ end
554
+
555
+ #
556
+ # Gets information about the Batch accounts associated with the subscription.
557
+ #
558
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
559
+ # will be added to the HTTP request.
560
+ #
561
+ # @return [BatchAccountListResult] which provide lazy access to pages of the
562
+ # response.
563
+ #
564
+ def list_as_lazy(custom_headers = nil)
565
+ response = list_async(custom_headers).value!
566
+ unless response.nil?
567
+ page = response.body
568
+ page.next_method = Proc.new do |next_link|
569
+ list_next_async(next_link, custom_headers)
570
+ end
571
+ page
572
+ end
573
+ end
574
+
575
+ #
576
+ # Gets information about the Batch accounts associated with the subscription.
577
+ #
578
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
579
+ # will be added to the HTTP request.
580
+ #
581
+ # @return [Array<AccountResource>] operation results.
582
+ #
583
+ def list(custom_headers = nil)
584
+ first_page = list_as_lazy(custom_headers)
585
+ first_page.get_all_items
586
+ end
587
+
588
+ #
589
+ # Gets information about the Batch accounts associated with the subscription.
590
+ #
591
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
592
+ # will be added to the HTTP request.
593
+ #
594
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
595
+ #
596
+ def list_with_http_info(custom_headers = nil)
597
+ list_async(custom_headers).value!
598
+ end
599
+
600
+ #
601
+ # Gets information about the Batch accounts associated with the subscription.
602
+ #
603
+ # @param [Hash{String => String}] A hash of custom headers that will be added
604
+ # to the HTTP request.
605
+ #
606
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
607
+ #
608
+ def list_async(custom_headers = nil)
609
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
610
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
611
+
612
+
613
+ request_headers = {}
614
+
615
+ # Set Headers
616
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
617
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
618
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts'
619
+ options = {
620
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
621
+ path_params: {'subscriptionId' => @client.subscription_id},
622
+ query_params: {'api-version' => @client.api_version},
623
+ headers: request_headers.merge(custom_headers || {})
624
+ }
625
+
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|
634
+ status_code = http_response.status
635
+ response_content = http_response.body
636
+ unless status_code == 200
637
+ error_model = JSON.load(response_content)
638
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
639
+ end
640
+
641
+ # Create Result
642
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
643
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
644
+ # Deserialize Response
645
+ if status_code == 200
646
+ begin
647
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
648
+ result_mapper = BatchAccountListResult.mapper()
649
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
650
+ rescue Exception => e
651
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
652
+ end
653
+ end
654
+
655
+ result
656
+ end
657
+
658
+ promise.execute
659
+ end
660
+
661
+ #
662
+ # Gets information about the Batch accounts associated within the specified
663
+ # resource group.
664
+ #
665
+ # @param resource_group_name [String] The name of the resource group whose
666
+ # Batch accounts to list.
667
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
668
+ # will be added to the HTTP request.
669
+ #
670
+ # @return [BatchAccountListResult] which provide lazy access to pages of the
671
+ # response.
672
+ #
673
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
674
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
675
+ unless response.nil?
676
+ page = response.body
677
+ page.next_method = Proc.new do |next_link|
678
+ list_by_resource_group_next_async(next_link, custom_headers)
679
+ end
680
+ page
681
+ end
682
+ end
683
+
684
+ #
685
+ # Gets information about the Batch accounts associated within the specified
686
+ # resource group.
687
+ #
688
+ # @param resource_group_name [String] The name of the resource group whose
689
+ # Batch accounts to list.
690
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
691
+ # will be added to the HTTP request.
692
+ #
693
+ # @return [Array<AccountResource>] operation results.
694
+ #
695
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
696
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
697
+ first_page.get_all_items
698
+ end
699
+
700
+ #
701
+ # Gets information about the Batch accounts associated within the specified
702
+ # resource group.
703
+ #
704
+ # @param resource_group_name [String] The name of the resource group whose
705
+ # Batch accounts to list.
706
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
707
+ # will be added to the HTTP request.
708
+ #
709
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
710
+ #
711
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
712
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
713
+ end
714
+
715
+ #
716
+ # Gets information about the Batch accounts associated within the specified
717
+ # resource group.
718
+ #
719
+ # @param resource_group_name [String] The name of the resource group whose
720
+ # Batch accounts to list.
721
+ # @param [Hash{String => String}] A hash of custom headers that will be added
722
+ # to the HTTP request.
723
+ #
724
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
725
+ #
726
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
727
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
728
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
729
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
730
+
731
+
732
+ request_headers = {}
733
+
734
+ # Set Headers
735
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
736
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
737
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts'
738
+ options = {
739
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
740
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
741
+ query_params: {'api-version' => @client.api_version},
742
+ headers: request_headers.merge(custom_headers || {})
743
+ }
744
+
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|
753
+ status_code = http_response.status
754
+ response_content = http_response.body
755
+ unless status_code == 200
756
+ error_model = JSON.load(response_content)
757
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
758
+ end
759
+
760
+ # Create Result
761
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
762
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
763
+ # Deserialize Response
764
+ if status_code == 200
765
+ begin
766
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
767
+ result_mapper = BatchAccountListResult.mapper()
768
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
769
+ rescue Exception => e
770
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
771
+ end
772
+ end
773
+
774
+ result
775
+ end
776
+
777
+ promise.execute
778
+ end
779
+
780
+ #
781
+ # Synchronizes access keys for the auto storage account configured for the
782
+ # specified Batch account.
783
+ #
784
+ # @param resource_group_name [String] The name of the resource group that
785
+ # contains the Batch account.
786
+ # @param account_name [String] The name of the Batch account.
787
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
788
+ # will be added to the HTTP request.
789
+ #
790
+ #
791
+ def synchronize_auto_storage_keys(resource_group_name, account_name, custom_headers = nil)
792
+ response = synchronize_auto_storage_keys_async(resource_group_name, account_name, custom_headers).value!
793
+ nil
794
+ end
795
+
796
+ #
797
+ # Synchronizes access keys for the auto storage account configured for the
798
+ # specified Batch account.
799
+ #
800
+ # @param resource_group_name [String] The name of the resource group that
801
+ # contains the Batch account.
802
+ # @param account_name [String] The name of the Batch account.
803
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
804
+ # will be added to the HTTP request.
805
+ #
806
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
807
+ #
808
+ def synchronize_auto_storage_keys_with_http_info(resource_group_name, account_name, custom_headers = nil)
809
+ synchronize_auto_storage_keys_async(resource_group_name, account_name, custom_headers).value!
810
+ end
811
+
812
+ #
813
+ # Synchronizes access keys for the auto storage account configured for the
814
+ # specified Batch account.
815
+ #
816
+ # @param resource_group_name [String] The name of the resource group that
817
+ # contains the Batch account.
818
+ # @param account_name [String] The name of the Batch account.
819
+ # @param [Hash{String => String}] A hash of custom headers that will be added
820
+ # to the HTTP request.
821
+ #
822
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
823
+ #
824
+ def synchronize_auto_storage_keys_async(resource_group_name, account_name, custom_headers = nil)
825
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
826
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
827
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
828
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
829
+
830
+
831
+ request_headers = {}
832
+
833
+ # Set Headers
834
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
835
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
836
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys'
837
+ options = {
838
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
839
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
840
+ query_params: {'api-version' => @client.api_version},
841
+ headers: request_headers.merge(custom_headers || {})
842
+ }
843
+
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|
852
+ status_code = http_response.status
853
+ response_content = http_response.body
854
+ unless status_code == 204
855
+ error_model = JSON.load(response_content)
856
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
857
+ end
858
+
859
+ # Create Result
860
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
861
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
862
+
863
+ result
864
+ end
865
+
866
+ promise.execute
867
+ end
868
+
869
+ #
870
+ # Regenerates the specified account key for the specified Batch account.
871
+ #
872
+ # @param resource_group_name [String] The name of the resource group that
873
+ # contains the Batch account.
874
+ # @param account_name [String] The name of the account.
875
+ # @param parameters [BatchAccountRegenerateKeyParameters] The type of key to
876
+ # regenerate.
877
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
878
+ # will be added to the HTTP request.
879
+ #
880
+ # @return [BatchAccountRegenerateKeyResult] operation results.
881
+ #
882
+ def regenerate_key(resource_group_name, account_name, parameters, custom_headers = nil)
883
+ response = regenerate_key_async(resource_group_name, account_name, parameters, custom_headers).value!
884
+ response.body unless response.nil?
885
+ end
886
+
887
+ #
888
+ # Regenerates the specified account key for the specified Batch account.
889
+ #
890
+ # @param resource_group_name [String] The name of the resource group that
891
+ # contains the Batch account.
892
+ # @param account_name [String] The name of the account.
893
+ # @param parameters [BatchAccountRegenerateKeyParameters] The type of key to
894
+ # regenerate.
895
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
896
+ # will be added to the HTTP request.
897
+ #
898
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
899
+ #
900
+ def regenerate_key_with_http_info(resource_group_name, account_name, parameters, custom_headers = nil)
901
+ regenerate_key_async(resource_group_name, account_name, parameters, custom_headers).value!
902
+ end
903
+
904
+ #
905
+ # Regenerates the specified account key for the specified Batch account.
906
+ #
907
+ # @param resource_group_name [String] The name of the resource group that
908
+ # contains the Batch account.
909
+ # @param account_name [String] The name of the account.
910
+ # @param parameters [BatchAccountRegenerateKeyParameters] The type of key to
911
+ # regenerate.
912
+ # @param [Hash{String => String}] A hash of custom headers that will be added
913
+ # to the HTTP request.
914
+ #
915
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
916
+ #
917
+ def regenerate_key_async(resource_group_name, account_name, parameters, custom_headers = nil)
918
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
919
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
920
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
921
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
922
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
923
+
924
+
925
+ request_headers = {}
926
+
927
+ # Set Headers
928
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
929
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
930
+
931
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
932
+
933
+ # Serialize Request
934
+ request_mapper = BatchAccountRegenerateKeyParameters.mapper()
935
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
936
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
937
+
938
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys'
939
+ options = {
940
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
941
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
942
+ query_params: {'api-version' => @client.api_version},
943
+ body: request_content,
944
+ headers: request_headers.merge(custom_headers || {})
945
+ }
946
+
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|
955
+ status_code = http_response.status
956
+ response_content = http_response.body
957
+ unless status_code == 200
958
+ error_model = JSON.load(response_content)
959
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
960
+ end
961
+
962
+ # Create Result
963
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
964
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
965
+ # Deserialize Response
966
+ if status_code == 200
967
+ begin
968
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
969
+ result_mapper = BatchAccountRegenerateKeyResult.mapper()
970
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
971
+ rescue Exception => e
972
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
973
+ end
974
+ end
975
+
976
+ result
977
+ end
978
+
979
+ promise.execute
980
+ end
981
+
982
+ #
983
+ # Lists the account keys for the specified Batch account.
984
+ #
985
+ # @param resource_group_name [String] The name of the resource group that
986
+ # contains the Batch account.
987
+ # @param account_name [String] The name of the account.
988
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
989
+ # will be added to the HTTP request.
990
+ #
991
+ # @return [BatchAccountListKeyResult] operation results.
992
+ #
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!
995
+ response.body unless response.nil?
996
+ end
997
+
998
+ #
999
+ # Lists the account keys for the specified Batch account.
1000
+ #
1001
+ # @param resource_group_name [String] The name of the resource group that
1002
+ # contains the Batch account.
1003
+ # @param account_name [String] The name of the account.
1004
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1005
+ # will be added to the HTTP request.
1006
+ #
1007
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1008
+ #
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!
1011
+ end
1012
+
1013
+ #
1014
+ # Lists the account keys for the specified Batch account.
1015
+ #
1016
+ # @param resource_group_name [String] The name of the resource group that
1017
+ # contains the Batch account.
1018
+ # @param account_name [String] The name of the account.
1019
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1020
+ # to the HTTP request.
1021
+ #
1022
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1023
+ #
1024
+ def list_keys_async(resource_group_name, account_name, custom_headers = nil)
1025
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1026
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1027
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1028
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1029
+
1030
+
1031
+ request_headers = {}
1032
+
1033
+ # Set Headers
1034
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1035
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1036
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys'
1037
+ options = {
1038
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1039
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
1040
+ query_params: {'api-version' => @client.api_version},
1041
+ headers: request_headers.merge(custom_headers || {})
1042
+ }
1043
+
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|
1052
+ status_code = http_response.status
1053
+ response_content = http_response.body
1054
+ unless status_code == 200
1055
+ error_model = JSON.load(response_content)
1056
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
1057
+ end
1058
+
1059
+ # Create Result
1060
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1061
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1062
+ # Deserialize Response
1063
+ if status_code == 200
1064
+ begin
1065
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1066
+ result_mapper = BatchAccountListKeyResult.mapper()
1067
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1068
+ rescue Exception => e
1069
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1070
+ end
1071
+ end
1072
+
1073
+ result
1074
+ end
1075
+
1076
+ promise.execute
1077
+ end
1078
+
1079
+ #
1080
+ # Gets information about the Batch accounts associated with the subscription.
1081
+ #
1082
+ # @param next_page_link [String] The NextLink from the previous successful
1083
+ # call to List operation.
1084
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1085
+ # will be added to the HTTP request.
1086
+ #
1087
+ # @return [BatchAccountListResult] operation results.
1088
+ #
1089
+ def list_next(next_page_link, custom_headers = nil)
1090
+ response = list_next_async(next_page_link, custom_headers).value!
1091
+ response.body unless response.nil?
1092
+ end
1093
+
1094
+ #
1095
+ # Gets information about the Batch accounts associated with the subscription.
1096
+ #
1097
+ # @param next_page_link [String] The NextLink from the previous successful
1098
+ # call to List operation.
1099
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1100
+ # will be added to the HTTP request.
1101
+ #
1102
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1103
+ #
1104
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
1105
+ list_next_async(next_page_link, custom_headers).value!
1106
+ end
1107
+
1108
+ #
1109
+ # Gets information about the Batch accounts associated with the subscription.
1110
+ #
1111
+ # @param next_page_link [String] The NextLink from the previous successful
1112
+ # call to List operation.
1113
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1114
+ # to the HTTP request.
1115
+ #
1116
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1117
+ #
1118
+ def list_next_async(next_page_link, custom_headers = nil)
1119
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1120
+
1121
+
1122
+ request_headers = {}
1123
+
1124
+ # Set Headers
1125
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1126
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1127
+ path_template = '{nextLink}'
1128
+ options = {
1129
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1130
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1131
+ headers: request_headers.merge(custom_headers || {})
1132
+ }
1133
+
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|
1142
+ status_code = http_response.status
1143
+ response_content = http_response.body
1144
+ unless status_code == 200
1145
+ error_model = JSON.load(response_content)
1146
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
1147
+ end
1148
+
1149
+ # Create Result
1150
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1151
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1152
+ # Deserialize Response
1153
+ if status_code == 200
1154
+ begin
1155
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1156
+ result_mapper = BatchAccountListResult.mapper()
1157
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1158
+ rescue Exception => e
1159
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1160
+ end
1161
+ end
1162
+
1163
+ result
1164
+ end
1165
+
1166
+ promise.execute
1167
+ end
1168
+
1169
+ #
1170
+ # Gets information about the Batch accounts associated within the specified
1171
+ # resource group.
1172
+ #
1173
+ # @param next_page_link [String] The NextLink from the previous successful
1174
+ # call to List operation.
1175
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1176
+ # will be added to the HTTP request.
1177
+ #
1178
+ # @return [BatchAccountListResult] operation results.
1179
+ #
1180
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
1181
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
1182
+ response.body unless response.nil?
1183
+ end
1184
+
1185
+ #
1186
+ # Gets information about the Batch accounts associated within the specified
1187
+ # resource group.
1188
+ #
1189
+ # @param next_page_link [String] The NextLink from the previous successful
1190
+ # call to List operation.
1191
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1192
+ # will be added to the HTTP request.
1193
+ #
1194
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1195
+ #
1196
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
1197
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
1198
+ end
1199
+
1200
+ #
1201
+ # Gets information about the Batch accounts associated within the specified
1202
+ # resource group.
1203
+ #
1204
+ # @param next_page_link [String] The NextLink from the previous successful
1205
+ # call to List operation.
1206
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1207
+ # to the HTTP request.
1208
+ #
1209
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1210
+ #
1211
+ def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
1212
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1213
+
1214
+
1215
+ request_headers = {}
1216
+
1217
+ # Set Headers
1218
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1219
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1220
+ path_template = '{nextLink}'
1221
+ options = {
1222
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1223
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1224
+ headers: request_headers.merge(custom_headers || {})
1225
+ }
1226
+
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|
1235
+ status_code = http_response.status
1236
+ response_content = http_response.body
1237
+ unless status_code == 200
1238
+ error_model = JSON.load(response_content)
1239
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
1240
+ end
1241
+
1242
+ # Create Result
1243
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1244
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1245
+ # Deserialize Response
1246
+ if status_code == 200
1247
+ begin
1248
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1249
+ result_mapper = BatchAccountListResult.mapper()
1250
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1251
+ rescue Exception => e
1252
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1253
+ end
1254
+ end
1255
+
1256
+ result
1257
+ end
1258
+
1259
+ promise.execute
1260
+ end
1261
+
1262
+ end
1263
+ end