azure_mgmt_relay 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2016-07-01/generated/azure_mgmt_relay.rb +55 -0
  3. data/lib/2016-07-01/generated/azure_mgmt_relay/hybrid_connections.rb +1269 -0
  4. data/lib/{generated → 2016-07-01/generated}/azure_mgmt_relay/models/access_rights.rb +1 -1
  5. data/lib/2016-07-01/generated/azure_mgmt_relay/models/authorization_rule.rb +78 -0
  6. data/lib/2016-07-01/generated/azure_mgmt_relay/models/authorization_rule_keys.rb +88 -0
  7. data/lib/2016-07-01/generated/azure_mgmt_relay/models/authorization_rule_list_result.rb +96 -0
  8. data/lib/2016-07-01/generated/azure_mgmt_relay/models/check_name_availability.rb +47 -0
  9. data/lib/2016-07-01/generated/azure_mgmt_relay/models/check_name_availability_result.rb +71 -0
  10. data/lib/{generated → 2016-07-01/generated}/azure_mgmt_relay/models/error_response.rb +1 -1
  11. data/lib/2016-07-01/generated/azure_mgmt_relay/models/hybrid_connection.rb +120 -0
  12. data/lib/2016-07-01/generated/azure_mgmt_relay/models/hybrid_connection_list_result.rb +95 -0
  13. data/lib/2016-07-01/generated/azure_mgmt_relay/models/operation.rb +56 -0
  14. data/lib/2016-07-01/generated/azure_mgmt_relay/models/operation_display.rb +68 -0
  15. data/lib/2016-07-01/generated/azure_mgmt_relay/models/operation_list_result.rb +99 -0
  16. data/lib/2016-07-01/generated/azure_mgmt_relay/models/policy_key.rb +16 -0
  17. data/lib/2016-07-01/generated/azure_mgmt_relay/models/regenerate_keys_parameters.rb +45 -0
  18. data/lib/2016-07-01/generated/azure_mgmt_relay/models/relay_namespace.rb +148 -0
  19. data/lib/2016-07-01/generated/azure_mgmt_relay/models/relay_namespace_list_result.rb +95 -0
  20. data/lib/2016-07-01/generated/azure_mgmt_relay/models/relay_namespace_update_parameter.rb +64 -0
  21. data/lib/{generated → 2016-07-01/generated}/azure_mgmt_relay/models/relaytype.rb +1 -1
  22. data/lib/2016-07-01/generated/azure_mgmt_relay/models/resource.rb +67 -0
  23. data/lib/2016-07-01/generated/azure_mgmt_relay/models/sku.rb +59 -0
  24. data/lib/2016-07-01/generated/azure_mgmt_relay/models/tracked_resource.rb +85 -0
  25. data/lib/{generated → 2016-07-01/generated}/azure_mgmt_relay/models/unavailable_reason.rb +1 -1
  26. data/lib/2016-07-01/generated/azure_mgmt_relay/models/wcf_relay.rb +149 -0
  27. data/lib/2016-07-01/generated/azure_mgmt_relay/models/wcf_relays_list_result.rb +95 -0
  28. data/lib/2016-07-01/generated/azure_mgmt_relay/module_definition.rb +9 -0
  29. data/lib/2016-07-01/generated/azure_mgmt_relay/namespaces.rb +1725 -0
  30. data/lib/2016-07-01/generated/azure_mgmt_relay/operations.rb +214 -0
  31. data/lib/2016-07-01/generated/azure_mgmt_relay/relay_management_client.rb +143 -0
  32. data/lib/{generated → 2016-07-01/generated}/azure_mgmt_relay/version.rb +2 -2
  33. data/lib/2016-07-01/generated/azure_mgmt_relay/wcfrelays.rb +1263 -0
  34. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay.rb +34 -34
  35. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/hybrid_connections.rb +14 -14
  36. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/access_keys.rb +1 -1
  37. data/lib/2017-04-01/generated/azure_mgmt_relay/models/access_rights.rb +17 -0
  38. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/authorization_rule.rb +1 -1
  39. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/authorization_rule_list_result.rb +1 -1
  40. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/check_name_availability.rb +1 -1
  41. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/check_name_availability_result.rb +1 -1
  42. data/lib/2017-04-01/generated/azure_mgmt_relay/models/error_response.rb +55 -0
  43. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/hybrid_connection.rb +1 -1
  44. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/hybrid_connection_list_result.rb +1 -1
  45. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/key_type.rb +1 -1
  46. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/operation.rb +1 -1
  47. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/operation_display.rb +1 -1
  48. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/operation_list_result.rb +1 -1
  49. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/provisioning_state_enum.rb +1 -1
  50. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/regenerate_access_key_parameters.rb +1 -1
  51. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/relay_namespace.rb +1 -1
  52. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/relay_namespace_list_result.rb +1 -1
  53. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/relay_update_parameters.rb +1 -1
  54. data/lib/2017-04-01/generated/azure_mgmt_relay/models/relaytype.rb +16 -0
  55. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/resource.rb +1 -1
  56. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/resource_namespace_patch.rb +1 -1
  57. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/sku.rb +1 -1
  58. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/sku_tier.rb +1 -1
  59. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/tracked_resource.rb +1 -1
  60. data/lib/2017-04-01/generated/azure_mgmt_relay/models/unavailable_reason.rb +20 -0
  61. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/wcf_relay.rb +1 -1
  62. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/models/wcf_relays_list_result.rb +1 -1
  63. data/lib/2017-04-01/generated/azure_mgmt_relay/module_definition.rb +9 -0
  64. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/namespaces.rb +23 -23
  65. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/operations.rb +3 -3
  66. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/relay_management_client.rb +3 -3
  67. data/lib/{generated/azure_mgmt_relay/module_definition.rb → 2017-04-01/generated/azure_mgmt_relay/version.rb} +3 -3
  68. data/lib/{generated → 2017-04-01/generated}/azure_mgmt_relay/wcfrelays.rb +14 -14
  69. data/lib/azure_mgmt_relay.rb +3 -4
  70. data/lib/module_definition.rb +7 -0
  71. data/lib/profiles/common/configurable.rb +73 -0
  72. data/lib/profiles/common/default.rb +68 -0
  73. data/lib/profiles/latest/modules/relay_profile_module.rb +156 -0
  74. data/lib/profiles/latest/relay_latest_profile_client.rb +33 -0
  75. data/lib/profiles/latest/relay_module_definition.rb +9 -0
  76. data/lib/version.rb +7 -0
  77. metadata +76 -37
@@ -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::Relay::Mgmt::V2016_07_01
7
+ module Models
8
+ #
9
+ # The response of the List WcfRelays operation.
10
+ #
11
+ class WcfRelaysListResult
12
+
13
+ include MsRestAzure
14
+
15
+ include MsRest::JSONable
16
+ # @return [Array<WcfRelay>] Result of the List WcfRelays .
17
+ attr_accessor :value
18
+
19
+ # @return [String] Link to the next set of results. Not empty if Value
20
+ # contains incomplete list of WcfRelays operation
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,9 @@
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::Relay end
8
+ module Azure::Relay::Mgmt end
9
+ module Azure::Relay::Mgmt::V2016_07_01 end
@@ -0,0 +1,1725 @@
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::Relay::Mgmt::V2016_07_01
7
+ #
8
+ # Use these API to manage Azure Relay resources through Azure Resources
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 give namespace name availability.
27
+ #
28
+ # @param parameters [CheckNameAvailability] Parameters to check availability of
29
+ # the given 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 give namespace name availability.
42
+ #
43
+ # @param parameters [CheckNameAvailability] Parameters to check availability of
44
+ # the given 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 give namespace name availability.
56
+ #
57
+ # @param parameters [CheckNameAvailability] Parameters to check availability of
58
+ # the given 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::Relay::Mgmt::V2016_07_01::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 MsRestAzure::AzureOperationError.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::Relay::Mgmt::V2016_07_01::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 irrespective of
126
+ # the 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 irrespective of
140
+ # the 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 irrespective of
153
+ # the 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::Relay::Mgmt::V2016_07_01::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::Relay::Mgmt::V2016_07_01::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::Relay::Mgmt::V2016_07_01::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::Relay::Mgmt::V2016_07_01::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 [RelayNamespaceUpdateParameter] Parameters for updating a
491
+ # namespace 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 [RelayNamespaceUpdateParameter] Parameters for updating a
510
+ # namespace 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 [RelayNamespaceUpdateParameter] Parameters for updating a
528
+ # namespace 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::Relay::Mgmt::V2016_07_01::Models::RelayNamespaceUpdateParameter.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
574
+ error_model = JSON.load(response_content)
575
+ fail MsRestAzure::AzureOperationError.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::Relay::Mgmt::V2016_07_01::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
+
590
+ result
591
+ end
592
+
593
+ promise.execute
594
+ end
595
+
596
+ #
597
+ # Authorization rules for a namespace.
598
+ #
599
+ # @param resource_group_name [String] Name of the Resource group within the
600
+ # Azure subscription.
601
+ # @param namespace_name [String] The Namespace Name
602
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
603
+ # will be added to the HTTP request.
604
+ #
605
+ # @return [Array<AuthorizationRule>] operation results.
606
+ #
607
+ def list_authorization_rules(resource_group_name, namespace_name, custom_headers = nil)
608
+ first_page = list_authorization_rules_as_lazy(resource_group_name, namespace_name, custom_headers)
609
+ first_page.get_all_items
610
+ end
611
+
612
+ #
613
+ # Authorization rules for a namespace.
614
+ #
615
+ # @param resource_group_name [String] Name of the Resource group within the
616
+ # Azure subscription.
617
+ # @param namespace_name [String] The Namespace Name
618
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
619
+ # will be added to the HTTP request.
620
+ #
621
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
622
+ #
623
+ def list_authorization_rules_with_http_info(resource_group_name, namespace_name, custom_headers = nil)
624
+ list_authorization_rules_async(resource_group_name, namespace_name, custom_headers).value!
625
+ end
626
+
627
+ #
628
+ # Authorization rules for a namespace.
629
+ #
630
+ # @param resource_group_name [String] Name of the Resource group within the
631
+ # Azure subscription.
632
+ # @param namespace_name [String] The Namespace Name
633
+ # @param [Hash{String => String}] A hash of custom headers that will be added
634
+ # to the HTTP request.
635
+ #
636
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
637
+ #
638
+ def list_authorization_rules_async(resource_group_name, namespace_name, custom_headers = nil)
639
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
640
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
641
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
642
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
643
+
644
+
645
+ request_headers = {}
646
+
647
+ # Set Headers
648
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
649
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
650
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules'
651
+
652
+ request_url = @base_url || @client.base_url
653
+
654
+ options = {
655
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
656
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'subscriptionId' => @client.subscription_id},
657
+ query_params: {'api-version' => @client.api_version},
658
+ headers: request_headers.merge(custom_headers || {}),
659
+ base_url: request_url
660
+ }
661
+ promise = @client.make_request_async(:get, path_template, options)
662
+
663
+ promise = promise.then do |result|
664
+ http_response = result.response
665
+ status_code = http_response.status
666
+ response_content = http_response.body
667
+ unless status_code == 200
668
+ error_model = JSON.load(response_content)
669
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
670
+ end
671
+
672
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
673
+ # Deserialize Response
674
+ if status_code == 200
675
+ begin
676
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
677
+ result_mapper = Azure::Relay::Mgmt::V2016_07_01::Models::AuthorizationRuleListResult.mapper()
678
+ result.body = @client.deserialize(result_mapper, parsed_response)
679
+ rescue Exception => e
680
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
681
+ end
682
+ end
683
+
684
+ result
685
+ end
686
+
687
+ promise.execute
688
+ end
689
+
690
+ #
691
+ # Creates or Updates an authorization rule for a namespace
692
+ #
693
+ # @param resource_group_name [String] Name of the Resource group within the
694
+ # Azure subscription.
695
+ # @param namespace_name [String] The Namespace Name
696
+ # @param authorization_rule_name [String] The authorizationRule name.
697
+ # @param parameters [AuthorizationRule] The authorization rule parameters
698
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
699
+ # will be added to the HTTP request.
700
+ #
701
+ # @return [AuthorizationRule] operation results.
702
+ #
703
+ def create_or_update_authorization_rule(resource_group_name, namespace_name, authorization_rule_name, parameters, custom_headers = nil)
704
+ response = create_or_update_authorization_rule_async(resource_group_name, namespace_name, authorization_rule_name, parameters, custom_headers).value!
705
+ response.body unless response.nil?
706
+ end
707
+
708
+ #
709
+ # Creates or Updates an authorization rule for a namespace
710
+ #
711
+ # @param resource_group_name [String] Name of the Resource group within the
712
+ # Azure subscription.
713
+ # @param namespace_name [String] The Namespace Name
714
+ # @param authorization_rule_name [String] The authorizationRule name.
715
+ # @param parameters [AuthorizationRule] The authorization rule parameters
716
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
717
+ # will be added to the HTTP request.
718
+ #
719
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
720
+ #
721
+ def create_or_update_authorization_rule_with_http_info(resource_group_name, namespace_name, authorization_rule_name, parameters, custom_headers = nil)
722
+ create_or_update_authorization_rule_async(resource_group_name, namespace_name, authorization_rule_name, parameters, custom_headers).value!
723
+ end
724
+
725
+ #
726
+ # Creates or Updates an authorization rule for a namespace
727
+ #
728
+ # @param resource_group_name [String] Name of the Resource group within the
729
+ # Azure subscription.
730
+ # @param namespace_name [String] The Namespace Name
731
+ # @param authorization_rule_name [String] The authorizationRule name.
732
+ # @param parameters [AuthorizationRule] The authorization rule parameters
733
+ # @param [Hash{String => String}] A hash of custom headers that will be added
734
+ # to the HTTP request.
735
+ #
736
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
737
+ #
738
+ def create_or_update_authorization_rule_async(resource_group_name, namespace_name, authorization_rule_name, parameters, custom_headers = nil)
739
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
740
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
741
+ fail ArgumentError, 'authorization_rule_name is nil' if authorization_rule_name.nil?
742
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
743
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
744
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
745
+
746
+
747
+ request_headers = {}
748
+
749
+ # Set Headers
750
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
751
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
752
+
753
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
754
+
755
+ # Serialize Request
756
+ request_mapper = Azure::Relay::Mgmt::V2016_07_01::Models::AuthorizationRule.mapper()
757
+ request_content = @client.serialize(request_mapper, parameters)
758
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
759
+
760
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'
761
+
762
+ request_url = @base_url || @client.base_url
763
+
764
+ options = {
765
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
766
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'authorizationRuleName' => authorization_rule_name,'subscriptionId' => @client.subscription_id},
767
+ query_params: {'api-version' => @client.api_version},
768
+ body: request_content,
769
+ headers: request_headers.merge(custom_headers || {}),
770
+ base_url: request_url
771
+ }
772
+ promise = @client.make_request_async(:put, path_template, options)
773
+
774
+ promise = promise.then do |result|
775
+ http_response = result.response
776
+ status_code = http_response.status
777
+ response_content = http_response.body
778
+ unless status_code == 200
779
+ error_model = JSON.load(response_content)
780
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
781
+ end
782
+
783
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
784
+ # Deserialize Response
785
+ if status_code == 200
786
+ begin
787
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
788
+ result_mapper = Azure::Relay::Mgmt::V2016_07_01::Models::AuthorizationRule.mapper()
789
+ result.body = @client.deserialize(result_mapper, parsed_response)
790
+ rescue Exception => e
791
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
792
+ end
793
+ end
794
+
795
+ result
796
+ end
797
+
798
+ promise.execute
799
+ end
800
+
801
+ #
802
+ # Deletes a namespace authorization rule
803
+ #
804
+ # @param resource_group_name [String] Name of the Resource group within the
805
+ # Azure subscription.
806
+ # @param namespace_name [String] The Namespace Name
807
+ # @param authorization_rule_name [String] The authorizationRule name.
808
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
809
+ # will be added to the HTTP request.
810
+ #
811
+ #
812
+ def delete_authorization_rule(resource_group_name, namespace_name, authorization_rule_name, custom_headers = nil)
813
+ response = delete_authorization_rule_async(resource_group_name, namespace_name, authorization_rule_name, custom_headers).value!
814
+ nil
815
+ end
816
+
817
+ #
818
+ # Deletes a namespace authorization rule
819
+ #
820
+ # @param resource_group_name [String] Name of the Resource group within the
821
+ # Azure subscription.
822
+ # @param namespace_name [String] The Namespace Name
823
+ # @param authorization_rule_name [String] The authorizationRule name.
824
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
825
+ # will be added to the HTTP request.
826
+ #
827
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
828
+ #
829
+ def delete_authorization_rule_with_http_info(resource_group_name, namespace_name, authorization_rule_name, custom_headers = nil)
830
+ delete_authorization_rule_async(resource_group_name, namespace_name, authorization_rule_name, custom_headers).value!
831
+ end
832
+
833
+ #
834
+ # Deletes a namespace authorization rule
835
+ #
836
+ # @param resource_group_name [String] Name of the Resource group within the
837
+ # Azure subscription.
838
+ # @param namespace_name [String] The Namespace Name
839
+ # @param authorization_rule_name [String] The authorizationRule name.
840
+ # @param [Hash{String => String}] A hash of custom headers that will be added
841
+ # to the HTTP request.
842
+ #
843
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
844
+ #
845
+ def delete_authorization_rule_async(resource_group_name, namespace_name, authorization_rule_name, custom_headers = nil)
846
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
847
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
848
+ fail ArgumentError, 'authorization_rule_name is nil' if authorization_rule_name.nil?
849
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
850
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
851
+
852
+
853
+ request_headers = {}
854
+
855
+ # Set Headers
856
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
857
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
858
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'
859
+
860
+ request_url = @base_url || @client.base_url
861
+
862
+ options = {
863
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
864
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'authorizationRuleName' => authorization_rule_name,'subscriptionId' => @client.subscription_id},
865
+ query_params: {'api-version' => @client.api_version},
866
+ headers: request_headers.merge(custom_headers || {}),
867
+ base_url: request_url
868
+ }
869
+ promise = @client.make_request_async(:delete, path_template, options)
870
+
871
+ promise = promise.then do |result|
872
+ http_response = result.response
873
+ status_code = http_response.status
874
+ response_content = http_response.body
875
+ unless status_code == 200 || status_code == 204
876
+ error_model = JSON.load(response_content)
877
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
878
+ end
879
+
880
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
881
+
882
+ result
883
+ end
884
+
885
+ promise.execute
886
+ end
887
+
888
+ #
889
+ # Authorization rule for a namespace by name.
890
+ #
891
+ # @param resource_group_name [String] Name of the Resource group within the
892
+ # Azure subscription.
893
+ # @param namespace_name [String] The Namespace Name
894
+ # @param authorization_rule_name [String] The authorizationRule name.
895
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
896
+ # will be added to the HTTP request.
897
+ #
898
+ # @return [AuthorizationRule] operation results.
899
+ #
900
+ def get_authorization_rule(resource_group_name, namespace_name, authorization_rule_name, custom_headers = nil)
901
+ response = get_authorization_rule_async(resource_group_name, namespace_name, authorization_rule_name, custom_headers).value!
902
+ response.body unless response.nil?
903
+ end
904
+
905
+ #
906
+ # Authorization rule for a namespace by name.
907
+ #
908
+ # @param resource_group_name [String] Name of the Resource group within the
909
+ # Azure subscription.
910
+ # @param namespace_name [String] The Namespace Name
911
+ # @param authorization_rule_name [String] The authorizationRule name.
912
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
913
+ # will be added to the HTTP request.
914
+ #
915
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
916
+ #
917
+ def get_authorization_rule_with_http_info(resource_group_name, namespace_name, authorization_rule_name, custom_headers = nil)
918
+ get_authorization_rule_async(resource_group_name, namespace_name, authorization_rule_name, custom_headers).value!
919
+ end
920
+
921
+ #
922
+ # Authorization rule for a namespace by name.
923
+ #
924
+ # @param resource_group_name [String] Name of the Resource group within the
925
+ # Azure subscription.
926
+ # @param namespace_name [String] The Namespace Name
927
+ # @param authorization_rule_name [String] The authorizationRule name.
928
+ # @param [Hash{String => String}] A hash of custom headers that will be added
929
+ # to the HTTP request.
930
+ #
931
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
932
+ #
933
+ def get_authorization_rule_async(resource_group_name, namespace_name, authorization_rule_name, custom_headers = nil)
934
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
935
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
936
+ fail ArgumentError, 'authorization_rule_name is nil' if authorization_rule_name.nil?
937
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
938
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
939
+
940
+
941
+ request_headers = {}
942
+
943
+ # Set Headers
944
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
945
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
946
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}'
947
+
948
+ request_url = @base_url || @client.base_url
949
+
950
+ options = {
951
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
952
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'authorizationRuleName' => authorization_rule_name,'subscriptionId' => @client.subscription_id},
953
+ query_params: {'api-version' => @client.api_version},
954
+ headers: request_headers.merge(custom_headers || {}),
955
+ base_url: request_url
956
+ }
957
+ promise = @client.make_request_async(:get, path_template, options)
958
+
959
+ promise = promise.then do |result|
960
+ http_response = result.response
961
+ status_code = http_response.status
962
+ response_content = http_response.body
963
+ unless status_code == 200
964
+ error_model = JSON.load(response_content)
965
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
966
+ end
967
+
968
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
969
+ # Deserialize Response
970
+ if status_code == 200
971
+ begin
972
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
973
+ result_mapper = Azure::Relay::Mgmt::V2016_07_01::Models::AuthorizationRule.mapper()
974
+ result.body = @client.deserialize(result_mapper, parsed_response)
975
+ rescue Exception => e
976
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
977
+ end
978
+ end
979
+
980
+ result
981
+ end
982
+
983
+ promise.execute
984
+ end
985
+
986
+ #
987
+ # Primary and Secondary ConnectionStrings to the namespace
988
+ #
989
+ # @param resource_group_name [String] Name of the Resource group within the
990
+ # Azure subscription.
991
+ # @param namespace_name [String] The Namespace Name
992
+ # @param authorization_rule_name [String] The authorizationRule name.
993
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
994
+ # will be added to the HTTP request.
995
+ #
996
+ # @return [AuthorizationRuleKeys] operation results.
997
+ #
998
+ def list_keys(resource_group_name, namespace_name, authorization_rule_name, custom_headers = nil)
999
+ response = list_keys_async(resource_group_name, namespace_name, authorization_rule_name, custom_headers).value!
1000
+ response.body unless response.nil?
1001
+ end
1002
+
1003
+ #
1004
+ # Primary and Secondary ConnectionStrings to the namespace
1005
+ #
1006
+ # @param resource_group_name [String] Name of the Resource group within the
1007
+ # Azure subscription.
1008
+ # @param namespace_name [String] The Namespace Name
1009
+ # @param authorization_rule_name [String] The authorizationRule name.
1010
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1011
+ # will be added to the HTTP request.
1012
+ #
1013
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1014
+ #
1015
+ def list_keys_with_http_info(resource_group_name, namespace_name, authorization_rule_name, custom_headers = nil)
1016
+ list_keys_async(resource_group_name, namespace_name, authorization_rule_name, custom_headers).value!
1017
+ end
1018
+
1019
+ #
1020
+ # Primary and Secondary ConnectionStrings to the namespace
1021
+ #
1022
+ # @param resource_group_name [String] Name of the Resource group within the
1023
+ # Azure subscription.
1024
+ # @param namespace_name [String] The Namespace Name
1025
+ # @param authorization_rule_name [String] The authorizationRule name.
1026
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1027
+ # to the HTTP request.
1028
+ #
1029
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1030
+ #
1031
+ def list_keys_async(resource_group_name, namespace_name, authorization_rule_name, custom_headers = nil)
1032
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1033
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
1034
+ fail ArgumentError, 'authorization_rule_name is nil' if authorization_rule_name.nil?
1035
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1036
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1037
+
1038
+
1039
+ request_headers = {}
1040
+
1041
+ # Set Headers
1042
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1043
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1044
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys'
1045
+
1046
+ request_url = @base_url || @client.base_url
1047
+
1048
+ options = {
1049
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1050
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'authorizationRuleName' => authorization_rule_name,'subscriptionId' => @client.subscription_id},
1051
+ query_params: {'api-version' => @client.api_version},
1052
+ headers: request_headers.merge(custom_headers || {}),
1053
+ base_url: request_url
1054
+ }
1055
+ promise = @client.make_request_async(:post, path_template, options)
1056
+
1057
+ promise = promise.then do |result|
1058
+ http_response = result.response
1059
+ status_code = http_response.status
1060
+ response_content = http_response.body
1061
+ unless status_code == 200
1062
+ error_model = JSON.load(response_content)
1063
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1064
+ end
1065
+
1066
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1067
+ # Deserialize Response
1068
+ if status_code == 200
1069
+ begin
1070
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1071
+ result_mapper = Azure::Relay::Mgmt::V2016_07_01::Models::AuthorizationRuleKeys.mapper()
1072
+ result.body = @client.deserialize(result_mapper, parsed_response)
1073
+ rescue Exception => e
1074
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1075
+ end
1076
+ end
1077
+
1078
+ result
1079
+ end
1080
+
1081
+ promise.execute
1082
+ end
1083
+
1084
+ #
1085
+ # Regenerates the Primary or Secondary ConnectionStrings to the namespace
1086
+ #
1087
+ # @param resource_group_name [String] Name of the Resource group within the
1088
+ # Azure subscription.
1089
+ # @param namespace_name [String] The Namespace Name
1090
+ # @param authorization_rule_name [String] The authorizationRule name.
1091
+ # @param parameters [RegenerateKeysParameters] Parameters supplied to
1092
+ # regenerate Auth Rule.
1093
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1094
+ # will be added to the HTTP request.
1095
+ #
1096
+ # @return [AuthorizationRuleKeys] operation results.
1097
+ #
1098
+ def regenerate_keys(resource_group_name, namespace_name, authorization_rule_name, parameters, custom_headers = nil)
1099
+ response = regenerate_keys_async(resource_group_name, namespace_name, authorization_rule_name, parameters, custom_headers).value!
1100
+ response.body unless response.nil?
1101
+ end
1102
+
1103
+ #
1104
+ # Regenerates the Primary or Secondary ConnectionStrings to the namespace
1105
+ #
1106
+ # @param resource_group_name [String] Name of the Resource group within the
1107
+ # Azure subscription.
1108
+ # @param namespace_name [String] The Namespace Name
1109
+ # @param authorization_rule_name [String] The authorizationRule name.
1110
+ # @param parameters [RegenerateKeysParameters] Parameters supplied to
1111
+ # regenerate Auth Rule.
1112
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1113
+ # will be added to the HTTP request.
1114
+ #
1115
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1116
+ #
1117
+ def regenerate_keys_with_http_info(resource_group_name, namespace_name, authorization_rule_name, parameters, custom_headers = nil)
1118
+ regenerate_keys_async(resource_group_name, namespace_name, authorization_rule_name, parameters, custom_headers).value!
1119
+ end
1120
+
1121
+ #
1122
+ # Regenerates the Primary or Secondary ConnectionStrings to the namespace
1123
+ #
1124
+ # @param resource_group_name [String] Name of the Resource group within the
1125
+ # Azure subscription.
1126
+ # @param namespace_name [String] The Namespace Name
1127
+ # @param authorization_rule_name [String] The authorizationRule name.
1128
+ # @param parameters [RegenerateKeysParameters] Parameters supplied to
1129
+ # regenerate Auth Rule.
1130
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1131
+ # to the HTTP request.
1132
+ #
1133
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1134
+ #
1135
+ def regenerate_keys_async(resource_group_name, namespace_name, authorization_rule_name, parameters, custom_headers = nil)
1136
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1137
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
1138
+ fail ArgumentError, 'authorization_rule_name is nil' if authorization_rule_name.nil?
1139
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1140
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1141
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1142
+
1143
+
1144
+ request_headers = {}
1145
+
1146
+ # Set Headers
1147
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1148
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1149
+
1150
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1151
+
1152
+ # Serialize Request
1153
+ request_mapper = Azure::Relay::Mgmt::V2016_07_01::Models::RegenerateKeysParameters.mapper()
1154
+ request_content = @client.serialize(request_mapper, parameters)
1155
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1156
+
1157
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys'
1158
+
1159
+ request_url = @base_url || @client.base_url
1160
+
1161
+ options = {
1162
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1163
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'authorizationRuleName' => authorization_rule_name,'subscriptionId' => @client.subscription_id},
1164
+ query_params: {'api-version' => @client.api_version},
1165
+ body: request_content,
1166
+ headers: request_headers.merge(custom_headers || {}),
1167
+ base_url: request_url
1168
+ }
1169
+ promise = @client.make_request_async(:post, path_template, options)
1170
+
1171
+ promise = promise.then do |result|
1172
+ http_response = result.response
1173
+ status_code = http_response.status
1174
+ response_content = http_response.body
1175
+ unless status_code == 200
1176
+ error_model = JSON.load(response_content)
1177
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1178
+ end
1179
+
1180
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1181
+ # Deserialize Response
1182
+ if status_code == 200
1183
+ begin
1184
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1185
+ result_mapper = Azure::Relay::Mgmt::V2016_07_01::Models::AuthorizationRuleKeys.mapper()
1186
+ result.body = @client.deserialize(result_mapper, parsed_response)
1187
+ rescue Exception => e
1188
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1189
+ end
1190
+ end
1191
+
1192
+ result
1193
+ end
1194
+
1195
+ promise.execute
1196
+ end
1197
+
1198
+ #
1199
+ # Create Azure Relay namespace.
1200
+ #
1201
+ # @param resource_group_name [String] Name of the Resource group within the
1202
+ # Azure subscription.
1203
+ # @param namespace_name [String] The Namespace Name
1204
+ # @param parameters [RelayNamespace] Parameters supplied to create a Namespace
1205
+ # Resource.
1206
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1207
+ # will be added to the HTTP request.
1208
+ #
1209
+ # @return [RelayNamespace] operation results.
1210
+ #
1211
+ def begin_create_or_update(resource_group_name, namespace_name, parameters, custom_headers = nil)
1212
+ response = begin_create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers).value!
1213
+ response.body unless response.nil?
1214
+ end
1215
+
1216
+ #
1217
+ # Create Azure Relay namespace.
1218
+ #
1219
+ # @param resource_group_name [String] Name of the Resource group within the
1220
+ # Azure subscription.
1221
+ # @param namespace_name [String] The Namespace Name
1222
+ # @param parameters [RelayNamespace] Parameters supplied to create a Namespace
1223
+ # Resource.
1224
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1225
+ # will be added to the HTTP request.
1226
+ #
1227
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1228
+ #
1229
+ def begin_create_or_update_with_http_info(resource_group_name, namespace_name, parameters, custom_headers = nil)
1230
+ begin_create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers).value!
1231
+ end
1232
+
1233
+ #
1234
+ # Create Azure Relay namespace.
1235
+ #
1236
+ # @param resource_group_name [String] Name of the Resource group within the
1237
+ # Azure subscription.
1238
+ # @param namespace_name [String] The Namespace Name
1239
+ # @param parameters [RelayNamespace] Parameters supplied to create a Namespace
1240
+ # Resource.
1241
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1242
+ # to the HTTP request.
1243
+ #
1244
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1245
+ #
1246
+ def begin_create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers = nil)
1247
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1248
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
1249
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1250
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1251
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1252
+
1253
+
1254
+ request_headers = {}
1255
+
1256
+ # Set Headers
1257
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1258
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1259
+
1260
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1261
+
1262
+ # Serialize Request
1263
+ request_mapper = Azure::Relay::Mgmt::V2016_07_01::Models::RelayNamespace.mapper()
1264
+ request_content = @client.serialize(request_mapper, parameters)
1265
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1266
+
1267
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}'
1268
+
1269
+ request_url = @base_url || @client.base_url
1270
+
1271
+ options = {
1272
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1273
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'subscriptionId' => @client.subscription_id},
1274
+ query_params: {'api-version' => @client.api_version},
1275
+ body: request_content,
1276
+ headers: request_headers.merge(custom_headers || {}),
1277
+ base_url: request_url
1278
+ }
1279
+ promise = @client.make_request_async(:put, path_template, options)
1280
+
1281
+ promise = promise.then do |result|
1282
+ http_response = result.response
1283
+ status_code = http_response.status
1284
+ response_content = http_response.body
1285
+ unless status_code == 200 || status_code == 202
1286
+ error_model = JSON.load(response_content)
1287
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1288
+ end
1289
+
1290
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1291
+ # Deserialize Response
1292
+ if status_code == 200
1293
+ begin
1294
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1295
+ result_mapper = Azure::Relay::Mgmt::V2016_07_01::Models::RelayNamespace.mapper()
1296
+ result.body = @client.deserialize(result_mapper, parsed_response)
1297
+ rescue Exception => e
1298
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1299
+ end
1300
+ end
1301
+
1302
+ result
1303
+ end
1304
+
1305
+ promise.execute
1306
+ end
1307
+
1308
+ #
1309
+ # Deletes an existing namespace. This operation also removes all associated
1310
+ # resources under the namespace.
1311
+ #
1312
+ # @param resource_group_name [String] Name of the Resource group within the
1313
+ # Azure subscription.
1314
+ # @param namespace_name [String] The Namespace Name
1315
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1316
+ # will be added to the HTTP request.
1317
+ #
1318
+ #
1319
+ def begin_delete(resource_group_name, namespace_name, custom_headers = nil)
1320
+ response = begin_delete_async(resource_group_name, namespace_name, custom_headers).value!
1321
+ nil
1322
+ end
1323
+
1324
+ #
1325
+ # Deletes an existing namespace. This operation also removes all associated
1326
+ # resources under the namespace.
1327
+ #
1328
+ # @param resource_group_name [String] Name of the Resource group within the
1329
+ # Azure subscription.
1330
+ # @param namespace_name [String] The Namespace Name
1331
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1332
+ # will be added to the HTTP request.
1333
+ #
1334
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1335
+ #
1336
+ def begin_delete_with_http_info(resource_group_name, namespace_name, custom_headers = nil)
1337
+ begin_delete_async(resource_group_name, namespace_name, custom_headers).value!
1338
+ end
1339
+
1340
+ #
1341
+ # Deletes an existing namespace. This operation also removes all associated
1342
+ # resources under the namespace.
1343
+ #
1344
+ # @param resource_group_name [String] Name of the Resource group within the
1345
+ # Azure subscription.
1346
+ # @param namespace_name [String] The Namespace Name
1347
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1348
+ # to the HTTP request.
1349
+ #
1350
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1351
+ #
1352
+ def begin_delete_async(resource_group_name, namespace_name, custom_headers = nil)
1353
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1354
+ fail ArgumentError, 'namespace_name is nil' if namespace_name.nil?
1355
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1356
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1357
+
1358
+
1359
+ request_headers = {}
1360
+
1361
+ # Set Headers
1362
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1363
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1364
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}'
1365
+
1366
+ request_url = @base_url || @client.base_url
1367
+
1368
+ options = {
1369
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1370
+ path_params: {'resourceGroupName' => resource_group_name,'namespaceName' => namespace_name,'subscriptionId' => @client.subscription_id},
1371
+ query_params: {'api-version' => @client.api_version},
1372
+ headers: request_headers.merge(custom_headers || {}),
1373
+ base_url: request_url
1374
+ }
1375
+ promise = @client.make_request_async(:delete, path_template, options)
1376
+
1377
+ promise = promise.then do |result|
1378
+ http_response = result.response
1379
+ status_code = http_response.status
1380
+ response_content = http_response.body
1381
+ unless status_code == 200 || status_code == 202 || status_code == 204
1382
+ error_model = JSON.load(response_content)
1383
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1384
+ end
1385
+
1386
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1387
+
1388
+ result
1389
+ end
1390
+
1391
+ promise.execute
1392
+ end
1393
+
1394
+ #
1395
+ # Lists all the available namespaces within the subscription irrespective of
1396
+ # the resourceGroups.
1397
+ #
1398
+ # @param next_page_link [String] The NextLink from the previous successful call
1399
+ # to List operation.
1400
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1401
+ # will be added to the HTTP request.
1402
+ #
1403
+ # @return [RelayNamespaceListResult] operation results.
1404
+ #
1405
+ def list_next(next_page_link, custom_headers = nil)
1406
+ response = list_next_async(next_page_link, custom_headers).value!
1407
+ response.body unless response.nil?
1408
+ end
1409
+
1410
+ #
1411
+ # Lists all the available namespaces within the subscription irrespective of
1412
+ # the resourceGroups.
1413
+ #
1414
+ # @param next_page_link [String] The NextLink from the previous successful call
1415
+ # to List operation.
1416
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1417
+ # will be added to the HTTP request.
1418
+ #
1419
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1420
+ #
1421
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
1422
+ list_next_async(next_page_link, custom_headers).value!
1423
+ end
1424
+
1425
+ #
1426
+ # Lists all the available namespaces within the subscription irrespective of
1427
+ # the resourceGroups.
1428
+ #
1429
+ # @param next_page_link [String] The NextLink from the previous successful call
1430
+ # to List operation.
1431
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1432
+ # to the HTTP request.
1433
+ #
1434
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1435
+ #
1436
+ def list_next_async(next_page_link, custom_headers = nil)
1437
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1438
+
1439
+
1440
+ request_headers = {}
1441
+
1442
+ # Set Headers
1443
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1444
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1445
+ path_template = '{nextLink}'
1446
+
1447
+ request_url = @base_url || @client.base_url
1448
+
1449
+ options = {
1450
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1451
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1452
+ headers: request_headers.merge(custom_headers || {}),
1453
+ base_url: request_url
1454
+ }
1455
+ promise = @client.make_request_async(:get, path_template, options)
1456
+
1457
+ promise = promise.then do |result|
1458
+ http_response = result.response
1459
+ status_code = http_response.status
1460
+ response_content = http_response.body
1461
+ unless status_code == 200
1462
+ error_model = JSON.load(response_content)
1463
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1464
+ end
1465
+
1466
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1467
+ # Deserialize Response
1468
+ if status_code == 200
1469
+ begin
1470
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1471
+ result_mapper = Azure::Relay::Mgmt::V2016_07_01::Models::RelayNamespaceListResult.mapper()
1472
+ result.body = @client.deserialize(result_mapper, parsed_response)
1473
+ rescue Exception => e
1474
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1475
+ end
1476
+ end
1477
+
1478
+ result
1479
+ end
1480
+
1481
+ promise.execute
1482
+ end
1483
+
1484
+ #
1485
+ # Lists all the available namespaces within the ResourceGroup.
1486
+ #
1487
+ # @param next_page_link [String] The NextLink from the previous successful call
1488
+ # to List operation.
1489
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1490
+ # will be added to the HTTP request.
1491
+ #
1492
+ # @return [RelayNamespaceListResult] operation results.
1493
+ #
1494
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
1495
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
1496
+ response.body unless response.nil?
1497
+ end
1498
+
1499
+ #
1500
+ # Lists all the available namespaces within the ResourceGroup.
1501
+ #
1502
+ # @param next_page_link [String] The NextLink from the previous successful call
1503
+ # to List operation.
1504
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1505
+ # will be added to the HTTP request.
1506
+ #
1507
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1508
+ #
1509
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
1510
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
1511
+ end
1512
+
1513
+ #
1514
+ # Lists all the available namespaces within the ResourceGroup.
1515
+ #
1516
+ # @param next_page_link [String] The NextLink from the previous successful call
1517
+ # to List operation.
1518
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1519
+ # to the HTTP request.
1520
+ #
1521
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1522
+ #
1523
+ def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
1524
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1525
+
1526
+
1527
+ request_headers = {}
1528
+
1529
+ # Set Headers
1530
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1531
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1532
+ path_template = '{nextLink}'
1533
+
1534
+ request_url = @base_url || @client.base_url
1535
+
1536
+ options = {
1537
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1538
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1539
+ headers: request_headers.merge(custom_headers || {}),
1540
+ base_url: request_url
1541
+ }
1542
+ promise = @client.make_request_async(:get, path_template, options)
1543
+
1544
+ promise = promise.then do |result|
1545
+ http_response = result.response
1546
+ status_code = http_response.status
1547
+ response_content = http_response.body
1548
+ unless status_code == 200
1549
+ error_model = JSON.load(response_content)
1550
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1551
+ end
1552
+
1553
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1554
+ # Deserialize Response
1555
+ if status_code == 200
1556
+ begin
1557
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1558
+ result_mapper = Azure::Relay::Mgmt::V2016_07_01::Models::RelayNamespaceListResult.mapper()
1559
+ result.body = @client.deserialize(result_mapper, parsed_response)
1560
+ rescue Exception => e
1561
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1562
+ end
1563
+ end
1564
+
1565
+ result
1566
+ end
1567
+
1568
+ promise.execute
1569
+ end
1570
+
1571
+ #
1572
+ # Authorization rules for a namespace.
1573
+ #
1574
+ # @param next_page_link [String] The NextLink from the previous successful call
1575
+ # to List operation.
1576
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1577
+ # will be added to the HTTP request.
1578
+ #
1579
+ # @return [AuthorizationRuleListResult] operation results.
1580
+ #
1581
+ def list_authorization_rules_next(next_page_link, custom_headers = nil)
1582
+ response = list_authorization_rules_next_async(next_page_link, custom_headers).value!
1583
+ response.body unless response.nil?
1584
+ end
1585
+
1586
+ #
1587
+ # Authorization rules for a namespace.
1588
+ #
1589
+ # @param next_page_link [String] The NextLink from the previous successful call
1590
+ # to List operation.
1591
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1592
+ # will be added to the HTTP request.
1593
+ #
1594
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1595
+ #
1596
+ def list_authorization_rules_next_with_http_info(next_page_link, custom_headers = nil)
1597
+ list_authorization_rules_next_async(next_page_link, custom_headers).value!
1598
+ end
1599
+
1600
+ #
1601
+ # Authorization rules for a namespace.
1602
+ #
1603
+ # @param next_page_link [String] The NextLink from the previous successful call
1604
+ # to List operation.
1605
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1606
+ # to the HTTP request.
1607
+ #
1608
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1609
+ #
1610
+ def list_authorization_rules_next_async(next_page_link, custom_headers = nil)
1611
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1612
+
1613
+
1614
+ request_headers = {}
1615
+
1616
+ # Set Headers
1617
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1618
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1619
+ path_template = '{nextLink}'
1620
+
1621
+ request_url = @base_url || @client.base_url
1622
+
1623
+ options = {
1624
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1625
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1626
+ headers: request_headers.merge(custom_headers || {}),
1627
+ base_url: request_url
1628
+ }
1629
+ promise = @client.make_request_async(:get, path_template, options)
1630
+
1631
+ promise = promise.then do |result|
1632
+ http_response = result.response
1633
+ status_code = http_response.status
1634
+ response_content = http_response.body
1635
+ unless status_code == 200
1636
+ error_model = JSON.load(response_content)
1637
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1638
+ end
1639
+
1640
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1641
+ # Deserialize Response
1642
+ if status_code == 200
1643
+ begin
1644
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1645
+ result_mapper = Azure::Relay::Mgmt::V2016_07_01::Models::AuthorizationRuleListResult.mapper()
1646
+ result.body = @client.deserialize(result_mapper, parsed_response)
1647
+ rescue Exception => e
1648
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1649
+ end
1650
+ end
1651
+
1652
+ result
1653
+ end
1654
+
1655
+ promise.execute
1656
+ end
1657
+
1658
+ #
1659
+ # Lists all the available namespaces within the subscription irrespective of
1660
+ # the resourceGroups.
1661
+ #
1662
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1663
+ # will be added to the HTTP request.
1664
+ #
1665
+ # @return [RelayNamespaceListResult] which provide lazy access to pages of the
1666
+ # response.
1667
+ #
1668
+ def list_as_lazy(custom_headers = nil)
1669
+ response = list_async(custom_headers).value!
1670
+ unless response.nil?
1671
+ page = response.body
1672
+ page.next_method = Proc.new do |next_page_link|
1673
+ list_next_async(next_page_link, custom_headers)
1674
+ end
1675
+ page
1676
+ end
1677
+ end
1678
+
1679
+ #
1680
+ # Lists all the available namespaces within the ResourceGroup.
1681
+ #
1682
+ # @param resource_group_name [String] Name of the Resource group within the
1683
+ # Azure subscription.
1684
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1685
+ # will be added to the HTTP request.
1686
+ #
1687
+ # @return [RelayNamespaceListResult] which provide lazy access to pages of the
1688
+ # response.
1689
+ #
1690
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
1691
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
1692
+ unless response.nil?
1693
+ page = response.body
1694
+ page.next_method = Proc.new do |next_page_link|
1695
+ list_by_resource_group_next_async(next_page_link, custom_headers)
1696
+ end
1697
+ page
1698
+ end
1699
+ end
1700
+
1701
+ #
1702
+ # Authorization rules for a namespace.
1703
+ #
1704
+ # @param resource_group_name [String] Name of the Resource group within the
1705
+ # Azure subscription.
1706
+ # @param namespace_name [String] The Namespace Name
1707
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1708
+ # will be added to the HTTP request.
1709
+ #
1710
+ # @return [AuthorizationRuleListResult] which provide lazy access to pages of
1711
+ # the response.
1712
+ #
1713
+ def list_authorization_rules_as_lazy(resource_group_name, namespace_name, custom_headers = nil)
1714
+ response = list_authorization_rules_async(resource_group_name, namespace_name, custom_headers).value!
1715
+ unless response.nil?
1716
+ page = response.body
1717
+ page.next_method = Proc.new do |next_page_link|
1718
+ list_authorization_rules_next_async(next_page_link, custom_headers)
1719
+ end
1720
+ page
1721
+ end
1722
+ end
1723
+
1724
+ end
1725
+ end