azure_mgmt_compute 0.8.0 → 0.9.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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_compute.rb +86 -54
  3. data/lib/generated/azure_mgmt_compute/availability_sets.rb +17 -6
  4. data/lib/generated/azure_mgmt_compute/compute_management_client.rb +17 -6
  5. data/lib/generated/azure_mgmt_compute/disks.rb +1273 -0
  6. data/lib/generated/azure_mgmt_compute/images.rb +808 -0
  7. data/lib/generated/azure_mgmt_compute/models/access_level.rb +16 -0
  8. data/lib/generated/azure_mgmt_compute/models/access_uri.rb +45 -0
  9. data/lib/generated/azure_mgmt_compute/models/additional_unattend_content.rb +1 -1
  10. data/lib/generated/azure_mgmt_compute/models/api_entity_reference.rb +1 -1
  11. data/lib/generated/azure_mgmt_compute/models/api_error.rb +5 -5
  12. data/lib/generated/azure_mgmt_compute/models/api_error_base.rb +3 -3
  13. data/lib/generated/azure_mgmt_compute/models/availability_set.rb +21 -0
  14. data/lib/generated/azure_mgmt_compute/models/container_service.rb +1 -1
  15. data/lib/generated/azure_mgmt_compute/models/container_service_agent_pool_profile.rb +2 -1
  16. data/lib/generated/azure_mgmt_compute/models/container_service_diagnostics_profile.rb +1 -1
  17. data/lib/generated/azure_mgmt_compute/models/container_service_linux_profile.rb +1 -1
  18. data/lib/generated/azure_mgmt_compute/models/container_service_list_result.rb +1 -1
  19. data/lib/generated/azure_mgmt_compute/models/container_service_ssh_configuration.rb +1 -1
  20. data/lib/generated/azure_mgmt_compute/models/container_service_windows_profile.rb +1 -1
  21. data/lib/generated/azure_mgmt_compute/models/creation_data.rb +94 -0
  22. data/lib/generated/azure_mgmt_compute/models/data_disk.rb +13 -2
  23. data/lib/generated/azure_mgmt_compute/models/disk.rb +174 -0
  24. data/lib/generated/azure_mgmt_compute/models/disk_create_option.rb +20 -0
  25. data/lib/generated/azure_mgmt_compute/models/disk_list.rb +94 -0
  26. data/lib/generated/azure_mgmt_compute/models/disk_update.rb +109 -0
  27. data/lib/generated/azure_mgmt_compute/models/encryption_settings.rb +72 -0
  28. data/lib/generated/azure_mgmt_compute/models/grant_access_data.rb +56 -0
  29. data/lib/generated/azure_mgmt_compute/models/image.rb +113 -0
  30. data/lib/generated/azure_mgmt_compute/models/image_data_disk.rb +99 -0
  31. data/lib/generated/azure_mgmt_compute/models/image_disk_reference.rb +57 -0
  32. data/lib/generated/azure_mgmt_compute/models/image_list_result.rb +94 -0
  33. data/lib/generated/azure_mgmt_compute/models/image_osdisk.rb +113 -0
  34. data/lib/generated/azure_mgmt_compute/models/image_reference.rb +8 -1
  35. data/lib/generated/azure_mgmt_compute/models/image_storage_profile.rb +63 -0
  36. data/lib/generated/azure_mgmt_compute/models/inner_error.rb +2 -2
  37. data/lib/generated/azure_mgmt_compute/models/key_vault_and_key_reference.rb +57 -0
  38. data/lib/generated/azure_mgmt_compute/models/key_vault_and_secret_reference.rb +56 -0
  39. data/lib/generated/azure_mgmt_compute/models/managed_disk_parameters.rb +53 -0
  40. data/lib/generated/azure_mgmt_compute/models/operating_system_state_types.rb +16 -0
  41. data/lib/generated/azure_mgmt_compute/models/operation_status_response.rb +90 -0
  42. data/lib/generated/azure_mgmt_compute/models/osdisk.rb +14 -3
  43. data/lib/generated/azure_mgmt_compute/models/osprofile.rb +2 -2
  44. data/lib/generated/azure_mgmt_compute/models/resource_update.rb +51 -0
  45. data/lib/generated/azure_mgmt_compute/models/snapshot.rb +174 -0
  46. data/lib/generated/azure_mgmt_compute/models/snapshot_list.rb +94 -0
  47. data/lib/generated/azure_mgmt_compute/models/snapshot_update.rb +109 -0
  48. data/lib/generated/azure_mgmt_compute/models/source_vault.rb +45 -0
  49. data/lib/generated/azure_mgmt_compute/models/storage_account_types.rb +16 -0
  50. data/lib/generated/azure_mgmt_compute/models/sub_resource_read_only.rb +46 -0
  51. data/lib/generated/azure_mgmt_compute/models/upgrade_policy.rb +1 -1
  52. data/lib/generated/azure_mgmt_compute/models/virtual_machine.rb +1 -1
  53. data/lib/generated/azure_mgmt_compute/models/virtual_machine_extension.rb +7 -7
  54. data/lib/generated/azure_mgmt_compute/models/virtual_machine_extension_handler_instance_view.rb +3 -3
  55. data/lib/generated/azure_mgmt_compute/models/virtual_machine_extension_image.rb +5 -5
  56. data/lib/generated/azure_mgmt_compute/models/virtual_machine_extension_instance_view.rb +5 -5
  57. data/lib/generated/azure_mgmt_compute/models/virtual_machine_instance_view.rb +2 -2
  58. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set.rb +27 -4
  59. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_data_disk.rb +101 -0
  60. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_extension.rb +8 -7
  61. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_extension_profile.rb +1 -1
  62. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_instance_view.rb +3 -3
  63. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_instance_view_statuses_summary.rb +1 -1
  64. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_ipconfiguration.rb +5 -5
  65. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_list_result.rb +2 -2
  66. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_list_skus_result.rb +2 -2
  67. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_list_with_link_result.rb +2 -2
  68. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_managed_disk_parameters.rb +47 -0
  69. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_network_configuration.rb +3 -3
  70. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_network_profile.rb +1 -1
  71. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_osdisk.rb +19 -7
  72. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_osprofile.rb +7 -7
  73. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_sku.rb +3 -3
  74. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_sku_capacity.rb +4 -4
  75. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_storage_profile.rb +20 -2
  76. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vm.rb +21 -10
  77. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmextensions_summary.rb +2 -2
  78. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_ids.rb +1 -1
  79. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_required_ids.rb +1 -1
  80. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_view.rb +19 -8
  81. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmlist_result.rb +2 -2
  82. data/lib/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmprofile.rb +4 -4
  83. data/lib/generated/azure_mgmt_compute/models/virtual_machine_status_code_count.rb +2 -2
  84. data/lib/generated/azure_mgmt_compute/snapshots.rb +1273 -0
  85. data/lib/generated/azure_mgmt_compute/usage_operations.rb +1 -1
  86. data/lib/generated/azure_mgmt_compute/version.rb +1 -1
  87. data/lib/generated/azure_mgmt_compute/virtual_machine_extension_images.rb +3 -3
  88. data/lib/generated/azure_mgmt_compute/virtual_machine_extensions.rb +21 -6
  89. data/lib/generated/azure_mgmt_compute/virtual_machine_images.rb +5 -5
  90. data/lib/generated/azure_mgmt_compute/virtual_machine_scale_set_vms.rb +263 -26
  91. data/lib/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb +298 -37
  92. data/lib/generated/azure_mgmt_compute/virtual_machine_sizes.rb +1 -1
  93. data/lib/generated/azure_mgmt_compute/virtual_machines.rb +270 -32
  94. metadata +36 -4
@@ -0,0 +1,808 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Compute
7
+ #
8
+ # Composite Swagger for Compute Client
9
+ #
10
+ class Images
11
+ include Azure::ARM::Compute::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Images class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [ComputeManagementClient] reference to the ComputeManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Create or update an image.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group.
29
+ # @param image_name [String] The name of the image.
30
+ # @param parameters [Image] Parameters supplied to the Create Image operation.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [Image] operation results.
35
+ #
36
+ def create_or_update(resource_group_name, image_name, parameters, custom_headers = nil)
37
+ response = create_or_update_async(resource_group_name, image_name, parameters, custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # @param resource_group_name [String] The name of the resource group.
43
+ # @param image_name [String] The name of the image.
44
+ # @param parameters [Image] Parameters supplied to the Create Image operation.
45
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
46
+ # will be added to the HTTP request.
47
+ #
48
+ # @return [Concurrent::Promise] promise which provides async access to http
49
+ # response.
50
+ #
51
+ def create_or_update_async(resource_group_name, image_name, parameters, custom_headers = nil)
52
+ # Send request
53
+ promise = begin_create_or_update_async(resource_group_name, image_name, parameters, custom_headers)
54
+
55
+ promise = promise.then do |response|
56
+ # Defining deserialization method.
57
+ deserialize_method = lambda do |parsed_response|
58
+ result_mapper = Image.mapper()
59
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
60
+ end
61
+
62
+ # Waiting for response.
63
+ @client.get_long_running_operation_result(response, deserialize_method)
64
+ end
65
+
66
+ promise
67
+ end
68
+
69
+ #
70
+ # Deletes an Image.
71
+ #
72
+ # @param resource_group_name [String] The name of the resource group.
73
+ # @param image_name [String] The name of the image.
74
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
75
+ # will be added to the HTTP request.
76
+ #
77
+ # @return [OperationStatusResponse] operation results.
78
+ #
79
+ def delete(resource_group_name, image_name, custom_headers = nil)
80
+ response = delete_async(resource_group_name, image_name, custom_headers).value!
81
+ response.body unless response.nil?
82
+ end
83
+
84
+ #
85
+ # @param resource_group_name [String] The name of the resource group.
86
+ # @param image_name [String] The name of the image.
87
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
88
+ # will be added to the HTTP request.
89
+ #
90
+ # @return [Concurrent::Promise] promise which provides async access to http
91
+ # response.
92
+ #
93
+ def delete_async(resource_group_name, image_name, custom_headers = nil)
94
+ # Send request
95
+ promise = begin_delete_async(resource_group_name, image_name, custom_headers)
96
+
97
+ promise = promise.then do |response|
98
+ # Defining deserialization method.
99
+ deserialize_method = lambda do |parsed_response|
100
+ result_mapper = OperationStatusResponse.mapper()
101
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
102
+ end
103
+
104
+ # Waiting for response.
105
+ @client.get_long_running_operation_result(response, deserialize_method)
106
+ end
107
+
108
+ promise
109
+ end
110
+
111
+ #
112
+ # Gets an image.
113
+ #
114
+ # @param resource_group_name [String] The name of the resource group.
115
+ # @param image_name [String] The name of the image.
116
+ # @param expand [String] The expand expression to apply on the operation.
117
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
118
+ # will be added to the HTTP request.
119
+ #
120
+ # @return [Image] operation results.
121
+ #
122
+ def get(resource_group_name, image_name, expand = nil, custom_headers = nil)
123
+ response = get_async(resource_group_name, image_name, expand, custom_headers).value!
124
+ response.body unless response.nil?
125
+ end
126
+
127
+ #
128
+ # Gets an image.
129
+ #
130
+ # @param resource_group_name [String] The name of the resource group.
131
+ # @param image_name [String] The name of the image.
132
+ # @param expand [String] The expand expression to apply on the operation.
133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
134
+ # will be added to the HTTP request.
135
+ #
136
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
137
+ #
138
+ def get_with_http_info(resource_group_name, image_name, expand = nil, custom_headers = nil)
139
+ get_async(resource_group_name, image_name, expand, custom_headers).value!
140
+ end
141
+
142
+ #
143
+ # Gets an image.
144
+ #
145
+ # @param resource_group_name [String] The name of the resource group.
146
+ # @param image_name [String] The name of the image.
147
+ # @param expand [String] The expand expression to apply on the operation.
148
+ # @param [Hash{String => String}] A hash of custom headers that will be added
149
+ # to the HTTP request.
150
+ #
151
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
152
+ #
153
+ def get_async(resource_group_name, image_name, expand = nil, custom_headers = nil)
154
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
155
+ fail ArgumentError, 'image_name is nil' if image_name.nil?
156
+ api_version = '2016-04-30-preview'
157
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
158
+
159
+
160
+ request_headers = {}
161
+
162
+ # Set Headers
163
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
164
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
165
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'
166
+
167
+ request_url = @base_url || @client.base_url
168
+
169
+ options = {
170
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
171
+ path_params: {'resourceGroupName' => resource_group_name,'imageName' => image_name,'subscriptionId' => @client.subscription_id},
172
+ query_params: {'$expand' => expand,'api-version' => api_version},
173
+ headers: request_headers.merge(custom_headers || {}),
174
+ base_url: request_url
175
+ }
176
+ promise = @client.make_request_async(:get, path_template, options)
177
+
178
+ promise = promise.then do |result|
179
+ http_response = result.response
180
+ status_code = http_response.status
181
+ response_content = http_response.body
182
+ unless status_code == 200
183
+ error_model = JSON.load(response_content)
184
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
185
+ end
186
+
187
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
188
+ # Deserialize Response
189
+ if status_code == 200
190
+ begin
191
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
192
+ result_mapper = Image.mapper()
193
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
194
+ rescue Exception => e
195
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
196
+ end
197
+ end
198
+
199
+ result
200
+ end
201
+
202
+ promise.execute
203
+ end
204
+
205
+ #
206
+ # Gets the list of images under a resource group.
207
+ #
208
+ # @param resource_group_name [String] The name of the resource group.
209
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
210
+ # will be added to the HTTP request.
211
+ #
212
+ # @return [Array<Image>] operation results.
213
+ #
214
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
215
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
216
+ first_page.get_all_items
217
+ end
218
+
219
+ #
220
+ # Gets the list of images under a resource group.
221
+ #
222
+ # @param resource_group_name [String] The name of the resource group.
223
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
224
+ # will be added to the HTTP request.
225
+ #
226
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
227
+ #
228
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
229
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
230
+ end
231
+
232
+ #
233
+ # Gets the list of images under a resource group.
234
+ #
235
+ # @param resource_group_name [String] The name of the resource group.
236
+ # @param [Hash{String => String}] A hash of custom headers that will be added
237
+ # to the HTTP request.
238
+ #
239
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
240
+ #
241
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
242
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
243
+ api_version = '2016-04-30-preview'
244
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
245
+
246
+
247
+ request_headers = {}
248
+
249
+ # Set Headers
250
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
251
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
252
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images'
253
+
254
+ request_url = @base_url || @client.base_url
255
+
256
+ options = {
257
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
258
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
259
+ query_params: {'api-version' => api_version},
260
+ headers: request_headers.merge(custom_headers || {}),
261
+ base_url: request_url
262
+ }
263
+ promise = @client.make_request_async(:get, path_template, options)
264
+
265
+ promise = promise.then do |result|
266
+ http_response = result.response
267
+ status_code = http_response.status
268
+ response_content = http_response.body
269
+ unless status_code == 200
270
+ error_model = JSON.load(response_content)
271
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
272
+ end
273
+
274
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
275
+ # Deserialize Response
276
+ if status_code == 200
277
+ begin
278
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
279
+ result_mapper = ImageListResult.mapper()
280
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
281
+ rescue Exception => e
282
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
283
+ end
284
+ end
285
+
286
+ result
287
+ end
288
+
289
+ promise.execute
290
+ end
291
+
292
+ #
293
+ # Gets the list of Images in the subscription. Use nextLink property in the
294
+ # response to get the next page of Images. Do this till nextLink is not null to
295
+ # fetch all the Images.
296
+ #
297
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
298
+ # will be added to the HTTP request.
299
+ #
300
+ # @return [Array<Image>] operation results.
301
+ #
302
+ def list(custom_headers = nil)
303
+ first_page = list_as_lazy(custom_headers)
304
+ first_page.get_all_items
305
+ end
306
+
307
+ #
308
+ # Gets the list of Images in the subscription. Use nextLink property in the
309
+ # response to get the next page of Images. Do this till nextLink is not null to
310
+ # fetch all the Images.
311
+ #
312
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
313
+ # will be added to the HTTP request.
314
+ #
315
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
316
+ #
317
+ def list_with_http_info(custom_headers = nil)
318
+ list_async(custom_headers).value!
319
+ end
320
+
321
+ #
322
+ # Gets the list of Images in the subscription. Use nextLink property in the
323
+ # response to get the next page of Images. Do this till nextLink is not null to
324
+ # fetch all the Images.
325
+ #
326
+ # @param [Hash{String => String}] A hash of custom headers that will be added
327
+ # to the HTTP request.
328
+ #
329
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
330
+ #
331
+ def list_async(custom_headers = nil)
332
+ api_version = '2016-04-30-preview'
333
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
334
+
335
+
336
+ request_headers = {}
337
+
338
+ # Set Headers
339
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
340
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
341
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images'
342
+
343
+ request_url = @base_url || @client.base_url
344
+
345
+ options = {
346
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
347
+ path_params: {'subscriptionId' => @client.subscription_id},
348
+ query_params: {'api-version' => api_version},
349
+ headers: request_headers.merge(custom_headers || {}),
350
+ base_url: request_url
351
+ }
352
+ promise = @client.make_request_async(:get, path_template, options)
353
+
354
+ promise = promise.then do |result|
355
+ http_response = result.response
356
+ status_code = http_response.status
357
+ response_content = http_response.body
358
+ unless status_code == 200
359
+ error_model = JSON.load(response_content)
360
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
361
+ end
362
+
363
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
364
+ # Deserialize Response
365
+ if status_code == 200
366
+ begin
367
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
368
+ result_mapper = ImageListResult.mapper()
369
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
370
+ rescue Exception => e
371
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
372
+ end
373
+ end
374
+
375
+ result
376
+ end
377
+
378
+ promise.execute
379
+ end
380
+
381
+ #
382
+ # Create or update an image.
383
+ #
384
+ # @param resource_group_name [String] The name of the resource group.
385
+ # @param image_name [String] The name of the image.
386
+ # @param parameters [Image] Parameters supplied to the Create Image operation.
387
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
388
+ # will be added to the HTTP request.
389
+ #
390
+ # @return [Image] operation results.
391
+ #
392
+ def begin_create_or_update(resource_group_name, image_name, parameters, custom_headers = nil)
393
+ response = begin_create_or_update_async(resource_group_name, image_name, parameters, custom_headers).value!
394
+ response.body unless response.nil?
395
+ end
396
+
397
+ #
398
+ # Create or update an image.
399
+ #
400
+ # @param resource_group_name [String] The name of the resource group.
401
+ # @param image_name [String] The name of the image.
402
+ # @param parameters [Image] Parameters supplied to the Create Image operation.
403
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
404
+ # will be added to the HTTP request.
405
+ #
406
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
407
+ #
408
+ def begin_create_or_update_with_http_info(resource_group_name, image_name, parameters, custom_headers = nil)
409
+ begin_create_or_update_async(resource_group_name, image_name, parameters, custom_headers).value!
410
+ end
411
+
412
+ #
413
+ # Create or update an image.
414
+ #
415
+ # @param resource_group_name [String] The name of the resource group.
416
+ # @param image_name [String] The name of the image.
417
+ # @param parameters [Image] Parameters supplied to the Create Image operation.
418
+ # @param [Hash{String => String}] A hash of custom headers that will be added
419
+ # to the HTTP request.
420
+ #
421
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
422
+ #
423
+ def begin_create_or_update_async(resource_group_name, image_name, parameters, custom_headers = nil)
424
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
425
+ fail ArgumentError, 'image_name is nil' if image_name.nil?
426
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
427
+ api_version = '2016-04-30-preview'
428
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
429
+
430
+
431
+ request_headers = {}
432
+
433
+ # Set Headers
434
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
435
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
436
+
437
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
438
+
439
+ # Serialize Request
440
+ request_mapper = Image.mapper()
441
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
442
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
443
+
444
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'
445
+
446
+ request_url = @base_url || @client.base_url
447
+
448
+ options = {
449
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
450
+ path_params: {'resourceGroupName' => resource_group_name,'imageName' => image_name,'subscriptionId' => @client.subscription_id},
451
+ query_params: {'api-version' => api_version},
452
+ body: request_content,
453
+ headers: request_headers.merge(custom_headers || {}),
454
+ base_url: request_url
455
+ }
456
+ promise = @client.make_request_async(:put, path_template, options)
457
+
458
+ promise = promise.then do |result|
459
+ http_response = result.response
460
+ status_code = http_response.status
461
+ response_content = http_response.body
462
+ unless status_code == 200 || status_code == 201
463
+ error_model = JSON.load(response_content)
464
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
465
+ end
466
+
467
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
468
+ # Deserialize Response
469
+ if status_code == 200
470
+ begin
471
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
472
+ result_mapper = Image.mapper()
473
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
474
+ rescue Exception => e
475
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
476
+ end
477
+ end
478
+ # Deserialize Response
479
+ if status_code == 201
480
+ begin
481
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
482
+ result_mapper = Image.mapper()
483
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
484
+ rescue Exception => e
485
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
486
+ end
487
+ end
488
+
489
+ result
490
+ end
491
+
492
+ promise.execute
493
+ end
494
+
495
+ #
496
+ # Deletes an Image.
497
+ #
498
+ # @param resource_group_name [String] The name of the resource group.
499
+ # @param image_name [String] The name of the image.
500
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
501
+ # will be added to the HTTP request.
502
+ #
503
+ # @return [OperationStatusResponse] operation results.
504
+ #
505
+ def begin_delete(resource_group_name, image_name, custom_headers = nil)
506
+ response = begin_delete_async(resource_group_name, image_name, custom_headers).value!
507
+ response.body unless response.nil?
508
+ end
509
+
510
+ #
511
+ # Deletes an Image.
512
+ #
513
+ # @param resource_group_name [String] The name of the resource group.
514
+ # @param image_name [String] The name of the image.
515
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
516
+ # will be added to the HTTP request.
517
+ #
518
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
519
+ #
520
+ def begin_delete_with_http_info(resource_group_name, image_name, custom_headers = nil)
521
+ begin_delete_async(resource_group_name, image_name, custom_headers).value!
522
+ end
523
+
524
+ #
525
+ # Deletes an Image.
526
+ #
527
+ # @param resource_group_name [String] The name of the resource group.
528
+ # @param image_name [String] The name of the image.
529
+ # @param [Hash{String => String}] A hash of custom headers that will be added
530
+ # to the HTTP request.
531
+ #
532
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
533
+ #
534
+ def begin_delete_async(resource_group_name, image_name, custom_headers = nil)
535
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
536
+ fail ArgumentError, 'image_name is nil' if image_name.nil?
537
+ api_version = '2016-04-30-preview'
538
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
539
+
540
+
541
+ request_headers = {}
542
+
543
+ # Set Headers
544
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
545
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
546
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'
547
+
548
+ request_url = @base_url || @client.base_url
549
+
550
+ options = {
551
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
552
+ path_params: {'resourceGroupName' => resource_group_name,'imageName' => image_name,'subscriptionId' => @client.subscription_id},
553
+ query_params: {'api-version' => api_version},
554
+ headers: request_headers.merge(custom_headers || {}),
555
+ base_url: request_url
556
+ }
557
+ promise = @client.make_request_async(:delete, path_template, options)
558
+
559
+ promise = promise.then do |result|
560
+ http_response = result.response
561
+ status_code = http_response.status
562
+ response_content = http_response.body
563
+ unless status_code == 200 || status_code == 202 || status_code == 204
564
+ error_model = JSON.load(response_content)
565
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
566
+ end
567
+
568
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
569
+ # Deserialize Response
570
+ if status_code == 200
571
+ begin
572
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
573
+ result_mapper = OperationStatusResponse.mapper()
574
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
575
+ rescue Exception => e
576
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
577
+ end
578
+ end
579
+
580
+ result
581
+ end
582
+
583
+ promise.execute
584
+ end
585
+
586
+ #
587
+ # Gets the list of images under a resource group.
588
+ #
589
+ # @param next_page_link [String] The NextLink from the previous successful call
590
+ # to List operation.
591
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
592
+ # will be added to the HTTP request.
593
+ #
594
+ # @return [ImageListResult] operation results.
595
+ #
596
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
597
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
598
+ response.body unless response.nil?
599
+ end
600
+
601
+ #
602
+ # Gets the list of images under a resource group.
603
+ #
604
+ # @param next_page_link [String] The NextLink from the previous successful call
605
+ # to List operation.
606
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
607
+ # will be added to the HTTP request.
608
+ #
609
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
610
+ #
611
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
612
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
613
+ end
614
+
615
+ #
616
+ # Gets the list of images under a resource group.
617
+ #
618
+ # @param next_page_link [String] The NextLink from the previous successful call
619
+ # to List operation.
620
+ # @param [Hash{String => String}] A hash of custom headers that will be added
621
+ # to the HTTP request.
622
+ #
623
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
624
+ #
625
+ def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
626
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
627
+
628
+
629
+ request_headers = {}
630
+
631
+ # Set Headers
632
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
633
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
634
+ path_template = '{nextLink}'
635
+
636
+ request_url = @base_url || @client.base_url
637
+
638
+ options = {
639
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
640
+ skip_encoding_path_params: {'nextLink' => next_page_link},
641
+ headers: request_headers.merge(custom_headers || {}),
642
+ base_url: request_url
643
+ }
644
+ promise = @client.make_request_async(:get, path_template, options)
645
+
646
+ promise = promise.then do |result|
647
+ http_response = result.response
648
+ status_code = http_response.status
649
+ response_content = http_response.body
650
+ unless status_code == 200
651
+ error_model = JSON.load(response_content)
652
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
653
+ end
654
+
655
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
656
+ # Deserialize Response
657
+ if status_code == 200
658
+ begin
659
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
660
+ result_mapper = ImageListResult.mapper()
661
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
662
+ rescue Exception => e
663
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
664
+ end
665
+ end
666
+
667
+ result
668
+ end
669
+
670
+ promise.execute
671
+ end
672
+
673
+ #
674
+ # Gets the list of Images in the subscription. Use nextLink property in the
675
+ # response to get the next page of Images. Do this till nextLink is not null to
676
+ # fetch all the Images.
677
+ #
678
+ # @param next_page_link [String] The NextLink from the previous successful call
679
+ # to List operation.
680
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
681
+ # will be added to the HTTP request.
682
+ #
683
+ # @return [ImageListResult] operation results.
684
+ #
685
+ def list_next(next_page_link, custom_headers = nil)
686
+ response = list_next_async(next_page_link, custom_headers).value!
687
+ response.body unless response.nil?
688
+ end
689
+
690
+ #
691
+ # Gets the list of Images in the subscription. Use nextLink property in the
692
+ # response to get the next page of Images. Do this till nextLink is not null to
693
+ # fetch all the Images.
694
+ #
695
+ # @param next_page_link [String] The NextLink from the previous successful call
696
+ # to List operation.
697
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
698
+ # will be added to the HTTP request.
699
+ #
700
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
701
+ #
702
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
703
+ list_next_async(next_page_link, custom_headers).value!
704
+ end
705
+
706
+ #
707
+ # Gets the list of Images in the subscription. Use nextLink property in the
708
+ # response to get the next page of Images. Do this till nextLink is not null to
709
+ # fetch all the Images.
710
+ #
711
+ # @param next_page_link [String] The NextLink from the previous successful call
712
+ # to List operation.
713
+ # @param [Hash{String => String}] A hash of custom headers that will be added
714
+ # to the HTTP request.
715
+ #
716
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
717
+ #
718
+ def list_next_async(next_page_link, custom_headers = nil)
719
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
720
+
721
+
722
+ request_headers = {}
723
+
724
+ # Set Headers
725
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
726
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
727
+ path_template = '{nextLink}'
728
+
729
+ request_url = @base_url || @client.base_url
730
+
731
+ options = {
732
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
733
+ skip_encoding_path_params: {'nextLink' => next_page_link},
734
+ headers: request_headers.merge(custom_headers || {}),
735
+ base_url: request_url
736
+ }
737
+ promise = @client.make_request_async(:get, path_template, options)
738
+
739
+ promise = promise.then do |result|
740
+ http_response = result.response
741
+ status_code = http_response.status
742
+ response_content = http_response.body
743
+ unless status_code == 200
744
+ error_model = JSON.load(response_content)
745
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
746
+ end
747
+
748
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
749
+ # Deserialize Response
750
+ if status_code == 200
751
+ begin
752
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
753
+ result_mapper = ImageListResult.mapper()
754
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
755
+ rescue Exception => e
756
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
757
+ end
758
+ end
759
+
760
+ result
761
+ end
762
+
763
+ promise.execute
764
+ end
765
+
766
+ #
767
+ # Gets the list of images under a resource group.
768
+ #
769
+ # @param resource_group_name [String] The name of the resource group.
770
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
771
+ # will be added to the HTTP request.
772
+ #
773
+ # @return [ImageListResult] which provide lazy access to pages of the response.
774
+ #
775
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
776
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
777
+ unless response.nil?
778
+ page = response.body
779
+ page.next_method = Proc.new do |next_page_link|
780
+ list_by_resource_group_next_async(next_page_link, custom_headers)
781
+ end
782
+ page
783
+ end
784
+ end
785
+
786
+ #
787
+ # Gets the list of Images in the subscription. Use nextLink property in the
788
+ # response to get the next page of Images. Do this till nextLink is not null to
789
+ # fetch all the Images.
790
+ #
791
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
792
+ # will be added to the HTTP request.
793
+ #
794
+ # @return [ImageListResult] which provide lazy access to pages of the response.
795
+ #
796
+ def list_as_lazy(custom_headers = nil)
797
+ response = list_async(custom_headers).value!
798
+ unless response.nil?
799
+ page = response.body
800
+ page.next_method = Proc.new do |next_page_link|
801
+ list_next_async(next_page_link, custom_headers)
802
+ end
803
+ page
804
+ end
805
+ end
806
+
807
+ end
808
+ end