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