azure_mgmt_managed_applications 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_managed_applications.rb +7 -0
  4. data/lib/generated/azure_mgmt_managed_applications.rb +47 -0
  5. data/lib/generated/azure_mgmt_managed_applications/appliance_definitions.rb +1014 -0
  6. data/lib/generated/azure_mgmt_managed_applications/appliances.rb +1400 -0
  7. data/lib/generated/azure_mgmt_managed_applications/managed_application_client.rb +133 -0
  8. data/lib/generated/azure_mgmt_managed_applications/models/appliance.rb +192 -0
  9. data/lib/generated/azure_mgmt_managed_applications/models/appliance_artifact.rb +66 -0
  10. data/lib/generated/azure_mgmt_managed_applications/models/appliance_artifact_type.rb +16 -0
  11. data/lib/generated/azure_mgmt_managed_applications/models/appliance_definition.rb +184 -0
  12. data/lib/generated/azure_mgmt_managed_applications/models/appliance_definition_list_result.rb +95 -0
  13. data/lib/generated/azure_mgmt_managed_applications/models/appliance_list_result.rb +94 -0
  14. data/lib/generated/azure_mgmt_managed_applications/models/appliance_lock_level.rb +17 -0
  15. data/lib/generated/azure_mgmt_managed_applications/models/appliance_patchable.rb +192 -0
  16. data/lib/generated/azure_mgmt_managed_applications/models/appliance_provider_authorization.rb +59 -0
  17. data/lib/generated/azure_mgmt_managed_applications/models/error_response.rb +65 -0
  18. data/lib/generated/azure_mgmt_managed_applications/models/generic_resource.rb +111 -0
  19. data/lib/generated/azure_mgmt_managed_applications/models/identity.rb +68 -0
  20. data/lib/generated/azure_mgmt_managed_applications/models/plan.rb +84 -0
  21. data/lib/generated/azure_mgmt_managed_applications/models/plan_patchable.rb +84 -0
  22. data/lib/generated/azure_mgmt_managed_applications/models/provisioning_state.rb +25 -0
  23. data/lib/generated/azure_mgmt_managed_applications/models/resource.rb +94 -0
  24. data/lib/generated/azure_mgmt_managed_applications/models/resource_identity_type.rb +15 -0
  25. data/lib/generated/azure_mgmt_managed_applications/models/sku.rb +94 -0
  26. data/lib/generated/azure_mgmt_managed_applications/module_definition.rb +8 -0
  27. data/lib/generated/azure_mgmt_managed_applications/version.rb +8 -0
  28. metadata +139 -0
@@ -0,0 +1,1400 @@
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::ManagedApplications
7
+ #
8
+ # ARM managed applications (appliances)
9
+ #
10
+ class Appliances
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Appliances class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ManagedApplicationClient] reference to the ManagedApplicationClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets the appliance.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group. The name
28
+ # is case insensitive.
29
+ # @param appliance_name [String] The name of the appliance.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [Appliance] operation results.
34
+ #
35
+ def get(resource_group_name, appliance_name, custom_headers = nil)
36
+ response = get_async(resource_group_name, appliance_name, custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # Gets the appliance.
42
+ #
43
+ # @param resource_group_name [String] The name of the resource group. The name
44
+ # is case insensitive.
45
+ # @param appliance_name [String] The name of the appliance.
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def get_with_http_info(resource_group_name, appliance_name, custom_headers = nil)
52
+ get_async(resource_group_name, appliance_name, custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Gets the appliance.
57
+ #
58
+ # @param resource_group_name [String] The name of the resource group. The name
59
+ # is case insensitive.
60
+ # @param appliance_name [String] The name of the appliance.
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def get_async(resource_group_name, appliance_name, custom_headers = nil)
67
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
68
+ fail ArgumentError, 'appliance_name is nil' if appliance_name.nil?
69
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
70
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
71
+
72
+
73
+ request_headers = {}
74
+
75
+ # Set Headers
76
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
77
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
78
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/appliances/{applianceName}'
79
+
80
+ request_url = @base_url || @client.base_url
81
+
82
+ options = {
83
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
84
+ path_params: {'resourceGroupName' => resource_group_name,'applianceName' => appliance_name,'subscriptionId' => @client.subscription_id},
85
+ query_params: {'api-version' => @client.api_version},
86
+ headers: request_headers.merge(custom_headers || {}),
87
+ base_url: request_url
88
+ }
89
+ promise = @client.make_request_async(:get, path_template, options)
90
+
91
+ promise = promise.then do |result|
92
+ http_response = result.response
93
+ status_code = http_response.status
94
+ response_content = http_response.body
95
+ unless status_code == 200 || status_code == 404
96
+ error_model = JSON.load(response_content)
97
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
98
+ end
99
+
100
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
101
+ # Deserialize Response
102
+ if status_code == 200
103
+ begin
104
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
105
+ result_mapper = Azure::ARM::ManagedApplications::Models::Appliance.mapper()
106
+ result.body = @client.deserialize(result_mapper, parsed_response)
107
+ rescue Exception => e
108
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
109
+ end
110
+ end
111
+
112
+ result
113
+ end
114
+
115
+ promise.execute
116
+ end
117
+
118
+ #
119
+ # Deletes the appliance.
120
+ #
121
+ # @param resource_group_name [String] The name of the resource group. The name
122
+ # is case insensitive.
123
+ # @param appliance_name [String] The name of the appliance.
124
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
125
+ # will be added to the HTTP request.
126
+ #
127
+ def delete(resource_group_name, appliance_name, custom_headers = nil)
128
+ response = delete_async(resource_group_name, appliance_name, custom_headers).value!
129
+ nil
130
+ end
131
+
132
+ #
133
+ # @param resource_group_name [String] The name of the resource group. The name
134
+ # is case insensitive.
135
+ # @param appliance_name [String] The name of the appliance.
136
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
137
+ # will be added to the HTTP request.
138
+ #
139
+ # @return [Concurrent::Promise] promise which provides async access to http
140
+ # response.
141
+ #
142
+ def delete_async(resource_group_name, appliance_name, custom_headers = nil)
143
+ # Send request
144
+ promise = begin_delete_async(resource_group_name, appliance_name, custom_headers)
145
+
146
+ promise = promise.then do |response|
147
+ # Defining deserialization method.
148
+ deserialize_method = lambda do |parsed_response|
149
+ end
150
+
151
+ # Waiting for response.
152
+ @client.get_long_running_operation_result(response, deserialize_method)
153
+ end
154
+
155
+ promise
156
+ end
157
+
158
+ #
159
+ # Creates a new appliance.
160
+ #
161
+ # @param resource_group_name [String] The name of the resource group. The name
162
+ # is case insensitive.
163
+ # @param appliance_name [String] The name of the appliance.
164
+ # @param parameters [Appliance] Parameters supplied to the create or update an
165
+ # appliance.
166
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
167
+ # will be added to the HTTP request.
168
+ #
169
+ # @return [Appliance] operation results.
170
+ #
171
+ def create_or_update(resource_group_name, appliance_name, parameters, custom_headers = nil)
172
+ response = create_or_update_async(resource_group_name, appliance_name, parameters, custom_headers).value!
173
+ response.body unless response.nil?
174
+ end
175
+
176
+ #
177
+ # @param resource_group_name [String] The name of the resource group. The name
178
+ # is case insensitive.
179
+ # @param appliance_name [String] The name of the appliance.
180
+ # @param parameters [Appliance] Parameters supplied to the create or update an
181
+ # appliance.
182
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
183
+ # will be added to the HTTP request.
184
+ #
185
+ # @return [Concurrent::Promise] promise which provides async access to http
186
+ # response.
187
+ #
188
+ def create_or_update_async(resource_group_name, appliance_name, parameters, custom_headers = nil)
189
+ # Send request
190
+ promise = begin_create_or_update_async(resource_group_name, appliance_name, parameters, custom_headers)
191
+
192
+ promise = promise.then do |response|
193
+ # Defining deserialization method.
194
+ deserialize_method = lambda do |parsed_response|
195
+ result_mapper = Azure::ARM::ManagedApplications::Models::Appliance.mapper()
196
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
197
+ end
198
+
199
+ # Waiting for response.
200
+ @client.get_long_running_operation_result(response, deserialize_method)
201
+ end
202
+
203
+ promise
204
+ end
205
+
206
+ #
207
+ # Updates an existing appliance. The only value that can be updated via PATCH
208
+ # currently is the tags.
209
+ #
210
+ # @param resource_group_name [String] The name of the resource group. The name
211
+ # is case insensitive.
212
+ # @param appliance_name [String] The name of the appliance.
213
+ # @param parameters [Appliance] Parameters supplied to update an existing
214
+ # appliance.
215
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
216
+ # will be added to the HTTP request.
217
+ #
218
+ # @return [Appliance] operation results.
219
+ #
220
+ def update(resource_group_name, appliance_name, parameters = nil, custom_headers = nil)
221
+ response = update_async(resource_group_name, appliance_name, parameters, custom_headers).value!
222
+ response.body unless response.nil?
223
+ end
224
+
225
+ #
226
+ # Updates an existing appliance. The only value that can be updated via PATCH
227
+ # currently is the tags.
228
+ #
229
+ # @param resource_group_name [String] The name of the resource group. The name
230
+ # is case insensitive.
231
+ # @param appliance_name [String] The name of the appliance.
232
+ # @param parameters [Appliance] Parameters supplied to update an existing
233
+ # appliance.
234
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
235
+ # will be added to the HTTP request.
236
+ #
237
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
238
+ #
239
+ def update_with_http_info(resource_group_name, appliance_name, parameters = nil, custom_headers = nil)
240
+ update_async(resource_group_name, appliance_name, parameters, custom_headers).value!
241
+ end
242
+
243
+ #
244
+ # Updates an existing appliance. The only value that can be updated via PATCH
245
+ # currently is the tags.
246
+ #
247
+ # @param resource_group_name [String] The name of the resource group. The name
248
+ # is case insensitive.
249
+ # @param appliance_name [String] The name of the appliance.
250
+ # @param parameters [Appliance] Parameters supplied to update an existing
251
+ # appliance.
252
+ # @param [Hash{String => String}] A hash of custom headers that will be added
253
+ # to the HTTP request.
254
+ #
255
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
256
+ #
257
+ def update_async(resource_group_name, appliance_name, parameters = nil, custom_headers = nil)
258
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
259
+ fail ArgumentError, 'appliance_name is nil' if appliance_name.nil?
260
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
261
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
262
+
263
+
264
+ request_headers = {}
265
+
266
+ # Set Headers
267
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
268
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
269
+
270
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
271
+
272
+ # Serialize Request
273
+ request_mapper = Azure::ARM::ManagedApplications::Models::Appliance.mapper()
274
+ request_content = @client.serialize(request_mapper, parameters)
275
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
276
+
277
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/appliances/{applianceName}'
278
+
279
+ request_url = @base_url || @client.base_url
280
+
281
+ options = {
282
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
283
+ path_params: {'resourceGroupName' => resource_group_name,'applianceName' => appliance_name,'subscriptionId' => @client.subscription_id},
284
+ query_params: {'api-version' => @client.api_version},
285
+ body: request_content,
286
+ headers: request_headers.merge(custom_headers || {}),
287
+ base_url: request_url
288
+ }
289
+ promise = @client.make_request_async(:patch, path_template, options)
290
+
291
+ promise = promise.then do |result|
292
+ http_response = result.response
293
+ status_code = http_response.status
294
+ response_content = http_response.body
295
+ unless status_code == 200
296
+ error_model = JSON.load(response_content)
297
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
298
+ end
299
+
300
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
301
+ # Deserialize Response
302
+ if status_code == 200
303
+ begin
304
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
305
+ result_mapper = Azure::ARM::ManagedApplications::Models::Appliance.mapper()
306
+ result.body = @client.deserialize(result_mapper, parsed_response)
307
+ rescue Exception => e
308
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
309
+ end
310
+ end
311
+
312
+ result
313
+ end
314
+
315
+ promise.execute
316
+ end
317
+
318
+ #
319
+ # Gets all the appliances within a resource group.
320
+ #
321
+ # @param resource_group_name [String] The name of the resource group. The name
322
+ # is case insensitive.
323
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
324
+ # will be added to the HTTP request.
325
+ #
326
+ # @return [Array<Appliance>] operation results.
327
+ #
328
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
329
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
330
+ first_page.get_all_items
331
+ end
332
+
333
+ #
334
+ # Gets all the appliances within a resource group.
335
+ #
336
+ # @param resource_group_name [String] The name of the resource group. The name
337
+ # is case insensitive.
338
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
339
+ # will be added to the HTTP request.
340
+ #
341
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
342
+ #
343
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
344
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
345
+ end
346
+
347
+ #
348
+ # Gets all the appliances within a resource group.
349
+ #
350
+ # @param resource_group_name [String] The name of the resource group. The name
351
+ # is case insensitive.
352
+ # @param [Hash{String => String}] A hash of custom headers that will be added
353
+ # to the HTTP request.
354
+ #
355
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
356
+ #
357
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
358
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
359
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
360
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
361
+
362
+
363
+ request_headers = {}
364
+
365
+ # Set Headers
366
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
367
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
368
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/appliances'
369
+
370
+ request_url = @base_url || @client.base_url
371
+
372
+ options = {
373
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
374
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
375
+ query_params: {'api-version' => @client.api_version},
376
+ headers: request_headers.merge(custom_headers || {}),
377
+ base_url: request_url
378
+ }
379
+ promise = @client.make_request_async(:get, path_template, options)
380
+
381
+ promise = promise.then do |result|
382
+ http_response = result.response
383
+ status_code = http_response.status
384
+ response_content = http_response.body
385
+ unless status_code == 200
386
+ error_model = JSON.load(response_content)
387
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
388
+ end
389
+
390
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
391
+ # Deserialize Response
392
+ if status_code == 200
393
+ begin
394
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
395
+ result_mapper = Azure::ARM::ManagedApplications::Models::ApplianceListResult.mapper()
396
+ result.body = @client.deserialize(result_mapper, parsed_response)
397
+ rescue Exception => e
398
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
399
+ end
400
+ end
401
+
402
+ result
403
+ end
404
+
405
+ promise.execute
406
+ end
407
+
408
+ #
409
+ # Gets all the appliances within a subscription.
410
+ #
411
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
412
+ # will be added to the HTTP request.
413
+ #
414
+ # @return [Array<Appliance>] operation results.
415
+ #
416
+ def list_by_subscription(custom_headers = nil)
417
+ first_page = list_by_subscription_as_lazy(custom_headers)
418
+ first_page.get_all_items
419
+ end
420
+
421
+ #
422
+ # Gets all the appliances within a subscription.
423
+ #
424
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
425
+ # will be added to the HTTP request.
426
+ #
427
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
428
+ #
429
+ def list_by_subscription_with_http_info(custom_headers = nil)
430
+ list_by_subscription_async(custom_headers).value!
431
+ end
432
+
433
+ #
434
+ # Gets all the appliances within a subscription.
435
+ #
436
+ # @param [Hash{String => String}] A hash of custom headers that will be added
437
+ # to the HTTP request.
438
+ #
439
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
440
+ #
441
+ def list_by_subscription_async(custom_headers = nil)
442
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
443
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
444
+
445
+
446
+ request_headers = {}
447
+
448
+ # Set Headers
449
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
450
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
451
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Solutions/appliances'
452
+
453
+ request_url = @base_url || @client.base_url
454
+
455
+ options = {
456
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
457
+ path_params: {'subscriptionId' => @client.subscription_id},
458
+ query_params: {'api-version' => @client.api_version},
459
+ headers: request_headers.merge(custom_headers || {}),
460
+ base_url: request_url
461
+ }
462
+ promise = @client.make_request_async(:get, path_template, options)
463
+
464
+ promise = promise.then do |result|
465
+ http_response = result.response
466
+ status_code = http_response.status
467
+ response_content = http_response.body
468
+ unless status_code == 200
469
+ error_model = JSON.load(response_content)
470
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
471
+ end
472
+
473
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
474
+ # Deserialize Response
475
+ if status_code == 200
476
+ begin
477
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
478
+ result_mapper = Azure::ARM::ManagedApplications::Models::ApplianceListResult.mapper()
479
+ result.body = @client.deserialize(result_mapper, parsed_response)
480
+ rescue Exception => e
481
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
482
+ end
483
+ end
484
+
485
+ result
486
+ end
487
+
488
+ promise.execute
489
+ end
490
+
491
+ #
492
+ # Gets the appliance.
493
+ #
494
+ # @param appliance_id [String] The fully qualified ID of the appliance,
495
+ # including the appliance name and the appliance resource type. Use the format,
496
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
497
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
498
+ # will be added to the HTTP request.
499
+ #
500
+ # @return [Appliance] operation results.
501
+ #
502
+ def get_by_id(appliance_id, custom_headers = nil)
503
+ response = get_by_id_async(appliance_id, custom_headers).value!
504
+ response.body unless response.nil?
505
+ end
506
+
507
+ #
508
+ # Gets the appliance.
509
+ #
510
+ # @param appliance_id [String] The fully qualified ID of the appliance,
511
+ # including the appliance name and the appliance resource type. Use the format,
512
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
513
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
514
+ # will be added to the HTTP request.
515
+ #
516
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
517
+ #
518
+ def get_by_id_with_http_info(appliance_id, custom_headers = nil)
519
+ get_by_id_async(appliance_id, custom_headers).value!
520
+ end
521
+
522
+ #
523
+ # Gets the appliance.
524
+ #
525
+ # @param appliance_id [String] The fully qualified ID of the appliance,
526
+ # including the appliance name and the appliance resource type. Use the format,
527
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
528
+ # @param [Hash{String => String}] A hash of custom headers that will be added
529
+ # to the HTTP request.
530
+ #
531
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
532
+ #
533
+ def get_by_id_async(appliance_id, custom_headers = nil)
534
+ fail ArgumentError, 'appliance_id is nil' if appliance_id.nil?
535
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
536
+
537
+
538
+ request_headers = {}
539
+
540
+ # Set Headers
541
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
542
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
543
+ path_template = '{applianceId}'
544
+
545
+ request_url = @base_url || @client.base_url
546
+
547
+ options = {
548
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
549
+ skip_encoding_path_params: {'applianceId' => appliance_id},
550
+ query_params: {'api-version' => @client.api_version},
551
+ headers: request_headers.merge(custom_headers || {}),
552
+ base_url: request_url
553
+ }
554
+ promise = @client.make_request_async(:get, path_template, options)
555
+
556
+ promise = promise.then do |result|
557
+ http_response = result.response
558
+ status_code = http_response.status
559
+ response_content = http_response.body
560
+ unless status_code == 200 || status_code == 404
561
+ error_model = JSON.load(response_content)
562
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
563
+ end
564
+
565
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
566
+ # Deserialize Response
567
+ if status_code == 200
568
+ begin
569
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
570
+ result_mapper = Azure::ARM::ManagedApplications::Models::Appliance.mapper()
571
+ result.body = @client.deserialize(result_mapper, parsed_response)
572
+ rescue Exception => e
573
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
574
+ end
575
+ end
576
+
577
+ result
578
+ end
579
+
580
+ promise.execute
581
+ end
582
+
583
+ #
584
+ # Deletes the appliance.
585
+ #
586
+ # @param appliance_id [String] The fully qualified ID of the appliance,
587
+ # including the appliance name and the appliance resource type. Use the format,
588
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
589
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
590
+ # will be added to the HTTP request.
591
+ #
592
+ def delete_by_id(appliance_id, custom_headers = nil)
593
+ response = delete_by_id_async(appliance_id, custom_headers).value!
594
+ nil
595
+ end
596
+
597
+ #
598
+ # @param appliance_id [String] The fully qualified ID of the appliance,
599
+ # including the appliance name and the appliance resource type. Use the format,
600
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
601
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
602
+ # will be added to the HTTP request.
603
+ #
604
+ # @return [Concurrent::Promise] promise which provides async access to http
605
+ # response.
606
+ #
607
+ def delete_by_id_async(appliance_id, custom_headers = nil)
608
+ # Send request
609
+ promise = begin_delete_by_id_async(appliance_id, custom_headers)
610
+
611
+ promise = promise.then do |response|
612
+ # Defining deserialization method.
613
+ deserialize_method = lambda do |parsed_response|
614
+ end
615
+
616
+ # Waiting for response.
617
+ @client.get_long_running_operation_result(response, deserialize_method)
618
+ end
619
+
620
+ promise
621
+ end
622
+
623
+ #
624
+ # Creates a new appliance.
625
+ #
626
+ # @param appliance_id [String] The fully qualified ID of the appliance,
627
+ # including the appliance name and the appliance resource type. Use the format,
628
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
629
+ # @param parameters [Appliance] Parameters supplied to the create or update an
630
+ # appliance.
631
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
632
+ # will be added to the HTTP request.
633
+ #
634
+ # @return [Appliance] operation results.
635
+ #
636
+ def create_or_update_by_id(appliance_id, parameters, custom_headers = nil)
637
+ response = create_or_update_by_id_async(appliance_id, parameters, custom_headers).value!
638
+ response.body unless response.nil?
639
+ end
640
+
641
+ #
642
+ # @param appliance_id [String] The fully qualified ID of the appliance,
643
+ # including the appliance name and the appliance resource type. Use the format,
644
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
645
+ # @param parameters [Appliance] Parameters supplied to the create or update an
646
+ # appliance.
647
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
648
+ # will be added to the HTTP request.
649
+ #
650
+ # @return [Concurrent::Promise] promise which provides async access to http
651
+ # response.
652
+ #
653
+ def create_or_update_by_id_async(appliance_id, parameters, custom_headers = nil)
654
+ # Send request
655
+ promise = begin_create_or_update_by_id_async(appliance_id, parameters, custom_headers)
656
+
657
+ promise = promise.then do |response|
658
+ # Defining deserialization method.
659
+ deserialize_method = lambda do |parsed_response|
660
+ result_mapper = Azure::ARM::ManagedApplications::Models::Appliance.mapper()
661
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
662
+ end
663
+
664
+ # Waiting for response.
665
+ @client.get_long_running_operation_result(response, deserialize_method)
666
+ end
667
+
668
+ promise
669
+ end
670
+
671
+ #
672
+ # Updates an existing appliance. The only value that can be updated via PATCH
673
+ # currently is the tags.
674
+ #
675
+ # @param appliance_id [String] The fully qualified ID of the appliance,
676
+ # including the appliance name and the appliance resource type. Use the format,
677
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
678
+ # @param parameters [Appliance] Parameters supplied to update an existing
679
+ # appliance.
680
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
681
+ # will be added to the HTTP request.
682
+ #
683
+ # @return [Appliance] operation results.
684
+ #
685
+ def update_by_id(appliance_id, parameters = nil, custom_headers = nil)
686
+ response = update_by_id_async(appliance_id, parameters, custom_headers).value!
687
+ response.body unless response.nil?
688
+ end
689
+
690
+ #
691
+ # Updates an existing appliance. The only value that can be updated via PATCH
692
+ # currently is the tags.
693
+ #
694
+ # @param appliance_id [String] The fully qualified ID of the appliance,
695
+ # including the appliance name and the appliance resource type. Use the format,
696
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
697
+ # @param parameters [Appliance] Parameters supplied to update an existing
698
+ # appliance.
699
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
700
+ # will be added to the HTTP request.
701
+ #
702
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
703
+ #
704
+ def update_by_id_with_http_info(appliance_id, parameters = nil, custom_headers = nil)
705
+ update_by_id_async(appliance_id, parameters, custom_headers).value!
706
+ end
707
+
708
+ #
709
+ # Updates an existing appliance. The only value that can be updated via PATCH
710
+ # currently is the tags.
711
+ #
712
+ # @param appliance_id [String] The fully qualified ID of the appliance,
713
+ # including the appliance name and the appliance resource type. Use the format,
714
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
715
+ # @param parameters [Appliance] Parameters supplied to update an existing
716
+ # appliance.
717
+ # @param [Hash{String => String}] A hash of custom headers that will be added
718
+ # to the HTTP request.
719
+ #
720
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
721
+ #
722
+ def update_by_id_async(appliance_id, parameters = nil, custom_headers = nil)
723
+ fail ArgumentError, 'appliance_id is nil' if appliance_id.nil?
724
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
725
+
726
+
727
+ request_headers = {}
728
+
729
+ # Set Headers
730
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
731
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
732
+
733
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
734
+
735
+ # Serialize Request
736
+ request_mapper = Azure::ARM::ManagedApplications::Models::Appliance.mapper()
737
+ request_content = @client.serialize(request_mapper, parameters)
738
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
739
+
740
+ path_template = '{applianceId}'
741
+
742
+ request_url = @base_url || @client.base_url
743
+
744
+ options = {
745
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
746
+ skip_encoding_path_params: {'applianceId' => appliance_id},
747
+ query_params: {'api-version' => @client.api_version},
748
+ body: request_content,
749
+ headers: request_headers.merge(custom_headers || {}),
750
+ base_url: request_url
751
+ }
752
+ promise = @client.make_request_async(:patch, path_template, options)
753
+
754
+ promise = promise.then do |result|
755
+ http_response = result.response
756
+ status_code = http_response.status
757
+ response_content = http_response.body
758
+ unless status_code == 200
759
+ error_model = JSON.load(response_content)
760
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
761
+ end
762
+
763
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
764
+ # Deserialize Response
765
+ if status_code == 200
766
+ begin
767
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
768
+ result_mapper = Azure::ARM::ManagedApplications::Models::Appliance.mapper()
769
+ result.body = @client.deserialize(result_mapper, parsed_response)
770
+ rescue Exception => e
771
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
772
+ end
773
+ end
774
+
775
+ result
776
+ end
777
+
778
+ promise.execute
779
+ end
780
+
781
+ #
782
+ # Deletes the appliance.
783
+ #
784
+ # @param resource_group_name [String] The name of the resource group. The name
785
+ # is case insensitive.
786
+ # @param appliance_name [String] The name of the appliance.
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 begin_delete(resource_group_name, appliance_name, custom_headers = nil)
792
+ response = begin_delete_async(resource_group_name, appliance_name, custom_headers).value!
793
+ nil
794
+ end
795
+
796
+ #
797
+ # Deletes the appliance.
798
+ #
799
+ # @param resource_group_name [String] The name of the resource group. The name
800
+ # is case insensitive.
801
+ # @param appliance_name [String] The name of the appliance.
802
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
803
+ # will be added to the HTTP request.
804
+ #
805
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
806
+ #
807
+ def begin_delete_with_http_info(resource_group_name, appliance_name, custom_headers = nil)
808
+ begin_delete_async(resource_group_name, appliance_name, custom_headers).value!
809
+ end
810
+
811
+ #
812
+ # Deletes the appliance.
813
+ #
814
+ # @param resource_group_name [String] The name of the resource group. The name
815
+ # is case insensitive.
816
+ # @param appliance_name [String] The name of the appliance.
817
+ # @param [Hash{String => String}] A hash of custom headers that will be added
818
+ # to the HTTP request.
819
+ #
820
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
821
+ #
822
+ def begin_delete_async(resource_group_name, appliance_name, custom_headers = nil)
823
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
824
+ fail ArgumentError, 'appliance_name is nil' if appliance_name.nil?
825
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
826
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
827
+
828
+
829
+ request_headers = {}
830
+
831
+ # Set Headers
832
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
833
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
834
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/appliances/{applianceName}'
835
+
836
+ request_url = @base_url || @client.base_url
837
+
838
+ options = {
839
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
840
+ path_params: {'resourceGroupName' => resource_group_name,'applianceName' => appliance_name,'subscriptionId' => @client.subscription_id},
841
+ query_params: {'api-version' => @client.api_version},
842
+ headers: request_headers.merge(custom_headers || {}),
843
+ base_url: request_url
844
+ }
845
+ promise = @client.make_request_async(:delete, path_template, options)
846
+
847
+ promise = promise.then do |result|
848
+ http_response = result.response
849
+ status_code = http_response.status
850
+ response_content = http_response.body
851
+ unless status_code == 204 || status_code == 202
852
+ error_model = JSON.load(response_content)
853
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
854
+ end
855
+
856
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
857
+
858
+ result
859
+ end
860
+
861
+ promise.execute
862
+ end
863
+
864
+ #
865
+ # Creates a new appliance.
866
+ #
867
+ # @param resource_group_name [String] The name of the resource group. The name
868
+ # is case insensitive.
869
+ # @param appliance_name [String] The name of the appliance.
870
+ # @param parameters [Appliance] Parameters supplied to the create or update an
871
+ # appliance.
872
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
873
+ # will be added to the HTTP request.
874
+ #
875
+ # @return [Appliance] operation results.
876
+ #
877
+ def begin_create_or_update(resource_group_name, appliance_name, parameters, custom_headers = nil)
878
+ response = begin_create_or_update_async(resource_group_name, appliance_name, parameters, custom_headers).value!
879
+ response.body unless response.nil?
880
+ end
881
+
882
+ #
883
+ # Creates a new appliance.
884
+ #
885
+ # @param resource_group_name [String] The name of the resource group. The name
886
+ # is case insensitive.
887
+ # @param appliance_name [String] The name of the appliance.
888
+ # @param parameters [Appliance] Parameters supplied to the create or update an
889
+ # appliance.
890
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
891
+ # will be added to the HTTP request.
892
+ #
893
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
894
+ #
895
+ def begin_create_or_update_with_http_info(resource_group_name, appliance_name, parameters, custom_headers = nil)
896
+ begin_create_or_update_async(resource_group_name, appliance_name, parameters, custom_headers).value!
897
+ end
898
+
899
+ #
900
+ # Creates a new appliance.
901
+ #
902
+ # @param resource_group_name [String] The name of the resource group. The name
903
+ # is case insensitive.
904
+ # @param appliance_name [String] The name of the appliance.
905
+ # @param parameters [Appliance] Parameters supplied to the create or update an
906
+ # appliance.
907
+ # @param [Hash{String => String}] A hash of custom headers that will be added
908
+ # to the HTTP request.
909
+ #
910
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
911
+ #
912
+ def begin_create_or_update_async(resource_group_name, appliance_name, parameters, custom_headers = nil)
913
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
914
+ fail ArgumentError, 'appliance_name is nil' if appliance_name.nil?
915
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
916
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
917
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
918
+
919
+
920
+ request_headers = {}
921
+
922
+ # Set Headers
923
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
924
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
925
+
926
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
927
+
928
+ # Serialize Request
929
+ request_mapper = Azure::ARM::ManagedApplications::Models::Appliance.mapper()
930
+ request_content = @client.serialize(request_mapper, parameters)
931
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
932
+
933
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/appliances/{applianceName}'
934
+
935
+ request_url = @base_url || @client.base_url
936
+
937
+ options = {
938
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
939
+ path_params: {'resourceGroupName' => resource_group_name,'applianceName' => appliance_name,'subscriptionId' => @client.subscription_id},
940
+ query_params: {'api-version' => @client.api_version},
941
+ body: request_content,
942
+ headers: request_headers.merge(custom_headers || {}),
943
+ base_url: request_url
944
+ }
945
+ promise = @client.make_request_async(:put, path_template, options)
946
+
947
+ promise = promise.then do |result|
948
+ http_response = result.response
949
+ status_code = http_response.status
950
+ response_content = http_response.body
951
+ unless status_code == 200 || status_code == 201
952
+ error_model = JSON.load(response_content)
953
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
954
+ end
955
+
956
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
957
+ # Deserialize Response
958
+ if status_code == 200
959
+ begin
960
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
961
+ result_mapper = Azure::ARM::ManagedApplications::Models::Appliance.mapper()
962
+ result.body = @client.deserialize(result_mapper, parsed_response)
963
+ rescue Exception => e
964
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
965
+ end
966
+ end
967
+ # Deserialize Response
968
+ if status_code == 201
969
+ begin
970
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
971
+ result_mapper = Azure::ARM::ManagedApplications::Models::Appliance.mapper()
972
+ result.body = @client.deserialize(result_mapper, parsed_response)
973
+ rescue Exception => e
974
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
975
+ end
976
+ end
977
+
978
+ result
979
+ end
980
+
981
+ promise.execute
982
+ end
983
+
984
+ #
985
+ # Deletes the appliance.
986
+ #
987
+ # @param appliance_id [String] The fully qualified ID of the appliance,
988
+ # including the appliance name and the appliance resource type. Use the format,
989
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
990
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
991
+ # will be added to the HTTP request.
992
+ #
993
+ #
994
+ def begin_delete_by_id(appliance_id, custom_headers = nil)
995
+ response = begin_delete_by_id_async(appliance_id, custom_headers).value!
996
+ nil
997
+ end
998
+
999
+ #
1000
+ # Deletes the appliance.
1001
+ #
1002
+ # @param appliance_id [String] The fully qualified ID of the appliance,
1003
+ # including the appliance name and the appliance resource type. Use the format,
1004
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
1005
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1006
+ # will be added to the HTTP request.
1007
+ #
1008
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1009
+ #
1010
+ def begin_delete_by_id_with_http_info(appliance_id, custom_headers = nil)
1011
+ begin_delete_by_id_async(appliance_id, custom_headers).value!
1012
+ end
1013
+
1014
+ #
1015
+ # Deletes the appliance.
1016
+ #
1017
+ # @param appliance_id [String] The fully qualified ID of the appliance,
1018
+ # including the appliance name and the appliance resource type. Use the format,
1019
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
1020
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1021
+ # to the HTTP request.
1022
+ #
1023
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1024
+ #
1025
+ def begin_delete_by_id_async(appliance_id, custom_headers = nil)
1026
+ fail ArgumentError, 'appliance_id is nil' if appliance_id.nil?
1027
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1028
+
1029
+
1030
+ request_headers = {}
1031
+
1032
+ # Set Headers
1033
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1034
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1035
+ path_template = '{applianceId}'
1036
+
1037
+ request_url = @base_url || @client.base_url
1038
+
1039
+ options = {
1040
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1041
+ skip_encoding_path_params: {'applianceId' => appliance_id},
1042
+ query_params: {'api-version' => @client.api_version},
1043
+ headers: request_headers.merge(custom_headers || {}),
1044
+ base_url: request_url
1045
+ }
1046
+ promise = @client.make_request_async(:delete, path_template, options)
1047
+
1048
+ promise = promise.then do |result|
1049
+ http_response = result.response
1050
+ status_code = http_response.status
1051
+ response_content = http_response.body
1052
+ unless status_code == 204 || status_code == 202
1053
+ error_model = JSON.load(response_content)
1054
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1055
+ end
1056
+
1057
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1058
+
1059
+ result
1060
+ end
1061
+
1062
+ promise.execute
1063
+ end
1064
+
1065
+ #
1066
+ # Creates a new appliance.
1067
+ #
1068
+ # @param appliance_id [String] The fully qualified ID of the appliance,
1069
+ # including the appliance name and the appliance resource type. Use the format,
1070
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
1071
+ # @param parameters [Appliance] Parameters supplied to the create or update an
1072
+ # appliance.
1073
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1074
+ # will be added to the HTTP request.
1075
+ #
1076
+ # @return [Appliance] operation results.
1077
+ #
1078
+ def begin_create_or_update_by_id(appliance_id, parameters, custom_headers = nil)
1079
+ response = begin_create_or_update_by_id_async(appliance_id, parameters, custom_headers).value!
1080
+ response.body unless response.nil?
1081
+ end
1082
+
1083
+ #
1084
+ # Creates a new appliance.
1085
+ #
1086
+ # @param appliance_id [String] The fully qualified ID of the appliance,
1087
+ # including the appliance name and the appliance resource type. Use the format,
1088
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
1089
+ # @param parameters [Appliance] Parameters supplied to the create or update an
1090
+ # appliance.
1091
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1092
+ # will be added to the HTTP request.
1093
+ #
1094
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1095
+ #
1096
+ def begin_create_or_update_by_id_with_http_info(appliance_id, parameters, custom_headers = nil)
1097
+ begin_create_or_update_by_id_async(appliance_id, parameters, custom_headers).value!
1098
+ end
1099
+
1100
+ #
1101
+ # Creates a new appliance.
1102
+ #
1103
+ # @param appliance_id [String] The fully qualified ID of the appliance,
1104
+ # including the appliance name and the appliance resource type. Use the format,
1105
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name}
1106
+ # @param parameters [Appliance] Parameters supplied to the create or update an
1107
+ # appliance.
1108
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1109
+ # to the HTTP request.
1110
+ #
1111
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1112
+ #
1113
+ def begin_create_or_update_by_id_async(appliance_id, parameters, custom_headers = nil)
1114
+ fail ArgumentError, 'appliance_id is nil' if appliance_id.nil?
1115
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1116
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1117
+
1118
+
1119
+ request_headers = {}
1120
+
1121
+ # Set Headers
1122
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1123
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1124
+
1125
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1126
+
1127
+ # Serialize Request
1128
+ request_mapper = Azure::ARM::ManagedApplications::Models::Appliance.mapper()
1129
+ request_content = @client.serialize(request_mapper, parameters)
1130
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1131
+
1132
+ path_template = '{applianceId}'
1133
+
1134
+ request_url = @base_url || @client.base_url
1135
+
1136
+ options = {
1137
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1138
+ skip_encoding_path_params: {'applianceId' => appliance_id},
1139
+ query_params: {'api-version' => @client.api_version},
1140
+ body: request_content,
1141
+ headers: request_headers.merge(custom_headers || {}),
1142
+ base_url: request_url
1143
+ }
1144
+ promise = @client.make_request_async(:put, path_template, options)
1145
+
1146
+ promise = promise.then do |result|
1147
+ http_response = result.response
1148
+ status_code = http_response.status
1149
+ response_content = http_response.body
1150
+ unless status_code == 200 || status_code == 201
1151
+ error_model = JSON.load(response_content)
1152
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1153
+ end
1154
+
1155
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1156
+ # Deserialize Response
1157
+ if status_code == 200
1158
+ begin
1159
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1160
+ result_mapper = Azure::ARM::ManagedApplications::Models::Appliance.mapper()
1161
+ result.body = @client.deserialize(result_mapper, parsed_response)
1162
+ rescue Exception => e
1163
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1164
+ end
1165
+ end
1166
+ # Deserialize Response
1167
+ if status_code == 201
1168
+ begin
1169
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1170
+ result_mapper = Azure::ARM::ManagedApplications::Models::Appliance.mapper()
1171
+ result.body = @client.deserialize(result_mapper, parsed_response)
1172
+ rescue Exception => e
1173
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1174
+ end
1175
+ end
1176
+
1177
+ result
1178
+ end
1179
+
1180
+ promise.execute
1181
+ end
1182
+
1183
+ #
1184
+ # Gets all the appliances within a resource group.
1185
+ #
1186
+ # @param next_page_link [String] The NextLink from the previous successful call
1187
+ # to List operation.
1188
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1189
+ # will be added to the HTTP request.
1190
+ #
1191
+ # @return [ApplianceListResult] operation results.
1192
+ #
1193
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
1194
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
1195
+ response.body unless response.nil?
1196
+ end
1197
+
1198
+ #
1199
+ # Gets all the appliances within a resource group.
1200
+ #
1201
+ # @param next_page_link [String] The NextLink from the previous successful call
1202
+ # to List operation.
1203
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1204
+ # will be added to the HTTP request.
1205
+ #
1206
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1207
+ #
1208
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
1209
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
1210
+ end
1211
+
1212
+ #
1213
+ # Gets all the appliances within a resource group.
1214
+ #
1215
+ # @param next_page_link [String] The NextLink from the previous successful call
1216
+ # to List operation.
1217
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1218
+ # to the HTTP request.
1219
+ #
1220
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1221
+ #
1222
+ def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
1223
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1224
+
1225
+
1226
+ request_headers = {}
1227
+
1228
+ # Set Headers
1229
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1230
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1231
+ path_template = '{nextLink}'
1232
+
1233
+ request_url = @base_url || @client.base_url
1234
+
1235
+ options = {
1236
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1237
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1238
+ headers: request_headers.merge(custom_headers || {}),
1239
+ base_url: request_url
1240
+ }
1241
+ promise = @client.make_request_async(:get, path_template, options)
1242
+
1243
+ promise = promise.then do |result|
1244
+ http_response = result.response
1245
+ status_code = http_response.status
1246
+ response_content = http_response.body
1247
+ unless status_code == 200
1248
+ error_model = JSON.load(response_content)
1249
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1250
+ end
1251
+
1252
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1253
+ # Deserialize Response
1254
+ if status_code == 200
1255
+ begin
1256
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1257
+ result_mapper = Azure::ARM::ManagedApplications::Models::ApplianceListResult.mapper()
1258
+ result.body = @client.deserialize(result_mapper, parsed_response)
1259
+ rescue Exception => e
1260
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1261
+ end
1262
+ end
1263
+
1264
+ result
1265
+ end
1266
+
1267
+ promise.execute
1268
+ end
1269
+
1270
+ #
1271
+ # Gets all the appliances within a subscription.
1272
+ #
1273
+ # @param next_page_link [String] The NextLink from the previous successful call
1274
+ # to List operation.
1275
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1276
+ # will be added to the HTTP request.
1277
+ #
1278
+ # @return [ApplianceListResult] operation results.
1279
+ #
1280
+ def list_by_subscription_next(next_page_link, custom_headers = nil)
1281
+ response = list_by_subscription_next_async(next_page_link, custom_headers).value!
1282
+ response.body unless response.nil?
1283
+ end
1284
+
1285
+ #
1286
+ # Gets all the appliances within a subscription.
1287
+ #
1288
+ # @param next_page_link [String] The NextLink from the previous successful call
1289
+ # to List operation.
1290
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1291
+ # will be added to the HTTP request.
1292
+ #
1293
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1294
+ #
1295
+ def list_by_subscription_next_with_http_info(next_page_link, custom_headers = nil)
1296
+ list_by_subscription_next_async(next_page_link, custom_headers).value!
1297
+ end
1298
+
1299
+ #
1300
+ # Gets all the appliances within a subscription.
1301
+ #
1302
+ # @param next_page_link [String] The NextLink from the previous successful call
1303
+ # to List operation.
1304
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1305
+ # to the HTTP request.
1306
+ #
1307
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1308
+ #
1309
+ def list_by_subscription_next_async(next_page_link, custom_headers = nil)
1310
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1311
+
1312
+
1313
+ request_headers = {}
1314
+
1315
+ # Set Headers
1316
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1317
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1318
+ path_template = '{nextLink}'
1319
+
1320
+ request_url = @base_url || @client.base_url
1321
+
1322
+ options = {
1323
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1324
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1325
+ headers: request_headers.merge(custom_headers || {}),
1326
+ base_url: request_url
1327
+ }
1328
+ promise = @client.make_request_async(:get, path_template, options)
1329
+
1330
+ promise = promise.then do |result|
1331
+ http_response = result.response
1332
+ status_code = http_response.status
1333
+ response_content = http_response.body
1334
+ unless status_code == 200
1335
+ error_model = JSON.load(response_content)
1336
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1337
+ end
1338
+
1339
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1340
+ # Deserialize Response
1341
+ if status_code == 200
1342
+ begin
1343
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1344
+ result_mapper = Azure::ARM::ManagedApplications::Models::ApplianceListResult.mapper()
1345
+ result.body = @client.deserialize(result_mapper, parsed_response)
1346
+ rescue Exception => e
1347
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1348
+ end
1349
+ end
1350
+
1351
+ result
1352
+ end
1353
+
1354
+ promise.execute
1355
+ end
1356
+
1357
+ #
1358
+ # Gets all the appliances within a resource group.
1359
+ #
1360
+ # @param resource_group_name [String] The name of the resource group. The name
1361
+ # is case insensitive.
1362
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1363
+ # will be added to the HTTP request.
1364
+ #
1365
+ # @return [ApplianceListResult] which provide lazy access to pages of the
1366
+ # response.
1367
+ #
1368
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
1369
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
1370
+ unless response.nil?
1371
+ page = response.body
1372
+ page.next_method = Proc.new do |next_page_link|
1373
+ list_by_resource_group_next_async(next_page_link, custom_headers)
1374
+ end
1375
+ page
1376
+ end
1377
+ end
1378
+
1379
+ #
1380
+ # Gets all the appliances within a subscription.
1381
+ #
1382
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1383
+ # will be added to the HTTP request.
1384
+ #
1385
+ # @return [ApplianceListResult] which provide lazy access to pages of the
1386
+ # response.
1387
+ #
1388
+ def list_by_subscription_as_lazy(custom_headers = nil)
1389
+ response = list_by_subscription_async(custom_headers).value!
1390
+ unless response.nil?
1391
+ page = response.body
1392
+ page.next_method = Proc.new do |next_page_link|
1393
+ list_by_subscription_next_async(next_page_link, custom_headers)
1394
+ end
1395
+ page
1396
+ end
1397
+ end
1398
+
1399
+ end
1400
+ end