azure_mgmt_cdn 0.2.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_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,607 @@
|
|
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 Profiles
|
15
|
+
include Azure::ARM::CDN::Models
|
16
|
+
include MsRestAzure
|
17
|
+
|
18
|
+
#
|
19
|
+
# Creates and initializes a new instance of the Profiles 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 the CDN Profiles within an Azure subscitption
|
31
|
+
#
|
32
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
33
|
+
# applied to HTTP request.
|
34
|
+
#
|
35
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
36
|
+
# response.
|
37
|
+
#
|
38
|
+
def list_by_subscription_id(custom_headers = nil)
|
39
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
40
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
41
|
+
request_headers = {}
|
42
|
+
|
43
|
+
# Set Headers
|
44
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
45
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
46
|
+
path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles'
|
47
|
+
options = {
|
48
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
49
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
50
|
+
query_params: {'api-version' => @client.api_version},
|
51
|
+
headers: request_headers.merge(custom_headers || {})
|
52
|
+
}
|
53
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
54
|
+
promise = request.run_promise do |req|
|
55
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
56
|
+
end
|
57
|
+
|
58
|
+
promise = promise.then do |http_response|
|
59
|
+
status_code = http_response.status
|
60
|
+
response_content = http_response.body
|
61
|
+
unless status_code == 200
|
62
|
+
error_model = JSON.load(response_content)
|
63
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Create Result
|
67
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
68
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
69
|
+
# Deserialize Response
|
70
|
+
if status_code == 200
|
71
|
+
begin
|
72
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
73
|
+
unless parsed_response.nil?
|
74
|
+
parsed_response = ProfileListResult.deserialize_object(parsed_response)
|
75
|
+
end
|
76
|
+
result.body = parsed_response
|
77
|
+
rescue Exception => e
|
78
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
result
|
83
|
+
end
|
84
|
+
|
85
|
+
promise.execute
|
86
|
+
end
|
87
|
+
|
88
|
+
#
|
89
|
+
# Lists the CDN Profiles within a resource group
|
90
|
+
#
|
91
|
+
# @param resource_group_name [String] Name of the resource group within the
|
92
|
+
# Azure subscription
|
93
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
94
|
+
# applied to HTTP request.
|
95
|
+
#
|
96
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
97
|
+
# response.
|
98
|
+
#
|
99
|
+
def list_by_resource_group(resource_group_name, custom_headers = nil)
|
100
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
101
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
102
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
103
|
+
request_headers = {}
|
104
|
+
|
105
|
+
# Set Headers
|
106
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
107
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
108
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles'
|
109
|
+
options = {
|
110
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
111
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
112
|
+
query_params: {'api-version' => @client.api_version},
|
113
|
+
headers: request_headers.merge(custom_headers || {})
|
114
|
+
}
|
115
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
116
|
+
promise = request.run_promise do |req|
|
117
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
118
|
+
end
|
119
|
+
|
120
|
+
promise = promise.then do |http_response|
|
121
|
+
status_code = http_response.status
|
122
|
+
response_content = http_response.body
|
123
|
+
unless status_code == 200
|
124
|
+
error_model = JSON.load(response_content)
|
125
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Create Result
|
129
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
130
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
131
|
+
# Deserialize Response
|
132
|
+
if status_code == 200
|
133
|
+
begin
|
134
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
135
|
+
unless parsed_response.nil?
|
136
|
+
parsed_response = ProfileListResult.deserialize_object(parsed_response)
|
137
|
+
end
|
138
|
+
result.body = parsed_response
|
139
|
+
rescue Exception => e
|
140
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
result
|
145
|
+
end
|
146
|
+
|
147
|
+
promise.execute
|
148
|
+
end
|
149
|
+
|
150
|
+
#
|
151
|
+
# Gets a CDN profile with the specified parameters
|
152
|
+
#
|
153
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
154
|
+
# group
|
155
|
+
# @param resource_group_name [String] Name of the resource group within the
|
156
|
+
# Azure subscription
|
157
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
158
|
+
# applied to HTTP request.
|
159
|
+
#
|
160
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
161
|
+
# response.
|
162
|
+
#
|
163
|
+
def get(profile_name, resource_group_name, custom_headers = nil)
|
164
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
165
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
166
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
167
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
168
|
+
request_headers = {}
|
169
|
+
|
170
|
+
# Set Headers
|
171
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
172
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
173
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'
|
174
|
+
options = {
|
175
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
176
|
+
path_params: {'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
177
|
+
query_params: {'api-version' => @client.api_version},
|
178
|
+
headers: request_headers.merge(custom_headers || {})
|
179
|
+
}
|
180
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
181
|
+
promise = request.run_promise do |req|
|
182
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
183
|
+
end
|
184
|
+
|
185
|
+
promise = promise.then do |http_response|
|
186
|
+
status_code = http_response.status
|
187
|
+
response_content = http_response.body
|
188
|
+
unless status_code == 200
|
189
|
+
error_model = JSON.load(response_content)
|
190
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
191
|
+
end
|
192
|
+
|
193
|
+
# Create Result
|
194
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
195
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
196
|
+
# Deserialize Response
|
197
|
+
if status_code == 200
|
198
|
+
begin
|
199
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
200
|
+
unless parsed_response.nil?
|
201
|
+
parsed_response = Profile.deserialize_object(parsed_response)
|
202
|
+
end
|
203
|
+
result.body = parsed_response
|
204
|
+
rescue Exception => e
|
205
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
result
|
210
|
+
end
|
211
|
+
|
212
|
+
promise.execute
|
213
|
+
end
|
214
|
+
|
215
|
+
#
|
216
|
+
# Creates a new CDN Profile with the specified parameters
|
217
|
+
#
|
218
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
219
|
+
# group
|
220
|
+
# @param profile_properties [ProfileCreateParameters] Profile properties
|
221
|
+
# needed for creation
|
222
|
+
# @param resource_group_name [String] Name of the resource group within the
|
223
|
+
# Azure subscription
|
224
|
+
# @param @client.subscription_id [String] Azure Subscription ID
|
225
|
+
# @param @client.api_version [String] Version of the API to be used with the
|
226
|
+
# client request, current version is 2015-06-01
|
227
|
+
# @param @client.accept_language [String] Gets or sets the preferred language
|
228
|
+
# for the response.
|
229
|
+
#
|
230
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
231
|
+
# response.
|
232
|
+
#
|
233
|
+
def create(profile_name, profile_properties, resource_group_name, custom_headers = nil)
|
234
|
+
# Send request
|
235
|
+
promise = begin_create(profile_name, profile_properties, resource_group_name, custom_headers)
|
236
|
+
|
237
|
+
promise = promise.then do |response|
|
238
|
+
# Defining deserialization method.
|
239
|
+
deserialize_method = lambda do |parsed_response|
|
240
|
+
unless parsed_response.nil?
|
241
|
+
parsed_response = Profile.deserialize_object(parsed_response)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
# Waiting for response.
|
246
|
+
@client.get_put_operation_result(response, deserialize_method)
|
247
|
+
end
|
248
|
+
|
249
|
+
promise
|
250
|
+
end
|
251
|
+
|
252
|
+
#
|
253
|
+
# Creates a new CDN Profile with the specified parameters
|
254
|
+
#
|
255
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
256
|
+
# group
|
257
|
+
# @param profile_properties [ProfileCreateParameters] Profile properties
|
258
|
+
# needed for creation
|
259
|
+
# @param resource_group_name [String] Name of the resource group within the
|
260
|
+
# Azure subscription
|
261
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
262
|
+
# applied to HTTP request.
|
263
|
+
#
|
264
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
265
|
+
# response.
|
266
|
+
#
|
267
|
+
def begin_create(profile_name, profile_properties, resource_group_name, custom_headers = nil)
|
268
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
269
|
+
fail ArgumentError, 'profile_properties is nil' if profile_properties.nil?
|
270
|
+
profile_properties.validate unless profile_properties.nil?
|
271
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
272
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
273
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
274
|
+
request_headers = {}
|
275
|
+
|
276
|
+
# Set Headers
|
277
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
278
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
279
|
+
|
280
|
+
# Serialize Request
|
281
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
282
|
+
unless profile_properties.nil?
|
283
|
+
profile_properties = ProfileCreateParameters.serialize_object(profile_properties)
|
284
|
+
end
|
285
|
+
request_content = JSON.generate(profile_properties, quirks_mode: true)
|
286
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'
|
287
|
+
options = {
|
288
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
289
|
+
path_params: {'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
290
|
+
query_params: {'api-version' => @client.api_version},
|
291
|
+
body: request_content,
|
292
|
+
headers: request_headers.merge(custom_headers || {})
|
293
|
+
}
|
294
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
|
295
|
+
promise = request.run_promise do |req|
|
296
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
297
|
+
end
|
298
|
+
|
299
|
+
promise = promise.then do |http_response|
|
300
|
+
status_code = http_response.status
|
301
|
+
response_content = http_response.body
|
302
|
+
unless status_code == 201 || status_code == 202
|
303
|
+
error_model = JSON.load(response_content)
|
304
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
305
|
+
end
|
306
|
+
|
307
|
+
# Create Result
|
308
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
309
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
310
|
+
# Deserialize Response
|
311
|
+
if status_code == 201
|
312
|
+
begin
|
313
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
314
|
+
unless parsed_response.nil?
|
315
|
+
parsed_response = Profile.deserialize_object(parsed_response)
|
316
|
+
end
|
317
|
+
result.body = parsed_response
|
318
|
+
rescue Exception => e
|
319
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
320
|
+
end
|
321
|
+
end
|
322
|
+
# Deserialize Response
|
323
|
+
if status_code == 202
|
324
|
+
begin
|
325
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
326
|
+
unless parsed_response.nil?
|
327
|
+
parsed_response = Profile.deserialize_object(parsed_response)
|
328
|
+
end
|
329
|
+
result.body = parsed_response
|
330
|
+
rescue Exception => e
|
331
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
result
|
336
|
+
end
|
337
|
+
|
338
|
+
promise.execute
|
339
|
+
end
|
340
|
+
|
341
|
+
#
|
342
|
+
# Updates an existing CDN Profile with the specified parameters
|
343
|
+
#
|
344
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
345
|
+
# group
|
346
|
+
# @param profile_properties [ProfileUpdateParameters] Profile properties
|
347
|
+
# needed for update
|
348
|
+
# @param resource_group_name [String] Name of the resource group within the
|
349
|
+
# Azure subscription
|
350
|
+
# @param @client.subscription_id [String] Azure Subscription ID
|
351
|
+
# @param @client.api_version [String] Version of the API to be used with the
|
352
|
+
# client request, current version is 2015-06-01
|
353
|
+
# @param @client.accept_language [String] Gets or sets the preferred language
|
354
|
+
# for the response.
|
355
|
+
#
|
356
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
357
|
+
# response.
|
358
|
+
#
|
359
|
+
def update(profile_name, profile_properties, resource_group_name, custom_headers = nil)
|
360
|
+
# Send request
|
361
|
+
promise = begin_update(profile_name, profile_properties, resource_group_name, custom_headers)
|
362
|
+
|
363
|
+
promise = promise.then do |response|
|
364
|
+
# Defining deserialization method.
|
365
|
+
deserialize_method = lambda do |parsed_response|
|
366
|
+
unless parsed_response.nil?
|
367
|
+
parsed_response = Profile.deserialize_object(parsed_response)
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
# Waiting for response.
|
372
|
+
@client.get_put_operation_result(response, deserialize_method)
|
373
|
+
end
|
374
|
+
|
375
|
+
promise
|
376
|
+
end
|
377
|
+
|
378
|
+
#
|
379
|
+
# Updates an existing CDN Profile with the specified parameters
|
380
|
+
#
|
381
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
382
|
+
# group
|
383
|
+
# @param profile_properties [ProfileUpdateParameters] Profile properties
|
384
|
+
# needed for update
|
385
|
+
# @param resource_group_name [String] Name of the resource group within the
|
386
|
+
# Azure subscription
|
387
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
388
|
+
# applied to HTTP request.
|
389
|
+
#
|
390
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
391
|
+
# response.
|
392
|
+
#
|
393
|
+
def begin_update(profile_name, profile_properties, resource_group_name, custom_headers = nil)
|
394
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
395
|
+
fail ArgumentError, 'profile_properties is nil' if profile_properties.nil?
|
396
|
+
profile_properties.validate unless profile_properties.nil?
|
397
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
398
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
399
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
400
|
+
request_headers = {}
|
401
|
+
|
402
|
+
# Set Headers
|
403
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
404
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
405
|
+
|
406
|
+
# Serialize Request
|
407
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
408
|
+
unless profile_properties.nil?
|
409
|
+
profile_properties = ProfileUpdateParameters.serialize_object(profile_properties)
|
410
|
+
end
|
411
|
+
request_content = JSON.generate(profile_properties, quirks_mode: true)
|
412
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'
|
413
|
+
options = {
|
414
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
415
|
+
path_params: {'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
416
|
+
query_params: {'api-version' => @client.api_version},
|
417
|
+
body: request_content,
|
418
|
+
headers: request_headers.merge(custom_headers || {})
|
419
|
+
}
|
420
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :patch, options)
|
421
|
+
promise = request.run_promise do |req|
|
422
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
423
|
+
end
|
424
|
+
|
425
|
+
promise = promise.then do |http_response|
|
426
|
+
status_code = http_response.status
|
427
|
+
response_content = http_response.body
|
428
|
+
unless status_code == 202
|
429
|
+
error_model = JSON.load(response_content)
|
430
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
431
|
+
end
|
432
|
+
|
433
|
+
# Create Result
|
434
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
435
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
436
|
+
# Deserialize Response
|
437
|
+
if status_code == 202
|
438
|
+
begin
|
439
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
440
|
+
unless parsed_response.nil?
|
441
|
+
parsed_response = Profile.deserialize_object(parsed_response)
|
442
|
+
end
|
443
|
+
result.body = parsed_response
|
444
|
+
rescue Exception => e
|
445
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
446
|
+
end
|
447
|
+
end
|
448
|
+
|
449
|
+
result
|
450
|
+
end
|
451
|
+
|
452
|
+
promise.execute
|
453
|
+
end
|
454
|
+
|
455
|
+
#
|
456
|
+
# Deletes an existing CDN Profile with the specified parameters. Deleting a
|
457
|
+
# profile will result in the deletion of all sub resources including
|
458
|
+
# endpoints, origins and CustomDomains
|
459
|
+
#
|
460
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
461
|
+
# group
|
462
|
+
# @param resource_group_name [String] Name of the resource group within the
|
463
|
+
# Azure subscription
|
464
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
465
|
+
# response.
|
466
|
+
#
|
467
|
+
def delete_if_exists(profile_name, resource_group_name, custom_headers = nil)
|
468
|
+
# Send request
|
469
|
+
promise = begin_delete_if_exists(profile_name, resource_group_name, custom_headers)
|
470
|
+
|
471
|
+
promise = promise.then do |response|
|
472
|
+
# Defining deserialization method.
|
473
|
+
deserialize_method = lambda do |parsed_response|
|
474
|
+
end
|
475
|
+
|
476
|
+
# Waiting for response.
|
477
|
+
@client.get_post_or_delete_operation_result(response, deserialize_method)
|
478
|
+
end
|
479
|
+
|
480
|
+
promise
|
481
|
+
end
|
482
|
+
|
483
|
+
#
|
484
|
+
# Deletes an existing CDN Profile with the specified parameters. Deleting a
|
485
|
+
# profile will result in the deletion of all sub resources including
|
486
|
+
# endpoints, origins and CustomDomains
|
487
|
+
#
|
488
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
489
|
+
# group
|
490
|
+
# @param resource_group_name [String] Name of the resource group within the
|
491
|
+
# Azure subscription
|
492
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
493
|
+
# applied to HTTP request.
|
494
|
+
#
|
495
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
496
|
+
# response.
|
497
|
+
#
|
498
|
+
def begin_delete_if_exists(profile_name, resource_group_name, custom_headers = nil)
|
499
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
500
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
501
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
502
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
503
|
+
request_headers = {}
|
504
|
+
|
505
|
+
# Set Headers
|
506
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
507
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
508
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'
|
509
|
+
options = {
|
510
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
511
|
+
path_params: {'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
512
|
+
query_params: {'api-version' => @client.api_version},
|
513
|
+
headers: request_headers.merge(custom_headers || {})
|
514
|
+
}
|
515
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
|
516
|
+
promise = request.run_promise do |req|
|
517
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
518
|
+
end
|
519
|
+
|
520
|
+
promise = promise.then do |http_response|
|
521
|
+
status_code = http_response.status
|
522
|
+
response_content = http_response.body
|
523
|
+
unless status_code == 202 || status_code == 204
|
524
|
+
error_model = JSON.load(response_content)
|
525
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
526
|
+
end
|
527
|
+
|
528
|
+
# Create Result
|
529
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
530
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
531
|
+
|
532
|
+
result
|
533
|
+
end
|
534
|
+
|
535
|
+
promise.execute
|
536
|
+
end
|
537
|
+
|
538
|
+
#
|
539
|
+
# Generates a dynamic SSO URI used to sign in to the CDN Supplemental Portal
|
540
|
+
# used for advanced management tasks, such as Country Filtering, Advanced
|
541
|
+
# HTTP Reports, and Real-time Stats and Alerts. The SSO URI changes
|
542
|
+
# approximately every 10 minutes.
|
543
|
+
#
|
544
|
+
# @param profile_name [String] Name of the CDN profile within the resource
|
545
|
+
# group
|
546
|
+
# @param resource_group_name [String] Name of the resource group within the
|
547
|
+
# Azure subscription
|
548
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
549
|
+
# applied to HTTP request.
|
550
|
+
#
|
551
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
552
|
+
# response.
|
553
|
+
#
|
554
|
+
def generate_sso_uri(profile_name, resource_group_name, custom_headers = nil)
|
555
|
+
fail ArgumentError, 'profile_name is nil' if profile_name.nil?
|
556
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
557
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
558
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
559
|
+
request_headers = {}
|
560
|
+
|
561
|
+
# Set Headers
|
562
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
563
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
564
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/generateSsoUri'
|
565
|
+
options = {
|
566
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
567
|
+
path_params: {'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
568
|
+
query_params: {'api-version' => @client.api_version},
|
569
|
+
headers: request_headers.merge(custom_headers || {})
|
570
|
+
}
|
571
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
|
572
|
+
promise = request.run_promise do |req|
|
573
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
574
|
+
end
|
575
|
+
|
576
|
+
promise = promise.then do |http_response|
|
577
|
+
status_code = http_response.status
|
578
|
+
response_content = http_response.body
|
579
|
+
unless status_code == 200
|
580
|
+
error_model = JSON.load(response_content)
|
581
|
+
fail MsRest::HttpOperationError.new(request, http_response, error_model)
|
582
|
+
end
|
583
|
+
|
584
|
+
# Create Result
|
585
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
586
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
587
|
+
# Deserialize Response
|
588
|
+
if status_code == 200
|
589
|
+
begin
|
590
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
591
|
+
unless parsed_response.nil?
|
592
|
+
parsed_response = SsoUri.deserialize_object(parsed_response)
|
593
|
+
end
|
594
|
+
result.body = parsed_response
|
595
|
+
rescue Exception => e
|
596
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
597
|
+
end
|
598
|
+
end
|
599
|
+
|
600
|
+
result
|
601
|
+
end
|
602
|
+
|
603
|
+
promise.execute
|
604
|
+
end
|
605
|
+
|
606
|
+
end
|
607
|
+
end
|