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,223 @@
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::V2017_10_12
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.
11
+ #
12
+ class EdgeNodes
13
+ include MsRestAzure
14
+
15
+ #
16
+ # Creates and initializes a new instance of the EdgeNodes class.
17
+ # @param client service class for accessing basic functionality.
18
+ #
19
+ def initialize(client)
20
+ @client = client
21
+ end
22
+
23
+ # @return [CdnManagementClient] reference to the CdnManagementClient
24
+ attr_reader :client
25
+
26
+ #
27
+ # Edgenodes are the global Point of Presence (POP) locations used to deliver
28
+ # CDN content to end users.
29
+ #
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [Array<EdgeNode>] operation results.
34
+ #
35
+ def list(custom_headers:nil)
36
+ first_page = list_as_lazy(custom_headers:custom_headers)
37
+ first_page.get_all_items
38
+ end
39
+
40
+ #
41
+ # Edgenodes are the global Point of Presence (POP) locations used to deliver
42
+ # CDN content to end users.
43
+ #
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def list_with_http_info(custom_headers:nil)
50
+ list_async(custom_headers:custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Edgenodes are the global Point of Presence (POP) locations used to deliver
55
+ # CDN content to end users.
56
+ #
57
+ # @param [Hash{String => String}] A hash of custom headers that will be added
58
+ # to the HTTP request.
59
+ #
60
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
61
+ #
62
+ def list_async(custom_headers:nil)
63
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
64
+
65
+
66
+ request_headers = {}
67
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
68
+
69
+ # Set Headers
70
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
71
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
72
+ path_template = 'providers/Microsoft.Cdn/edgenodes'
73
+
74
+ request_url = @base_url || @client.base_url
75
+
76
+ options = {
77
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
78
+ query_params: {'api-version' => @client.api_version},
79
+ headers: request_headers.merge(custom_headers || {}),
80
+ base_url: request_url
81
+ }
82
+ promise = @client.make_request_async(:get, path_template, options)
83
+
84
+ promise = promise.then do |result|
85
+ http_response = result.response
86
+ status_code = http_response.status
87
+ response_content = http_response.body
88
+ unless status_code == 200
89
+ error_model = JSON.load(response_content)
90
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
91
+ end
92
+
93
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
94
+ # Deserialize Response
95
+ if status_code == 200
96
+ begin
97
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
98
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::EdgenodeResult.mapper()
99
+ result.body = @client.deserialize(result_mapper, parsed_response)
100
+ rescue Exception => e
101
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
102
+ end
103
+ end
104
+
105
+ result
106
+ end
107
+
108
+ promise.execute
109
+ end
110
+
111
+ #
112
+ # Edgenodes are the global Point of Presence (POP) locations used to deliver
113
+ # CDN content to end users.
114
+ #
115
+ # @param next_page_link [String] The NextLink from the previous successful call
116
+ # to List operation.
117
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
118
+ # will be added to the HTTP request.
119
+ #
120
+ # @return [EdgenodeResult] operation results.
121
+ #
122
+ def list_next(next_page_link, custom_headers:nil)
123
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
124
+ response.body unless response.nil?
125
+ end
126
+
127
+ #
128
+ # Edgenodes are the global Point of Presence (POP) locations used to deliver
129
+ # CDN content to end users.
130
+ #
131
+ # @param next_page_link [String] The NextLink from the previous successful call
132
+ # to List operation.
133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
134
+ # will be added to the HTTP request.
135
+ #
136
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
137
+ #
138
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
139
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
140
+ end
141
+
142
+ #
143
+ # Edgenodes are the global Point of Presence (POP) locations used to deliver
144
+ # CDN content to end users.
145
+ #
146
+ # @param next_page_link [String] The NextLink from the previous successful call
147
+ # to List operation.
148
+ # @param [Hash{String => String}] A hash of custom headers that will be added
149
+ # to the HTTP request.
150
+ #
151
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
152
+ #
153
+ def list_next_async(next_page_link, custom_headers:nil)
154
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
155
+
156
+
157
+ request_headers = {}
158
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
159
+
160
+ # Set Headers
161
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
162
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
163
+ path_template = '{nextLink}'
164
+
165
+ request_url = @base_url || @client.base_url
166
+
167
+ options = {
168
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
169
+ skip_encoding_path_params: {'nextLink' => next_page_link},
170
+ headers: request_headers.merge(custom_headers || {}),
171
+ base_url: request_url
172
+ }
173
+ promise = @client.make_request_async(:get, path_template, options)
174
+
175
+ promise = promise.then do |result|
176
+ http_response = result.response
177
+ status_code = http_response.status
178
+ response_content = http_response.body
179
+ unless status_code == 200
180
+ error_model = JSON.load(response_content)
181
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
182
+ end
183
+
184
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
185
+ # Deserialize Response
186
+ if status_code == 200
187
+ begin
188
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
189
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::EdgenodeResult.mapper()
190
+ result.body = @client.deserialize(result_mapper, parsed_response)
191
+ rescue Exception => e
192
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
193
+ end
194
+ end
195
+
196
+ result
197
+ end
198
+
199
+ promise.execute
200
+ end
201
+
202
+ #
203
+ # Edgenodes are the global Point of Presence (POP) locations used to deliver
204
+ # CDN content to end users.
205
+ #
206
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
207
+ # will be added to the HTTP request.
208
+ #
209
+ # @return [EdgenodeResult] which provide lazy access to pages of the response.
210
+ #
211
+ def list_as_lazy(custom_headers:nil)
212
+ response = list_async(custom_headers:custom_headers).value!
213
+ unless response.nil?
214
+ page = response.body
215
+ page.next_method = Proc.new do |next_page_link|
216
+ list_next_async(next_page_link, custom_headers:custom_headers)
217
+ end
218
+ page
219
+ end
220
+ end
221
+
222
+ end
223
+ end
@@ -0,0 +1,1922 @@
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::V2017_10_12
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.
11
+ #
12
+ class Endpoints
13
+ include MsRestAzure
14
+
15
+ #
16
+ # Creates and initializes a new instance of the Endpoints class.
17
+ # @param client service class for accessing basic functionality.
18
+ #
19
+ def initialize(client)
20
+ @client = client
21
+ end
22
+
23
+ # @return [CdnManagementClient] reference to the CdnManagementClient
24
+ attr_reader :client
25
+
26
+ #
27
+ # Lists existing CDN endpoints.
28
+ #
29
+ # @param resource_group_name [String] Name of the Resource group within the
30
+ # Azure subscription.
31
+ # @param profile_name [String] Name of the CDN profile which is unique within
32
+ # the resource group.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [Array<Endpoint>] operation results.
37
+ #
38
+ def list_by_profile(resource_group_name, profile_name, custom_headers:nil)
39
+ first_page = list_by_profile_as_lazy(resource_group_name, profile_name, custom_headers:custom_headers)
40
+ first_page.get_all_items
41
+ end
42
+
43
+ #
44
+ # Lists existing CDN endpoints.
45
+ #
46
+ # @param resource_group_name [String] Name of the Resource group within the
47
+ # Azure subscription.
48
+ # @param profile_name [String] Name of the CDN profile which is unique within
49
+ # the resource group.
50
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
51
+ # will be added to the HTTP request.
52
+ #
53
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
54
+ #
55
+ def list_by_profile_with_http_info(resource_group_name, profile_name, custom_headers:nil)
56
+ list_by_profile_async(resource_group_name, profile_name, custom_headers:custom_headers).value!
57
+ end
58
+
59
+ #
60
+ # Lists existing CDN endpoints.
61
+ #
62
+ # @param resource_group_name [String] Name of the Resource group within the
63
+ # Azure subscription.
64
+ # @param profile_name [String] Name of the CDN profile which is unique within
65
+ # the resource group.
66
+ # @param [Hash{String => String}] A hash of custom headers that will be added
67
+ # to the HTTP request.
68
+ #
69
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
70
+ #
71
+ def list_by_profile_async(resource_group_name, profile_name, custom_headers:nil)
72
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
73
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
74
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
75
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
76
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
77
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
78
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
79
+
80
+
81
+ request_headers = {}
82
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
83
+
84
+ # Set Headers
85
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
86
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
87
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints'
88
+
89
+ request_url = @base_url || @client.base_url
90
+
91
+ options = {
92
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
93
+ path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'subscriptionId' => @client.subscription_id},
94
+ query_params: {'api-version' => @client.api_version},
95
+ headers: request_headers.merge(custom_headers || {}),
96
+ base_url: request_url
97
+ }
98
+ promise = @client.make_request_async(:get, path_template, options)
99
+
100
+ promise = promise.then do |result|
101
+ http_response = result.response
102
+ status_code = http_response.status
103
+ response_content = http_response.body
104
+ unless status_code == 200
105
+ error_model = JSON.load(response_content)
106
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
107
+ end
108
+
109
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
110
+ # Deserialize Response
111
+ if status_code == 200
112
+ begin
113
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
114
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::EndpointListResult.mapper()
115
+ result.body = @client.deserialize(result_mapper, parsed_response)
116
+ rescue Exception => e
117
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
118
+ end
119
+ end
120
+
121
+ result
122
+ end
123
+
124
+ promise.execute
125
+ end
126
+
127
+ #
128
+ # Gets an existing CDN endpoint with the specified endpoint name under the
129
+ # specified subscription, resource group and profile.
130
+ #
131
+ # @param resource_group_name [String] Name of the Resource group within the
132
+ # Azure subscription.
133
+ # @param profile_name [String] Name of the CDN profile which is unique within
134
+ # the resource group.
135
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
136
+ # unique globally.
137
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
138
+ # will be added to the HTTP request.
139
+ #
140
+ # @return [Endpoint] operation results.
141
+ #
142
+ def get(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
143
+ response = get_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
144
+ response.body unless response.nil?
145
+ end
146
+
147
+ #
148
+ # Gets an existing CDN endpoint with the specified endpoint name under the
149
+ # specified subscription, resource group and profile.
150
+ #
151
+ # @param resource_group_name [String] Name of the Resource group within the
152
+ # Azure subscription.
153
+ # @param profile_name [String] Name of the CDN profile which is unique within
154
+ # the resource group.
155
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
156
+ # unique globally.
157
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
158
+ # will be added to the HTTP request.
159
+ #
160
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
161
+ #
162
+ def get_with_http_info(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
163
+ get_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
164
+ end
165
+
166
+ #
167
+ # Gets an existing CDN endpoint with the specified endpoint name under the
168
+ # specified subscription, resource group and profile.
169
+ #
170
+ # @param resource_group_name [String] Name of the Resource group within the
171
+ # Azure subscription.
172
+ # @param profile_name [String] Name of the CDN profile which is unique within
173
+ # the resource group.
174
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
175
+ # unique globally.
176
+ # @param [Hash{String => String}] A hash of custom headers that will be added
177
+ # to the HTTP request.
178
+ #
179
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
180
+ #
181
+ def get_async(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
182
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
183
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
184
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
185
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
186
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
187
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
188
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
189
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
190
+
191
+
192
+ request_headers = {}
193
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
194
+
195
+ # Set Headers
196
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
197
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
198
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
199
+
200
+ request_url = @base_url || @client.base_url
201
+
202
+ options = {
203
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
204
+ path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'endpointName' => endpoint_name,'subscriptionId' => @client.subscription_id},
205
+ query_params: {'api-version' => @client.api_version},
206
+ headers: request_headers.merge(custom_headers || {}),
207
+ base_url: request_url
208
+ }
209
+ promise = @client.make_request_async(:get, path_template, options)
210
+
211
+ promise = promise.then do |result|
212
+ http_response = result.response
213
+ status_code = http_response.status
214
+ response_content = http_response.body
215
+ unless status_code == 200
216
+ error_model = JSON.load(response_content)
217
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
218
+ end
219
+
220
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
221
+ # Deserialize Response
222
+ if status_code == 200
223
+ begin
224
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
225
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
226
+ result.body = @client.deserialize(result_mapper, parsed_response)
227
+ rescue Exception => e
228
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
229
+ end
230
+ end
231
+
232
+ result
233
+ end
234
+
235
+ promise.execute
236
+ end
237
+
238
+ #
239
+ # Creates a new CDN endpoint with the specified endpoint name under the
240
+ # specified subscription, resource group and profile.
241
+ #
242
+ # @param resource_group_name [String] Name of the Resource group within the
243
+ # Azure subscription.
244
+ # @param profile_name [String] Name of the CDN profile which is unique within
245
+ # the resource group.
246
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
247
+ # unique globally.
248
+ # @param endpoint [Endpoint] Endpoint properties
249
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
250
+ # will be added to the HTTP request.
251
+ #
252
+ # @return [Endpoint] operation results.
253
+ #
254
+ def create(resource_group_name, profile_name, endpoint_name, endpoint, custom_headers:nil)
255
+ response = create_async(resource_group_name, profile_name, endpoint_name, endpoint, custom_headers:custom_headers).value!
256
+ response.body unless response.nil?
257
+ end
258
+
259
+ #
260
+ # @param resource_group_name [String] Name of the Resource group within the
261
+ # Azure subscription.
262
+ # @param profile_name [String] Name of the CDN profile which is unique within
263
+ # the resource group.
264
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
265
+ # unique globally.
266
+ # @param endpoint [Endpoint] Endpoint properties
267
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
268
+ # will be added to the HTTP request.
269
+ #
270
+ # @return [Concurrent::Promise] promise which provides async access to http
271
+ # response.
272
+ #
273
+ def create_async(resource_group_name, profile_name, endpoint_name, endpoint, custom_headers:nil)
274
+ # Send request
275
+ promise = begin_create_async(resource_group_name, profile_name, endpoint_name, endpoint, custom_headers:custom_headers)
276
+
277
+ promise = promise.then do |response|
278
+ # Defining deserialization method.
279
+ deserialize_method = lambda do |parsed_response|
280
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
281
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
282
+ end
283
+
284
+ # Waiting for response.
285
+ @client.get_long_running_operation_result(response, deserialize_method)
286
+ end
287
+
288
+ promise
289
+ end
290
+
291
+ #
292
+ # Updates an existing CDN endpoint with the specified endpoint name under the
293
+ # specified subscription, resource group and profile. Only tags and Origin
294
+ # HostHeader can be updated after creating an endpoint. To update origins, use
295
+ # the Update Origin operation. To update custom domains, use the Update Custom
296
+ # Domain operation.
297
+ #
298
+ # @param resource_group_name [String] Name of the Resource group within the
299
+ # Azure subscription.
300
+ # @param profile_name [String] Name of the CDN profile which is unique within
301
+ # the resource group.
302
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
303
+ # unique globally.
304
+ # @param endpoint_update_properties [EndpointUpdateParameters] Endpoint update
305
+ # properties
306
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
307
+ # will be added to the HTTP request.
308
+ #
309
+ # @return [Endpoint] operation results.
310
+ #
311
+ def update(resource_group_name, profile_name, endpoint_name, endpoint_update_properties, custom_headers:nil)
312
+ response = update_async(resource_group_name, profile_name, endpoint_name, endpoint_update_properties, custom_headers:custom_headers).value!
313
+ response.body unless response.nil?
314
+ end
315
+
316
+ #
317
+ # @param resource_group_name [String] Name of the Resource group within the
318
+ # Azure subscription.
319
+ # @param profile_name [String] Name of the CDN profile which is unique within
320
+ # the resource group.
321
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
322
+ # unique globally.
323
+ # @param endpoint_update_properties [EndpointUpdateParameters] Endpoint update
324
+ # properties
325
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
326
+ # will be added to the HTTP request.
327
+ #
328
+ # @return [Concurrent::Promise] promise which provides async access to http
329
+ # response.
330
+ #
331
+ def update_async(resource_group_name, profile_name, endpoint_name, endpoint_update_properties, custom_headers:nil)
332
+ # Send request
333
+ promise = begin_update_async(resource_group_name, profile_name, endpoint_name, endpoint_update_properties, custom_headers:custom_headers)
334
+
335
+ promise = promise.then do |response|
336
+ # Defining deserialization method.
337
+ deserialize_method = lambda do |parsed_response|
338
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
339
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
340
+ end
341
+
342
+ # Waiting for response.
343
+ @client.get_long_running_operation_result(response, deserialize_method)
344
+ end
345
+
346
+ promise
347
+ end
348
+
349
+ #
350
+ # Deletes an existing CDN endpoint with the specified endpoint name under the
351
+ # specified subscription, resource group and profile.
352
+ #
353
+ # @param resource_group_name [String] Name of the Resource group within the
354
+ # Azure subscription.
355
+ # @param profile_name [String] Name of the CDN profile which is unique within
356
+ # the resource group.
357
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
358
+ # unique globally.
359
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
360
+ # will be added to the HTTP request.
361
+ #
362
+ def delete(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
363
+ response = delete_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
364
+ nil
365
+ end
366
+
367
+ #
368
+ # @param resource_group_name [String] Name of the Resource group within the
369
+ # Azure subscription.
370
+ # @param profile_name [String] Name of the CDN profile which is unique within
371
+ # the resource group.
372
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
373
+ # unique globally.
374
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
375
+ # will be added to the HTTP request.
376
+ #
377
+ # @return [Concurrent::Promise] promise which provides async access to http
378
+ # response.
379
+ #
380
+ def delete_async(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
381
+ # Send request
382
+ promise = begin_delete_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers)
383
+
384
+ promise = promise.then do |response|
385
+ # Defining deserialization method.
386
+ deserialize_method = lambda do |parsed_response|
387
+ end
388
+
389
+ # Waiting for response.
390
+ @client.get_long_running_operation_result(response, deserialize_method)
391
+ end
392
+
393
+ promise
394
+ end
395
+
396
+ #
397
+ # Starts an existing CDN endpoint that is on a stopped state.
398
+ #
399
+ # @param resource_group_name [String] Name of the Resource group within the
400
+ # Azure subscription.
401
+ # @param profile_name [String] Name of the CDN profile which is unique within
402
+ # the resource group.
403
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
404
+ # unique globally.
405
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
406
+ # will be added to the HTTP request.
407
+ #
408
+ # @return [Endpoint] operation results.
409
+ #
410
+ def start(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
411
+ response = start_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
412
+ response.body unless response.nil?
413
+ end
414
+
415
+ #
416
+ # @param resource_group_name [String] Name of the Resource group within the
417
+ # Azure subscription.
418
+ # @param profile_name [String] Name of the CDN profile which is unique within
419
+ # the resource group.
420
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
421
+ # unique globally.
422
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
423
+ # will be added to the HTTP request.
424
+ #
425
+ # @return [Concurrent::Promise] promise which provides async access to http
426
+ # response.
427
+ #
428
+ def start_async(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
429
+ # Send request
430
+ promise = begin_start_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers)
431
+
432
+ promise = promise.then do |response|
433
+ # Defining deserialization method.
434
+ deserialize_method = lambda do |parsed_response|
435
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
436
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
437
+ end
438
+
439
+ # Waiting for response.
440
+ @client.get_long_running_operation_result(response, deserialize_method)
441
+ end
442
+
443
+ promise
444
+ end
445
+
446
+ #
447
+ # Stops an existing running CDN endpoint.
448
+ #
449
+ # @param resource_group_name [String] Name of the Resource group within the
450
+ # Azure subscription.
451
+ # @param profile_name [String] Name of the CDN profile which is unique within
452
+ # the resource group.
453
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
454
+ # unique globally.
455
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
456
+ # will be added to the HTTP request.
457
+ #
458
+ # @return [Endpoint] operation results.
459
+ #
460
+ def stop(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
461
+ response = stop_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
462
+ response.body unless response.nil?
463
+ end
464
+
465
+ #
466
+ # @param resource_group_name [String] Name of the Resource group within the
467
+ # Azure subscription.
468
+ # @param profile_name [String] Name of the CDN profile which is unique within
469
+ # the resource group.
470
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
471
+ # unique globally.
472
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
473
+ # will be added to the HTTP request.
474
+ #
475
+ # @return [Concurrent::Promise] promise which provides async access to http
476
+ # response.
477
+ #
478
+ def stop_async(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
479
+ # Send request
480
+ promise = begin_stop_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers)
481
+
482
+ promise = promise.then do |response|
483
+ # Defining deserialization method.
484
+ deserialize_method = lambda do |parsed_response|
485
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
486
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
487
+ end
488
+
489
+ # Waiting for response.
490
+ @client.get_long_running_operation_result(response, deserialize_method)
491
+ end
492
+
493
+ promise
494
+ end
495
+
496
+ #
497
+ # Removes a content from CDN.
498
+ #
499
+ # @param resource_group_name [String] Name of the Resource group within the
500
+ # Azure subscription.
501
+ # @param profile_name [String] Name of the CDN profile which is unique within
502
+ # the resource group.
503
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
504
+ # unique globally.
505
+ # @param content_file_paths [PurgeParameters] The path to the content to be
506
+ # purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a
507
+ # single file, or a directory with a wildcard, e.g. '/pictures/*' which removes
508
+ # all folders and files in the directory.
509
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
510
+ # will be added to the HTTP request.
511
+ #
512
+ def purge_content(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:nil)
513
+ response = purge_content_async(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:custom_headers).value!
514
+ nil
515
+ end
516
+
517
+ #
518
+ # @param resource_group_name [String] Name of the Resource group within the
519
+ # Azure subscription.
520
+ # @param profile_name [String] Name of the CDN profile which is unique within
521
+ # the resource group.
522
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
523
+ # unique globally.
524
+ # @param content_file_paths [PurgeParameters] The path to the content to be
525
+ # purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a
526
+ # single file, or a directory with a wildcard, e.g. '/pictures/*' which removes
527
+ # all folders and files in the directory.
528
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
529
+ # will be added to the HTTP request.
530
+ #
531
+ # @return [Concurrent::Promise] promise which provides async access to http
532
+ # response.
533
+ #
534
+ def purge_content_async(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:nil)
535
+ # Send request
536
+ promise = begin_purge_content_async(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:custom_headers)
537
+
538
+ promise = promise.then do |response|
539
+ # Defining deserialization method.
540
+ deserialize_method = lambda do |parsed_response|
541
+ end
542
+
543
+ # Waiting for response.
544
+ @client.get_long_running_operation_result(response, deserialize_method)
545
+ end
546
+
547
+ promise
548
+ end
549
+
550
+ #
551
+ # Pre-loads a content to CDN. Available for Verizon Profiles.
552
+ #
553
+ # @param resource_group_name [String] Name of the Resource group within the
554
+ # Azure subscription.
555
+ # @param profile_name [String] Name of the CDN profile which is unique within
556
+ # the resource group.
557
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
558
+ # unique globally.
559
+ # @param content_file_paths [LoadParameters] The path to the content to be
560
+ # loaded. Path should be a full URL, e.g. ‘/pictires/city.png' which loads a
561
+ # single file
562
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
563
+ # will be added to the HTTP request.
564
+ #
565
+ def load_content(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:nil)
566
+ response = load_content_async(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:custom_headers).value!
567
+ nil
568
+ end
569
+
570
+ #
571
+ # @param resource_group_name [String] Name of the Resource group within the
572
+ # Azure subscription.
573
+ # @param profile_name [String] Name of the CDN profile which is unique within
574
+ # the resource group.
575
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
576
+ # unique globally.
577
+ # @param content_file_paths [LoadParameters] The path to the content to be
578
+ # loaded. Path should be a full URL, e.g. ‘/pictires/city.png' which loads a
579
+ # single file
580
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
581
+ # will be added to the HTTP request.
582
+ #
583
+ # @return [Concurrent::Promise] promise which provides async access to http
584
+ # response.
585
+ #
586
+ def load_content_async(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:nil)
587
+ # Send request
588
+ promise = begin_load_content_async(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:custom_headers)
589
+
590
+ promise = promise.then do |response|
591
+ # Defining deserialization method.
592
+ deserialize_method = lambda do |parsed_response|
593
+ end
594
+
595
+ # Waiting for response.
596
+ @client.get_long_running_operation_result(response, deserialize_method)
597
+ end
598
+
599
+ promise
600
+ end
601
+
602
+ #
603
+ # Validates the custom domain mapping to ensure it maps to the correct CDN
604
+ # endpoint in DNS.
605
+ #
606
+ # @param resource_group_name [String] Name of the Resource group within the
607
+ # Azure subscription.
608
+ # @param profile_name [String] Name of the CDN profile which is unique within
609
+ # the resource group.
610
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
611
+ # unique globally.
612
+ # @param custom_domain_properties [ValidateCustomDomainInput] Custom domain to
613
+ # be validated.
614
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
615
+ # will be added to the HTTP request.
616
+ #
617
+ # @return [ValidateCustomDomainOutput] operation results.
618
+ #
619
+ def validate_custom_domain(resource_group_name, profile_name, endpoint_name, custom_domain_properties, custom_headers:nil)
620
+ response = validate_custom_domain_async(resource_group_name, profile_name, endpoint_name, custom_domain_properties, custom_headers:custom_headers).value!
621
+ response.body unless response.nil?
622
+ end
623
+
624
+ #
625
+ # Validates the custom domain mapping to ensure it maps to the correct CDN
626
+ # endpoint in DNS.
627
+ #
628
+ # @param resource_group_name [String] Name of the Resource group within the
629
+ # Azure subscription.
630
+ # @param profile_name [String] Name of the CDN profile which is unique within
631
+ # the resource group.
632
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
633
+ # unique globally.
634
+ # @param custom_domain_properties [ValidateCustomDomainInput] Custom domain to
635
+ # be validated.
636
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
637
+ # will be added to the HTTP request.
638
+ #
639
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
640
+ #
641
+ def validate_custom_domain_with_http_info(resource_group_name, profile_name, endpoint_name, custom_domain_properties, custom_headers:nil)
642
+ validate_custom_domain_async(resource_group_name, profile_name, endpoint_name, custom_domain_properties, custom_headers:custom_headers).value!
643
+ end
644
+
645
+ #
646
+ # Validates the custom domain mapping to ensure it maps to the correct CDN
647
+ # endpoint in DNS.
648
+ #
649
+ # @param resource_group_name [String] Name of the Resource group within the
650
+ # Azure subscription.
651
+ # @param profile_name [String] Name of the CDN profile which is unique within
652
+ # the resource group.
653
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
654
+ # unique globally.
655
+ # @param custom_domain_properties [ValidateCustomDomainInput] Custom domain to
656
+ # be validated.
657
+ # @param [Hash{String => String}] A hash of custom headers that will be added
658
+ # to the HTTP request.
659
+ #
660
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
661
+ #
662
+ def validate_custom_domain_async(resource_group_name, profile_name, endpoint_name, custom_domain_properties, custom_headers:nil)
663
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
664
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
665
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
666
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
667
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
668
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
669
+ fail ArgumentError, 'custom_domain_properties is nil' if custom_domain_properties.nil?
670
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
671
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
672
+
673
+
674
+ request_headers = {}
675
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
676
+
677
+ # Set Headers
678
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
679
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
680
+
681
+ # Serialize Request
682
+ request_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::ValidateCustomDomainInput.mapper()
683
+ request_content = @client.serialize(request_mapper, custom_domain_properties)
684
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
685
+
686
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/validateCustomDomain'
687
+
688
+ request_url = @base_url || @client.base_url
689
+
690
+ options = {
691
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
692
+ path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'endpointName' => endpoint_name,'subscriptionId' => @client.subscription_id},
693
+ query_params: {'api-version' => @client.api_version},
694
+ body: request_content,
695
+ headers: request_headers.merge(custom_headers || {}),
696
+ base_url: request_url
697
+ }
698
+ promise = @client.make_request_async(:post, path_template, options)
699
+
700
+ promise = promise.then do |result|
701
+ http_response = result.response
702
+ status_code = http_response.status
703
+ response_content = http_response.body
704
+ unless status_code == 200
705
+ error_model = JSON.load(response_content)
706
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
707
+ end
708
+
709
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
710
+ # Deserialize Response
711
+ if status_code == 200
712
+ begin
713
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
714
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::ValidateCustomDomainOutput.mapper()
715
+ result.body = @client.deserialize(result_mapper, parsed_response)
716
+ rescue Exception => e
717
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
718
+ end
719
+ end
720
+
721
+ result
722
+ end
723
+
724
+ promise.execute
725
+ end
726
+
727
+ #
728
+ # Checks the quota and usage of geo filters and custom domains under the given
729
+ # endpoint.
730
+ #
731
+ # @param resource_group_name [String] Name of the Resource group within the
732
+ # Azure subscription.
733
+ # @param profile_name [String] Name of the CDN profile which is unique within
734
+ # the resource group.
735
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
736
+ # unique globally.
737
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
738
+ # will be added to the HTTP request.
739
+ #
740
+ # @return [Array<ResourceUsage>] operation results.
741
+ #
742
+ def list_resource_usage(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
743
+ first_page = list_resource_usage_as_lazy(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers)
744
+ first_page.get_all_items
745
+ end
746
+
747
+ #
748
+ # Checks the quota and usage of geo filters and custom domains under the given
749
+ # endpoint.
750
+ #
751
+ # @param resource_group_name [String] Name of the Resource group within the
752
+ # Azure subscription.
753
+ # @param profile_name [String] Name of the CDN profile which is unique within
754
+ # the resource group.
755
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
756
+ # unique globally.
757
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
758
+ # will be added to the HTTP request.
759
+ #
760
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
761
+ #
762
+ def list_resource_usage_with_http_info(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
763
+ list_resource_usage_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
764
+ end
765
+
766
+ #
767
+ # Checks the quota and usage of geo filters and custom domains under the given
768
+ # endpoint.
769
+ #
770
+ # @param resource_group_name [String] Name of the Resource group within the
771
+ # Azure subscription.
772
+ # @param profile_name [String] Name of the CDN profile which is unique within
773
+ # the resource group.
774
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
775
+ # unique globally.
776
+ # @param [Hash{String => String}] A hash of custom headers that will be added
777
+ # to the HTTP request.
778
+ #
779
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
780
+ #
781
+ def list_resource_usage_async(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
782
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
783
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
784
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
785
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
786
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
787
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
788
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
789
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
790
+
791
+
792
+ request_headers = {}
793
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
794
+
795
+ # Set Headers
796
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
797
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
798
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/checkResourceUsage'
799
+
800
+ request_url = @base_url || @client.base_url
801
+
802
+ options = {
803
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
804
+ path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'endpointName' => endpoint_name,'subscriptionId' => @client.subscription_id},
805
+ query_params: {'api-version' => @client.api_version},
806
+ headers: request_headers.merge(custom_headers || {}),
807
+ base_url: request_url
808
+ }
809
+ promise = @client.make_request_async(:post, path_template, options)
810
+
811
+ promise = promise.then do |result|
812
+ http_response = result.response
813
+ status_code = http_response.status
814
+ response_content = http_response.body
815
+ unless status_code == 200
816
+ error_model = JSON.load(response_content)
817
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
818
+ end
819
+
820
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
821
+ # Deserialize Response
822
+ if status_code == 200
823
+ begin
824
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
825
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::ResourceUsageListResult.mapper()
826
+ result.body = @client.deserialize(result_mapper, parsed_response)
827
+ rescue Exception => e
828
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
829
+ end
830
+ end
831
+
832
+ result
833
+ end
834
+
835
+ promise.execute
836
+ end
837
+
838
+ #
839
+ # Creates a new CDN endpoint with the specified endpoint name under the
840
+ # specified subscription, resource group and profile.
841
+ #
842
+ # @param resource_group_name [String] Name of the Resource group within the
843
+ # Azure subscription.
844
+ # @param profile_name [String] Name of the CDN profile which is unique within
845
+ # the resource group.
846
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
847
+ # unique globally.
848
+ # @param endpoint [Endpoint] Endpoint properties
849
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
850
+ # will be added to the HTTP request.
851
+ #
852
+ # @return [Endpoint] operation results.
853
+ #
854
+ def begin_create(resource_group_name, profile_name, endpoint_name, endpoint, custom_headers:nil)
855
+ response = begin_create_async(resource_group_name, profile_name, endpoint_name, endpoint, custom_headers:custom_headers).value!
856
+ response.body unless response.nil?
857
+ end
858
+
859
+ #
860
+ # Creates a new CDN endpoint with the specified endpoint name under the
861
+ # specified subscription, resource group and profile.
862
+ #
863
+ # @param resource_group_name [String] Name of the Resource group within the
864
+ # Azure subscription.
865
+ # @param profile_name [String] Name of the CDN profile which is unique within
866
+ # the resource group.
867
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
868
+ # unique globally.
869
+ # @param endpoint [Endpoint] Endpoint properties
870
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
871
+ # will be added to the HTTP request.
872
+ #
873
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
874
+ #
875
+ def begin_create_with_http_info(resource_group_name, profile_name, endpoint_name, endpoint, custom_headers:nil)
876
+ begin_create_async(resource_group_name, profile_name, endpoint_name, endpoint, custom_headers:custom_headers).value!
877
+ end
878
+
879
+ #
880
+ # Creates a new CDN endpoint with the specified endpoint name under the
881
+ # specified subscription, resource group and profile.
882
+ #
883
+ # @param resource_group_name [String] Name of the Resource group within the
884
+ # Azure subscription.
885
+ # @param profile_name [String] Name of the CDN profile which is unique within
886
+ # the resource group.
887
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
888
+ # unique globally.
889
+ # @param endpoint [Endpoint] Endpoint properties
890
+ # @param [Hash{String => String}] A hash of custom headers that will be added
891
+ # to the HTTP request.
892
+ #
893
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
894
+ #
895
+ def begin_create_async(resource_group_name, profile_name, endpoint_name, endpoint, custom_headers:nil)
896
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
897
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
898
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
899
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
900
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
901
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
902
+ fail ArgumentError, 'endpoint is nil' if endpoint.nil?
903
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
904
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
905
+
906
+
907
+ request_headers = {}
908
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
909
+
910
+ # Set Headers
911
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
912
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
913
+
914
+ # Serialize Request
915
+ request_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
916
+ request_content = @client.serialize(request_mapper, endpoint)
917
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
918
+
919
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
920
+
921
+ request_url = @base_url || @client.base_url
922
+
923
+ options = {
924
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
925
+ path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'endpointName' => endpoint_name,'subscriptionId' => @client.subscription_id},
926
+ query_params: {'api-version' => @client.api_version},
927
+ body: request_content,
928
+ headers: request_headers.merge(custom_headers || {}),
929
+ base_url: request_url
930
+ }
931
+ promise = @client.make_request_async(:put, path_template, options)
932
+
933
+ promise = promise.then do |result|
934
+ http_response = result.response
935
+ status_code = http_response.status
936
+ response_content = http_response.body
937
+ unless status_code == 200 || status_code == 201 || status_code == 202
938
+ error_model = JSON.load(response_content)
939
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
940
+ end
941
+
942
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
943
+ # Deserialize Response
944
+ if status_code == 200
945
+ begin
946
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
947
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
948
+ result.body = @client.deserialize(result_mapper, parsed_response)
949
+ rescue Exception => e
950
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
951
+ end
952
+ end
953
+ # Deserialize Response
954
+ if status_code == 201
955
+ begin
956
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
957
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
958
+ result.body = @client.deserialize(result_mapper, parsed_response)
959
+ rescue Exception => e
960
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
961
+ end
962
+ end
963
+ # Deserialize Response
964
+ if status_code == 202
965
+ begin
966
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
967
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
968
+ result.body = @client.deserialize(result_mapper, parsed_response)
969
+ rescue Exception => e
970
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
971
+ end
972
+ end
973
+
974
+ result
975
+ end
976
+
977
+ promise.execute
978
+ end
979
+
980
+ #
981
+ # Updates an existing CDN endpoint with the specified endpoint name under the
982
+ # specified subscription, resource group and profile. Only tags and Origin
983
+ # HostHeader can be updated after creating an endpoint. To update origins, use
984
+ # the Update Origin operation. To update custom domains, use the Update Custom
985
+ # Domain operation.
986
+ #
987
+ # @param resource_group_name [String] Name of the Resource group within the
988
+ # Azure subscription.
989
+ # @param profile_name [String] Name of the CDN profile which is unique within
990
+ # the resource group.
991
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
992
+ # unique globally.
993
+ # @param endpoint_update_properties [EndpointUpdateParameters] Endpoint update
994
+ # properties
995
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
996
+ # will be added to the HTTP request.
997
+ #
998
+ # @return [Endpoint] operation results.
999
+ #
1000
+ def begin_update(resource_group_name, profile_name, endpoint_name, endpoint_update_properties, custom_headers:nil)
1001
+ response = begin_update_async(resource_group_name, profile_name, endpoint_name, endpoint_update_properties, custom_headers:custom_headers).value!
1002
+ response.body unless response.nil?
1003
+ end
1004
+
1005
+ #
1006
+ # Updates an existing CDN endpoint with the specified endpoint name under the
1007
+ # specified subscription, resource group and profile. Only tags and Origin
1008
+ # HostHeader can be updated after creating an endpoint. To update origins, use
1009
+ # the Update Origin operation. To update custom domains, use the Update Custom
1010
+ # Domain operation.
1011
+ #
1012
+ # @param resource_group_name [String] Name of the Resource group within the
1013
+ # Azure subscription.
1014
+ # @param profile_name [String] Name of the CDN profile which is unique within
1015
+ # the resource group.
1016
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1017
+ # unique globally.
1018
+ # @param endpoint_update_properties [EndpointUpdateParameters] Endpoint update
1019
+ # properties
1020
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1021
+ # will be added to the HTTP request.
1022
+ #
1023
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1024
+ #
1025
+ def begin_update_with_http_info(resource_group_name, profile_name, endpoint_name, endpoint_update_properties, custom_headers:nil)
1026
+ begin_update_async(resource_group_name, profile_name, endpoint_name, endpoint_update_properties, custom_headers:custom_headers).value!
1027
+ end
1028
+
1029
+ #
1030
+ # Updates an existing CDN endpoint with the specified endpoint name under the
1031
+ # specified subscription, resource group and profile. Only tags and Origin
1032
+ # HostHeader can be updated after creating an endpoint. To update origins, use
1033
+ # the Update Origin operation. To update custom domains, use the Update Custom
1034
+ # Domain operation.
1035
+ #
1036
+ # @param resource_group_name [String] Name of the Resource group within the
1037
+ # Azure subscription.
1038
+ # @param profile_name [String] Name of the CDN profile which is unique within
1039
+ # the resource group.
1040
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1041
+ # unique globally.
1042
+ # @param endpoint_update_properties [EndpointUpdateParameters] Endpoint update
1043
+ # properties
1044
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1045
+ # to the HTTP request.
1046
+ #
1047
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1048
+ #
1049
+ def begin_update_async(resource_group_name, profile_name, endpoint_name, endpoint_update_properties, custom_headers:nil)
1050
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1051
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1052
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1053
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1054
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1055
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
1056
+ fail ArgumentError, 'endpoint_update_properties is nil' if endpoint_update_properties.nil?
1057
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1058
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1059
+
1060
+
1061
+ request_headers = {}
1062
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1063
+
1064
+ # Set Headers
1065
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1066
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1067
+
1068
+ # Serialize Request
1069
+ request_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::EndpointUpdateParameters.mapper()
1070
+ request_content = @client.serialize(request_mapper, endpoint_update_properties)
1071
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1072
+
1073
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
1074
+
1075
+ request_url = @base_url || @client.base_url
1076
+
1077
+ options = {
1078
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1079
+ path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'endpointName' => endpoint_name,'subscriptionId' => @client.subscription_id},
1080
+ query_params: {'api-version' => @client.api_version},
1081
+ body: request_content,
1082
+ headers: request_headers.merge(custom_headers || {}),
1083
+ base_url: request_url
1084
+ }
1085
+ promise = @client.make_request_async(:patch, path_template, options)
1086
+
1087
+ promise = promise.then do |result|
1088
+ http_response = result.response
1089
+ status_code = http_response.status
1090
+ response_content = http_response.body
1091
+ unless status_code == 200 || status_code == 202
1092
+ error_model = JSON.load(response_content)
1093
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1094
+ end
1095
+
1096
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1097
+ # Deserialize Response
1098
+ if status_code == 200
1099
+ begin
1100
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1101
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
1102
+ result.body = @client.deserialize(result_mapper, parsed_response)
1103
+ rescue Exception => e
1104
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1105
+ end
1106
+ end
1107
+ # Deserialize Response
1108
+ if status_code == 202
1109
+ begin
1110
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1111
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
1112
+ result.body = @client.deserialize(result_mapper, parsed_response)
1113
+ rescue Exception => e
1114
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1115
+ end
1116
+ end
1117
+
1118
+ result
1119
+ end
1120
+
1121
+ promise.execute
1122
+ end
1123
+
1124
+ #
1125
+ # Deletes an existing CDN endpoint with the specified endpoint name under the
1126
+ # specified subscription, resource group and profile.
1127
+ #
1128
+ # @param resource_group_name [String] Name of the Resource group within the
1129
+ # Azure subscription.
1130
+ # @param profile_name [String] Name of the CDN profile which is unique within
1131
+ # the resource group.
1132
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1133
+ # unique globally.
1134
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1135
+ # will be added to the HTTP request.
1136
+ #
1137
+ #
1138
+ def begin_delete(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
1139
+ response = begin_delete_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
1140
+ nil
1141
+ end
1142
+
1143
+ #
1144
+ # Deletes an existing CDN endpoint with the specified endpoint name under the
1145
+ # specified subscription, resource group and profile.
1146
+ #
1147
+ # @param resource_group_name [String] Name of the Resource group within the
1148
+ # Azure subscription.
1149
+ # @param profile_name [String] Name of the CDN profile which is unique within
1150
+ # the resource group.
1151
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1152
+ # unique globally.
1153
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1154
+ # will be added to the HTTP request.
1155
+ #
1156
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1157
+ #
1158
+ def begin_delete_with_http_info(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
1159
+ begin_delete_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
1160
+ end
1161
+
1162
+ #
1163
+ # Deletes an existing CDN endpoint with the specified endpoint name under the
1164
+ # specified subscription, resource group and profile.
1165
+ #
1166
+ # @param resource_group_name [String] Name of the Resource group within the
1167
+ # Azure subscription.
1168
+ # @param profile_name [String] Name of the CDN profile which is unique within
1169
+ # the resource group.
1170
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1171
+ # unique globally.
1172
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1173
+ # to the HTTP request.
1174
+ #
1175
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1176
+ #
1177
+ def begin_delete_async(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
1178
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1179
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1180
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1181
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1182
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1183
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
1184
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1185
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1186
+
1187
+
1188
+ request_headers = {}
1189
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1190
+
1191
+ # Set Headers
1192
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1193
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1194
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
1195
+
1196
+ request_url = @base_url || @client.base_url
1197
+
1198
+ options = {
1199
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1200
+ path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'endpointName' => endpoint_name,'subscriptionId' => @client.subscription_id},
1201
+ query_params: {'api-version' => @client.api_version},
1202
+ headers: request_headers.merge(custom_headers || {}),
1203
+ base_url: request_url
1204
+ }
1205
+ promise = @client.make_request_async(:delete, path_template, options)
1206
+
1207
+ promise = promise.then do |result|
1208
+ http_response = result.response
1209
+ status_code = http_response.status
1210
+ response_content = http_response.body
1211
+ unless status_code == 202 || status_code == 204
1212
+ error_model = JSON.load(response_content)
1213
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1214
+ end
1215
+
1216
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1217
+
1218
+ result
1219
+ end
1220
+
1221
+ promise.execute
1222
+ end
1223
+
1224
+ #
1225
+ # Starts an existing CDN endpoint that is on a stopped state.
1226
+ #
1227
+ # @param resource_group_name [String] Name of the Resource group within the
1228
+ # Azure subscription.
1229
+ # @param profile_name [String] Name of the CDN profile which is unique within
1230
+ # the resource group.
1231
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1232
+ # unique globally.
1233
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1234
+ # will be added to the HTTP request.
1235
+ #
1236
+ # @return [Endpoint] operation results.
1237
+ #
1238
+ def begin_start(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
1239
+ response = begin_start_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
1240
+ response.body unless response.nil?
1241
+ end
1242
+
1243
+ #
1244
+ # Starts an existing CDN endpoint that is on a stopped state.
1245
+ #
1246
+ # @param resource_group_name [String] Name of the Resource group within the
1247
+ # Azure subscription.
1248
+ # @param profile_name [String] Name of the CDN profile which is unique within
1249
+ # the resource group.
1250
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1251
+ # unique globally.
1252
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1253
+ # will be added to the HTTP request.
1254
+ #
1255
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1256
+ #
1257
+ def begin_start_with_http_info(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
1258
+ begin_start_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
1259
+ end
1260
+
1261
+ #
1262
+ # Starts an existing CDN endpoint that is on a stopped state.
1263
+ #
1264
+ # @param resource_group_name [String] Name of the Resource group within the
1265
+ # Azure subscription.
1266
+ # @param profile_name [String] Name of the CDN profile which is unique within
1267
+ # the resource group.
1268
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1269
+ # unique globally.
1270
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1271
+ # to the HTTP request.
1272
+ #
1273
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1274
+ #
1275
+ def begin_start_async(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
1276
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1277
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1278
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1279
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1280
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1281
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
1282
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1283
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1284
+
1285
+
1286
+ request_headers = {}
1287
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1288
+
1289
+ # Set Headers
1290
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1291
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1292
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start'
1293
+
1294
+ request_url = @base_url || @client.base_url
1295
+
1296
+ options = {
1297
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1298
+ path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'endpointName' => endpoint_name,'subscriptionId' => @client.subscription_id},
1299
+ query_params: {'api-version' => @client.api_version},
1300
+ headers: request_headers.merge(custom_headers || {}),
1301
+ base_url: request_url
1302
+ }
1303
+ promise = @client.make_request_async(:post, path_template, options)
1304
+
1305
+ promise = promise.then do |result|
1306
+ http_response = result.response
1307
+ status_code = http_response.status
1308
+ response_content = http_response.body
1309
+ unless status_code == 200 || status_code == 202
1310
+ error_model = JSON.load(response_content)
1311
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1312
+ end
1313
+
1314
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1315
+ # Deserialize Response
1316
+ if status_code == 200
1317
+ begin
1318
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1319
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
1320
+ result.body = @client.deserialize(result_mapper, parsed_response)
1321
+ rescue Exception => e
1322
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1323
+ end
1324
+ end
1325
+ # Deserialize Response
1326
+ if status_code == 202
1327
+ begin
1328
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1329
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
1330
+ result.body = @client.deserialize(result_mapper, parsed_response)
1331
+ rescue Exception => e
1332
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1333
+ end
1334
+ end
1335
+
1336
+ result
1337
+ end
1338
+
1339
+ promise.execute
1340
+ end
1341
+
1342
+ #
1343
+ # Stops an existing running CDN endpoint.
1344
+ #
1345
+ # @param resource_group_name [String] Name of the Resource group within the
1346
+ # Azure subscription.
1347
+ # @param profile_name [String] Name of the CDN profile which is unique within
1348
+ # the resource group.
1349
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1350
+ # unique globally.
1351
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1352
+ # will be added to the HTTP request.
1353
+ #
1354
+ # @return [Endpoint] operation results.
1355
+ #
1356
+ def begin_stop(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
1357
+ response = begin_stop_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
1358
+ response.body unless response.nil?
1359
+ end
1360
+
1361
+ #
1362
+ # Stops an existing running CDN endpoint.
1363
+ #
1364
+ # @param resource_group_name [String] Name of the Resource group within the
1365
+ # Azure subscription.
1366
+ # @param profile_name [String] Name of the CDN profile which is unique within
1367
+ # the resource group.
1368
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1369
+ # unique globally.
1370
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1371
+ # will be added to the HTTP request.
1372
+ #
1373
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1374
+ #
1375
+ def begin_stop_with_http_info(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
1376
+ begin_stop_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
1377
+ end
1378
+
1379
+ #
1380
+ # Stops an existing running CDN endpoint.
1381
+ #
1382
+ # @param resource_group_name [String] Name of the Resource group within the
1383
+ # Azure subscription.
1384
+ # @param profile_name [String] Name of the CDN profile which is unique within
1385
+ # the resource group.
1386
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1387
+ # unique globally.
1388
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1389
+ # to the HTTP request.
1390
+ #
1391
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1392
+ #
1393
+ def begin_stop_async(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
1394
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1395
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1396
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1397
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1398
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1399
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
1400
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1401
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1402
+
1403
+
1404
+ request_headers = {}
1405
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1406
+
1407
+ # Set Headers
1408
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1409
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1410
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop'
1411
+
1412
+ request_url = @base_url || @client.base_url
1413
+
1414
+ options = {
1415
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1416
+ path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'endpointName' => endpoint_name,'subscriptionId' => @client.subscription_id},
1417
+ query_params: {'api-version' => @client.api_version},
1418
+ headers: request_headers.merge(custom_headers || {}),
1419
+ base_url: request_url
1420
+ }
1421
+ promise = @client.make_request_async(:post, path_template, options)
1422
+
1423
+ promise = promise.then do |result|
1424
+ http_response = result.response
1425
+ status_code = http_response.status
1426
+ response_content = http_response.body
1427
+ unless status_code == 200 || status_code == 202
1428
+ error_model = JSON.load(response_content)
1429
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1430
+ end
1431
+
1432
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1433
+ # Deserialize Response
1434
+ if status_code == 200
1435
+ begin
1436
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1437
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
1438
+ result.body = @client.deserialize(result_mapper, parsed_response)
1439
+ rescue Exception => e
1440
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1441
+ end
1442
+ end
1443
+ # Deserialize Response
1444
+ if status_code == 202
1445
+ begin
1446
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1447
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::Endpoint.mapper()
1448
+ result.body = @client.deserialize(result_mapper, parsed_response)
1449
+ rescue Exception => e
1450
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1451
+ end
1452
+ end
1453
+
1454
+ result
1455
+ end
1456
+
1457
+ promise.execute
1458
+ end
1459
+
1460
+ #
1461
+ # Removes a content from CDN.
1462
+ #
1463
+ # @param resource_group_name [String] Name of the Resource group within the
1464
+ # Azure subscription.
1465
+ # @param profile_name [String] Name of the CDN profile which is unique within
1466
+ # the resource group.
1467
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1468
+ # unique globally.
1469
+ # @param content_file_paths [PurgeParameters] The path to the content to be
1470
+ # purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a
1471
+ # single file, or a directory with a wildcard, e.g. '/pictures/*' which removes
1472
+ # all folders and files in the directory.
1473
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1474
+ # will be added to the HTTP request.
1475
+ #
1476
+ #
1477
+ def begin_purge_content(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:nil)
1478
+ response = begin_purge_content_async(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:custom_headers).value!
1479
+ nil
1480
+ end
1481
+
1482
+ #
1483
+ # Removes a content from CDN.
1484
+ #
1485
+ # @param resource_group_name [String] Name of the Resource group within the
1486
+ # Azure subscription.
1487
+ # @param profile_name [String] Name of the CDN profile which is unique within
1488
+ # the resource group.
1489
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1490
+ # unique globally.
1491
+ # @param content_file_paths [PurgeParameters] The path to the content to be
1492
+ # purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a
1493
+ # single file, or a directory with a wildcard, e.g. '/pictures/*' which removes
1494
+ # all folders and files in the directory.
1495
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1496
+ # will be added to the HTTP request.
1497
+ #
1498
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1499
+ #
1500
+ def begin_purge_content_with_http_info(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:nil)
1501
+ begin_purge_content_async(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:custom_headers).value!
1502
+ end
1503
+
1504
+ #
1505
+ # Removes a content from CDN.
1506
+ #
1507
+ # @param resource_group_name [String] Name of the Resource group within the
1508
+ # Azure subscription.
1509
+ # @param profile_name [String] Name of the CDN profile which is unique within
1510
+ # the resource group.
1511
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1512
+ # unique globally.
1513
+ # @param content_file_paths [PurgeParameters] The path to the content to be
1514
+ # purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a
1515
+ # single file, or a directory with a wildcard, e.g. '/pictures/*' which removes
1516
+ # all folders and files in the directory.
1517
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1518
+ # to the HTTP request.
1519
+ #
1520
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1521
+ #
1522
+ def begin_purge_content_async(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:nil)
1523
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1524
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1525
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1526
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1527
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1528
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
1529
+ fail ArgumentError, 'content_file_paths is nil' if content_file_paths.nil?
1530
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1531
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1532
+
1533
+
1534
+ request_headers = {}
1535
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1536
+
1537
+ # Set Headers
1538
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1539
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1540
+
1541
+ # Serialize Request
1542
+ request_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::PurgeParameters.mapper()
1543
+ request_content = @client.serialize(request_mapper, content_file_paths)
1544
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1545
+
1546
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge'
1547
+
1548
+ request_url = @base_url || @client.base_url
1549
+
1550
+ options = {
1551
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1552
+ path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'endpointName' => endpoint_name,'subscriptionId' => @client.subscription_id},
1553
+ query_params: {'api-version' => @client.api_version},
1554
+ body: request_content,
1555
+ headers: request_headers.merge(custom_headers || {}),
1556
+ base_url: request_url
1557
+ }
1558
+ promise = @client.make_request_async(:post, path_template, options)
1559
+
1560
+ promise = promise.then do |result|
1561
+ http_response = result.response
1562
+ status_code = http_response.status
1563
+ response_content = http_response.body
1564
+ unless status_code == 200 || status_code == 202
1565
+ error_model = JSON.load(response_content)
1566
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1567
+ end
1568
+
1569
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1570
+
1571
+ result
1572
+ end
1573
+
1574
+ promise.execute
1575
+ end
1576
+
1577
+ #
1578
+ # Pre-loads a content to CDN. Available for Verizon Profiles.
1579
+ #
1580
+ # @param resource_group_name [String] Name of the Resource group within the
1581
+ # Azure subscription.
1582
+ # @param profile_name [String] Name of the CDN profile which is unique within
1583
+ # the resource group.
1584
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1585
+ # unique globally.
1586
+ # @param content_file_paths [LoadParameters] The path to the content to be
1587
+ # loaded. Path should be a full URL, e.g. ‘/pictires/city.png' which loads a
1588
+ # single file
1589
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1590
+ # will be added to the HTTP request.
1591
+ #
1592
+ #
1593
+ def begin_load_content(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:nil)
1594
+ response = begin_load_content_async(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:custom_headers).value!
1595
+ nil
1596
+ end
1597
+
1598
+ #
1599
+ # Pre-loads a content to CDN. Available for Verizon Profiles.
1600
+ #
1601
+ # @param resource_group_name [String] Name of the Resource group within the
1602
+ # Azure subscription.
1603
+ # @param profile_name [String] Name of the CDN profile which is unique within
1604
+ # the resource group.
1605
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1606
+ # unique globally.
1607
+ # @param content_file_paths [LoadParameters] The path to the content to be
1608
+ # loaded. Path should be a full URL, e.g. ‘/pictires/city.png' which loads a
1609
+ # single file
1610
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1611
+ # will be added to the HTTP request.
1612
+ #
1613
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1614
+ #
1615
+ def begin_load_content_with_http_info(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:nil)
1616
+ begin_load_content_async(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:custom_headers).value!
1617
+ end
1618
+
1619
+ #
1620
+ # Pre-loads a content to CDN. Available for Verizon Profiles.
1621
+ #
1622
+ # @param resource_group_name [String] Name of the Resource group within the
1623
+ # Azure subscription.
1624
+ # @param profile_name [String] Name of the CDN profile which is unique within
1625
+ # the resource group.
1626
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1627
+ # unique globally.
1628
+ # @param content_file_paths [LoadParameters] The path to the content to be
1629
+ # loaded. Path should be a full URL, e.g. ‘/pictires/city.png' which loads a
1630
+ # single file
1631
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1632
+ # to the HTTP request.
1633
+ #
1634
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1635
+ #
1636
+ def begin_load_content_async(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:nil)
1637
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1638
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1639
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1640
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1641
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
1642
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
1643
+ fail ArgumentError, 'content_file_paths is nil' if content_file_paths.nil?
1644
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1645
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1646
+
1647
+
1648
+ request_headers = {}
1649
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1650
+
1651
+ # Set Headers
1652
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1653
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1654
+
1655
+ # Serialize Request
1656
+ request_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::LoadParameters.mapper()
1657
+ request_content = @client.serialize(request_mapper, content_file_paths)
1658
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1659
+
1660
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load'
1661
+
1662
+ request_url = @base_url || @client.base_url
1663
+
1664
+ options = {
1665
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1666
+ path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_name,'endpointName' => endpoint_name,'subscriptionId' => @client.subscription_id},
1667
+ query_params: {'api-version' => @client.api_version},
1668
+ body: request_content,
1669
+ headers: request_headers.merge(custom_headers || {}),
1670
+ base_url: request_url
1671
+ }
1672
+ promise = @client.make_request_async(:post, path_template, options)
1673
+
1674
+ promise = promise.then do |result|
1675
+ http_response = result.response
1676
+ status_code = http_response.status
1677
+ response_content = http_response.body
1678
+ unless status_code == 200 || status_code == 202
1679
+ error_model = JSON.load(response_content)
1680
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1681
+ end
1682
+
1683
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1684
+
1685
+ result
1686
+ end
1687
+
1688
+ promise.execute
1689
+ end
1690
+
1691
+ #
1692
+ # Lists existing CDN endpoints.
1693
+ #
1694
+ # @param next_page_link [String] The NextLink from the previous successful call
1695
+ # to List operation.
1696
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1697
+ # will be added to the HTTP request.
1698
+ #
1699
+ # @return [EndpointListResult] operation results.
1700
+ #
1701
+ def list_by_profile_next(next_page_link, custom_headers:nil)
1702
+ response = list_by_profile_next_async(next_page_link, custom_headers:custom_headers).value!
1703
+ response.body unless response.nil?
1704
+ end
1705
+
1706
+ #
1707
+ # Lists existing CDN endpoints.
1708
+ #
1709
+ # @param next_page_link [String] The NextLink from the previous successful call
1710
+ # to List operation.
1711
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1712
+ # will be added to the HTTP request.
1713
+ #
1714
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1715
+ #
1716
+ def list_by_profile_next_with_http_info(next_page_link, custom_headers:nil)
1717
+ list_by_profile_next_async(next_page_link, custom_headers:custom_headers).value!
1718
+ end
1719
+
1720
+ #
1721
+ # Lists existing CDN endpoints.
1722
+ #
1723
+ # @param next_page_link [String] The NextLink from the previous successful call
1724
+ # to List operation.
1725
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1726
+ # to the HTTP request.
1727
+ #
1728
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1729
+ #
1730
+ def list_by_profile_next_async(next_page_link, custom_headers:nil)
1731
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1732
+
1733
+
1734
+ request_headers = {}
1735
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1736
+
1737
+ # Set Headers
1738
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1739
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1740
+ path_template = '{nextLink}'
1741
+
1742
+ request_url = @base_url || @client.base_url
1743
+
1744
+ options = {
1745
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1746
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1747
+ headers: request_headers.merge(custom_headers || {}),
1748
+ base_url: request_url
1749
+ }
1750
+ promise = @client.make_request_async(:get, path_template, options)
1751
+
1752
+ promise = promise.then do |result|
1753
+ http_response = result.response
1754
+ status_code = http_response.status
1755
+ response_content = http_response.body
1756
+ unless status_code == 200
1757
+ error_model = JSON.load(response_content)
1758
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1759
+ end
1760
+
1761
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1762
+ # Deserialize Response
1763
+ if status_code == 200
1764
+ begin
1765
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1766
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::EndpointListResult.mapper()
1767
+ result.body = @client.deserialize(result_mapper, parsed_response)
1768
+ rescue Exception => e
1769
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1770
+ end
1771
+ end
1772
+
1773
+ result
1774
+ end
1775
+
1776
+ promise.execute
1777
+ end
1778
+
1779
+ #
1780
+ # Checks the quota and usage of geo filters and custom domains under the given
1781
+ # endpoint.
1782
+ #
1783
+ # @param next_page_link [String] The NextLink from the previous successful call
1784
+ # to List operation.
1785
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1786
+ # will be added to the HTTP request.
1787
+ #
1788
+ # @return [ResourceUsageListResult] operation results.
1789
+ #
1790
+ def list_resource_usage_next(next_page_link, custom_headers:nil)
1791
+ response = list_resource_usage_next_async(next_page_link, custom_headers:custom_headers).value!
1792
+ response.body unless response.nil?
1793
+ end
1794
+
1795
+ #
1796
+ # Checks the quota and usage of geo filters and custom domains under the given
1797
+ # endpoint.
1798
+ #
1799
+ # @param next_page_link [String] The NextLink from the previous successful call
1800
+ # to List operation.
1801
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1802
+ # will be added to the HTTP request.
1803
+ #
1804
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1805
+ #
1806
+ def list_resource_usage_next_with_http_info(next_page_link, custom_headers:nil)
1807
+ list_resource_usage_next_async(next_page_link, custom_headers:custom_headers).value!
1808
+ end
1809
+
1810
+ #
1811
+ # Checks the quota and usage of geo filters and custom domains under the given
1812
+ # endpoint.
1813
+ #
1814
+ # @param next_page_link [String] The NextLink from the previous successful call
1815
+ # to List operation.
1816
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1817
+ # to the HTTP request.
1818
+ #
1819
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1820
+ #
1821
+ def list_resource_usage_next_async(next_page_link, custom_headers:nil)
1822
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1823
+
1824
+
1825
+ request_headers = {}
1826
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1827
+
1828
+ # Set Headers
1829
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1830
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1831
+ path_template = '{nextLink}'
1832
+
1833
+ request_url = @base_url || @client.base_url
1834
+
1835
+ options = {
1836
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1837
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1838
+ headers: request_headers.merge(custom_headers || {}),
1839
+ base_url: request_url
1840
+ }
1841
+ promise = @client.make_request_async(:post, path_template, options)
1842
+
1843
+ promise = promise.then do |result|
1844
+ http_response = result.response
1845
+ status_code = http_response.status
1846
+ response_content = http_response.body
1847
+ unless status_code == 200
1848
+ error_model = JSON.load(response_content)
1849
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1850
+ end
1851
+
1852
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1853
+ # Deserialize Response
1854
+ if status_code == 200
1855
+ begin
1856
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1857
+ result_mapper = Azure::CDN::Mgmt::V2017_10_12::Models::ResourceUsageListResult.mapper()
1858
+ result.body = @client.deserialize(result_mapper, parsed_response)
1859
+ rescue Exception => e
1860
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1861
+ end
1862
+ end
1863
+
1864
+ result
1865
+ end
1866
+
1867
+ promise.execute
1868
+ end
1869
+
1870
+ #
1871
+ # Lists existing CDN endpoints.
1872
+ #
1873
+ # @param resource_group_name [String] Name of the Resource group within the
1874
+ # Azure subscription.
1875
+ # @param profile_name [String] Name of the CDN profile which is unique within
1876
+ # the resource group.
1877
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1878
+ # will be added to the HTTP request.
1879
+ #
1880
+ # @return [EndpointListResult] which provide lazy access to pages of the
1881
+ # response.
1882
+ #
1883
+ def list_by_profile_as_lazy(resource_group_name, profile_name, custom_headers:nil)
1884
+ response = list_by_profile_async(resource_group_name, profile_name, custom_headers:custom_headers).value!
1885
+ unless response.nil?
1886
+ page = response.body
1887
+ page.next_method = Proc.new do |next_page_link|
1888
+ list_by_profile_next_async(next_page_link, custom_headers:custom_headers)
1889
+ end
1890
+ page
1891
+ end
1892
+ end
1893
+
1894
+ #
1895
+ # Checks the quota and usage of geo filters and custom domains under the given
1896
+ # endpoint.
1897
+ #
1898
+ # @param resource_group_name [String] Name of the Resource group within the
1899
+ # Azure subscription.
1900
+ # @param profile_name [String] Name of the CDN profile which is unique within
1901
+ # the resource group.
1902
+ # @param endpoint_name [String] Name of the endpoint under the profile which is
1903
+ # unique globally.
1904
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1905
+ # will be added to the HTTP request.
1906
+ #
1907
+ # @return [ResourceUsageListResult] which provide lazy access to pages of the
1908
+ # response.
1909
+ #
1910
+ def list_resource_usage_as_lazy(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
1911
+ response = list_resource_usage_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
1912
+ unless response.nil?
1913
+ page = response.body
1914
+ page.next_method = Proc.new do |next_page_link|
1915
+ list_resource_usage_next_async(next_page_link, custom_headers:custom_headers)
1916
+ end
1917
+ page
1918
+ end
1919
+ end
1920
+
1921
+ end
1922
+ end