azure_mgmt_cdn 0.15.2 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-06-01/generated/azure_mgmt_cdn/cdn_management_client.rb +4 -1
  3. data/lib/2015-06-01/generated/azure_mgmt_cdn/custom_domains.rb +38 -37
  4. data/lib/2015-06-01/generated/azure_mgmt_cdn/endpoints.rb +88 -88
  5. data/lib/2015-06-01/generated/azure_mgmt_cdn/name_availability.rb +6 -7
  6. data/lib/2015-06-01/generated/azure_mgmt_cdn/operations.rb +6 -5
  7. data/lib/2015-06-01/generated/azure_mgmt_cdn/origins.rb +42 -41
  8. data/lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb +54 -51
  9. data/lib/2016-04-02/generated/azure_mgmt_cdn.rb +70 -0
  10. data/lib/2016-04-02/generated/azure_mgmt_cdn/cdn_management_client.rb +151 -0
  11. data/lib/2016-04-02/generated/azure_mgmt_cdn/custom_domains.rb +719 -0
  12. data/lib/2016-04-02/generated/azure_mgmt_cdn/endpoints.rb +1456 -0
  13. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/check_name_availability_input.rb +60 -0
  14. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/check_name_availability_output.rb +69 -0
  15. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/custom_domain.rb +103 -0
  16. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/custom_domain_list_result.rb +57 -0
  17. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/custom_domain_parameters.rb +47 -0
  18. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/custom_domain_resource_state.rb +17 -0
  19. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/deep_created_origin.rb +82 -0
  20. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/endpoint.rb +249 -0
  21. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/endpoint_create_parameters.rb +185 -0
  22. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/endpoint_list_result.rb +56 -0
  23. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/endpoint_resource_state.rb +20 -0
  24. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/endpoint_update_parameters.rb +152 -0
  25. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/error_response.rb +58 -0
  26. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/load_parameters.rb +55 -0
  27. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/operation.rb +58 -0
  28. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/operation_display.rb +70 -0
  29. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/operation_list_result.rb +57 -0
  30. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/origin.rb +128 -0
  31. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/origin_list_result.rb +56 -0
  32. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/origin_parameters.rb +71 -0
  33. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/origin_resource_state.rb +17 -0
  34. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/profile.rb +128 -0
  35. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/profile_create_parameters.rb +77 -0
  36. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/profile_list_result.rb +56 -0
  37. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/profile_resource_state.rb +18 -0
  38. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/profile_update_parameters.rb +54 -0
  39. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/provisioning_state.rb +17 -0
  40. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/purge_parameters.rb +55 -0
  41. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/query_string_caching_behavior.rb +18 -0
  42. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/resource.rb +72 -0
  43. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/resource_type.rb +15 -0
  44. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/sku.rb +49 -0
  45. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/sku_name.rb +18 -0
  46. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/sso_uri.rb +46 -0
  47. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/tracked_resource.rb +92 -0
  48. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/validate_custom_domain_input.rb +47 -0
  49. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/validate_custom_domain_output.rb +70 -0
  50. data/lib/2016-04-02/generated/azure_mgmt_cdn/module_definition.rb +9 -0
  51. data/lib/2016-04-02/generated/azure_mgmt_cdn/name_availability.rb +130 -0
  52. data/lib/2016-04-02/generated/azure_mgmt_cdn/operations.rb +110 -0
  53. data/lib/2016-04-02/generated/azure_mgmt_cdn/origins.rb +778 -0
  54. data/lib/2016-04-02/generated/azure_mgmt_cdn/profiles.rb +899 -0
  55. data/lib/2016-10-02/generated/azure_mgmt_cdn/cdn_management_client.rb +46 -38
  56. data/lib/2016-10-02/generated/azure_mgmt_cdn/custom_domains.rb +53 -48
  57. data/lib/2016-10-02/generated/azure_mgmt_cdn/edge_nodes.rb +15 -13
  58. data/lib/2016-10-02/generated/azure_mgmt_cdn/endpoints.rb +112 -109
  59. data/lib/2016-10-02/generated/azure_mgmt_cdn/origins.rb +31 -29
  60. data/lib/2016-10-02/generated/azure_mgmt_cdn/profiles.rb +93 -85
  61. data/lib/2017-04-02/generated/azure_mgmt_cdn.rb +18 -16
  62. data/lib/2017-04-02/generated/azure_mgmt_cdn/cdn_management_client.rb +16 -15
  63. data/lib/2017-04-02/generated/azure_mgmt_cdn/custom_domains.rb +53 -48
  64. data/lib/2017-04-02/generated/azure_mgmt_cdn/edge_nodes.rb +15 -13
  65. data/lib/2017-04-02/generated/azure_mgmt_cdn/endpoints.rb +136 -113
  66. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/custom_domain.rb +1 -25
  67. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/edge_node.rb +1 -25
  68. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/endpoint.rb +6 -3
  69. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/endpoint_update_parameters.rb +5 -2
  70. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/origin.rb +1 -1
  71. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/profile.rb +1 -1
  72. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/profile_update_parameters.rb +1 -1
  73. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/proxy_resource.rb +63 -0
  74. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/resource.rb +1 -31
  75. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/tracked_resource.rb +92 -0
  76. data/lib/2017-04-02/generated/azure_mgmt_cdn/operations.rb +15 -13
  77. data/lib/2017-04-02/generated/azure_mgmt_cdn/origins.rb +31 -29
  78. data/lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb +93 -85
  79. data/lib/2017-04-02/generated/azure_mgmt_cdn/resource_usage_operations.rb +15 -13
  80. data/lib/2017-10-12/generated/azure_mgmt_cdn.rb +93 -0
  81. data/lib/2017-10-12/generated/azure_mgmt_cdn/cdn_management_client.rb +358 -0
  82. data/lib/2017-10-12/generated/azure_mgmt_cdn/custom_domains.rb +970 -0
  83. data/lib/2017-10-12/generated/azure_mgmt_cdn/edge_nodes.rb +223 -0
  84. data/lib/2017-10-12/generated/azure_mgmt_cdn/endpoints.rb +1922 -0
  85. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/cache_expiration_action_parameters.rb +89 -0
  86. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/check_name_availability_input.rb +60 -0
  87. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/check_name_availability_output.rb +72 -0
  88. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/cidr_ip_address.rb +57 -0
  89. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/custom_domain.rb +148 -0
  90. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/custom_domain_list_result.rb +102 -0
  91. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/custom_domain_parameters.rb +48 -0
  92. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/custom_domain_resource_state.rb +17 -0
  93. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/custom_https_provisioning_state.rb +19 -0
  94. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/custom_https_provisioning_substate.rb +24 -0
  95. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/deep_created_origin.rb +91 -0
  96. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/delivery_rule.rb +96 -0
  97. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/delivery_rule_action.rb +46 -0
  98. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/delivery_rule_cache_expiration_action.rb +64 -0
  99. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/delivery_rule_condition.rb +47 -0
  100. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/delivery_rule_url_file_extension_condition.rb +64 -0
  101. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/delivery_rule_url_path_condition.rb +64 -0
  102. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/edge_node.rb +83 -0
  103. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/edgenode_result.rb +101 -0
  104. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/endpoint.rb +318 -0
  105. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/endpoint_list_result.rb +101 -0
  106. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/endpoint_properties_update_parameters_delivery_policy.rb +67 -0
  107. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/endpoint_resource_state.rb +20 -0
  108. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/endpoint_update_parameters.rb +223 -0
  109. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/error_response.rb +60 -0
  110. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/geo_filter.rb +80 -0
  111. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/geo_filter_actions.rb +16 -0
  112. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/ip_address_group.rb +86 -0
  113. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/load_parameters.rb +55 -0
  114. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/operation.rb +59 -0
  115. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/operation_display.rb +72 -0
  116. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/operations_list_result.rb +102 -0
  117. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/optimization_type.rb +19 -0
  118. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/origin.rb +158 -0
  119. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/origin_list_result.rb +101 -0
  120. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/origin_resource_state.rb +17 -0
  121. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/origin_update_parameters.rb +79 -0
  122. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/profile.rb +125 -0
  123. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/profile_list_result.rb +101 -0
  124. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/profile_resource_state.rb +18 -0
  125. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/profile_update_parameters.rb +54 -0
  126. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/proxy_resource.rb +63 -0
  127. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/purge_parameters.rb +55 -0
  128. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/query_string_caching_behavior.rb +18 -0
  129. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/resource.rb +71 -0
  130. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/resource_type.rb +15 -0
  131. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/resource_usage.rb +83 -0
  132. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/resource_usage_list_result.rb +100 -0
  133. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/sku.rb +49 -0
  134. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/sku_name.rb +19 -0
  135. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/sso_uri.rb +48 -0
  136. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/supported_optimization_types_list_result.rb +56 -0
  137. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/tracked_resource.rb +92 -0
  138. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/url_file_extension_condition_parameters.rb +70 -0
  139. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/url_path_condition_parameters.rb +72 -0
  140. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/validate_custom_domain_input.rb +47 -0
  141. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/validate_custom_domain_output.rb +72 -0
  142. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/validate_probe_input.rb +46 -0
  143. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/validate_probe_output.rb +73 -0
  144. data/lib/2017-10-12/generated/azure_mgmt_cdn/module_definition.rb +9 -0
  145. data/lib/2017-10-12/generated/azure_mgmt_cdn/operations.rb +217 -0
  146. data/lib/2017-10-12/generated/azure_mgmt_cdn/origins.rb +556 -0
  147. data/lib/2017-10-12/generated/azure_mgmt_cdn/profiles.rb +1460 -0
  148. data/lib/2017-10-12/generated/azure_mgmt_cdn/resource_usage_operations.rb +226 -0
  149. data/lib/azure_mgmt_cdn.rb +2 -0
  150. data/lib/profiles/latest/cdn_latest_profile_client.rb +28 -9
  151. data/lib/profiles/latest/cdn_module_definition.rb +0 -1
  152. data/lib/profiles/latest/modules/cdn_profile_module.rb +277 -210
  153. data/lib/version.rb +1 -1
  154. metadata +119 -2
@@ -0,0 +1,110 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::CDN::Mgmt::V2016_04_02
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
11
+ # https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx.
12
+ #
13
+ class Operations
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Operations class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [CdnManagementClient] reference to the CdnManagementClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Lists all of the available CDN REST API operations.
29
+ #
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [OperationListResult] operation results.
34
+ #
35
+ def list(custom_headers:nil)
36
+ response = list_async(custom_headers:custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # Lists all of the available CDN REST API operations.
42
+ #
43
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
44
+ # will be added to the HTTP request.
45
+ #
46
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
47
+ #
48
+ def list_with_http_info(custom_headers:nil)
49
+ list_async(custom_headers:custom_headers).value!
50
+ end
51
+
52
+ #
53
+ # Lists all of the available CDN REST API operations.
54
+ #
55
+ # @param [Hash{String => String}] A hash of custom headers that will be added
56
+ # to the HTTP request.
57
+ #
58
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
59
+ #
60
+ def list_async(custom_headers:nil)
61
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
62
+
63
+
64
+ request_headers = {}
65
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
66
+
67
+ # Set Headers
68
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
69
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
70
+ path_template = 'providers/Microsoft.Cdn/operations'
71
+
72
+ request_url = @base_url || @client.base_url
73
+
74
+ options = {
75
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
76
+ query_params: {'api-version' => @client.api_version},
77
+ headers: request_headers.merge(custom_headers || {}),
78
+ base_url: request_url
79
+ }
80
+ promise = @client.make_request_async(:get, path_template, options)
81
+
82
+ promise = promise.then do |result|
83
+ http_response = result.response
84
+ status_code = http_response.status
85
+ response_content = http_response.body
86
+ unless status_code == 200
87
+ error_model = JSON.load(response_content)
88
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
89
+ end
90
+
91
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
92
+ # Deserialize Response
93
+ if status_code == 200
94
+ begin
95
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
96
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::OperationListResult.mapper()
97
+ result.body = @client.deserialize(result_mapper, parsed_response)
98
+ rescue Exception => e
99
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
100
+ end
101
+ end
102
+
103
+ result
104
+ end
105
+
106
+ promise.execute
107
+ end
108
+
109
+ end
110
+ end
@@ -0,0 +1,778 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::CDN::Mgmt::V2016_04_02
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
11
+ # https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx.
12
+ #
13
+ class Origins
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Origins class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [CdnManagementClient] reference to the CdnManagementClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Lists the existing CDN origins within an endpoint.
29
+ #
30
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
31
+ # @param profile_name [String] Name of the CDN profile within the resource
32
+ # group.
33
+ # @param resource_group_name [String] Name of the resource group within the
34
+ # Azure subscription.
35
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
36
+ # will be added to the HTTP request.
37
+ #
38
+ # @return [OriginListResult] operation results.
39
+ #
40
+ def list_by_endpoint(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
41
+ response = list_by_endpoint_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
42
+ response.body unless response.nil?
43
+ end
44
+
45
+ #
46
+ # Lists the existing CDN origins within an endpoint.
47
+ #
48
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
49
+ # @param profile_name [String] Name of the CDN profile within the resource
50
+ # group.
51
+ # @param resource_group_name [String] Name of the resource group within the
52
+ # Azure subscription.
53
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
54
+ # will be added to the HTTP request.
55
+ #
56
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
57
+ #
58
+ def list_by_endpoint_with_http_info(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
59
+ list_by_endpoint_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
60
+ end
61
+
62
+ #
63
+ # Lists the existing CDN origins within an endpoint.
64
+ #
65
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
66
+ # @param profile_name [String] Name of the CDN profile within the resource
67
+ # group.
68
+ # @param resource_group_name [String] Name of the resource group within the
69
+ # Azure subscription.
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def list_by_endpoint_async(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
76
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
77
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
78
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
79
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
80
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
81
+
82
+
83
+ request_headers = {}
84
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
85
+
86
+ # Set Headers
87
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
88
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
89
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins'
90
+
91
+ request_url = @base_url || @client.base_url
92
+
93
+ options = {
94
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
95
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
96
+ query_params: {'api-version' => @client.api_version},
97
+ headers: request_headers.merge(custom_headers || {}),
98
+ base_url: request_url
99
+ }
100
+ promise = @client.make_request_async(:get, path_template, options)
101
+
102
+ promise = promise.then do |result|
103
+ http_response = result.response
104
+ status_code = http_response.status
105
+ response_content = http_response.body
106
+ unless status_code == 200
107
+ error_model = JSON.load(response_content)
108
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
109
+ end
110
+
111
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
112
+ # Deserialize Response
113
+ if status_code == 200
114
+ begin
115
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
116
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::OriginListResult.mapper()
117
+ result.body = @client.deserialize(result_mapper, parsed_response)
118
+ rescue Exception => e
119
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
120
+ end
121
+ end
122
+
123
+ result
124
+ end
125
+
126
+ promise.execute
127
+ end
128
+
129
+ #
130
+ # Gets an existing CDN origin within an endpoint.
131
+ #
132
+ # @param origin_name [String] Name of the origin, an arbitrary value but it
133
+ # needs to be unique under endpoint
134
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
135
+ # @param profile_name [String] Name of the CDN profile within the resource
136
+ # group.
137
+ # @param resource_group_name [String] Name of the resource group within the
138
+ # Azure subscription.
139
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
140
+ # will be added to the HTTP request.
141
+ #
142
+ # @return [Origin] operation results.
143
+ #
144
+ def get(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
145
+ response = get_async(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
146
+ response.body unless response.nil?
147
+ end
148
+
149
+ #
150
+ # Gets an existing CDN origin within an endpoint.
151
+ #
152
+ # @param origin_name [String] Name of the origin, an arbitrary value but it
153
+ # needs to be unique under endpoint
154
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
155
+ # @param profile_name [String] Name of the CDN profile within the resource
156
+ # group.
157
+ # @param resource_group_name [String] Name of the resource group within the
158
+ # Azure subscription.
159
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
160
+ # will be added to the HTTP request.
161
+ #
162
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
163
+ #
164
+ def get_with_http_info(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
165
+ get_async(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
166
+ end
167
+
168
+ #
169
+ # Gets an existing CDN origin within an endpoint.
170
+ #
171
+ # @param origin_name [String] Name of the origin, an arbitrary value but it
172
+ # needs to be unique under endpoint
173
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
174
+ # @param profile_name [String] Name of the CDN profile within the resource
175
+ # group.
176
+ # @param resource_group_name [String] Name of the resource group within the
177
+ # Azure subscription.
178
+ # @param [Hash{String => String}] A hash of custom headers that will be added
179
+ # to the HTTP request.
180
+ #
181
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
182
+ #
183
+ def get_async(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
184
+ fail ArgumentError, 'origin_name is nil' if origin_name.nil?
185
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
186
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
187
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
188
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
189
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
190
+
191
+
192
+ request_headers = {}
193
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
194
+
195
+ # Set Headers
196
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
197
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
198
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'
199
+
200
+ request_url = @base_url || @client.base_url
201
+
202
+ options = {
203
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
204
+ path_params: {'originName' => origin_name,'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
205
+ query_params: {'api-version' => @client.api_version},
206
+ headers: request_headers.merge(custom_headers || {}),
207
+ base_url: request_url
208
+ }
209
+ promise = @client.make_request_async(:get, path_template, options)
210
+
211
+ promise = promise.then do |result|
212
+ http_response = result.response
213
+ status_code = http_response.status
214
+ response_content = http_response.body
215
+ unless status_code == 200
216
+ error_model = JSON.load(response_content)
217
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
218
+ end
219
+
220
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
221
+ # Deserialize Response
222
+ if status_code == 200
223
+ begin
224
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
225
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Origin.mapper()
226
+ result.body = @client.deserialize(result_mapper, parsed_response)
227
+ rescue Exception => e
228
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
229
+ end
230
+ end
231
+
232
+ result
233
+ end
234
+
235
+ promise.execute
236
+ end
237
+
238
+ #
239
+ # Creates a new CDN origin within an endpoint.
240
+ #
241
+ # @param origin_name [String] Name of the origin, an arbitrary value but it
242
+ # needs to be unique under endpoint
243
+ # @param origin_properties [OriginParameters] Origin properties
244
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
245
+ # @param profile_name [String] Name of the CDN profile within the resource
246
+ # group.
247
+ # @param resource_group_name [String] Name of the resource group within the
248
+ # Azure subscription.
249
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
250
+ # will be added to the HTTP request.
251
+ #
252
+ # @return [Origin] operation results.
253
+ #
254
+ def create(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
255
+ response = create_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
256
+ response.body unless response.nil?
257
+ end
258
+
259
+ #
260
+ # @param origin_name [String] Name of the origin, an arbitrary value but it
261
+ # needs to be unique under endpoint
262
+ # @param origin_properties [OriginParameters] Origin properties
263
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
264
+ # @param profile_name [String] Name of the CDN profile within the resource
265
+ # group.
266
+ # @param resource_group_name [String] Name of the resource group within the
267
+ # Azure subscription.
268
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
269
+ # will be added to the HTTP request.
270
+ #
271
+ # @return [Concurrent::Promise] promise which provides async access to http
272
+ # response.
273
+ #
274
+ def create_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
275
+ # Send request
276
+ promise = begin_create_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers)
277
+
278
+ promise = promise.then do |response|
279
+ # Defining deserialization method.
280
+ deserialize_method = lambda do |parsed_response|
281
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Origin.mapper()
282
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
283
+ end
284
+
285
+ # Waiting for response.
286
+ @client.get_long_running_operation_result(response, deserialize_method)
287
+ end
288
+
289
+ promise
290
+ end
291
+
292
+ #
293
+ # Updates an existing CDN origin within an endpoint.
294
+ #
295
+ # @param origin_name [String] Name of the origin. Must be unique within
296
+ # endpoint.
297
+ # @param origin_properties [OriginParameters] Origin properties
298
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
299
+ # @param profile_name [String] Name of the CDN profile within the resource
300
+ # group.
301
+ # @param resource_group_name [String] Name of the resource group within the
302
+ # Azure subscription.
303
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
304
+ # will be added to the HTTP request.
305
+ #
306
+ # @return [Origin] operation results.
307
+ #
308
+ def update(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
309
+ response = update_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
310
+ response.body unless response.nil?
311
+ end
312
+
313
+ #
314
+ # @param origin_name [String] Name of the origin. Must be unique within
315
+ # endpoint.
316
+ # @param origin_properties [OriginParameters] Origin properties
317
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
318
+ # @param profile_name [String] Name of the CDN profile within the resource
319
+ # group.
320
+ # @param resource_group_name [String] Name of the resource group within the
321
+ # Azure subscription.
322
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
323
+ # will be added to the HTTP request.
324
+ #
325
+ # @return [Concurrent::Promise] promise which provides async access to http
326
+ # response.
327
+ #
328
+ def update_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
329
+ # Send request
330
+ promise = begin_update_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers)
331
+
332
+ promise = promise.then do |response|
333
+ # Defining deserialization method.
334
+ deserialize_method = lambda do |parsed_response|
335
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Origin.mapper()
336
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
337
+ end
338
+
339
+ # Waiting for response.
340
+ @client.get_long_running_operation_result(response, deserialize_method)
341
+ end
342
+
343
+ promise
344
+ end
345
+
346
+ #
347
+ # Deletes an existing CDN origin within an endpoint.
348
+ #
349
+ # @param origin_name [String] Name of the origin. Must be unique within
350
+ # endpoint.
351
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
352
+ # @param profile_name [String] Name of the CDN profile within the resource
353
+ # group.
354
+ # @param resource_group_name [String] Name of the resource group within the
355
+ # Azure subscription.
356
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
357
+ # will be added to the HTTP request.
358
+ #
359
+ # @return [Origin] operation results.
360
+ #
361
+ def delete_if_exists(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
362
+ response = delete_if_exists_async(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
363
+ response.body unless response.nil?
364
+ end
365
+
366
+ #
367
+ # @param origin_name [String] Name of the origin. Must be unique within
368
+ # endpoint.
369
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
370
+ # @param profile_name [String] Name of the CDN profile within the resource
371
+ # group.
372
+ # @param resource_group_name [String] Name of the resource group within the
373
+ # Azure subscription.
374
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
375
+ # will be added to the HTTP request.
376
+ #
377
+ # @return [Concurrent::Promise] promise which provides async access to http
378
+ # response.
379
+ #
380
+ def delete_if_exists_async(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
381
+ # Send request
382
+ promise = begin_delete_if_exists_async(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers)
383
+
384
+ promise = promise.then do |response|
385
+ # Defining deserialization method.
386
+ deserialize_method = lambda do |parsed_response|
387
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Origin.mapper()
388
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
389
+ end
390
+
391
+ # Waiting for response.
392
+ @client.get_long_running_operation_result(response, deserialize_method)
393
+ end
394
+
395
+ promise
396
+ end
397
+
398
+ #
399
+ # Creates a new CDN origin within an endpoint.
400
+ #
401
+ # @param origin_name [String] Name of the origin, an arbitrary value but it
402
+ # needs to be unique under endpoint
403
+ # @param origin_properties [OriginParameters] Origin properties
404
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
405
+ # @param profile_name [String] Name of the CDN profile within the resource
406
+ # group.
407
+ # @param resource_group_name [String] Name of the resource group within the
408
+ # Azure subscription.
409
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
410
+ # will be added to the HTTP request.
411
+ #
412
+ # @return [Origin] operation results.
413
+ #
414
+ def begin_create(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
415
+ response = begin_create_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
416
+ response.body unless response.nil?
417
+ end
418
+
419
+ #
420
+ # Creates a new CDN origin within an endpoint.
421
+ #
422
+ # @param origin_name [String] Name of the origin, an arbitrary value but it
423
+ # needs to be unique under endpoint
424
+ # @param origin_properties [OriginParameters] Origin properties
425
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
426
+ # @param profile_name [String] Name of the CDN profile within the resource
427
+ # group.
428
+ # @param resource_group_name [String] Name of the resource group within the
429
+ # Azure subscription.
430
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
431
+ # will be added to the HTTP request.
432
+ #
433
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
434
+ #
435
+ def begin_create_with_http_info(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
436
+ begin_create_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
437
+ end
438
+
439
+ #
440
+ # Creates a new CDN origin within an endpoint.
441
+ #
442
+ # @param origin_name [String] Name of the origin, an arbitrary value but it
443
+ # needs to be unique under endpoint
444
+ # @param origin_properties [OriginParameters] Origin properties
445
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
446
+ # @param profile_name [String] Name of the CDN profile within the resource
447
+ # group.
448
+ # @param resource_group_name [String] Name of the resource group within the
449
+ # Azure subscription.
450
+ # @param [Hash{String => String}] A hash of custom headers that will be added
451
+ # to the HTTP request.
452
+ #
453
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
454
+ #
455
+ def begin_create_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
456
+ fail ArgumentError, 'origin_name is nil' if origin_name.nil?
457
+ fail ArgumentError, 'origin_properties is nil' if origin_properties.nil?
458
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
459
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
460
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
461
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
462
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
463
+
464
+
465
+ request_headers = {}
466
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
467
+
468
+ # Set Headers
469
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
470
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
471
+
472
+ # Serialize Request
473
+ request_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::OriginParameters.mapper()
474
+ request_content = @client.serialize(request_mapper, origin_properties)
475
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
476
+
477
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'
478
+
479
+ request_url = @base_url || @client.base_url
480
+
481
+ options = {
482
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
483
+ path_params: {'originName' => origin_name,'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
484
+ query_params: {'api-version' => @client.api_version},
485
+ body: request_content,
486
+ headers: request_headers.merge(custom_headers || {}),
487
+ base_url: request_url
488
+ }
489
+ promise = @client.make_request_async(:put, path_template, options)
490
+
491
+ promise = promise.then do |result|
492
+ http_response = result.response
493
+ status_code = http_response.status
494
+ response_content = http_response.body
495
+ unless status_code == 200 || status_code == 201 || status_code == 202
496
+ error_model = JSON.load(response_content)
497
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
498
+ end
499
+
500
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
501
+ # Deserialize Response
502
+ if status_code == 200
503
+ begin
504
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
505
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Origin.mapper()
506
+ result.body = @client.deserialize(result_mapper, parsed_response)
507
+ rescue Exception => e
508
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
509
+ end
510
+ end
511
+ # Deserialize Response
512
+ if status_code == 201
513
+ begin
514
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
515
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Origin.mapper()
516
+ result.body = @client.deserialize(result_mapper, parsed_response)
517
+ rescue Exception => e
518
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
519
+ end
520
+ end
521
+ # Deserialize Response
522
+ if status_code == 202
523
+ begin
524
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
525
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Origin.mapper()
526
+ result.body = @client.deserialize(result_mapper, parsed_response)
527
+ rescue Exception => e
528
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
529
+ end
530
+ end
531
+
532
+ result
533
+ end
534
+
535
+ promise.execute
536
+ end
537
+
538
+ #
539
+ # Updates an existing CDN origin within an endpoint.
540
+ #
541
+ # @param origin_name [String] Name of the origin. Must be unique within
542
+ # endpoint.
543
+ # @param origin_properties [OriginParameters] Origin properties
544
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
545
+ # @param profile_name [String] Name of the CDN profile within the resource
546
+ # group.
547
+ # @param resource_group_name [String] Name of the resource group within the
548
+ # Azure subscription.
549
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
550
+ # will be added to the HTTP request.
551
+ #
552
+ # @return [Origin] operation results.
553
+ #
554
+ def begin_update(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
555
+ response = begin_update_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
556
+ response.body unless response.nil?
557
+ end
558
+
559
+ #
560
+ # Updates an existing CDN origin within an endpoint.
561
+ #
562
+ # @param origin_name [String] Name of the origin. Must be unique within
563
+ # endpoint.
564
+ # @param origin_properties [OriginParameters] Origin properties
565
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
566
+ # @param profile_name [String] Name of the CDN profile within the resource
567
+ # group.
568
+ # @param resource_group_name [String] Name of the resource group within the
569
+ # Azure subscription.
570
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
571
+ # will be added to the HTTP request.
572
+ #
573
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
574
+ #
575
+ def begin_update_with_http_info(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
576
+ begin_update_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
577
+ end
578
+
579
+ #
580
+ # Updates an existing CDN origin within an endpoint.
581
+ #
582
+ # @param origin_name [String] Name of the origin. Must be unique within
583
+ # endpoint.
584
+ # @param origin_properties [OriginParameters] Origin properties
585
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
586
+ # @param profile_name [String] Name of the CDN profile within the resource
587
+ # group.
588
+ # @param resource_group_name [String] Name of the resource group within the
589
+ # Azure subscription.
590
+ # @param [Hash{String => String}] A hash of custom headers that will be added
591
+ # to the HTTP request.
592
+ #
593
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
594
+ #
595
+ def begin_update_async(origin_name, origin_properties, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
596
+ fail ArgumentError, 'origin_name is nil' if origin_name.nil?
597
+ fail ArgumentError, 'origin_properties is nil' if origin_properties.nil?
598
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
599
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
600
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
601
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
602
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
603
+
604
+
605
+ request_headers = {}
606
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
607
+
608
+ # Set Headers
609
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
610
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
611
+
612
+ # Serialize Request
613
+ request_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::OriginParameters.mapper()
614
+ request_content = @client.serialize(request_mapper, origin_properties)
615
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
616
+
617
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'
618
+
619
+ request_url = @base_url || @client.base_url
620
+
621
+ options = {
622
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
623
+ path_params: {'originName' => origin_name,'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
624
+ query_params: {'api-version' => @client.api_version},
625
+ body: request_content,
626
+ headers: request_headers.merge(custom_headers || {}),
627
+ base_url: request_url
628
+ }
629
+ promise = @client.make_request_async(:patch, path_template, options)
630
+
631
+ promise = promise.then do |result|
632
+ http_response = result.response
633
+ status_code = http_response.status
634
+ response_content = http_response.body
635
+ unless status_code == 200 || status_code == 202
636
+ error_model = JSON.load(response_content)
637
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
638
+ end
639
+
640
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
641
+ # Deserialize Response
642
+ if status_code == 200
643
+ begin
644
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
645
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Origin.mapper()
646
+ result.body = @client.deserialize(result_mapper, parsed_response)
647
+ rescue Exception => e
648
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
649
+ end
650
+ end
651
+ # Deserialize Response
652
+ if status_code == 202
653
+ begin
654
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
655
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Origin.mapper()
656
+ result.body = @client.deserialize(result_mapper, parsed_response)
657
+ rescue Exception => e
658
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
659
+ end
660
+ end
661
+
662
+ result
663
+ end
664
+
665
+ promise.execute
666
+ end
667
+
668
+ #
669
+ # Deletes an existing CDN origin within an endpoint.
670
+ #
671
+ # @param origin_name [String] Name of the origin. Must be unique within
672
+ # endpoint.
673
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
674
+ # @param profile_name [String] Name of the CDN profile within the resource
675
+ # group.
676
+ # @param resource_group_name [String] Name of the resource group within the
677
+ # Azure subscription.
678
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
679
+ # will be added to the HTTP request.
680
+ #
681
+ # @return [Origin] operation results.
682
+ #
683
+ def begin_delete_if_exists(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
684
+ response = begin_delete_if_exists_async(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
685
+ response.body unless response.nil?
686
+ end
687
+
688
+ #
689
+ # Deletes an existing CDN origin within an endpoint.
690
+ #
691
+ # @param origin_name [String] Name of the origin. Must be unique within
692
+ # endpoint.
693
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
694
+ # @param profile_name [String] Name of the CDN profile within the resource
695
+ # group.
696
+ # @param resource_group_name [String] Name of the resource group within the
697
+ # Azure subscription.
698
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
699
+ # will be added to the HTTP request.
700
+ #
701
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
702
+ #
703
+ def begin_delete_if_exists_with_http_info(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
704
+ begin_delete_if_exists_async(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
705
+ end
706
+
707
+ #
708
+ # Deletes an existing CDN origin within an endpoint.
709
+ #
710
+ # @param origin_name [String] Name of the origin. Must be unique within
711
+ # endpoint.
712
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
713
+ # @param profile_name [String] Name of the CDN profile within the resource
714
+ # group.
715
+ # @param resource_group_name [String] Name of the resource group within the
716
+ # Azure subscription.
717
+ # @param [Hash{String => String}] A hash of custom headers that will be added
718
+ # to the HTTP request.
719
+ #
720
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
721
+ #
722
+ def begin_delete_if_exists_async(origin_name, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
723
+ fail ArgumentError, 'origin_name is nil' if origin_name.nil?
724
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
725
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
726
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
727
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
728
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
729
+
730
+
731
+ request_headers = {}
732
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
733
+
734
+ # Set Headers
735
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
736
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
737
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}'
738
+
739
+ request_url = @base_url || @client.base_url
740
+
741
+ options = {
742
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
743
+ path_params: {'originName' => origin_name,'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
744
+ query_params: {'api-version' => @client.api_version},
745
+ headers: request_headers.merge(custom_headers || {}),
746
+ base_url: request_url
747
+ }
748
+ promise = @client.make_request_async(:delete, path_template, options)
749
+
750
+ promise = promise.then do |result|
751
+ http_response = result.response
752
+ status_code = http_response.status
753
+ response_content = http_response.body
754
+ unless status_code == 202 || status_code == 204
755
+ error_model = JSON.load(response_content)
756
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
757
+ end
758
+
759
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
760
+ # Deserialize Response
761
+ if status_code == 202
762
+ begin
763
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
764
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Origin.mapper()
765
+ result.body = @client.deserialize(result_mapper, parsed_response)
766
+ rescue Exception => e
767
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
768
+ end
769
+ end
770
+
771
+ result
772
+ end
773
+
774
+ promise.execute
775
+ end
776
+
777
+ end
778
+ end