azure_mgmt_cdn 0.15.2 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-06-01/generated/azure_mgmt_cdn/cdn_management_client.rb +4 -1
  3. data/lib/2015-06-01/generated/azure_mgmt_cdn/custom_domains.rb +38 -37
  4. data/lib/2015-06-01/generated/azure_mgmt_cdn/endpoints.rb +88 -88
  5. data/lib/2015-06-01/generated/azure_mgmt_cdn/name_availability.rb +6 -7
  6. data/lib/2015-06-01/generated/azure_mgmt_cdn/operations.rb +6 -5
  7. data/lib/2015-06-01/generated/azure_mgmt_cdn/origins.rb +42 -41
  8. data/lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb +54 -51
  9. data/lib/2016-04-02/generated/azure_mgmt_cdn.rb +70 -0
  10. data/lib/2016-04-02/generated/azure_mgmt_cdn/cdn_management_client.rb +151 -0
  11. data/lib/2016-04-02/generated/azure_mgmt_cdn/custom_domains.rb +719 -0
  12. data/lib/2016-04-02/generated/azure_mgmt_cdn/endpoints.rb +1456 -0
  13. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/check_name_availability_input.rb +60 -0
  14. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/check_name_availability_output.rb +69 -0
  15. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/custom_domain.rb +103 -0
  16. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/custom_domain_list_result.rb +57 -0
  17. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/custom_domain_parameters.rb +47 -0
  18. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/custom_domain_resource_state.rb +17 -0
  19. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/deep_created_origin.rb +82 -0
  20. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/endpoint.rb +249 -0
  21. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/endpoint_create_parameters.rb +185 -0
  22. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/endpoint_list_result.rb +56 -0
  23. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/endpoint_resource_state.rb +20 -0
  24. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/endpoint_update_parameters.rb +152 -0
  25. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/error_response.rb +58 -0
  26. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/load_parameters.rb +55 -0
  27. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/operation.rb +58 -0
  28. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/operation_display.rb +70 -0
  29. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/operation_list_result.rb +57 -0
  30. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/origin.rb +128 -0
  31. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/origin_list_result.rb +56 -0
  32. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/origin_parameters.rb +71 -0
  33. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/origin_resource_state.rb +17 -0
  34. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/profile.rb +128 -0
  35. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/profile_create_parameters.rb +77 -0
  36. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/profile_list_result.rb +56 -0
  37. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/profile_resource_state.rb +18 -0
  38. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/profile_update_parameters.rb +54 -0
  39. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/provisioning_state.rb +17 -0
  40. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/purge_parameters.rb +55 -0
  41. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/query_string_caching_behavior.rb +18 -0
  42. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/resource.rb +72 -0
  43. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/resource_type.rb +15 -0
  44. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/sku.rb +49 -0
  45. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/sku_name.rb +18 -0
  46. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/sso_uri.rb +46 -0
  47. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/tracked_resource.rb +92 -0
  48. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/validate_custom_domain_input.rb +47 -0
  49. data/lib/2016-04-02/generated/azure_mgmt_cdn/models/validate_custom_domain_output.rb +70 -0
  50. data/lib/2016-04-02/generated/azure_mgmt_cdn/module_definition.rb +9 -0
  51. data/lib/2016-04-02/generated/azure_mgmt_cdn/name_availability.rb +130 -0
  52. data/lib/2016-04-02/generated/azure_mgmt_cdn/operations.rb +110 -0
  53. data/lib/2016-04-02/generated/azure_mgmt_cdn/origins.rb +778 -0
  54. data/lib/2016-04-02/generated/azure_mgmt_cdn/profiles.rb +899 -0
  55. data/lib/2016-10-02/generated/azure_mgmt_cdn/cdn_management_client.rb +46 -38
  56. data/lib/2016-10-02/generated/azure_mgmt_cdn/custom_domains.rb +53 -48
  57. data/lib/2016-10-02/generated/azure_mgmt_cdn/edge_nodes.rb +15 -13
  58. data/lib/2016-10-02/generated/azure_mgmt_cdn/endpoints.rb +112 -109
  59. data/lib/2016-10-02/generated/azure_mgmt_cdn/origins.rb +31 -29
  60. data/lib/2016-10-02/generated/azure_mgmt_cdn/profiles.rb +93 -85
  61. data/lib/2017-04-02/generated/azure_mgmt_cdn.rb +18 -16
  62. data/lib/2017-04-02/generated/azure_mgmt_cdn/cdn_management_client.rb +16 -15
  63. data/lib/2017-04-02/generated/azure_mgmt_cdn/custom_domains.rb +53 -48
  64. data/lib/2017-04-02/generated/azure_mgmt_cdn/edge_nodes.rb +15 -13
  65. data/lib/2017-04-02/generated/azure_mgmt_cdn/endpoints.rb +136 -113
  66. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/custom_domain.rb +1 -25
  67. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/edge_node.rb +1 -25
  68. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/endpoint.rb +6 -3
  69. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/endpoint_update_parameters.rb +5 -2
  70. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/origin.rb +1 -1
  71. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/profile.rb +1 -1
  72. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/profile_update_parameters.rb +1 -1
  73. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/proxy_resource.rb +63 -0
  74. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/resource.rb +1 -31
  75. data/lib/2017-04-02/generated/azure_mgmt_cdn/models/tracked_resource.rb +92 -0
  76. data/lib/2017-04-02/generated/azure_mgmt_cdn/operations.rb +15 -13
  77. data/lib/2017-04-02/generated/azure_mgmt_cdn/origins.rb +31 -29
  78. data/lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb +93 -85
  79. data/lib/2017-04-02/generated/azure_mgmt_cdn/resource_usage_operations.rb +15 -13
  80. data/lib/2017-10-12/generated/azure_mgmt_cdn.rb +93 -0
  81. data/lib/2017-10-12/generated/azure_mgmt_cdn/cdn_management_client.rb +358 -0
  82. data/lib/2017-10-12/generated/azure_mgmt_cdn/custom_domains.rb +970 -0
  83. data/lib/2017-10-12/generated/azure_mgmt_cdn/edge_nodes.rb +223 -0
  84. data/lib/2017-10-12/generated/azure_mgmt_cdn/endpoints.rb +1922 -0
  85. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/cache_expiration_action_parameters.rb +89 -0
  86. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/check_name_availability_input.rb +60 -0
  87. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/check_name_availability_output.rb +72 -0
  88. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/cidr_ip_address.rb +57 -0
  89. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/custom_domain.rb +148 -0
  90. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/custom_domain_list_result.rb +102 -0
  91. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/custom_domain_parameters.rb +48 -0
  92. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/custom_domain_resource_state.rb +17 -0
  93. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/custom_https_provisioning_state.rb +19 -0
  94. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/custom_https_provisioning_substate.rb +24 -0
  95. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/deep_created_origin.rb +91 -0
  96. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/delivery_rule.rb +96 -0
  97. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/delivery_rule_action.rb +46 -0
  98. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/delivery_rule_cache_expiration_action.rb +64 -0
  99. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/delivery_rule_condition.rb +47 -0
  100. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/delivery_rule_url_file_extension_condition.rb +64 -0
  101. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/delivery_rule_url_path_condition.rb +64 -0
  102. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/edge_node.rb +83 -0
  103. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/edgenode_result.rb +101 -0
  104. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/endpoint.rb +318 -0
  105. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/endpoint_list_result.rb +101 -0
  106. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/endpoint_properties_update_parameters_delivery_policy.rb +67 -0
  107. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/endpoint_resource_state.rb +20 -0
  108. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/endpoint_update_parameters.rb +223 -0
  109. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/error_response.rb +60 -0
  110. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/geo_filter.rb +80 -0
  111. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/geo_filter_actions.rb +16 -0
  112. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/ip_address_group.rb +86 -0
  113. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/load_parameters.rb +55 -0
  114. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/operation.rb +59 -0
  115. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/operation_display.rb +72 -0
  116. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/operations_list_result.rb +102 -0
  117. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/optimization_type.rb +19 -0
  118. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/origin.rb +158 -0
  119. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/origin_list_result.rb +101 -0
  120. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/origin_resource_state.rb +17 -0
  121. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/origin_update_parameters.rb +79 -0
  122. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/profile.rb +125 -0
  123. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/profile_list_result.rb +101 -0
  124. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/profile_resource_state.rb +18 -0
  125. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/profile_update_parameters.rb +54 -0
  126. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/proxy_resource.rb +63 -0
  127. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/purge_parameters.rb +55 -0
  128. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/query_string_caching_behavior.rb +18 -0
  129. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/resource.rb +71 -0
  130. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/resource_type.rb +15 -0
  131. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/resource_usage.rb +83 -0
  132. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/resource_usage_list_result.rb +100 -0
  133. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/sku.rb +49 -0
  134. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/sku_name.rb +19 -0
  135. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/sso_uri.rb +48 -0
  136. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/supported_optimization_types_list_result.rb +56 -0
  137. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/tracked_resource.rb +92 -0
  138. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/url_file_extension_condition_parameters.rb +70 -0
  139. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/url_path_condition_parameters.rb +72 -0
  140. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/validate_custom_domain_input.rb +47 -0
  141. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/validate_custom_domain_output.rb +72 -0
  142. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/validate_probe_input.rb +46 -0
  143. data/lib/2017-10-12/generated/azure_mgmt_cdn/models/validate_probe_output.rb +73 -0
  144. data/lib/2017-10-12/generated/azure_mgmt_cdn/module_definition.rb +9 -0
  145. data/lib/2017-10-12/generated/azure_mgmt_cdn/operations.rb +217 -0
  146. data/lib/2017-10-12/generated/azure_mgmt_cdn/origins.rb +556 -0
  147. data/lib/2017-10-12/generated/azure_mgmt_cdn/profiles.rb +1460 -0
  148. data/lib/2017-10-12/generated/azure_mgmt_cdn/resource_usage_operations.rb +226 -0
  149. data/lib/azure_mgmt_cdn.rb +2 -0
  150. data/lib/profiles/latest/cdn_latest_profile_client.rb +28 -9
  151. data/lib/profiles/latest/cdn_module_definition.rb +0 -1
  152. data/lib/profiles/latest/modules/cdn_profile_module.rb +277 -210
  153. data/lib/version.rb +1 -1
  154. metadata +119 -2
@@ -0,0 +1,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::V2016_04_02
7
+ #
8
+ # Use these APIs to manage Azure CDN resources through the Azure Resource
9
+ # Manager. You must make sure that requests made to these resources are
10
+ # secure. For more information, see
11
+ # https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx.
12
+ #
13
+ class 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: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: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
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
81
+
82
+ # Set Headers
83
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
84
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
85
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints'
86
+
87
+ request_url = @base_url || @client.base_url
88
+
89
+ options = {
90
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
91
+ path_params: {'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
92
+ query_params: {'api-version' => @client.api_version},
93
+ headers: request_headers.merge(custom_headers || {}),
94
+ base_url: request_url
95
+ }
96
+ promise = @client.make_request_async(:get, path_template, options)
97
+
98
+ promise = promise.then do |result|
99
+ http_response = result.response
100
+ status_code = http_response.status
101
+ response_content = http_response.body
102
+ unless status_code == 200
103
+ error_model = JSON.load(response_content)
104
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
105
+ end
106
+
107
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
108
+ # Deserialize Response
109
+ if status_code == 200
110
+ begin
111
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
112
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::EndpointListResult.mapper()
113
+ result.body = @client.deserialize(result_mapper, parsed_response)
114
+ rescue Exception => e
115
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
116
+ end
117
+ end
118
+
119
+ result
120
+ end
121
+
122
+ promise.execute
123
+ end
124
+
125
+ #
126
+ # Gets an existing CDN endpoint with the specified parameters.
127
+ #
128
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
129
+ # @param profile_name [String] Name of the CDN profile within the resource
130
+ # group.
131
+ # @param resource_group_name [String] Name of the resource group within the
132
+ # Azure subscription.
133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
134
+ # will be added to the HTTP request.
135
+ #
136
+ # @return [Endpoint] operation results.
137
+ #
138
+ def get(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
139
+ response = get_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
140
+ response.body unless response.nil?
141
+ end
142
+
143
+ #
144
+ # Gets an existing CDN endpoint with the specified parameters.
145
+ #
146
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
147
+ # @param profile_name [String] Name of the CDN profile within the resource
148
+ # group.
149
+ # @param resource_group_name [String] Name of the resource group within the
150
+ # Azure subscription.
151
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
152
+ # will be added to the HTTP request.
153
+ #
154
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
155
+ #
156
+ def get_with_http_info(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
157
+ get_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
158
+ end
159
+
160
+ #
161
+ # Gets an existing CDN endpoint with the specified parameters.
162
+ #
163
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
164
+ # @param profile_name [String] Name of the CDN profile within the resource
165
+ # group.
166
+ # @param resource_group_name [String] Name of the resource group within the
167
+ # Azure subscription.
168
+ # @param [Hash{String => String}] A hash of custom headers that will be added
169
+ # to the HTTP request.
170
+ #
171
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
172
+ #
173
+ def get_async(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
174
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
175
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
176
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
177
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
178
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
179
+
180
+
181
+ request_headers = {}
182
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
183
+
184
+ # Set Headers
185
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
186
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
187
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
188
+
189
+ request_url = @base_url || @client.base_url
190
+
191
+ options = {
192
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
193
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
194
+ query_params: {'api-version' => @client.api_version},
195
+ headers: request_headers.merge(custom_headers || {}),
196
+ base_url: request_url
197
+ }
198
+ promise = @client.make_request_async(:get, path_template, options)
199
+
200
+ promise = promise.then do |result|
201
+ http_response = result.response
202
+ status_code = http_response.status
203
+ response_content = http_response.body
204
+ unless status_code == 200
205
+ error_model = JSON.load(response_content)
206
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
207
+ end
208
+
209
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
210
+ # Deserialize Response
211
+ if status_code == 200
212
+ begin
213
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
214
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Endpoint.mapper()
215
+ result.body = @client.deserialize(result_mapper, parsed_response)
216
+ rescue Exception => e
217
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
218
+ end
219
+ end
220
+
221
+ result
222
+ end
223
+
224
+ promise.execute
225
+ end
226
+
227
+ #
228
+ # Creates a new CDN endpoint with the specified parameters.
229
+ #
230
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
231
+ # @param endpoint_properties [EndpointCreateParameters] Endpoint properties
232
+ # @param profile_name [String] Name of the CDN profile within the resource
233
+ # group.
234
+ # @param resource_group_name [String] Name of the resource group within the
235
+ # Azure subscription.
236
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
237
+ # will be added to the HTTP request.
238
+ #
239
+ # @return [Endpoint] operation results.
240
+ #
241
+ def create(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:nil)
242
+ response = create_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:custom_headers).value!
243
+ response.body unless response.nil?
244
+ end
245
+
246
+ #
247
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
248
+ # @param endpoint_properties [EndpointCreateParameters] Endpoint properties
249
+ # @param profile_name [String] Name of the CDN profile within the resource
250
+ # group.
251
+ # @param resource_group_name [String] Name of the resource group within the
252
+ # Azure subscription.
253
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
254
+ # will be added to the HTTP request.
255
+ #
256
+ # @return [Concurrent::Promise] promise which provides async access to http
257
+ # response.
258
+ #
259
+ def create_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:nil)
260
+ # Send request
261
+ promise = begin_create_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:custom_headers)
262
+
263
+ promise = promise.then do |response|
264
+ # Defining deserialization method.
265
+ deserialize_method = lambda do |parsed_response|
266
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Endpoint.mapper()
267
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
268
+ end
269
+
270
+ # Waiting for response.
271
+ @client.get_long_running_operation_result(response, deserialize_method)
272
+ end
273
+
274
+ promise
275
+ end
276
+
277
+ #
278
+ # Updates an existing CDN endpoint with the specified parameters. Only tags and
279
+ # OriginHostHeader can be updated after creating an endpoint. To update
280
+ # origins, use the Update Origin operation. To update custom domains, use the
281
+ # Update Custom Domain operation.
282
+ #
283
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
284
+ # @param endpoint_properties [EndpointUpdateParameters] Endpoint properties
285
+ # @param profile_name [String] Name of the CDN profile within the resource
286
+ # group.
287
+ # @param resource_group_name [String] Name of the resource group within the
288
+ # Azure subscription.
289
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
290
+ # will be added to the HTTP request.
291
+ #
292
+ # @return [Endpoint] operation results.
293
+ #
294
+ def update(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:nil)
295
+ response = update_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:custom_headers).value!
296
+ response.body unless response.nil?
297
+ end
298
+
299
+ #
300
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
301
+ # @param endpoint_properties [EndpointUpdateParameters] Endpoint properties
302
+ # @param profile_name [String] Name of the CDN profile within the resource
303
+ # group.
304
+ # @param resource_group_name [String] Name of the resource group within the
305
+ # Azure subscription.
306
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
307
+ # will be added to the HTTP request.
308
+ #
309
+ # @return [Concurrent::Promise] promise which provides async access to http
310
+ # response.
311
+ #
312
+ def update_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:nil)
313
+ # Send request
314
+ promise = begin_update_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:custom_headers)
315
+
316
+ promise = promise.then do |response|
317
+ # Defining deserialization method.
318
+ deserialize_method = lambda do |parsed_response|
319
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Endpoint.mapper()
320
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
321
+ end
322
+
323
+ # Waiting for response.
324
+ @client.get_long_running_operation_result(response, deserialize_method)
325
+ end
326
+
327
+ promise
328
+ end
329
+
330
+ #
331
+ # Deletes an existing CDN endpoint with the specified parameters.
332
+ #
333
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
334
+ # @param profile_name [String] Name of the CDN profile within the resource
335
+ # group.
336
+ # @param resource_group_name [String] Name of the resource group within the
337
+ # Azure subscription.
338
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
339
+ # will be added to the HTTP request.
340
+ #
341
+ def delete_if_exists(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
342
+ response = delete_if_exists_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
343
+ nil
344
+ end
345
+
346
+ #
347
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
348
+ # @param profile_name [String] Name of the CDN profile within the resource
349
+ # group.
350
+ # @param resource_group_name [String] Name of the resource group within the
351
+ # Azure subscription.
352
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
353
+ # will be added to the HTTP request.
354
+ #
355
+ # @return [Concurrent::Promise] promise which provides async access to http
356
+ # response.
357
+ #
358
+ def delete_if_exists_async(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
359
+ # Send request
360
+ promise = begin_delete_if_exists_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers)
361
+
362
+ promise = promise.then do |response|
363
+ # Defining deserialization method.
364
+ deserialize_method = lambda do |parsed_response|
365
+ end
366
+
367
+ # Waiting for response.
368
+ @client.get_long_running_operation_result(response, deserialize_method)
369
+ end
370
+
371
+ promise
372
+ end
373
+
374
+ #
375
+ # Starts an existing stopped CDN endpoint.
376
+ #
377
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
378
+ # @param profile_name [String] Name of the CDN profile within the resource
379
+ # group.
380
+ # @param resource_group_name [String] Name of the resource group within the
381
+ # Azure subscription.
382
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
383
+ # will be added to the HTTP request.
384
+ #
385
+ # @return [Endpoint] operation results.
386
+ #
387
+ def start(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
388
+ response = start_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
389
+ response.body unless response.nil?
390
+ end
391
+
392
+ #
393
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
394
+ # @param profile_name [String] Name of the CDN profile within the resource
395
+ # group.
396
+ # @param resource_group_name [String] Name of the resource group within the
397
+ # Azure subscription.
398
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
399
+ # will be added to the HTTP request.
400
+ #
401
+ # @return [Concurrent::Promise] promise which provides async access to http
402
+ # response.
403
+ #
404
+ def start_async(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
405
+ # Send request
406
+ promise = begin_start_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers)
407
+
408
+ promise = promise.then do |response|
409
+ # Defining deserialization method.
410
+ deserialize_method = lambda do |parsed_response|
411
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Endpoint.mapper()
412
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
413
+ end
414
+
415
+ # Waiting for response.
416
+ @client.get_long_running_operation_result(response, deserialize_method)
417
+ end
418
+
419
+ promise
420
+ end
421
+
422
+ #
423
+ # Stops an existing running CDN endpoint.
424
+ #
425
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
426
+ # @param profile_name [String] Name of the CDN profile within the resource
427
+ # group.
428
+ # @param resource_group_name [String] Name of the resource group within the
429
+ # Azure subscription.
430
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
431
+ # will be added to the HTTP request.
432
+ #
433
+ # @return [Endpoint] operation results.
434
+ #
435
+ def stop(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
436
+ response = stop_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
437
+ response.body unless response.nil?
438
+ end
439
+
440
+ #
441
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
442
+ # @param profile_name [String] Name of the CDN profile within the resource
443
+ # group.
444
+ # @param resource_group_name [String] Name of the resource group within the
445
+ # Azure subscription.
446
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
447
+ # will be added to the HTTP request.
448
+ #
449
+ # @return [Concurrent::Promise] promise which provides async access to http
450
+ # response.
451
+ #
452
+ def stop_async(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
453
+ # Send request
454
+ promise = begin_stop_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers)
455
+
456
+ promise = promise.then do |response|
457
+ # Defining deserialization method.
458
+ deserialize_method = lambda do |parsed_response|
459
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Endpoint.mapper()
460
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
461
+ end
462
+
463
+ # Waiting for response.
464
+ @client.get_long_running_operation_result(response, deserialize_method)
465
+ end
466
+
467
+ promise
468
+ end
469
+
470
+ #
471
+ # Forcibly purges CDN endpoint content.
472
+ #
473
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
474
+ # @param content_file_paths [PurgeParameters] The path to the content to be
475
+ # purged. Path can describe a file or directory.
476
+ # @param profile_name [String] Name of the CDN profile within the resource
477
+ # group.
478
+ # @param resource_group_name [String] Name of the resource group within the
479
+ # Azure subscription.
480
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
481
+ # will be added to the HTTP request.
482
+ #
483
+ def purge_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:nil)
484
+ response = purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:custom_headers).value!
485
+ nil
486
+ end
487
+
488
+ #
489
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
490
+ # @param content_file_paths [PurgeParameters] The path to the content to be
491
+ # purged. Path can describe a file or directory.
492
+ # @param profile_name [String] Name of the CDN profile within the resource
493
+ # group.
494
+ # @param resource_group_name [String] Name of the resource group within the
495
+ # Azure subscription.
496
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
497
+ # will be added to the HTTP request.
498
+ #
499
+ # @return [Concurrent::Promise] promise which provides async access to http
500
+ # response.
501
+ #
502
+ def purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:nil)
503
+ # Send request
504
+ promise = begin_purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:custom_headers)
505
+
506
+ promise = promise.then do |response|
507
+ # Defining deserialization method.
508
+ deserialize_method = lambda do |parsed_response|
509
+ end
510
+
511
+ # Waiting for response.
512
+ @client.get_long_running_operation_result(response, deserialize_method)
513
+ end
514
+
515
+ promise
516
+ end
517
+
518
+ #
519
+ # Forcibly pre-loads CDN endpoint content.
520
+ #
521
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
522
+ # @param content_file_paths [LoadParameters] The path to the content to be
523
+ # loaded. Path should describe a file.
524
+ # @param profile_name [String] Name of the CDN profile within the resource
525
+ # group.
526
+ # @param resource_group_name [String] Name of the resource group within the
527
+ # Azure subscription.
528
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
529
+ # will be added to the HTTP request.
530
+ #
531
+ def load_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:nil)
532
+ response = load_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:custom_headers).value!
533
+ nil
534
+ end
535
+
536
+ #
537
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
538
+ # @param content_file_paths [LoadParameters] The path to the content to be
539
+ # loaded. Path should describe a file.
540
+ # @param profile_name [String] Name of the CDN profile within the resource
541
+ # group.
542
+ # @param resource_group_name [String] Name of the resource group within the
543
+ # Azure subscription.
544
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
545
+ # will be added to the HTTP request.
546
+ #
547
+ # @return [Concurrent::Promise] promise which provides async access to http
548
+ # response.
549
+ #
550
+ def load_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:nil)
551
+ # Send request
552
+ promise = begin_load_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:custom_headers)
553
+
554
+ promise = promise.then do |response|
555
+ # Defining deserialization method.
556
+ deserialize_method = lambda do |parsed_response|
557
+ end
558
+
559
+ # Waiting for response.
560
+ @client.get_long_running_operation_result(response, deserialize_method)
561
+ end
562
+
563
+ promise
564
+ end
565
+
566
+ #
567
+ # Validates a custom domain mapping to ensure it maps to the correct CNAME in
568
+ # DNS.
569
+ #
570
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
571
+ # @param custom_domain_properties [ValidateCustomDomainInput] Custom domain to
572
+ # validate.
573
+ # @param profile_name [String] Name of the CDN profile within the resource
574
+ # group.
575
+ # @param resource_group_name [String] Name of the resource group within the
576
+ # Azure subscription.
577
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
578
+ # will be added to the HTTP request.
579
+ #
580
+ # @return [ValidateCustomDomainOutput] operation results.
581
+ #
582
+ def validate_custom_domain(endpoint_name, custom_domain_properties, profile_name, resource_group_name, custom_headers:nil)
583
+ response = validate_custom_domain_async(endpoint_name, custom_domain_properties, profile_name, resource_group_name, custom_headers:custom_headers).value!
584
+ response.body unless response.nil?
585
+ end
586
+
587
+ #
588
+ # Validates a custom domain mapping to ensure it maps to the correct CNAME in
589
+ # DNS.
590
+ #
591
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
592
+ # @param custom_domain_properties [ValidateCustomDomainInput] Custom domain to
593
+ # validate.
594
+ # @param profile_name [String] Name of the CDN profile within the resource
595
+ # group.
596
+ # @param resource_group_name [String] Name of the resource group within the
597
+ # Azure subscription.
598
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
599
+ # will be added to the HTTP request.
600
+ #
601
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
602
+ #
603
+ def validate_custom_domain_with_http_info(endpoint_name, custom_domain_properties, profile_name, resource_group_name, custom_headers:nil)
604
+ validate_custom_domain_async(endpoint_name, custom_domain_properties, profile_name, resource_group_name, custom_headers:custom_headers).value!
605
+ end
606
+
607
+ #
608
+ # Validates a custom domain mapping to ensure it maps to the correct CNAME in
609
+ # DNS.
610
+ #
611
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
612
+ # @param custom_domain_properties [ValidateCustomDomainInput] Custom domain to
613
+ # validate.
614
+ # @param profile_name [String] Name of the CDN profile within the resource
615
+ # group.
616
+ # @param resource_group_name [String] Name of the resource group within the
617
+ # Azure subscription.
618
+ # @param [Hash{String => String}] A hash of custom headers that will be added
619
+ # to the HTTP request.
620
+ #
621
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
622
+ #
623
+ def validate_custom_domain_async(endpoint_name, custom_domain_properties, profile_name, resource_group_name, custom_headers:nil)
624
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
625
+ fail ArgumentError, 'custom_domain_properties is nil' if custom_domain_properties.nil?
626
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
627
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
628
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
629
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
630
+
631
+
632
+ request_headers = {}
633
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
634
+
635
+ # Set Headers
636
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
637
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
638
+
639
+ # Serialize Request
640
+ request_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::ValidateCustomDomainInput.mapper()
641
+ request_content = @client.serialize(request_mapper, custom_domain_properties)
642
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
643
+
644
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/validateCustomDomain'
645
+
646
+ request_url = @base_url || @client.base_url
647
+
648
+ options = {
649
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
650
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
651
+ query_params: {'api-version' => @client.api_version},
652
+ body: request_content,
653
+ headers: request_headers.merge(custom_headers || {}),
654
+ base_url: request_url
655
+ }
656
+ promise = @client.make_request_async(:post, path_template, options)
657
+
658
+ promise = promise.then do |result|
659
+ http_response = result.response
660
+ status_code = http_response.status
661
+ response_content = http_response.body
662
+ unless status_code == 200
663
+ error_model = JSON.load(response_content)
664
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
665
+ end
666
+
667
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
668
+ # Deserialize Response
669
+ if status_code == 200
670
+ begin
671
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
672
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::ValidateCustomDomainOutput.mapper()
673
+ result.body = @client.deserialize(result_mapper, parsed_response)
674
+ rescue Exception => e
675
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
676
+ end
677
+ end
678
+
679
+ result
680
+ end
681
+
682
+ promise.execute
683
+ end
684
+
685
+ #
686
+ # Creates a new CDN endpoint with the specified parameters.
687
+ #
688
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
689
+ # @param endpoint_properties [EndpointCreateParameters] Endpoint properties
690
+ # @param profile_name [String] Name of the CDN profile within the resource
691
+ # group.
692
+ # @param resource_group_name [String] Name of the resource group within the
693
+ # Azure subscription.
694
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
695
+ # will be added to the HTTP request.
696
+ #
697
+ # @return [Endpoint] operation results.
698
+ #
699
+ def begin_create(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:nil)
700
+ response = begin_create_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:custom_headers).value!
701
+ response.body unless response.nil?
702
+ end
703
+
704
+ #
705
+ # Creates a new CDN endpoint with the specified parameters.
706
+ #
707
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
708
+ # @param endpoint_properties [EndpointCreateParameters] Endpoint properties
709
+ # @param profile_name [String] Name of the CDN profile within the resource
710
+ # group.
711
+ # @param resource_group_name [String] Name of the resource group within the
712
+ # Azure subscription.
713
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
714
+ # will be added to the HTTP request.
715
+ #
716
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
717
+ #
718
+ def begin_create_with_http_info(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:nil)
719
+ begin_create_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:custom_headers).value!
720
+ end
721
+
722
+ #
723
+ # Creates a new CDN endpoint with the specified parameters.
724
+ #
725
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
726
+ # @param endpoint_properties [EndpointCreateParameters] Endpoint properties
727
+ # @param profile_name [String] Name of the CDN profile within the resource
728
+ # group.
729
+ # @param resource_group_name [String] Name of the resource group within the
730
+ # Azure subscription.
731
+ # @param [Hash{String => String}] A hash of custom headers that will be added
732
+ # to the HTTP request.
733
+ #
734
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
735
+ #
736
+ def begin_create_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:nil)
737
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
738
+ fail ArgumentError, 'endpoint_properties is nil' if endpoint_properties.nil?
739
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
740
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
741
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
742
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
743
+
744
+
745
+ request_headers = {}
746
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
747
+
748
+ # Set Headers
749
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
750
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
751
+
752
+ # Serialize Request
753
+ request_mapper = Azure::CDN::Mgmt::V2016_04_02::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::V2016_04_02::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::V2016_04_02::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::V2016_04_02::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: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: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
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
889
+
890
+ # Set Headers
891
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
892
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
893
+
894
+ # Serialize Request
895
+ request_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::EndpointUpdateParameters.mapper()
896
+ request_content = @client.serialize(request_mapper, endpoint_properties)
897
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
898
+
899
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
900
+
901
+ request_url = @base_url || @client.base_url
902
+
903
+ options = {
904
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
905
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
906
+ query_params: {'api-version' => @client.api_version},
907
+ body: request_content,
908
+ headers: request_headers.merge(custom_headers || {}),
909
+ base_url: request_url
910
+ }
911
+ promise = @client.make_request_async(:patch, path_template, options)
912
+
913
+ promise = promise.then do |result|
914
+ http_response = result.response
915
+ status_code = http_response.status
916
+ response_content = http_response.body
917
+ unless status_code == 200 || status_code == 202
918
+ error_model = JSON.load(response_content)
919
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
920
+ end
921
+
922
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
923
+ # Deserialize Response
924
+ if status_code == 200
925
+ begin
926
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
927
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Endpoint.mapper()
928
+ result.body = @client.deserialize(result_mapper, parsed_response)
929
+ rescue Exception => e
930
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
931
+ end
932
+ end
933
+ # Deserialize Response
934
+ if status_code == 202
935
+ begin
936
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
937
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Endpoint.mapper()
938
+ result.body = @client.deserialize(result_mapper, parsed_response)
939
+ rescue Exception => e
940
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
941
+ end
942
+ end
943
+
944
+ result
945
+ end
946
+
947
+ promise.execute
948
+ end
949
+
950
+ #
951
+ # Deletes an existing CDN endpoint with the specified parameters.
952
+ #
953
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
954
+ # @param profile_name [String] Name of the CDN profile within the resource
955
+ # group.
956
+ # @param resource_group_name [String] Name of the resource group within the
957
+ # Azure subscription.
958
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
959
+ # will be added to the HTTP request.
960
+ #
961
+ #
962
+ def begin_delete_if_exists(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
963
+ response = begin_delete_if_exists_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
964
+ nil
965
+ end
966
+
967
+ #
968
+ # Deletes an existing CDN endpoint with the specified parameters.
969
+ #
970
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
971
+ # @param profile_name [String] Name of the CDN profile within the resource
972
+ # group.
973
+ # @param resource_group_name [String] Name of the resource group within the
974
+ # Azure subscription.
975
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
976
+ # will be added to the HTTP request.
977
+ #
978
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
979
+ #
980
+ def begin_delete_if_exists_with_http_info(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
981
+ begin_delete_if_exists_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
982
+ end
983
+
984
+ #
985
+ # Deletes an existing CDN endpoint with the specified parameters.
986
+ #
987
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
988
+ # @param profile_name [String] Name of the CDN profile within the resource
989
+ # group.
990
+ # @param resource_group_name [String] Name of the resource group within the
991
+ # Azure subscription.
992
+ # @param [Hash{String => String}] A hash of custom headers that will be added
993
+ # to the HTTP request.
994
+ #
995
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
996
+ #
997
+ def begin_delete_if_exists_async(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
998
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
999
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1000
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1001
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1002
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1003
+
1004
+
1005
+ request_headers = {}
1006
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
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: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: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
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1099
+
1100
+ # Set Headers
1101
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1102
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1103
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start'
1104
+
1105
+ request_url = @base_url || @client.base_url
1106
+
1107
+ options = {
1108
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1109
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
1110
+ query_params: {'api-version' => @client.api_version},
1111
+ headers: request_headers.merge(custom_headers || {}),
1112
+ base_url: request_url
1113
+ }
1114
+ promise = @client.make_request_async(:post, path_template, options)
1115
+
1116
+ promise = promise.then do |result|
1117
+ http_response = result.response
1118
+ status_code = http_response.status
1119
+ response_content = http_response.body
1120
+ unless status_code == 202
1121
+ error_model = JSON.load(response_content)
1122
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1123
+ end
1124
+
1125
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1126
+ # Deserialize Response
1127
+ if status_code == 202
1128
+ begin
1129
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1130
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Endpoint.mapper()
1131
+ result.body = @client.deserialize(result_mapper, parsed_response)
1132
+ rescue Exception => e
1133
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1134
+ end
1135
+ end
1136
+
1137
+ result
1138
+ end
1139
+
1140
+ promise.execute
1141
+ end
1142
+
1143
+ #
1144
+ # Stops an existing running CDN endpoint.
1145
+ #
1146
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1147
+ # @param profile_name [String] Name of the CDN profile within the resource
1148
+ # group.
1149
+ # @param resource_group_name [String] Name of the resource group within the
1150
+ # Azure subscription.
1151
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1152
+ # will be added to the HTTP request.
1153
+ #
1154
+ # @return [Endpoint] operation results.
1155
+ #
1156
+ def begin_stop(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
1157
+ response = begin_stop_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
1158
+ response.body unless response.nil?
1159
+ end
1160
+
1161
+ #
1162
+ # Stops an existing running CDN endpoint.
1163
+ #
1164
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1165
+ # @param profile_name [String] Name of the CDN profile within the resource
1166
+ # group.
1167
+ # @param resource_group_name [String] Name of the resource group within the
1168
+ # Azure subscription.
1169
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1170
+ # will be added to the HTTP request.
1171
+ #
1172
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1173
+ #
1174
+ def begin_stop_with_http_info(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
1175
+ begin_stop_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
1176
+ end
1177
+
1178
+ #
1179
+ # Stops an existing running CDN endpoint.
1180
+ #
1181
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1182
+ # @param profile_name [String] Name of the CDN profile within the resource
1183
+ # group.
1184
+ # @param resource_group_name [String] Name of the resource group within the
1185
+ # Azure subscription.
1186
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1187
+ # to the HTTP request.
1188
+ #
1189
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1190
+ #
1191
+ def begin_stop_async(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
1192
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
1193
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1194
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1195
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1196
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1197
+
1198
+
1199
+ request_headers = {}
1200
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1201
+
1202
+ # Set Headers
1203
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1204
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1205
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop'
1206
+
1207
+ request_url = @base_url || @client.base_url
1208
+
1209
+ options = {
1210
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1211
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
1212
+ query_params: {'api-version' => @client.api_version},
1213
+ headers: request_headers.merge(custom_headers || {}),
1214
+ base_url: request_url
1215
+ }
1216
+ promise = @client.make_request_async(:post, path_template, options)
1217
+
1218
+ promise = promise.then do |result|
1219
+ http_response = result.response
1220
+ status_code = http_response.status
1221
+ response_content = http_response.body
1222
+ unless status_code == 202
1223
+ error_model = JSON.load(response_content)
1224
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1225
+ end
1226
+
1227
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1228
+ # Deserialize Response
1229
+ if status_code == 202
1230
+ begin
1231
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1232
+ result_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::Endpoint.mapper()
1233
+ result.body = @client.deserialize(result_mapper, parsed_response)
1234
+ rescue Exception => e
1235
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1236
+ end
1237
+ end
1238
+
1239
+ result
1240
+ end
1241
+
1242
+ promise.execute
1243
+ end
1244
+
1245
+ #
1246
+ # Forcibly purges CDN endpoint content.
1247
+ #
1248
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1249
+ # @param content_file_paths [PurgeParameters] The path to the content to be
1250
+ # purged. Path can describe a file or directory.
1251
+ # @param profile_name [String] Name of the CDN profile within the resource
1252
+ # group.
1253
+ # @param resource_group_name [String] Name of the resource group within the
1254
+ # Azure subscription.
1255
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1256
+ # will be added to the HTTP request.
1257
+ #
1258
+ #
1259
+ def begin_purge_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:nil)
1260
+ response = begin_purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:custom_headers).value!
1261
+ nil
1262
+ end
1263
+
1264
+ #
1265
+ # Forcibly purges CDN endpoint content.
1266
+ #
1267
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1268
+ # @param content_file_paths [PurgeParameters] The path to the content to be
1269
+ # purged. Path can describe a file or directory.
1270
+ # @param profile_name [String] Name of the CDN profile within the resource
1271
+ # group.
1272
+ # @param resource_group_name [String] Name of the resource group within the
1273
+ # Azure subscription.
1274
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1275
+ # will be added to the HTTP request.
1276
+ #
1277
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1278
+ #
1279
+ def begin_purge_content_with_http_info(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:nil)
1280
+ begin_purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:custom_headers).value!
1281
+ end
1282
+
1283
+ #
1284
+ # Forcibly purges CDN endpoint content.
1285
+ #
1286
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1287
+ # @param content_file_paths [PurgeParameters] The path to the content to be
1288
+ # purged. Path can describe a file or directory.
1289
+ # @param profile_name [String] Name of the CDN profile within the resource
1290
+ # group.
1291
+ # @param resource_group_name [String] Name of the resource group within the
1292
+ # Azure subscription.
1293
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1294
+ # to the HTTP request.
1295
+ #
1296
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1297
+ #
1298
+ def begin_purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:nil)
1299
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
1300
+ fail ArgumentError, 'content_file_paths is nil' if content_file_paths.nil?
1301
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1302
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1303
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1304
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1305
+
1306
+
1307
+ request_headers = {}
1308
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1309
+
1310
+ # Set Headers
1311
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1312
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1313
+
1314
+ # Serialize Request
1315
+ request_mapper = Azure::CDN::Mgmt::V2016_04_02::Models::PurgeParameters.mapper()
1316
+ request_content = @client.serialize(request_mapper, content_file_paths)
1317
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1318
+
1319
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge'
1320
+
1321
+ request_url = @base_url || @client.base_url
1322
+
1323
+ options = {
1324
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1325
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
1326
+ query_params: {'api-version' => @client.api_version},
1327
+ body: request_content,
1328
+ headers: request_headers.merge(custom_headers || {}),
1329
+ base_url: request_url
1330
+ }
1331
+ promise = @client.make_request_async(:post, path_template, options)
1332
+
1333
+ promise = promise.then do |result|
1334
+ http_response = result.response
1335
+ status_code = http_response.status
1336
+ response_content = http_response.body
1337
+ unless status_code == 202
1338
+ error_model = JSON.load(response_content)
1339
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1340
+ end
1341
+
1342
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1343
+
1344
+ result
1345
+ end
1346
+
1347
+ promise.execute
1348
+ end
1349
+
1350
+ #
1351
+ # Forcibly pre-loads CDN endpoint content.
1352
+ #
1353
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1354
+ # @param content_file_paths [LoadParameters] The path to the content to be
1355
+ # loaded. Path should describe a file.
1356
+ # @param profile_name [String] Name of the CDN profile within the resource
1357
+ # group.
1358
+ # @param resource_group_name [String] Name of the resource group within the
1359
+ # Azure subscription.
1360
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1361
+ # will be added to the HTTP request.
1362
+ #
1363
+ #
1364
+ def begin_load_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:nil)
1365
+ response = begin_load_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:custom_headers).value!
1366
+ nil
1367
+ end
1368
+
1369
+ #
1370
+ # Forcibly pre-loads CDN endpoint content.
1371
+ #
1372
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1373
+ # @param content_file_paths [LoadParameters] The path to the content to be
1374
+ # loaded. Path should describe a file.
1375
+ # @param profile_name [String] Name of the CDN profile within the resource
1376
+ # group.
1377
+ # @param resource_group_name [String] Name of the resource group within the
1378
+ # Azure subscription.
1379
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1380
+ # will be added to the HTTP request.
1381
+ #
1382
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1383
+ #
1384
+ def begin_load_content_with_http_info(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:nil)
1385
+ begin_load_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:custom_headers).value!
1386
+ end
1387
+
1388
+ #
1389
+ # Forcibly pre-loads CDN endpoint content.
1390
+ #
1391
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile.
1392
+ # @param content_file_paths [LoadParameters] The path to the content to be
1393
+ # loaded. Path should describe a file.
1394
+ # @param profile_name [String] Name of the CDN profile within the resource
1395
+ # group.
1396
+ # @param resource_group_name [String] Name of the resource group within the
1397
+ # Azure subscription.
1398
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1399
+ # to the HTTP request.
1400
+ #
1401
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1402
+ #
1403
+ def begin_load_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:nil)
1404
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
1405
+ fail ArgumentError, 'content_file_paths is nil' if content_file_paths.nil?
1406
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1407
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1408
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1409
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1410
+
1411
+
1412
+ request_headers = {}
1413
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1414
+
1415
+ # Set Headers
1416
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1417
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1418
+
1419
+ # Serialize Request
1420
+ request_mapper = Azure::CDN::Mgmt::V2016_04_02::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