azure_mgmt_event_hub 0.14.0 → 0.15.0

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