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,832 @@
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 PrivateEndpointConnections
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the PrivateEndpointConnections 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 a private endpoint connection.
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 private_endpoint_connection_name [String] The name of the private
34
+ # endpoint connection.
35
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
36
+ # will be added to the HTTP request.
37
+ #
38
+ # @return [PrivateEndpointConnection] operation results.
39
+ #
40
+ def get(resource_group_name, server_name, private_endpoint_connection_name, custom_headers:nil)
41
+ response = get_async(resource_group_name, server_name, private_endpoint_connection_name, custom_headers:custom_headers).value!
42
+ response.body unless response.nil?
43
+ end
44
+
45
+ #
46
+ # Gets a private endpoint connection.
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 private_endpoint_connection_name [String] The name of the private
52
+ # endpoint connection.
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, private_endpoint_connection_name, custom_headers:nil)
59
+ get_async(resource_group_name, server_name, private_endpoint_connection_name, custom_headers:custom_headers).value!
60
+ end
61
+
62
+ #
63
+ # Gets a private endpoint connection.
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 private_endpoint_connection_name [String] The name of the private
69
+ # endpoint connection.
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, private_endpoint_connection_name, custom_headers:nil)
76
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
77
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
78
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
79
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
80
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
81
+ fail ArgumentError, 'private_endpoint_connection_name is nil' if private_endpoint_connection_name.nil?
82
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
83
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
84
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
85
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
86
+
87
+
88
+ request_headers = {}
89
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
90
+
91
+ # Set Headers
92
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
93
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
94
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}'
95
+
96
+ request_url = @base_url || @client.base_url
97
+
98
+ options = {
99
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
100
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'privateEndpointConnectionName' => private_endpoint_connection_name,'subscriptionId' => @client.subscription_id},
101
+ query_params: {'api-version' => @client.api_version},
102
+ headers: request_headers.merge(custom_headers || {}),
103
+ base_url: request_url
104
+ }
105
+ promise = @client.make_request_async(:get, path_template, options)
106
+
107
+ promise = promise.then do |result|
108
+ http_response = result.response
109
+ status_code = http_response.status
110
+ response_content = http_response.body
111
+ unless status_code == 200
112
+ error_model = JSON.load(response_content)
113
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
114
+ end
115
+
116
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
117
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
118
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
119
+ # Deserialize Response
120
+ if status_code == 200
121
+ begin
122
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
123
+ result_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::PrivateEndpointConnection.mapper()
124
+ result.body = @client.deserialize(result_mapper, parsed_response)
125
+ rescue Exception => e
126
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
127
+ end
128
+ end
129
+
130
+ result
131
+ end
132
+
133
+ promise.execute
134
+ end
135
+
136
+ #
137
+ # Approve or reject a private endpoint connection with a given name.
138
+ #
139
+ # @param resource_group_name [String] The name of the resource group. The name
140
+ # is case insensitive.
141
+ # @param server_name [String] The name of the server.
142
+ # @param private_endpoint_connection_name [String]
143
+ # @param parameters [PrivateEndpointConnection]
144
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
145
+ # will be added to the HTTP request.
146
+ #
147
+ # @return [PrivateEndpointConnection] operation results.
148
+ #
149
+ def create_or_update(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:nil)
150
+ response = create_or_update_async(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:custom_headers).value!
151
+ response.body unless response.nil?
152
+ end
153
+
154
+ #
155
+ # @param resource_group_name [String] The name of the resource group. The name
156
+ # is case insensitive.
157
+ # @param server_name [String] The name of the server.
158
+ # @param private_endpoint_connection_name [String]
159
+ # @param parameters [PrivateEndpointConnection]
160
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
161
+ # will be added to the HTTP request.
162
+ #
163
+ # @return [Concurrent::Promise] promise which provides async access to http
164
+ # response.
165
+ #
166
+ def create_or_update_async(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:nil)
167
+ # Send request
168
+ promise = begin_create_or_update_async(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:custom_headers)
169
+
170
+ promise = promise.then do |response|
171
+ # Defining deserialization method.
172
+ deserialize_method = lambda do |parsed_response|
173
+ result_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::PrivateEndpointConnection.mapper()
174
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
175
+ end
176
+
177
+ # Waiting for response.
178
+ @client.get_long_running_operation_result(response, deserialize_method)
179
+ end
180
+
181
+ promise
182
+ end
183
+
184
+ #
185
+ # Deletes a private endpoint connection with a given name.
186
+ #
187
+ # @param resource_group_name [String] The name of the resource group. The name
188
+ # is case insensitive.
189
+ # @param server_name [String] The name of the server.
190
+ # @param private_endpoint_connection_name [String]
191
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
192
+ # will be added to the HTTP request.
193
+ #
194
+ def delete(resource_group_name, server_name, private_endpoint_connection_name, custom_headers:nil)
195
+ response = delete_async(resource_group_name, server_name, private_endpoint_connection_name, custom_headers:custom_headers).value!
196
+ nil
197
+ end
198
+
199
+ #
200
+ # @param resource_group_name [String] The name of the resource group. The name
201
+ # is case insensitive.
202
+ # @param server_name [String] The name of the server.
203
+ # @param private_endpoint_connection_name [String]
204
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
205
+ # will be added to the HTTP request.
206
+ #
207
+ # @return [Concurrent::Promise] promise which provides async access to http
208
+ # response.
209
+ #
210
+ def delete_async(resource_group_name, server_name, private_endpoint_connection_name, custom_headers:nil)
211
+ # Send request
212
+ promise = begin_delete_async(resource_group_name, server_name, private_endpoint_connection_name, custom_headers:custom_headers)
213
+
214
+ promise = promise.then do |response|
215
+ # Defining deserialization method.
216
+ deserialize_method = lambda do |parsed_response|
217
+ end
218
+
219
+ # Waiting for response.
220
+ @client.get_long_running_operation_result(response, deserialize_method)
221
+ end
222
+
223
+ promise
224
+ end
225
+
226
+ #
227
+ # Updates tags on private endpoint connection.
228
+ #
229
+ # Updates private endpoint connection with the specified tags.
230
+ #
231
+ # @param resource_group_name [String] The name of the resource group. The name
232
+ # is case insensitive.
233
+ # @param server_name [String] The name of the server.
234
+ # @param private_endpoint_connection_name [String]
235
+ # @param parameters [TagsObject] Parameters supplied to the Update private
236
+ # endpoint connection Tags operation.
237
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
238
+ # will be added to the HTTP request.
239
+ #
240
+ # @return [PrivateEndpointConnection] operation results.
241
+ #
242
+ def update_tags(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:nil)
243
+ response = update_tags_async(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:custom_headers).value!
244
+ response.body unless response.nil?
245
+ end
246
+
247
+ #
248
+ # @param resource_group_name [String] The name of the resource group. The name
249
+ # is case insensitive.
250
+ # @param server_name [String] The name of the server.
251
+ # @param private_endpoint_connection_name [String]
252
+ # @param parameters [TagsObject] Parameters supplied to the Update private
253
+ # endpoint connection Tags operation.
254
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
255
+ # will be added to the HTTP request.
256
+ #
257
+ # @return [Concurrent::Promise] promise which provides async access to http
258
+ # response.
259
+ #
260
+ def update_tags_async(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:nil)
261
+ # Send request
262
+ promise = begin_update_tags_async(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:custom_headers)
263
+
264
+ promise = promise.then do |response|
265
+ # Defining deserialization method.
266
+ deserialize_method = lambda do |parsed_response|
267
+ result_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::PrivateEndpointConnection.mapper()
268
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
269
+ end
270
+
271
+ # Waiting for response.
272
+ @client.get_long_running_operation_result(response, deserialize_method)
273
+ end
274
+
275
+ promise
276
+ end
277
+
278
+ #
279
+ # Gets all private endpoint connections on a server.
280
+ #
281
+ # @param resource_group_name [String] The name of the resource group. The name
282
+ # is case insensitive.
283
+ # @param server_name [String] The name of the server.
284
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
285
+ # will be added to the HTTP request.
286
+ #
287
+ # @return [Array<PrivateEndpointConnection>] operation results.
288
+ #
289
+ def list_by_server(resource_group_name, server_name, custom_headers:nil)
290
+ first_page = list_by_server_as_lazy(resource_group_name, server_name, custom_headers:custom_headers)
291
+ first_page.get_all_items
292
+ end
293
+
294
+ #
295
+ # Gets all private endpoint connections on a server.
296
+ #
297
+ # @param resource_group_name [String] The name of the resource group. The name
298
+ # is case insensitive.
299
+ # @param server_name [String] The name of the server.
300
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
301
+ # will be added to the HTTP request.
302
+ #
303
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
304
+ #
305
+ def list_by_server_with_http_info(resource_group_name, server_name, custom_headers:nil)
306
+ list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
307
+ end
308
+
309
+ #
310
+ # Gets all private endpoint connections on a server.
311
+ #
312
+ # @param resource_group_name [String] The name of the resource group. The name
313
+ # is case insensitive.
314
+ # @param server_name [String] The name of the server.
315
+ # @param [Hash{String => String}] A hash of custom headers that will be added
316
+ # to the HTTP request.
317
+ #
318
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
319
+ #
320
+ def list_by_server_async(resource_group_name, server_name, custom_headers:nil)
321
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
322
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
323
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
324
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
325
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
326
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
327
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
328
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
329
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
330
+
331
+
332
+ request_headers = {}
333
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
334
+
335
+ # Set Headers
336
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
337
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
338
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateEndpointConnections'
339
+
340
+ request_url = @base_url || @client.base_url
341
+
342
+ options = {
343
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
344
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id},
345
+ query_params: {'api-version' => @client.api_version},
346
+ headers: request_headers.merge(custom_headers || {}),
347
+ base_url: request_url
348
+ }
349
+ promise = @client.make_request_async(:get, path_template, options)
350
+
351
+ promise = promise.then do |result|
352
+ http_response = result.response
353
+ status_code = http_response.status
354
+ response_content = http_response.body
355
+ unless status_code == 200
356
+ error_model = JSON.load(response_content)
357
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
358
+ end
359
+
360
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
361
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
362
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
363
+ # Deserialize Response
364
+ if status_code == 200
365
+ begin
366
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
367
+ result_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::PrivateEndpointConnectionListResult.mapper()
368
+ result.body = @client.deserialize(result_mapper, parsed_response)
369
+ rescue Exception => e
370
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
371
+ end
372
+ end
373
+
374
+ result
375
+ end
376
+
377
+ promise.execute
378
+ end
379
+
380
+ #
381
+ # Approve or reject a private endpoint connection with a given name.
382
+ #
383
+ # @param resource_group_name [String] The name of the resource group. The name
384
+ # is case insensitive.
385
+ # @param server_name [String] The name of the server.
386
+ # @param private_endpoint_connection_name [String]
387
+ # @param parameters [PrivateEndpointConnection]
388
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
389
+ # will be added to the HTTP request.
390
+ #
391
+ # @return [PrivateEndpointConnection] operation results.
392
+ #
393
+ def begin_create_or_update(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:nil)
394
+ response = begin_create_or_update_async(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:custom_headers).value!
395
+ response.body unless response.nil?
396
+ end
397
+
398
+ #
399
+ # Approve or reject a private endpoint connection with a given name.
400
+ #
401
+ # @param resource_group_name [String] The name of the resource group. The name
402
+ # is case insensitive.
403
+ # @param server_name [String] The name of the server.
404
+ # @param private_endpoint_connection_name [String]
405
+ # @param parameters [PrivateEndpointConnection]
406
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
407
+ # will be added to the HTTP request.
408
+ #
409
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
410
+ #
411
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:nil)
412
+ begin_create_or_update_async(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:custom_headers).value!
413
+ end
414
+
415
+ #
416
+ # Approve or reject a private endpoint connection with a given name.
417
+ #
418
+ # @param resource_group_name [String] The name of the resource group. The name
419
+ # is case insensitive.
420
+ # @param server_name [String] The name of the server.
421
+ # @param private_endpoint_connection_name [String]
422
+ # @param parameters [PrivateEndpointConnection]
423
+ # @param [Hash{String => String}] A hash of custom headers that will be added
424
+ # to the HTTP request.
425
+ #
426
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
427
+ #
428
+ def begin_create_or_update_async(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:nil)
429
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
430
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
431
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
432
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
433
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
434
+ fail ArgumentError, 'private_endpoint_connection_name is nil' if private_endpoint_connection_name.nil?
435
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
436
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
437
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
438
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
439
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
440
+
441
+
442
+ request_headers = {}
443
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
444
+
445
+ # Set Headers
446
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
447
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
448
+
449
+ # Serialize Request
450
+ request_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::PrivateEndpointConnection.mapper()
451
+ request_content = @client.serialize(request_mapper, parameters)
452
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
453
+
454
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}'
455
+
456
+ request_url = @base_url || @client.base_url
457
+
458
+ options = {
459
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
460
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'privateEndpointConnectionName' => private_endpoint_connection_name,'subscriptionId' => @client.subscription_id},
461
+ query_params: {'api-version' => @client.api_version},
462
+ body: request_content,
463
+ headers: request_headers.merge(custom_headers || {}),
464
+ base_url: request_url
465
+ }
466
+ promise = @client.make_request_async(:put, path_template, options)
467
+
468
+ promise = promise.then do |result|
469
+ http_response = result.response
470
+ status_code = http_response.status
471
+ response_content = http_response.body
472
+ unless status_code == 200 || status_code == 202
473
+ error_model = JSON.load(response_content)
474
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
475
+ end
476
+
477
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
478
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
479
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
480
+ # Deserialize Response
481
+ if status_code == 200
482
+ begin
483
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
484
+ result_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::PrivateEndpointConnection.mapper()
485
+ result.body = @client.deserialize(result_mapper, parsed_response)
486
+ rescue Exception => e
487
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
488
+ end
489
+ end
490
+
491
+ result
492
+ end
493
+
494
+ promise.execute
495
+ end
496
+
497
+ #
498
+ # Deletes a private endpoint connection with a given name.
499
+ #
500
+ # @param resource_group_name [String] The name of the resource group. The name
501
+ # is case insensitive.
502
+ # @param server_name [String] The name of the server.
503
+ # @param private_endpoint_connection_name [String]
504
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
505
+ # will be added to the HTTP request.
506
+ #
507
+ #
508
+ def begin_delete(resource_group_name, server_name, private_endpoint_connection_name, custom_headers:nil)
509
+ response = begin_delete_async(resource_group_name, server_name, private_endpoint_connection_name, custom_headers:custom_headers).value!
510
+ nil
511
+ end
512
+
513
+ #
514
+ # Deletes a private endpoint connection with a given name.
515
+ #
516
+ # @param resource_group_name [String] The name of the resource group. The name
517
+ # is case insensitive.
518
+ # @param server_name [String] The name of the server.
519
+ # @param private_endpoint_connection_name [String]
520
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
521
+ # will be added to the HTTP request.
522
+ #
523
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
524
+ #
525
+ def begin_delete_with_http_info(resource_group_name, server_name, private_endpoint_connection_name, custom_headers:nil)
526
+ begin_delete_async(resource_group_name, server_name, private_endpoint_connection_name, custom_headers:custom_headers).value!
527
+ end
528
+
529
+ #
530
+ # Deletes a private endpoint connection with a given name.
531
+ #
532
+ # @param resource_group_name [String] The name of the resource group. The name
533
+ # is case insensitive.
534
+ # @param server_name [String] The name of the server.
535
+ # @param private_endpoint_connection_name [String]
536
+ # @param [Hash{String => String}] A hash of custom headers that will be added
537
+ # to the HTTP request.
538
+ #
539
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
540
+ #
541
+ def begin_delete_async(resource_group_name, server_name, private_endpoint_connection_name, custom_headers:nil)
542
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
543
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
544
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
545
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
546
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
547
+ fail ArgumentError, 'private_endpoint_connection_name is nil' if private_endpoint_connection_name.nil?
548
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
549
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
550
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
551
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
552
+
553
+
554
+ request_headers = {}
555
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
556
+
557
+ # Set Headers
558
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
559
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
560
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}'
561
+
562
+ request_url = @base_url || @client.base_url
563
+
564
+ options = {
565
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
566
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'privateEndpointConnectionName' => private_endpoint_connection_name,'subscriptionId' => @client.subscription_id},
567
+ query_params: {'api-version' => @client.api_version},
568
+ headers: request_headers.merge(custom_headers || {}),
569
+ base_url: request_url
570
+ }
571
+ promise = @client.make_request_async(:delete, path_template, options)
572
+
573
+ promise = promise.then do |result|
574
+ http_response = result.response
575
+ status_code = http_response.status
576
+ response_content = http_response.body
577
+ unless status_code == 200 || status_code == 202 || status_code == 204
578
+ error_model = JSON.load(response_content)
579
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
580
+ end
581
+
582
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
583
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
584
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
585
+
586
+ result
587
+ end
588
+
589
+ promise.execute
590
+ end
591
+
592
+ #
593
+ # Updates tags on private endpoint connection.
594
+ #
595
+ # Updates private endpoint connection with the specified tags.
596
+ #
597
+ # @param resource_group_name [String] The name of the resource group. The name
598
+ # is case insensitive.
599
+ # @param server_name [String] The name of the server.
600
+ # @param private_endpoint_connection_name [String]
601
+ # @param parameters [TagsObject] Parameters supplied to the Update private
602
+ # endpoint connection Tags operation.
603
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
604
+ # will be added to the HTTP request.
605
+ #
606
+ # @return [PrivateEndpointConnection] operation results.
607
+ #
608
+ def begin_update_tags(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:nil)
609
+ response = begin_update_tags_async(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:custom_headers).value!
610
+ response.body unless response.nil?
611
+ end
612
+
613
+ #
614
+ # Updates tags on private endpoint connection.
615
+ #
616
+ # Updates private endpoint connection with the specified tags.
617
+ #
618
+ # @param resource_group_name [String] The name of the resource group. The name
619
+ # is case insensitive.
620
+ # @param server_name [String] The name of the server.
621
+ # @param private_endpoint_connection_name [String]
622
+ # @param parameters [TagsObject] Parameters supplied to the Update private
623
+ # endpoint connection Tags operation.
624
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
625
+ # will be added to the HTTP request.
626
+ #
627
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
628
+ #
629
+ def begin_update_tags_with_http_info(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:nil)
630
+ begin_update_tags_async(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:custom_headers).value!
631
+ end
632
+
633
+ #
634
+ # Updates tags on private endpoint connection.
635
+ #
636
+ # Updates private endpoint connection with the specified tags.
637
+ #
638
+ # @param resource_group_name [String] The name of the resource group. The name
639
+ # is case insensitive.
640
+ # @param server_name [String] The name of the server.
641
+ # @param private_endpoint_connection_name [String]
642
+ # @param parameters [TagsObject] Parameters supplied to the Update private
643
+ # endpoint connection Tags operation.
644
+ # @param [Hash{String => String}] A hash of custom headers that will be added
645
+ # to the HTTP request.
646
+ #
647
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
648
+ #
649
+ def begin_update_tags_async(resource_group_name, server_name, private_endpoint_connection_name, parameters, custom_headers:nil)
650
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
651
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
652
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
653
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
654
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
655
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
656
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
657
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
658
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
659
+ fail ArgumentError, 'private_endpoint_connection_name is nil' if private_endpoint_connection_name.nil?
660
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
661
+
662
+
663
+ request_headers = {}
664
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
665
+
666
+ # Set Headers
667
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
668
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
669
+
670
+ # Serialize Request
671
+ request_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::TagsObject.mapper()
672
+ request_content = @client.serialize(request_mapper, parameters)
673
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
674
+
675
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}'
676
+
677
+ request_url = @base_url || @client.base_url
678
+
679
+ options = {
680
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
681
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'privateEndpointConnectionName' => private_endpoint_connection_name},
682
+ query_params: {'api-version' => @client.api_version},
683
+ body: request_content,
684
+ headers: request_headers.merge(custom_headers || {}),
685
+ base_url: request_url
686
+ }
687
+ promise = @client.make_request_async(:patch, path_template, options)
688
+
689
+ promise = promise.then do |result|
690
+ http_response = result.response
691
+ status_code = http_response.status
692
+ response_content = http_response.body
693
+ unless status_code == 200
694
+ error_model = JSON.load(response_content)
695
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
696
+ end
697
+
698
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
699
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
700
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
701
+ # Deserialize Response
702
+ if status_code == 200
703
+ begin
704
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
705
+ result_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::PrivateEndpointConnection.mapper()
706
+ result.body = @client.deserialize(result_mapper, parsed_response)
707
+ rescue Exception => e
708
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
709
+ end
710
+ end
711
+
712
+ result
713
+ end
714
+
715
+ promise.execute
716
+ end
717
+
718
+ #
719
+ # Gets all private endpoint connections on a server.
720
+ #
721
+ # @param next_page_link [String] The NextLink from the previous successful call
722
+ # to List operation.
723
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
724
+ # will be added to the HTTP request.
725
+ #
726
+ # @return [PrivateEndpointConnectionListResult] operation results.
727
+ #
728
+ def list_by_server_next(next_page_link, custom_headers:nil)
729
+ response = list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
730
+ response.body unless response.nil?
731
+ end
732
+
733
+ #
734
+ # Gets all private endpoint connections on a server.
735
+ #
736
+ # @param next_page_link [String] The NextLink from the previous successful call
737
+ # to List operation.
738
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
739
+ # will be added to the HTTP request.
740
+ #
741
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
742
+ #
743
+ def list_by_server_next_with_http_info(next_page_link, custom_headers:nil)
744
+ list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
745
+ end
746
+
747
+ #
748
+ # Gets all private endpoint connections on a server.
749
+ #
750
+ # @param next_page_link [String] The NextLink from the previous successful call
751
+ # to List operation.
752
+ # @param [Hash{String => String}] A hash of custom headers that will be added
753
+ # to the HTTP request.
754
+ #
755
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
756
+ #
757
+ def list_by_server_next_async(next_page_link, custom_headers:nil)
758
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
759
+
760
+
761
+ request_headers = {}
762
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
763
+
764
+ # Set Headers
765
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
766
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
767
+ path_template = '{nextLink}'
768
+
769
+ request_url = @base_url || @client.base_url
770
+
771
+ options = {
772
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
773
+ skip_encoding_path_params: {'nextLink' => next_page_link},
774
+ headers: request_headers.merge(custom_headers || {}),
775
+ base_url: request_url
776
+ }
777
+ promise = @client.make_request_async(:get, path_template, options)
778
+
779
+ promise = promise.then do |result|
780
+ http_response = result.response
781
+ status_code = http_response.status
782
+ response_content = http_response.body
783
+ unless status_code == 200
784
+ error_model = JSON.load(response_content)
785
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
786
+ end
787
+
788
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
789
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
790
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
791
+ # Deserialize Response
792
+ if status_code == 200
793
+ begin
794
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
795
+ result_mapper = Azure::Mysql::Mgmt::V2018_06_01::Models::PrivateEndpointConnectionListResult.mapper()
796
+ result.body = @client.deserialize(result_mapper, parsed_response)
797
+ rescue Exception => e
798
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
799
+ end
800
+ end
801
+
802
+ result
803
+ end
804
+
805
+ promise.execute
806
+ end
807
+
808
+ #
809
+ # Gets all private endpoint connections on a server.
810
+ #
811
+ # @param resource_group_name [String] The name of the resource group. The name
812
+ # is case insensitive.
813
+ # @param server_name [String] The name of the server.
814
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
815
+ # will be added to the HTTP request.
816
+ #
817
+ # @return [PrivateEndpointConnectionListResult] which provide lazy access to
818
+ # pages of the response.
819
+ #
820
+ def list_by_server_as_lazy(resource_group_name, server_name, custom_headers:nil)
821
+ response = list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
822
+ unless response.nil?
823
+ page = response.body
824
+ page.next_method = Proc.new do |next_page_link|
825
+ list_by_server_next_async(next_page_link, custom_headers:custom_headers)
826
+ end
827
+ page
828
+ end
829
+ end
830
+
831
+ end
832
+ end