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