azure_mgmt_service_bus 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_service_bus.rb +35 -20
  3. data/lib/generated/azure_mgmt_service_bus/models/{resource_list_keys.rb → access_keys.rb} +11 -5
  4. data/lib/generated/azure_mgmt_service_bus/models/access_rights.rb +1 -1
  5. data/lib/generated/azure_mgmt_service_bus/models/action.rb +69 -0
  6. data/lib/generated/azure_mgmt_service_bus/models/authorization_rule_properties.rb +53 -0
  7. data/lib/generated/azure_mgmt_service_bus/models/check_name_availability.rb +48 -0
  8. data/lib/generated/azure_mgmt_service_bus/models/check_name_availability_result.rb +72 -0
  9. data/lib/generated/azure_mgmt_service_bus/models/correlation_filter.rb +127 -0
  10. data/lib/generated/azure_mgmt_service_bus/models/entity_status.rb +5 -5
  11. data/lib/generated/azure_mgmt_service_bus/models/error_response.rb +56 -0
  12. data/lib/generated/azure_mgmt_service_bus/models/filter_type.rb +16 -0
  13. data/lib/generated/azure_mgmt_service_bus/models/{policykey.rb → key_type.rb} +3 -3
  14. data/lib/generated/azure_mgmt_service_bus/models/message_count_details.rb +9 -8
  15. data/lib/generated/azure_mgmt_service_bus/models/operation.rb +57 -0
  16. data/lib/generated/azure_mgmt_service_bus/models/operation_display.rb +69 -0
  17. data/lib/generated/azure_mgmt_service_bus/models/operation_list_result.rb +99 -0
  18. data/lib/generated/azure_mgmt_service_bus/models/regenerate_access_key_parameters.rb +59 -0
  19. data/lib/generated/azure_mgmt_service_bus/models/resource_namespace_patch.rb +86 -0
  20. data/lib/generated/azure_mgmt_service_bus/models/rule.rb +107 -0
  21. data/lib/generated/azure_mgmt_service_bus/models/rule_list_result.rb +95 -0
  22. data/lib/generated/azure_mgmt_service_bus/models/{shared_access_authorization_rule_resource.rb → sbauthorization_rule.rb} +7 -27
  23. data/lib/generated/azure_mgmt_service_bus/models/{shared_access_authorization_rule_list_result.rb → sbauthorization_rule_list_result.rb} +12 -13
  24. data/lib/generated/azure_mgmt_service_bus/models/{namespace_resource.rb → sbnamespace.rb} +19 -7
  25. data/lib/generated/azure_mgmt_service_bus/models/{namespace_list_result.rb → sbnamespace_list_result.rb} +11 -11
  26. data/lib/generated/azure_mgmt_service_bus/models/{namespace_create_or_update_parameters.rb → sbnamespace_update_parameters.rb} +50 -20
  27. data/lib/generated/azure_mgmt_service_bus/models/{queue_create_or_update_parameters.rb → sbqueue.rb} +119 -133
  28. data/lib/generated/azure_mgmt_service_bus/models/{queue_list_result.rb → sbqueue_list_result.rb} +11 -10
  29. data/lib/generated/azure_mgmt_service_bus/models/{sku.rb → sbsku.rb} +14 -10
  30. data/lib/generated/azure_mgmt_service_bus/models/{subscription_resource.rb → sbsubscription.rb} +74 -92
  31. data/lib/generated/azure_mgmt_service_bus/models/{subscription_list_result.rb → sbsubscription_list_result.rb} +11 -10
  32. data/lib/generated/azure_mgmt_service_bus/models/{topic_create_or_update_parameters.rb → sbtopic.rb} +102 -97
  33. data/lib/generated/azure_mgmt_service_bus/models/{topic_list_result.rb → sbtopic_list_result.rb} +11 -10
  34. data/lib/generated/azure_mgmt_service_bus/models/sku_name.rb +1 -1
  35. data/lib/generated/azure_mgmt_service_bus/models/sku_tier.rb +1 -1
  36. data/lib/generated/azure_mgmt_service_bus/models/sql_filter.rb +72 -0
  37. data/lib/generated/azure_mgmt_service_bus/models/sql_rule_action.rb +58 -0
  38. data/lib/generated/azure_mgmt_service_bus/models/tracked_resource.rb +86 -0
  39. data/lib/generated/azure_mgmt_service_bus/models/unavailable_reason.rb +20 -0
  40. data/lib/generated/azure_mgmt_service_bus/module_definition.rb +1 -1
  41. data/lib/generated/azure_mgmt_service_bus/namespaces.rb +442 -188
  42. data/lib/generated/azure_mgmt_service_bus/operations.rb +213 -0
  43. data/lib/generated/azure_mgmt_service_bus/queues.rb +198 -169
  44. data/lib/generated/azure_mgmt_service_bus/rules.rb +558 -0
  45. data/lib/generated/azure_mgmt_service_bus/service_bus_management_client.rb +10 -2
  46. data/lib/generated/azure_mgmt_service_bus/subscriptions.rb +90 -78
  47. data/lib/generated/azure_mgmt_service_bus/topics.rb +199 -173
  48. data/lib/generated/azure_mgmt_service_bus/version.rb +2 -2
  49. metadata +38 -23
  50. data/lib/generated/azure_mgmt_service_bus/models/queue_resource.rb +0 -308
  51. data/lib/generated/azure_mgmt_service_bus/models/regenerate_keys_parameters.rb +0 -46
  52. data/lib/generated/azure_mgmt_service_bus/models/shared_access_authorization_rule_create_or_update_parameters.rb +0 -74
  53. data/lib/generated/azure_mgmt_service_bus/models/subscription_create_or_update_parameters.rb +0 -213
  54. data/lib/generated/azure_mgmt_service_bus/models/topic_resource.rb +0 -263
@@ -0,0 +1,558 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.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 Rules
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Rules class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ServiceBusManagementClient] reference to the ServiceBusManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # List all the rules within given topic-subscription
26
+ #
27
+ # @param resource_group_name [String] Name of the Resource group within the
28
+ # Azure subscription.
29
+ # @param namespace_name [String] The namespace name
30
+ # @param topic_name [String] The topic name.
31
+ # @param subscription_name [String] The subscription name.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [Array<Rule>] operation results.
36
+ #
37
+ def list_by_subscriptions(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers = nil)
38
+ first_page = list_by_subscriptions_as_lazy(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers)
39
+ first_page.get_all_items
40
+ end
41
+
42
+ #
43
+ # List all the rules within given topic-subscription
44
+ #
45
+ # @param resource_group_name [String] Name of the Resource group within the
46
+ # Azure subscription.
47
+ # @param namespace_name [String] The namespace name
48
+ # @param topic_name [String] The topic name.
49
+ # @param subscription_name [String] The subscription name.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def list_by_subscriptions_with_http_info(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers = nil)
56
+ list_by_subscriptions_async(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # List all the rules within given topic-subscription
61
+ #
62
+ # @param resource_group_name [String] Name of the Resource group within the
63
+ # Azure subscription.
64
+ # @param namespace_name [String] The namespace name
65
+ # @param topic_name [String] The topic name.
66
+ # @param subscription_name [String] The subscription name.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def list_by_subscriptions_async(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers = nil)
73
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
74
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
75
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
76
+ fail ArgumentError, 'subscription_name is nil' if subscription_name.nil?
77
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
78
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
79
+
80
+
81
+ request_headers = {}
82
+
83
+ # Set Headers
84
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
85
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
86
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules'
87
+
88
+ request_url = @base_url || @client.base_url
89
+
90
+ options = {
91
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
92
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'topicName' => topic_name,'subscriptionName' => subscription_name,'subscriptionId' => @client.subscription_id},
93
+ query_params: {'api-version' => @client.api_version},
94
+ headers: request_headers.merge(custom_headers || {}),
95
+ base_url: request_url
96
+ }
97
+ promise = @client.make_request_async(:get, path_template, options)
98
+
99
+ promise = promise.then do |result|
100
+ http_response = result.response
101
+ status_code = http_response.status
102
+ response_content = http_response.body
103
+ unless status_code == 200
104
+ error_model = JSON.load(response_content)
105
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
106
+ end
107
+
108
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
109
+ # Deserialize Response
110
+ if status_code == 200
111
+ begin
112
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
113
+ result_mapper = Azure::ARM::ServiceBus::Models::RuleListResult.mapper()
114
+ result.body = @client.deserialize(result_mapper, parsed_response)
115
+ rescue Exception => e
116
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
117
+ end
118
+ end
119
+
120
+ result
121
+ end
122
+
123
+ promise.execute
124
+ end
125
+
126
+ #
127
+ # Creates a new rule and updates an existing rule
128
+ #
129
+ # @param resource_group_name [String] Name of the Resource group within the
130
+ # Azure subscription.
131
+ # @param namespace_name [String] The namespace name
132
+ # @param topic_name [String] The topic name.
133
+ # @param subscription_name [String] The subscription name.
134
+ # @param rule_name [String] The rule name.
135
+ # @param parameters [Rule] Parameters supplied to create a rule.
136
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
137
+ # will be added to the HTTP request.
138
+ #
139
+ # @return [Rule] operation results.
140
+ #
141
+ def create_or_update(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, parameters, custom_headers = nil)
142
+ response = create_or_update_async(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, parameters, custom_headers).value!
143
+ response.body unless response.nil?
144
+ end
145
+
146
+ #
147
+ # Creates a new rule and updates an existing rule
148
+ #
149
+ # @param resource_group_name [String] Name of the Resource group within the
150
+ # Azure subscription.
151
+ # @param namespace_name [String] The namespace name
152
+ # @param topic_name [String] The topic name.
153
+ # @param subscription_name [String] The subscription name.
154
+ # @param rule_name [String] The rule name.
155
+ # @param parameters [Rule] Parameters supplied to create a rule.
156
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
157
+ # will be added to the HTTP request.
158
+ #
159
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
160
+ #
161
+ def create_or_update_with_http_info(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, parameters, custom_headers = nil)
162
+ create_or_update_async(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, parameters, custom_headers).value!
163
+ end
164
+
165
+ #
166
+ # Creates a new rule and updates an existing rule
167
+ #
168
+ # @param resource_group_name [String] Name of the Resource group within the
169
+ # Azure subscription.
170
+ # @param namespace_name [String] The namespace name
171
+ # @param topic_name [String] The topic name.
172
+ # @param subscription_name [String] The subscription name.
173
+ # @param rule_name [String] The rule name.
174
+ # @param parameters [Rule] Parameters supplied to create a rule.
175
+ # @param [Hash{String => String}] A hash of custom headers that will be added
176
+ # to the HTTP request.
177
+ #
178
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
179
+ #
180
+ def create_or_update_async(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, parameters, custom_headers = nil)
181
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
182
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
183
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
184
+ fail ArgumentError, 'subscription_name is nil' if subscription_name.nil?
185
+ fail ArgumentError, 'rule_name is nil' if rule_name.nil?
186
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
187
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
188
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
189
+
190
+
191
+ request_headers = {}
192
+
193
+ # Set Headers
194
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
195
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
196
+
197
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
198
+
199
+ # Serialize Request
200
+ request_mapper = Azure::ARM::ServiceBus::Models::Rule.mapper()
201
+ request_content = @client.serialize(request_mapper, parameters)
202
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
203
+
204
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'
205
+
206
+ request_url = @base_url || @client.base_url
207
+
208
+ options = {
209
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
210
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'topicName' => topic_name,'subscriptionName' => subscription_name,'ruleName' => rule_name,'subscriptionId' => @client.subscription_id},
211
+ query_params: {'api-version' => @client.api_version},
212
+ body: request_content,
213
+ headers: request_headers.merge(custom_headers || {}),
214
+ base_url: request_url
215
+ }
216
+ promise = @client.make_request_async(:put, path_template, options)
217
+
218
+ promise = promise.then do |result|
219
+ http_response = result.response
220
+ status_code = http_response.status
221
+ response_content = http_response.body
222
+ unless status_code == 200
223
+ error_model = JSON.load(response_content)
224
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
225
+ end
226
+
227
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
228
+ # Deserialize Response
229
+ if status_code == 200
230
+ begin
231
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
232
+ result_mapper = Azure::ARM::ServiceBus::Models::Rule.mapper()
233
+ result.body = @client.deserialize(result_mapper, parsed_response)
234
+ rescue Exception => e
235
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
236
+ end
237
+ end
238
+
239
+ result
240
+ end
241
+
242
+ promise.execute
243
+ end
244
+
245
+ #
246
+ # Deletes an existing rule.
247
+ #
248
+ # @param resource_group_name [String] Name of the Resource group within the
249
+ # Azure subscription.
250
+ # @param namespace_name [String] The namespace name
251
+ # @param topic_name [String] The topic name.
252
+ # @param subscription_name [String] The subscription name.
253
+ # @param rule_name [String] The rule name.
254
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
255
+ # will be added to the HTTP request.
256
+ #
257
+ #
258
+ def delete(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, custom_headers = nil)
259
+ response = delete_async(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, custom_headers).value!
260
+ nil
261
+ end
262
+
263
+ #
264
+ # Deletes an existing rule.
265
+ #
266
+ # @param resource_group_name [String] Name of the Resource group within the
267
+ # Azure subscription.
268
+ # @param namespace_name [String] The namespace name
269
+ # @param topic_name [String] The topic name.
270
+ # @param subscription_name [String] The subscription name.
271
+ # @param rule_name [String] The rule name.
272
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
273
+ # will be added to the HTTP request.
274
+ #
275
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
276
+ #
277
+ def delete_with_http_info(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, custom_headers = nil)
278
+ delete_async(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, custom_headers).value!
279
+ end
280
+
281
+ #
282
+ # Deletes an existing rule.
283
+ #
284
+ # @param resource_group_name [String] Name of the Resource group within the
285
+ # Azure subscription.
286
+ # @param namespace_name [String] The namespace name
287
+ # @param topic_name [String] The topic name.
288
+ # @param subscription_name [String] The subscription name.
289
+ # @param rule_name [String] The rule name.
290
+ # @param [Hash{String => String}] A hash of custom headers that will be added
291
+ # to the HTTP request.
292
+ #
293
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
294
+ #
295
+ def delete_async(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, custom_headers = nil)
296
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
297
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
298
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
299
+ fail ArgumentError, 'subscription_name is nil' if subscription_name.nil?
300
+ fail ArgumentError, 'rule_name is nil' if rule_name.nil?
301
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
302
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
303
+
304
+
305
+ request_headers = {}
306
+
307
+ # Set Headers
308
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
309
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
310
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'
311
+
312
+ request_url = @base_url || @client.base_url
313
+
314
+ options = {
315
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
316
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'topicName' => topic_name,'subscriptionName' => subscription_name,'ruleName' => rule_name,'subscriptionId' => @client.subscription_id},
317
+ query_params: {'api-version' => @client.api_version},
318
+ headers: request_headers.merge(custom_headers || {}),
319
+ base_url: request_url
320
+ }
321
+ promise = @client.make_request_async(:delete, path_template, options)
322
+
323
+ promise = promise.then do |result|
324
+ http_response = result.response
325
+ status_code = http_response.status
326
+ response_content = http_response.body
327
+ unless status_code == 204 || status_code == 200
328
+ error_model = JSON.load(response_content)
329
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
330
+ end
331
+
332
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
333
+
334
+ result
335
+ end
336
+
337
+ promise.execute
338
+ end
339
+
340
+ #
341
+ # Retrieves the description for the specified rule.
342
+ #
343
+ # @param resource_group_name [String] Name of the Resource group within the
344
+ # Azure subscription.
345
+ # @param namespace_name [String] The namespace name
346
+ # @param topic_name [String] The topic name.
347
+ # @param subscription_name [String] The subscription name.
348
+ # @param rule_name [String] The rule name.
349
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
350
+ # will be added to the HTTP request.
351
+ #
352
+ # @return [Rule] operation results.
353
+ #
354
+ def get(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, custom_headers = nil)
355
+ response = get_async(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, custom_headers).value!
356
+ response.body unless response.nil?
357
+ end
358
+
359
+ #
360
+ # Retrieves the description for the specified rule.
361
+ #
362
+ # @param resource_group_name [String] Name of the Resource group within the
363
+ # Azure subscription.
364
+ # @param namespace_name [String] The namespace name
365
+ # @param topic_name [String] The topic name.
366
+ # @param subscription_name [String] The subscription name.
367
+ # @param rule_name [String] The rule name.
368
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
369
+ # will be added to the HTTP request.
370
+ #
371
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
372
+ #
373
+ def get_with_http_info(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, custom_headers = nil)
374
+ get_async(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, custom_headers).value!
375
+ end
376
+
377
+ #
378
+ # Retrieves the description for the specified rule.
379
+ #
380
+ # @param resource_group_name [String] Name of the Resource group within the
381
+ # Azure subscription.
382
+ # @param namespace_name [String] The namespace name
383
+ # @param topic_name [String] The topic name.
384
+ # @param subscription_name [String] The subscription name.
385
+ # @param rule_name [String] The rule name.
386
+ # @param [Hash{String => String}] A hash of custom headers that will be added
387
+ # to the HTTP request.
388
+ #
389
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
390
+ #
391
+ def get_async(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, custom_headers = nil)
392
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
393
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
394
+ fail ArgumentError, 'topic_name is nil' if topic_name.nil?
395
+ fail ArgumentError, 'subscription_name is nil' if subscription_name.nil?
396
+ fail ArgumentError, 'rule_name is nil' if rule_name.nil?
397
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
398
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
399
+
400
+
401
+ request_headers = {}
402
+
403
+ # Set Headers
404
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
405
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
406
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}'
407
+
408
+ request_url = @base_url || @client.base_url
409
+
410
+ options = {
411
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
412
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'topicName' => topic_name,'subscriptionName' => subscription_name,'ruleName' => rule_name,'subscriptionId' => @client.subscription_id},
413
+ query_params: {'api-version' => @client.api_version},
414
+ headers: request_headers.merge(custom_headers || {}),
415
+ base_url: request_url
416
+ }
417
+ promise = @client.make_request_async(:get, path_template, options)
418
+
419
+ promise = promise.then do |result|
420
+ http_response = result.response
421
+ status_code = http_response.status
422
+ response_content = http_response.body
423
+ unless status_code == 200
424
+ error_model = JSON.load(response_content)
425
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
426
+ end
427
+
428
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
429
+ # Deserialize Response
430
+ if status_code == 200
431
+ begin
432
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
433
+ result_mapper = Azure::ARM::ServiceBus::Models::Rule.mapper()
434
+ result.body = @client.deserialize(result_mapper, parsed_response)
435
+ rescue Exception => e
436
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
437
+ end
438
+ end
439
+
440
+ result
441
+ end
442
+
443
+ promise.execute
444
+ end
445
+
446
+ #
447
+ # List all the rules within given topic-subscription
448
+ #
449
+ # @param next_page_link [String] The NextLink from the previous successful call
450
+ # to List operation.
451
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
452
+ # will be added to the HTTP request.
453
+ #
454
+ # @return [RuleListResult] operation results.
455
+ #
456
+ def list_by_subscriptions_next(next_page_link, custom_headers = nil)
457
+ response = list_by_subscriptions_next_async(next_page_link, custom_headers).value!
458
+ response.body unless response.nil?
459
+ end
460
+
461
+ #
462
+ # List all the rules within given topic-subscription
463
+ #
464
+ # @param next_page_link [String] The NextLink from the previous successful call
465
+ # to List operation.
466
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
467
+ # will be added to the HTTP request.
468
+ #
469
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
470
+ #
471
+ def list_by_subscriptions_next_with_http_info(next_page_link, custom_headers = nil)
472
+ list_by_subscriptions_next_async(next_page_link, custom_headers).value!
473
+ end
474
+
475
+ #
476
+ # List all the rules within given topic-subscription
477
+ #
478
+ # @param next_page_link [String] The NextLink from the previous successful call
479
+ # to List operation.
480
+ # @param [Hash{String => String}] A hash of custom headers that will be added
481
+ # to the HTTP request.
482
+ #
483
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
484
+ #
485
+ def list_by_subscriptions_next_async(next_page_link, custom_headers = nil)
486
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
487
+
488
+
489
+ request_headers = {}
490
+
491
+ # Set Headers
492
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
493
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
494
+ path_template = '{nextLink}'
495
+
496
+ request_url = @base_url || @client.base_url
497
+
498
+ options = {
499
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
500
+ skip_encoding_path_params: {'nextLink' => next_page_link},
501
+ headers: request_headers.merge(custom_headers || {}),
502
+ base_url: request_url
503
+ }
504
+ promise = @client.make_request_async(:get, path_template, options)
505
+
506
+ promise = promise.then do |result|
507
+ http_response = result.response
508
+ status_code = http_response.status
509
+ response_content = http_response.body
510
+ unless status_code == 200
511
+ error_model = JSON.load(response_content)
512
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
513
+ end
514
+
515
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
516
+ # Deserialize Response
517
+ if status_code == 200
518
+ begin
519
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
520
+ result_mapper = Azure::ARM::ServiceBus::Models::RuleListResult.mapper()
521
+ result.body = @client.deserialize(result_mapper, parsed_response)
522
+ rescue Exception => e
523
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
524
+ end
525
+ end
526
+
527
+ result
528
+ end
529
+
530
+ promise.execute
531
+ end
532
+
533
+ #
534
+ # List all the rules within given topic-subscription
535
+ #
536
+ # @param resource_group_name [String] Name of the Resource group within the
537
+ # Azure subscription.
538
+ # @param namespace_name [String] The namespace name
539
+ # @param topic_name [String] The topic name.
540
+ # @param subscription_name [String] The subscription name.
541
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
542
+ # will be added to the HTTP request.
543
+ #
544
+ # @return [RuleListResult] which provide lazy access to pages of the response.
545
+ #
546
+ def list_by_subscriptions_as_lazy(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers = nil)
547
+ response = list_by_subscriptions_async(resource_group_name, namespace_name, topic_name, subscription_name, custom_headers).value!
548
+ unless response.nil?
549
+ page = response.body
550
+ page.next_method = Proc.new do |next_page_link|
551
+ list_by_subscriptions_next_async(next_page_link, custom_headers)
552
+ end
553
+ page
554
+ end
555
+ end
556
+
557
+ end
558
+ end