azure_mgmt_cdn 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +5 -0
- data/azure_mgmt_cdn.gemspec +34 -0
- data/lib/azure_mgmt_cdn.rb +77 -0
- data/lib/azure_mgmt_cdn/cdn_management_client.rb +87 -0
- data/lib/azure_mgmt_cdn/custom_domains.rb +482 -0
- data/lib/azure_mgmt_cdn/endpoints.rb +940 -0
- data/lib/azure_mgmt_cdn/models/check_name_availability_input.rb +66 -0
- data/lib/azure_mgmt_cdn/models/check_name_availability_output.rb +75 -0
- data/lib/azure_mgmt_cdn/models/custom_domain.rb +82 -0
- data/lib/azure_mgmt_cdn/models/custom_domain_list_result.rb +77 -0
- data/lib/azure_mgmt_cdn/models/custom_domain_parameters.rb +62 -0
- data/lib/azure_mgmt_cdn/models/custom_domain_properties.rb +84 -0
- data/lib/azure_mgmt_cdn/models/custom_domain_properties_parameters.rb +56 -0
- data/lib/azure_mgmt_cdn/models/custom_domain_resource_state.rb +17 -0
- data/lib/azure_mgmt_cdn/models/deep_created_origin.rb +72 -0
- data/lib/azure_mgmt_cdn/models/deep_created_origin_properties.rb +78 -0
- data/lib/azure_mgmt_cdn/models/endpoint.rb +95 -0
- data/lib/azure_mgmt_cdn/models/endpoint_create_parameters.rb +82 -0
- data/lib/azure_mgmt_cdn/models/endpoint_list_result.rb +76 -0
- data/lib/azure_mgmt_cdn/models/endpoint_properties.rb +197 -0
- data/lib/azure_mgmt_cdn/models/endpoint_properties_create_parameters.rb +160 -0
- data/lib/azure_mgmt_cdn/models/endpoint_properties_update_parameters.rb +127 -0
- data/lib/azure_mgmt_cdn/models/endpoint_resource_state.rb +20 -0
- data/lib/azure_mgmt_cdn/models/endpoint_update_parameters.rb +72 -0
- data/lib/azure_mgmt_cdn/models/error_response.rb +65 -0
- data/lib/azure_mgmt_cdn/models/load_parameters.rb +58 -0
- data/lib/azure_mgmt_cdn/models/operation.rb +71 -0
- data/lib/azure_mgmt_cdn/models/operation_display.rb +75 -0
- data/lib/azure_mgmt_cdn/models/operation_list_result.rb +77 -0
- data/lib/azure_mgmt_cdn/models/origin.rb +83 -0
- data/lib/azure_mgmt_cdn/models/origin_list_result.rb +76 -0
- data/lib/azure_mgmt_cdn/models/origin_parameters.rb +62 -0
- data/lib/azure_mgmt_cdn/models/origin_properties.rb +106 -0
- data/lib/azure_mgmt_cdn/models/origin_properties_parameters.rb +78 -0
- data/lib/azure_mgmt_cdn/models/origin_resource_state.rb +17 -0
- data/lib/azure_mgmt_cdn/models/profile.rb +95 -0
- data/lib/azure_mgmt_cdn/models/profile_create_parameters.rb +82 -0
- data/lib/azure_mgmt_cdn/models/profile_list_result.rb +76 -0
- data/lib/azure_mgmt_cdn/models/profile_properties.rb +90 -0
- data/lib/azure_mgmt_cdn/models/profile_properties_create_parameters.rb +63 -0
- data/lib/azure_mgmt_cdn/models/profile_resource_state.rb +18 -0
- data/lib/azure_mgmt_cdn/models/profile_update_parameters.rb +57 -0
- data/lib/azure_mgmt_cdn/models/provisioning_state.rb +17 -0
- data/lib/azure_mgmt_cdn/models/purge_parameters.rb +58 -0
- data/lib/azure_mgmt_cdn/models/query_string_caching_behavior.rb +18 -0
- data/lib/azure_mgmt_cdn/models/sku.rb +60 -0
- data/lib/azure_mgmt_cdn/models/sku_name.rb +16 -0
- data/lib/azure_mgmt_cdn/models/sso_uri.rb +56 -0
- data/lib/azure_mgmt_cdn/models/tracked_resource.rb +85 -0
- data/lib/azure_mgmt_cdn/models/validate_custom_domain_input.rb +56 -0
- data/lib/azure_mgmt_cdn/models/validate_custom_domain_output.rb +75 -0
- data/lib/azure_mgmt_cdn/module_definition.rb +8 -0
- data/lib/azure_mgmt_cdn/name_availability.rb +101 -0
- data/lib/azure_mgmt_cdn/operations.rb +87 -0
- data/lib/azure_mgmt_cdn/origins.rb +533 -0
- data/lib/azure_mgmt_cdn/profiles.rb +607 -0
- data/lib/azure_mgmt_cdn/version.rb +8 -0
- metadata +172 -0
@@ -0,0 +1,940 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::CDN
|
7
|
+
#
|
8
|
+
# Use these APIs to manage Azure CDN resources through the Azure Resource
|
9
|
+
# Manager. You must make sure that requests made to these resources are
|
10
|
+
# secure. For more information, see <a
|
11
|
+
# href="https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx">Authenticating
|
12
|
+
# Azure Resource Manager requests.</a>
|
13
|
+
#
|
14
|
+
class Endpoints
|
15
|
+
include Azure::ARM::CDN::Models
|
16
|
+
include MsRestAzure
|
17
|
+
|
18
|
+
#
|
19
|
+
# Creates and initializes a new instance of the Endpoints class.
|
20
|
+
# @param client service class for accessing basic functionality.
|
21
|
+
#
|
22
|
+
def initialize(client)
|
23
|
+
@client = client
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return reference to the CdnManagementClient
|
27
|
+
attr_reader :client
|
28
|
+
|
29
|
+
#
|
30
|
+
# Lists existing CDN endpoints within a profile
|
31
|
+
#
|
32
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
33
|
+
# group
|
34
|
+
# @param resource_group_name [String] Name of the resource group within the
|
35
|
+
# Azure subscription
|
36
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
37
|
+
# applied to HTTP request.
|
38
|
+
#
|
39
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
40
|
+
# response.
|
41
|
+
#
|
42
|
+
def list_by_profile(profile_name, resource_group_name, custom_headers = nil)
|
43
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
44
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
45
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
46
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
47
|
+
request_headers = {}
|
48
|
+
|
49
|
+
# Set Headers
|
50
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
51
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
52
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints'
|
53
|
+
options = {
|
54
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
55
|
+
path_params: {'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
56
|
+
query_params: {'api-version' => @client.api_version},
|
57
|
+
headers: request_headers.merge(custom_headers || {})
|
58
|
+
}
|
59
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
60
|
+
promise = request.run_promise do |req|
|
61
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
62
|
+
end
|
63
|
+
|
64
|
+
promise = promise.then do |http_response|
|
65
|
+
status_code = http_response.status
|
66
|
+
response_content = http_response.body
|
67
|
+
unless status_code == 200
|
68
|
+
error_model = JSON.load(response_content)
|
69
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Create Result
|
73
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
74
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
75
|
+
# Deserialize Response
|
76
|
+
if status_code == 200
|
77
|
+
begin
|
78
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
79
|
+
unless parsed_response.nil?
|
80
|
+
parsed_response = EndpointListResult.deserialize_object(parsed_response)
|
81
|
+
end
|
82
|
+
result.body = parsed_response
|
83
|
+
rescue Exception => e
|
84
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
result
|
89
|
+
end
|
90
|
+
|
91
|
+
promise.execute
|
92
|
+
end
|
93
|
+
|
94
|
+
#
|
95
|
+
# Gets an existing CDN endpoint with the specified parameters
|
96
|
+
#
|
97
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
98
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
99
|
+
# group
|
100
|
+
# @param resource_group_name [String] Name of the resource group within the
|
101
|
+
# Azure subscription
|
102
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
103
|
+
# applied to HTTP request.
|
104
|
+
#
|
105
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
106
|
+
# response.
|
107
|
+
#
|
108
|
+
def get(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
|
109
|
+
fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
|
110
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
111
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
112
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
113
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
114
|
+
request_headers = {}
|
115
|
+
|
116
|
+
# Set Headers
|
117
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
118
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
119
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
|
120
|
+
options = {
|
121
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
122
|
+
path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
123
|
+
query_params: {'api-version' => @client.api_version},
|
124
|
+
headers: request_headers.merge(custom_headers || {})
|
125
|
+
}
|
126
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
127
|
+
promise = request.run_promise do |req|
|
128
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
129
|
+
end
|
130
|
+
|
131
|
+
promise = promise.then do |http_response|
|
132
|
+
status_code = http_response.status
|
133
|
+
response_content = http_response.body
|
134
|
+
unless status_code == 200
|
135
|
+
error_model = JSON.load(response_content)
|
136
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
137
|
+
end
|
138
|
+
|
139
|
+
# Create Result
|
140
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
141
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
142
|
+
# Deserialize Response
|
143
|
+
if status_code == 200
|
144
|
+
begin
|
145
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
146
|
+
unless parsed_response.nil?
|
147
|
+
parsed_response = Endpoint.deserialize_object(parsed_response)
|
148
|
+
end
|
149
|
+
result.body = parsed_response
|
150
|
+
rescue Exception => e
|
151
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
result
|
156
|
+
end
|
157
|
+
|
158
|
+
promise.execute
|
159
|
+
end
|
160
|
+
|
161
|
+
#
|
162
|
+
# Creates a new CDN endpoint with the specified parameters
|
163
|
+
#
|
164
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
165
|
+
# @param endpoint_properties [EndpointCreateParameters] Endpoint properties
|
166
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
167
|
+
# group
|
168
|
+
# @param resource_group_name [String] Name of the resource group within the
|
169
|
+
# Azure subscription
|
170
|
+
# @param @client.subscription_id [String] Azure Subscription ID
|
171
|
+
# @param @client.api_version [String] Version of the API to be used with the
|
172
|
+
# client request, current version is 2015-06-01
|
173
|
+
# @param @client.accept_language [String] Gets or sets the preferred language
|
174
|
+
# for the response.
|
175
|
+
#
|
176
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
177
|
+
# response.
|
178
|
+
#
|
179
|
+
def create(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
|
180
|
+
# Send request
|
181
|
+
promise = begin_create(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers)
|
182
|
+
|
183
|
+
promise = promise.then do |response|
|
184
|
+
# Defining deserialization method.
|
185
|
+
deserialize_method = lambda do |parsed_response|
|
186
|
+
unless parsed_response.nil?
|
187
|
+
parsed_response = Endpoint.deserialize_object(parsed_response)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Waiting for response.
|
192
|
+
@client.get_put_operation_result(response, deserialize_method)
|
193
|
+
end
|
194
|
+
|
195
|
+
promise
|
196
|
+
end
|
197
|
+
|
198
|
+
#
|
199
|
+
# Creates a new CDN endpoint with the specified parameters
|
200
|
+
#
|
201
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
202
|
+
# @param endpoint_properties [EndpointCreateParameters] Endpoint properties
|
203
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
204
|
+
# group
|
205
|
+
# @param resource_group_name [String] Name of the resource group within the
|
206
|
+
# Azure subscription
|
207
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
208
|
+
# applied to HTTP request.
|
209
|
+
#
|
210
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
211
|
+
# response.
|
212
|
+
#
|
213
|
+
def begin_create(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
|
214
|
+
fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
|
215
|
+
fail ArgumentError, 'endpoint_properties is nil' if endpoint_properties.nil?
|
216
|
+
endpoint_properties.validate unless endpoint_properties.nil?
|
217
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
218
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
219
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
220
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
221
|
+
request_headers = {}
|
222
|
+
|
223
|
+
# Set Headers
|
224
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
225
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
226
|
+
|
227
|
+
# Serialize Request
|
228
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
229
|
+
unless endpoint_properties.nil?
|
230
|
+
endpoint_properties = EndpointCreateParameters.serialize_object(endpoint_properties)
|
231
|
+
end
|
232
|
+
request_content = JSON.generate(endpoint_properties, quirks_mode: true)
|
233
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
|
234
|
+
options = {
|
235
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
236
|
+
path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
237
|
+
query_params: {'api-version' => @client.api_version},
|
238
|
+
body: request_content,
|
239
|
+
headers: request_headers.merge(custom_headers || {})
|
240
|
+
}
|
241
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
|
242
|
+
promise = request.run_promise do |req|
|
243
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
244
|
+
end
|
245
|
+
|
246
|
+
promise = promise.then do |http_response|
|
247
|
+
status_code = http_response.status
|
248
|
+
response_content = http_response.body
|
249
|
+
unless status_code == 201 || status_code == 202
|
250
|
+
error_model = JSON.load(response_content)
|
251
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
252
|
+
end
|
253
|
+
|
254
|
+
# Create Result
|
255
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
256
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
257
|
+
# Deserialize Response
|
258
|
+
if status_code == 201
|
259
|
+
begin
|
260
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
261
|
+
unless parsed_response.nil?
|
262
|
+
parsed_response = Endpoint.deserialize_object(parsed_response)
|
263
|
+
end
|
264
|
+
result.body = parsed_response
|
265
|
+
rescue Exception => e
|
266
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
267
|
+
end
|
268
|
+
end
|
269
|
+
# Deserialize Response
|
270
|
+
if status_code == 202
|
271
|
+
begin
|
272
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
273
|
+
unless parsed_response.nil?
|
274
|
+
parsed_response = Endpoint.deserialize_object(parsed_response)
|
275
|
+
end
|
276
|
+
result.body = parsed_response
|
277
|
+
rescue Exception => e
|
278
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
result
|
283
|
+
end
|
284
|
+
|
285
|
+
promise.execute
|
286
|
+
end
|
287
|
+
|
288
|
+
#
|
289
|
+
# Updates an existing CDN endpoint with the specified parameters. Only tags
|
290
|
+
# and OriginHostHeader can be updated after creating an endpoint. To update
|
291
|
+
# origins, use the Update Origin operation. To update custom domains, use the
|
292
|
+
# Update Custom Domain operation.
|
293
|
+
#
|
294
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
295
|
+
# @param endpoint_properties [EndpointUpdateParameters] Endpoint properties
|
296
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
297
|
+
# group
|
298
|
+
# @param resource_group_name [String] Name of the resource group within the
|
299
|
+
# Azure subscription
|
300
|
+
# @param @client.subscription_id [String] Azure Subscription ID
|
301
|
+
# @param @client.api_version [String] Version of the API to be used with the
|
302
|
+
# client request, current version is 2015-06-01
|
303
|
+
# @param @client.accept_language [String] Gets or sets the preferred language
|
304
|
+
# for the response.
|
305
|
+
#
|
306
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
307
|
+
# response.
|
308
|
+
#
|
309
|
+
def update(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
|
310
|
+
# Send request
|
311
|
+
promise = begin_update(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers)
|
312
|
+
|
313
|
+
promise = promise.then do |response|
|
314
|
+
# Defining deserialization method.
|
315
|
+
deserialize_method = lambda do |parsed_response|
|
316
|
+
unless parsed_response.nil?
|
317
|
+
parsed_response = Endpoint.deserialize_object(parsed_response)
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
# Waiting for response.
|
322
|
+
@client.get_put_operation_result(response, deserialize_method)
|
323
|
+
end
|
324
|
+
|
325
|
+
promise
|
326
|
+
end
|
327
|
+
|
328
|
+
#
|
329
|
+
# Updates an existing CDN endpoint with the specified parameters. Only tags
|
330
|
+
# and OriginHostHeader can be updated after creating an endpoint. To update
|
331
|
+
# origins, use the Update Origin operation. To update custom domains, use the
|
332
|
+
# Update Custom Domain operation.
|
333
|
+
#
|
334
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
335
|
+
# @param endpoint_properties [EndpointUpdateParameters] Endpoint properties
|
336
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
337
|
+
# group
|
338
|
+
# @param resource_group_name [String] Name of the resource group within the
|
339
|
+
# Azure subscription
|
340
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
341
|
+
# applied to HTTP request.
|
342
|
+
#
|
343
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
344
|
+
# response.
|
345
|
+
#
|
346
|
+
def begin_update(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
|
347
|
+
fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
|
348
|
+
fail ArgumentError, 'endpoint_properties is nil' if endpoint_properties.nil?
|
349
|
+
endpoint_properties.validate unless endpoint_properties.nil?
|
350
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
351
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
352
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
353
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
354
|
+
request_headers = {}
|
355
|
+
|
356
|
+
# Set Headers
|
357
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
358
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
359
|
+
|
360
|
+
# Serialize Request
|
361
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
362
|
+
unless endpoint_properties.nil?
|
363
|
+
endpoint_properties = EndpointUpdateParameters.serialize_object(endpoint_properties)
|
364
|
+
end
|
365
|
+
request_content = JSON.generate(endpoint_properties, quirks_mode: true)
|
366
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
|
367
|
+
options = {
|
368
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
369
|
+
path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
370
|
+
query_params: {'api-version' => @client.api_version},
|
371
|
+
body: request_content,
|
372
|
+
headers: request_headers.merge(custom_headers || {})
|
373
|
+
}
|
374
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :patch, options)
|
375
|
+
promise = request.run_promise do |req|
|
376
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
377
|
+
end
|
378
|
+
|
379
|
+
promise = promise.then do |http_response|
|
380
|
+
status_code = http_response.status
|
381
|
+
response_content = http_response.body
|
382
|
+
unless status_code == 200 || status_code == 202
|
383
|
+
error_model = JSON.load(response_content)
|
384
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
385
|
+
end
|
386
|
+
|
387
|
+
# Create Result
|
388
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
389
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
390
|
+
# Deserialize Response
|
391
|
+
if status_code == 200
|
392
|
+
begin
|
393
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
394
|
+
unless parsed_response.nil?
|
395
|
+
parsed_response = Endpoint.deserialize_object(parsed_response)
|
396
|
+
end
|
397
|
+
result.body = parsed_response
|
398
|
+
rescue Exception => e
|
399
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
400
|
+
end
|
401
|
+
end
|
402
|
+
# Deserialize Response
|
403
|
+
if status_code == 202
|
404
|
+
begin
|
405
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
406
|
+
unless parsed_response.nil?
|
407
|
+
parsed_response = Endpoint.deserialize_object(parsed_response)
|
408
|
+
end
|
409
|
+
result.body = parsed_response
|
410
|
+
rescue Exception => e
|
411
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
415
|
+
result
|
416
|
+
end
|
417
|
+
|
418
|
+
promise.execute
|
419
|
+
end
|
420
|
+
|
421
|
+
#
|
422
|
+
# deletes an existing CDN endpoint with the specified parameters
|
423
|
+
#
|
424
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
425
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
426
|
+
# group
|
427
|
+
# @param resource_group_name [String] Name of the resource group within the
|
428
|
+
# Azure subscription
|
429
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
430
|
+
# response.
|
431
|
+
#
|
432
|
+
def delete_if_exists(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
|
433
|
+
# Send request
|
434
|
+
promise = begin_delete_if_exists(endpoint_name, profile_name, resource_group_name, custom_headers)
|
435
|
+
|
436
|
+
promise = promise.then do |response|
|
437
|
+
# Defining deserialization method.
|
438
|
+
deserialize_method = lambda do |parsed_response|
|
439
|
+
end
|
440
|
+
|
441
|
+
# Waiting for response.
|
442
|
+
@client.get_post_or_delete_operation_result(response, deserialize_method)
|
443
|
+
end
|
444
|
+
|
445
|
+
promise
|
446
|
+
end
|
447
|
+
|
448
|
+
#
|
449
|
+
# deletes an existing CDN endpoint with the specified parameters
|
450
|
+
#
|
451
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
452
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
453
|
+
# group
|
454
|
+
# @param resource_group_name [String] Name of the resource group within the
|
455
|
+
# Azure subscription
|
456
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
457
|
+
# applied to HTTP request.
|
458
|
+
#
|
459
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
460
|
+
# response.
|
461
|
+
#
|
462
|
+
def begin_delete_if_exists(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
|
463
|
+
fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
|
464
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
465
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
466
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
467
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
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.Cdn/profiles/{profileName}/endpoints/{endpointName}'
|
474
|
+
options = {
|
475
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
476
|
+
path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
477
|
+
query_params: {'api-version' => @client.api_version},
|
478
|
+
headers: request_headers.merge(custom_headers || {})
|
479
|
+
}
|
480
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
|
481
|
+
promise = request.run_promise do |req|
|
482
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
483
|
+
end
|
484
|
+
|
485
|
+
promise = promise.then do |http_response|
|
486
|
+
status_code = http_response.status
|
487
|
+
response_content = http_response.body
|
488
|
+
unless status_code == 202 || status_code == 204
|
489
|
+
error_model = JSON.load(response_content)
|
490
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
491
|
+
end
|
492
|
+
|
493
|
+
# Create Result
|
494
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
495
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
496
|
+
|
497
|
+
result
|
498
|
+
end
|
499
|
+
|
500
|
+
promise.execute
|
501
|
+
end
|
502
|
+
|
503
|
+
#
|
504
|
+
# Starts an existing stopped CDN endpoint
|
505
|
+
#
|
506
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
507
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
508
|
+
# group
|
509
|
+
# @param resource_group_name [String] Name of the resource group within the
|
510
|
+
# Azure subscription
|
511
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
512
|
+
# response.
|
513
|
+
#
|
514
|
+
def start(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
|
515
|
+
# Send request
|
516
|
+
promise = begin_start(endpoint_name, profile_name, resource_group_name, custom_headers)
|
517
|
+
|
518
|
+
promise = promise.then do |response|
|
519
|
+
# Defining deserialization method.
|
520
|
+
deserialize_method = lambda do |parsed_response|
|
521
|
+
end
|
522
|
+
|
523
|
+
# Waiting for response.
|
524
|
+
@client.get_post_or_delete_operation_result(response, deserialize_method)
|
525
|
+
end
|
526
|
+
|
527
|
+
promise
|
528
|
+
end
|
529
|
+
|
530
|
+
#
|
531
|
+
# Starts an existing stopped CDN endpoint
|
532
|
+
#
|
533
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
534
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
535
|
+
# group
|
536
|
+
# @param resource_group_name [String] Name of the resource group within the
|
537
|
+
# Azure subscription
|
538
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
539
|
+
# applied to HTTP request.
|
540
|
+
#
|
541
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
542
|
+
# response.
|
543
|
+
#
|
544
|
+
def begin_start(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
|
545
|
+
fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
|
546
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
547
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
548
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
549
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
550
|
+
request_headers = {}
|
551
|
+
|
552
|
+
# Set Headers
|
553
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
554
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
555
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start'
|
556
|
+
options = {
|
557
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
558
|
+
path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
559
|
+
query_params: {'api-version' => @client.api_version},
|
560
|
+
headers: request_headers.merge(custom_headers || {})
|
561
|
+
}
|
562
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
|
563
|
+
promise = request.run_promise do |req|
|
564
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
565
|
+
end
|
566
|
+
|
567
|
+
promise = promise.then do |http_response|
|
568
|
+
status_code = http_response.status
|
569
|
+
response_content = http_response.body
|
570
|
+
unless status_code == 202
|
571
|
+
error_model = JSON.load(response_content)
|
572
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
573
|
+
end
|
574
|
+
|
575
|
+
# Create Result
|
576
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
577
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
578
|
+
|
579
|
+
result
|
580
|
+
end
|
581
|
+
|
582
|
+
promise.execute
|
583
|
+
end
|
584
|
+
|
585
|
+
#
|
586
|
+
# Stops an existing running CDN endpoint
|
587
|
+
#
|
588
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
589
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
590
|
+
# group
|
591
|
+
# @param resource_group_name [String] Name of the resource group within the
|
592
|
+
# Azure subscription
|
593
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
594
|
+
# response.
|
595
|
+
#
|
596
|
+
def stop(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
|
597
|
+
# Send request
|
598
|
+
promise = begin_stop(endpoint_name, profile_name, resource_group_name, custom_headers)
|
599
|
+
|
600
|
+
promise = promise.then do |response|
|
601
|
+
# Defining deserialization method.
|
602
|
+
deserialize_method = lambda do |parsed_response|
|
603
|
+
end
|
604
|
+
|
605
|
+
# Waiting for response.
|
606
|
+
@client.get_post_or_delete_operation_result(response, deserialize_method)
|
607
|
+
end
|
608
|
+
|
609
|
+
promise
|
610
|
+
end
|
611
|
+
|
612
|
+
#
|
613
|
+
# Stops an existing running CDN endpoint
|
614
|
+
#
|
615
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
616
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
617
|
+
# group
|
618
|
+
# @param resource_group_name [String] Name of the resource group within the
|
619
|
+
# Azure subscription
|
620
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
621
|
+
# applied to HTTP request.
|
622
|
+
#
|
623
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
624
|
+
# response.
|
625
|
+
#
|
626
|
+
def begin_stop(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
|
627
|
+
fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
|
628
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
629
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
630
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
631
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
632
|
+
request_headers = {}
|
633
|
+
|
634
|
+
# Set Headers
|
635
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
636
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
637
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop'
|
638
|
+
options = {
|
639
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
640
|
+
path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
641
|
+
query_params: {'api-version' => @client.api_version},
|
642
|
+
headers: request_headers.merge(custom_headers || {})
|
643
|
+
}
|
644
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
|
645
|
+
promise = request.run_promise do |req|
|
646
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
647
|
+
end
|
648
|
+
|
649
|
+
promise = promise.then do |http_response|
|
650
|
+
status_code = http_response.status
|
651
|
+
response_content = http_response.body
|
652
|
+
unless status_code == 202
|
653
|
+
error_model = JSON.load(response_content)
|
654
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
655
|
+
end
|
656
|
+
|
657
|
+
# Create Result
|
658
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
659
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
660
|
+
|
661
|
+
result
|
662
|
+
end
|
663
|
+
|
664
|
+
promise.execute
|
665
|
+
end
|
666
|
+
|
667
|
+
#
|
668
|
+
# Forcibly purges CDN endpoint content
|
669
|
+
#
|
670
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
671
|
+
# @param content_file_paths [PurgeParameters] The path to the content to be
|
672
|
+
# purged. Path can describe a file or directory.
|
673
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
674
|
+
# group
|
675
|
+
# @param resource_group_name [String] Name of the resource group within the
|
676
|
+
# Azure subscription
|
677
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
678
|
+
# response.
|
679
|
+
#
|
680
|
+
def purge_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
|
681
|
+
# Send request
|
682
|
+
promise = begin_purge_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers)
|
683
|
+
|
684
|
+
promise = promise.then do |response|
|
685
|
+
# Defining deserialization method.
|
686
|
+
deserialize_method = lambda do |parsed_response|
|
687
|
+
end
|
688
|
+
|
689
|
+
# Waiting for response.
|
690
|
+
@client.get_post_or_delete_operation_result(response, deserialize_method)
|
691
|
+
end
|
692
|
+
|
693
|
+
promise
|
694
|
+
end
|
695
|
+
|
696
|
+
#
|
697
|
+
# Forcibly purges CDN endpoint content
|
698
|
+
#
|
699
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
700
|
+
# @param content_file_paths [PurgeParameters] The path to the content to be
|
701
|
+
# purged. Path can describe a file or directory.
|
702
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
703
|
+
# group
|
704
|
+
# @param resource_group_name [String] Name of the resource group within the
|
705
|
+
# Azure subscription
|
706
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
707
|
+
# applied to HTTP request.
|
708
|
+
#
|
709
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
710
|
+
# response.
|
711
|
+
#
|
712
|
+
def begin_purge_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
|
713
|
+
fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
|
714
|
+
fail ArgumentError, 'content_file_paths is nil' if content_file_paths.nil?
|
715
|
+
content_file_paths.validate unless content_file_paths.nil?
|
716
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
717
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
718
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
719
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
720
|
+
request_headers = {}
|
721
|
+
|
722
|
+
# Set Headers
|
723
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
724
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
725
|
+
|
726
|
+
# Serialize Request
|
727
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
728
|
+
unless content_file_paths.nil?
|
729
|
+
content_file_paths = PurgeParameters.serialize_object(content_file_paths)
|
730
|
+
end
|
731
|
+
request_content = JSON.generate(content_file_paths, quirks_mode: true)
|
732
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge'
|
733
|
+
options = {
|
734
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
735
|
+
path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
736
|
+
query_params: {'api-version' => @client.api_version},
|
737
|
+
body: request_content,
|
738
|
+
headers: request_headers.merge(custom_headers || {})
|
739
|
+
}
|
740
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
|
741
|
+
promise = request.run_promise do |req|
|
742
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
743
|
+
end
|
744
|
+
|
745
|
+
promise = promise.then do |http_response|
|
746
|
+
status_code = http_response.status
|
747
|
+
response_content = http_response.body
|
748
|
+
unless status_code == 202
|
749
|
+
error_model = JSON.load(response_content)
|
750
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
751
|
+
end
|
752
|
+
|
753
|
+
# Create Result
|
754
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
755
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
756
|
+
|
757
|
+
result
|
758
|
+
end
|
759
|
+
|
760
|
+
promise.execute
|
761
|
+
end
|
762
|
+
|
763
|
+
#
|
764
|
+
# Forcibly pre-loads CDN endpoint content
|
765
|
+
#
|
766
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
767
|
+
# @param content_file_paths [LoadParameters] The path to the content to be
|
768
|
+
# loaded. Path should describe a file.
|
769
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
770
|
+
# group
|
771
|
+
# @param resource_group_name [String] Name of the resource group within the
|
772
|
+
# Azure subscription
|
773
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
774
|
+
# response.
|
775
|
+
#
|
776
|
+
def load_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
|
777
|
+
# Send request
|
778
|
+
promise = begin_load_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers)
|
779
|
+
|
780
|
+
promise = promise.then do |response|
|
781
|
+
# Defining deserialization method.
|
782
|
+
deserialize_method = lambda do |parsed_response|
|
783
|
+
end
|
784
|
+
|
785
|
+
# Waiting for response.
|
786
|
+
@client.get_post_or_delete_operation_result(response, deserialize_method)
|
787
|
+
end
|
788
|
+
|
789
|
+
promise
|
790
|
+
end
|
791
|
+
|
792
|
+
#
|
793
|
+
# Forcibly pre-loads CDN endpoint content
|
794
|
+
#
|
795
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
796
|
+
# @param content_file_paths [LoadParameters] The path to the content to be
|
797
|
+
# loaded. Path should describe a file.
|
798
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
799
|
+
# group
|
800
|
+
# @param resource_group_name [String] Name of the resource group within the
|
801
|
+
# Azure subscription
|
802
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
803
|
+
# applied to HTTP request.
|
804
|
+
#
|
805
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
806
|
+
# response.
|
807
|
+
#
|
808
|
+
def begin_load_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
|
809
|
+
fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
|
810
|
+
fail ArgumentError, 'content_file_paths is nil' if content_file_paths.nil?
|
811
|
+
content_file_paths.validate unless content_file_paths.nil?
|
812
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
813
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
814
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
815
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
816
|
+
request_headers = {}
|
817
|
+
|
818
|
+
# Set Headers
|
819
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
820
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
821
|
+
|
822
|
+
# Serialize Request
|
823
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
824
|
+
unless content_file_paths.nil?
|
825
|
+
content_file_paths = LoadParameters.serialize_object(content_file_paths)
|
826
|
+
end
|
827
|
+
request_content = JSON.generate(content_file_paths, quirks_mode: true)
|
828
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load'
|
829
|
+
options = {
|
830
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
831
|
+
path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
832
|
+
query_params: {'api-version' => @client.api_version},
|
833
|
+
body: request_content,
|
834
|
+
headers: request_headers.merge(custom_headers || {})
|
835
|
+
}
|
836
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
|
837
|
+
promise = request.run_promise do |req|
|
838
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
839
|
+
end
|
840
|
+
|
841
|
+
promise = promise.then do |http_response|
|
842
|
+
status_code = http_response.status
|
843
|
+
response_content = http_response.body
|
844
|
+
unless status_code == 202
|
845
|
+
error_model = JSON.load(response_content)
|
846
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
847
|
+
end
|
848
|
+
|
849
|
+
# Create Result
|
850
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
851
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
852
|
+
|
853
|
+
result
|
854
|
+
end
|
855
|
+
|
856
|
+
promise.execute
|
857
|
+
end
|
858
|
+
|
859
|
+
#
|
860
|
+
# Validates a Custom Domain mapping to ensure it maps to the correct CNAME in
|
861
|
+
# DNS
|
862
|
+
#
|
863
|
+
# @param endpoint_name [String] Name of the endpoint within the CDN profile
|
864
|
+
# @param custom_domain_properties [ValidateCustomDomainInput] Custom domain to
|
865
|
+
# validate
|
866
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
867
|
+
# group
|
868
|
+
# @param resource_group_name [String] Name of the resource group within the
|
869
|
+
# Azure subscription
|
870
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
871
|
+
# applied to HTTP request.
|
872
|
+
#
|
873
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
874
|
+
# response.
|
875
|
+
#
|
876
|
+
def validate_custom_domain(endpoint_name, custom_domain_properties, profile_name, resource_group_name, custom_headers = nil)
|
877
|
+
fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
|
878
|
+
fail ArgumentError, 'custom_domain_properties is nil' if custom_domain_properties.nil?
|
879
|
+
custom_domain_properties.validate unless custom_domain_properties.nil?
|
880
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
881
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
882
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
883
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
884
|
+
request_headers = {}
|
885
|
+
|
886
|
+
# Set Headers
|
887
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
888
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
889
|
+
|
890
|
+
# Serialize Request
|
891
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
892
|
+
unless custom_domain_properties.nil?
|
893
|
+
custom_domain_properties = ValidateCustomDomainInput.serialize_object(custom_domain_properties)
|
894
|
+
end
|
895
|
+
request_content = JSON.generate(custom_domain_properties, quirks_mode: true)
|
896
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/validateCustomDomain'
|
897
|
+
options = {
|
898
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
899
|
+
path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
900
|
+
query_params: {'api-version' => @client.api_version},
|
901
|
+
body: request_content,
|
902
|
+
headers: request_headers.merge(custom_headers || {})
|
903
|
+
}
|
904
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
|
905
|
+
promise = request.run_promise do |req|
|
906
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
907
|
+
end
|
908
|
+
|
909
|
+
promise = promise.then do |http_response|
|
910
|
+
status_code = http_response.status
|
911
|
+
response_content = http_response.body
|
912
|
+
unless status_code == 200
|
913
|
+
error_model = JSON.load(response_content)
|
914
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
915
|
+
end
|
916
|
+
|
917
|
+
# Create Result
|
918
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
919
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
920
|
+
# Deserialize Response
|
921
|
+
if status_code == 200
|
922
|
+
begin
|
923
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
924
|
+
unless parsed_response.nil?
|
925
|
+
parsed_response = ValidateCustomDomainOutput.deserialize_object(parsed_response)
|
926
|
+
end
|
927
|
+
result.body = parsed_response
|
928
|
+
rescue Exception => e
|
929
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
930
|
+
end
|
931
|
+
end
|
932
|
+
|
933
|
+
result
|
934
|
+
end
|
935
|
+
|
936
|
+
promise.execute
|
937
|
+
end
|
938
|
+
|
939
|
+
end
|
940
|
+
end
|