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