azure_mgmt_event_hub 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-08-01/generated/azure_mgmt_event_hub/event_hub_management_client.rb +7 -6
  3. data/lib/2015-08-01/generated/azure_mgmt_event_hub/event_hubs.rb +111 -0
  4. data/lib/2017-04-01/generated/azure_mgmt_event_hub.rb +11 -6
  5. data/lib/2017-04-01/generated/azure_mgmt_event_hub/consumer_groups.rb +36 -8
  6. data/lib/2017-04-01/generated/azure_mgmt_event_hub/event_hub_management_client.rb +11 -6
  7. data/lib/2017-04-01/generated/azure_mgmt_event_hub/event_hubs.rb +36 -8
  8. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/arm_disaster_recovery.rb +12 -0
  9. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/messaging_plan.rb +134 -0
  10. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/messaging_regions.rb +98 -0
  11. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/messaging_regions_list_result.rb +101 -0
  12. data/lib/2017-04-01/generated/azure_mgmt_event_hub/models/messaging_regions_properties.rb +60 -0
  13. data/lib/2017-04-01/generated/azure_mgmt_event_hub/namespaces.rb +99 -0
  14. data/lib/2017-04-01/generated/azure_mgmt_event_hub/regions.rb +224 -0
  15. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub.rb +51 -0
  16. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/clusters.rb +503 -0
  17. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/configuration.rb +257 -0
  18. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/event_hub2018preview_management_client.rb +145 -0
  19. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/cluster.rb +136 -0
  20. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/cluster_list_result.rb +100 -0
  21. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/cluster_quota_configuration_properties.rb +56 -0
  22. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/cluster_sku.rb +64 -0
  23. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ehnamespace.rb +212 -0
  24. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ehnamespace_list_result.rb +99 -0
  25. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/error_response.rb +58 -0
  26. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ip_filter_rule.rb +96 -0
  27. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ip_filter_rule_list_result.rb +100 -0
  28. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/ipaction.rb +16 -0
  29. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/operation.rb +59 -0
  30. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/operation_display.rb +72 -0
  31. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/operation_list_result.rb +103 -0
  32. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/resource.rb +71 -0
  33. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/sku.rb +75 -0
  34. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/sku_name.rb +16 -0
  35. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/sku_tier.rb +16 -0
  36. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/tracked_resource.rb +92 -0
  37. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/virtual_network_rule.rb +73 -0
  38. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/models/virtual_network_rule_list_result.rb +100 -0
  39. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/module_definition.rb +9 -0
  40. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/namespaces.rb +2006 -0
  41. data/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/operations.rb +216 -0
  42. data/lib/azure_mgmt_event_hub.rb +2 -1
  43. data/lib/profiles/latest/modules/eventhub_profile_module.rb +61 -111
  44. data/lib/version.rb +1 -1
  45. metadata +37 -5
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure end
7
+ module Azure::EventHub end
8
+ module Azure::EventHub::Mgmt end
9
+ module Azure::EventHub::Mgmt::V2018_01_01_preview end
@@ -0,0 +1,2006 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::EventHub::Mgmt::V2018_01_01_preview
7
+ #
8
+ # Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and
9
+ # VirtualNetworkRules resources.
10
+ #
11
+ class Namespaces
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 [EventHub2018PreviewManagementClient] reference to the EventHub2018PreviewManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Lists all the available Namespaces within a subscription, irrespective of the
27
+ # 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<EHNamespace>] operation results.
33
+ #
34
+ def list(custom_headers:nil)
35
+ first_page = list_as_lazy(custom_headers:custom_headers)
36
+ first_page.get_all_items
37
+ end
38
+
39
+ #
40
+ # Lists all the available Namespaces within a subscription, irrespective of the
41
+ # 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_with_http_info(custom_headers:nil)
49
+ list_async(custom_headers:custom_headers).value!
50
+ end
51
+
52
+ #
53
+ # Lists all the available Namespaces within a subscription, irrespective of the
54
+ # 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_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
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
68
+
69
+ # Set Headers
70
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
71
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
72
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.EventHub/namespaces'
73
+
74
+ request_url = @base_url || @client.base_url
75
+
76
+ options = {
77
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
78
+ path_params: {'subscriptionId' => @client.subscription_id},
79
+ query_params: {'api-version' => @client.api_version},
80
+ headers: request_headers.merge(custom_headers || {}),
81
+ base_url: request_url
82
+ }
83
+ promise = @client.make_request_async(:get, path_template, options)
84
+
85
+ promise = promise.then do |result|
86
+ http_response = result.response
87
+ status_code = http_response.status
88
+ response_content = http_response.body
89
+ unless status_code == 200
90
+ error_model = JSON.load(response_content)
91
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
92
+ end
93
+
94
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
95
+ # Deserialize Response
96
+ if status_code == 200
97
+ begin
98
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
99
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespaceListResult.mapper()
100
+ result.body = @client.deserialize(result_mapper, parsed_response)
101
+ rescue Exception => e
102
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
103
+ end
104
+ end
105
+
106
+ result
107
+ end
108
+
109
+ promise.execute
110
+ end
111
+
112
+ #
113
+ # Lists the available Namespaces within a resource group.
114
+ #
115
+ # @param resource_group_name [String] Name of the resource group within the
116
+ # Azure subscription.
117
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
118
+ # will be added to the HTTP request.
119
+ #
120
+ # @return [Array<EHNamespace>] operation results.
121
+ #
122
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
123
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
124
+ first_page.get_all_items
125
+ end
126
+
127
+ #
128
+ # Lists the available Namespaces within a resource group.
129
+ #
130
+ # @param resource_group_name [String] Name of the resource group within the
131
+ # Azure subscription.
132
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
133
+ # will be added to the HTTP request.
134
+ #
135
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
136
+ #
137
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
138
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
139
+ end
140
+
141
+ #
142
+ # Lists the available Namespaces within a resource group.
143
+ #
144
+ # @param resource_group_name [String] Name of the resource group within the
145
+ # Azure subscription.
146
+ # @param [Hash{String => String}] A hash of custom headers that will be added
147
+ # to the HTTP request.
148
+ #
149
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
150
+ #
151
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
152
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
153
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
154
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
155
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
156
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
157
+
158
+
159
+ request_headers = {}
160
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
161
+
162
+ # Set Headers
163
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
164
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
165
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces'
166
+
167
+ request_url = @base_url || @client.base_url
168
+
169
+ options = {
170
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
171
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
172
+ query_params: {'api-version' => @client.api_version},
173
+ headers: request_headers.merge(custom_headers || {}),
174
+ base_url: request_url
175
+ }
176
+ promise = @client.make_request_async(:get, path_template, options)
177
+
178
+ promise = promise.then do |result|
179
+ http_response = result.response
180
+ status_code = http_response.status
181
+ response_content = http_response.body
182
+ unless status_code == 200
183
+ error_model = JSON.load(response_content)
184
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
185
+ end
186
+
187
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
188
+ # Deserialize Response
189
+ if status_code == 200
190
+ begin
191
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
192
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespaceListResult.mapper()
193
+ result.body = @client.deserialize(result_mapper, parsed_response)
194
+ rescue Exception => e
195
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
196
+ end
197
+ end
198
+
199
+ result
200
+ end
201
+
202
+ promise.execute
203
+ end
204
+
205
+ #
206
+ # Creates or updates a namespace. Once created, this namespace's resource
207
+ # manifest is immutable. This operation is idempotent.
208
+ #
209
+ # @param resource_group_name [String] Name of the resource group within the
210
+ # Azure subscription.
211
+ # @param namespace_name [String] The Namespace name
212
+ # @param parameters [EHNamespace] Parameters for creating a namespace resource.
213
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
214
+ # will be added to the HTTP request.
215
+ #
216
+ # @return [EHNamespace] operation results.
217
+ #
218
+ def create_or_update(resource_group_name, namespace_name, parameters, custom_headers:nil)
219
+ response = create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
220
+ response.body unless response.nil?
221
+ end
222
+
223
+ #
224
+ # @param resource_group_name [String] Name of the resource group within the
225
+ # Azure subscription.
226
+ # @param namespace_name [String] The Namespace name
227
+ # @param parameters [EHNamespace] Parameters for creating a namespace resource.
228
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
229
+ # will be added to the HTTP request.
230
+ #
231
+ # @return [Concurrent::Promise] promise which provides async access to http
232
+ # response.
233
+ #
234
+ def create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers:nil)
235
+ # Send request
236
+ promise = begin_create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers)
237
+
238
+ promise = promise.then do |response|
239
+ # Defining deserialization method.
240
+ deserialize_method = lambda do |parsed_response|
241
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespace.mapper()
242
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
243
+ end
244
+
245
+ # Waiting for response.
246
+ @client.get_long_running_operation_result(response, deserialize_method)
247
+ end
248
+
249
+ promise
250
+ end
251
+
252
+ #
253
+ # Deletes an existing namespace. This operation also removes all associated
254
+ # resources under the namespace.
255
+ #
256
+ # @param resource_group_name [String] Name of the resource group within the
257
+ # Azure subscription.
258
+ # @param namespace_name [String] The Namespace name
259
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
260
+ # will be added to the HTTP request.
261
+ #
262
+ def delete(resource_group_name, namespace_name, custom_headers:nil)
263
+ response = delete_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
264
+ nil
265
+ end
266
+
267
+ #
268
+ # @param resource_group_name [String] Name of the resource group within the
269
+ # Azure subscription.
270
+ # @param namespace_name [String] The Namespace name
271
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
272
+ # will be added to the HTTP request.
273
+ #
274
+ # @return [Concurrent::Promise] promise which provides async access to http
275
+ # response.
276
+ #
277
+ def delete_async(resource_group_name, namespace_name, custom_headers:nil)
278
+ # Send request
279
+ promise = begin_delete_async(resource_group_name, namespace_name, custom_headers:custom_headers)
280
+
281
+ promise = promise.then do |response|
282
+ # Defining deserialization method.
283
+ deserialize_method = lambda do |parsed_response|
284
+ end
285
+
286
+ # Waiting for response.
287
+ @client.get_long_running_operation_result(response, deserialize_method)
288
+ end
289
+
290
+ promise
291
+ end
292
+
293
+ #
294
+ # Gets the description of the specified namespace.
295
+ #
296
+ # @param resource_group_name [String] Name of the resource group within the
297
+ # Azure subscription.
298
+ # @param namespace_name [String] The Namespace name
299
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
300
+ # will be added to the HTTP request.
301
+ #
302
+ # @return [EHNamespace] operation results.
303
+ #
304
+ def get(resource_group_name, namespace_name, custom_headers:nil)
305
+ response = get_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
306
+ response.body unless response.nil?
307
+ end
308
+
309
+ #
310
+ # Gets the description of the specified namespace.
311
+ #
312
+ # @param resource_group_name [String] Name of the resource group within the
313
+ # Azure subscription.
314
+ # @param namespace_name [String] The Namespace name
315
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
316
+ # will be added to the HTTP request.
317
+ #
318
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
319
+ #
320
+ def get_with_http_info(resource_group_name, namespace_name, custom_headers:nil)
321
+ get_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
322
+ end
323
+
324
+ #
325
+ # Gets the description of the specified namespace.
326
+ #
327
+ # @param resource_group_name [String] Name of the resource group within the
328
+ # Azure subscription.
329
+ # @param namespace_name [String] The Namespace name
330
+ # @param [Hash{String => String}] A hash of custom headers that will be added
331
+ # to the HTTP request.
332
+ #
333
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
334
+ #
335
+ def get_async(resource_group_name, namespace_name, custom_headers:nil)
336
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
337
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
338
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
339
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
340
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
341
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
342
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
343
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
344
+
345
+
346
+ request_headers = {}
347
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
348
+
349
+ # Set Headers
350
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
351
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
352
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'
353
+
354
+ request_url = @base_url || @client.base_url
355
+
356
+ options = {
357
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
358
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'subscriptionId' => @client.subscription_id},
359
+ query_params: {'api-version' => @client.api_version},
360
+ headers: request_headers.merge(custom_headers || {}),
361
+ base_url: request_url
362
+ }
363
+ promise = @client.make_request_async(:get, path_template, options)
364
+
365
+ promise = promise.then do |result|
366
+ http_response = result.response
367
+ status_code = http_response.status
368
+ response_content = http_response.body
369
+ unless status_code == 200 || status_code == 201
370
+ error_model = JSON.load(response_content)
371
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
372
+ end
373
+
374
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
375
+ # Deserialize Response
376
+ if status_code == 200
377
+ begin
378
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
379
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespace.mapper()
380
+ result.body = @client.deserialize(result_mapper, parsed_response)
381
+ rescue Exception => e
382
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
383
+ end
384
+ end
385
+ # Deserialize Response
386
+ if status_code == 201
387
+ begin
388
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
389
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespace.mapper()
390
+ result.body = @client.deserialize(result_mapper, parsed_response)
391
+ rescue Exception => e
392
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
393
+ end
394
+ end
395
+
396
+ result
397
+ end
398
+
399
+ promise.execute
400
+ end
401
+
402
+ #
403
+ # Creates or updates a namespace. Once created, this namespace's resource
404
+ # manifest is immutable. This operation is idempotent.
405
+ #
406
+ # @param resource_group_name [String] Name of the resource group within the
407
+ # Azure subscription.
408
+ # @param namespace_name [String] The Namespace name
409
+ # @param parameters [EHNamespace] Parameters for updating a namespace resource.
410
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
411
+ # will be added to the HTTP request.
412
+ #
413
+ # @return [EHNamespace] operation results.
414
+ #
415
+ def update(resource_group_name, namespace_name, parameters, custom_headers:nil)
416
+ response = update_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
417
+ response.body unless response.nil?
418
+ end
419
+
420
+ #
421
+ # Creates or updates a namespace. Once created, this namespace's resource
422
+ # manifest is immutable. This operation is idempotent.
423
+ #
424
+ # @param resource_group_name [String] Name of the resource group within the
425
+ # Azure subscription.
426
+ # @param namespace_name [String] The Namespace name
427
+ # @param parameters [EHNamespace] Parameters for updating a namespace resource.
428
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
429
+ # will be added to the HTTP request.
430
+ #
431
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
432
+ #
433
+ def update_with_http_info(resource_group_name, namespace_name, parameters, custom_headers:nil)
434
+ update_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
435
+ end
436
+
437
+ #
438
+ # Creates or updates a namespace. Once created, this namespace's resource
439
+ # manifest is immutable. This operation is idempotent.
440
+ #
441
+ # @param resource_group_name [String] Name of the resource group within the
442
+ # Azure subscription.
443
+ # @param namespace_name [String] The Namespace name
444
+ # @param parameters [EHNamespace] Parameters for updating a namespace resource.
445
+ # @param [Hash{String => String}] A hash of custom headers that will be added
446
+ # to the HTTP request.
447
+ #
448
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
449
+ #
450
+ def update_async(resource_group_name, namespace_name, parameters, custom_headers:nil)
451
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
452
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
453
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
454
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
455
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
456
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
457
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
458
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
459
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
460
+
461
+
462
+ request_headers = {}
463
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
464
+
465
+ # Set Headers
466
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
467
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
468
+
469
+ # Serialize Request
470
+ request_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespace.mapper()
471
+ request_content = @client.serialize(request_mapper, parameters)
472
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
473
+
474
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'
475
+
476
+ request_url = @base_url || @client.base_url
477
+
478
+ options = {
479
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
480
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'subscriptionId' => @client.subscription_id},
481
+ query_params: {'api-version' => @client.api_version},
482
+ body: request_content,
483
+ headers: request_headers.merge(custom_headers || {}),
484
+ base_url: request_url
485
+ }
486
+ promise = @client.make_request_async(:patch, path_template, options)
487
+
488
+ promise = promise.then do |result|
489
+ http_response = result.response
490
+ status_code = http_response.status
491
+ response_content = http_response.body
492
+ unless status_code == 201 || status_code == 200 || status_code == 202
493
+ error_model = JSON.load(response_content)
494
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
495
+ end
496
+
497
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
498
+ # Deserialize Response
499
+ if status_code == 201
500
+ begin
501
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
502
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespace.mapper()
503
+ result.body = @client.deserialize(result_mapper, parsed_response)
504
+ rescue Exception => e
505
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
506
+ end
507
+ end
508
+ # Deserialize Response
509
+ if status_code == 200
510
+ begin
511
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
512
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespace.mapper()
513
+ result.body = @client.deserialize(result_mapper, parsed_response)
514
+ rescue Exception => e
515
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
516
+ end
517
+ end
518
+
519
+ result
520
+ end
521
+
522
+ promise.execute
523
+ end
524
+
525
+ #
526
+ # Gets a list of IP Filter rules for a Namespace.
527
+ #
528
+ # @param resource_group_name [String] Name of the resource group within the
529
+ # Azure subscription.
530
+ # @param namespace_name [String] The Namespace name
531
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
532
+ # will be added to the HTTP request.
533
+ #
534
+ # @return [Array<IpFilterRule>] operation results.
535
+ #
536
+ def list_ipfilter_rules(resource_group_name, namespace_name, custom_headers:nil)
537
+ first_page = list_ipfilter_rules_as_lazy(resource_group_name, namespace_name, custom_headers:custom_headers)
538
+ first_page.get_all_items
539
+ end
540
+
541
+ #
542
+ # Gets a list of IP Filter rules for a Namespace.
543
+ #
544
+ # @param resource_group_name [String] Name of the resource group within the
545
+ # Azure subscription.
546
+ # @param namespace_name [String] The Namespace name
547
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
548
+ # will be added to the HTTP request.
549
+ #
550
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
551
+ #
552
+ def list_ipfilter_rules_with_http_info(resource_group_name, namespace_name, custom_headers:nil)
553
+ list_ipfilter_rules_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
554
+ end
555
+
556
+ #
557
+ # Gets a list of IP Filter rules for a Namespace.
558
+ #
559
+ # @param resource_group_name [String] Name of the resource group within the
560
+ # Azure subscription.
561
+ # @param namespace_name [String] The Namespace name
562
+ # @param [Hash{String => String}] A hash of custom headers that will be added
563
+ # to the HTTP request.
564
+ #
565
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
566
+ #
567
+ def list_ipfilter_rules_async(resource_group_name, namespace_name, custom_headers:nil)
568
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
569
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
570
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
571
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
572
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
573
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
574
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
575
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
576
+
577
+
578
+ request_headers = {}
579
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
580
+
581
+ # Set Headers
582
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
583
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
584
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules'
585
+
586
+ request_url = @base_url || @client.base_url
587
+
588
+ options = {
589
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
590
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'subscriptionId' => @client.subscription_id},
591
+ query_params: {'api-version' => @client.api_version},
592
+ headers: request_headers.merge(custom_headers || {}),
593
+ base_url: request_url
594
+ }
595
+ promise = @client.make_request_async(:get, path_template, options)
596
+
597
+ promise = promise.then do |result|
598
+ http_response = result.response
599
+ status_code = http_response.status
600
+ response_content = http_response.body
601
+ unless status_code == 200
602
+ error_model = JSON.load(response_content)
603
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
604
+ end
605
+
606
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
607
+ # Deserialize Response
608
+ if status_code == 200
609
+ begin
610
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
611
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::IpFilterRuleListResult.mapper()
612
+ result.body = @client.deserialize(result_mapper, parsed_response)
613
+ rescue Exception => e
614
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
615
+ end
616
+ end
617
+
618
+ result
619
+ end
620
+
621
+ promise.execute
622
+ end
623
+
624
+ #
625
+ # Creates or updates an IpFilterRule for a Namespace.
626
+ #
627
+ # @param resource_group_name [String] Name of the resource group within the
628
+ # Azure subscription.
629
+ # @param namespace_name [String] The Namespace name
630
+ # @param ip_filter_rule_name [String] The IP Filter Rule name.
631
+ # @param parameters [IpFilterRule] The Namespace IpFilterRule.
632
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
633
+ # will be added to the HTTP request.
634
+ #
635
+ # @return [IpFilterRule] operation results.
636
+ #
637
+ def create_or_update_ip_filter_rule(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers:nil)
638
+ response = create_or_update_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers:custom_headers).value!
639
+ response.body unless response.nil?
640
+ end
641
+
642
+ #
643
+ # Creates or updates an IpFilterRule for a Namespace.
644
+ #
645
+ # @param resource_group_name [String] Name of the resource group within the
646
+ # Azure subscription.
647
+ # @param namespace_name [String] The Namespace name
648
+ # @param ip_filter_rule_name [String] The IP Filter Rule name.
649
+ # @param parameters [IpFilterRule] The Namespace IpFilterRule.
650
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
651
+ # will be added to the HTTP request.
652
+ #
653
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
654
+ #
655
+ def create_or_update_ip_filter_rule_with_http_info(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers:nil)
656
+ create_or_update_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers:custom_headers).value!
657
+ end
658
+
659
+ #
660
+ # Creates or updates an IpFilterRule for a Namespace.
661
+ #
662
+ # @param resource_group_name [String] Name of the resource group within the
663
+ # Azure subscription.
664
+ # @param namespace_name [String] The Namespace name
665
+ # @param ip_filter_rule_name [String] The IP Filter Rule name.
666
+ # @param parameters [IpFilterRule] The Namespace IpFilterRule.
667
+ # @param [Hash{String => String}] A hash of custom headers that will be added
668
+ # to the HTTP request.
669
+ #
670
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
671
+ #
672
+ def create_or_update_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers:nil)
673
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
674
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
675
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
676
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
677
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
678
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
679
+ fail ArgumentError, 'ip_filter_rule_name is nil' if ip_filter_rule_name.nil?
680
+ fail ArgumentError, "'ip_filter_rule_name' should satisfy the constraint - 'MinLength': '1'" if !ip_filter_rule_name.nil? && ip_filter_rule_name.length < 1
681
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
682
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
683
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
684
+
685
+
686
+ request_headers = {}
687
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
688
+
689
+ # Set Headers
690
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
691
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
692
+
693
+ # Serialize Request
694
+ request_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::IpFilterRule.mapper()
695
+ request_content = @client.serialize(request_mapper, parameters)
696
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
697
+
698
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'
699
+
700
+ request_url = @base_url || @client.base_url
701
+
702
+ options = {
703
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
704
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'ipFilterRuleName' => ip_filter_rule_name,'subscriptionId' => @client.subscription_id},
705
+ query_params: {'api-version' => @client.api_version},
706
+ body: request_content,
707
+ headers: request_headers.merge(custom_headers || {}),
708
+ base_url: request_url
709
+ }
710
+ promise = @client.make_request_async(:put, path_template, options)
711
+
712
+ promise = promise.then do |result|
713
+ http_response = result.response
714
+ status_code = http_response.status
715
+ response_content = http_response.body
716
+ unless status_code == 200
717
+ error_model = JSON.load(response_content)
718
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
719
+ end
720
+
721
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
722
+ # Deserialize Response
723
+ if status_code == 200
724
+ begin
725
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
726
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::IpFilterRule.mapper()
727
+ result.body = @client.deserialize(result_mapper, parsed_response)
728
+ rescue Exception => e
729
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
730
+ end
731
+ end
732
+
733
+ result
734
+ end
735
+
736
+ promise.execute
737
+ end
738
+
739
+ #
740
+ # Deletes an IpFilterRule for a Namespace.
741
+ #
742
+ # @param resource_group_name [String] Name of the resource group within the
743
+ # Azure subscription.
744
+ # @param namespace_name [String] The Namespace name
745
+ # @param ip_filter_rule_name [String] The IP Filter Rule name.
746
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
747
+ # will be added to the HTTP request.
748
+ #
749
+ #
750
+ def delete_ip_filter_rule(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:nil)
751
+ response = delete_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:custom_headers).value!
752
+ nil
753
+ end
754
+
755
+ #
756
+ # Deletes an IpFilterRule for a Namespace.
757
+ #
758
+ # @param resource_group_name [String] Name of the resource group within the
759
+ # Azure subscription.
760
+ # @param namespace_name [String] The Namespace name
761
+ # @param ip_filter_rule_name [String] The IP Filter 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 [MsRestAzure::AzureOperationResponse] HTTP response information.
766
+ #
767
+ def delete_ip_filter_rule_with_http_info(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:nil)
768
+ delete_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:custom_headers).value!
769
+ end
770
+
771
+ #
772
+ # Deletes an IpFilterRule for a Namespace.
773
+ #
774
+ # @param resource_group_name [String] Name of the resource group within the
775
+ # Azure subscription.
776
+ # @param namespace_name [String] The Namespace name
777
+ # @param ip_filter_rule_name [String] The IP Filter Rule name.
778
+ # @param [Hash{String => String}] A hash of custom headers that will be added
779
+ # to the HTTP request.
780
+ #
781
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
782
+ #
783
+ def delete_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:nil)
784
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
785
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
786
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
787
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
788
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
789
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
790
+ fail ArgumentError, 'ip_filter_rule_name is nil' if ip_filter_rule_name.nil?
791
+ fail ArgumentError, "'ip_filter_rule_name' should satisfy the constraint - 'MinLength': '1'" if !ip_filter_rule_name.nil? && ip_filter_rule_name.length < 1
792
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
793
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
794
+
795
+
796
+ request_headers = {}
797
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
798
+
799
+ # Set Headers
800
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
801
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
802
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'
803
+
804
+ request_url = @base_url || @client.base_url
805
+
806
+ options = {
807
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
808
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'ipFilterRuleName' => ip_filter_rule_name,'subscriptionId' => @client.subscription_id},
809
+ query_params: {'api-version' => @client.api_version},
810
+ headers: request_headers.merge(custom_headers || {}),
811
+ base_url: request_url
812
+ }
813
+ promise = @client.make_request_async(:delete, path_template, options)
814
+
815
+ promise = promise.then do |result|
816
+ http_response = result.response
817
+ status_code = http_response.status
818
+ response_content = http_response.body
819
+ unless status_code == 204 || status_code == 200
820
+ error_model = JSON.load(response_content)
821
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
822
+ end
823
+
824
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
825
+
826
+ result
827
+ end
828
+
829
+ promise.execute
830
+ end
831
+
832
+ #
833
+ # Gets an IpFilterRule for a Namespace by rule name.
834
+ #
835
+ # @param resource_group_name [String] Name of the resource group within the
836
+ # Azure subscription.
837
+ # @param namespace_name [String] The Namespace name
838
+ # @param ip_filter_rule_name [String] The IP Filter Rule name.
839
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
840
+ # will be added to the HTTP request.
841
+ #
842
+ # @return [IpFilterRule] operation results.
843
+ #
844
+ def get_ip_filter_rule(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:nil)
845
+ response = get_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:custom_headers).value!
846
+ response.body unless response.nil?
847
+ end
848
+
849
+ #
850
+ # Gets an IpFilterRule for a Namespace by rule name.
851
+ #
852
+ # @param resource_group_name [String] Name of the resource group within the
853
+ # Azure subscription.
854
+ # @param namespace_name [String] The Namespace name
855
+ # @param ip_filter_rule_name [String] The IP Filter Rule name.
856
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
857
+ # will be added to the HTTP request.
858
+ #
859
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
860
+ #
861
+ def get_ip_filter_rule_with_http_info(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:nil)
862
+ get_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:custom_headers).value!
863
+ end
864
+
865
+ #
866
+ # Gets an IpFilterRule for a Namespace by rule name.
867
+ #
868
+ # @param resource_group_name [String] Name of the resource group within the
869
+ # Azure subscription.
870
+ # @param namespace_name [String] The Namespace name
871
+ # @param ip_filter_rule_name [String] The IP Filter Rule name.
872
+ # @param [Hash{String => String}] A hash of custom headers that will be added
873
+ # to the HTTP request.
874
+ #
875
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
876
+ #
877
+ def get_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:nil)
878
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
879
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
880
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
881
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
882
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
883
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
884
+ fail ArgumentError, 'ip_filter_rule_name is nil' if ip_filter_rule_name.nil?
885
+ fail ArgumentError, "'ip_filter_rule_name' should satisfy the constraint - 'MinLength': '1'" if !ip_filter_rule_name.nil? && ip_filter_rule_name.length < 1
886
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
887
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
888
+
889
+
890
+ request_headers = {}
891
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
892
+
893
+ # Set Headers
894
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
895
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
896
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/ipfilterrules/{ipFilterRuleName}'
897
+
898
+ request_url = @base_url || @client.base_url
899
+
900
+ options = {
901
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
902
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'ipFilterRuleName' => ip_filter_rule_name,'subscriptionId' => @client.subscription_id},
903
+ query_params: {'api-version' => @client.api_version},
904
+ headers: request_headers.merge(custom_headers || {}),
905
+ base_url: request_url
906
+ }
907
+ promise = @client.make_request_async(:get, path_template, options)
908
+
909
+ promise = promise.then do |result|
910
+ http_response = result.response
911
+ status_code = http_response.status
912
+ response_content = http_response.body
913
+ unless status_code == 200
914
+ error_model = JSON.load(response_content)
915
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
916
+ end
917
+
918
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
919
+ # Deserialize Response
920
+ if status_code == 200
921
+ begin
922
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
923
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::IpFilterRule.mapper()
924
+ result.body = @client.deserialize(result_mapper, parsed_response)
925
+ rescue Exception => e
926
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
927
+ end
928
+ end
929
+
930
+ result
931
+ end
932
+
933
+ promise.execute
934
+ end
935
+
936
+ #
937
+ # Gets a list of VirtualNetwork rules for a Namespace.
938
+ #
939
+ # @param resource_group_name [String] Name of the resource group within the
940
+ # Azure subscription.
941
+ # @param namespace_name [String] The Namespace name
942
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
943
+ # will be added to the HTTP request.
944
+ #
945
+ # @return [Array<IpFilterRule>] operation results.
946
+ #
947
+ def list_virtual_network_rules(resource_group_name, namespace_name, custom_headers:nil)
948
+ first_page = list_virtual_network_rules_as_lazy(resource_group_name, namespace_name, custom_headers:custom_headers)
949
+ first_page.get_all_items
950
+ end
951
+
952
+ #
953
+ # Gets a list of VirtualNetwork rules for a Namespace.
954
+ #
955
+ # @param resource_group_name [String] Name of the resource group within the
956
+ # Azure subscription.
957
+ # @param namespace_name [String] The Namespace name
958
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
959
+ # will be added to the HTTP request.
960
+ #
961
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
962
+ #
963
+ def list_virtual_network_rules_with_http_info(resource_group_name, namespace_name, custom_headers:nil)
964
+ list_virtual_network_rules_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
965
+ end
966
+
967
+ #
968
+ # Gets a list of VirtualNetwork rules for a Namespace.
969
+ #
970
+ # @param resource_group_name [String] Name of the resource group within the
971
+ # Azure subscription.
972
+ # @param namespace_name [String] The Namespace name
973
+ # @param [Hash{String => String}] A hash of custom headers that will be added
974
+ # to the HTTP request.
975
+ #
976
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
977
+ #
978
+ def list_virtual_network_rules_async(resource_group_name, namespace_name, custom_headers:nil)
979
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
980
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
981
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
982
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
983
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
984
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
985
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
986
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
987
+
988
+
989
+ request_headers = {}
990
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
991
+
992
+ # Set Headers
993
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
994
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
995
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules'
996
+
997
+ request_url = @base_url || @client.base_url
998
+
999
+ options = {
1000
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1001
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'subscriptionId' => @client.subscription_id},
1002
+ query_params: {'api-version' => @client.api_version},
1003
+ headers: request_headers.merge(custom_headers || {}),
1004
+ base_url: request_url
1005
+ }
1006
+ promise = @client.make_request_async(:get, path_template, options)
1007
+
1008
+ promise = promise.then do |result|
1009
+ http_response = result.response
1010
+ status_code = http_response.status
1011
+ response_content = http_response.body
1012
+ unless status_code == 200
1013
+ error_model = JSON.load(response_content)
1014
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1015
+ end
1016
+
1017
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1018
+ # Deserialize Response
1019
+ if status_code == 200
1020
+ begin
1021
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1022
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::VirtualNetworkRuleListResult.mapper()
1023
+ result.body = @client.deserialize(result_mapper, parsed_response)
1024
+ rescue Exception => e
1025
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1026
+ end
1027
+ end
1028
+
1029
+ result
1030
+ end
1031
+
1032
+ promise.execute
1033
+ end
1034
+
1035
+ #
1036
+ # Creates or updates an VirtualNetworkRule for a Namespace.
1037
+ #
1038
+ # @param resource_group_name [String] Name of the resource group within the
1039
+ # Azure subscription.
1040
+ # @param namespace_name [String] The Namespace name
1041
+ # @param virtual_network_rule_name [String] The Virtual Network Rule name.
1042
+ # @param parameters [VirtualNetworkRule] The Namespace VirtualNetworkRule.
1043
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1044
+ # will be added to the HTTP request.
1045
+ #
1046
+ # @return [VirtualNetworkRule] operation results.
1047
+ #
1048
+ def create_or_update_virtual_network_rule(resource_group_name, namespace_name, virtual_network_rule_name, parameters, custom_headers:nil)
1049
+ response = create_or_update_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, parameters, custom_headers:custom_headers).value!
1050
+ response.body unless response.nil?
1051
+ end
1052
+
1053
+ #
1054
+ # Creates or updates an VirtualNetworkRule for a Namespace.
1055
+ #
1056
+ # @param resource_group_name [String] Name of the resource group within the
1057
+ # Azure subscription.
1058
+ # @param namespace_name [String] The Namespace name
1059
+ # @param virtual_network_rule_name [String] The Virtual Network Rule name.
1060
+ # @param parameters [VirtualNetworkRule] The Namespace VirtualNetworkRule.
1061
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1062
+ # will be added to the HTTP request.
1063
+ #
1064
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1065
+ #
1066
+ def create_or_update_virtual_network_rule_with_http_info(resource_group_name, namespace_name, virtual_network_rule_name, parameters, custom_headers:nil)
1067
+ create_or_update_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, parameters, custom_headers:custom_headers).value!
1068
+ end
1069
+
1070
+ #
1071
+ # Creates or updates an VirtualNetworkRule for a Namespace.
1072
+ #
1073
+ # @param resource_group_name [String] Name of the resource group within the
1074
+ # Azure subscription.
1075
+ # @param namespace_name [String] The Namespace name
1076
+ # @param virtual_network_rule_name [String] The Virtual Network Rule name.
1077
+ # @param parameters [VirtualNetworkRule] The Namespace VirtualNetworkRule.
1078
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1079
+ # to the HTTP request.
1080
+ #
1081
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1082
+ #
1083
+ def create_or_update_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, parameters, custom_headers:nil)
1084
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1085
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1086
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1087
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
1088
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
1089
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
1090
+ fail ArgumentError, 'virtual_network_rule_name is nil' if virtual_network_rule_name.nil?
1091
+ fail ArgumentError, "'virtual_network_rule_name' should satisfy the constraint - 'MinLength': '1'" if !virtual_network_rule_name.nil? && virtual_network_rule_name.length < 1
1092
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1093
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1094
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1095
+
1096
+
1097
+ request_headers = {}
1098
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1099
+
1100
+ # Set Headers
1101
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1102
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1103
+
1104
+ # Serialize Request
1105
+ request_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::VirtualNetworkRule.mapper()
1106
+ request_content = @client.serialize(request_mapper, parameters)
1107
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1108
+
1109
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'
1110
+
1111
+ request_url = @base_url || @client.base_url
1112
+
1113
+ options = {
1114
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1115
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'virtualNetworkRuleName' => virtual_network_rule_name,'subscriptionId' => @client.subscription_id},
1116
+ query_params: {'api-version' => @client.api_version},
1117
+ body: request_content,
1118
+ headers: request_headers.merge(custom_headers || {}),
1119
+ base_url: request_url
1120
+ }
1121
+ promise = @client.make_request_async(:put, path_template, options)
1122
+
1123
+ promise = promise.then do |result|
1124
+ http_response = result.response
1125
+ status_code = http_response.status
1126
+ response_content = http_response.body
1127
+ unless status_code == 200
1128
+ error_model = JSON.load(response_content)
1129
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1130
+ end
1131
+
1132
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1133
+ # Deserialize Response
1134
+ if status_code == 200
1135
+ begin
1136
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1137
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::VirtualNetworkRule.mapper()
1138
+ result.body = @client.deserialize(result_mapper, parsed_response)
1139
+ rescue Exception => e
1140
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1141
+ end
1142
+ end
1143
+
1144
+ result
1145
+ end
1146
+
1147
+ promise.execute
1148
+ end
1149
+
1150
+ #
1151
+ # Deletes an VirtualNetworkRule for a Namespace.
1152
+ #
1153
+ # @param resource_group_name [String] Name of the resource group within the
1154
+ # Azure subscription.
1155
+ # @param namespace_name [String] The Namespace name
1156
+ # @param virtual_network_rule_name [String] The Virtual Network Rule name.
1157
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1158
+ # will be added to the HTTP request.
1159
+ #
1160
+ #
1161
+ def delete_virtual_network_rule(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:nil)
1162
+ response = delete_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:custom_headers).value!
1163
+ nil
1164
+ end
1165
+
1166
+ #
1167
+ # Deletes an VirtualNetworkRule for a Namespace.
1168
+ #
1169
+ # @param resource_group_name [String] Name of the resource group within the
1170
+ # Azure subscription.
1171
+ # @param namespace_name [String] The Namespace name
1172
+ # @param virtual_network_rule_name [String] The Virtual Network Rule name.
1173
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1174
+ # will be added to the HTTP request.
1175
+ #
1176
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1177
+ #
1178
+ def delete_virtual_network_rule_with_http_info(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:nil)
1179
+ delete_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:custom_headers).value!
1180
+ end
1181
+
1182
+ #
1183
+ # Deletes an VirtualNetworkRule for a Namespace.
1184
+ #
1185
+ # @param resource_group_name [String] Name of the resource group within the
1186
+ # Azure subscription.
1187
+ # @param namespace_name [String] The Namespace name
1188
+ # @param virtual_network_rule_name [String] The Virtual Network Rule name.
1189
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1190
+ # to the HTTP request.
1191
+ #
1192
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1193
+ #
1194
+ def delete_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:nil)
1195
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1196
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1197
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1198
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
1199
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
1200
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
1201
+ fail ArgumentError, 'virtual_network_rule_name is nil' if virtual_network_rule_name.nil?
1202
+ fail ArgumentError, "'virtual_network_rule_name' should satisfy the constraint - 'MinLength': '1'" if !virtual_network_rule_name.nil? && virtual_network_rule_name.length < 1
1203
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1204
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1205
+
1206
+
1207
+ request_headers = {}
1208
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1209
+
1210
+ # Set Headers
1211
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1212
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1213
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'
1214
+
1215
+ request_url = @base_url || @client.base_url
1216
+
1217
+ options = {
1218
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1219
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'virtualNetworkRuleName' => virtual_network_rule_name,'subscriptionId' => @client.subscription_id},
1220
+ query_params: {'api-version' => @client.api_version},
1221
+ headers: request_headers.merge(custom_headers || {}),
1222
+ base_url: request_url
1223
+ }
1224
+ promise = @client.make_request_async(:delete, path_template, options)
1225
+
1226
+ promise = promise.then do |result|
1227
+ http_response = result.response
1228
+ status_code = http_response.status
1229
+ response_content = http_response.body
1230
+ unless status_code == 204 || status_code == 200
1231
+ error_model = JSON.load(response_content)
1232
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1233
+ end
1234
+
1235
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1236
+
1237
+ result
1238
+ end
1239
+
1240
+ promise.execute
1241
+ end
1242
+
1243
+ #
1244
+ # Gets an VirtualNetworkRule for a Namespace by rule name.
1245
+ #
1246
+ # @param resource_group_name [String] Name of the resource group within the
1247
+ # Azure subscription.
1248
+ # @param namespace_name [String] The Namespace name
1249
+ # @param virtual_network_rule_name [String] The Virtual Network Rule name.
1250
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1251
+ # will be added to the HTTP request.
1252
+ #
1253
+ # @return [VirtualNetworkRule] operation results.
1254
+ #
1255
+ def get_virtual_network_rule(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:nil)
1256
+ response = get_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:custom_headers).value!
1257
+ response.body unless response.nil?
1258
+ end
1259
+
1260
+ #
1261
+ # Gets an VirtualNetworkRule for a Namespace by rule name.
1262
+ #
1263
+ # @param resource_group_name [String] Name of the resource group within the
1264
+ # Azure subscription.
1265
+ # @param namespace_name [String] The Namespace name
1266
+ # @param virtual_network_rule_name [String] The Virtual Network Rule name.
1267
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1268
+ # will be added to the HTTP request.
1269
+ #
1270
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1271
+ #
1272
+ def get_virtual_network_rule_with_http_info(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:nil)
1273
+ get_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:custom_headers).value!
1274
+ end
1275
+
1276
+ #
1277
+ # Gets an VirtualNetworkRule for a Namespace by rule name.
1278
+ #
1279
+ # @param resource_group_name [String] Name of the resource group within the
1280
+ # Azure subscription.
1281
+ # @param namespace_name [String] The Namespace name
1282
+ # @param virtual_network_rule_name [String] The Virtual Network Rule name.
1283
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1284
+ # to the HTTP request.
1285
+ #
1286
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1287
+ #
1288
+ def get_virtual_network_rule_async(resource_group_name, namespace_name, virtual_network_rule_name, custom_headers:nil)
1289
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1290
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1291
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1292
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
1293
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
1294
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
1295
+ fail ArgumentError, 'virtual_network_rule_name is nil' if virtual_network_rule_name.nil?
1296
+ fail ArgumentError, "'virtual_network_rule_name' should satisfy the constraint - 'MinLength': '1'" if !virtual_network_rule_name.nil? && virtual_network_rule_name.length < 1
1297
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1298
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1299
+
1300
+
1301
+ request_headers = {}
1302
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1303
+
1304
+ # Set Headers
1305
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1306
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1307
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}'
1308
+
1309
+ request_url = @base_url || @client.base_url
1310
+
1311
+ options = {
1312
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1313
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'virtualNetworkRuleName' => virtual_network_rule_name,'subscriptionId' => @client.subscription_id},
1314
+ query_params: {'api-version' => @client.api_version},
1315
+ headers: request_headers.merge(custom_headers || {}),
1316
+ base_url: request_url
1317
+ }
1318
+ promise = @client.make_request_async(:get, path_template, options)
1319
+
1320
+ promise = promise.then do |result|
1321
+ http_response = result.response
1322
+ status_code = http_response.status
1323
+ response_content = http_response.body
1324
+ unless status_code == 200
1325
+ error_model = JSON.load(response_content)
1326
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1327
+ end
1328
+
1329
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1330
+ # Deserialize Response
1331
+ if status_code == 200
1332
+ begin
1333
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1334
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::VirtualNetworkRule.mapper()
1335
+ result.body = @client.deserialize(result_mapper, parsed_response)
1336
+ rescue Exception => e
1337
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1338
+ end
1339
+ end
1340
+
1341
+ result
1342
+ end
1343
+
1344
+ promise.execute
1345
+ end
1346
+
1347
+ #
1348
+ # Creates or updates a namespace. Once created, this namespace's resource
1349
+ # manifest is immutable. This operation is idempotent.
1350
+ #
1351
+ # @param resource_group_name [String] Name of the resource group within the
1352
+ # Azure subscription.
1353
+ # @param namespace_name [String] The Namespace name
1354
+ # @param parameters [EHNamespace] Parameters for creating a namespace resource.
1355
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1356
+ # will be added to the HTTP request.
1357
+ #
1358
+ # @return [EHNamespace] operation results.
1359
+ #
1360
+ def begin_create_or_update(resource_group_name, namespace_name, parameters, custom_headers:nil)
1361
+ response = begin_create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
1362
+ response.body unless response.nil?
1363
+ end
1364
+
1365
+ #
1366
+ # Creates or updates a namespace. Once created, this namespace's resource
1367
+ # manifest is immutable. This operation is idempotent.
1368
+ #
1369
+ # @param resource_group_name [String] Name of the resource group within the
1370
+ # Azure subscription.
1371
+ # @param namespace_name [String] The Namespace name
1372
+ # @param parameters [EHNamespace] Parameters for creating a namespace resource.
1373
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1374
+ # will be added to the HTTP request.
1375
+ #
1376
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1377
+ #
1378
+ def begin_create_or_update_with_http_info(resource_group_name, namespace_name, parameters, custom_headers:nil)
1379
+ begin_create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
1380
+ end
1381
+
1382
+ #
1383
+ # Creates or updates a namespace. Once created, this namespace's resource
1384
+ # manifest is immutable. This operation is idempotent.
1385
+ #
1386
+ # @param resource_group_name [String] Name of the resource group within the
1387
+ # Azure subscription.
1388
+ # @param namespace_name [String] The Namespace name
1389
+ # @param parameters [EHNamespace] Parameters for creating a namespace resource.
1390
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1391
+ # to the HTTP request.
1392
+ #
1393
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1394
+ #
1395
+ def begin_create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers:nil)
1396
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1397
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1398
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1399
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
1400
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
1401
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
1402
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1403
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1404
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1405
+
1406
+
1407
+ request_headers = {}
1408
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1409
+
1410
+ # Set Headers
1411
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1412
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1413
+
1414
+ # Serialize Request
1415
+ request_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespace.mapper()
1416
+ request_content = @client.serialize(request_mapper, parameters)
1417
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1418
+
1419
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'
1420
+
1421
+ request_url = @base_url || @client.base_url
1422
+
1423
+ options = {
1424
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1425
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'subscriptionId' => @client.subscription_id},
1426
+ query_params: {'api-version' => @client.api_version},
1427
+ body: request_content,
1428
+ headers: request_headers.merge(custom_headers || {}),
1429
+ base_url: request_url
1430
+ }
1431
+ promise = @client.make_request_async(:put, path_template, options)
1432
+
1433
+ promise = promise.then do |result|
1434
+ http_response = result.response
1435
+ status_code = http_response.status
1436
+ response_content = http_response.body
1437
+ unless status_code == 201 || status_code == 200 || status_code == 202
1438
+ error_model = JSON.load(response_content)
1439
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1440
+ end
1441
+
1442
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1443
+ # Deserialize Response
1444
+ if status_code == 201
1445
+ begin
1446
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1447
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespace.mapper()
1448
+ result.body = @client.deserialize(result_mapper, parsed_response)
1449
+ rescue Exception => e
1450
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1451
+ end
1452
+ end
1453
+ # Deserialize Response
1454
+ if status_code == 200
1455
+ begin
1456
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1457
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespace.mapper()
1458
+ result.body = @client.deserialize(result_mapper, parsed_response)
1459
+ rescue Exception => e
1460
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1461
+ end
1462
+ end
1463
+
1464
+ result
1465
+ end
1466
+
1467
+ promise.execute
1468
+ end
1469
+
1470
+ #
1471
+ # Deletes an existing namespace. This operation also removes all associated
1472
+ # resources under the namespace.
1473
+ #
1474
+ # @param resource_group_name [String] Name of the resource group within the
1475
+ # Azure subscription.
1476
+ # @param namespace_name [String] The Namespace name
1477
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1478
+ # will be added to the HTTP request.
1479
+ #
1480
+ #
1481
+ def begin_delete(resource_group_name, namespace_name, custom_headers:nil)
1482
+ response = begin_delete_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
1483
+ nil
1484
+ end
1485
+
1486
+ #
1487
+ # Deletes an existing namespace. This operation also removes all associated
1488
+ # resources under the namespace.
1489
+ #
1490
+ # @param resource_group_name [String] Name of the resource group within the
1491
+ # Azure subscription.
1492
+ # @param namespace_name [String] The Namespace name
1493
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1494
+ # will be added to the HTTP request.
1495
+ #
1496
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1497
+ #
1498
+ def begin_delete_with_http_info(resource_group_name, namespace_name, custom_headers:nil)
1499
+ begin_delete_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
1500
+ end
1501
+
1502
+ #
1503
+ # Deletes an existing namespace. This operation also removes all associated
1504
+ # resources under the namespace.
1505
+ #
1506
+ # @param resource_group_name [String] Name of the resource group within the
1507
+ # Azure subscription.
1508
+ # @param namespace_name [String] The Namespace name
1509
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1510
+ # to the HTTP request.
1511
+ #
1512
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1513
+ #
1514
+ def begin_delete_async(resource_group_name, namespace_name, custom_headers:nil)
1515
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1516
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1517
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1518
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
1519
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MaxLength': '50'" if !namespace_name.nil? && namespace_name.length > 50
1520
+ fail ArgumentError, "'namespace_name' should satisfy the constraint - 'MinLength': '6'" if !namespace_name.nil? && namespace_name.length < 6
1521
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1522
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1523
+
1524
+
1525
+ request_headers = {}
1526
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1527
+
1528
+ # Set Headers
1529
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1530
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1531
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}'
1532
+
1533
+ request_url = @base_url || @client.base_url
1534
+
1535
+ options = {
1536
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1537
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'subscriptionId' => @client.subscription_id},
1538
+ query_params: {'api-version' => @client.api_version},
1539
+ headers: request_headers.merge(custom_headers || {}),
1540
+ base_url: request_url
1541
+ }
1542
+ promise = @client.make_request_async(:delete, path_template, options)
1543
+
1544
+ promise = promise.then do |result|
1545
+ http_response = result.response
1546
+ status_code = http_response.status
1547
+ response_content = http_response.body
1548
+ unless status_code == 204 || status_code == 200 || status_code == 202
1549
+ error_model = JSON.load(response_content)
1550
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1551
+ end
1552
+
1553
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1554
+
1555
+ result
1556
+ end
1557
+
1558
+ promise.execute
1559
+ end
1560
+
1561
+ #
1562
+ # Lists all the available Namespaces within a subscription, irrespective of the
1563
+ # resource groups.
1564
+ #
1565
+ # @param next_page_link [String] The NextLink from the previous successful call
1566
+ # to List operation.
1567
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1568
+ # will be added to the HTTP request.
1569
+ #
1570
+ # @return [EHNamespaceListResult] operation results.
1571
+ #
1572
+ def list_next(next_page_link, custom_headers:nil)
1573
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
1574
+ response.body unless response.nil?
1575
+ end
1576
+
1577
+ #
1578
+ # Lists all the available Namespaces within a subscription, irrespective of the
1579
+ # resource groups.
1580
+ #
1581
+ # @param next_page_link [String] The NextLink from the previous successful call
1582
+ # to List operation.
1583
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1584
+ # will be added to the HTTP request.
1585
+ #
1586
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1587
+ #
1588
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
1589
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
1590
+ end
1591
+
1592
+ #
1593
+ # Lists all the available Namespaces within a subscription, irrespective of the
1594
+ # resource groups.
1595
+ #
1596
+ # @param next_page_link [String] The NextLink from the previous successful call
1597
+ # to List operation.
1598
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1599
+ # to the HTTP request.
1600
+ #
1601
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1602
+ #
1603
+ def list_next_async(next_page_link, custom_headers:nil)
1604
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1605
+
1606
+
1607
+ request_headers = {}
1608
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1609
+
1610
+ # Set Headers
1611
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1612
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1613
+ path_template = '{nextLink}'
1614
+
1615
+ request_url = @base_url || @client.base_url
1616
+
1617
+ options = {
1618
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1619
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1620
+ headers: request_headers.merge(custom_headers || {}),
1621
+ base_url: request_url
1622
+ }
1623
+ promise = @client.make_request_async(:get, path_template, options)
1624
+
1625
+ promise = promise.then do |result|
1626
+ http_response = result.response
1627
+ status_code = http_response.status
1628
+ response_content = http_response.body
1629
+ unless status_code == 200
1630
+ error_model = JSON.load(response_content)
1631
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1632
+ end
1633
+
1634
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1635
+ # Deserialize Response
1636
+ if status_code == 200
1637
+ begin
1638
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1639
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespaceListResult.mapper()
1640
+ result.body = @client.deserialize(result_mapper, parsed_response)
1641
+ rescue Exception => e
1642
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1643
+ end
1644
+ end
1645
+
1646
+ result
1647
+ end
1648
+
1649
+ promise.execute
1650
+ end
1651
+
1652
+ #
1653
+ # Lists the available Namespaces within a resource group.
1654
+ #
1655
+ # @param next_page_link [String] The NextLink from the previous successful call
1656
+ # to List operation.
1657
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1658
+ # will be added to the HTTP request.
1659
+ #
1660
+ # @return [EHNamespaceListResult] operation results.
1661
+ #
1662
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
1663
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1664
+ response.body unless response.nil?
1665
+ end
1666
+
1667
+ #
1668
+ # Lists the available Namespaces within a resource group.
1669
+ #
1670
+ # @param next_page_link [String] The NextLink from the previous successful call
1671
+ # to List operation.
1672
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1673
+ # will be added to the HTTP request.
1674
+ #
1675
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1676
+ #
1677
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
1678
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1679
+ end
1680
+
1681
+ #
1682
+ # Lists the available Namespaces within a resource group.
1683
+ #
1684
+ # @param next_page_link [String] The NextLink from the previous successful call
1685
+ # to List operation.
1686
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1687
+ # to the HTTP request.
1688
+ #
1689
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1690
+ #
1691
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
1692
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1693
+
1694
+
1695
+ request_headers = {}
1696
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1697
+
1698
+ # Set Headers
1699
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1700
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1701
+ path_template = '{nextLink}'
1702
+
1703
+ request_url = @base_url || @client.base_url
1704
+
1705
+ options = {
1706
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1707
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1708
+ headers: request_headers.merge(custom_headers || {}),
1709
+ base_url: request_url
1710
+ }
1711
+ promise = @client.make_request_async(:get, path_template, options)
1712
+
1713
+ promise = promise.then do |result|
1714
+ http_response = result.response
1715
+ status_code = http_response.status
1716
+ response_content = http_response.body
1717
+ unless status_code == 200
1718
+ error_model = JSON.load(response_content)
1719
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1720
+ end
1721
+
1722
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1723
+ # Deserialize Response
1724
+ if status_code == 200
1725
+ begin
1726
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1727
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespaceListResult.mapper()
1728
+ result.body = @client.deserialize(result_mapper, parsed_response)
1729
+ rescue Exception => e
1730
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1731
+ end
1732
+ end
1733
+
1734
+ result
1735
+ end
1736
+
1737
+ promise.execute
1738
+ end
1739
+
1740
+ #
1741
+ # Gets a list of IP Filter rules for a Namespace.
1742
+ #
1743
+ # @param next_page_link [String] The NextLink from the previous successful call
1744
+ # to List operation.
1745
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1746
+ # will be added to the HTTP request.
1747
+ #
1748
+ # @return [IpFilterRuleListResult] operation results.
1749
+ #
1750
+ def list_ipfilter_rules_next(next_page_link, custom_headers:nil)
1751
+ response = list_ipfilter_rules_next_async(next_page_link, custom_headers:custom_headers).value!
1752
+ response.body unless response.nil?
1753
+ end
1754
+
1755
+ #
1756
+ # Gets a list of IP Filter rules for a Namespace.
1757
+ #
1758
+ # @param next_page_link [String] The NextLink from the previous successful call
1759
+ # to List operation.
1760
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1761
+ # will be added to the HTTP request.
1762
+ #
1763
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1764
+ #
1765
+ def list_ipfilter_rules_next_with_http_info(next_page_link, custom_headers:nil)
1766
+ list_ipfilter_rules_next_async(next_page_link, custom_headers:custom_headers).value!
1767
+ end
1768
+
1769
+ #
1770
+ # Gets a list of IP Filter rules for a Namespace.
1771
+ #
1772
+ # @param next_page_link [String] The NextLink from the previous successful call
1773
+ # to List operation.
1774
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1775
+ # to the HTTP request.
1776
+ #
1777
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1778
+ #
1779
+ def list_ipfilter_rules_next_async(next_page_link, custom_headers:nil)
1780
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1781
+
1782
+
1783
+ request_headers = {}
1784
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1785
+
1786
+ # Set Headers
1787
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1788
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1789
+ path_template = '{nextLink}'
1790
+
1791
+ request_url = @base_url || @client.base_url
1792
+
1793
+ options = {
1794
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1795
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1796
+ headers: request_headers.merge(custom_headers || {}),
1797
+ base_url: request_url
1798
+ }
1799
+ promise = @client.make_request_async(:get, path_template, options)
1800
+
1801
+ promise = promise.then do |result|
1802
+ http_response = result.response
1803
+ status_code = http_response.status
1804
+ response_content = http_response.body
1805
+ unless status_code == 200
1806
+ error_model = JSON.load(response_content)
1807
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1808
+ end
1809
+
1810
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1811
+ # Deserialize Response
1812
+ if status_code == 200
1813
+ begin
1814
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1815
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::IpFilterRuleListResult.mapper()
1816
+ result.body = @client.deserialize(result_mapper, parsed_response)
1817
+ rescue Exception => e
1818
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1819
+ end
1820
+ end
1821
+
1822
+ result
1823
+ end
1824
+
1825
+ promise.execute
1826
+ end
1827
+
1828
+ #
1829
+ # Gets a list of VirtualNetwork rules for a Namespace.
1830
+ #
1831
+ # @param next_page_link [String] The NextLink from the previous successful call
1832
+ # to List operation.
1833
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1834
+ # will be added to the HTTP request.
1835
+ #
1836
+ # @return [VirtualNetworkRuleListResult] operation results.
1837
+ #
1838
+ def list_virtual_network_rules_next(next_page_link, custom_headers:nil)
1839
+ response = list_virtual_network_rules_next_async(next_page_link, custom_headers:custom_headers).value!
1840
+ response.body unless response.nil?
1841
+ end
1842
+
1843
+ #
1844
+ # Gets a list of VirtualNetwork rules for a Namespace.
1845
+ #
1846
+ # @param next_page_link [String] The NextLink from the previous successful call
1847
+ # to List operation.
1848
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1849
+ # will be added to the HTTP request.
1850
+ #
1851
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1852
+ #
1853
+ def list_virtual_network_rules_next_with_http_info(next_page_link, custom_headers:nil)
1854
+ list_virtual_network_rules_next_async(next_page_link, custom_headers:custom_headers).value!
1855
+ end
1856
+
1857
+ #
1858
+ # Gets a list of VirtualNetwork rules for a Namespace.
1859
+ #
1860
+ # @param next_page_link [String] The NextLink from the previous successful call
1861
+ # to List operation.
1862
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1863
+ # to the HTTP request.
1864
+ #
1865
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1866
+ #
1867
+ def list_virtual_network_rules_next_async(next_page_link, custom_headers:nil)
1868
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1869
+
1870
+
1871
+ request_headers = {}
1872
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1873
+
1874
+ # Set Headers
1875
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1876
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1877
+ path_template = '{nextLink}'
1878
+
1879
+ request_url = @base_url || @client.base_url
1880
+
1881
+ options = {
1882
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1883
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1884
+ headers: request_headers.merge(custom_headers || {}),
1885
+ base_url: request_url
1886
+ }
1887
+ promise = @client.make_request_async(:get, path_template, options)
1888
+
1889
+ promise = promise.then do |result|
1890
+ http_response = result.response
1891
+ status_code = http_response.status
1892
+ response_content = http_response.body
1893
+ unless status_code == 200
1894
+ error_model = JSON.load(response_content)
1895
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1896
+ end
1897
+
1898
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1899
+ # Deserialize Response
1900
+ if status_code == 200
1901
+ begin
1902
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1903
+ result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::VirtualNetworkRuleListResult.mapper()
1904
+ result.body = @client.deserialize(result_mapper, parsed_response)
1905
+ rescue Exception => e
1906
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1907
+ end
1908
+ end
1909
+
1910
+ result
1911
+ end
1912
+
1913
+ promise.execute
1914
+ end
1915
+
1916
+ #
1917
+ # Lists all the available Namespaces within a subscription, irrespective of the
1918
+ # resource groups.
1919
+ #
1920
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1921
+ # will be added to the HTTP request.
1922
+ #
1923
+ # @return [EHNamespaceListResult] which provide lazy access to pages of the
1924
+ # response.
1925
+ #
1926
+ def list_as_lazy(custom_headers:nil)
1927
+ response = list_async(custom_headers:custom_headers).value!
1928
+ unless response.nil?
1929
+ page = response.body
1930
+ page.next_method = Proc.new do |next_page_link|
1931
+ list_next_async(next_page_link, custom_headers:custom_headers)
1932
+ end
1933
+ page
1934
+ end
1935
+ end
1936
+
1937
+ #
1938
+ # Lists the available Namespaces within a resource group.
1939
+ #
1940
+ # @param resource_group_name [String] Name of the resource group within the
1941
+ # Azure subscription.
1942
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1943
+ # will be added to the HTTP request.
1944
+ #
1945
+ # @return [EHNamespaceListResult] which provide lazy access to pages of the
1946
+ # response.
1947
+ #
1948
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
1949
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
1950
+ unless response.nil?
1951
+ page = response.body
1952
+ page.next_method = Proc.new do |next_page_link|
1953
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
1954
+ end
1955
+ page
1956
+ end
1957
+ end
1958
+
1959
+ #
1960
+ # Gets a list of IP Filter rules for a Namespace.
1961
+ #
1962
+ # @param resource_group_name [String] Name of the resource group within the
1963
+ # Azure subscription.
1964
+ # @param namespace_name [String] The Namespace name
1965
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1966
+ # will be added to the HTTP request.
1967
+ #
1968
+ # @return [IpFilterRuleListResult] which provide lazy access to pages of the
1969
+ # response.
1970
+ #
1971
+ def list_ipfilter_rules_as_lazy(resource_group_name, namespace_name, custom_headers:nil)
1972
+ response = list_ipfilter_rules_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
1973
+ unless response.nil?
1974
+ page = response.body
1975
+ page.next_method = Proc.new do |next_page_link|
1976
+ list_ipfilter_rules_next_async(next_page_link, custom_headers:custom_headers)
1977
+ end
1978
+ page
1979
+ end
1980
+ end
1981
+
1982
+ #
1983
+ # Gets a list of VirtualNetwork rules for a Namespace.
1984
+ #
1985
+ # @param resource_group_name [String] Name of the resource group within the
1986
+ # Azure subscription.
1987
+ # @param namespace_name [String] The Namespace name
1988
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1989
+ # will be added to the HTTP request.
1990
+ #
1991
+ # @return [VirtualNetworkRuleListResult] which provide lazy access to pages of
1992
+ # the response.
1993
+ #
1994
+ def list_virtual_network_rules_as_lazy(resource_group_name, namespace_name, custom_headers:nil)
1995
+ response = list_virtual_network_rules_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
1996
+ unless response.nil?
1997
+ page = response.body
1998
+ page.next_method = Proc.new do |next_page_link|
1999
+ list_virtual_network_rules_next_async(next_page_link, custom_headers:custom_headers)
2000
+ end
2001
+ page
2002
+ end
2003
+ end
2004
+
2005
+ end
2006
+ end