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