azure_mgmt_cdn 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +13 -5
  2. data/azure_mgmt_cdn.gemspec +1 -1
  3. data/lib/azure_mgmt_cdn.rb +2 -3
  4. data/lib/azure_mgmt_cdn/cdn_management_client.rb +5 -5
  5. data/lib/azure_mgmt_cdn/custom_domains.rb +293 -72
  6. data/lib/azure_mgmt_cdn/endpoints.rb +573 -142
  7. data/lib/azure_mgmt_cdn/models/check_name_availability_input.rb +3 -3
  8. data/lib/azure_mgmt_cdn/models/check_name_availability_output.rb +6 -6
  9. data/lib/azure_mgmt_cdn/models/custom_domain.rb +3 -3
  10. data/lib/azure_mgmt_cdn/models/custom_domain_list_result.rb +1 -1
  11. data/lib/azure_mgmt_cdn/models/custom_domain_parameters.rb +2 -2
  12. data/lib/azure_mgmt_cdn/models/custom_domain_properties.rb +3 -2
  13. data/lib/azure_mgmt_cdn/models/custom_domain_properties_parameters.rb +3 -2
  14. data/lib/azure_mgmt_cdn/models/custom_domain_resource_state.rb +1 -1
  15. data/lib/azure_mgmt_cdn/models/deep_created_origin.rb +2 -2
  16. data/lib/azure_mgmt_cdn/models/deep_created_origin_properties.rb +6 -5
  17. data/lib/azure_mgmt_cdn/models/endpoint.rb +3 -3
  18. data/lib/azure_mgmt_cdn/models/endpoint_create_parameters.rb +2 -2
  19. data/lib/azure_mgmt_cdn/models/endpoint_list_result.rb +2 -2
  20. data/lib/azure_mgmt_cdn/models/endpoint_properties.rb +12 -12
  21. data/lib/azure_mgmt_cdn/models/endpoint_properties_create_parameters.rb +15 -14
  22. data/lib/azure_mgmt_cdn/models/endpoint_properties_update_parameters.rb +16 -15
  23. data/lib/azure_mgmt_cdn/models/endpoint_resource_state.rb +1 -1
  24. data/lib/azure_mgmt_cdn/models/endpoint_update_parameters.rb +2 -2
  25. data/lib/azure_mgmt_cdn/models/error_response.rb +2 -2
  26. data/lib/azure_mgmt_cdn/models/load_parameters.rb +3 -3
  27. data/lib/azure_mgmt_cdn/models/operation.rb +1 -1
  28. data/lib/azure_mgmt_cdn/models/operation_display.rb +3 -3
  29. data/lib/azure_mgmt_cdn/models/operation_list_result.rb +3 -3
  30. data/lib/azure_mgmt_cdn/models/origin.rb +4 -4
  31. data/lib/azure_mgmt_cdn/models/origin_list_result.rb +1 -1
  32. data/lib/azure_mgmt_cdn/models/origin_parameters.rb +2 -2
  33. data/lib/azure_mgmt_cdn/models/origin_properties.rb +7 -6
  34. data/lib/azure_mgmt_cdn/models/origin_properties_parameters.rb +7 -6
  35. data/lib/azure_mgmt_cdn/models/origin_resource_state.rb +1 -1
  36. data/lib/azure_mgmt_cdn/models/profile.rb +17 -1
  37. data/lib/azure_mgmt_cdn/models/profile_create_parameters.rb +18 -17
  38. data/lib/azure_mgmt_cdn/models/profile_list_result.rb +2 -2
  39. data/lib/azure_mgmt_cdn/models/profile_properties.rb +1 -17
  40. data/lib/azure_mgmt_cdn/models/profile_resource_state.rb +1 -1
  41. data/lib/azure_mgmt_cdn/models/profile_update_parameters.rb +2 -2
  42. data/lib/azure_mgmt_cdn/models/provisioning_state.rb +1 -1
  43. data/lib/azure_mgmt_cdn/models/purge_parameters.rb +3 -3
  44. data/lib/azure_mgmt_cdn/models/query_string_caching_behavior.rb +1 -1
  45. data/lib/azure_mgmt_cdn/models/resource_type.rb +1 -1
  46. data/lib/azure_mgmt_cdn/models/sku.rb +5 -4
  47. data/lib/azure_mgmt_cdn/models/sku_name.rb +5 -3
  48. data/lib/azure_mgmt_cdn/models/sso_uri.rb +3 -3
  49. data/lib/azure_mgmt_cdn/models/tracked_resource.rb +1 -1
  50. data/lib/azure_mgmt_cdn/models/validate_custom_domain_input.rb +4 -3
  51. data/lib/azure_mgmt_cdn/models/validate_custom_domain_output.rb +6 -5
  52. data/lib/azure_mgmt_cdn/module_definition.rb +1 -1
  53. data/lib/azure_mgmt_cdn/name_availability.rb +47 -12
  54. data/lib/azure_mgmt_cdn/operations.rb +34 -7
  55. data/lib/azure_mgmt_cdn/origins.rb +296 -79
  56. data/lib/azure_mgmt_cdn/profiles.rb +358 -84
  57. data/lib/azure_mgmt_cdn/version.rb +2 -2
  58. metadata +25 -21
  59. data/lib/azure_mgmt_cdn/models/profile_properties_create_parameters.rb +0 -63
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -27,15 +27,39 @@ module Azure::ARM::CDN
27
27
  attr_reader :client
28
28
 
29
29
  #
30
- # Lists the CDN Profiles within an Azure subscitption
30
+ # Lists the CDN profiles within an Azure subscitption.
31
31
  #
32
- # @param [Hash{String => String}] The hash of custom headers need to be
33
- # applied to HTTP request.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
34
  #
35
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
36
- # response.
35
+ # @return [ProfileListResult] operation results.
37
36
  #
38
37
  def list_by_subscription_id(custom_headers = nil)
38
+ response = list_by_subscription_id_async(custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # Lists the CDN profiles within an Azure subscitption.
44
+ #
45
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
46
+ # will be added to the HTTP request.
47
+ #
48
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
49
+ #
50
+ def list_by_subscription_id_with_http_info(custom_headers = nil)
51
+ list_by_subscription_id_async(custom_headers).value!
52
+ end
53
+
54
+ #
55
+ # Lists the CDN profiles within an Azure subscitption.
56
+ #
57
+ # @param [Hash{String => String}] A hash of custom headers that will be added
58
+ # to the HTTP request.
59
+ #
60
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
61
+ #
62
+ def list_by_subscription_id_async(custom_headers = nil)
39
63
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
40
64
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
41
65
  request_headers = {}
@@ -50,7 +74,10 @@ module Azure::ARM::CDN
50
74
  query_params: {'api-version' => @client.api_version},
51
75
  headers: request_headers.merge(custom_headers || {})
52
76
  }
53
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
77
+
78
+ request_url = @base_url || @client.base_url
79
+
80
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
54
81
  promise = request.run_promise do |req|
55
82
  @client.credentials.sign_request(req) unless @client.credentials.nil?
56
83
  end
@@ -86,17 +113,45 @@ module Azure::ARM::CDN
86
113
  end
87
114
 
88
115
  #
89
- # Lists the CDN Profiles within a resource group
116
+ # Lists the CDN profiles within a resource group.
90
117
  #
91
118
  # @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.
119
+ # Azure subscription.
120
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
121
+ # will be added to the HTTP request.
95
122
  #
96
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
97
- # response.
123
+ # @return [ProfileListResult] operation results.
98
124
  #
99
125
  def list_by_resource_group(resource_group_name, custom_headers = nil)
126
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
127
+ response.body unless response.nil?
128
+ end
129
+
130
+ #
131
+ # Lists the CDN profiles within a resource group.
132
+ #
133
+ # @param resource_group_name [String] Name of the resource group within the
134
+ # Azure subscription.
135
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
136
+ # will be added to the HTTP request.
137
+ #
138
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
139
+ #
140
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
141
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
142
+ end
143
+
144
+ #
145
+ # Lists the CDN profiles within a resource group.
146
+ #
147
+ # @param resource_group_name [String] Name of the resource group within the
148
+ # Azure subscription.
149
+ # @param [Hash{String => String}] A hash of custom headers that will be added
150
+ # to the HTTP request.
151
+ #
152
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
153
+ #
154
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
100
155
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
101
156
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
102
157
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
@@ -112,7 +167,10 @@ module Azure::ARM::CDN
112
167
  query_params: {'api-version' => @client.api_version},
113
168
  headers: request_headers.merge(custom_headers || {})
114
169
  }
115
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
170
+
171
+ request_url = @base_url || @client.base_url
172
+
173
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
116
174
  promise = request.run_promise do |req|
117
175
  @client.credentials.sign_request(req) unless @client.credentials.nil?
118
176
  end
@@ -148,19 +206,51 @@ module Azure::ARM::CDN
148
206
  end
149
207
 
150
208
  #
151
- # Gets a CDN profile with the specified parameters
209
+ # Gets a CDN profile with the specified parameters.
152
210
  #
153
211
  # @param profile_name [String] Name of the CDN profile within the resource
154
- # group
212
+ # group.
155
213
  # @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.
214
+ # Azure subscription.
215
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
216
+ # will be added to the HTTP request.
159
217
  #
160
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
161
- # response.
218
+ # @return [Profile] operation results.
162
219
  #
163
220
  def get(profile_name, resource_group_name, custom_headers = nil)
221
+ response = get_async(profile_name, resource_group_name, custom_headers).value!
222
+ response.body unless response.nil?
223
+ end
224
+
225
+ #
226
+ # Gets a CDN profile with the specified parameters.
227
+ #
228
+ # @param profile_name [String] Name of the CDN profile within the resource
229
+ # group.
230
+ # @param resource_group_name [String] Name of the resource group within the
231
+ # Azure subscription.
232
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
233
+ # will be added to the HTTP request.
234
+ #
235
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
236
+ #
237
+ def get_with_http_info(profile_name, resource_group_name, custom_headers = nil)
238
+ get_async(profile_name, resource_group_name, custom_headers).value!
239
+ end
240
+
241
+ #
242
+ # Gets a CDN profile with the specified parameters.
243
+ #
244
+ # @param profile_name [String] Name of the CDN profile within the resource
245
+ # group.
246
+ # @param resource_group_name [String] Name of the resource group within the
247
+ # Azure subscription.
248
+ # @param [Hash{String => String}] A hash of custom headers that will be added
249
+ # to the HTTP request.
250
+ #
251
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
252
+ #
253
+ def get_async(profile_name, resource_group_name, custom_headers = nil)
164
254
  fail ArgumentError, 'profile_name is nil' if profile_name.nil?
165
255
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
166
256
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
@@ -177,7 +267,10 @@ module Azure::ARM::CDN
177
267
  query_params: {'api-version' => @client.api_version},
178
268
  headers: request_headers.merge(custom_headers || {})
179
269
  }
180
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
270
+
271
+ request_url = @base_url || @client.base_url
272
+
273
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
181
274
  promise = request.run_promise do |req|
182
275
  @client.credentials.sign_request(req) unless @client.credentials.nil?
183
276
  end
@@ -213,17 +306,17 @@ module Azure::ARM::CDN
213
306
  end
214
307
 
215
308
  #
216
- # Creates a new CDN Profile with the specified parameters
309
+ # Creates a new CDN profile with the specified parameters.
217
310
  #
218
311
  # @param profile_name [String] Name of the CDN profile within the resource
219
- # group
312
+ # group.
220
313
  # @param profile_properties [ProfileCreateParameters] Profile properties
221
- # needed for creation
314
+ # needed for creation.
222
315
  # @param resource_group_name [String] Name of the resource group within the
223
- # Azure subscription
224
- # @param @client.subscription_id [String] Azure Subscription ID
316
+ # Azure subscription.
317
+ # @param @client.subscription_id [String] Azure Subscription ID.
225
318
  # @param @client.api_version [String] Version of the API to be used with the
226
- # client request, current version is 2015-06-01
319
+ # client request. Current version is 2016-04-02
227
320
  # @param @client.accept_language [String] Gets or sets the preferred language
228
321
  # for the response.
229
322
  #
@@ -232,7 +325,7 @@ module Azure::ARM::CDN
232
325
  #
233
326
  def create(profile_name, profile_properties, resource_group_name, custom_headers = nil)
234
327
  # Send request
235
- promise = begin_create(profile_name, profile_properties, resource_group_name, custom_headers)
328
+ promise = begin_create_async(profile_name, profile_properties, resource_group_name, custom_headers)
236
329
 
237
330
  promise = promise.then do |response|
238
331
  # Defining deserialization method.
@@ -243,28 +336,64 @@ module Azure::ARM::CDN
243
336
  end
244
337
 
245
338
  # Waiting for response.
246
- @client.get_put_operation_result(response, deserialize_method)
339
+ @client.get_long_running_operation_result(response, deserialize_method)
247
340
  end
248
341
 
249
342
  promise
250
343
  end
251
344
 
252
345
  #
253
- # Creates a new CDN Profile with the specified parameters
346
+ # Creates a new CDN profile with the specified parameters.
254
347
  #
255
348
  # @param profile_name [String] Name of the CDN profile within the resource
256
- # group
349
+ # group.
257
350
  # @param profile_properties [ProfileCreateParameters] Profile properties
258
- # needed for creation
351
+ # needed for creation.
259
352
  # @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.
353
+ # Azure subscription.
354
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
355
+ # will be added to the HTTP request.
263
356
  #
264
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
265
- # response.
357
+ # @return [Profile] operation results.
266
358
  #
267
359
  def begin_create(profile_name, profile_properties, resource_group_name, custom_headers = nil)
360
+ response = begin_create_async(profile_name, profile_properties, resource_group_name, custom_headers).value!
361
+ response.body unless response.nil?
362
+ end
363
+
364
+ #
365
+ # Creates a new CDN profile with the specified parameters.
366
+ #
367
+ # @param profile_name [String] Name of the CDN profile within the resource
368
+ # group.
369
+ # @param profile_properties [ProfileCreateParameters] Profile properties
370
+ # needed for creation.
371
+ # @param resource_group_name [String] Name of the resource group within the
372
+ # Azure subscription.
373
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
374
+ # will be added to the HTTP request.
375
+ #
376
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
377
+ #
378
+ def begin_create_with_http_info(profile_name, profile_properties, resource_group_name, custom_headers = nil)
379
+ begin_create_async(profile_name, profile_properties, resource_group_name, custom_headers).value!
380
+ end
381
+
382
+ #
383
+ # Creates a new CDN profile with the specified parameters.
384
+ #
385
+ # @param profile_name [String] Name of the CDN profile within the resource
386
+ # group.
387
+ # @param profile_properties [ProfileCreateParameters] Profile properties
388
+ # needed for creation.
389
+ # @param resource_group_name [String] Name of the resource group within the
390
+ # Azure subscription.
391
+ # @param [Hash{String => String}] A hash of custom headers that will be added
392
+ # to the HTTP request.
393
+ #
394
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
395
+ #
396
+ def begin_create_async(profile_name, profile_properties, resource_group_name, custom_headers = nil)
268
397
  fail ArgumentError, 'profile_name is nil' if profile_name.nil?
269
398
  fail ArgumentError, 'profile_properties is nil' if profile_properties.nil?
270
399
  profile_properties.validate unless profile_properties.nil?
@@ -282,7 +411,7 @@ module Azure::ARM::CDN
282
411
  unless profile_properties.nil?
283
412
  profile_properties = ProfileCreateParameters.serialize_object(profile_properties)
284
413
  end
285
- request_content = JSON.generate(profile_properties, quirks_mode: true)
414
+ request_content = profile_properties != nil ? JSON.generate(profile_properties, quirks_mode: true) : nil
286
415
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'
287
416
  options = {
288
417
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -291,7 +420,10 @@ module Azure::ARM::CDN
291
420
  body: request_content,
292
421
  headers: request_headers.merge(custom_headers || {})
293
422
  }
294
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
423
+
424
+ request_url = @base_url || @client.base_url
425
+
426
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
295
427
  promise = request.run_promise do |req|
296
428
  @client.credentials.sign_request(req) unless @client.credentials.nil?
297
429
  end
@@ -299,7 +431,7 @@ module Azure::ARM::CDN
299
431
  promise = promise.then do |http_response|
300
432
  status_code = http_response.status
301
433
  response_content = http_response.body
302
- unless status_code == 201 || status_code == 202
434
+ unless status_code == 200 || status_code == 201 || status_code == 202
303
435
  error_model = JSON.load(response_content)
304
436
  fail MsRest::HttpOperationError.new(request, http_response, error_model)
305
437
  end
@@ -308,6 +440,18 @@ module Azure::ARM::CDN
308
440
  result = MsRestAzure::AzureOperationResponse.new(request, http_response)
309
441
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
310
442
  # Deserialize Response
443
+ if status_code == 200
444
+ begin
445
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
446
+ unless parsed_response.nil?
447
+ parsed_response = Profile.deserialize_object(parsed_response)
448
+ end
449
+ result.body = parsed_response
450
+ rescue Exception => e
451
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
452
+ end
453
+ end
454
+ # Deserialize Response
311
455
  if status_code == 201
312
456
  begin
313
457
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
@@ -339,17 +483,17 @@ module Azure::ARM::CDN
339
483
  end
340
484
 
341
485
  #
342
- # Updates an existing CDN Profile with the specified parameters
486
+ # Updates an existing CDN profile with the specified parameters.
343
487
  #
344
488
  # @param profile_name [String] Name of the CDN profile within the resource
345
- # group
489
+ # group.
346
490
  # @param profile_properties [ProfileUpdateParameters] Profile properties
347
- # needed for update
491
+ # needed for update.
348
492
  # @param resource_group_name [String] Name of the resource group within the
349
- # Azure subscription
350
- # @param @client.subscription_id [String] Azure Subscription ID
493
+ # Azure subscription.
494
+ # @param @client.subscription_id [String] Azure Subscription ID.
351
495
  # @param @client.api_version [String] Version of the API to be used with the
352
- # client request, current version is 2015-06-01
496
+ # client request. Current version is 2016-04-02
353
497
  # @param @client.accept_language [String] Gets or sets the preferred language
354
498
  # for the response.
355
499
  #
@@ -358,7 +502,7 @@ module Azure::ARM::CDN
358
502
  #
359
503
  def update(profile_name, profile_properties, resource_group_name, custom_headers = nil)
360
504
  # Send request
361
- promise = begin_update(profile_name, profile_properties, resource_group_name, custom_headers)
505
+ promise = begin_update_async(profile_name, profile_properties, resource_group_name, custom_headers)
362
506
 
363
507
  promise = promise.then do |response|
364
508
  # Defining deserialization method.
@@ -369,28 +513,64 @@ module Azure::ARM::CDN
369
513
  end
370
514
 
371
515
  # Waiting for response.
372
- @client.get_put_operation_result(response, deserialize_method)
516
+ @client.get_long_running_operation_result(response, deserialize_method)
373
517
  end
374
518
 
375
519
  promise
376
520
  end
377
521
 
378
522
  #
379
- # Updates an existing CDN Profile with the specified parameters
523
+ # Updates an existing CDN profile with the specified parameters.
380
524
  #
381
525
  # @param profile_name [String] Name of the CDN profile within the resource
382
- # group
526
+ # group.
383
527
  # @param profile_properties [ProfileUpdateParameters] Profile properties
384
- # needed for update
528
+ # needed for update.
385
529
  # @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.
530
+ # Azure subscription.
531
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
532
+ # will be added to the HTTP request.
389
533
  #
390
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
391
- # response.
534
+ # @return [Profile] operation results.
392
535
  #
393
536
  def begin_update(profile_name, profile_properties, resource_group_name, custom_headers = nil)
537
+ response = begin_update_async(profile_name, profile_properties, resource_group_name, custom_headers).value!
538
+ response.body unless response.nil?
539
+ end
540
+
541
+ #
542
+ # Updates an existing CDN profile with the specified parameters.
543
+ #
544
+ # @param profile_name [String] Name of the CDN profile within the resource
545
+ # group.
546
+ # @param profile_properties [ProfileUpdateParameters] Profile properties
547
+ # needed for update.
548
+ # @param resource_group_name [String] Name of the resource group within the
549
+ # Azure subscription.
550
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
551
+ # will be added to the HTTP request.
552
+ #
553
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
554
+ #
555
+ def begin_update_with_http_info(profile_name, profile_properties, resource_group_name, custom_headers = nil)
556
+ begin_update_async(profile_name, profile_properties, resource_group_name, custom_headers).value!
557
+ end
558
+
559
+ #
560
+ # Updates an existing CDN profile with the specified parameters.
561
+ #
562
+ # @param profile_name [String] Name of the CDN profile within the resource
563
+ # group.
564
+ # @param profile_properties [ProfileUpdateParameters] Profile properties
565
+ # needed for update.
566
+ # @param resource_group_name [String] Name of the resource group within the
567
+ # Azure subscription.
568
+ # @param [Hash{String => String}] A hash of custom headers that will be added
569
+ # to the HTTP request.
570
+ #
571
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
572
+ #
573
+ def begin_update_async(profile_name, profile_properties, resource_group_name, custom_headers = nil)
394
574
  fail ArgumentError, 'profile_name is nil' if profile_name.nil?
395
575
  fail ArgumentError, 'profile_properties is nil' if profile_properties.nil?
396
576
  profile_properties.validate unless profile_properties.nil?
@@ -408,7 +588,7 @@ module Azure::ARM::CDN
408
588
  unless profile_properties.nil?
409
589
  profile_properties = ProfileUpdateParameters.serialize_object(profile_properties)
410
590
  end
411
- request_content = JSON.generate(profile_properties, quirks_mode: true)
591
+ request_content = profile_properties != nil ? JSON.generate(profile_properties, quirks_mode: true) : nil
412
592
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'
413
593
  options = {
414
594
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -417,7 +597,10 @@ module Azure::ARM::CDN
417
597
  body: request_content,
418
598
  headers: request_headers.merge(custom_headers || {})
419
599
  }
420
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :patch, options)
600
+
601
+ request_url = @base_url || @client.base_url
602
+
603
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
421
604
  promise = request.run_promise do |req|
422
605
  @client.credentials.sign_request(req) unless @client.credentials.nil?
423
606
  end
@@ -425,7 +608,7 @@ module Azure::ARM::CDN
425
608
  promise = promise.then do |http_response|
426
609
  status_code = http_response.status
427
610
  response_content = http_response.body
428
- unless status_code == 202
611
+ unless status_code == 200 || status_code == 202
429
612
  error_model = JSON.load(response_content)
430
613
  fail MsRest::HttpOperationError.new(request, http_response, error_model)
431
614
  end
@@ -434,6 +617,18 @@ module Azure::ARM::CDN
434
617
  result = MsRestAzure::AzureOperationResponse.new(request, http_response)
435
618
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
436
619
  # Deserialize Response
620
+ if status_code == 200
621
+ begin
622
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
623
+ unless parsed_response.nil?
624
+ parsed_response = Profile.deserialize_object(parsed_response)
625
+ end
626
+ result.body = parsed_response
627
+ rescue Exception => e
628
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
629
+ end
630
+ end
631
+ # Deserialize Response
437
632
  if status_code == 202
438
633
  begin
439
634
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
@@ -453,20 +648,20 @@ module Azure::ARM::CDN
453
648
  end
454
649
 
455
650
  #
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
651
+ # Deletes an existing CDN profile with the specified parameters. Deleting a
652
+ # profile will result in the deletion of all subresources including
653
+ # endpoints, origins and custom domains.
459
654
  #
460
655
  # @param profile_name [String] Name of the CDN profile within the resource
461
- # group
656
+ # group.
462
657
  # @param resource_group_name [String] Name of the resource group within the
463
- # Azure subscription
658
+ # Azure subscription.
464
659
  # @return [Concurrent::Promise] promise which provides async access to http
465
660
  # response.
466
661
  #
467
662
  def delete_if_exists(profile_name, resource_group_name, custom_headers = nil)
468
663
  # Send request
469
- promise = begin_delete_if_exists(profile_name, resource_group_name, custom_headers)
664
+ promise = begin_delete_if_exists_async(profile_name, resource_group_name, custom_headers)
470
665
 
471
666
  promise = promise.then do |response|
472
667
  # Defining deserialization method.
@@ -474,28 +669,63 @@ module Azure::ARM::CDN
474
669
  end
475
670
 
476
671
  # Waiting for response.
477
- @client.get_post_or_delete_operation_result(response, deserialize_method)
672
+ @client.get_long_running_operation_result(response, deserialize_method)
478
673
  end
479
674
 
480
675
  promise
481
676
  end
482
677
 
483
678
  #
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
679
+ # Deletes an existing CDN profile with the specified parameters. Deleting a
680
+ # profile will result in the deletion of all subresources including
681
+ # endpoints, origins and custom domains.
487
682
  #
488
683
  # @param profile_name [String] Name of the CDN profile within the resource
489
- # group
684
+ # group.
490
685
  # @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.
686
+ # Azure subscription.
687
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
688
+ # will be added to the HTTP request.
494
689
  #
495
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
496
- # response.
497
690
  #
498
691
  def begin_delete_if_exists(profile_name, resource_group_name, custom_headers = nil)
692
+ response = begin_delete_if_exists_async(profile_name, resource_group_name, custom_headers).value!
693
+ nil
694
+ end
695
+
696
+ #
697
+ # Deletes an existing CDN profile with the specified parameters. Deleting a
698
+ # profile will result in the deletion of all subresources including
699
+ # endpoints, origins and custom domains.
700
+ #
701
+ # @param profile_name [String] Name of the CDN profile within the resource
702
+ # group.
703
+ # @param resource_group_name [String] Name of the resource group within the
704
+ # Azure subscription.
705
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
706
+ # will be added to the HTTP request.
707
+ #
708
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
709
+ #
710
+ def begin_delete_if_exists_with_http_info(profile_name, resource_group_name, custom_headers = nil)
711
+ begin_delete_if_exists_async(profile_name, resource_group_name, custom_headers).value!
712
+ end
713
+
714
+ #
715
+ # Deletes an existing CDN profile with the specified parameters. Deleting a
716
+ # profile will result in the deletion of all subresources including
717
+ # endpoints, origins and custom domains.
718
+ #
719
+ # @param profile_name [String] Name of the CDN profile within the resource
720
+ # group.
721
+ # @param resource_group_name [String] Name of the resource group within the
722
+ # Azure subscription.
723
+ # @param [Hash{String => String}] A hash of custom headers that will be added
724
+ # to the HTTP request.
725
+ #
726
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
727
+ #
728
+ def begin_delete_if_exists_async(profile_name, resource_group_name, custom_headers = nil)
499
729
  fail ArgumentError, 'profile_name is nil' if profile_name.nil?
500
730
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
501
731
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
@@ -512,7 +742,10 @@ module Azure::ARM::CDN
512
742
  query_params: {'api-version' => @client.api_version},
513
743
  headers: request_headers.merge(custom_headers || {})
514
744
  }
515
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
745
+
746
+ request_url = @base_url || @client.base_url
747
+
748
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
516
749
  promise = request.run_promise do |req|
517
750
  @client.credentials.sign_request(req) unless @client.credentials.nil?
518
751
  end
@@ -542,16 +775,54 @@ module Azure::ARM::CDN
542
775
  # approximately every 10 minutes.
543
776
  #
544
777
  # @param profile_name [String] Name of the CDN profile within the resource
545
- # group
778
+ # group.
546
779
  # @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.
780
+ # Azure subscription.
781
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
782
+ # will be added to the HTTP request.
550
783
  #
551
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
552
- # response.
784
+ # @return [SsoUri] operation results.
553
785
  #
554
786
  def generate_sso_uri(profile_name, resource_group_name, custom_headers = nil)
787
+ response = generate_sso_uri_async(profile_name, resource_group_name, custom_headers).value!
788
+ response.body unless response.nil?
789
+ end
790
+
791
+ #
792
+ # Generates a dynamic SSO URI used to sign in to the CDN Supplemental Portal
793
+ # used for advanced management tasks, such as Country Filtering, Advanced
794
+ # HTTP Reports, and Real-time Stats and Alerts. The SSO URI changes
795
+ # approximately every 10 minutes.
796
+ #
797
+ # @param profile_name [String] Name of the CDN profile within the resource
798
+ # group.
799
+ # @param resource_group_name [String] Name of the resource group within the
800
+ # Azure subscription.
801
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
802
+ # will be added to the HTTP request.
803
+ #
804
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
805
+ #
806
+ def generate_sso_uri_with_http_info(profile_name, resource_group_name, custom_headers = nil)
807
+ generate_sso_uri_async(profile_name, resource_group_name, custom_headers).value!
808
+ end
809
+
810
+ #
811
+ # Generates a dynamic SSO URI used to sign in to the CDN Supplemental Portal
812
+ # used for advanced management tasks, such as Country Filtering, Advanced
813
+ # HTTP Reports, and Real-time Stats and Alerts. The SSO URI changes
814
+ # approximately every 10 minutes.
815
+ #
816
+ # @param profile_name [String] Name of the CDN profile within the resource
817
+ # group.
818
+ # @param resource_group_name [String] Name of the resource group within the
819
+ # Azure subscription.
820
+ # @param [Hash{String => String}] A hash of custom headers that will be added
821
+ # to the HTTP request.
822
+ #
823
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
824
+ #
825
+ def generate_sso_uri_async(profile_name, resource_group_name, custom_headers = nil)
555
826
  fail ArgumentError, 'profile_name is nil' if profile_name.nil?
556
827
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
557
828
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
@@ -568,7 +839,10 @@ module Azure::ARM::CDN
568
839
  query_params: {'api-version' => @client.api_version},
569
840
  headers: request_headers.merge(custom_headers || {})
570
841
  }
571
- request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
842
+
843
+ request_url = @base_url || @client.base_url
844
+
845
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
572
846
  promise = request.run_promise do |req|
573
847
  @client.credentials.sign_request(req) unless @client.credentials.nil?
574
848
  end