azure_mgmt_iot_central 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-07-01-privatepreview/generated/azure_mgmt_iot_central/iot_central_client.rb +7 -6
  3. data/lib/2018-09-01/generated/azure_mgmt_iot_central.rb +42 -0
  4. data/lib/2018-09-01/generated/azure_mgmt_iot_central/apps.rb +1085 -0
  5. data/lib/2018-09-01/generated/azure_mgmt_iot_central/iot_central_client.rb +135 -0
  6. data/lib/2018-09-01/generated/azure_mgmt_iot_central/models/app.rb +155 -0
  7. data/lib/2018-09-01/generated/azure_mgmt_iot_central/models/app_list_result.rb +99 -0
  8. data/lib/2018-09-01/generated/azure_mgmt_iot_central/models/app_name_availability_info.rb +74 -0
  9. data/lib/2018-09-01/generated/azure_mgmt_iot_central/models/app_name_unavailability_reason.rb +16 -0
  10. data/lib/2018-09-01/generated/azure_mgmt_iot_central/models/app_patch.rb +108 -0
  11. data/lib/2018-09-01/generated/azure_mgmt_iot_central/models/app_sku.rb +16 -0
  12. data/lib/2018-09-01/generated/azure_mgmt_iot_central/models/app_sku_info.rb +47 -0
  13. data/lib/2018-09-01/generated/azure_mgmt_iot_central/models/error_details.rb +71 -0
  14. data/lib/2018-09-01/generated/azure_mgmt_iot_central/models/operation.rb +60 -0
  15. data/lib/2018-09-01/generated/azure_mgmt_iot_central/models/operation_display.rb +83 -0
  16. data/lib/2018-09-01/generated/azure_mgmt_iot_central/models/operation_inputs.rb +47 -0
  17. data/lib/2018-09-01/generated/azure_mgmt_iot_central/models/operation_list_result.rb +102 -0
  18. data/lib/2018-09-01/generated/azure_mgmt_iot_central/models/resource.rb +104 -0
  19. data/lib/2018-09-01/generated/azure_mgmt_iot_central/module_definition.rb +9 -0
  20. data/lib/2018-09-01/generated/azure_mgmt_iot_central/operations.rb +215 -0
  21. data/lib/azure_mgmt_iot_central.rb +1 -0
  22. data/lib/profiles/latest/modules/iotcentral_profile_module.rb +29 -29
  23. data/lib/version.rb +1 -1
  24. metadata +22 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b39ea717ce09b1382719d490c532bfbf4fdd58f5
4
- data.tar.gz: 16b0520d46227e9563103b7b6510f7a6f5cee3bc
3
+ metadata.gz: 8a1671b5c45d7b9781da5b91f731ea76ac6bed4f
4
+ data.tar.gz: c0b6ed983c35249eec7428dda746c71872c76204
5
5
  SHA512:
6
- metadata.gz: ad38d0641669d0323ede85bb9ee9d2cf32d15a6fd9ef8c574785b53c45a535309db8ab54939e1a5aa4bf9a94d08f9c58b9c76cd28552a8f5f072d743c9dec10a
7
- data.tar.gz: ff66fb25f01924b3b041221d9d7d353504bf829029a2d0cab93e87e437bd61cf608abe3802c8b3e09990bad941bc2ca99b1f2be10dbca0ebd7651b304cfe67d9
6
+ metadata.gz: 0baf3b14f40fd5124437758e6f2e43a6fb6a17fc13e1a084e19ac4b06f89984b164a0ebe35ea2e22abd499f2792f206e544d21abc2affe34eeea36176cac1f15
7
+ data.tar.gz: f68e44905fd95b2cdc55ad64af985868bba6786838d29ff188462f7a5961a3518241c40991a73e49218a2c5b378003e414911f2337a5e98682c63ce96c1da1a1
@@ -23,15 +23,16 @@ module Azure::IotCentral::Mgmt::V2017_07_01_privatepreview
23
23
  # @return [String] The version of the API.
24
24
  attr_reader :api_version
25
25
 
26
- # @return [String] Gets or sets the preferred language for the response.
26
+ # @return [String] The preferred language for the response.
27
27
  attr_accessor :accept_language
28
28
 
29
- # @return [Integer] Gets or sets the retry timeout in seconds for Long
30
- # Running Operations. Default value is 30.
29
+ # @return [Integer] The retry timeout in seconds for Long Running
30
+ # Operations. Default value is 30.
31
31
  attr_accessor :long_running_operation_retry_timeout
32
32
 
33
- # @return [Boolean] When set to true a unique x-ms-client-request-id value
34
- # is generated and included in each request. Default is true.
33
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
34
+ # generated. When set to true a unique x-ms-client-request-id value is
35
+ # generated and included in each request. Default is true.
35
36
  attr_accessor :generate_client_request_id
36
37
 
37
38
  # @return [Apps] apps
@@ -127,7 +128,7 @@ module Azure::IotCentral::Mgmt::V2017_07_01_privatepreview
127
128
  #
128
129
  def add_telemetry
129
130
  sdk_information = 'azure_mgmt_iot_central'
130
- sdk_information = "#{sdk_information}/0.0.1"
131
+ sdk_information = "#{sdk_information}/0.17.0"
131
132
  add_user_agent_information(sdk_information)
132
133
  end
133
134
  end
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2018-09-01/generated/azure_mgmt_iot_central/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::IotCentral::Mgmt::V2018_09_01
23
+ autoload :Apps, '2018-09-01/generated/azure_mgmt_iot_central/apps.rb'
24
+ autoload :Operations, '2018-09-01/generated/azure_mgmt_iot_central/operations.rb'
25
+ autoload :IotCentralClient, '2018-09-01/generated/azure_mgmt_iot_central/iot_central_client.rb'
26
+
27
+ module Models
28
+ autoload :AppListResult, '2018-09-01/generated/azure_mgmt_iot_central/models/app_list_result.rb'
29
+ autoload :OperationDisplay, '2018-09-01/generated/azure_mgmt_iot_central/models/operation_display.rb'
30
+ autoload :AppPatch, '2018-09-01/generated/azure_mgmt_iot_central/models/app_patch.rb'
31
+ autoload :Operation, '2018-09-01/generated/azure_mgmt_iot_central/models/operation.rb'
32
+ autoload :ErrorDetails, '2018-09-01/generated/azure_mgmt_iot_central/models/error_details.rb'
33
+ autoload :OperationListResult, '2018-09-01/generated/azure_mgmt_iot_central/models/operation_list_result.rb'
34
+ autoload :Resource, '2018-09-01/generated/azure_mgmt_iot_central/models/resource.rb'
35
+ autoload :OperationInputs, '2018-09-01/generated/azure_mgmt_iot_central/models/operation_inputs.rb'
36
+ autoload :AppSkuInfo, '2018-09-01/generated/azure_mgmt_iot_central/models/app_sku_info.rb'
37
+ autoload :AppNameAvailabilityInfo, '2018-09-01/generated/azure_mgmt_iot_central/models/app_name_availability_info.rb'
38
+ autoload :App, '2018-09-01/generated/azure_mgmt_iot_central/models/app.rb'
39
+ autoload :AppSku, '2018-09-01/generated/azure_mgmt_iot_central/models/app_sku.rb'
40
+ autoload :AppNameUnavailabilityReason, '2018-09-01/generated/azure_mgmt_iot_central/models/app_name_unavailability_reason.rb'
41
+ end
42
+ end
@@ -0,0 +1,1085 @@
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 MsRest::HttpOperationError.new(result.request, http_response, error_model)
102
+ end
103
+
104
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
105
+ # Deserialize Response
106
+ if status_code == 200
107
+ begin
108
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
109
+ result_mapper = Azure::IotCentral::Mgmt::V2018_09_01::Models::App.mapper()
110
+ result.body = @client.deserialize(result_mapper, parsed_response)
111
+ rescue Exception => e
112
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
113
+ end
114
+ end
115
+
116
+ result
117
+ end
118
+
119
+ promise.execute
120
+ end
121
+
122
+ #
123
+ # Create or update the metadata of an IoT Central application. The usual
124
+ # pattern to modify a property is to retrieve the IoT Central application
125
+ # metadata and security metadata, and then combine them with the modified
126
+ # values in a new body to update the IoT Central application.
127
+ #
128
+ # @param resource_group_name [String] The name of the resource group that
129
+ # contains the IoT Central application.
130
+ # @param resource_name [String] The ARM resource name of the IoT Central
131
+ # application.
132
+ # @param app [App] The IoT Central application metadata and security metadata.
133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
134
+ # will be added to the HTTP request.
135
+ #
136
+ # @return [App] operation results.
137
+ #
138
+ def create_or_update(resource_group_name, resource_name, app, custom_headers:nil)
139
+ response = create_or_update_async(resource_group_name, resource_name, app, custom_headers:custom_headers).value!
140
+ response.body unless response.nil?
141
+ end
142
+
143
+ #
144
+ # @param resource_group_name [String] The name of the resource group that
145
+ # contains the IoT Central application.
146
+ # @param resource_name [String] The ARM resource name of the IoT Central
147
+ # application.
148
+ # @param app [App] The IoT Central application metadata and security metadata.
149
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
150
+ # will be added to the HTTP request.
151
+ #
152
+ # @return [Concurrent::Promise] promise which provides async access to http
153
+ # response.
154
+ #
155
+ def create_or_update_async(resource_group_name, resource_name, app, custom_headers:nil)
156
+ # Send request
157
+ promise = begin_create_or_update_async(resource_group_name, resource_name, app, custom_headers:custom_headers)
158
+
159
+ promise = promise.then do |response|
160
+ # Defining deserialization method.
161
+ deserialize_method = lambda do |parsed_response|
162
+ result_mapper = Azure::IotCentral::Mgmt::V2018_09_01::Models::App.mapper()
163
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
164
+ end
165
+
166
+ # Waiting for response.
167
+ @client.get_long_running_operation_result(response, deserialize_method)
168
+ end
169
+
170
+ promise
171
+ end
172
+
173
+ #
174
+ # Update the metadata of an IoT Central application.
175
+ #
176
+ # @param resource_group_name [String] The name of the resource group that
177
+ # contains the IoT Central application.
178
+ # @param resource_name [String] The ARM resource name of the IoT Central
179
+ # application.
180
+ # @param app_patch [AppPatch] The IoT Central application metadata and security
181
+ # metadata.
182
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
183
+ # will be added to the HTTP request.
184
+ #
185
+ # @return [App] operation results.
186
+ #
187
+ def update(resource_group_name, resource_name, app_patch, custom_headers:nil)
188
+ response = update_async(resource_group_name, resource_name, app_patch, custom_headers:custom_headers).value!
189
+ response.body unless response.nil?
190
+ end
191
+
192
+ #
193
+ # @param resource_group_name [String] The name of the resource group that
194
+ # contains the IoT Central application.
195
+ # @param resource_name [String] The ARM resource name of the IoT Central
196
+ # application.
197
+ # @param app_patch [AppPatch] The IoT Central application metadata and security
198
+ # metadata.
199
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
200
+ # will be added to the HTTP request.
201
+ #
202
+ # @return [Concurrent::Promise] promise which provides async access to http
203
+ # response.
204
+ #
205
+ def update_async(resource_group_name, resource_name, app_patch, custom_headers:nil)
206
+ # Send request
207
+ promise = begin_update_async(resource_group_name, resource_name, app_patch, custom_headers:custom_headers)
208
+
209
+ promise = promise.then do |response|
210
+ # Defining deserialization method.
211
+ deserialize_method = lambda do |parsed_response|
212
+ result_mapper = Azure::IotCentral::Mgmt::V2018_09_01::Models::App.mapper()
213
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
214
+ end
215
+
216
+ # Waiting for response.
217
+ @client.get_long_running_operation_result(response, deserialize_method)
218
+ end
219
+
220
+ promise
221
+ end
222
+
223
+ #
224
+ # Delete an IoT Central application.
225
+ #
226
+ # @param resource_group_name [String] The name of the resource group that
227
+ # contains the IoT Central application.
228
+ # @param resource_name [String] The ARM resource name of the IoT Central
229
+ # application.
230
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
231
+ # will be added to the HTTP request.
232
+ #
233
+ def delete(resource_group_name, resource_name, custom_headers:nil)
234
+ response = delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
235
+ nil
236
+ end
237
+
238
+ #
239
+ # @param resource_group_name [String] The name of the resource group that
240
+ # contains the IoT Central application.
241
+ # @param resource_name [String] The ARM resource name of the IoT Central
242
+ # application.
243
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
244
+ # will be added to the HTTP request.
245
+ #
246
+ # @return [Concurrent::Promise] promise which provides async access to http
247
+ # response.
248
+ #
249
+ def delete_async(resource_group_name, resource_name, custom_headers:nil)
250
+ # Send request
251
+ promise = begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers)
252
+
253
+ promise = promise.then do |response|
254
+ # Defining deserialization method.
255
+ deserialize_method = lambda do |parsed_response|
256
+ end
257
+
258
+ # Waiting for response.
259
+ @client.get_long_running_operation_result(response, deserialize_method)
260
+ end
261
+
262
+ promise
263
+ end
264
+
265
+ #
266
+ # Get all IoT Central Applications in a subscription.
267
+ #
268
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
269
+ # will be added to the HTTP request.
270
+ #
271
+ # @return [Array<App>] operation results.
272
+ #
273
+ def list_by_subscription(custom_headers:nil)
274
+ first_page = list_by_subscription_as_lazy(custom_headers:custom_headers)
275
+ first_page.get_all_items
276
+ end
277
+
278
+ #
279
+ # Get all IoT Central Applications in a subscription.
280
+ #
281
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
282
+ # will be added to the HTTP request.
283
+ #
284
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
285
+ #
286
+ def list_by_subscription_with_http_info(custom_headers:nil)
287
+ list_by_subscription_async(custom_headers:custom_headers).value!
288
+ end
289
+
290
+ #
291
+ # Get all IoT Central Applications in a subscription.
292
+ #
293
+ # @param [Hash{String => String}] A hash of custom headers that will be added
294
+ # to the HTTP request.
295
+ #
296
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
297
+ #
298
+ def list_by_subscription_async(custom_headers:nil)
299
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
300
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
301
+
302
+
303
+ request_headers = {}
304
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
305
+
306
+ # Set Headers
307
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
308
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
309
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/IoTApps'
310
+
311
+ request_url = @base_url || @client.base_url
312
+
313
+ options = {
314
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
315
+ path_params: {'subscriptionId' => @client.subscription_id},
316
+ query_params: {'api-version' => @client.api_version},
317
+ headers: request_headers.merge(custom_headers || {}),
318
+ base_url: request_url
319
+ }
320
+ promise = @client.make_request_async(:get, path_template, options)
321
+
322
+ promise = promise.then do |result|
323
+ http_response = result.response
324
+ status_code = http_response.status
325
+ response_content = http_response.body
326
+ unless status_code == 200
327
+ error_model = JSON.load(response_content)
328
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
329
+ end
330
+
331
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
332
+ # Deserialize Response
333
+ if status_code == 200
334
+ begin
335
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
336
+ result_mapper = Azure::IotCentral::Mgmt::V2018_09_01::Models::AppListResult.mapper()
337
+ result.body = @client.deserialize(result_mapper, parsed_response)
338
+ rescue Exception => e
339
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
340
+ end
341
+ end
342
+
343
+ result
344
+ end
345
+
346
+ promise.execute
347
+ end
348
+
349
+ #
350
+ # Get all the IoT Central Applications in a resource group.
351
+ #
352
+ # @param resource_group_name [String] The name of the resource group that
353
+ # contains the IoT Central application.
354
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
355
+ # will be added to the HTTP request.
356
+ #
357
+ # @return [Array<App>] operation results.
358
+ #
359
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
360
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
361
+ first_page.get_all_items
362
+ end
363
+
364
+ #
365
+ # Get all the IoT Central Applications in a resource group.
366
+ #
367
+ # @param resource_group_name [String] The name of the resource group that
368
+ # contains the IoT Central application.
369
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
370
+ # will be added to the HTTP request.
371
+ #
372
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
373
+ #
374
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
375
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
376
+ end
377
+
378
+ #
379
+ # Get all the IoT Central Applications in a resource group.
380
+ #
381
+ # @param resource_group_name [String] The name of the resource group that
382
+ # contains the IoT Central application.
383
+ # @param [Hash{String => String}] A hash of custom headers that will be added
384
+ # to the HTTP request.
385
+ #
386
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
387
+ #
388
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
389
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
390
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
391
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
392
+
393
+
394
+ request_headers = {}
395
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
396
+
397
+ # Set Headers
398
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
399
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
400
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps'
401
+
402
+ request_url = @base_url || @client.base_url
403
+
404
+ options = {
405
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
406
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
407
+ query_params: {'api-version' => @client.api_version},
408
+ headers: request_headers.merge(custom_headers || {}),
409
+ base_url: request_url
410
+ }
411
+ promise = @client.make_request_async(:get, path_template, options)
412
+
413
+ promise = promise.then do |result|
414
+ http_response = result.response
415
+ status_code = http_response.status
416
+ response_content = http_response.body
417
+ unless status_code == 200
418
+ error_model = JSON.load(response_content)
419
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
420
+ end
421
+
422
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
423
+ # Deserialize Response
424
+ if status_code == 200
425
+ begin
426
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
427
+ result_mapper = Azure::IotCentral::Mgmt::V2018_09_01::Models::AppListResult.mapper()
428
+ result.body = @client.deserialize(result_mapper, parsed_response)
429
+ rescue Exception => e
430
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
431
+ end
432
+ end
433
+
434
+ result
435
+ end
436
+
437
+ promise.execute
438
+ end
439
+
440
+ #
441
+ # Check if an IoT Central application name is available.
442
+ #
443
+ # @param operation_inputs [OperationInputs] Set the name parameter in the
444
+ # OperationInputs structure to the name of the IoT Central application to
445
+ # check.
446
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
447
+ # will be added to the HTTP request.
448
+ #
449
+ # @return [AppNameAvailabilityInfo] operation results.
450
+ #
451
+ def check_name_availability(operation_inputs, custom_headers:nil)
452
+ response = check_name_availability_async(operation_inputs, custom_headers:custom_headers).value!
453
+ response.body unless response.nil?
454
+ end
455
+
456
+ #
457
+ # Check if an IoT Central application name is available.
458
+ #
459
+ # @param operation_inputs [OperationInputs] Set the name parameter in the
460
+ # OperationInputs structure to the name of the IoT Central application to
461
+ # check.
462
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
463
+ # will be added to the HTTP request.
464
+ #
465
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
466
+ #
467
+ def check_name_availability_with_http_info(operation_inputs, custom_headers:nil)
468
+ check_name_availability_async(operation_inputs, custom_headers:custom_headers).value!
469
+ end
470
+
471
+ #
472
+ # Check if an IoT Central application name is available.
473
+ #
474
+ # @param operation_inputs [OperationInputs] Set the name parameter in the
475
+ # OperationInputs structure to the name of the IoT Central application to
476
+ # check.
477
+ # @param [Hash{String => String}] A hash of custom headers that will be added
478
+ # to the HTTP request.
479
+ #
480
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
481
+ #
482
+ def check_name_availability_async(operation_inputs, custom_headers:nil)
483
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
484
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
485
+ fail ArgumentError, 'operation_inputs is nil' if operation_inputs.nil?
486
+
487
+
488
+ request_headers = {}
489
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
490
+
491
+ # Set Headers
492
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
493
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
494
+
495
+ # Serialize Request
496
+ request_mapper = Azure::IotCentral::Mgmt::V2018_09_01::Models::OperationInputs.mapper()
497
+ request_content = @client.serialize(request_mapper, operation_inputs)
498
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
499
+
500
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability'
501
+
502
+ request_url = @base_url || @client.base_url
503
+
504
+ options = {
505
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
506
+ path_params: {'subscriptionId' => @client.subscription_id},
507
+ query_params: {'api-version' => @client.api_version},
508
+ body: request_content,
509
+ headers: request_headers.merge(custom_headers || {}),
510
+ base_url: request_url
511
+ }
512
+ promise = @client.make_request_async(:post, path_template, options)
513
+
514
+ promise = promise.then do |result|
515
+ http_response = result.response
516
+ status_code = http_response.status
517
+ response_content = http_response.body
518
+ unless status_code == 200
519
+ error_model = JSON.load(response_content)
520
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
521
+ end
522
+
523
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
524
+ # Deserialize Response
525
+ if status_code == 200
526
+ begin
527
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
528
+ result_mapper = Azure::IotCentral::Mgmt::V2018_09_01::Models::AppNameAvailabilityInfo.mapper()
529
+ result.body = @client.deserialize(result_mapper, parsed_response)
530
+ rescue Exception => e
531
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
532
+ end
533
+ end
534
+
535
+ result
536
+ end
537
+
538
+ promise.execute
539
+ end
540
+
541
+ #
542
+ # Create or update the metadata of an IoT Central application. The usual
543
+ # pattern to modify a property is to retrieve the IoT Central application
544
+ # metadata and security metadata, and then combine them with the modified
545
+ # values in a new body to update the IoT Central application.
546
+ #
547
+ # @param resource_group_name [String] The name of the resource group that
548
+ # contains the IoT Central application.
549
+ # @param resource_name [String] The ARM resource name of the IoT Central
550
+ # application.
551
+ # @param app [App] The IoT Central application metadata and security metadata.
552
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
553
+ # will be added to the HTTP request.
554
+ #
555
+ # @return [App] operation results.
556
+ #
557
+ def begin_create_or_update(resource_group_name, resource_name, app, custom_headers:nil)
558
+ response = begin_create_or_update_async(resource_group_name, resource_name, app, custom_headers:custom_headers).value!
559
+ response.body unless response.nil?
560
+ end
561
+
562
+ #
563
+ # Create or update the metadata of an IoT Central application. The usual
564
+ # pattern to modify a property is to retrieve the IoT Central application
565
+ # metadata and security metadata, and then combine them with the modified
566
+ # values in a new body to update the IoT Central application.
567
+ #
568
+ # @param resource_group_name [String] The name of the resource group that
569
+ # contains the IoT Central application.
570
+ # @param resource_name [String] The ARM resource name of the IoT Central
571
+ # application.
572
+ # @param app [App] The IoT Central application metadata and security metadata.
573
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
574
+ # will be added to the HTTP request.
575
+ #
576
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
577
+ #
578
+ def begin_create_or_update_with_http_info(resource_group_name, resource_name, app, custom_headers:nil)
579
+ begin_create_or_update_async(resource_group_name, resource_name, app, custom_headers:custom_headers).value!
580
+ end
581
+
582
+ #
583
+ # Create or update the metadata of an IoT Central application. The usual
584
+ # pattern to modify a property is to retrieve the IoT Central application
585
+ # metadata and security metadata, and then combine them with the modified
586
+ # values in a new body to update the IoT Central application.
587
+ #
588
+ # @param resource_group_name [String] The name of the resource group that
589
+ # contains the IoT Central application.
590
+ # @param resource_name [String] The ARM resource name of the IoT Central
591
+ # application.
592
+ # @param app [App] The IoT Central application metadata and security metadata.
593
+ # @param [Hash{String => String}] A hash of custom headers that will be added
594
+ # to the HTTP request.
595
+ #
596
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
597
+ #
598
+ def begin_create_or_update_async(resource_group_name, resource_name, app, custom_headers:nil)
599
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
600
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
601
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
602
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
603
+ fail ArgumentError, 'app is nil' if app.nil?
604
+
605
+
606
+ request_headers = {}
607
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
608
+
609
+ # Set Headers
610
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
611
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
612
+
613
+ # Serialize Request
614
+ request_mapper = Azure::IotCentral::Mgmt::V2018_09_01::Models::App.mapper()
615
+ request_content = @client.serialize(request_mapper, app)
616
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
617
+
618
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps/{resourceName}'
619
+
620
+ request_url = @base_url || @client.base_url
621
+
622
+ options = {
623
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
624
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
625
+ query_params: {'api-version' => @client.api_version},
626
+ body: request_content,
627
+ headers: request_headers.merge(custom_headers || {}),
628
+ base_url: request_url
629
+ }
630
+ promise = @client.make_request_async(:put, path_template, options)
631
+
632
+ promise = promise.then do |result|
633
+ http_response = result.response
634
+ status_code = http_response.status
635
+ response_content = http_response.body
636
+ unless status_code == 200 || status_code == 201 || status_code == 202
637
+ error_model = JSON.load(response_content)
638
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
639
+ end
640
+
641
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
642
+ # Deserialize Response
643
+ if status_code == 200
644
+ begin
645
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
646
+ result_mapper = Azure::IotCentral::Mgmt::V2018_09_01::Models::App.mapper()
647
+ result.body = @client.deserialize(result_mapper, parsed_response)
648
+ rescue Exception => e
649
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
650
+ end
651
+ end
652
+ # Deserialize Response
653
+ if status_code == 201
654
+ begin
655
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
656
+ result_mapper = Azure::IotCentral::Mgmt::V2018_09_01::Models::App.mapper()
657
+ result.body = @client.deserialize(result_mapper, parsed_response)
658
+ rescue Exception => e
659
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
660
+ end
661
+ end
662
+
663
+ result
664
+ end
665
+
666
+ promise.execute
667
+ end
668
+
669
+ #
670
+ # Update the metadata of an IoT Central application.
671
+ #
672
+ # @param resource_group_name [String] The name of the resource group that
673
+ # contains the IoT Central application.
674
+ # @param resource_name [String] The ARM resource name of the IoT Central
675
+ # application.
676
+ # @param app_patch [AppPatch] The IoT Central application metadata and security
677
+ # metadata.
678
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
679
+ # will be added to the HTTP request.
680
+ #
681
+ # @return [App] operation results.
682
+ #
683
+ def begin_update(resource_group_name, resource_name, app_patch, custom_headers:nil)
684
+ response = begin_update_async(resource_group_name, resource_name, app_patch, custom_headers:custom_headers).value!
685
+ response.body unless response.nil?
686
+ end
687
+
688
+ #
689
+ # Update the metadata of an IoT Central application.
690
+ #
691
+ # @param resource_group_name [String] The name of the resource group that
692
+ # contains the IoT Central application.
693
+ # @param resource_name [String] The ARM resource name of the IoT Central
694
+ # application.
695
+ # @param app_patch [AppPatch] The IoT Central application metadata and security
696
+ # metadata.
697
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
698
+ # will be added to the HTTP request.
699
+ #
700
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
701
+ #
702
+ def begin_update_with_http_info(resource_group_name, resource_name, app_patch, custom_headers:nil)
703
+ begin_update_async(resource_group_name, resource_name, app_patch, custom_headers:custom_headers).value!
704
+ end
705
+
706
+ #
707
+ # Update the metadata of an IoT Central application.
708
+ #
709
+ # @param resource_group_name [String] The name of the resource group that
710
+ # contains the IoT Central application.
711
+ # @param resource_name [String] The ARM resource name of the IoT Central
712
+ # application.
713
+ # @param app_patch [AppPatch] The IoT Central application metadata and security
714
+ # metadata.
715
+ # @param [Hash{String => String}] A hash of custom headers that will be added
716
+ # to the HTTP request.
717
+ #
718
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
719
+ #
720
+ def begin_update_async(resource_group_name, resource_name, app_patch, custom_headers:nil)
721
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
722
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
723
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
724
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
725
+ fail ArgumentError, 'app_patch is nil' if app_patch.nil?
726
+
727
+
728
+ request_headers = {}
729
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
730
+
731
+ # Set Headers
732
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
733
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
734
+
735
+ # Serialize Request
736
+ request_mapper = Azure::IotCentral::Mgmt::V2018_09_01::Models::AppPatch.mapper()
737
+ request_content = @client.serialize(request_mapper, app_patch)
738
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
739
+
740
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps/{resourceName}'
741
+
742
+ request_url = @base_url || @client.base_url
743
+
744
+ options = {
745
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
746
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
747
+ query_params: {'api-version' => @client.api_version},
748
+ body: request_content,
749
+ headers: request_headers.merge(custom_headers || {}),
750
+ base_url: request_url
751
+ }
752
+ promise = @client.make_request_async(:patch, path_template, options)
753
+
754
+ promise = promise.then do |result|
755
+ http_response = result.response
756
+ status_code = http_response.status
757
+ response_content = http_response.body
758
+ unless status_code == 200 || status_code == 202
759
+ error_model = JSON.load(response_content)
760
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
761
+ end
762
+
763
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
764
+ # Deserialize Response
765
+ if status_code == 200
766
+ begin
767
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
768
+ result_mapper = Azure::IotCentral::Mgmt::V2018_09_01::Models::App.mapper()
769
+ result.body = @client.deserialize(result_mapper, parsed_response)
770
+ rescue Exception => e
771
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
772
+ end
773
+ end
774
+
775
+ result
776
+ end
777
+
778
+ promise.execute
779
+ end
780
+
781
+ #
782
+ # Delete an IoT Central application.
783
+ #
784
+ # @param resource_group_name [String] The name of the resource group that
785
+ # contains the IoT Central application.
786
+ # @param resource_name [String] The ARM resource name of the IoT Central
787
+ # application.
788
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
789
+ # will be added to the HTTP request.
790
+ #
791
+ #
792
+ def begin_delete(resource_group_name, resource_name, custom_headers:nil)
793
+ response = begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
794
+ nil
795
+ end
796
+
797
+ #
798
+ # Delete an IoT Central application.
799
+ #
800
+ # @param resource_group_name [String] The name of the resource group that
801
+ # contains the IoT Central application.
802
+ # @param resource_name [String] The ARM resource name of the IoT Central
803
+ # application.
804
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
805
+ # will be added to the HTTP request.
806
+ #
807
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
808
+ #
809
+ def begin_delete_with_http_info(resource_group_name, resource_name, custom_headers:nil)
810
+ begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
811
+ end
812
+
813
+ #
814
+ # Delete an IoT Central application.
815
+ #
816
+ # @param resource_group_name [String] The name of the resource group that
817
+ # contains the IoT Central application.
818
+ # @param resource_name [String] The ARM resource name of the IoT Central
819
+ # application.
820
+ # @param [Hash{String => String}] A hash of custom headers that will be added
821
+ # to the HTTP request.
822
+ #
823
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
824
+ #
825
+ def begin_delete_async(resource_group_name, resource_name, custom_headers:nil)
826
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
827
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
828
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
829
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
830
+
831
+
832
+ request_headers = {}
833
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
834
+
835
+ # Set Headers
836
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
837
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
838
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps/{resourceName}'
839
+
840
+ request_url = @base_url || @client.base_url
841
+
842
+ options = {
843
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
844
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
845
+ query_params: {'api-version' => @client.api_version},
846
+ headers: request_headers.merge(custom_headers || {}),
847
+ base_url: request_url
848
+ }
849
+ promise = @client.make_request_async(:delete, path_template, options)
850
+
851
+ promise = promise.then do |result|
852
+ http_response = result.response
853
+ status_code = http_response.status
854
+ response_content = http_response.body
855
+ unless status_code == 200 || status_code == 202 || status_code == 204
856
+ error_model = JSON.load(response_content)
857
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
858
+ end
859
+
860
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
861
+
862
+ result
863
+ end
864
+
865
+ promise.execute
866
+ end
867
+
868
+ #
869
+ # Get all IoT Central Applications in a subscription.
870
+ #
871
+ # @param next_page_link [String] The NextLink from the previous successful call
872
+ # to List operation.
873
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
874
+ # will be added to the HTTP request.
875
+ #
876
+ # @return [AppListResult] operation results.
877
+ #
878
+ def list_by_subscription_next(next_page_link, custom_headers:nil)
879
+ response = list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
880
+ response.body unless response.nil?
881
+ end
882
+
883
+ #
884
+ # Get all IoT Central Applications in a subscription.
885
+ #
886
+ # @param next_page_link [String] The NextLink from the previous successful call
887
+ # to List operation.
888
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
889
+ # will be added to the HTTP request.
890
+ #
891
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
892
+ #
893
+ def list_by_subscription_next_with_http_info(next_page_link, custom_headers:nil)
894
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
895
+ end
896
+
897
+ #
898
+ # Get all IoT Central Applications in a subscription.
899
+ #
900
+ # @param next_page_link [String] The NextLink from the previous successful call
901
+ # to List operation.
902
+ # @param [Hash{String => String}] A hash of custom headers that will be added
903
+ # to the HTTP request.
904
+ #
905
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
906
+ #
907
+ def list_by_subscription_next_async(next_page_link, custom_headers:nil)
908
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
909
+
910
+
911
+ request_headers = {}
912
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
913
+
914
+ # Set Headers
915
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
916
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
917
+ path_template = '{nextLink}'
918
+
919
+ request_url = @base_url || @client.base_url
920
+
921
+ options = {
922
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
923
+ skip_encoding_path_params: {'nextLink' => next_page_link},
924
+ headers: request_headers.merge(custom_headers || {}),
925
+ base_url: request_url
926
+ }
927
+ promise = @client.make_request_async(:get, path_template, options)
928
+
929
+ promise = promise.then do |result|
930
+ http_response = result.response
931
+ status_code = http_response.status
932
+ response_content = http_response.body
933
+ unless status_code == 200
934
+ error_model = JSON.load(response_content)
935
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
936
+ end
937
+
938
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
939
+ # Deserialize Response
940
+ if status_code == 200
941
+ begin
942
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
943
+ result_mapper = Azure::IotCentral::Mgmt::V2018_09_01::Models::AppListResult.mapper()
944
+ result.body = @client.deserialize(result_mapper, parsed_response)
945
+ rescue Exception => e
946
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
947
+ end
948
+ end
949
+
950
+ result
951
+ end
952
+
953
+ promise.execute
954
+ end
955
+
956
+ #
957
+ # Get all the IoT Central Applications in a resource group.
958
+ #
959
+ # @param next_page_link [String] The NextLink from the previous successful call
960
+ # to List operation.
961
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
962
+ # will be added to the HTTP request.
963
+ #
964
+ # @return [AppListResult] operation results.
965
+ #
966
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
967
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
968
+ response.body unless response.nil?
969
+ end
970
+
971
+ #
972
+ # Get all the IoT Central Applications in a resource group.
973
+ #
974
+ # @param next_page_link [String] The NextLink from the previous successful call
975
+ # to List operation.
976
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
977
+ # will be added to the HTTP request.
978
+ #
979
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
980
+ #
981
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
982
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
983
+ end
984
+
985
+ #
986
+ # Get all the IoT Central Applications in a resource group.
987
+ #
988
+ # @param next_page_link [String] The NextLink from the previous successful call
989
+ # to List operation.
990
+ # @param [Hash{String => String}] A hash of custom headers that will be added
991
+ # to the HTTP request.
992
+ #
993
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
994
+ #
995
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
996
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
997
+
998
+
999
+ request_headers = {}
1000
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1001
+
1002
+ # Set Headers
1003
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1004
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1005
+ path_template = '{nextLink}'
1006
+
1007
+ request_url = @base_url || @client.base_url
1008
+
1009
+ options = {
1010
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1011
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1012
+ headers: request_headers.merge(custom_headers || {}),
1013
+ base_url: request_url
1014
+ }
1015
+ promise = @client.make_request_async(:get, path_template, options)
1016
+
1017
+ promise = promise.then do |result|
1018
+ http_response = result.response
1019
+ status_code = http_response.status
1020
+ response_content = http_response.body
1021
+ unless status_code == 200
1022
+ error_model = JSON.load(response_content)
1023
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1024
+ end
1025
+
1026
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1027
+ # Deserialize Response
1028
+ if status_code == 200
1029
+ begin
1030
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1031
+ result_mapper = Azure::IotCentral::Mgmt::V2018_09_01::Models::AppListResult.mapper()
1032
+ result.body = @client.deserialize(result_mapper, parsed_response)
1033
+ rescue Exception => e
1034
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1035
+ end
1036
+ end
1037
+
1038
+ result
1039
+ end
1040
+
1041
+ promise.execute
1042
+ end
1043
+
1044
+ #
1045
+ # Get all IoT Central Applications in a subscription.
1046
+ #
1047
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1048
+ # will be added to the HTTP request.
1049
+ #
1050
+ # @return [AppListResult] which provide lazy access to pages of the response.
1051
+ #
1052
+ def list_by_subscription_as_lazy(custom_headers:nil)
1053
+ response = list_by_subscription_async(custom_headers:custom_headers).value!
1054
+ unless response.nil?
1055
+ page = response.body
1056
+ page.next_method = Proc.new do |next_page_link|
1057
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers)
1058
+ end
1059
+ page
1060
+ end
1061
+ end
1062
+
1063
+ #
1064
+ # Get all the IoT Central Applications in a resource group.
1065
+ #
1066
+ # @param resource_group_name [String] The name of the resource group that
1067
+ # contains the IoT Central application.
1068
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1069
+ # will be added to the HTTP request.
1070
+ #
1071
+ # @return [AppListResult] which provide lazy access to pages of the response.
1072
+ #
1073
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
1074
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
1075
+ unless response.nil?
1076
+ page = response.body
1077
+ page.next_method = Proc.new do |next_page_link|
1078
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
1079
+ end
1080
+ page
1081
+ end
1082
+ end
1083
+
1084
+ end
1085
+ end