azure_mgmt_event_hub 0.8.0

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