azure_mgmt_cdn 0.14.0 → 0.15.0

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