azure_mgmt_relay 0.14.0

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