azure_mgmt_service_bus 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_service_bus.rb +5 -0
  4. data/lib/generated/azure_mgmt_service_bus.rb +57 -0
  5. data/lib/generated/azure_mgmt_service_bus/models/access_rights.rb +17 -0
  6. data/lib/generated/azure_mgmt_service_bus/models/entity_availability_status.rb +19 -0
  7. data/lib/generated/azure_mgmt_service_bus/models/entity_status.rb +23 -0
  8. data/lib/generated/azure_mgmt_service_bus/models/message_count_details.rb +86 -0
  9. data/lib/generated/azure_mgmt_service_bus/models/namespace_create_or_update_parameters.rb +147 -0
  10. data/lib/generated/azure_mgmt_service_bus/models/namespace_list_result.rb +95 -0
  11. data/lib/generated/azure_mgmt_service_bus/models/namespace_resource.rb +165 -0
  12. data/lib/generated/azure_mgmt_service_bus/models/namespace_state.rb +27 -0
  13. data/lib/generated/azure_mgmt_service_bus/models/policykey.rb +16 -0
  14. data/lib/generated/azure_mgmt_service_bus/models/queue_create_or_update_parameters.rb +301 -0
  15. data/lib/generated/azure_mgmt_service_bus/models/queue_list_result.rb +94 -0
  16. data/lib/generated/azure_mgmt_service_bus/models/queue_resource.rb +326 -0
  17. data/lib/generated/azure_mgmt_service_bus/models/regenerate_keys_parameters.rb +46 -0
  18. data/lib/generated/azure_mgmt_service_bus/models/resource_list_keys.rb +88 -0
  19. data/lib/generated/azure_mgmt_service_bus/models/shared_access_authorization_rule_create_or_update_parameters.rb +74 -0
  20. data/lib/generated/azure_mgmt_service_bus/models/shared_access_authorization_rule_list_result.rb +97 -0
  21. data/lib/generated/azure_mgmt_service_bus/models/shared_access_authorization_rule_resource.rb +97 -0
  22. data/lib/generated/azure_mgmt_service_bus/models/sku.rb +66 -0
  23. data/lib/generated/azure_mgmt_service_bus/models/sku_name.rb +17 -0
  24. data/lib/generated/azure_mgmt_service_bus/models/sku_tier.rb +17 -0
  25. data/lib/generated/azure_mgmt_service_bus/models/subscription_create_or_update_parameters.rb +232 -0
  26. data/lib/generated/azure_mgmt_service_bus/models/subscription_list_result.rb +95 -0
  27. data/lib/generated/azure_mgmt_service_bus/models/subscription_resource.rb +257 -0
  28. data/lib/generated/azure_mgmt_service_bus/models/topic_create_or_update_parameters.rb +288 -0
  29. data/lib/generated/azure_mgmt_service_bus/models/topic_list_result.rb +94 -0
  30. data/lib/generated/azure_mgmt_service_bus/models/topic_resource.rb +313 -0
  31. data/lib/generated/azure_mgmt_service_bus/module_definition.rb +8 -0
  32. data/lib/generated/azure_mgmt_service_bus/namespaces.rb +1494 -0
  33. data/lib/generated/azure_mgmt_service_bus/queues.rb +1236 -0
  34. data/lib/generated/azure_mgmt_service_bus/service_bus_management_client.rb +144 -0
  35. data/lib/generated/azure_mgmt_service_bus/subscriptions.rb +533 -0
  36. data/lib/generated/azure_mgmt_service_bus/topics.rb +1236 -0
  37. data/lib/generated/azure_mgmt_service_bus/version.rb +8 -0
  38. metadata +150 -0
@@ -0,0 +1,1236 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::ServiceBus
7
+ #
8
+ # Azure Service Bus client
9
+ #
10
+ class Queues
11
+ include Azure::ARM::ServiceBus::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Queues class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [ServiceBusManagementClient] reference to the ServiceBusManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Gets the queues within a namespace.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group.
29
+ # @param namespace_name [String] The namespace name.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [Array<QueueResource>] operation results.
34
+ #
35
+ def list_all(resource_group_name, namespace_name, custom_headers = nil)
36
+ first_page = list_all_as_lazy(resource_group_name, namespace_name, custom_headers)
37
+ first_page.get_all_items
38
+ end
39
+
40
+ #
41
+ # Gets the queues within a namespace.
42
+ #
43
+ # @param resource_group_name [String] The name of the resource group.
44
+ # @param namespace_name [String] The namespace name.
45
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
46
+ # will be added to the HTTP request.
47
+ #
48
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
49
+ #
50
+ def list_all_with_http_info(resource_group_name, namespace_name, custom_headers = nil)
51
+ list_all_async(resource_group_name, namespace_name, custom_headers).value!
52
+ end
53
+
54
+ #
55
+ # Gets the queues within a namespace.
56
+ #
57
+ # @param resource_group_name [String] The name of the resource group.
58
+ # @param namespace_name [String] The namespace name.
59
+ # @param [Hash{String => String}] A hash of custom headers that will be added
60
+ # to the HTTP request.
61
+ #
62
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
63
+ #
64
+ def list_all_async(resource_group_name, namespace_name, custom_headers = nil)
65
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
66
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
67
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
68
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
69
+
70
+
71
+ request_headers = {}
72
+
73
+ # Set Headers
74
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
75
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
76
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues'
77
+
78
+ request_url = @base_url || @client.base_url
79
+
80
+ options = {
81
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
82
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'subscriptionId' => @client.subscription_id},
83
+ query_params: {'api-version' => @client.api_version},
84
+ headers: request_headers.merge(custom_headers || {}),
85
+ base_url: request_url
86
+ }
87
+ promise = @client.make_request_async(:get, path_template, options)
88
+
89
+ promise = promise.then do |result|
90
+ http_response = result.response
91
+ status_code = http_response.status
92
+ response_content = http_response.body
93
+ unless status_code == 200
94
+ error_model = JSON.load(response_content)
95
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
96
+ end
97
+
98
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
99
+ # Deserialize Response
100
+ if status_code == 200
101
+ begin
102
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
103
+ result_mapper = QueueListResult.mapper()
104
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
105
+ rescue Exception => e
106
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
107
+ end
108
+ end
109
+
110
+ result
111
+ end
112
+
113
+ promise.execute
114
+ end
115
+
116
+ #
117
+ # Creates or updates a Service Bus queue. This operation is idempotent.
118
+ #
119
+ # @param resource_group_name [String] The name of the resource group.
120
+ # @param namespace_name [String] The namespace name.
121
+ # @param queue_name [String] The queue name.
122
+ # @param parameters [QueueCreateOrUpdateParameters] Parameters supplied to
123
+ # create or update a queue resource.
124
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
125
+ # will be added to the HTTP request.
126
+ #
127
+ # @return [QueueResource] operation results.
128
+ #
129
+ def create_or_update(resource_group_name, namespace_name, queue_name, parameters, custom_headers = nil)
130
+ response = create_or_update_async(resource_group_name, namespace_name, queue_name, parameters, custom_headers).value!
131
+ response.body unless response.nil?
132
+ end
133
+
134
+ #
135
+ # Creates or updates a Service Bus queue. This operation is idempotent.
136
+ #
137
+ # @param resource_group_name [String] The name of the resource group.
138
+ # @param namespace_name [String] The namespace name.
139
+ # @param queue_name [String] The queue name.
140
+ # @param parameters [QueueCreateOrUpdateParameters] Parameters supplied to
141
+ # create or update a queue resource.
142
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
143
+ # will be added to the HTTP request.
144
+ #
145
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
146
+ #
147
+ def create_or_update_with_http_info(resource_group_name, namespace_name, queue_name, parameters, custom_headers = nil)
148
+ create_or_update_async(resource_group_name, namespace_name, queue_name, parameters, custom_headers).value!
149
+ end
150
+
151
+ #
152
+ # Creates or updates a Service Bus queue. This operation is idempotent.
153
+ #
154
+ # @param resource_group_name [String] The name of the resource group.
155
+ # @param namespace_name [String] The namespace name.
156
+ # @param queue_name [String] The queue name.
157
+ # @param parameters [QueueCreateOrUpdateParameters] Parameters supplied to
158
+ # create or update a queue resource.
159
+ # @param [Hash{String => String}] A hash of custom headers that will be added
160
+ # to the HTTP request.
161
+ #
162
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
163
+ #
164
+ def create_or_update_async(resource_group_name, namespace_name, queue_name, parameters, custom_headers = nil)
165
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
166
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
167
+ fail ArgumentError, 'queue_name is nil' if queue_name.nil?
168
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
169
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
170
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
171
+
172
+
173
+ request_headers = {}
174
+
175
+ # Set Headers
176
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
177
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
178
+
179
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
180
+
181
+ # Serialize Request
182
+ request_mapper = QueueCreateOrUpdateParameters.mapper()
183
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
184
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
185
+
186
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'
187
+
188
+ request_url = @base_url || @client.base_url
189
+
190
+ options = {
191
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
192
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'queueName' => queue_name,'subscriptionId' => @client.subscription_id},
193
+ query_params: {'api-version' => @client.api_version},
194
+ body: request_content,
195
+ headers: request_headers.merge(custom_headers || {}),
196
+ base_url: request_url
197
+ }
198
+ promise = @client.make_request_async(:put, path_template, options)
199
+
200
+ promise = promise.then do |result|
201
+ http_response = result.response
202
+ status_code = http_response.status
203
+ response_content = http_response.body
204
+ unless status_code == 200
205
+ error_model = JSON.load(response_content)
206
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
207
+ end
208
+
209
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
210
+ # Deserialize Response
211
+ if status_code == 200
212
+ begin
213
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
214
+ result_mapper = QueueResource.mapper()
215
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
216
+ rescue Exception => e
217
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
218
+ end
219
+ end
220
+
221
+ result
222
+ end
223
+
224
+ promise.execute
225
+ end
226
+
227
+ #
228
+ # Deletes a queue from the specified namespace in a resource group.
229
+ #
230
+ # @param resource_group_name [String] The name of the resource group.
231
+ # @param namespace_name [String] The namespace name.
232
+ # @param queue_name [String] The name of the queue to be deleted.
233
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
234
+ # will be added to the HTTP request.
235
+ #
236
+ #
237
+ def delete(resource_group_name, namespace_name, queue_name, custom_headers = nil)
238
+ response = delete_async(resource_group_name, namespace_name, queue_name, custom_headers).value!
239
+ nil
240
+ end
241
+
242
+ #
243
+ # Deletes a queue from the specified namespace in a resource group.
244
+ #
245
+ # @param resource_group_name [String] The name of the resource group.
246
+ # @param namespace_name [String] The namespace name.
247
+ # @param queue_name [String] The name of the queue to be deleted.
248
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
249
+ # will be added to the HTTP request.
250
+ #
251
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
252
+ #
253
+ def delete_with_http_info(resource_group_name, namespace_name, queue_name, custom_headers = nil)
254
+ delete_async(resource_group_name, namespace_name, queue_name, custom_headers).value!
255
+ end
256
+
257
+ #
258
+ # Deletes a queue from the specified namespace in a resource group.
259
+ #
260
+ # @param resource_group_name [String] The name of the resource group.
261
+ # @param namespace_name [String] The namespace name.
262
+ # @param queue_name [String] The name of the queue to be deleted.
263
+ # @param [Hash{String => String}] A hash of custom headers that will be added
264
+ # to the HTTP request.
265
+ #
266
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
267
+ #
268
+ def delete_async(resource_group_name, namespace_name, queue_name, custom_headers = nil)
269
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
270
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
271
+ fail ArgumentError, 'queue_name is nil' if queue_name.nil?
272
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
273
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
274
+
275
+
276
+ request_headers = {}
277
+
278
+ # Set Headers
279
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
280
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
281
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'
282
+
283
+ request_url = @base_url || @client.base_url
284
+
285
+ options = {
286
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
287
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'queueName' => queue_name,'subscriptionId' => @client.subscription_id},
288
+ query_params: {'api-version' => @client.api_version},
289
+ headers: request_headers.merge(custom_headers || {}),
290
+ base_url: request_url
291
+ }
292
+ promise = @client.make_request_async(:delete, path_template, options)
293
+
294
+ promise = promise.then do |result|
295
+ http_response = result.response
296
+ status_code = http_response.status
297
+ response_content = http_response.body
298
+ unless status_code == 204 || status_code == 200
299
+ error_model = JSON.load(response_content)
300
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
301
+ end
302
+
303
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
304
+
305
+ result
306
+ end
307
+
308
+ promise.execute
309
+ end
310
+
311
+ #
312
+ # Returns a description for the specified queue.
313
+ #
314
+ # @param resource_group_name [String] The name of the resource group.
315
+ # @param namespace_name [String] The namespace name.
316
+ # @param queue_name [String] The queue name.
317
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
318
+ # will be added to the HTTP request.
319
+ #
320
+ # @return [QueueResource] operation results.
321
+ #
322
+ def get(resource_group_name, namespace_name, queue_name, custom_headers = nil)
323
+ response = get_async(resource_group_name, namespace_name, queue_name, custom_headers).value!
324
+ response.body unless response.nil?
325
+ end
326
+
327
+ #
328
+ # Returns a description for the specified queue.
329
+ #
330
+ # @param resource_group_name [String] The name of the resource group.
331
+ # @param namespace_name [String] The namespace name.
332
+ # @param queue_name [String] The queue name.
333
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
334
+ # will be added to the HTTP request.
335
+ #
336
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
337
+ #
338
+ def get_with_http_info(resource_group_name, namespace_name, queue_name, custom_headers = nil)
339
+ get_async(resource_group_name, namespace_name, queue_name, custom_headers).value!
340
+ end
341
+
342
+ #
343
+ # Returns a description for the specified queue.
344
+ #
345
+ # @param resource_group_name [String] The name of the resource group.
346
+ # @param namespace_name [String] The namespace name.
347
+ # @param queue_name [String] The queue name.
348
+ # @param [Hash{String => String}] A hash of custom headers that will be added
349
+ # to the HTTP request.
350
+ #
351
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
352
+ #
353
+ def get_async(resource_group_name, namespace_name, queue_name, custom_headers = nil)
354
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
355
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
356
+ fail ArgumentError, 'queue_name is nil' if queue_name.nil?
357
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
358
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
359
+
360
+
361
+ request_headers = {}
362
+
363
+ # Set Headers
364
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
365
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
366
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}'
367
+
368
+ request_url = @base_url || @client.base_url
369
+
370
+ options = {
371
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
372
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'queueName' => queue_name,'subscriptionId' => @client.subscription_id},
373
+ query_params: {'api-version' => @client.api_version},
374
+ headers: request_headers.merge(custom_headers || {}),
375
+ base_url: request_url
376
+ }
377
+ promise = @client.make_request_async(:get, path_template, options)
378
+
379
+ promise = promise.then do |result|
380
+ http_response = result.response
381
+ status_code = http_response.status
382
+ response_content = http_response.body
383
+ unless status_code == 200
384
+ error_model = JSON.load(response_content)
385
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
386
+ end
387
+
388
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
389
+ # Deserialize Response
390
+ if status_code == 200
391
+ begin
392
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
393
+ result_mapper = QueueResource.mapper()
394
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
395
+ rescue Exception => e
396
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
397
+ end
398
+ end
399
+
400
+ result
401
+ end
402
+
403
+ promise.execute
404
+ end
405
+
406
+ #
407
+ # Gets all authorization rules for a queue.
408
+ #
409
+ # @param resource_group_name [String] The name of the resource group.
410
+ # @param namespace_name [String] The namespace name
411
+ # @param queue_name [String] The queue name.
412
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
413
+ # will be added to the HTTP request.
414
+ #
415
+ # @return [Array<SharedAccessAuthorizationRuleResource>] operation results.
416
+ #
417
+ def list_authorization_rules(resource_group_name, namespace_name, queue_name, custom_headers = nil)
418
+ first_page = list_authorization_rules_as_lazy(resource_group_name, namespace_name, queue_name, custom_headers)
419
+ first_page.get_all_items
420
+ end
421
+
422
+ #
423
+ # Gets all authorization rules for a queue.
424
+ #
425
+ # @param resource_group_name [String] The name of the resource group.
426
+ # @param namespace_name [String] The namespace name
427
+ # @param queue_name [String] The queue name.
428
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
429
+ # will be added to the HTTP request.
430
+ #
431
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
432
+ #
433
+ def list_authorization_rules_with_http_info(resource_group_name, namespace_name, queue_name, custom_headers = nil)
434
+ list_authorization_rules_async(resource_group_name, namespace_name, queue_name, custom_headers).value!
435
+ end
436
+
437
+ #
438
+ # Gets all authorization rules for a queue.
439
+ #
440
+ # @param resource_group_name [String] The name of the resource group.
441
+ # @param namespace_name [String] The namespace name
442
+ # @param queue_name [String] The queue name.
443
+ # @param [Hash{String => String}] A hash of custom headers that will be added
444
+ # to the HTTP request.
445
+ #
446
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
447
+ #
448
+ def list_authorization_rules_async(resource_group_name, namespace_name, queue_name, custom_headers = nil)
449
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
450
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
451
+ fail ArgumentError, 'queue_name is nil' if queue_name.nil?
452
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
453
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
454
+
455
+
456
+ request_headers = {}
457
+
458
+ # Set Headers
459
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
460
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
461
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules'
462
+
463
+ request_url = @base_url || @client.base_url
464
+
465
+ options = {
466
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
467
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'queueName' => queue_name,'subscriptionId' => @client.subscription_id},
468
+ query_params: {'api-version' => @client.api_version},
469
+ headers: request_headers.merge(custom_headers || {}),
470
+ base_url: request_url
471
+ }
472
+ promise = @client.make_request_async(:get, path_template, options)
473
+
474
+ promise = promise.then do |result|
475
+ http_response = result.response
476
+ status_code = http_response.status
477
+ response_content = http_response.body
478
+ unless status_code == 200
479
+ error_model = JSON.load(response_content)
480
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
481
+ end
482
+
483
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
484
+ # Deserialize Response
485
+ if status_code == 200
486
+ begin
487
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
488
+ result_mapper = SharedAccessAuthorizationRuleListResult.mapper()
489
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
490
+ rescue Exception => e
491
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
492
+ end
493
+ end
494
+
495
+ result
496
+ end
497
+
498
+ promise.execute
499
+ end
500
+
501
+ #
502
+ # Creates an authorization rule for a queue.
503
+ #
504
+ # @param resource_group_name [String] The name of the resource group.
505
+ # @param namespace_name [String] The namespace name.
506
+ # @param queue_name [String] The queue name.
507
+ # @param authorization_rule_name [String] Authorization rule name.
508
+ # @param parameters [SharedAccessAuthorizationRuleCreateOrUpdateParameters] The
509
+ # shared access authorization rule.
510
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
511
+ # will be added to the HTTP request.
512
+ #
513
+ # @return [SharedAccessAuthorizationRuleResource] operation results.
514
+ #
515
+ def create_or_update_authorization_rule(resource_group_name, namespace_name, queue_name, authorization_rule_name, parameters, custom_headers = nil)
516
+ response = create_or_update_authorization_rule_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, parameters, custom_headers).value!
517
+ response.body unless response.nil?
518
+ end
519
+
520
+ #
521
+ # Creates an authorization rule for a queue.
522
+ #
523
+ # @param resource_group_name [String] The name of the resource group.
524
+ # @param namespace_name [String] The namespace name.
525
+ # @param queue_name [String] The queue name.
526
+ # @param authorization_rule_name [String] Authorization rule name.
527
+ # @param parameters [SharedAccessAuthorizationRuleCreateOrUpdateParameters] The
528
+ # shared access authorization rule.
529
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
530
+ # will be added to the HTTP request.
531
+ #
532
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
533
+ #
534
+ def create_or_update_authorization_rule_with_http_info(resource_group_name, namespace_name, queue_name, authorization_rule_name, parameters, custom_headers = nil)
535
+ create_or_update_authorization_rule_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, parameters, custom_headers).value!
536
+ end
537
+
538
+ #
539
+ # Creates an authorization rule for a queue.
540
+ #
541
+ # @param resource_group_name [String] The name of the resource group.
542
+ # @param namespace_name [String] The namespace name.
543
+ # @param queue_name [String] The queue name.
544
+ # @param authorization_rule_name [String] Authorization rule name.
545
+ # @param parameters [SharedAccessAuthorizationRuleCreateOrUpdateParameters] The
546
+ # shared access authorization rule.
547
+ # @param [Hash{String => String}] A hash of custom headers that will be added
548
+ # to the HTTP request.
549
+ #
550
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
551
+ #
552
+ def create_or_update_authorization_rule_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, parameters, custom_headers = nil)
553
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
554
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
555
+ fail ArgumentError, 'queue_name is nil' if queue_name.nil?
556
+ fail ArgumentError, 'authorization_rule_name is nil' if authorization_rule_name.nil?
557
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
558
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
559
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
560
+
561
+
562
+ request_headers = {}
563
+
564
+ # Set Headers
565
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
566
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
567
+
568
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
569
+
570
+ # Serialize Request
571
+ request_mapper = SharedAccessAuthorizationRuleCreateOrUpdateParameters.mapper()
572
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
573
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
574
+
575
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'
576
+
577
+ request_url = @base_url || @client.base_url
578
+
579
+ options = {
580
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
581
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'queueName' => queue_name,'authorizationRuleName' => authorization_rule_name,'subscriptionId' => @client.subscription_id},
582
+ query_params: {'api-version' => @client.api_version},
583
+ body: request_content,
584
+ headers: request_headers.merge(custom_headers || {}),
585
+ base_url: request_url
586
+ }
587
+ promise = @client.make_request_async(:put, path_template, options)
588
+
589
+ promise = promise.then do |result|
590
+ http_response = result.response
591
+ status_code = http_response.status
592
+ response_content = http_response.body
593
+ unless status_code == 200
594
+ error_model = JSON.load(response_content)
595
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
596
+ end
597
+
598
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
599
+ # Deserialize Response
600
+ if status_code == 200
601
+ begin
602
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
603
+ result_mapper = SharedAccessAuthorizationRuleResource.mapper()
604
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
605
+ rescue Exception => e
606
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
607
+ end
608
+ end
609
+
610
+ result
611
+ end
612
+
613
+ promise.execute
614
+ end
615
+
616
+ #
617
+ # Deletes a queue authorization rule.
618
+ #
619
+ # @param resource_group_name [String] The name of the resource group.
620
+ # @param namespace_name [String] The namespace name.
621
+ # @param queue_name [String] The queue name.
622
+ # @param authorization_rule_name [String] Authorization rule name.
623
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
624
+ # will be added to the HTTP request.
625
+ #
626
+ #
627
+ def delete_authorization_rule(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers = nil)
628
+ response = delete_authorization_rule_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers).value!
629
+ nil
630
+ end
631
+
632
+ #
633
+ # Deletes a queue authorization rule.
634
+ #
635
+ # @param resource_group_name [String] The name of the resource group.
636
+ # @param namespace_name [String] The namespace name.
637
+ # @param queue_name [String] The queue name.
638
+ # @param authorization_rule_name [String] Authorization rule name.
639
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
640
+ # will be added to the HTTP request.
641
+ #
642
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
643
+ #
644
+ def delete_authorization_rule_with_http_info(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers = nil)
645
+ delete_authorization_rule_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers).value!
646
+ end
647
+
648
+ #
649
+ # Deletes a queue authorization rule.
650
+ #
651
+ # @param resource_group_name [String] The name of the resource group.
652
+ # @param namespace_name [String] The namespace name.
653
+ # @param queue_name [String] The queue name.
654
+ # @param authorization_rule_name [String] Authorization rule name.
655
+ # @param [Hash{String => String}] A hash of custom headers that will be added
656
+ # to the HTTP request.
657
+ #
658
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
659
+ #
660
+ def delete_authorization_rule_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers = nil)
661
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
662
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
663
+ fail ArgumentError, 'queue_name is nil' if queue_name.nil?
664
+ fail ArgumentError, 'authorization_rule_name is nil' if authorization_rule_name.nil?
665
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
666
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
667
+
668
+
669
+ request_headers = {}
670
+
671
+ # Set Headers
672
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
673
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
674
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'
675
+
676
+ request_url = @base_url || @client.base_url
677
+
678
+ options = {
679
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
680
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'queueName' => queue_name,'authorizationRuleName' => authorization_rule_name,'subscriptionId' => @client.subscription_id},
681
+ query_params: {'api-version' => @client.api_version},
682
+ headers: request_headers.merge(custom_headers || {}),
683
+ base_url: request_url
684
+ }
685
+ promise = @client.make_request_async(:delete, path_template, options)
686
+
687
+ promise = promise.then do |result|
688
+ http_response = result.response
689
+ status_code = http_response.status
690
+ response_content = http_response.body
691
+ unless status_code == 204 || status_code == 200
692
+ error_model = JSON.load(response_content)
693
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
694
+ end
695
+
696
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
697
+
698
+ result
699
+ end
700
+
701
+ promise.execute
702
+ end
703
+
704
+ #
705
+ # Gets an authorization rule for a queue by rule name.
706
+ #
707
+ # @param resource_group_name [String] The name of the resource group.
708
+ # @param namespace_name [String] The namespace name.
709
+ # @param queue_name [String] The queue name.
710
+ # @param authorization_rule_name [String] Authorization rule name.
711
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
712
+ # will be added to the HTTP request.
713
+ #
714
+ # @return [SharedAccessAuthorizationRuleResource] operation results.
715
+ #
716
+ def get_authorization_rule(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers = nil)
717
+ response = get_authorization_rule_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers).value!
718
+ response.body unless response.nil?
719
+ end
720
+
721
+ #
722
+ # Gets an authorization rule for a queue by rule name.
723
+ #
724
+ # @param resource_group_name [String] The name of the resource group.
725
+ # @param namespace_name [String] The namespace name.
726
+ # @param queue_name [String] The queue name.
727
+ # @param authorization_rule_name [String] Authorization rule name.
728
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
729
+ # will be added to the HTTP request.
730
+ #
731
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
732
+ #
733
+ def get_authorization_rule_with_http_info(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers = nil)
734
+ get_authorization_rule_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers).value!
735
+ end
736
+
737
+ #
738
+ # Gets an authorization rule for a queue by rule name.
739
+ #
740
+ # @param resource_group_name [String] The name of the resource group.
741
+ # @param namespace_name [String] The namespace name.
742
+ # @param queue_name [String] The queue name.
743
+ # @param authorization_rule_name [String] Authorization rule name.
744
+ # @param [Hash{String => String}] A hash of custom headers that will be added
745
+ # to the HTTP request.
746
+ #
747
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
748
+ #
749
+ def get_authorization_rule_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers = nil)
750
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
751
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
752
+ fail ArgumentError, 'queue_name is nil' if queue_name.nil?
753
+ fail ArgumentError, 'authorization_rule_name is nil' if authorization_rule_name.nil?
754
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
755
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
756
+
757
+
758
+ request_headers = {}
759
+
760
+ # Set Headers
761
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
762
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
763
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}'
764
+
765
+ request_url = @base_url || @client.base_url
766
+
767
+ options = {
768
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
769
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'queueName' => queue_name,'authorizationRuleName' => authorization_rule_name,'subscriptionId' => @client.subscription_id},
770
+ query_params: {'api-version' => @client.api_version},
771
+ headers: request_headers.merge(custom_headers || {}),
772
+ base_url: request_url
773
+ }
774
+ promise = @client.make_request_async(:get, path_template, options)
775
+
776
+ promise = promise.then do |result|
777
+ http_response = result.response
778
+ status_code = http_response.status
779
+ response_content = http_response.body
780
+ unless status_code == 200
781
+ error_model = JSON.load(response_content)
782
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
783
+ end
784
+
785
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
786
+ # Deserialize Response
787
+ if status_code == 200
788
+ begin
789
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
790
+ result_mapper = SharedAccessAuthorizationRuleResource.mapper()
791
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
792
+ rescue Exception => e
793
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
794
+ end
795
+ end
796
+
797
+ result
798
+ end
799
+
800
+ promise.execute
801
+ end
802
+
803
+ #
804
+ # Primary and secondary connection strings to the queue.
805
+ #
806
+ # @param resource_group_name [String] The name of the resource group.
807
+ # @param namespace_name [String] The namespace name.
808
+ # @param queue_name [String] The queue name.
809
+ # @param authorization_rule_name [String] The authorization rule name.
810
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
811
+ # will be added to the HTTP request.
812
+ #
813
+ # @return [ResourceListKeys] operation results.
814
+ #
815
+ def list_keys(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers = nil)
816
+ response = list_keys_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers).value!
817
+ response.body unless response.nil?
818
+ end
819
+
820
+ #
821
+ # Primary and secondary connection strings to the queue.
822
+ #
823
+ # @param resource_group_name [String] The name of the resource group.
824
+ # @param namespace_name [String] The namespace name.
825
+ # @param queue_name [String] The queue name.
826
+ # @param authorization_rule_name [String] The authorization rule name.
827
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
828
+ # will be added to the HTTP request.
829
+ #
830
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
831
+ #
832
+ def list_keys_with_http_info(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers = nil)
833
+ list_keys_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers).value!
834
+ end
835
+
836
+ #
837
+ # Primary and secondary connection strings to the queue.
838
+ #
839
+ # @param resource_group_name [String] The name of the resource group.
840
+ # @param namespace_name [String] The namespace name.
841
+ # @param queue_name [String] The queue name.
842
+ # @param authorization_rule_name [String] The authorization rule name.
843
+ # @param [Hash{String => String}] A hash of custom headers that will be added
844
+ # to the HTTP request.
845
+ #
846
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
847
+ #
848
+ def list_keys_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, custom_headers = nil)
849
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
850
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
851
+ fail ArgumentError, 'queue_name is nil' if queue_name.nil?
852
+ fail ArgumentError, 'authorization_rule_name is nil' if authorization_rule_name.nil?
853
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
854
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
855
+
856
+
857
+ request_headers = {}
858
+
859
+ # Set Headers
860
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
861
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
862
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys'
863
+
864
+ request_url = @base_url || @client.base_url
865
+
866
+ options = {
867
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
868
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'queueName' => queue_name,'authorizationRuleName' => authorization_rule_name,'subscriptionId' => @client.subscription_id},
869
+ query_params: {'api-version' => @client.api_version},
870
+ headers: request_headers.merge(custom_headers || {}),
871
+ base_url: request_url
872
+ }
873
+ promise = @client.make_request_async(:post, path_template, options)
874
+
875
+ promise = promise.then do |result|
876
+ http_response = result.response
877
+ status_code = http_response.status
878
+ response_content = http_response.body
879
+ unless status_code == 200
880
+ error_model = JSON.load(response_content)
881
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
882
+ end
883
+
884
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
885
+ # Deserialize Response
886
+ if status_code == 200
887
+ begin
888
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
889
+ result_mapper = ResourceListKeys.mapper()
890
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
891
+ rescue Exception => e
892
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
893
+ end
894
+ end
895
+
896
+ result
897
+ end
898
+
899
+ promise.execute
900
+ end
901
+
902
+ #
903
+ # Regenerates the primary or secondary connection strings to the queue.
904
+ #
905
+ # @param resource_group_name [String] The name of the resource group.
906
+ # @param namespace_name [String] The namespace name.
907
+ # @param queue_name [String] The queue name.
908
+ # @param authorization_rule_name [String] The authorization rule name.
909
+ # @param parameters [RegenerateKeysParameters] Parameters supplied to
910
+ # regenerate the authorization rule.
911
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
912
+ # will be added to the HTTP request.
913
+ #
914
+ # @return [ResourceListKeys] operation results.
915
+ #
916
+ def regenerate_keys(resource_group_name, namespace_name, queue_name, authorization_rule_name, parameters, custom_headers = nil)
917
+ response = regenerate_keys_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, parameters, custom_headers).value!
918
+ response.body unless response.nil?
919
+ end
920
+
921
+ #
922
+ # Regenerates the primary or secondary connection strings to the queue.
923
+ #
924
+ # @param resource_group_name [String] The name of the resource group.
925
+ # @param namespace_name [String] The namespace name.
926
+ # @param queue_name [String] The queue name.
927
+ # @param authorization_rule_name [String] The authorization rule name.
928
+ # @param parameters [RegenerateKeysParameters] Parameters supplied to
929
+ # regenerate the authorization rule.
930
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
931
+ # will be added to the HTTP request.
932
+ #
933
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
934
+ #
935
+ def regenerate_keys_with_http_info(resource_group_name, namespace_name, queue_name, authorization_rule_name, parameters, custom_headers = nil)
936
+ regenerate_keys_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, parameters, custom_headers).value!
937
+ end
938
+
939
+ #
940
+ # Regenerates the primary or secondary connection strings to the queue.
941
+ #
942
+ # @param resource_group_name [String] The name of the resource group.
943
+ # @param namespace_name [String] The namespace name.
944
+ # @param queue_name [String] The queue name.
945
+ # @param authorization_rule_name [String] The authorization rule name.
946
+ # @param parameters [RegenerateKeysParameters] Parameters supplied to
947
+ # regenerate the authorization rule.
948
+ # @param [Hash{String => String}] A hash of custom headers that will be added
949
+ # to the HTTP request.
950
+ #
951
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
952
+ #
953
+ def regenerate_keys_async(resource_group_name, namespace_name, queue_name, authorization_rule_name, parameters, custom_headers = nil)
954
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
955
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
956
+ fail ArgumentError, 'queue_name is nil' if queue_name.nil?
957
+ fail ArgumentError, 'authorization_rule_name is nil' if authorization_rule_name.nil?
958
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
959
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
960
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
961
+
962
+
963
+ request_headers = {}
964
+
965
+ # Set Headers
966
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
967
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
968
+
969
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
970
+
971
+ # Serialize Request
972
+ request_mapper = RegenerateKeysParameters.mapper()
973
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
974
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
975
+
976
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys'
977
+
978
+ request_url = @base_url || @client.base_url
979
+
980
+ options = {
981
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
982
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'queueName' => queue_name,'authorizationRuleName' => authorization_rule_name,'subscriptionId' => @client.subscription_id},
983
+ query_params: {'api-version' => @client.api_version},
984
+ body: request_content,
985
+ headers: request_headers.merge(custom_headers || {}),
986
+ base_url: request_url
987
+ }
988
+ promise = @client.make_request_async(:post, path_template, options)
989
+
990
+ promise = promise.then do |result|
991
+ http_response = result.response
992
+ status_code = http_response.status
993
+ response_content = http_response.body
994
+ unless status_code == 200
995
+ error_model = JSON.load(response_content)
996
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
997
+ end
998
+
999
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1000
+ # Deserialize Response
1001
+ if status_code == 200
1002
+ begin
1003
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1004
+ result_mapper = ResourceListKeys.mapper()
1005
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1006
+ rescue Exception => e
1007
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1008
+ end
1009
+ end
1010
+
1011
+ result
1012
+ end
1013
+
1014
+ promise.execute
1015
+ end
1016
+
1017
+ #
1018
+ # Gets the queues within a namespace.
1019
+ #
1020
+ # @param next_page_link [String] The NextLink from the previous successful call
1021
+ # to List operation.
1022
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1023
+ # will be added to the HTTP request.
1024
+ #
1025
+ # @return [QueueListResult] operation results.
1026
+ #
1027
+ def list_all_next(next_page_link, custom_headers = nil)
1028
+ response = list_all_next_async(next_page_link, custom_headers).value!
1029
+ response.body unless response.nil?
1030
+ end
1031
+
1032
+ #
1033
+ # Gets the queues within a namespace.
1034
+ #
1035
+ # @param next_page_link [String] The NextLink from the previous successful call
1036
+ # to List operation.
1037
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1038
+ # will be added to the HTTP request.
1039
+ #
1040
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1041
+ #
1042
+ def list_all_next_with_http_info(next_page_link, custom_headers = nil)
1043
+ list_all_next_async(next_page_link, custom_headers).value!
1044
+ end
1045
+
1046
+ #
1047
+ # Gets the queues within a namespace.
1048
+ #
1049
+ # @param next_page_link [String] The NextLink from the previous successful call
1050
+ # to List operation.
1051
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1052
+ # to the HTTP request.
1053
+ #
1054
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1055
+ #
1056
+ def list_all_next_async(next_page_link, custom_headers = nil)
1057
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1058
+
1059
+
1060
+ request_headers = {}
1061
+
1062
+ # Set Headers
1063
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1064
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1065
+ path_template = '{nextLink}'
1066
+
1067
+ request_url = @base_url || @client.base_url
1068
+
1069
+ options = {
1070
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1071
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1072
+ headers: request_headers.merge(custom_headers || {}),
1073
+ base_url: request_url
1074
+ }
1075
+ promise = @client.make_request_async(:get, path_template, options)
1076
+
1077
+ promise = promise.then do |result|
1078
+ http_response = result.response
1079
+ status_code = http_response.status
1080
+ response_content = http_response.body
1081
+ unless status_code == 200
1082
+ error_model = JSON.load(response_content)
1083
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1084
+ end
1085
+
1086
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1087
+ # Deserialize Response
1088
+ if status_code == 200
1089
+ begin
1090
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1091
+ result_mapper = QueueListResult.mapper()
1092
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1093
+ rescue Exception => e
1094
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1095
+ end
1096
+ end
1097
+
1098
+ result
1099
+ end
1100
+
1101
+ promise.execute
1102
+ end
1103
+
1104
+ #
1105
+ # Gets all authorization rules for a queue.
1106
+ #
1107
+ # @param next_page_link [String] The NextLink from the previous successful call
1108
+ # to List operation.
1109
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1110
+ # will be added to the HTTP request.
1111
+ #
1112
+ # @return [SharedAccessAuthorizationRuleListResult] operation results.
1113
+ #
1114
+ def list_authorization_rules_next(next_page_link, custom_headers = nil)
1115
+ response = list_authorization_rules_next_async(next_page_link, custom_headers).value!
1116
+ response.body unless response.nil?
1117
+ end
1118
+
1119
+ #
1120
+ # Gets all authorization rules for a queue.
1121
+ #
1122
+ # @param next_page_link [String] The NextLink from the previous successful call
1123
+ # to List operation.
1124
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1125
+ # will be added to the HTTP request.
1126
+ #
1127
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1128
+ #
1129
+ def list_authorization_rules_next_with_http_info(next_page_link, custom_headers = nil)
1130
+ list_authorization_rules_next_async(next_page_link, custom_headers).value!
1131
+ end
1132
+
1133
+ #
1134
+ # Gets all authorization rules for a queue.
1135
+ #
1136
+ # @param next_page_link [String] The NextLink from the previous successful call
1137
+ # to List operation.
1138
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1139
+ # to the HTTP request.
1140
+ #
1141
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1142
+ #
1143
+ def list_authorization_rules_next_async(next_page_link, custom_headers = nil)
1144
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1145
+
1146
+
1147
+ request_headers = {}
1148
+
1149
+ # Set Headers
1150
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1151
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1152
+ path_template = '{nextLink}'
1153
+
1154
+ request_url = @base_url || @client.base_url
1155
+
1156
+ options = {
1157
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1158
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1159
+ headers: request_headers.merge(custom_headers || {}),
1160
+ base_url: request_url
1161
+ }
1162
+ promise = @client.make_request_async(:get, path_template, options)
1163
+
1164
+ promise = promise.then do |result|
1165
+ http_response = result.response
1166
+ status_code = http_response.status
1167
+ response_content = http_response.body
1168
+ unless status_code == 200
1169
+ error_model = JSON.load(response_content)
1170
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1171
+ end
1172
+
1173
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1174
+ # Deserialize Response
1175
+ if status_code == 200
1176
+ begin
1177
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1178
+ result_mapper = SharedAccessAuthorizationRuleListResult.mapper()
1179
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1180
+ rescue Exception => e
1181
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1182
+ end
1183
+ end
1184
+
1185
+ result
1186
+ end
1187
+
1188
+ promise.execute
1189
+ end
1190
+
1191
+ #
1192
+ # Gets the queues within a namespace.
1193
+ #
1194
+ # @param resource_group_name [String] The name of the resource group.
1195
+ # @param namespace_name [String] The namespace name.
1196
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1197
+ # will be added to the HTTP request.
1198
+ #
1199
+ # @return [QueueListResult] which provide lazy access to pages of the response.
1200
+ #
1201
+ def list_all_as_lazy(resource_group_name, namespace_name, custom_headers = nil)
1202
+ response = list_all_async(resource_group_name, namespace_name, custom_headers).value!
1203
+ unless response.nil?
1204
+ page = response.body
1205
+ page.next_method = Proc.new do |next_page_link|
1206
+ list_all_next_async(next_page_link, custom_headers)
1207
+ end
1208
+ page
1209
+ end
1210
+ end
1211
+
1212
+ #
1213
+ # Gets all authorization rules for a queue.
1214
+ #
1215
+ # @param resource_group_name [String] The name of the resource group.
1216
+ # @param namespace_name [String] The namespace name
1217
+ # @param queue_name [String] The queue name.
1218
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1219
+ # will be added to the HTTP request.
1220
+ #
1221
+ # @return [SharedAccessAuthorizationRuleListResult] which provide lazy access
1222
+ # to pages of the response.
1223
+ #
1224
+ def list_authorization_rules_as_lazy(resource_group_name, namespace_name, queue_name, custom_headers = nil)
1225
+ response = list_authorization_rules_async(resource_group_name, namespace_name, queue_name, custom_headers).value!
1226
+ unless response.nil?
1227
+ page = response.body
1228
+ page.next_method = Proc.new do |next_page_link|
1229
+ list_authorization_rules_next_async(next_page_link, custom_headers)
1230
+ end
1231
+ page
1232
+ end
1233
+ end
1234
+
1235
+ end
1236
+ end