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