azure_mgmt_relay 0.14.0

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