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,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a65126ffd72b329fed65e4671b679861d5a314b65adbdec9f48d60df3de3722b
4
+ data.tar.gz: 26f42914bbbf9b4d6c7218ef8391d060da27ccf31d816ae5bd2b1e2a15ad8d91
5
+ SHA512:
6
+ metadata.gz: 4a8c6808f1358424bee739a91a11418ba2f76d45cb85239604e137dbd9dc7f7e95aa93c03d2435c96881e8d1b46a267b1f57187025ece4a7e1299d9d08eb01ce
7
+ data.tar.gz: ee13233aa406b75394db219e36478e08986e3c3826b4184984778b24c7efb9870c214923b2df76bed8d533677b8b2b093d93c3516cd0bb2de434874f931cb2ba
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -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 '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::IotCentral::Mgmt::V2017_07_01_privatepreview
23
+ autoload :Apps, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/apps.rb'
24
+ autoload :Operations, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/operations.rb'
25
+ autoload :IotCentralClient, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/iot_central_client.rb'
26
+
27
+ module Models
28
+ autoload :AppListResult, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/models/app_list_result.rb'
29
+ autoload :OperationDisplay, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/models/operation_display.rb'
30
+ autoload :AppPatch, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/models/app_patch.rb'
31
+ autoload :Operation, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/models/operation.rb'
32
+ autoload :ErrorDetails, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/models/error_details.rb'
33
+ autoload :OperationListResult, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/models/operation_list_result.rb'
34
+ autoload :Resource, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/models/resource.rb'
35
+ autoload :OperationInputs, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/models/operation_inputs.rb'
36
+ autoload :AppSkuInfo, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/models/app_sku_info.rb'
37
+ autoload :AppNameAvailabilityInfo, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/models/app_name_availability_info.rb'
38
+ autoload :App, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/models/app.rb'
39
+ autoload :AppSku, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/models/app_sku.rb'
40
+ autoload :AppNameUnavailabilityReason, '2017-07-01-privatepreview/generated/azure_mgmt_iot_central/models/app_name_unavailability_reason.rb'
41
+ end
42
+ end
@@ -0,0 +1,1103 @@
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::V2017_07_01_privatepreview
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
+ 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::V2017_07_01_privatepreview::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::V2017_07_01_privatepreview::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::V2017_07_01_privatepreview::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 MsRest::HttpOperationError.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::V2017_07_01_privatepreview::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 MsRest::HttpOperationError.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::V2017_07_01_privatepreview::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 [AppNameAvailabilityInfo] 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::V2017_07_01_privatepreview::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 MsRest::HttpOperationError.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::V2017_07_01_privatepreview::Models::AppNameAvailabilityInfo.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
+ # Create or update the metadata of an IoT Central application. The usual
551
+ # pattern to modify a property is to retrieve the IoT Central application
552
+ # metadata and security metadata, and then combine them with the modified
553
+ # values in a new body to update the IoT Central application.
554
+ #
555
+ # @param resource_group_name [String] The name of the resource group that
556
+ # contains the IoT Central application.
557
+ # @param resource_name [String] The ARM resource name of the IoT Central
558
+ # application.
559
+ # @param app [App] The IoT Central application metadata and security metadata.
560
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
561
+ # will be added to the HTTP request.
562
+ #
563
+ # @return [App] operation results.
564
+ #
565
+ def begin_create_or_update(resource_group_name, resource_name, app, custom_headers:nil)
566
+ response = begin_create_or_update_async(resource_group_name, resource_name, app, custom_headers:custom_headers).value!
567
+ response.body unless response.nil?
568
+ end
569
+
570
+ #
571
+ # Create or update the metadata of an IoT Central application. The usual
572
+ # pattern to modify a property is to retrieve the IoT Central application
573
+ # metadata and security metadata, and then combine them with the modified
574
+ # values in a new body to update the IoT Central application.
575
+ #
576
+ # @param resource_group_name [String] The name of the resource group that
577
+ # contains the IoT Central application.
578
+ # @param resource_name [String] The ARM resource name of the IoT Central
579
+ # application.
580
+ # @param app [App] The IoT Central application metadata and security metadata.
581
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
582
+ # will be added to the HTTP request.
583
+ #
584
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
585
+ #
586
+ def begin_create_or_update_with_http_info(resource_group_name, resource_name, app, custom_headers:nil)
587
+ begin_create_or_update_async(resource_group_name, resource_name, app, custom_headers:custom_headers).value!
588
+ end
589
+
590
+ #
591
+ # Create or update the metadata of an IoT Central application. The usual
592
+ # pattern to modify a property is to retrieve the IoT Central application
593
+ # metadata and security metadata, and then combine them with the modified
594
+ # values in a new body to update the IoT Central application.
595
+ #
596
+ # @param resource_group_name [String] The name of the resource group that
597
+ # contains the IoT Central application.
598
+ # @param resource_name [String] The ARM resource name of the IoT Central
599
+ # application.
600
+ # @param app [App] The IoT Central application metadata and security metadata.
601
+ # @param [Hash{String => String}] A hash of custom headers that will be added
602
+ # to the HTTP request.
603
+ #
604
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
605
+ #
606
+ def begin_create_or_update_async(resource_group_name, resource_name, app, custom_headers:nil)
607
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
608
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
609
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
610
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
611
+ fail ArgumentError, 'app is nil' if app.nil?
612
+
613
+
614
+ request_headers = {}
615
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
616
+
617
+ # Set Headers
618
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
619
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
620
+
621
+ # Serialize Request
622
+ request_mapper = Azure::IotCentral::Mgmt::V2017_07_01_privatepreview::Models::App.mapper()
623
+ request_content = @client.serialize(request_mapper, app)
624
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
625
+
626
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps/{resourceName}'
627
+
628
+ request_url = @base_url || @client.base_url
629
+
630
+ options = {
631
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
632
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
633
+ query_params: {'api-version' => @client.api_version},
634
+ body: request_content,
635
+ headers: request_headers.merge(custom_headers || {}),
636
+ base_url: request_url
637
+ }
638
+ promise = @client.make_request_async(:put, path_template, options)
639
+
640
+ promise = promise.then do |result|
641
+ http_response = result.response
642
+ status_code = http_response.status
643
+ response_content = http_response.body
644
+ unless status_code == 200 || status_code == 201 || status_code == 202
645
+ error_model = JSON.load(response_content)
646
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
647
+ end
648
+
649
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
650
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
651
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
652
+ # Deserialize Response
653
+ if status_code == 200
654
+ begin
655
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
656
+ result_mapper = Azure::IotCentral::Mgmt::V2017_07_01_privatepreview::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
+ # Deserialize Response
663
+ if status_code == 201
664
+ begin
665
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
666
+ result_mapper = Azure::IotCentral::Mgmt::V2017_07_01_privatepreview::Models::App.mapper()
667
+ result.body = @client.deserialize(result_mapper, parsed_response)
668
+ rescue Exception => e
669
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
670
+ end
671
+ end
672
+
673
+ result
674
+ end
675
+
676
+ promise.execute
677
+ end
678
+
679
+ #
680
+ # Update the metadata of an IoT Central application.
681
+ #
682
+ # @param resource_group_name [String] The name of the resource group that
683
+ # contains the IoT Central application.
684
+ # @param resource_name [String] The ARM resource name of the IoT Central
685
+ # application.
686
+ # @param app_patch [AppPatch] The IoT Central application metadata and security
687
+ # metadata.
688
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
689
+ # will be added to the HTTP request.
690
+ #
691
+ # @return [App] operation results.
692
+ #
693
+ def begin_update(resource_group_name, resource_name, app_patch, custom_headers:nil)
694
+ response = begin_update_async(resource_group_name, resource_name, app_patch, custom_headers:custom_headers).value!
695
+ response.body unless response.nil?
696
+ end
697
+
698
+ #
699
+ # Update the metadata of an IoT Central application.
700
+ #
701
+ # @param resource_group_name [String] The name of the resource group that
702
+ # contains the IoT Central application.
703
+ # @param resource_name [String] The ARM resource name of the IoT Central
704
+ # application.
705
+ # @param app_patch [AppPatch] The IoT Central application metadata and security
706
+ # metadata.
707
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
708
+ # will be added to the HTTP request.
709
+ #
710
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
711
+ #
712
+ def begin_update_with_http_info(resource_group_name, resource_name, app_patch, custom_headers:nil)
713
+ begin_update_async(resource_group_name, resource_name, app_patch, custom_headers:custom_headers).value!
714
+ end
715
+
716
+ #
717
+ # Update the metadata of an IoT Central application.
718
+ #
719
+ # @param resource_group_name [String] The name of the resource group that
720
+ # contains the IoT Central application.
721
+ # @param resource_name [String] The ARM resource name of the IoT Central
722
+ # application.
723
+ # @param app_patch [AppPatch] The IoT Central application metadata and security
724
+ # metadata.
725
+ # @param [Hash{String => String}] A hash of custom headers that will be added
726
+ # to the HTTP request.
727
+ #
728
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
729
+ #
730
+ def begin_update_async(resource_group_name, resource_name, app_patch, custom_headers:nil)
731
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
732
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
733
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
734
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
735
+ fail ArgumentError, 'app_patch is nil' if app_patch.nil?
736
+
737
+
738
+ request_headers = {}
739
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
740
+
741
+ # Set Headers
742
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
743
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
744
+
745
+ # Serialize Request
746
+ request_mapper = Azure::IotCentral::Mgmt::V2017_07_01_privatepreview::Models::AppPatch.mapper()
747
+ request_content = @client.serialize(request_mapper, app_patch)
748
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
749
+
750
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps/{resourceName}'
751
+
752
+ request_url = @base_url || @client.base_url
753
+
754
+ options = {
755
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
756
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
757
+ query_params: {'api-version' => @client.api_version},
758
+ body: request_content,
759
+ headers: request_headers.merge(custom_headers || {}),
760
+ base_url: request_url
761
+ }
762
+ promise = @client.make_request_async(:patch, path_template, options)
763
+
764
+ promise = promise.then do |result|
765
+ http_response = result.response
766
+ status_code = http_response.status
767
+ response_content = http_response.body
768
+ unless status_code == 200 || status_code == 202
769
+ error_model = JSON.load(response_content)
770
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
771
+ end
772
+
773
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
774
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
775
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
776
+ # Deserialize Response
777
+ if status_code == 200
778
+ begin
779
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
780
+ result_mapper = Azure::IotCentral::Mgmt::V2017_07_01_privatepreview::Models::App.mapper()
781
+ result.body = @client.deserialize(result_mapper, parsed_response)
782
+ rescue Exception => e
783
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
784
+ end
785
+ end
786
+
787
+ result
788
+ end
789
+
790
+ promise.execute
791
+ end
792
+
793
+ #
794
+ # Delete an IoT Central application.
795
+ #
796
+ # @param resource_group_name [String] The name of the resource group that
797
+ # contains the IoT Central application.
798
+ # @param resource_name [String] The ARM resource name of the IoT Central
799
+ # application.
800
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
801
+ # will be added to the HTTP request.
802
+ #
803
+ #
804
+ def begin_delete(resource_group_name, resource_name, custom_headers:nil)
805
+ response = begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
806
+ nil
807
+ end
808
+
809
+ #
810
+ # Delete an IoT Central application.
811
+ #
812
+ # @param resource_group_name [String] The name of the resource group that
813
+ # contains the IoT Central application.
814
+ # @param resource_name [String] The ARM resource name of the IoT Central
815
+ # application.
816
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
817
+ # will be added to the HTTP request.
818
+ #
819
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
820
+ #
821
+ def begin_delete_with_http_info(resource_group_name, resource_name, custom_headers:nil)
822
+ begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
823
+ end
824
+
825
+ #
826
+ # Delete an IoT Central application.
827
+ #
828
+ # @param resource_group_name [String] The name of the resource group that
829
+ # contains the IoT Central application.
830
+ # @param resource_name [String] The ARM resource name of the IoT Central
831
+ # application.
832
+ # @param [Hash{String => String}] A hash of custom headers that will be added
833
+ # to the HTTP request.
834
+ #
835
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
836
+ #
837
+ def begin_delete_async(resource_group_name, resource_name, custom_headers:nil)
838
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
839
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
840
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
841
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
842
+
843
+
844
+ request_headers = {}
845
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
846
+
847
+ # Set Headers
848
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
849
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
850
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps/{resourceName}'
851
+
852
+ request_url = @base_url || @client.base_url
853
+
854
+ options = {
855
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
856
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'resourceName' => resource_name},
857
+ query_params: {'api-version' => @client.api_version},
858
+ headers: request_headers.merge(custom_headers || {}),
859
+ base_url: request_url
860
+ }
861
+ promise = @client.make_request_async(:delete, path_template, options)
862
+
863
+ promise = promise.then do |result|
864
+ http_response = result.response
865
+ status_code = http_response.status
866
+ response_content = http_response.body
867
+ unless status_code == 200 || status_code == 202 || status_code == 204
868
+ error_model = JSON.load(response_content)
869
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
870
+ end
871
+
872
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
873
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
874
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
875
+
876
+ result
877
+ end
878
+
879
+ promise.execute
880
+ end
881
+
882
+ #
883
+ # Get all IoT Central Applications in a subscription.
884
+ #
885
+ # @param next_page_link [String] The NextLink from the previous successful call
886
+ # to List operation.
887
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
888
+ # will be added to the HTTP request.
889
+ #
890
+ # @return [AppListResult] operation results.
891
+ #
892
+ def list_by_subscription_next(next_page_link, custom_headers:nil)
893
+ response = list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
894
+ response.body unless response.nil?
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 custom_headers [Hash{String => String}] A hash of custom headers that
903
+ # will be added to the HTTP request.
904
+ #
905
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
906
+ #
907
+ def list_by_subscription_next_with_http_info(next_page_link, custom_headers:nil)
908
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
909
+ end
910
+
911
+ #
912
+ # Get all IoT Central Applications in a subscription.
913
+ #
914
+ # @param next_page_link [String] The NextLink from the previous successful call
915
+ # to List operation.
916
+ # @param [Hash{String => String}] A hash of custom headers that will be added
917
+ # to the HTTP request.
918
+ #
919
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
920
+ #
921
+ def list_by_subscription_next_async(next_page_link, custom_headers:nil)
922
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
923
+
924
+
925
+ request_headers = {}
926
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
927
+
928
+ # Set Headers
929
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
930
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
931
+ path_template = '{nextLink}'
932
+
933
+ request_url = @base_url || @client.base_url
934
+
935
+ options = {
936
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
937
+ skip_encoding_path_params: {'nextLink' => next_page_link},
938
+ headers: request_headers.merge(custom_headers || {}),
939
+ base_url: request_url
940
+ }
941
+ promise = @client.make_request_async(:get, path_template, options)
942
+
943
+ promise = promise.then do |result|
944
+ http_response = result.response
945
+ status_code = http_response.status
946
+ response_content = http_response.body
947
+ unless status_code == 200
948
+ error_model = JSON.load(response_content)
949
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
950
+ end
951
+
952
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
953
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
954
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
955
+ # Deserialize Response
956
+ if status_code == 200
957
+ begin
958
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
959
+ result_mapper = Azure::IotCentral::Mgmt::V2017_07_01_privatepreview::Models::AppListResult.mapper()
960
+ result.body = @client.deserialize(result_mapper, parsed_response)
961
+ rescue Exception => e
962
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
963
+ end
964
+ end
965
+
966
+ result
967
+ end
968
+
969
+ promise.execute
970
+ end
971
+
972
+ #
973
+ # Get all the IoT Central Applications in a resource group.
974
+ #
975
+ # @param next_page_link [String] The NextLink from the previous successful call
976
+ # to List operation.
977
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
978
+ # will be added to the HTTP request.
979
+ #
980
+ # @return [AppListResult] operation results.
981
+ #
982
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
983
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
984
+ response.body unless response.nil?
985
+ end
986
+
987
+ #
988
+ # Get all the IoT Central Applications in a resource group.
989
+ #
990
+ # @param next_page_link [String] The NextLink from the previous successful call
991
+ # to List operation.
992
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
993
+ # will be added to the HTTP request.
994
+ #
995
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
996
+ #
997
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
998
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
999
+ end
1000
+
1001
+ #
1002
+ # Get all the IoT Central Applications in a resource group.
1003
+ #
1004
+ # @param next_page_link [String] The NextLink from the previous successful call
1005
+ # to List operation.
1006
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1007
+ # to the HTTP request.
1008
+ #
1009
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1010
+ #
1011
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
1012
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1013
+
1014
+
1015
+ request_headers = {}
1016
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1017
+
1018
+ # Set Headers
1019
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1020
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1021
+ path_template = '{nextLink}'
1022
+
1023
+ request_url = @base_url || @client.base_url
1024
+
1025
+ options = {
1026
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1027
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1028
+ headers: request_headers.merge(custom_headers || {}),
1029
+ base_url: request_url
1030
+ }
1031
+ promise = @client.make_request_async(:get, path_template, options)
1032
+
1033
+ promise = promise.then do |result|
1034
+ http_response = result.response
1035
+ status_code = http_response.status
1036
+ response_content = http_response.body
1037
+ unless status_code == 200
1038
+ error_model = JSON.load(response_content)
1039
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1040
+ end
1041
+
1042
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1043
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1044
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1045
+ # Deserialize Response
1046
+ if status_code == 200
1047
+ begin
1048
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1049
+ result_mapper = Azure::IotCentral::Mgmt::V2017_07_01_privatepreview::Models::AppListResult.mapper()
1050
+ result.body = @client.deserialize(result_mapper, parsed_response)
1051
+ rescue Exception => e
1052
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1053
+ end
1054
+ end
1055
+
1056
+ result
1057
+ end
1058
+
1059
+ promise.execute
1060
+ end
1061
+
1062
+ #
1063
+ # Get all IoT Central Applications in a subscription.
1064
+ #
1065
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1066
+ # will be added to the HTTP request.
1067
+ #
1068
+ # @return [AppListResult] which provide lazy access to pages of the response.
1069
+ #
1070
+ def list_by_subscription_as_lazy(custom_headers:nil)
1071
+ response = list_by_subscription_async(custom_headers:custom_headers).value!
1072
+ unless response.nil?
1073
+ page = response.body
1074
+ page.next_method = Proc.new do |next_page_link|
1075
+ list_by_subscription_next_async(next_page_link, custom_headers:custom_headers)
1076
+ end
1077
+ page
1078
+ end
1079
+ end
1080
+
1081
+ #
1082
+ # Get all the IoT Central Applications in a resource group.
1083
+ #
1084
+ # @param resource_group_name [String] The name of the resource group that
1085
+ # contains the IoT Central application.
1086
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1087
+ # will be added to the HTTP request.
1088
+ #
1089
+ # @return [AppListResult] which provide lazy access to pages of the response.
1090
+ #
1091
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
1092
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
1093
+ unless response.nil?
1094
+ page = response.body
1095
+ page.next_method = Proc.new do |next_page_link|
1096
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
1097
+ end
1098
+ page
1099
+ end
1100
+ end
1101
+
1102
+ end
1103
+ end