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,1456 @@
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 Endpoints
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Endpoints 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 existing CDN endpoints within a profile.
29
+ #
30
+ # @param profile_name [String] Name of the CDN profile within the resource
31
+ # group.
32
+ # @param resource_group_name [String] Name of the resource group within the
33
+ # Azure subscription.
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [EndpointListResult] operation results.
38
+ #
39
+ def list_by_profile(profile_name, resource_group_name, custom_headers = nil)
40
+ response = list_by_profile_async(profile_name, resource_group_name, custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # Lists existing CDN endpoints within a profile.
46
+ #
47
+ # @param profile_name [String] Name of the CDN profile within the resource
48
+ # group.
49
+ # @param resource_group_name [String] Name of the resource group within the
50
+ # Azure subscription.
51
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
52
+ # will be added to the HTTP request.
53
+ #
54
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
55
+ #
56
+ def list_by_profile_with_http_info(profile_name, resource_group_name, custom_headers = nil)
57
+ list_by_profile_async(profile_name, resource_group_name, custom_headers).value!
58
+ end
59
+
60
+ #
61
+ # Lists existing CDN endpoints within a profile.
62
+ #
63
+ # @param profile_name [String] Name of the CDN profile within the resource
64
+ # group.
65
+ # @param resource_group_name [String] Name of the resource group within the
66
+ # Azure subscription.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def list_by_profile_async(profile_name, resource_group_name, custom_headers = nil)
73
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
74
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
75
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
76
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
77
+
78
+
79
+ request_headers = {}
80
+
81
+ # Set Headers
82
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
83
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
84
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints'
85
+
86
+ request_url = @base_url || @client.base_url
87
+
88
+ options = {
89
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
90
+ path_params: {'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
91
+ query_params: {'api-version' => @client.api_version},
92
+ headers: request_headers.merge(custom_headers || {}),
93
+ base_url: request_url
94
+ }
95
+ promise = @client.make_request_async(:get, path_template, options)
96
+
97
+ promise = promise.then do |result|
98
+ http_response = result.response
99
+ status_code = http_response.status
100
+ response_content = http_response.body
101
+ unless status_code == 200
102
+ error_model = JSON.load(response_content)
103
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
104
+ end
105
+
106
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
107
+ # Deserialize Response
108
+ if status_code == 200
109
+ begin
110
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
111
+ result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::EndpointListResult.mapper()
112
+ result.body = @client.deserialize(result_mapper, parsed_response)
113
+ rescue Exception => e
114
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
115
+ end
116
+ end
117
+
118
+ result
119
+ end
120
+
121
+ promise.execute
122
+ end
123
+
124
+ #
125
+ # Gets an existing CDN endpoint with the specified parameters.
126
+ #
127
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
128
+ # @param profile_name [String] Name of the CDN profile within the resource
129
+ # group.
130
+ # @param resource_group_name [String] Name of the resource group within the
131
+ # Azure subscription.
132
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
133
+ # will be added to the HTTP request.
134
+ #
135
+ # @return [Endpoint] operation results.
136
+ #
137
+ def get(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
138
+ response = get_async(endpoint_name, profile_name, resource_group_name, custom_headers).value!
139
+ response.body unless response.nil?
140
+ end
141
+
142
+ #
143
+ # Gets an existing CDN endpoint with the specified parameters.
144
+ #
145
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
146
+ # @param profile_name [String] Name of the CDN profile within the resource
147
+ # group.
148
+ # @param resource_group_name [String] Name of the resource group within the
149
+ # Azure subscription.
150
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
151
+ # will be added to the HTTP request.
152
+ #
153
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
154
+ #
155
+ def get_with_http_info(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
156
+ get_async(endpoint_name, profile_name, resource_group_name, custom_headers).value!
157
+ end
158
+
159
+ #
160
+ # Gets an existing CDN endpoint with the specified parameters.
161
+ #
162
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
163
+ # @param profile_name [String] Name of the CDN profile within the resource
164
+ # group.
165
+ # @param resource_group_name [String] Name of the resource group within the
166
+ # Azure subscription.
167
+ # @param [Hash{String => String}] A hash of custom headers that will be added
168
+ # to the HTTP request.
169
+ #
170
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
171
+ #
172
+ def get_async(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
173
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
174
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
175
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
176
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
177
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
178
+
179
+
180
+ request_headers = {}
181
+
182
+ # Set Headers
183
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
184
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
185
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
186
+
187
+ request_url = @base_url || @client.base_url
188
+
189
+ options = {
190
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
191
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
192
+ query_params: {'api-version' => @client.api_version},
193
+ headers: request_headers.merge(custom_headers || {}),
194
+ base_url: request_url
195
+ }
196
+ promise = @client.make_request_async(:get, path_template, options)
197
+
198
+ promise = promise.then do |result|
199
+ http_response = result.response
200
+ status_code = http_response.status
201
+ response_content = http_response.body
202
+ unless status_code == 200
203
+ error_model = JSON.load(response_content)
204
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
205
+ end
206
+
207
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
208
+ # Deserialize Response
209
+ if status_code == 200
210
+ begin
211
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
212
+ result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Endpoint.mapper()
213
+ result.body = @client.deserialize(result_mapper, parsed_response)
214
+ rescue Exception => e
215
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
216
+ end
217
+ end
218
+
219
+ result
220
+ end
221
+
222
+ promise.execute
223
+ end
224
+
225
+ #
226
+ # Creates a new CDN endpoint with the specified parameters.
227
+ #
228
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
229
+ # @param endpoint_properties [EndpointCreateParameters] Endpoint properties
230
+ # @param profile_name [String] Name of the CDN profile within the resource
231
+ # group.
232
+ # @param resource_group_name [String] Name of the resource group within the
233
+ # Azure subscription.
234
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
235
+ # will be added to the HTTP request.
236
+ #
237
+ # @return [Endpoint] operation results.
238
+ #
239
+ def create(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
240
+ response = create_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers).value!
241
+ response.body unless response.nil?
242
+ end
243
+
244
+ #
245
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
246
+ # @param endpoint_properties [EndpointCreateParameters] Endpoint properties
247
+ # @param profile_name [String] Name of the CDN profile within the resource
248
+ # group.
249
+ # @param resource_group_name [String] Name of the resource group within the
250
+ # Azure subscription.
251
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
252
+ # will be added to the HTTP request.
253
+ #
254
+ # @return [Concurrent::Promise] promise which provides async access to http
255
+ # response.
256
+ #
257
+ def create_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
258
+ # Send request
259
+ promise = begin_create_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers)
260
+
261
+ promise = promise.then do |response|
262
+ # Defining deserialization method.
263
+ deserialize_method = lambda do |parsed_response|
264
+ result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Endpoint.mapper()
265
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
266
+ end
267
+
268
+ # Waiting for response.
269
+ @client.get_long_running_operation_result(response, deserialize_method)
270
+ end
271
+
272
+ promise
273
+ end
274
+
275
+ #
276
+ # Updates an existing CDN endpoint with the specified parameters. Only tags and
277
+ # OriginHostHeader can be updated after creating an endpoint. To update
278
+ # origins, use the Update Origin operation. To update custom domains, use the
279
+ # Update Custom Domain operation.
280
+ #
281
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
282
+ # @param endpoint_properties [EndpointUpdateParameters] Endpoint properties
283
+ # @param profile_name [String] Name of the CDN profile within the resource
284
+ # group.
285
+ # @param resource_group_name [String] Name of the resource group within the
286
+ # Azure subscription.
287
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
288
+ # will be added to the HTTP request.
289
+ #
290
+ # @return [Endpoint] operation results.
291
+ #
292
+ def update(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
293
+ response = update_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers).value!
294
+ response.body unless response.nil?
295
+ end
296
+
297
+ #
298
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
299
+ # @param endpoint_properties [EndpointUpdateParameters] Endpoint properties
300
+ # @param profile_name [String] Name of the CDN profile within the resource
301
+ # group.
302
+ # @param resource_group_name [String] Name of the resource group within the
303
+ # Azure subscription.
304
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
305
+ # will be added to the HTTP request.
306
+ #
307
+ # @return [Concurrent::Promise] promise which provides async access to http
308
+ # response.
309
+ #
310
+ def update_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
311
+ # Send request
312
+ promise = begin_update_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers)
313
+
314
+ promise = promise.then do |response|
315
+ # Defining deserialization method.
316
+ deserialize_method = lambda do |parsed_response|
317
+ result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Endpoint.mapper()
318
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
319
+ end
320
+
321
+ # Waiting for response.
322
+ @client.get_long_running_operation_result(response, deserialize_method)
323
+ end
324
+
325
+ promise
326
+ end
327
+
328
+ #
329
+ # Deletes an existing CDN endpoint with the specified parameters.
330
+ #
331
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
332
+ # @param profile_name [String] Name of the CDN profile within the resource
333
+ # group.
334
+ # @param resource_group_name [String] Name of the resource group within the
335
+ # Azure subscription.
336
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
337
+ # will be added to the HTTP request.
338
+ #
339
+ def delete_if_exists(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
340
+ response = delete_if_exists_async(endpoint_name, profile_name, resource_group_name, custom_headers).value!
341
+ nil
342
+ end
343
+
344
+ #
345
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
346
+ # @param profile_name [String] Name of the CDN profile within the resource
347
+ # group.
348
+ # @param resource_group_name [String] Name of the resource group within the
349
+ # Azure subscription.
350
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
351
+ # will be added to the HTTP request.
352
+ #
353
+ # @return [Concurrent::Promise] promise which provides async access to http
354
+ # response.
355
+ #
356
+ def delete_if_exists_async(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
357
+ # Send request
358
+ promise = begin_delete_if_exists_async(endpoint_name, profile_name, resource_group_name, custom_headers)
359
+
360
+ promise = promise.then do |response|
361
+ # Defining deserialization method.
362
+ deserialize_method = lambda do |parsed_response|
363
+ end
364
+
365
+ # Waiting for response.
366
+ @client.get_long_running_operation_result(response, deserialize_method)
367
+ end
368
+
369
+ promise
370
+ end
371
+
372
+ #
373
+ # Starts an existing stopped CDN endpoint.
374
+ #
375
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
376
+ # @param profile_name [String] Name of the CDN profile within the resource
377
+ # group.
378
+ # @param resource_group_name [String] Name of the resource group within the
379
+ # Azure subscription.
380
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
381
+ # will be added to the HTTP request.
382
+ #
383
+ # @return [Endpoint] operation results.
384
+ #
385
+ def start(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
386
+ response = start_async(endpoint_name, profile_name, resource_group_name, custom_headers).value!
387
+ response.body unless response.nil?
388
+ end
389
+
390
+ #
391
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
392
+ # @param profile_name [String] Name of the CDN profile within the resource
393
+ # group.
394
+ # @param resource_group_name [String] Name of the resource group within the
395
+ # Azure subscription.
396
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
397
+ # will be added to the HTTP request.
398
+ #
399
+ # @return [Concurrent::Promise] promise which provides async access to http
400
+ # response.
401
+ #
402
+ def start_async(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
403
+ # Send request
404
+ promise = begin_start_async(endpoint_name, profile_name, resource_group_name, custom_headers)
405
+
406
+ promise = promise.then do |response|
407
+ # Defining deserialization method.
408
+ deserialize_method = lambda do |parsed_response|
409
+ result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Endpoint.mapper()
410
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
411
+ end
412
+
413
+ # Waiting for response.
414
+ @client.get_long_running_operation_result(response, deserialize_method)
415
+ end
416
+
417
+ promise
418
+ end
419
+
420
+ #
421
+ # Stops an existing running CDN endpoint.
422
+ #
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 [Endpoint] operation results.
432
+ #
433
+ def stop(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
434
+ response = stop_async(endpoint_name, profile_name, resource_group_name, custom_headers).value!
435
+ response.body unless response.nil?
436
+ end
437
+
438
+ #
439
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
440
+ # @param profile_name [String] Name of the CDN profile within the resource
441
+ # group.
442
+ # @param resource_group_name [String] Name of the resource group within the
443
+ # Azure subscription.
444
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
445
+ # will be added to the HTTP request.
446
+ #
447
+ # @return [Concurrent::Promise] promise which provides async access to http
448
+ # response.
449
+ #
450
+ def stop_async(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
451
+ # Send request
452
+ promise = begin_stop_async(endpoint_name, profile_name, resource_group_name, custom_headers)
453
+
454
+ promise = promise.then do |response|
455
+ # Defining deserialization method.
456
+ deserialize_method = lambda do |parsed_response|
457
+ result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Endpoint.mapper()
458
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
459
+ end
460
+
461
+ # Waiting for response.
462
+ @client.get_long_running_operation_result(response, deserialize_method)
463
+ end
464
+
465
+ promise
466
+ end
467
+
468
+ #
469
+ # Forcibly purges CDN endpoint content.
470
+ #
471
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
472
+ # @param content_file_paths [PurgeParameters] The path to the content to be
473
+ # purged. Path can describe a file or directory.
474
+ # @param profile_name [String] Name of the CDN profile within the resource
475
+ # group.
476
+ # @param resource_group_name [String] Name of the resource group within the
477
+ # Azure subscription.
478
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
479
+ # will be added to the HTTP request.
480
+ #
481
+ def purge_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
482
+ response = purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers).value!
483
+ nil
484
+ end
485
+
486
+ #
487
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
488
+ # @param content_file_paths [PurgeParameters] The path to the content to be
489
+ # purged. Path can describe a file or directory.
490
+ # @param profile_name [String] Name of the CDN profile within the resource
491
+ # group.
492
+ # @param resource_group_name [String] Name of the resource group within the
493
+ # Azure subscription.
494
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
495
+ # will be added to the HTTP request.
496
+ #
497
+ # @return [Concurrent::Promise] promise which provides async access to http
498
+ # response.
499
+ #
500
+ def purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
501
+ # Send request
502
+ promise = begin_purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers)
503
+
504
+ promise = promise.then do |response|
505
+ # Defining deserialization method.
506
+ deserialize_method = lambda do |parsed_response|
507
+ end
508
+
509
+ # Waiting for response.
510
+ @client.get_long_running_operation_result(response, deserialize_method)
511
+ end
512
+
513
+ promise
514
+ end
515
+
516
+ #
517
+ # Forcibly pre-loads CDN endpoint content.
518
+ #
519
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
520
+ # @param content_file_paths [LoadParameters] The path to the content to be
521
+ # loaded. Path should describe a file.
522
+ # @param profile_name [String] Name of the CDN profile within the resource
523
+ # group.
524
+ # @param resource_group_name [String] Name of the resource group within the
525
+ # Azure subscription.
526
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
527
+ # will be added to the HTTP request.
528
+ #
529
+ def load_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
530
+ response = load_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers).value!
531
+ nil
532
+ end
533
+
534
+ #
535
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
536
+ # @param content_file_paths [LoadParameters] The path to the content to be
537
+ # loaded. Path should describe a file.
538
+ # @param profile_name [String] Name of the CDN profile within the resource
539
+ # group.
540
+ # @param resource_group_name [String] Name of the resource group within the
541
+ # Azure subscription.
542
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
543
+ # will be added to the HTTP request.
544
+ #
545
+ # @return [Concurrent::Promise] promise which provides async access to http
546
+ # response.
547
+ #
548
+ def load_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
549
+ # Send request
550
+ promise = begin_load_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers)
551
+
552
+ promise = promise.then do |response|
553
+ # Defining deserialization method.
554
+ deserialize_method = lambda do |parsed_response|
555
+ end
556
+
557
+ # Waiting for response.
558
+ @client.get_long_running_operation_result(response, deserialize_method)
559
+ end
560
+
561
+ promise
562
+ end
563
+
564
+ #
565
+ # Validates a custom domain mapping to ensure it maps to the correct CNAME in
566
+ # DNS.
567
+ #
568
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
569
+ # @param custom_domain_properties [ValidateCustomDomainInput] Custom domain to
570
+ # validate.
571
+ # @param profile_name [String] Name of the CDN profile within the resource
572
+ # group.
573
+ # @param resource_group_name [String] Name of the resource group within the
574
+ # Azure subscription.
575
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
576
+ # will be added to the HTTP request.
577
+ #
578
+ # @return [ValidateCustomDomainOutput] operation results.
579
+ #
580
+ def validate_custom_domain(endpoint_name, custom_domain_properties, profile_name, resource_group_name, custom_headers = nil)
581
+ response = validate_custom_domain_async(endpoint_name, custom_domain_properties, profile_name, resource_group_name, custom_headers).value!
582
+ response.body unless response.nil?
583
+ end
584
+
585
+ #
586
+ # Validates a custom domain mapping to ensure it maps to the correct CNAME in
587
+ # DNS.
588
+ #
589
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
590
+ # @param custom_domain_properties [ValidateCustomDomainInput] Custom domain to
591
+ # validate.
592
+ # @param profile_name [String] Name of the CDN profile within the resource
593
+ # group.
594
+ # @param resource_group_name [String] Name of the resource group within the
595
+ # Azure subscription.
596
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
597
+ # will be added to the HTTP request.
598
+ #
599
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
600
+ #
601
+ def validate_custom_domain_with_http_info(endpoint_name, custom_domain_properties, profile_name, resource_group_name, custom_headers = nil)
602
+ validate_custom_domain_async(endpoint_name, custom_domain_properties, profile_name, resource_group_name, custom_headers).value!
603
+ end
604
+
605
+ #
606
+ # Validates a custom domain mapping to ensure it maps to the correct CNAME in
607
+ # DNS.
608
+ #
609
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
610
+ # @param custom_domain_properties [ValidateCustomDomainInput] Custom domain to
611
+ # validate.
612
+ # @param profile_name [String] Name of the CDN profile within the resource
613
+ # group.
614
+ # @param resource_group_name [String] Name of the resource group within the
615
+ # Azure subscription.
616
+ # @param [Hash{String => String}] A hash of custom headers that will be added
617
+ # to the HTTP request.
618
+ #
619
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
620
+ #
621
+ def validate_custom_domain_async(endpoint_name, custom_domain_properties, profile_name, resource_group_name, custom_headers = nil)
622
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
623
+ fail ArgumentError, 'custom_domain_properties is nil' if custom_domain_properties.nil?
624
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
625
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
626
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
627
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
628
+
629
+
630
+ request_headers = {}
631
+
632
+ # Set Headers
633
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
634
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
635
+
636
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
637
+
638
+ # Serialize Request
639
+ request_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::ValidateCustomDomainInput.mapper()
640
+ request_content = @client.serialize(request_mapper, custom_domain_properties)
641
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
642
+
643
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/validateCustomDomain'
644
+
645
+ request_url = @base_url || @client.base_url
646
+
647
+ options = {
648
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
649
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
650
+ query_params: {'api-version' => @client.api_version},
651
+ body: request_content,
652
+ headers: request_headers.merge(custom_headers || {}),
653
+ base_url: request_url
654
+ }
655
+ promise = @client.make_request_async(:post, path_template, options)
656
+
657
+ promise = promise.then do |result|
658
+ http_response = result.response
659
+ status_code = http_response.status
660
+ response_content = http_response.body
661
+ unless status_code == 200
662
+ error_model = JSON.load(response_content)
663
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
664
+ end
665
+
666
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
667
+ # Deserialize Response
668
+ if status_code == 200
669
+ begin
670
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
671
+ result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::ValidateCustomDomainOutput.mapper()
672
+ result.body = @client.deserialize(result_mapper, parsed_response)
673
+ rescue Exception => e
674
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
675
+ end
676
+ end
677
+
678
+ result
679
+ end
680
+
681
+ promise.execute
682
+ end
683
+
684
+ #
685
+ # Creates a new CDN endpoint with the specified parameters.
686
+ #
687
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
688
+ # @param endpoint_properties [EndpointCreateParameters] Endpoint properties
689
+ # @param profile_name [String] Name of the CDN profile within the resource
690
+ # group.
691
+ # @param resource_group_name [String] Name of the resource group within the
692
+ # Azure subscription.
693
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
694
+ # will be added to the HTTP request.
695
+ #
696
+ # @return [Endpoint] operation results.
697
+ #
698
+ def begin_create(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
699
+ response = begin_create_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers).value!
700
+ response.body unless response.nil?
701
+ end
702
+
703
+ #
704
+ # Creates a new CDN endpoint with the specified parameters.
705
+ #
706
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
707
+ # @param endpoint_properties [EndpointCreateParameters] Endpoint properties
708
+ # @param profile_name [String] Name of the CDN profile within the resource
709
+ # group.
710
+ # @param resource_group_name [String] Name of the resource group within the
711
+ # Azure subscription.
712
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
713
+ # will be added to the HTTP request.
714
+ #
715
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
716
+ #
717
+ def begin_create_with_http_info(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
718
+ begin_create_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers).value!
719
+ end
720
+
721
+ #
722
+ # Creates a new CDN endpoint with the specified parameters.
723
+ #
724
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
725
+ # @param endpoint_properties [EndpointCreateParameters] Endpoint properties
726
+ # @param profile_name [String] Name of the CDN profile within the resource
727
+ # group.
728
+ # @param resource_group_name [String] Name of the resource group within the
729
+ # Azure subscription.
730
+ # @param [Hash{String => String}] A hash of custom headers that will be added
731
+ # to the HTTP request.
732
+ #
733
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
734
+ #
735
+ def begin_create_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
736
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
737
+ fail ArgumentError, 'endpoint_properties is nil' if endpoint_properties.nil?
738
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
739
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
740
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
741
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
742
+
743
+
744
+ request_headers = {}
745
+
746
+ # Set Headers
747
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
748
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
749
+
750
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
751
+
752
+ # Serialize Request
753
+ request_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::EndpointCreateParameters.mapper()
754
+ request_content = @client.serialize(request_mapper, endpoint_properties)
755
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
756
+
757
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
758
+
759
+ request_url = @base_url || @client.base_url
760
+
761
+ options = {
762
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
763
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
764
+ query_params: {'api-version' => @client.api_version},
765
+ body: request_content,
766
+ headers: request_headers.merge(custom_headers || {}),
767
+ base_url: request_url
768
+ }
769
+ promise = @client.make_request_async(:put, path_template, options)
770
+
771
+ promise = promise.then do |result|
772
+ http_response = result.response
773
+ status_code = http_response.status
774
+ response_content = http_response.body
775
+ unless status_code == 200 || status_code == 201 || status_code == 202
776
+ error_model = JSON.load(response_content)
777
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
778
+ end
779
+
780
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
781
+ # Deserialize Response
782
+ if status_code == 200
783
+ begin
784
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
785
+ result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Endpoint.mapper()
786
+ result.body = @client.deserialize(result_mapper, parsed_response)
787
+ rescue Exception => e
788
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
789
+ end
790
+ end
791
+ # Deserialize Response
792
+ if status_code == 201
793
+ begin
794
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
795
+ result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Endpoint.mapper()
796
+ result.body = @client.deserialize(result_mapper, parsed_response)
797
+ rescue Exception => e
798
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
799
+ end
800
+ end
801
+ # Deserialize Response
802
+ if status_code == 202
803
+ begin
804
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
805
+ result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Endpoint.mapper()
806
+ result.body = @client.deserialize(result_mapper, parsed_response)
807
+ rescue Exception => e
808
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
809
+ end
810
+ end
811
+
812
+ result
813
+ end
814
+
815
+ promise.execute
816
+ end
817
+
818
+ #
819
+ # Updates an existing CDN endpoint with the specified parameters. Only tags and
820
+ # OriginHostHeader can be updated after creating an endpoint. To update
821
+ # origins, use the Update Origin operation. To update custom domains, use the
822
+ # Update Custom Domain operation.
823
+ #
824
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
825
+ # @param endpoint_properties [EndpointUpdateParameters] Endpoint properties
826
+ # @param profile_name [String] Name of the CDN profile within the resource
827
+ # group.
828
+ # @param resource_group_name [String] Name of the resource group within the
829
+ # Azure subscription.
830
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
831
+ # will be added to the HTTP request.
832
+ #
833
+ # @return [Endpoint] operation results.
834
+ #
835
+ def begin_update(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
836
+ response = begin_update_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers).value!
837
+ response.body unless response.nil?
838
+ end
839
+
840
+ #
841
+ # Updates an existing CDN endpoint with the specified parameters. Only tags and
842
+ # OriginHostHeader can be updated after creating an endpoint. To update
843
+ # origins, use the Update Origin operation. To update custom domains, use the
844
+ # Update Custom Domain operation.
845
+ #
846
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
847
+ # @param endpoint_properties [EndpointUpdateParameters] Endpoint properties
848
+ # @param profile_name [String] Name of the CDN profile within the resource
849
+ # group.
850
+ # @param resource_group_name [String] Name of the resource group within the
851
+ # Azure subscription.
852
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
853
+ # will be added to the HTTP request.
854
+ #
855
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
856
+ #
857
+ def begin_update_with_http_info(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
858
+ begin_update_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers).value!
859
+ end
860
+
861
+ #
862
+ # Updates an existing CDN endpoint with the specified parameters. Only tags and
863
+ # OriginHostHeader can be updated after creating an endpoint. To update
864
+ # origins, use the Update Origin operation. To update custom domains, use the
865
+ # Update Custom Domain operation.
866
+ #
867
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
868
+ # @param endpoint_properties [EndpointUpdateParameters] Endpoint properties
869
+ # @param profile_name [String] Name of the CDN profile within the resource
870
+ # group.
871
+ # @param resource_group_name [String] Name of the resource group within the
872
+ # Azure subscription.
873
+ # @param [Hash{String => String}] A hash of custom headers that will be added
874
+ # to the HTTP request.
875
+ #
876
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
877
+ #
878
+ def begin_update_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
879
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
880
+ fail ArgumentError, 'endpoint_properties is nil' if endpoint_properties.nil?
881
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
882
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
883
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
884
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
885
+
886
+
887
+ request_headers = {}
888
+
889
+ # Set Headers
890
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
891
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
892
+
893
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
894
+
895
+ # Serialize Request
896
+ request_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::EndpointUpdateParameters.mapper()
897
+ request_content = @client.serialize(request_mapper, endpoint_properties)
898
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
899
+
900
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
901
+
902
+ request_url = @base_url || @client.base_url
903
+
904
+ options = {
905
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
906
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
907
+ query_params: {'api-version' => @client.api_version},
908
+ body: request_content,
909
+ headers: request_headers.merge(custom_headers || {}),
910
+ base_url: request_url
911
+ }
912
+ promise = @client.make_request_async(:patch, path_template, options)
913
+
914
+ promise = promise.then do |result|
915
+ http_response = result.response
916
+ status_code = http_response.status
917
+ response_content = http_response.body
918
+ unless status_code == 200 || status_code == 202
919
+ error_model = JSON.load(response_content)
920
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
921
+ end
922
+
923
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
924
+ # Deserialize Response
925
+ if status_code == 200
926
+ begin
927
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
928
+ result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Endpoint.mapper()
929
+ result.body = @client.deserialize(result_mapper, parsed_response)
930
+ rescue Exception => e
931
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
932
+ end
933
+ end
934
+ # Deserialize Response
935
+ if status_code == 202
936
+ begin
937
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
938
+ result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Endpoint.mapper()
939
+ result.body = @client.deserialize(result_mapper, parsed_response)
940
+ rescue Exception => e
941
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
942
+ end
943
+ end
944
+
945
+ result
946
+ end
947
+
948
+ promise.execute
949
+ end
950
+
951
+ #
952
+ # Deletes an existing CDN endpoint with the specified parameters.
953
+ #
954
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
955
+ # @param profile_name [String] Name of the CDN profile within the resource
956
+ # group.
957
+ # @param resource_group_name [String] Name of the resource group within the
958
+ # Azure subscription.
959
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
960
+ # will be added to the HTTP request.
961
+ #
962
+ #
963
+ def begin_delete_if_exists(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
964
+ response = begin_delete_if_exists_async(endpoint_name, profile_name, resource_group_name, custom_headers).value!
965
+ nil
966
+ end
967
+
968
+ #
969
+ # Deletes an existing CDN endpoint with the specified parameters.
970
+ #
971
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
972
+ # @param profile_name [String] Name of the CDN profile within the resource
973
+ # group.
974
+ # @param resource_group_name [String] Name of the resource group within the
975
+ # Azure subscription.
976
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
977
+ # will be added to the HTTP request.
978
+ #
979
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
980
+ #
981
+ def begin_delete_if_exists_with_http_info(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
982
+ begin_delete_if_exists_async(endpoint_name, profile_name, resource_group_name, custom_headers).value!
983
+ end
984
+
985
+ #
986
+ # Deletes an existing CDN endpoint with the specified parameters.
987
+ #
988
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
989
+ # @param profile_name [String] Name of the CDN profile within the resource
990
+ # group.
991
+ # @param resource_group_name [String] Name of the resource group within the
992
+ # Azure subscription.
993
+ # @param [Hash{String => String}] A hash of custom headers that will be added
994
+ # to the HTTP request.
995
+ #
996
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
997
+ #
998
+ def begin_delete_if_exists_async(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
999
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
1000
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1001
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1002
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1003
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1004
+
1005
+
1006
+ request_headers = {}
1007
+
1008
+ # Set Headers
1009
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1010
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1011
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
1012
+
1013
+ request_url = @base_url || @client.base_url
1014
+
1015
+ options = {
1016
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1017
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
1018
+ query_params: {'api-version' => @client.api_version},
1019
+ headers: request_headers.merge(custom_headers || {}),
1020
+ base_url: request_url
1021
+ }
1022
+ promise = @client.make_request_async(:delete, path_template, options)
1023
+
1024
+ promise = promise.then do |result|
1025
+ http_response = result.response
1026
+ status_code = http_response.status
1027
+ response_content = http_response.body
1028
+ unless status_code == 202 || status_code == 204
1029
+ error_model = JSON.load(response_content)
1030
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1031
+ end
1032
+
1033
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1034
+
1035
+ result
1036
+ end
1037
+
1038
+ promise.execute
1039
+ end
1040
+
1041
+ #
1042
+ # Starts an existing stopped CDN endpoint.
1043
+ #
1044
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1045
+ # @param profile_name [String] Name of the CDN profile within the resource
1046
+ # group.
1047
+ # @param resource_group_name [String] Name of the resource group within the
1048
+ # Azure subscription.
1049
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1050
+ # will be added to the HTTP request.
1051
+ #
1052
+ # @return [Endpoint] operation results.
1053
+ #
1054
+ def begin_start(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
1055
+ response = begin_start_async(endpoint_name, profile_name, resource_group_name, custom_headers).value!
1056
+ response.body unless response.nil?
1057
+ end
1058
+
1059
+ #
1060
+ # Starts an existing stopped CDN endpoint.
1061
+ #
1062
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1063
+ # @param profile_name [String] Name of the CDN profile within the resource
1064
+ # group.
1065
+ # @param resource_group_name [String] Name of the resource group within the
1066
+ # Azure subscription.
1067
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1068
+ # will be added to the HTTP request.
1069
+ #
1070
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1071
+ #
1072
+ def begin_start_with_http_info(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
1073
+ begin_start_async(endpoint_name, profile_name, resource_group_name, custom_headers).value!
1074
+ end
1075
+
1076
+ #
1077
+ # Starts an existing stopped CDN endpoint.
1078
+ #
1079
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1080
+ # @param profile_name [String] Name of the CDN profile within the resource
1081
+ # group.
1082
+ # @param resource_group_name [String] Name of the resource group within the
1083
+ # Azure subscription.
1084
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1085
+ # to the HTTP request.
1086
+ #
1087
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1088
+ #
1089
+ def begin_start_async(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
1090
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
1091
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1092
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1093
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1094
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1095
+
1096
+
1097
+ request_headers = {}
1098
+
1099
+ # Set Headers
1100
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1101
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1102
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start'
1103
+
1104
+ request_url = @base_url || @client.base_url
1105
+
1106
+ options = {
1107
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1108
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
1109
+ query_params: {'api-version' => @client.api_version},
1110
+ headers: request_headers.merge(custom_headers || {}),
1111
+ base_url: request_url
1112
+ }
1113
+ promise = @client.make_request_async(:post, path_template, options)
1114
+
1115
+ promise = promise.then do |result|
1116
+ http_response = result.response
1117
+ status_code = http_response.status
1118
+ response_content = http_response.body
1119
+ unless status_code == 202
1120
+ error_model = JSON.load(response_content)
1121
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1122
+ end
1123
+
1124
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1125
+ # Deserialize Response
1126
+ if status_code == 202
1127
+ begin
1128
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1129
+ result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Endpoint.mapper()
1130
+ result.body = @client.deserialize(result_mapper, parsed_response)
1131
+ rescue Exception => e
1132
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1133
+ end
1134
+ end
1135
+
1136
+ result
1137
+ end
1138
+
1139
+ promise.execute
1140
+ end
1141
+
1142
+ #
1143
+ # Stops an existing running CDN endpoint.
1144
+ #
1145
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1146
+ # @param profile_name [String] Name of the CDN profile within the resource
1147
+ # group.
1148
+ # @param resource_group_name [String] Name of the resource group within the
1149
+ # Azure subscription.
1150
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1151
+ # will be added to the HTTP request.
1152
+ #
1153
+ # @return [Endpoint] operation results.
1154
+ #
1155
+ def begin_stop(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
1156
+ response = begin_stop_async(endpoint_name, profile_name, resource_group_name, custom_headers).value!
1157
+ response.body unless response.nil?
1158
+ end
1159
+
1160
+ #
1161
+ # Stops an existing running CDN endpoint.
1162
+ #
1163
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1164
+ # @param profile_name [String] Name of the CDN profile within the resource
1165
+ # group.
1166
+ # @param resource_group_name [String] Name of the resource group within the
1167
+ # Azure subscription.
1168
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1169
+ # will be added to the HTTP request.
1170
+ #
1171
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1172
+ #
1173
+ def begin_stop_with_http_info(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
1174
+ begin_stop_async(endpoint_name, profile_name, resource_group_name, custom_headers).value!
1175
+ end
1176
+
1177
+ #
1178
+ # Stops an existing running CDN endpoint.
1179
+ #
1180
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1181
+ # @param profile_name [String] Name of the CDN profile within the resource
1182
+ # group.
1183
+ # @param resource_group_name [String] Name of the resource group within the
1184
+ # Azure subscription.
1185
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1186
+ # to the HTTP request.
1187
+ #
1188
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1189
+ #
1190
+ def begin_stop_async(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
1191
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
1192
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1193
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1194
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1195
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1196
+
1197
+
1198
+ request_headers = {}
1199
+
1200
+ # Set Headers
1201
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1202
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1203
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop'
1204
+
1205
+ request_url = @base_url || @client.base_url
1206
+
1207
+ options = {
1208
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1209
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
1210
+ query_params: {'api-version' => @client.api_version},
1211
+ headers: request_headers.merge(custom_headers || {}),
1212
+ base_url: request_url
1213
+ }
1214
+ promise = @client.make_request_async(:post, path_template, options)
1215
+
1216
+ promise = promise.then do |result|
1217
+ http_response = result.response
1218
+ status_code = http_response.status
1219
+ response_content = http_response.body
1220
+ unless status_code == 202
1221
+ error_model = JSON.load(response_content)
1222
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1223
+ end
1224
+
1225
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1226
+ # Deserialize Response
1227
+ if status_code == 202
1228
+ begin
1229
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1230
+ result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Endpoint.mapper()
1231
+ result.body = @client.deserialize(result_mapper, parsed_response)
1232
+ rescue Exception => e
1233
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1234
+ end
1235
+ end
1236
+
1237
+ result
1238
+ end
1239
+
1240
+ promise.execute
1241
+ end
1242
+
1243
+ #
1244
+ # Forcibly purges CDN endpoint content.
1245
+ #
1246
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1247
+ # @param content_file_paths [PurgeParameters] The path to the content to be
1248
+ # purged. Path can describe a file or directory.
1249
+ # @param profile_name [String] Name of the CDN profile within the resource
1250
+ # group.
1251
+ # @param resource_group_name [String] Name of the resource group within the
1252
+ # Azure subscription.
1253
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1254
+ # will be added to the HTTP request.
1255
+ #
1256
+ #
1257
+ def begin_purge_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
1258
+ response = begin_purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers).value!
1259
+ nil
1260
+ end
1261
+
1262
+ #
1263
+ # Forcibly purges CDN endpoint content.
1264
+ #
1265
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1266
+ # @param content_file_paths [PurgeParameters] The path to the content to be
1267
+ # purged. Path can describe a file or directory.
1268
+ # @param profile_name [String] Name of the CDN profile within the resource
1269
+ # group.
1270
+ # @param resource_group_name [String] Name of the resource group within the
1271
+ # Azure subscription.
1272
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1273
+ # will be added to the HTTP request.
1274
+ #
1275
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1276
+ #
1277
+ def begin_purge_content_with_http_info(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
1278
+ begin_purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers).value!
1279
+ end
1280
+
1281
+ #
1282
+ # Forcibly purges CDN endpoint content.
1283
+ #
1284
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1285
+ # @param content_file_paths [PurgeParameters] The path to the content to be
1286
+ # purged. Path can describe a file or directory.
1287
+ # @param profile_name [String] Name of the CDN profile within the resource
1288
+ # group.
1289
+ # @param resource_group_name [String] Name of the resource group within the
1290
+ # Azure subscription.
1291
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1292
+ # to the HTTP request.
1293
+ #
1294
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1295
+ #
1296
+ def begin_purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
1297
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
1298
+ fail ArgumentError, 'content_file_paths is nil' if content_file_paths.nil?
1299
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1300
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1301
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1302
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1303
+
1304
+
1305
+ request_headers = {}
1306
+
1307
+ # Set Headers
1308
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1309
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1310
+
1311
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1312
+
1313
+ # Serialize Request
1314
+ request_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::PurgeParameters.mapper()
1315
+ request_content = @client.serialize(request_mapper, content_file_paths)
1316
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1317
+
1318
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge'
1319
+
1320
+ request_url = @base_url || @client.base_url
1321
+
1322
+ options = {
1323
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1324
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
1325
+ query_params: {'api-version' => @client.api_version},
1326
+ body: request_content,
1327
+ headers: request_headers.merge(custom_headers || {}),
1328
+ base_url: request_url
1329
+ }
1330
+ promise = @client.make_request_async(:post, path_template, options)
1331
+
1332
+ promise = promise.then do |result|
1333
+ http_response = result.response
1334
+ status_code = http_response.status
1335
+ response_content = http_response.body
1336
+ unless status_code == 202
1337
+ error_model = JSON.load(response_content)
1338
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1339
+ end
1340
+
1341
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1342
+
1343
+ result
1344
+ end
1345
+
1346
+ promise.execute
1347
+ end
1348
+
1349
+ #
1350
+ # Forcibly pre-loads CDN endpoint content.
1351
+ #
1352
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1353
+ # @param content_file_paths [LoadParameters] The path to the content to be
1354
+ # loaded. Path should describe a file.
1355
+ # @param profile_name [String] Name of the CDN profile within the resource
1356
+ # group.
1357
+ # @param resource_group_name [String] Name of the resource group within the
1358
+ # Azure subscription.
1359
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1360
+ # will be added to the HTTP request.
1361
+ #
1362
+ #
1363
+ def begin_load_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
1364
+ response = begin_load_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers).value!
1365
+ nil
1366
+ end
1367
+
1368
+ #
1369
+ # Forcibly pre-loads CDN endpoint content.
1370
+ #
1371
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1372
+ # @param content_file_paths [LoadParameters] The path to the content to be
1373
+ # loaded. Path should describe a file.
1374
+ # @param profile_name [String] Name of the CDN profile within the resource
1375
+ # group.
1376
+ # @param resource_group_name [String] Name of the resource group within the
1377
+ # Azure subscription.
1378
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1379
+ # will be added to the HTTP request.
1380
+ #
1381
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1382
+ #
1383
+ def begin_load_content_with_http_info(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
1384
+ begin_load_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers).value!
1385
+ end
1386
+
1387
+ #
1388
+ # Forcibly pre-loads CDN endpoint content.
1389
+ #
1390
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1391
+ # @param content_file_paths [LoadParameters] The path to the content to be
1392
+ # loaded. Path should describe a file.
1393
+ # @param profile_name [String] Name of the CDN profile within the resource
1394
+ # group.
1395
+ # @param resource_group_name [String] Name of the resource group within the
1396
+ # Azure subscription.
1397
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1398
+ # to the HTTP request.
1399
+ #
1400
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1401
+ #
1402
+ def begin_load_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
1403
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
1404
+ fail ArgumentError, 'content_file_paths is nil' if content_file_paths.nil?
1405
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1406
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1407
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1408
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1409
+
1410
+
1411
+ request_headers = {}
1412
+
1413
+ # Set Headers
1414
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1415
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1416
+
1417
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1418
+
1419
+ # Serialize Request
1420
+ request_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::LoadParameters.mapper()
1421
+ request_content = @client.serialize(request_mapper, content_file_paths)
1422
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1423
+
1424
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load'
1425
+
1426
+ request_url = @base_url || @client.base_url
1427
+
1428
+ options = {
1429
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1430
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
1431
+ query_params: {'api-version' => @client.api_version},
1432
+ body: request_content,
1433
+ headers: request_headers.merge(custom_headers || {}),
1434
+ base_url: request_url
1435
+ }
1436
+ promise = @client.make_request_async(:post, path_template, options)
1437
+
1438
+ promise = promise.then do |result|
1439
+ http_response = result.response
1440
+ status_code = http_response.status
1441
+ response_content = http_response.body
1442
+ unless status_code == 202
1443
+ error_model = JSON.load(response_content)
1444
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1445
+ end
1446
+
1447
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1448
+
1449
+ result
1450
+ end
1451
+
1452
+ promise.execute
1453
+ end
1454
+
1455
+ end
1456
+ end