azure_mgmt_managed_applications 0.15.2 → 0.16.0

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