azure_mgmt_cdn 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +5 -13
  2. data/azure_mgmt_cdn.gemspec +4 -4
  3. data/lib/azure_mgmt_cdn.rb +3 -76
  4. data/lib/generated/azure_mgmt_cdn.rb +69 -0
  5. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/cdn_management_client.rb +8 -8
  6. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/custom_domains.rb +87 -55
  7. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/endpoints.rb +226 -109
  8. data/lib/generated/azure_mgmt_cdn/models/check_name_availability_input.rb +56 -0
  9. data/lib/generated/azure_mgmt_cdn/models/check_name_availability_output.rb +65 -0
  10. data/lib/generated/azure_mgmt_cdn/models/custom_domain.rb +96 -0
  11. data/lib/generated/azure_mgmt_cdn/models/custom_domain_list_result.rb +53 -0
  12. data/lib/generated/azure_mgmt_cdn/models/custom_domain_parameters.rb +45 -0
  13. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/models/custom_domain_resource_state.rb +0 -0
  14. data/lib/generated/azure_mgmt_cdn/models/deep_created_origin.rb +77 -0
  15. data/lib/generated/azure_mgmt_cdn/models/endpoint.rb +230 -0
  16. data/lib/generated/azure_mgmt_cdn/models/endpoint_create_parameters.rb +173 -0
  17. data/lib/generated/azure_mgmt_cdn/models/endpoint_list_result.rb +52 -0
  18. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/models/endpoint_resource_state.rb +0 -0
  19. data/lib/generated/azure_mgmt_cdn/models/endpoint_update_parameters.rb +143 -0
  20. data/lib/generated/azure_mgmt_cdn/models/error_response.rb +54 -0
  21. data/lib/generated/azure_mgmt_cdn/models/load_parameters.rb +52 -0
  22. data/lib/generated/azure_mgmt_cdn/models/operation.rb +55 -0
  23. data/lib/generated/azure_mgmt_cdn/models/operation_display.rb +65 -0
  24. data/lib/generated/azure_mgmt_cdn/models/operation_list_result.rb +53 -0
  25. data/lib/generated/azure_mgmt_cdn/models/origin.rb +119 -0
  26. data/lib/generated/azure_mgmt_cdn/models/origin_list_result.rb +52 -0
  27. data/lib/generated/azure_mgmt_cdn/models/origin_parameters.rb +67 -0
  28. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/models/origin_resource_state.rb +0 -0
  29. data/lib/generated/azure_mgmt_cdn/models/profile.rb +118 -0
  30. data/lib/generated/azure_mgmt_cdn/models/profile_create_parameters.rb +72 -0
  31. data/lib/generated/azure_mgmt_cdn/models/profile_list_result.rb +52 -0
  32. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/models/profile_resource_state.rb +0 -0
  33. data/lib/generated/azure_mgmt_cdn/models/profile_update_parameters.rb +51 -0
  34. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/models/provisioning_state.rb +0 -0
  35. data/lib/generated/azure_mgmt_cdn/models/purge_parameters.rb +52 -0
  36. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/models/query_string_caching_behavior.rb +0 -0
  37. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/models/resource_type.rb +0 -0
  38. data/lib/generated/azure_mgmt_cdn/models/sku.rb +47 -0
  39. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/models/sku_name.rb +0 -0
  40. data/lib/generated/azure_mgmt_cdn/models/sso_uri.rb +44 -0
  41. data/lib/generated/azure_mgmt_cdn/models/tracked_resource.rb +85 -0
  42. data/lib/generated/azure_mgmt_cdn/models/validate_custom_domain_input.rb +45 -0
  43. data/lib/generated/azure_mgmt_cdn/models/validate_custom_domain_output.rb +66 -0
  44. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/module_definition.rb +0 -0
  45. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/name_availability.rb +10 -10
  46. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/operations.rb +4 -4
  47. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/origins.rb +112 -68
  48. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/profiles.rb +107 -69
  49. data/lib/{azure_mgmt_cdn → generated/azure_mgmt_cdn}/version.rb +1 -1
  50. metadata +67 -80
  51. data/lib/azure_mgmt_cdn/models/check_name_availability_input.rb +0 -71
  52. data/lib/azure_mgmt_cdn/models/check_name_availability_output.rb +0 -75
  53. data/lib/azure_mgmt_cdn/models/custom_domain.rb +0 -82
  54. data/lib/azure_mgmt_cdn/models/custom_domain_list_result.rb +0 -77
  55. data/lib/azure_mgmt_cdn/models/custom_domain_parameters.rb +0 -62
  56. data/lib/azure_mgmt_cdn/models/custom_domain_properties.rb +0 -85
  57. data/lib/azure_mgmt_cdn/models/custom_domain_properties_parameters.rb +0 -57
  58. data/lib/azure_mgmt_cdn/models/deep_created_origin.rb +0 -72
  59. data/lib/azure_mgmt_cdn/models/deep_created_origin_properties.rb +0 -79
  60. data/lib/azure_mgmt_cdn/models/endpoint.rb +0 -95
  61. data/lib/azure_mgmt_cdn/models/endpoint_create_parameters.rb +0 -82
  62. data/lib/azure_mgmt_cdn/models/endpoint_list_result.rb +0 -76
  63. data/lib/azure_mgmt_cdn/models/endpoint_properties.rb +0 -197
  64. data/lib/azure_mgmt_cdn/models/endpoint_properties_create_parameters.rb +0 -161
  65. data/lib/azure_mgmt_cdn/models/endpoint_properties_update_parameters.rb +0 -128
  66. data/lib/azure_mgmt_cdn/models/endpoint_update_parameters.rb +0 -72
  67. data/lib/azure_mgmt_cdn/models/error_response.rb +0 -65
  68. data/lib/azure_mgmt_cdn/models/load_parameters.rb +0 -58
  69. data/lib/azure_mgmt_cdn/models/operation.rb +0 -71
  70. data/lib/azure_mgmt_cdn/models/operation_display.rb +0 -75
  71. data/lib/azure_mgmt_cdn/models/operation_list_result.rb +0 -77
  72. data/lib/azure_mgmt_cdn/models/origin.rb +0 -83
  73. data/lib/azure_mgmt_cdn/models/origin_list_result.rb +0 -76
  74. data/lib/azure_mgmt_cdn/models/origin_parameters.rb +0 -62
  75. data/lib/azure_mgmt_cdn/models/origin_properties.rb +0 -107
  76. data/lib/azure_mgmt_cdn/models/origin_properties_parameters.rb +0 -79
  77. data/lib/azure_mgmt_cdn/models/profile.rb +0 -111
  78. data/lib/azure_mgmt_cdn/models/profile_create_parameters.rb +0 -83
  79. data/lib/azure_mgmt_cdn/models/profile_list_result.rb +0 -76
  80. data/lib/azure_mgmt_cdn/models/profile_properties.rb +0 -74
  81. data/lib/azure_mgmt_cdn/models/profile_update_parameters.rb +0 -57
  82. data/lib/azure_mgmt_cdn/models/purge_parameters.rb +0 -58
  83. data/lib/azure_mgmt_cdn/models/sku.rb +0 -61
  84. data/lib/azure_mgmt_cdn/models/sso_uri.rb +0 -56
  85. data/lib/azure_mgmt_cdn/models/tracked_resource.rb +0 -85
  86. data/lib/azure_mgmt_cdn/models/validate_custom_domain_input.rb +0 -57
  87. data/lib/azure_mgmt_cdn/models/validate_custom_domain_output.rb +0 -76
@@ -0,0 +1,66 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::CDN
7
+ module Models
8
+ #
9
+ # Output of custom domain validation.
10
+ #
11
+ class ValidateCustomDomainOutput
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Boolean] Indicates whether the custom domain is validated or
16
+ # not.
17
+ attr_accessor :custom_domain_validated
18
+
19
+ # @return [String] The reason why the custom domain is not valid.
20
+ attr_accessor :reason
21
+
22
+ # @return [String] The message describing why the custom domain is not
23
+ # valid.
24
+ attr_accessor :message
25
+
26
+
27
+ #
28
+ # Mapper for ValidateCustomDomainOutput class as Ruby Hash.
29
+ # This will be used for serialization/deserialization.
30
+ #
31
+ def self.mapper()
32
+ {
33
+ required: false,
34
+ serialized_name: 'ValidateCustomDomainOutput',
35
+ type: {
36
+ name: 'Composite',
37
+ class_name: 'ValidateCustomDomainOutput',
38
+ model_properties: {
39
+ custom_domain_validated: {
40
+ required: false,
41
+ serialized_name: 'customDomainValidated',
42
+ type: {
43
+ name: 'Boolean'
44
+ }
45
+ },
46
+ reason: {
47
+ required: false,
48
+ serialized_name: 'reason',
49
+ type: {
50
+ name: 'String'
51
+ }
52
+ },
53
+ message: {
54
+ required: false,
55
+ serialized_name: 'message',
56
+ type: {
57
+ name: 'String'
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
63
+ end
64
+ end
65
+ end
66
+ end
@@ -73,20 +73,22 @@ module Azure::ARM::CDN
73
73
  #
74
74
  def check_name_availability_async(check_name_availability_input, custom_headers = nil)
75
75
  fail ArgumentError, 'check_name_availability_input is nil' if check_name_availability_input.nil?
76
- check_name_availability_input.validate unless check_name_availability_input.nil?
77
76
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
77
+
78
+
78
79
  request_headers = {}
79
80
 
80
81
  # Set Headers
81
82
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
82
83
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
83
84
 
84
- # Serialize Request
85
85
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
86
- unless check_name_availability_input.nil?
87
- check_name_availability_input = CheckNameAvailabilityInput.serialize_object(check_name_availability_input)
88
- end
89
- request_content = check_name_availability_input != nil ? JSON.generate(check_name_availability_input, quirks_mode: true) : nil
86
+
87
+ # Serialize Request
88
+ request_mapper = CheckNameAvailabilityInput.mapper()
89
+ request_content = @client.serialize(request_mapper, check_name_availability_input, 'check_name_availability_input')
90
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
91
+
90
92
  path_template = '/providers/Microsoft.Cdn/checkNameAvailability'
91
93
  options = {
92
94
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -117,10 +119,8 @@ module Azure::ARM::CDN
117
119
  if status_code == 200
118
120
  begin
119
121
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
120
- unless parsed_response.nil?
121
- parsed_response = CheckNameAvailabilityOutput.deserialize_object(parsed_response)
122
- end
123
- result.body = parsed_response
122
+ result_mapper = CheckNameAvailabilityOutput.mapper()
123
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
124
124
  rescue Exception => e
125
125
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
126
126
  end
@@ -61,6 +61,8 @@ module Azure::ARM::CDN
61
61
  #
62
62
  def list_async(custom_headers = nil)
63
63
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
64
+
65
+
64
66
  request_headers = {}
65
67
 
66
68
  # Set Headers
@@ -95,10 +97,8 @@ module Azure::ARM::CDN
95
97
  if status_code == 200
96
98
  begin
97
99
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
98
- unless parsed_response.nil?
99
- parsed_response = OperationListResult.deserialize_object(parsed_response)
100
- end
101
- result.body = parsed_response
100
+ result_mapper = OperationListResult.mapper()
101
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
102
102
  rescue Exception => e
103
103
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
104
104
  end
@@ -80,6 +80,8 @@ module Azure::ARM::CDN
80
80
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
81
81
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
82
82
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
83
+
84
+
83
85
  request_headers = {}
84
86
 
85
87
  # Set Headers
@@ -115,10 +117,8 @@ module Azure::ARM::CDN
115
117
  if status_code == 200
116
118
  begin
117
119
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
118
- unless parsed_response.nil?
119
- parsed_response = OriginListResult.deserialize_object(parsed_response)
120
- end
121
- result.body = parsed_response
120
+ result_mapper = OriginListResult.mapper()
121
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
122
122
  rescue Exception => e
123
123
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
124
124
  end
@@ -191,6 +191,8 @@ module Azure::ARM::CDN
191
191
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
192
192
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
193
193
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
194
+
195
+
194
196
  request_headers = {}
195
197
 
196
198
  # Set Headers
@@ -226,10 +228,8 @@ module Azure::ARM::CDN
226
228
  if status_code == 200
227
229
  begin
228
230
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
229
- unless parsed_response.nil?
230
- parsed_response = Origin.deserialize_object(parsed_response)
231
- end
232
- result.body = parsed_response
231
+ result_mapper = Origin.mapper()
232
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
233
233
  rescue Exception => e
234
234
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
235
235
  end
@@ -252,25 +252,40 @@ module Azure::ARM::CDN
252
252
  # group.
253
253
  # @param resource_group_name [String] Name of the resource group within the
254
254
  # Azure subscription.
255
- # @param @client.subscription_id [String] Azure Subscription ID.
256
- # @param @client.api_version [String] Version of the API to be used with the
257
- # client request. Current version is 2016-04-02
258
- # @param @client.accept_language [String] Gets or sets the preferred language
259
- # for the response.
255
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
256
+ # will be added to the HTTP request.
257
+ #
258
+ # @return [Origin] operation results.
259
+ #
260
+ def create(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
261
+ response = create_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers).value!
262
+ response.body unless response.nil?
263
+ end
264
+
265
+ #
266
+ # @param origin_name [String] Name of the origin, an arbitrary value but it
267
+ # needs to be unique under endpoint
268
+ # @param origin_properties [OriginParameters] Origin properties
269
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
270
+ # @param profile_name [String] Name of the CDN profile within the resource
271
+ # group.
272
+ # @param resource_group_name [String] Name of the resource group within the
273
+ # Azure subscription.
274
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
275
+ # will be added to the HTTP request.
260
276
  #
261
277
  # @return [Concurrent::Promise] promise which provides async access to http
262
278
  # response.
263
279
  #
264
- def create(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
280
+ def create_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
265
281
  # Send request
266
282
  promise = begin_create_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers)
267
283
 
268
284
  promise = promise.then do |response|
269
285
  # Defining deserialization method.
270
286
  deserialize_method = lambda do |parsed_response|
271
- unless parsed_response.nil?
272
- parsed_response = Origin.deserialize_object(parsed_response)
273
- end
287
+ result_mapper = Origin.mapper()
288
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
274
289
  end
275
290
 
276
291
  # Waiting for response.
@@ -340,24 +355,26 @@ module Azure::ARM::CDN
340
355
  def begin_create_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
341
356
  fail ArgumentError, 'origin_name is nil' if origin_name.nil?
342
357
  fail ArgumentError, 'origin_properties is nil' if origin_properties.nil?
343
- origin_properties.validate unless origin_properties.nil?
344
358
  fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
345
359
  fail ArgumentError, 'profile_name is nil' if profile_name.nil?
346
360
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
347
361
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
348
362
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
363
+
364
+
349
365
  request_headers = {}
350
366
 
351
367
  # Set Headers
352
368
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
353
369
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
354
370
 
355
- # Serialize Request
356
371
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
357
- unless origin_properties.nil?
358
- origin_properties = OriginParameters.serialize_object(origin_properties)
359
- end
360
- request_content = origin_properties != nil ? JSON.generate(origin_properties, quirks_mode: true) : nil
372
+
373
+ # Serialize Request
374
+ request_mapper = OriginParameters.mapper()
375
+ request_content = @client.serialize(request_mapper, origin_properties, 'origin_properties')
376
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
377
+
361
378
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'
362
379
  options = {
363
380
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -389,10 +406,8 @@ module Azure::ARM::CDN
389
406
  if status_code == 200
390
407
  begin
391
408
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
392
- unless parsed_response.nil?
393
- parsed_response = Origin.deserialize_object(parsed_response)
394
- end
395
- result.body = parsed_response
409
+ result_mapper = Origin.mapper()
410
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
396
411
  rescue Exception => e
397
412
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
398
413
  end
@@ -401,10 +416,8 @@ module Azure::ARM::CDN
401
416
  if status_code == 201
402
417
  begin
403
418
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
404
- unless parsed_response.nil?
405
- parsed_response = Origin.deserialize_object(parsed_response)
406
- end
407
- result.body = parsed_response
419
+ result_mapper = Origin.mapper()
420
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
408
421
  rescue Exception => e
409
422
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
410
423
  end
@@ -413,10 +426,8 @@ module Azure::ARM::CDN
413
426
  if status_code == 202
414
427
  begin
415
428
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
416
- unless parsed_response.nil?
417
- parsed_response = Origin.deserialize_object(parsed_response)
418
- end
419
- result.body = parsed_response
429
+ result_mapper = Origin.mapper()
430
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
420
431
  rescue Exception => e
421
432
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
422
433
  end
@@ -439,25 +450,40 @@ module Azure::ARM::CDN
439
450
  # group.
440
451
  # @param resource_group_name [String] Name of the resource group within the
441
452
  # Azure subscription.
442
- # @param @client.subscription_id [String] Azure Subscription ID.
443
- # @param @client.api_version [String] Version of the API to be used with the
444
- # client request. Current version is 2016-04-02
445
- # @param @client.accept_language [String] Gets or sets the preferred language
446
- # for the response.
453
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
454
+ # will be added to the HTTP request.
455
+ #
456
+ # @return [Origin] operation results.
457
+ #
458
+ def update(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
459
+ response = update_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers).value!
460
+ response.body unless response.nil?
461
+ end
462
+
463
+ #
464
+ # @param origin_name [String] Name of the origin. Must be unique within
465
+ # endpoint.
466
+ # @param origin_properties [OriginParameters] Origin properties
467
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
468
+ # @param profile_name [String] Name of the CDN profile within the resource
469
+ # group.
470
+ # @param resource_group_name [String] Name of the resource group within the
471
+ # Azure subscription.
472
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
473
+ # will be added to the HTTP request.
447
474
  #
448
475
  # @return [Concurrent::Promise] promise which provides async access to http
449
476
  # response.
450
477
  #
451
- def update(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
478
+ def update_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
452
479
  # Send request
453
480
  promise = begin_update_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers)
454
481
 
455
482
  promise = promise.then do |response|
456
483
  # Defining deserialization method.
457
484
  deserialize_method = lambda do |parsed_response|
458
- unless parsed_response.nil?
459
- parsed_response = Origin.deserialize_object(parsed_response)
460
- end
485
+ result_mapper = Origin.mapper()
486
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
461
487
  end
462
488
 
463
489
  # Waiting for response.
@@ -527,24 +553,26 @@ module Azure::ARM::CDN
527
553
  def begin_update_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
528
554
  fail ArgumentError, 'origin_name is nil' if origin_name.nil?
529
555
  fail ArgumentError, 'origin_properties is nil' if origin_properties.nil?
530
- origin_properties.validate unless origin_properties.nil?
531
556
  fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
532
557
  fail ArgumentError, 'profile_name is nil' if profile_name.nil?
533
558
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
534
559
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
535
560
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
561
+
562
+
536
563
  request_headers = {}
537
564
 
538
565
  # Set Headers
539
566
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
540
567
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
541
568
 
542
- # Serialize Request
543
569
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
544
- unless origin_properties.nil?
545
- origin_properties = OriginParameters.serialize_object(origin_properties)
546
- end
547
- request_content = origin_properties != nil ? JSON.generate(origin_properties, quirks_mode: true) : nil
570
+
571
+ # Serialize Request
572
+ request_mapper = OriginParameters.mapper()
573
+ request_content = @client.serialize(request_mapper, origin_properties, 'origin_properties')
574
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
575
+
548
576
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'
549
577
  options = {
550
578
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
@@ -576,10 +604,8 @@ module Azure::ARM::CDN
576
604
  if status_code == 200
577
605
  begin
578
606
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
579
- unless parsed_response.nil?
580
- parsed_response = Origin.deserialize_object(parsed_response)
581
- end
582
- result.body = parsed_response
607
+ result_mapper = Origin.mapper()
608
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
583
609
  rescue Exception => e
584
610
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
585
611
  end
@@ -588,10 +614,8 @@ module Azure::ARM::CDN
588
614
  if status_code == 202
589
615
  begin
590
616
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
591
- unless parsed_response.nil?
592
- parsed_response = Origin.deserialize_object(parsed_response)
593
- end
594
- result.body = parsed_response
617
+ result_mapper = Origin.mapper()
618
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
595
619
  rescue Exception => e
596
620
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
597
621
  end
@@ -613,23 +637,43 @@ module Azure::ARM::CDN
613
637
  # group.
614
638
  # @param resource_group_name [String] Name of the resource group within the
615
639
  # Azure subscription.
640
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
641
+ # will be added to the HTTP request.
642
+ #
643
+ # @return [Origin] operation results.
644
+ #
645
+ def delete_if_exists(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
646
+ response = delete_if_exists_async(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers).value!
647
+ response.body unless response.nil?
648
+ end
649
+
650
+ #
651
+ # @param origin_name [String] Name of the origin. Must be unique within
652
+ # endpoint.
653
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
654
+ # @param profile_name [String] Name of the CDN profile within the resource
655
+ # group.
656
+ # @param resource_group_name [String] Name of the resource group within the
657
+ # Azure subscription.
658
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
659
+ # will be added to the HTTP request.
660
+ #
616
661
  # @return [Concurrent::Promise] promise which provides async access to http
617
662
  # response.
618
663
  #
619
- def delete_if_exists(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
664
+ def delete_if_exists_async(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
620
665
  # Send request
621
666
  promise = begin_delete_if_exists_async(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers)
622
667
 
623
668
  promise = promise.then do |response|
624
669
  # Defining deserialization method.
625
670
  deserialize_method = lambda do |parsed_response|
626
- unless parsed_response.nil?
627
- parsed_response = Origin.deserialize_object(parsed_response)
628
- end
671
+ result_mapper = Origin.mapper()
672
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
629
673
  end
630
674
 
631
- # Waiting for response.
632
- @client.get_long_running_operation_result(response, deserialize_method)
675
+ # Waiting for response.
676
+ @client.get_long_running_operation_result(response, deserialize_method)
633
677
  end
634
678
 
635
679
  promise
@@ -696,6 +740,8 @@ module Azure::ARM::CDN
696
740
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
697
741
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
698
742
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
743
+
744
+
699
745
  request_headers = {}
700
746
 
701
747
  # Set Headers
@@ -731,10 +777,8 @@ module Azure::ARM::CDN
731
777
  if status_code == 202
732
778
  begin
733
779
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
734
- unless parsed_response.nil?
735
- parsed_response = Origin.deserialize_object(parsed_response)
736
- end
737
- result.body = parsed_response
780
+ result_mapper = Origin.mapper()
781
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
738
782
  rescue Exception => e
739
783
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
740
784
  end