azure_mgmt_container_instance 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_container_instance.rb +6 -0
  4. data/lib/generated/azure_mgmt_container_instance.rb +51 -0
  5. data/lib/generated/azure_mgmt_container_instance/container_groups.rb +838 -0
  6. data/lib/generated/azure_mgmt_container_instance/container_instance_management_client.rb +135 -0
  7. data/lib/generated/azure_mgmt_container_instance/container_logs.rb +144 -0
  8. data/lib/generated/azure_mgmt_container_instance/models/azure_file_volume.rb +79 -0
  9. data/lib/generated/azure_mgmt_container_instance/models/container.rb +155 -0
  10. data/lib/generated/azure_mgmt_container_instance/models/container_event.rb +84 -0
  11. data/lib/generated/azure_mgmt_container_instance/models/container_group.rb +194 -0
  12. data/lib/generated/azure_mgmt_container_instance/models/container_group_list_result.rb +95 -0
  13. data/lib/generated/azure_mgmt_container_instance/models/container_group_network_protocol.rb +16 -0
  14. data/lib/generated/azure_mgmt_container_instance/models/container_port.rb +44 -0
  15. data/lib/generated/azure_mgmt_container_instance/models/container_properties_instance_view.rb +85 -0
  16. data/lib/generated/azure_mgmt_container_instance/models/container_restart_policy.rb +15 -0
  17. data/lib/generated/azure_mgmt_container_instance/models/container_state.rb +88 -0
  18. data/lib/generated/azure_mgmt_container_instance/models/environment_variable.rb +54 -0
  19. data/lib/generated/azure_mgmt_container_instance/models/image_registry_credential.rb +65 -0
  20. data/lib/generated/azure_mgmt_container_instance/models/ip_address.rb +75 -0
  21. data/lib/generated/azure_mgmt_container_instance/models/logs.rb +44 -0
  22. data/lib/generated/azure_mgmt_container_instance/models/operating_system_types.rb +16 -0
  23. data/lib/generated/azure_mgmt_container_instance/models/port.rb +55 -0
  24. data/lib/generated/azure_mgmt_container_instance/models/resource.rb +94 -0
  25. data/lib/generated/azure_mgmt_container_instance/models/resource_limits.rb +54 -0
  26. data/lib/generated/azure_mgmt_container_instance/models/resource_requests.rb +54 -0
  27. data/lib/generated/azure_mgmt_container_instance/models/resource_requirements.rb +58 -0
  28. data/lib/generated/azure_mgmt_container_instance/models/volume.rb +55 -0
  29. data/lib/generated/azure_mgmt_container_instance/models/volume_mount.rb +66 -0
  30. data/lib/generated/azure_mgmt_container_instance/module_definition.rb +8 -0
  31. data/lib/generated/azure_mgmt_container_instance/version.rb +8 -0
  32. metadata +143 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3976c272ed8d5d07eb30bf8fa3617a7d08e8f64b
4
+ data.tar.gz: 1bb9e4e0111e7f04f516de22589ff197c1532011
5
+ SHA512:
6
+ metadata.gz: ac295e83a6989f00f0ee1d7a33eb68a8b605dc773e464c1bb46647622b82d1764f60dbab868e55c84b3422e6f50f8826a0e361889e7b8e2f10449d63033f8c47
7
+ data.tar.gz: ed1f808bf82e5b3f307b48849ae7c729e47b3108816e7026f08212c774170d939c9b7d64c9c631ff8dde115524c081775951cfd73fbcec8bdad5be6ba2addcbe
data/LICENSE.txt ADDED
@@ -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,6 @@
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_container_instance'
6
+
@@ -0,0 +1,51 @@
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
+ 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_container_instance/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::ARM::ContainerInstance
23
+ autoload :ContainerGroups, 'generated/azure_mgmt_container_instance/container_groups.rb'
24
+ autoload :ContainerLogs, 'generated/azure_mgmt_container_instance/container_logs.rb'
25
+ autoload :ContainerInstanceManagementClient, 'generated/azure_mgmt_container_instance/container_instance_management_client.rb'
26
+
27
+ module Models
28
+ autoload :Container, 'generated/azure_mgmt_container_instance/models/container.rb'
29
+ autoload :AzureFileVolume, 'generated/azure_mgmt_container_instance/models/azure_file_volume.rb'
30
+ autoload :EnvironmentVariable, 'generated/azure_mgmt_container_instance/models/environment_variable.rb'
31
+ autoload :Volume, 'generated/azure_mgmt_container_instance/models/volume.rb'
32
+ autoload :ContainerEvent, 'generated/azure_mgmt_container_instance/models/container_event.rb'
33
+ autoload :ImageRegistryCredential, 'generated/azure_mgmt_container_instance/models/image_registry_credential.rb'
34
+ autoload :ResourceRequests, 'generated/azure_mgmt_container_instance/models/resource_requests.rb'
35
+ autoload :Port, 'generated/azure_mgmt_container_instance/models/port.rb'
36
+ autoload :ResourceRequirements, 'generated/azure_mgmt_container_instance/models/resource_requirements.rb'
37
+ autoload :IpAddress, 'generated/azure_mgmt_container_instance/models/ip_address.rb'
38
+ autoload :ContainerPort, 'generated/azure_mgmt_container_instance/models/container_port.rb'
39
+ autoload :ContainerState, 'generated/azure_mgmt_container_instance/models/container_state.rb'
40
+ autoload :ResourceLimits, 'generated/azure_mgmt_container_instance/models/resource_limits.rb'
41
+ autoload :ContainerGroupListResult, 'generated/azure_mgmt_container_instance/models/container_group_list_result.rb'
42
+ autoload :ContainerPropertiesInstanceView, 'generated/azure_mgmt_container_instance/models/container_properties_instance_view.rb'
43
+ autoload :Logs, 'generated/azure_mgmt_container_instance/models/logs.rb'
44
+ autoload :VolumeMount, 'generated/azure_mgmt_container_instance/models/volume_mount.rb'
45
+ autoload :Resource, 'generated/azure_mgmt_container_instance/models/resource.rb'
46
+ autoload :ContainerGroup, 'generated/azure_mgmt_container_instance/models/container_group.rb'
47
+ autoload :ContainerRestartPolicy, 'generated/azure_mgmt_container_instance/models/container_restart_policy.rb'
48
+ autoload :ContainerGroupNetworkProtocol, 'generated/azure_mgmt_container_instance/models/container_group_network_protocol.rb'
49
+ autoload :OperatingSystemTypes, 'generated/azure_mgmt_container_instance/models/operating_system_types.rb'
50
+ end
51
+ end
@@ -0,0 +1,838 @@
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::ARM::ContainerInstance
7
+ #
8
+ # ContainerGroups
9
+ #
10
+ class ContainerGroups
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ContainerGroups class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ContainerInstanceManagementClient] reference to the ContainerInstanceManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Get a list of container groups in the specified subscription.
26
+ #
27
+ # Get a list of container groups in the specified subscription. This operation
28
+ # returns properties of each container group including containers, image
29
+ # registry credentials, restart policy, IP address type, OS type, state, and
30
+ # volumes.
31
+ #
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [Array<ContainerGroup>] operation results.
36
+ #
37
+ def list(custom_headers = nil)
38
+ first_page = list_as_lazy(custom_headers)
39
+ first_page.get_all_items
40
+ end
41
+
42
+ #
43
+ # Get a list of container groups in the specified subscription.
44
+ #
45
+ # Get a list of container groups in the specified subscription. This operation
46
+ # returns properties of each container group including containers, image
47
+ # registry credentials, restart policy, IP address type, OS type, state, and
48
+ # volumes.
49
+ #
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def list_with_http_info(custom_headers = nil)
56
+ list_async(custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # Get a list of container groups in the specified subscription.
61
+ #
62
+ # Get a list of container groups in the specified subscription. This operation
63
+ # returns properties of each container group including containers, image
64
+ # registry credentials, restart policy, IP address type, OS type, state, and
65
+ # volumes.
66
+ #
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def list_async(custom_headers = nil)
73
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
74
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
75
+
76
+
77
+ request_headers = {}
78
+
79
+ # Set Headers
80
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
81
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
82
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups'
83
+
84
+ request_url = @base_url || @client.base_url
85
+
86
+ options = {
87
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
88
+ path_params: {'subscriptionId' => @client.subscription_id},
89
+ query_params: {'api-version' => @client.api_version},
90
+ headers: request_headers.merge(custom_headers || {}),
91
+ base_url: request_url
92
+ }
93
+ promise = @client.make_request_async(:get, path_template, options)
94
+
95
+ promise = promise.then do |result|
96
+ http_response = result.response
97
+ status_code = http_response.status
98
+ response_content = http_response.body
99
+ unless status_code == 200
100
+ error_model = JSON.load(response_content)
101
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
102
+ end
103
+
104
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
105
+ # Deserialize Response
106
+ if status_code == 200
107
+ begin
108
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
109
+ result_mapper = Azure::ARM::ContainerInstance::Models::ContainerGroupListResult.mapper()
110
+ result.body = @client.deserialize(result_mapper, parsed_response)
111
+ rescue Exception => e
112
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
113
+ end
114
+ end
115
+
116
+ result
117
+ end
118
+
119
+ promise.execute
120
+ end
121
+
122
+ #
123
+ # Get a list of container groups in the specified subscription and resource
124
+ # group.
125
+ #
126
+ # Get a list of container groups in a specified subscription and resource
127
+ # group. This operation returns properties of each container group including
128
+ # containers, image registry credentials, restart policy, IP address type, OS
129
+ # type, state, and volumes.
130
+ #
131
+ # @param resource_group_name [String] The name of the resource group that
132
+ # contains the container group.
133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
134
+ # will be added to the HTTP request.
135
+ #
136
+ # @return [Array<ContainerGroup>] operation results.
137
+ #
138
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
139
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
140
+ first_page.get_all_items
141
+ end
142
+
143
+ #
144
+ # Get a list of container groups in the specified subscription and resource
145
+ # group.
146
+ #
147
+ # Get a list of container groups in a specified subscription and resource
148
+ # group. This operation returns properties of each container group including
149
+ # containers, image registry credentials, restart policy, IP address type, OS
150
+ # type, state, and volumes.
151
+ #
152
+ # @param resource_group_name [String] The name of the resource group that
153
+ # contains the container group.
154
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
155
+ # will be added to the HTTP request.
156
+ #
157
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
158
+ #
159
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
160
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
161
+ end
162
+
163
+ #
164
+ # Get a list of container groups in the specified subscription and resource
165
+ # group.
166
+ #
167
+ # Get a list of container groups in a specified subscription and resource
168
+ # group. This operation returns properties of each container group including
169
+ # containers, image registry credentials, restart policy, IP address type, OS
170
+ # type, state, and volumes.
171
+ #
172
+ # @param resource_group_name [String] The name of the resource group that
173
+ # contains the container group.
174
+ # @param [Hash{String => String}] A hash of custom headers that will be added
175
+ # to the HTTP request.
176
+ #
177
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
178
+ #
179
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
180
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
181
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
182
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
183
+
184
+
185
+ request_headers = {}
186
+
187
+ # Set Headers
188
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
189
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
190
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups'
191
+
192
+ request_url = @base_url || @client.base_url
193
+
194
+ options = {
195
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
196
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
197
+ query_params: {'api-version' => @client.api_version},
198
+ headers: request_headers.merge(custom_headers || {}),
199
+ base_url: request_url
200
+ }
201
+ promise = @client.make_request_async(:get, path_template, options)
202
+
203
+ promise = promise.then do |result|
204
+ http_response = result.response
205
+ status_code = http_response.status
206
+ response_content = http_response.body
207
+ unless status_code == 200
208
+ error_model = JSON.load(response_content)
209
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
210
+ end
211
+
212
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
213
+ # Deserialize Response
214
+ if status_code == 200
215
+ begin
216
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
217
+ result_mapper = Azure::ARM::ContainerInstance::Models::ContainerGroupListResult.mapper()
218
+ result.body = @client.deserialize(result_mapper, parsed_response)
219
+ rescue Exception => e
220
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
221
+ end
222
+ end
223
+
224
+ result
225
+ end
226
+
227
+ promise.execute
228
+ end
229
+
230
+ #
231
+ # Get the properties of the specified container group.
232
+ #
233
+ # Gets the properties of the specified container group in the specified
234
+ # subscription and resource group. The operation returns the properties of each
235
+ # container group including containers, image registry credentials, restart
236
+ # policy, IP address type, OS type, state, and volumes.
237
+ #
238
+ # @param resource_group_name [String] The name of the resource group that
239
+ # contains the container group.
240
+ # @param container_group_name [String] The name of the container group.
241
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
242
+ # will be added to the HTTP request.
243
+ #
244
+ # @return [ContainerGroup] operation results.
245
+ #
246
+ def get(resource_group_name, container_group_name, custom_headers = nil)
247
+ response = get_async(resource_group_name, container_group_name, custom_headers).value!
248
+ response.body unless response.nil?
249
+ end
250
+
251
+ #
252
+ # Get the properties of the specified container group.
253
+ #
254
+ # Gets the properties of the specified container group in the specified
255
+ # subscription and resource group. The operation returns the properties of each
256
+ # container group including containers, image registry credentials, restart
257
+ # policy, IP address type, OS type, state, and volumes.
258
+ #
259
+ # @param resource_group_name [String] The name of the resource group that
260
+ # contains the container group.
261
+ # @param container_group_name [String] The name of the container group.
262
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
263
+ # will be added to the HTTP request.
264
+ #
265
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
266
+ #
267
+ def get_with_http_info(resource_group_name, container_group_name, custom_headers = nil)
268
+ get_async(resource_group_name, container_group_name, custom_headers).value!
269
+ end
270
+
271
+ #
272
+ # Get the properties of the specified container group.
273
+ #
274
+ # Gets the properties of the specified container group in the specified
275
+ # subscription and resource group. The operation returns the properties of each
276
+ # container group including containers, image registry credentials, restart
277
+ # policy, IP address type, OS type, state, and volumes.
278
+ #
279
+ # @param resource_group_name [String] The name of the resource group that
280
+ # contains the container group.
281
+ # @param container_group_name [String] The name of the container group.
282
+ # @param [Hash{String => String}] A hash of custom headers that will be added
283
+ # to the HTTP request.
284
+ #
285
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
286
+ #
287
+ def get_async(resource_group_name, container_group_name, custom_headers = nil)
288
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
289
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
290
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
291
+ fail ArgumentError, 'container_group_name is nil' if container_group_name.nil?
292
+
293
+
294
+ request_headers = {}
295
+
296
+ # Set Headers
297
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
298
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
299
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'
300
+
301
+ request_url = @base_url || @client.base_url
302
+
303
+ options = {
304
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
305
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'containerGroupName' => container_group_name},
306
+ query_params: {'api-version' => @client.api_version},
307
+ headers: request_headers.merge(custom_headers || {}),
308
+ base_url: request_url
309
+ }
310
+ promise = @client.make_request_async(:get, path_template, options)
311
+
312
+ promise = promise.then do |result|
313
+ http_response = result.response
314
+ status_code = http_response.status
315
+ response_content = http_response.body
316
+ unless status_code == 200
317
+ error_model = JSON.load(response_content)
318
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
319
+ end
320
+
321
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
322
+ # Deserialize Response
323
+ if status_code == 200
324
+ begin
325
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
326
+ result_mapper = Azure::ARM::ContainerInstance::Models::ContainerGroup.mapper()
327
+ result.body = @client.deserialize(result_mapper, parsed_response)
328
+ rescue Exception => e
329
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
330
+ end
331
+ end
332
+
333
+ result
334
+ end
335
+
336
+ promise.execute
337
+ end
338
+
339
+ #
340
+ # Create or update container groups.
341
+ #
342
+ # Create or update container groups with specified configurations.
343
+ #
344
+ # @param resource_group_name [String] The name of the resource group to contain
345
+ # the container group to be created or updated.
346
+ # @param container_group_name [String] The name of the container group to be
347
+ # created or updated.
348
+ # @param container_group [ContainerGroup] The properties of the container group
349
+ # to be created or updated.
350
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
351
+ # will be added to the HTTP request.
352
+ #
353
+ # @return [ContainerGroup] operation results.
354
+ #
355
+ def create_or_update(resource_group_name, container_group_name, container_group, custom_headers = nil)
356
+ response = create_or_update_async(resource_group_name, container_group_name, container_group, custom_headers).value!
357
+ response.body unless response.nil?
358
+ end
359
+
360
+ #
361
+ # Create or update container groups.
362
+ #
363
+ # Create or update container groups with specified configurations.
364
+ #
365
+ # @param resource_group_name [String] The name of the resource group to contain
366
+ # the container group to be created or updated.
367
+ # @param container_group_name [String] The name of the container group to be
368
+ # created or updated.
369
+ # @param container_group [ContainerGroup] The properties of the container group
370
+ # to be created or updated.
371
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
372
+ # will be added to the HTTP request.
373
+ #
374
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
375
+ #
376
+ def create_or_update_with_http_info(resource_group_name, container_group_name, container_group, custom_headers = nil)
377
+ create_or_update_async(resource_group_name, container_group_name, container_group, custom_headers).value!
378
+ end
379
+
380
+ #
381
+ # Create or update container groups.
382
+ #
383
+ # Create or update container groups with specified configurations.
384
+ #
385
+ # @param resource_group_name [String] The name of the resource group to contain
386
+ # the container group to be created or updated.
387
+ # @param container_group_name [String] The name of the container group to be
388
+ # created or updated.
389
+ # @param container_group [ContainerGroup] The properties of the container group
390
+ # to be created or updated.
391
+ # @param [Hash{String => String}] A hash of custom headers that will be added
392
+ # to the HTTP request.
393
+ #
394
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
395
+ #
396
+ def create_or_update_async(resource_group_name, container_group_name, container_group, custom_headers = nil)
397
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
398
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
399
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
400
+ fail ArgumentError, 'container_group_name is nil' if container_group_name.nil?
401
+ fail ArgumentError, 'container_group is nil' if container_group.nil?
402
+
403
+
404
+ request_headers = {}
405
+
406
+ # Set Headers
407
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
408
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
409
+
410
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
411
+
412
+ # Serialize Request
413
+ request_mapper = Azure::ARM::ContainerInstance::Models::ContainerGroup.mapper()
414
+ request_content = @client.serialize(request_mapper, container_group)
415
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
416
+
417
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'
418
+
419
+ request_url = @base_url || @client.base_url
420
+
421
+ options = {
422
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
423
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'containerGroupName' => container_group_name},
424
+ query_params: {'api-version' => @client.api_version},
425
+ body: request_content,
426
+ headers: request_headers.merge(custom_headers || {}),
427
+ base_url: request_url
428
+ }
429
+ promise = @client.make_request_async(:put, path_template, options)
430
+
431
+ promise = promise.then do |result|
432
+ http_response = result.response
433
+ status_code = http_response.status
434
+ response_content = http_response.body
435
+ unless status_code == 200 || status_code == 201
436
+ error_model = JSON.load(response_content)
437
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
438
+ end
439
+
440
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
441
+ # Deserialize Response
442
+ if status_code == 200
443
+ begin
444
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
445
+ result_mapper = Azure::ARM::ContainerInstance::Models::ContainerGroup.mapper()
446
+ result.body = @client.deserialize(result_mapper, parsed_response)
447
+ rescue Exception => e
448
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
449
+ end
450
+ end
451
+ # Deserialize Response
452
+ if status_code == 201
453
+ begin
454
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
455
+ result_mapper = Azure::ARM::ContainerInstance::Models::ContainerGroup.mapper()
456
+ result.body = @client.deserialize(result_mapper, parsed_response)
457
+ rescue Exception => e
458
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
459
+ end
460
+ end
461
+
462
+ result
463
+ end
464
+
465
+ promise.execute
466
+ end
467
+
468
+ #
469
+ # Delete the specified container group.
470
+ #
471
+ # Delete the specified container group in the specified subscription and
472
+ # resource group. The operation does not delete other resources provided by the
473
+ # user, such as volumes.
474
+ #
475
+ # @param resource_group_name [String] The name of the resource group that
476
+ # contains the container group.
477
+ # @param container_group_name [String] The name of the container group to be
478
+ # deleted.
479
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
480
+ # will be added to the HTTP request.
481
+ #
482
+ # @return [ContainerGroup] operation results.
483
+ #
484
+ def delete(resource_group_name, container_group_name, custom_headers = nil)
485
+ response = delete_async(resource_group_name, container_group_name, custom_headers).value!
486
+ response.body unless response.nil?
487
+ end
488
+
489
+ #
490
+ # Delete the specified container group.
491
+ #
492
+ # Delete the specified container group in the specified subscription and
493
+ # resource group. The operation does not delete other resources provided by the
494
+ # user, such as volumes.
495
+ #
496
+ # @param resource_group_name [String] The name of the resource group that
497
+ # contains the container group.
498
+ # @param container_group_name [String] The name of the container group to be
499
+ # deleted.
500
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
501
+ # will be added to the HTTP request.
502
+ #
503
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
504
+ #
505
+ def delete_with_http_info(resource_group_name, container_group_name, custom_headers = nil)
506
+ delete_async(resource_group_name, container_group_name, custom_headers).value!
507
+ end
508
+
509
+ #
510
+ # Delete the specified container group.
511
+ #
512
+ # Delete the specified container group in the specified subscription and
513
+ # resource group. The operation does not delete other resources provided by the
514
+ # user, such as volumes.
515
+ #
516
+ # @param resource_group_name [String] The name of the resource group that
517
+ # contains the container group.
518
+ # @param container_group_name [String] The name of the container group to be
519
+ # deleted.
520
+ # @param [Hash{String => String}] A hash of custom headers that will be added
521
+ # to the HTTP request.
522
+ #
523
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
524
+ #
525
+ def delete_async(resource_group_name, container_group_name, custom_headers = nil)
526
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
527
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
528
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
529
+ fail ArgumentError, 'container_group_name is nil' if container_group_name.nil?
530
+
531
+
532
+ request_headers = {}
533
+
534
+ # Set Headers
535
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
536
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
537
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}'
538
+
539
+ request_url = @base_url || @client.base_url
540
+
541
+ options = {
542
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
543
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'containerGroupName' => container_group_name},
544
+ query_params: {'api-version' => @client.api_version},
545
+ headers: request_headers.merge(custom_headers || {}),
546
+ base_url: request_url
547
+ }
548
+ promise = @client.make_request_async(:delete, path_template, options)
549
+
550
+ promise = promise.then do |result|
551
+ http_response = result.response
552
+ status_code = http_response.status
553
+ response_content = http_response.body
554
+ unless status_code == 200 || status_code == 204
555
+ error_model = JSON.load(response_content)
556
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
557
+ end
558
+
559
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
560
+ # Deserialize Response
561
+ if status_code == 200
562
+ begin
563
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
564
+ result_mapper = Azure::ARM::ContainerInstance::Models::ContainerGroup.mapper()
565
+ result.body = @client.deserialize(result_mapper, parsed_response)
566
+ rescue Exception => e
567
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
568
+ end
569
+ end
570
+
571
+ result
572
+ end
573
+
574
+ promise.execute
575
+ end
576
+
577
+ #
578
+ # Get a list of container groups in the specified subscription.
579
+ #
580
+ # Get a list of container groups in the specified subscription. This operation
581
+ # returns properties of each container group including containers, image
582
+ # registry credentials, restart policy, IP address type, OS type, state, and
583
+ # volumes.
584
+ #
585
+ # @param next_page_link [String] The NextLink from the previous successful call
586
+ # to List operation.
587
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
588
+ # will be added to the HTTP request.
589
+ #
590
+ # @return [ContainerGroupListResult] operation results.
591
+ #
592
+ def list_next(next_page_link, custom_headers = nil)
593
+ response = list_next_async(next_page_link, custom_headers).value!
594
+ response.body unless response.nil?
595
+ end
596
+
597
+ #
598
+ # Get a list of container groups in the specified subscription.
599
+ #
600
+ # Get a list of container groups in the specified subscription. This operation
601
+ # returns properties of each container group including containers, image
602
+ # registry credentials, restart policy, IP address type, OS type, state, and
603
+ # volumes.
604
+ #
605
+ # @param next_page_link [String] The NextLink from the previous successful call
606
+ # to List operation.
607
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
608
+ # will be added to the HTTP request.
609
+ #
610
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
611
+ #
612
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
613
+ list_next_async(next_page_link, custom_headers).value!
614
+ end
615
+
616
+ #
617
+ # Get a list of container groups in the specified subscription.
618
+ #
619
+ # Get a list of container groups in the specified subscription. This operation
620
+ # returns properties of each container group including containers, image
621
+ # registry credentials, restart policy, IP address type, OS type, state, and
622
+ # volumes.
623
+ #
624
+ # @param next_page_link [String] The NextLink from the previous successful call
625
+ # to List operation.
626
+ # @param [Hash{String => String}] A hash of custom headers that will be added
627
+ # to the HTTP request.
628
+ #
629
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
630
+ #
631
+ def list_next_async(next_page_link, custom_headers = nil)
632
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
633
+
634
+
635
+ request_headers = {}
636
+
637
+ # Set Headers
638
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
639
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
640
+ path_template = '{nextLink}'
641
+
642
+ request_url = @base_url || @client.base_url
643
+
644
+ options = {
645
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
646
+ skip_encoding_path_params: {'nextLink' => next_page_link},
647
+ headers: request_headers.merge(custom_headers || {}),
648
+ base_url: request_url
649
+ }
650
+ promise = @client.make_request_async(:get, path_template, options)
651
+
652
+ promise = promise.then do |result|
653
+ http_response = result.response
654
+ status_code = http_response.status
655
+ response_content = http_response.body
656
+ unless status_code == 200
657
+ error_model = JSON.load(response_content)
658
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
659
+ end
660
+
661
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
662
+ # Deserialize Response
663
+ if status_code == 200
664
+ begin
665
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
666
+ result_mapper = Azure::ARM::ContainerInstance::Models::ContainerGroupListResult.mapper()
667
+ result.body = @client.deserialize(result_mapper, parsed_response)
668
+ rescue Exception => e
669
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
670
+ end
671
+ end
672
+
673
+ result
674
+ end
675
+
676
+ promise.execute
677
+ end
678
+
679
+ #
680
+ # Get a list of container groups in the specified subscription and resource
681
+ # group.
682
+ #
683
+ # Get a list of container groups in a specified subscription and resource
684
+ # group. This operation returns properties of each container group including
685
+ # containers, image registry credentials, restart policy, IP address type, OS
686
+ # type, state, and volumes.
687
+ #
688
+ # @param next_page_link [String] The NextLink from the previous successful call
689
+ # to List operation.
690
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
691
+ # will be added to the HTTP request.
692
+ #
693
+ # @return [ContainerGroupListResult] operation results.
694
+ #
695
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
696
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
697
+ response.body unless response.nil?
698
+ end
699
+
700
+ #
701
+ # Get a list of container groups in the specified subscription and resource
702
+ # group.
703
+ #
704
+ # Get a list of container groups in a specified subscription and resource
705
+ # group. This operation returns properties of each container group including
706
+ # containers, image registry credentials, restart policy, IP address type, OS
707
+ # type, state, and volumes.
708
+ #
709
+ # @param next_page_link [String] The NextLink from the previous successful call
710
+ # to List operation.
711
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
712
+ # will be added to the HTTP request.
713
+ #
714
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
715
+ #
716
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
717
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
718
+ end
719
+
720
+ #
721
+ # Get a list of container groups in the specified subscription and resource
722
+ # group.
723
+ #
724
+ # Get a list of container groups in a specified subscription and resource
725
+ # group. This operation returns properties of each container group including
726
+ # containers, image registry credentials, restart policy, IP address type, OS
727
+ # type, state, and volumes.
728
+ #
729
+ # @param next_page_link [String] The NextLink from the previous successful call
730
+ # to List operation.
731
+ # @param [Hash{String => String}] A hash of custom headers that will be added
732
+ # to the HTTP request.
733
+ #
734
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
735
+ #
736
+ def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
737
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
738
+
739
+
740
+ request_headers = {}
741
+
742
+ # Set Headers
743
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
744
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
745
+ path_template = '{nextLink}'
746
+
747
+ request_url = @base_url || @client.base_url
748
+
749
+ options = {
750
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
751
+ skip_encoding_path_params: {'nextLink' => next_page_link},
752
+ headers: request_headers.merge(custom_headers || {}),
753
+ base_url: request_url
754
+ }
755
+ promise = @client.make_request_async(:get, path_template, options)
756
+
757
+ promise = promise.then do |result|
758
+ http_response = result.response
759
+ status_code = http_response.status
760
+ response_content = http_response.body
761
+ unless status_code == 200
762
+ error_model = JSON.load(response_content)
763
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
764
+ end
765
+
766
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
767
+ # Deserialize Response
768
+ if status_code == 200
769
+ begin
770
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
771
+ result_mapper = Azure::ARM::ContainerInstance::Models::ContainerGroupListResult.mapper()
772
+ result.body = @client.deserialize(result_mapper, parsed_response)
773
+ rescue Exception => e
774
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
775
+ end
776
+ end
777
+
778
+ result
779
+ end
780
+
781
+ promise.execute
782
+ end
783
+
784
+ #
785
+ # Get a list of container groups in the specified subscription.
786
+ #
787
+ # Get a list of container groups in the specified subscription. This operation
788
+ # returns properties of each container group including containers, image
789
+ # registry credentials, restart policy, IP address type, OS type, state, and
790
+ # volumes.
791
+ #
792
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
793
+ # will be added to the HTTP request.
794
+ #
795
+ # @return [ContainerGroupListResult] which provide lazy access to pages of the
796
+ # response.
797
+ #
798
+ def list_as_lazy(custom_headers = nil)
799
+ response = list_async(custom_headers).value!
800
+ unless response.nil?
801
+ page = response.body
802
+ page.next_method = Proc.new do |next_page_link|
803
+ list_next_async(next_page_link, custom_headers)
804
+ end
805
+ page
806
+ end
807
+ end
808
+
809
+ #
810
+ # Get a list of container groups in the specified subscription and resource
811
+ # group.
812
+ #
813
+ # Get a list of container groups in a specified subscription and resource
814
+ # group. This operation returns properties of each container group including
815
+ # containers, image registry credentials, restart policy, IP address type, OS
816
+ # type, state, and volumes.
817
+ #
818
+ # @param resource_group_name [String] The name of the resource group that
819
+ # contains the container group.
820
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
821
+ # will be added to the HTTP request.
822
+ #
823
+ # @return [ContainerGroupListResult] which provide lazy access to pages of the
824
+ # response.
825
+ #
826
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
827
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
828
+ unless response.nil?
829
+ page = response.body
830
+ page.next_method = Proc.new do |next_page_link|
831
+ list_by_resource_group_next_async(next_page_link, custom_headers)
832
+ end
833
+ page
834
+ end
835
+ end
836
+
837
+ end
838
+ end