azure_mgmt_iot_central 0.19.2

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