azure_mgmt_signalr 0.16.0

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