azure_mgmt_mysql 0.17.1 → 0.17.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/my_sqlmanagement_client.rb +1 -1
  3. data/lib/2017-12-01/generated/azure_mgmt_mysql/my_sqlmanagement_client.rb +1 -1
  4. data/lib/2018-06-01/generated/azure_mgmt_mysql.rb +52 -0
  5. data/lib/2018-06-01/generated/azure_mgmt_mysql/advisors.rb +349 -0
  6. data/lib/2018-06-01/generated/azure_mgmt_mysql/location_based_recommended_action_sessions_operation_status.rb +124 -0
  7. data/lib/2018-06-01/generated/azure_mgmt_mysql/location_based_recommended_action_sessions_result.rb +256 -0
  8. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/advisor.rb +73 -0
  9. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/advisors_result_list.rb +100 -0
  10. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/azure_entity_resource.rb +75 -0
  11. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/error_additional_info.rb +59 -0
  12. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/error_response.rb +113 -0
  13. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/private_endpoint_connection.rb +100 -0
  14. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/private_endpoint_connection_list_result.rb +100 -0
  15. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/private_endpoint_property.rb +47 -0
  16. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/private_link_resource.rb +76 -0
  17. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/private_link_resource_list_result.rb +100 -0
  18. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/private_link_resource_properties.rb +68 -0
  19. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/private_link_service_connection_state_property.rb +72 -0
  20. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/proxy_resource.rb +63 -0
  21. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/recommendation_action.rb +158 -0
  22. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/recommendation_actions_result_list.rb +101 -0
  23. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/recommended_action_sessions_operation_status.rb +68 -0
  24. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/resource.rb +83 -0
  25. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/tags_object.rb +54 -0
  26. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/tracked_resource.rb +92 -0
  27. data/lib/2018-06-01/generated/azure_mgmt_mysql/module_definition.rb +9 -0
  28. data/lib/2018-06-01/generated/azure_mgmt_mysql/my_sqlmanagement_client.rb +351 -0
  29. data/lib/2018-06-01/generated/azure_mgmt_mysql/private_endpoint_connections.rb +832 -0
  30. data/lib/2018-06-01/generated/azure_mgmt_mysql/private_link_resources.rb +349 -0
  31. data/lib/2018-06-01/generated/azure_mgmt_mysql/recommended_actions.rb +362 -0
  32. data/lib/2020-01-01/generated/azure_mgmt_mysql.rb +38 -0
  33. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/azure_entity_resource.rb +75 -0
  34. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/error_additional_info.rb +59 -0
  35. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/error_response.rb +113 -0
  36. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/proxy_resource.rb +63 -0
  37. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/resource.rb +83 -0
  38. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/server_key.rb +111 -0
  39. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/server_key_list_result.rb +100 -0
  40. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/server_upgrade_parameters.rb +47 -0
  41. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/tracked_resource.rb +92 -0
  42. data/lib/2020-01-01/generated/azure_mgmt_mysql/module_definition.rb +9 -0
  43. data/lib/2020-01-01/generated/azure_mgmt_mysql/my_sqlmanagement_client.rb +135 -0
  44. data/lib/2020-01-01/generated/azure_mgmt_mysql/server_keys.rb +666 -0
  45. data/lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb +439 -0
  46. data/lib/azure_mgmt_mysql.rb +3 -1
  47. data/lib/profiles/latest/modules/mysql_profile_module.rb +122 -12
  48. data/lib/version.rb +1 -1
  49. metadata +44 -2
@@ -0,0 +1,349 @@
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::Mysql::Mgmt::V2018_06_01
7
+ #
8
+ # The Microsoft Azure management API provides create, read, update, and
9
+ # delete functionality for Azure MySQL resources including servers,
10
+ # databases, firewall rules, VNET rules, security alert policies, log files
11
+ # and configurations with new business model.
12
+ #
13
+ class PrivateLinkResources
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the PrivateLinkResources class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [MySQLManagementClient] reference to the MySQLManagementClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Gets the private link resources for MySQL server.
29
+ #
30
+ # @param resource_group_name [String] The name of the resource group. The name
31
+ # is case insensitive.
32
+ # @param server_name [String] The name of the server.
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<PrivateLinkResource>] operation results.
37
+ #
38
+ def list_by_server(resource_group_name, server_name, custom_headers:nil)
39
+ first_page = list_by_server_as_lazy(resource_group_name, server_name, custom_headers:custom_headers)
40
+ first_page.get_all_items
41
+ end
42
+
43
+ #
44
+ # Gets the private link resources for MySQL server.
45
+ #
46
+ # @param resource_group_name [String] The name of the resource group. The name
47
+ # is case insensitive.
48
+ # @param server_name [String] The name of the server.
49
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
50
+ # will be added to the HTTP request.
51
+ #
52
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
53
+ #
54
+ def list_by_server_with_http_info(resource_group_name, server_name, custom_headers:nil)
55
+ list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
56
+ end
57
+
58
+ #
59
+ # Gets the private link resources for MySQL server.
60
+ #
61
+ # @param resource_group_name [String] The name of the resource group. The name
62
+ # is case insensitive.
63
+ # @param server_name [String] The name of the server.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def list_by_server_async(resource_group_name, server_name, custom_headers:nil)
70
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
71
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
72
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
73
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
74
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
75
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
76
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
77
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
78
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
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.DBforMySQL/servers/{serverName}/privateLinkResources'
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,'serverName' => server_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 MsRestAzure::AzureOperationError.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
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
111
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
112
+ # Deserialize Response
113
+ if status_code == 200
114
+ begin
115
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
116
+ result_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::PrivateLinkResourceListResult.mapper()
117
+ result.body = @client.deserialize(result_mapper, parsed_response)
118
+ rescue Exception => e
119
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
120
+ end
121
+ end
122
+
123
+ result
124
+ end
125
+
126
+ promise.execute
127
+ end
128
+
129
+ #
130
+ # Gets a private link resource for MySQL server.
131
+ #
132
+ # @param resource_group_name [String] The name of the resource group. The name
133
+ # is case insensitive.
134
+ # @param server_name [String] The name of the server.
135
+ # @param group_name [String] The name of the private link resource.
136
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
137
+ # will be added to the HTTP request.
138
+ #
139
+ # @return [PrivateLinkResource] operation results.
140
+ #
141
+ def get(resource_group_name, server_name, group_name, custom_headers:nil)
142
+ response = get_async(resource_group_name, server_name, group_name, custom_headers:custom_headers).value!
143
+ response.body unless response.nil?
144
+ end
145
+
146
+ #
147
+ # Gets a private link resource for MySQL server.
148
+ #
149
+ # @param resource_group_name [String] The name of the resource group. The name
150
+ # is case insensitive.
151
+ # @param server_name [String] The name of the server.
152
+ # @param group_name [String] The name of the private link resource.
153
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
154
+ # will be added to the HTTP request.
155
+ #
156
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
157
+ #
158
+ def get_with_http_info(resource_group_name, server_name, group_name, custom_headers:nil)
159
+ get_async(resource_group_name, server_name, group_name, custom_headers:custom_headers).value!
160
+ end
161
+
162
+ #
163
+ # Gets a private link resource for MySQL server.
164
+ #
165
+ # @param resource_group_name [String] The name of the resource group. The name
166
+ # is case insensitive.
167
+ # @param server_name [String] The name of the server.
168
+ # @param group_name [String] The name of the private link resource.
169
+ # @param [Hash{String => String}] A hash of custom headers that will be added
170
+ # to the HTTP request.
171
+ #
172
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
173
+ #
174
+ def get_async(resource_group_name, server_name, group_name, custom_headers:nil)
175
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
176
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
177
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
178
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
179
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
180
+ fail ArgumentError, 'group_name is nil' if group_name.nil?
181
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
182
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
183
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
184
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
185
+
186
+
187
+ request_headers = {}
188
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
189
+
190
+ # Set Headers
191
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
192
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
193
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateLinkResources/{groupName}'
194
+
195
+ request_url = @base_url || @client.base_url
196
+
197
+ options = {
198
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
199
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'groupName' => group_name,'subscriptionId' => @client.subscription_id},
200
+ query_params: {'api-version' => @client.api_version},
201
+ headers: request_headers.merge(custom_headers || {}),
202
+ base_url: request_url
203
+ }
204
+ promise = @client.make_request_async(:get, path_template, options)
205
+
206
+ promise = promise.then do |result|
207
+ http_response = result.response
208
+ status_code = http_response.status
209
+ response_content = http_response.body
210
+ unless status_code == 200
211
+ error_model = JSON.load(response_content)
212
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
213
+ end
214
+
215
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
216
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
217
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
218
+ # Deserialize Response
219
+ if status_code == 200
220
+ begin
221
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
222
+ result_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::PrivateLinkResource.mapper()
223
+ result.body = @client.deserialize(result_mapper, parsed_response)
224
+ rescue Exception => e
225
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
226
+ end
227
+ end
228
+
229
+ result
230
+ end
231
+
232
+ promise.execute
233
+ end
234
+
235
+ #
236
+ # Gets the private link resources for MySQL server.
237
+ #
238
+ # @param next_page_link [String] The NextLink from the previous successful call
239
+ # to List operation.
240
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
241
+ # will be added to the HTTP request.
242
+ #
243
+ # @return [PrivateLinkResourceListResult] operation results.
244
+ #
245
+ def list_by_server_next(next_page_link, custom_headers:nil)
246
+ response = list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
247
+ response.body unless response.nil?
248
+ end
249
+
250
+ #
251
+ # Gets the private link resources for MySQL server.
252
+ #
253
+ # @param next_page_link [String] The NextLink from the previous successful call
254
+ # to List operation.
255
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
256
+ # will be added to the HTTP request.
257
+ #
258
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
259
+ #
260
+ def list_by_server_next_with_http_info(next_page_link, custom_headers:nil)
261
+ list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
262
+ end
263
+
264
+ #
265
+ # Gets the private link resources for MySQL server.
266
+ #
267
+ # @param next_page_link [String] The NextLink from the previous successful call
268
+ # to List operation.
269
+ # @param [Hash{String => String}] A hash of custom headers that will be added
270
+ # to the HTTP request.
271
+ #
272
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
273
+ #
274
+ def list_by_server_next_async(next_page_link, custom_headers:nil)
275
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
276
+
277
+
278
+ request_headers = {}
279
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
280
+
281
+ # Set Headers
282
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
283
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
284
+ path_template = '{nextLink}'
285
+
286
+ request_url = @base_url || @client.base_url
287
+
288
+ options = {
289
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
290
+ skip_encoding_path_params: {'nextLink' => next_page_link},
291
+ headers: request_headers.merge(custom_headers || {}),
292
+ base_url: request_url
293
+ }
294
+ promise = @client.make_request_async(:get, path_template, options)
295
+
296
+ promise = promise.then do |result|
297
+ http_response = result.response
298
+ status_code = http_response.status
299
+ response_content = http_response.body
300
+ unless status_code == 200
301
+ error_model = JSON.load(response_content)
302
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
303
+ end
304
+
305
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
306
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
307
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
308
+ # Deserialize Response
309
+ if status_code == 200
310
+ begin
311
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
312
+ result_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::PrivateLinkResourceListResult.mapper()
313
+ result.body = @client.deserialize(result_mapper, parsed_response)
314
+ rescue Exception => e
315
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
316
+ end
317
+ end
318
+
319
+ result
320
+ end
321
+
322
+ promise.execute
323
+ end
324
+
325
+ #
326
+ # Gets the private link resources for MySQL server.
327
+ #
328
+ # @param resource_group_name [String] The name of the resource group. The name
329
+ # is case insensitive.
330
+ # @param server_name [String] The name of the server.
331
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
332
+ # will be added to the HTTP request.
333
+ #
334
+ # @return [PrivateLinkResourceListResult] which provide lazy access to pages of
335
+ # the response.
336
+ #
337
+ def list_by_server_as_lazy(resource_group_name, server_name, custom_headers:nil)
338
+ response = list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
339
+ unless response.nil?
340
+ page = response.body
341
+ page.next_method = Proc.new do |next_page_link|
342
+ list_by_server_next_async(next_page_link, custom_headers:custom_headers)
343
+ end
344
+ page
345
+ end
346
+ end
347
+
348
+ end
349
+ end
@@ -0,0 +1,362 @@
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::Mysql::Mgmt::V2018_06_01
7
+ #
8
+ # The Microsoft Azure management API provides create, read, update, and
9
+ # delete functionality for Azure MySQL resources including servers,
10
+ # databases, firewall rules, VNET rules, security alert policies, log files
11
+ # and configurations with new business model.
12
+ #
13
+ class RecommendedActions
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the RecommendedActions class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [MySQLManagementClient] reference to the MySQLManagementClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Retrieve recommended actions from the advisor.
29
+ #
30
+ # @param resource_group_name [String] The name of the resource group. The name
31
+ # is case insensitive.
32
+ # @param server_name [String] The name of the server.
33
+ # @param advisor_name [String] The advisor name for recommendation action.
34
+ # @param recommended_action_name [String] The recommended action name.
35
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
36
+ # will be added to the HTTP request.
37
+ #
38
+ # @return [RecommendationAction] operation results.
39
+ #
40
+ def get(resource_group_name, server_name, advisor_name, recommended_action_name, custom_headers:nil)
41
+ response = get_async(resource_group_name, server_name, advisor_name, recommended_action_name, custom_headers:custom_headers).value!
42
+ response.body unless response.nil?
43
+ end
44
+
45
+ #
46
+ # Retrieve recommended actions from the advisor.
47
+ #
48
+ # @param resource_group_name [String] The name of the resource group. The name
49
+ # is case insensitive.
50
+ # @param server_name [String] The name of the server.
51
+ # @param advisor_name [String] The advisor name for recommendation action.
52
+ # @param recommended_action_name [String] The recommended action name.
53
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
54
+ # will be added to the HTTP request.
55
+ #
56
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
57
+ #
58
+ def get_with_http_info(resource_group_name, server_name, advisor_name, recommended_action_name, custom_headers:nil)
59
+ get_async(resource_group_name, server_name, advisor_name, recommended_action_name, custom_headers:custom_headers).value!
60
+ end
61
+
62
+ #
63
+ # Retrieve recommended actions from the advisor.
64
+ #
65
+ # @param resource_group_name [String] The name of the resource group. The name
66
+ # is case insensitive.
67
+ # @param server_name [String] The name of the server.
68
+ # @param advisor_name [String] The advisor name for recommendation action.
69
+ # @param recommended_action_name [String] The recommended action name.
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def get_async(resource_group_name, server_name, advisor_name, recommended_action_name, custom_headers:nil)
76
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
77
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
78
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
79
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
80
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
81
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
82
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
83
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
84
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
85
+ fail ArgumentError, 'advisor_name is nil' if advisor_name.nil?
86
+ fail ArgumentError, 'recommended_action_name is nil' if recommended_action_name.nil?
87
+
88
+
89
+ request_headers = {}
90
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
91
+
92
+ # Set Headers
93
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
94
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
95
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}'
96
+
97
+ request_url = @base_url || @client.base_url
98
+
99
+ options = {
100
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
101
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'advisorName' => advisor_name,'recommendedActionName' => recommended_action_name},
102
+ query_params: {'api-version' => @client.api_version},
103
+ headers: request_headers.merge(custom_headers || {}),
104
+ base_url: request_url
105
+ }
106
+ promise = @client.make_request_async(:get, path_template, options)
107
+
108
+ promise = promise.then do |result|
109
+ http_response = result.response
110
+ status_code = http_response.status
111
+ response_content = http_response.body
112
+ unless status_code == 200
113
+ error_model = JSON.load(response_content)
114
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
115
+ end
116
+
117
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
118
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
119
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
120
+ # Deserialize Response
121
+ if status_code == 200
122
+ begin
123
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
124
+ result_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::RecommendationAction.mapper()
125
+ result.body = @client.deserialize(result_mapper, parsed_response)
126
+ rescue Exception => e
127
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
128
+ end
129
+ end
130
+
131
+ result
132
+ end
133
+
134
+ promise.execute
135
+ end
136
+
137
+ #
138
+ # Retrieve recommended actions from the advisor.
139
+ #
140
+ # @param resource_group_name [String] The name of the resource group. The name
141
+ # is case insensitive.
142
+ # @param server_name [String] The name of the server.
143
+ # @param advisor_name [String] The advisor name for recommendation action.
144
+ # @param session_id [String] The recommendation action session identifier.
145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
+ # will be added to the HTTP request.
147
+ #
148
+ # @return [Array<RecommendationAction>] operation results.
149
+ #
150
+ def list_by_server(resource_group_name, server_name, advisor_name, session_id:nil, custom_headers:nil)
151
+ first_page = list_by_server_as_lazy(resource_group_name, server_name, advisor_name, session_id:session_id, custom_headers:custom_headers)
152
+ first_page.get_all_items
153
+ end
154
+
155
+ #
156
+ # Retrieve recommended actions from the advisor.
157
+ #
158
+ # @param resource_group_name [String] The name of the resource group. The name
159
+ # is case insensitive.
160
+ # @param server_name [String] The name of the server.
161
+ # @param advisor_name [String] The advisor name for recommendation action.
162
+ # @param session_id [String] The recommendation action session identifier.
163
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
164
+ # will be added to the HTTP request.
165
+ #
166
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
167
+ #
168
+ def list_by_server_with_http_info(resource_group_name, server_name, advisor_name, session_id:nil, custom_headers:nil)
169
+ list_by_server_async(resource_group_name, server_name, advisor_name, session_id:session_id, custom_headers:custom_headers).value!
170
+ end
171
+
172
+ #
173
+ # Retrieve recommended actions from the advisor.
174
+ #
175
+ # @param resource_group_name [String] The name of the resource group. The name
176
+ # is case insensitive.
177
+ # @param server_name [String] The name of the server.
178
+ # @param advisor_name [String] The advisor name for recommendation action.
179
+ # @param session_id [String] The recommendation action session identifier.
180
+ # @param [Hash{String => String}] A hash of custom headers that will be added
181
+ # to the HTTP request.
182
+ #
183
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
184
+ #
185
+ def list_by_server_async(resource_group_name, server_name, advisor_name, session_id:nil, custom_headers:nil)
186
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
187
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
188
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
189
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
190
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
191
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
192
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
193
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
194
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
195
+ fail ArgumentError, 'advisor_name is nil' if advisor_name.nil?
196
+
197
+
198
+ request_headers = {}
199
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
200
+
201
+ # Set Headers
202
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
203
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
204
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/advisors/{advisorName}/recommendedActions'
205
+
206
+ request_url = @base_url || @client.base_url
207
+
208
+ options = {
209
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
210
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'advisorName' => advisor_name},
211
+ query_params: {'api-version' => @client.api_version,'sessionId' => session_id},
212
+ headers: request_headers.merge(custom_headers || {}),
213
+ base_url: request_url
214
+ }
215
+ promise = @client.make_request_async(:get, path_template, options)
216
+
217
+ promise = promise.then do |result|
218
+ http_response = result.response
219
+ status_code = http_response.status
220
+ response_content = http_response.body
221
+ unless status_code == 200
222
+ error_model = JSON.load(response_content)
223
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
224
+ end
225
+
226
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
227
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
228
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
229
+ # Deserialize Response
230
+ if status_code == 200
231
+ begin
232
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
233
+ result_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::RecommendationActionsResultList.mapper()
234
+ result.body = @client.deserialize(result_mapper, parsed_response)
235
+ rescue Exception => e
236
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
237
+ end
238
+ end
239
+
240
+ result
241
+ end
242
+
243
+ promise.execute
244
+ end
245
+
246
+ #
247
+ # Retrieve recommended actions from the advisor.
248
+ #
249
+ # @param next_page_link [String] The NextLink from the previous successful call
250
+ # to List operation.
251
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
252
+ # will be added to the HTTP request.
253
+ #
254
+ # @return [RecommendationActionsResultList] operation results.
255
+ #
256
+ def list_by_server_next(next_page_link, custom_headers:nil)
257
+ response = list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
258
+ response.body unless response.nil?
259
+ end
260
+
261
+ #
262
+ # Retrieve recommended actions from the advisor.
263
+ #
264
+ # @param next_page_link [String] The NextLink from the previous successful call
265
+ # to List operation.
266
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
267
+ # will be added to the HTTP request.
268
+ #
269
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
270
+ #
271
+ def list_by_server_next_with_http_info(next_page_link, custom_headers:nil)
272
+ list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
273
+ end
274
+
275
+ #
276
+ # Retrieve recommended actions from the advisor.
277
+ #
278
+ # @param next_page_link [String] The NextLink from the previous successful call
279
+ # to List operation.
280
+ # @param [Hash{String => String}] A hash of custom headers that will be added
281
+ # to the HTTP request.
282
+ #
283
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
284
+ #
285
+ def list_by_server_next_async(next_page_link, custom_headers:nil)
286
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
287
+
288
+
289
+ request_headers = {}
290
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
291
+
292
+ # Set Headers
293
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
294
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
295
+ path_template = '{nextLink}'
296
+
297
+ request_url = @base_url || @client.base_url
298
+
299
+ options = {
300
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
301
+ skip_encoding_path_params: {'nextLink' => next_page_link},
302
+ headers: request_headers.merge(custom_headers || {}),
303
+ base_url: request_url
304
+ }
305
+ promise = @client.make_request_async(:get, path_template, options)
306
+
307
+ promise = promise.then do |result|
308
+ http_response = result.response
309
+ status_code = http_response.status
310
+ response_content = http_response.body
311
+ unless status_code == 200
312
+ error_model = JSON.load(response_content)
313
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
314
+ end
315
+
316
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
317
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
318
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
319
+ # Deserialize Response
320
+ if status_code == 200
321
+ begin
322
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
323
+ result_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::RecommendationActionsResultList.mapper()
324
+ result.body = @client.deserialize(result_mapper, parsed_response)
325
+ rescue Exception => e
326
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
327
+ end
328
+ end
329
+
330
+ result
331
+ end
332
+
333
+ promise.execute
334
+ end
335
+
336
+ #
337
+ # Retrieve recommended actions from the advisor.
338
+ #
339
+ # @param resource_group_name [String] The name of the resource group. The name
340
+ # is case insensitive.
341
+ # @param server_name [String] The name of the server.
342
+ # @param advisor_name [String] The advisor name for recommendation action.
343
+ # @param session_id [String] The recommendation action session identifier.
344
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
345
+ # will be added to the HTTP request.
346
+ #
347
+ # @return [RecommendationActionsResultList] which provide lazy access to pages
348
+ # of the response.
349
+ #
350
+ def list_by_server_as_lazy(resource_group_name, server_name, advisor_name, session_id:nil, custom_headers:nil)
351
+ response = list_by_server_async(resource_group_name, server_name, advisor_name, session_id:session_id, custom_headers:custom_headers).value!
352
+ unless response.nil?
353
+ page = response.body
354
+ page.next_method = Proc.new do |next_page_link|
355
+ list_by_server_next_async(next_page_link, custom_headers:custom_headers)
356
+ end
357
+ page
358
+ end
359
+ end
360
+
361
+ end
362
+ end