azure_mgmt_traffic_manager 0.4.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.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +5 -0
- data/azure_mgmt_traffic_manager.gemspec +34 -0
- data/lib/azure_mgmt_traffic_manager.rb +5 -0
- data/lib/generated/azure_mgmt_traffic_manager.rb +36 -0
- data/lib/generated/azure_mgmt_traffic_manager/endpoints.rb +495 -0
- data/lib/generated/azure_mgmt_traffic_manager/models/check_traffic_manager_relative_dns_name_availability_parameters.rb +55 -0
- data/lib/generated/azure_mgmt_traffic_manager/models/dns_config.rb +72 -0
- data/lib/generated/azure_mgmt_traffic_manager/models/endpoint.rb +161 -0
- data/lib/generated/azure_mgmt_traffic_manager/models/monitor_config.rb +79 -0
- data/lib/generated/azure_mgmt_traffic_manager/models/profile.rb +145 -0
- data/lib/generated/azure_mgmt_traffic_manager/models/profile_list_result.rb +52 -0
- data/lib/generated/azure_mgmt_traffic_manager/models/traffic_manager_name_availability.rb +87 -0
- data/lib/generated/azure_mgmt_traffic_manager/module_definition.rb +8 -0
- data/lib/generated/azure_mgmt_traffic_manager/profiles.rb +732 -0
- data/lib/generated/azure_mgmt_traffic_manager/traffic_manager_management_client.rb +72 -0
- data/lib/generated/azure_mgmt_traffic_manager/version.rb +8 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 459861bcf3628f7f4372dd222c4a23c7231c0d91
|
4
|
+
data.tar.gz: fcc309b4309cf35f43758f6baa848180fb802fe7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 72cbf2ed5293f5d00ae90f40c951bf71710fa733d2c2288b7da909fa1d3afdf12595cb23cf297232fc3e3dfa222b46a2c76e9bcb609ecd44b5efc7f0e17f0452
|
7
|
+
data.tar.gz: 314f004ba29ecbd3d4d783eed5acf5dfd293783fcf7b6c4cad53997a8b39dddf6bcb53f57eb062784199a0e6ea215f7863afbc4ccc5f9062162474199e70d988
|
data/.rspec
ADDED
data/LICENSE.txt
ADDED
@@ -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.
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
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
|
+
lib = File.expand_path('../lib', __FILE__)
|
6
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
7
|
+
|
8
|
+
require 'generated/azure_mgmt_traffic_manager/module_definition'
|
9
|
+
require 'generated/azure_mgmt_traffic_manager/version'
|
10
|
+
|
11
|
+
Gem::Specification.new do |spec|
|
12
|
+
spec.name = 'azure_mgmt_traffic_manager'
|
13
|
+
spec.version = Azure::ARM::TrafficManager::VERSION
|
14
|
+
spec.authors = 'Microsoft Corporation'
|
15
|
+
spec.email = 'azrubyteam@microsoft.com'
|
16
|
+
spec.description = 'Microsoft Azure Traffic Management Client Library for Ruby'
|
17
|
+
spec.summary = 'Official Ruby client library to consume Microsoft Azure Traffic Management services.'
|
18
|
+
spec.homepage = 'https://aka.ms/azure-sdk-for-ruby'
|
19
|
+
spec.license = 'MIT'
|
20
|
+
|
21
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
spec.bindir = 'bin'
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ['lib']
|
25
|
+
|
26
|
+
spec.required_ruby_version = '>= 1.9.3'
|
27
|
+
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.9'
|
29
|
+
spec.add_development_dependency 'rake', '~> 10'
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3'
|
31
|
+
spec.add_development_dependency 'dotenv', '~> 2'
|
32
|
+
|
33
|
+
spec.add_runtime_dependency 'ms_rest_azure', '~> 0.3.0'
|
34
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
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_traffic_manager/module_definition'
|
20
|
+
require 'ms_rest_azure'
|
21
|
+
|
22
|
+
module Azure::ARM::TrafficManager
|
23
|
+
autoload :Endpoints, 'generated/azure_mgmt_traffic_manager/endpoints.rb'
|
24
|
+
autoload :Profiles, 'generated/azure_mgmt_traffic_manager/profiles.rb'
|
25
|
+
autoload :TrafficManagerManagementClient, 'generated/azure_mgmt_traffic_manager/traffic_manager_management_client.rb'
|
26
|
+
|
27
|
+
module Models
|
28
|
+
autoload :Endpoint, 'generated/azure_mgmt_traffic_manager/models/endpoint.rb'
|
29
|
+
autoload :CheckTrafficManagerRelativeDnsNameAvailabilityParameters, 'generated/azure_mgmt_traffic_manager/models/check_traffic_manager_relative_dns_name_availability_parameters.rb'
|
30
|
+
autoload :DnsConfig, 'generated/azure_mgmt_traffic_manager/models/dns_config.rb'
|
31
|
+
autoload :MonitorConfig, 'generated/azure_mgmt_traffic_manager/models/monitor_config.rb'
|
32
|
+
autoload :ProfileListResult, 'generated/azure_mgmt_traffic_manager/models/profile_list_result.rb'
|
33
|
+
autoload :TrafficManagerNameAvailability, 'generated/azure_mgmt_traffic_manager/models/traffic_manager_name_availability.rb'
|
34
|
+
autoload :Profile, 'generated/azure_mgmt_traffic_manager/models/profile.rb'
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,495 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::TrafficManager
|
7
|
+
#
|
8
|
+
# Endpoints
|
9
|
+
#
|
10
|
+
class Endpoints
|
11
|
+
include Azure::ARM::TrafficManager::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the Endpoints class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return reference to the TrafficManagerManagementClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# Update a Traffic Manager endpoint.
|
27
|
+
#
|
28
|
+
# @param resource_group_name [String] The name of the resource group
|
29
|
+
# containing the Traffic Manager endpoint to be updated.
|
30
|
+
# @param profile_name [String] The name of the Traffic Manager profile.
|
31
|
+
# @param endpoint_type [String] The type of the Traffic Manager endpoint to be
|
32
|
+
# updated.
|
33
|
+
# @param endpoint_name [String] The name of the Traffic Manager endpoint to be
|
34
|
+
# updated.
|
35
|
+
# @param parameters [Endpoint] The Traffic Manager endpoint parameters
|
36
|
+
# supplied to the Update operation.
|
37
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
38
|
+
# will be added to the HTTP request.
|
39
|
+
#
|
40
|
+
# @return [Endpoint] operation results.
|
41
|
+
#
|
42
|
+
def update(resource_group_name, profile_name, endpoint_type, endpoint_name, parameters, custom_headers = nil)
|
43
|
+
response = update_async(resource_group_name, profile_name, endpoint_type, endpoint_name, parameters, custom_headers).value!
|
44
|
+
response.body unless response.nil?
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# Update a Traffic Manager endpoint.
|
49
|
+
#
|
50
|
+
# @param resource_group_name [String] The name of the resource group
|
51
|
+
# containing the Traffic Manager endpoint to be updated.
|
52
|
+
# @param profile_name [String] The name of the Traffic Manager profile.
|
53
|
+
# @param endpoint_type [String] The type of the Traffic Manager endpoint to be
|
54
|
+
# updated.
|
55
|
+
# @param endpoint_name [String] The name of the Traffic Manager endpoint to be
|
56
|
+
# updated.
|
57
|
+
# @param parameters [Endpoint] The Traffic Manager endpoint parameters
|
58
|
+
# supplied to the Update operation.
|
59
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
60
|
+
# will be added to the HTTP request.
|
61
|
+
#
|
62
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
63
|
+
#
|
64
|
+
def update_with_http_info(resource_group_name, profile_name, endpoint_type, endpoint_name, parameters, custom_headers = nil)
|
65
|
+
update_async(resource_group_name, profile_name, endpoint_type, endpoint_name, parameters, custom_headers).value!
|
66
|
+
end
|
67
|
+
|
68
|
+
#
|
69
|
+
# Update a Traffic Manager endpoint.
|
70
|
+
#
|
71
|
+
# @param resource_group_name [String] The name of the resource group
|
72
|
+
# containing the Traffic Manager endpoint to be updated.
|
73
|
+
# @param profile_name [String] The name of the Traffic Manager profile.
|
74
|
+
# @param endpoint_type [String] The type of the Traffic Manager endpoint to be
|
75
|
+
# updated.
|
76
|
+
# @param endpoint_name [String] The name of the Traffic Manager endpoint to be
|
77
|
+
# updated.
|
78
|
+
# @param parameters [Endpoint] The Traffic Manager endpoint parameters
|
79
|
+
# supplied to the Update operation.
|
80
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
81
|
+
# to the HTTP request.
|
82
|
+
#
|
83
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
84
|
+
#
|
85
|
+
def update_async(resource_group_name, profile_name, endpoint_type, endpoint_name, parameters, custom_headers = nil)
|
86
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
87
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
88
|
+
fail ArgumentError, 'endpoint_type is nil' if endpoint_type.nil?
|
89
|
+
fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
|
90
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
91
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
92
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
93
|
+
|
94
|
+
|
95
|
+
request_headers = {}
|
96
|
+
|
97
|
+
# Set Headers
|
98
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
99
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
100
|
+
|
101
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
102
|
+
|
103
|
+
# Serialize Request
|
104
|
+
request_mapper = Endpoint.mapper()
|
105
|
+
request_content = @client.serialize(request_mapper, parameters, 'parameters')
|
106
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
107
|
+
|
108
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'
|
109
|
+
options = {
|
110
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
111
|
+
path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'endpointType' => endpoint_type,'endpointName' => endpoint_name,'subscriptionId' => @client.subscription_id},
|
112
|
+
query_params: {'api-version' => @client.api_version},
|
113
|
+
body: request_content,
|
114
|
+
headers: request_headers.merge(custom_headers || {})
|
115
|
+
}
|
116
|
+
|
117
|
+
request_url = @base_url || @client.base_url
|
118
|
+
|
119
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
|
120
|
+
promise = request.run_promise do |req|
|
121
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
122
|
+
end
|
123
|
+
|
124
|
+
promise = promise.then do |http_response|
|
125
|
+
status_code = http_response.status
|
126
|
+
response_content = http_response.body
|
127
|
+
unless status_code == 200
|
128
|
+
error_model = JSON.load(response_content)
|
129
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
130
|
+
end
|
131
|
+
|
132
|
+
# Create Result
|
133
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
134
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
135
|
+
# Deserialize Response
|
136
|
+
if status_code == 200
|
137
|
+
begin
|
138
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
139
|
+
result_mapper = Endpoint.mapper()
|
140
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
141
|
+
rescue Exception => e
|
142
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
result
|
147
|
+
end
|
148
|
+
|
149
|
+
promise.execute
|
150
|
+
end
|
151
|
+
|
152
|
+
#
|
153
|
+
# Gets a Traffic Manager endpoint.
|
154
|
+
#
|
155
|
+
# @param resource_group_name [String] The name of the resource group
|
156
|
+
# containing the Traffic Manager endpoint.
|
157
|
+
# @param profile_name [String] The name of the Traffic Manager profile.
|
158
|
+
# @param endpoint_type [String] The type of the Traffic Manager endpoint.
|
159
|
+
# @param endpoint_name [String] The name of the Traffic Manager endpoint.
|
160
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
161
|
+
# will be added to the HTTP request.
|
162
|
+
#
|
163
|
+
# @return [Endpoint] operation results.
|
164
|
+
#
|
165
|
+
def get(resource_group_name, profile_name, endpoint_type, endpoint_name, custom_headers = nil)
|
166
|
+
response = get_async(resource_group_name, profile_name, endpoint_type, endpoint_name, custom_headers).value!
|
167
|
+
response.body unless response.nil?
|
168
|
+
end
|
169
|
+
|
170
|
+
#
|
171
|
+
# Gets a Traffic Manager endpoint.
|
172
|
+
#
|
173
|
+
# @param resource_group_name [String] The name of the resource group
|
174
|
+
# containing the Traffic Manager endpoint.
|
175
|
+
# @param profile_name [String] The name of the Traffic Manager profile.
|
176
|
+
# @param endpoint_type [String] The type of the Traffic Manager endpoint.
|
177
|
+
# @param endpoint_name [String] The name of the Traffic Manager endpoint.
|
178
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
179
|
+
# will be added to the HTTP request.
|
180
|
+
#
|
181
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
182
|
+
#
|
183
|
+
def get_with_http_info(resource_group_name, profile_name, endpoint_type, endpoint_name, custom_headers = nil)
|
184
|
+
get_async(resource_group_name, profile_name, endpoint_type, endpoint_name, custom_headers).value!
|
185
|
+
end
|
186
|
+
|
187
|
+
#
|
188
|
+
# Gets a Traffic Manager endpoint.
|
189
|
+
#
|
190
|
+
# @param resource_group_name [String] The name of the resource group
|
191
|
+
# containing the Traffic Manager endpoint.
|
192
|
+
# @param profile_name [String] The name of the Traffic Manager profile.
|
193
|
+
# @param endpoint_type [String] The type of the Traffic Manager endpoint.
|
194
|
+
# @param endpoint_name [String] The name of the Traffic Manager endpoint.
|
195
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
196
|
+
# to the HTTP request.
|
197
|
+
#
|
198
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
199
|
+
#
|
200
|
+
def get_async(resource_group_name, profile_name, endpoint_type, endpoint_name, custom_headers = nil)
|
201
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
202
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
203
|
+
fail ArgumentError, 'endpoint_type is nil' if endpoint_type.nil?
|
204
|
+
fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
|
205
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
206
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
207
|
+
|
208
|
+
|
209
|
+
request_headers = {}
|
210
|
+
|
211
|
+
# Set Headers
|
212
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
213
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
214
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'
|
215
|
+
options = {
|
216
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
217
|
+
path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'endpointType' => endpoint_type,'endpointName' => endpoint_name,'subscriptionId' => @client.subscription_id},
|
218
|
+
query_params: {'api-version' => @client.api_version},
|
219
|
+
headers: request_headers.merge(custom_headers || {})
|
220
|
+
}
|
221
|
+
|
222
|
+
request_url = @base_url || @client.base_url
|
223
|
+
|
224
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
|
225
|
+
promise = request.run_promise do |req|
|
226
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
227
|
+
end
|
228
|
+
|
229
|
+
promise = promise.then do |http_response|
|
230
|
+
status_code = http_response.status
|
231
|
+
response_content = http_response.body
|
232
|
+
unless status_code == 200
|
233
|
+
error_model = JSON.load(response_content)
|
234
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
235
|
+
end
|
236
|
+
|
237
|
+
# Create Result
|
238
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
239
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
240
|
+
# Deserialize Response
|
241
|
+
if status_code == 200
|
242
|
+
begin
|
243
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
244
|
+
result_mapper = Endpoint.mapper()
|
245
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
246
|
+
rescue Exception => e
|
247
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
result
|
252
|
+
end
|
253
|
+
|
254
|
+
promise.execute
|
255
|
+
end
|
256
|
+
|
257
|
+
#
|
258
|
+
# Create or update a Traffic Manager endpoint.
|
259
|
+
#
|
260
|
+
# @param resource_group_name [String] The name of the resource group
|
261
|
+
# containing the Traffic Manager endpoint to be created or updated.
|
262
|
+
# @param profile_name [String] The name of the Traffic Manager profile.
|
263
|
+
# @param endpoint_type [String] The type of the Traffic Manager endpoint to be
|
264
|
+
# created or updated.
|
265
|
+
# @param endpoint_name [String] The name of the Traffic Manager endpoint to be
|
266
|
+
# created or updated.
|
267
|
+
# @param parameters [Endpoint] The Traffic Manager endpoint parameters
|
268
|
+
# supplied to the CreateOrUpdate operation.
|
269
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
270
|
+
# will be added to the HTTP request.
|
271
|
+
#
|
272
|
+
# @return [Endpoint] operation results.
|
273
|
+
#
|
274
|
+
def create_or_update(resource_group_name, profile_name, endpoint_type, endpoint_name, parameters, custom_headers = nil)
|
275
|
+
response = create_or_update_async(resource_group_name, profile_name, endpoint_type, endpoint_name, parameters, custom_headers).value!
|
276
|
+
response.body unless response.nil?
|
277
|
+
end
|
278
|
+
|
279
|
+
#
|
280
|
+
# Create or update a Traffic Manager endpoint.
|
281
|
+
#
|
282
|
+
# @param resource_group_name [String] The name of the resource group
|
283
|
+
# containing the Traffic Manager endpoint to be created or updated.
|
284
|
+
# @param profile_name [String] The name of the Traffic Manager profile.
|
285
|
+
# @param endpoint_type [String] The type of the Traffic Manager endpoint to be
|
286
|
+
# created or updated.
|
287
|
+
# @param endpoint_name [String] The name of the Traffic Manager endpoint to be
|
288
|
+
# created or updated.
|
289
|
+
# @param parameters [Endpoint] The Traffic Manager endpoint parameters
|
290
|
+
# supplied to the CreateOrUpdate operation.
|
291
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
292
|
+
# will be added to the HTTP request.
|
293
|
+
#
|
294
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
295
|
+
#
|
296
|
+
def create_or_update_with_http_info(resource_group_name, profile_name, endpoint_type, endpoint_name, parameters, custom_headers = nil)
|
297
|
+
create_or_update_async(resource_group_name, profile_name, endpoint_type, endpoint_name, parameters, custom_headers).value!
|
298
|
+
end
|
299
|
+
|
300
|
+
#
|
301
|
+
# Create or update a Traffic Manager endpoint.
|
302
|
+
#
|
303
|
+
# @param resource_group_name [String] The name of the resource group
|
304
|
+
# containing the Traffic Manager endpoint to be created or updated.
|
305
|
+
# @param profile_name [String] The name of the Traffic Manager profile.
|
306
|
+
# @param endpoint_type [String] The type of the Traffic Manager endpoint to be
|
307
|
+
# created or updated.
|
308
|
+
# @param endpoint_name [String] The name of the Traffic Manager endpoint to be
|
309
|
+
# created or updated.
|
310
|
+
# @param parameters [Endpoint] The Traffic Manager endpoint parameters
|
311
|
+
# supplied to the CreateOrUpdate operation.
|
312
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
313
|
+
# to the HTTP request.
|
314
|
+
#
|
315
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
316
|
+
#
|
317
|
+
def create_or_update_async(resource_group_name, profile_name, endpoint_type, endpoint_name, parameters, custom_headers = nil)
|
318
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
319
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
320
|
+
fail ArgumentError, 'endpoint_type is nil' if endpoint_type.nil?
|
321
|
+
fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
|
322
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
323
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
324
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
325
|
+
|
326
|
+
|
327
|
+
request_headers = {}
|
328
|
+
|
329
|
+
# Set Headers
|
330
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
331
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
332
|
+
|
333
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
334
|
+
|
335
|
+
# Serialize Request
|
336
|
+
request_mapper = Endpoint.mapper()
|
337
|
+
request_content = @client.serialize(request_mapper, parameters, 'parameters')
|
338
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
339
|
+
|
340
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'
|
341
|
+
options = {
|
342
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
343
|
+
path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'endpointType' => endpoint_type,'endpointName' => endpoint_name,'subscriptionId' => @client.subscription_id},
|
344
|
+
query_params: {'api-version' => @client.api_version},
|
345
|
+
body: request_content,
|
346
|
+
headers: request_headers.merge(custom_headers || {})
|
347
|
+
}
|
348
|
+
|
349
|
+
request_url = @base_url || @client.base_url
|
350
|
+
|
351
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
|
352
|
+
promise = request.run_promise do |req|
|
353
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
354
|
+
end
|
355
|
+
|
356
|
+
promise = promise.then do |http_response|
|
357
|
+
status_code = http_response.status
|
358
|
+
response_content = http_response.body
|
359
|
+
unless status_code == 200 || status_code == 201
|
360
|
+
error_model = JSON.load(response_content)
|
361
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
362
|
+
end
|
363
|
+
|
364
|
+
# Create Result
|
365
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
366
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
367
|
+
# Deserialize Response
|
368
|
+
if status_code == 200
|
369
|
+
begin
|
370
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
371
|
+
result_mapper = Endpoint.mapper()
|
372
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
373
|
+
rescue Exception => e
|
374
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
375
|
+
end
|
376
|
+
end
|
377
|
+
# Deserialize Response
|
378
|
+
if status_code == 201
|
379
|
+
begin
|
380
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
381
|
+
result_mapper = Endpoint.mapper()
|
382
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
383
|
+
rescue Exception => e
|
384
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
result
|
389
|
+
end
|
390
|
+
|
391
|
+
promise.execute
|
392
|
+
end
|
393
|
+
|
394
|
+
#
|
395
|
+
# Deletes a Traffic Manager endpoint.
|
396
|
+
#
|
397
|
+
# @param resource_group_name [String] The name of the resource group
|
398
|
+
# containing the Traffic Manager endpoint to be deleted.
|
399
|
+
# @param profile_name [String] The name of the Traffic Manager profile.
|
400
|
+
# @param endpoint_type [String] The type of the Traffic Manager endpoint to be
|
401
|
+
# deleted.
|
402
|
+
# @param endpoint_name [String] The name of the Traffic Manager endpoint to be
|
403
|
+
# deleted.
|
404
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
405
|
+
# will be added to the HTTP request.
|
406
|
+
#
|
407
|
+
#
|
408
|
+
def delete(resource_group_name, profile_name, endpoint_type, endpoint_name, custom_headers = nil)
|
409
|
+
response = delete_async(resource_group_name, profile_name, endpoint_type, endpoint_name, custom_headers).value!
|
410
|
+
nil
|
411
|
+
end
|
412
|
+
|
413
|
+
#
|
414
|
+
# Deletes a Traffic Manager endpoint.
|
415
|
+
#
|
416
|
+
# @param resource_group_name [String] The name of the resource group
|
417
|
+
# containing the Traffic Manager endpoint to be deleted.
|
418
|
+
# @param profile_name [String] The name of the Traffic Manager profile.
|
419
|
+
# @param endpoint_type [String] The type of the Traffic Manager endpoint to be
|
420
|
+
# deleted.
|
421
|
+
# @param endpoint_name [String] The name of the Traffic Manager endpoint to be
|
422
|
+
# deleted.
|
423
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
424
|
+
# will be added to the HTTP request.
|
425
|
+
#
|
426
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
427
|
+
#
|
428
|
+
def delete_with_http_info(resource_group_name, profile_name, endpoint_type, endpoint_name, custom_headers = nil)
|
429
|
+
delete_async(resource_group_name, profile_name, endpoint_type, endpoint_name, custom_headers).value!
|
430
|
+
end
|
431
|
+
|
432
|
+
#
|
433
|
+
# Deletes a Traffic Manager endpoint.
|
434
|
+
#
|
435
|
+
# @param resource_group_name [String] The name of the resource group
|
436
|
+
# containing the Traffic Manager endpoint to be deleted.
|
437
|
+
# @param profile_name [String] The name of the Traffic Manager profile.
|
438
|
+
# @param endpoint_type [String] The type of the Traffic Manager endpoint to be
|
439
|
+
# deleted.
|
440
|
+
# @param endpoint_name [String] The name of the Traffic Manager endpoint to be
|
441
|
+
# deleted.
|
442
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
443
|
+
# to the HTTP request.
|
444
|
+
#
|
445
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
446
|
+
#
|
447
|
+
def delete_async(resource_group_name, profile_name, endpoint_type, endpoint_name, custom_headers = nil)
|
448
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
449
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
450
|
+
fail ArgumentError, 'endpoint_type is nil' if endpoint_type.nil?
|
451
|
+
fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
|
452
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
453
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
454
|
+
|
455
|
+
|
456
|
+
request_headers = {}
|
457
|
+
|
458
|
+
# Set Headers
|
459
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
460
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
461
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}'
|
462
|
+
options = {
|
463
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
464
|
+
path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'endpointType' => endpoint_type,'endpointName' => endpoint_name,'subscriptionId' => @client.subscription_id},
|
465
|
+
query_params: {'api-version' => @client.api_version},
|
466
|
+
headers: request_headers.merge(custom_headers || {})
|
467
|
+
}
|
468
|
+
|
469
|
+
request_url = @base_url || @client.base_url
|
470
|
+
|
471
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
|
472
|
+
promise = request.run_promise do |req|
|
473
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
474
|
+
end
|
475
|
+
|
476
|
+
promise = promise.then do |http_response|
|
477
|
+
status_code = http_response.status
|
478
|
+
response_content = http_response.body
|
479
|
+
unless status_code == 200 || status_code == 204
|
480
|
+
error_model = JSON.load(response_content)
|
481
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
482
|
+
end
|
483
|
+
|
484
|
+
# Create Result
|
485
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
486
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
487
|
+
|
488
|
+
result
|
489
|
+
end
|
490
|
+
|
491
|
+
promise.execute
|
492
|
+
end
|
493
|
+
|
494
|
+
end
|
495
|
+
end
|