azure_mgmt_mysql 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql.rb +79 -0
  4. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/check_name_availability.rb +128 -0
  5. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/configurations.rb +402 -0
  6. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/databases.rb +549 -0
  7. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/firewall_rules.rb +549 -0
  8. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/location_based_performance_tier.rb +118 -0
  9. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/log_files.rb +128 -0
  10. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/configuration.rb +132 -0
  11. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/configuration_list_result.rb +55 -0
  12. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/database.rb +84 -0
  13. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/database_list_result.rb +55 -0
  14. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/firewall_rule.rb +92 -0
  15. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/firewall_rule_list_result.rb +55 -0
  16. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/geo_redundant_backup.rb +16 -0
  17. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/log_file.rb +119 -0
  18. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/log_file_list_result.rb +55 -0
  19. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/name_availability.rb +68 -0
  20. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/name_availability_request.rb +57 -0
  21. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/operation.rb +95 -0
  22. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/operation_display.rb +83 -0
  23. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/operation_list_result.rb +55 -0
  24. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/operation_origin.rb +17 -0
  25. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/performance_tier_list_result.rb +56 -0
  26. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/performance_tier_properties.rb +67 -0
  27. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/performance_tier_service_level_objectives.rb +126 -0
  28. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/proxy_resource.rb +71 -0
  29. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server.rb +220 -0
  30. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_for_create.rb +92 -0
  31. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_list_result.rb +55 -0
  32. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_properties_for_create.rb +86 -0
  33. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_properties_for_default_create.rb +100 -0
  34. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_properties_for_geo_restore.rb +88 -0
  35. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_properties_for_replica.rb +87 -0
  36. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_properties_for_restore.rb +99 -0
  37. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_security_alert_policy.rb +166 -0
  38. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_security_alert_policy_state.rb +16 -0
  39. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_state.rb +17 -0
  40. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_update_parameters.rb +126 -0
  41. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_version.rb +16 -0
  42. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/sku.rb +97 -0
  43. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/sku_tier.rb +17 -0
  44. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/ssl_enforcement_enum.rb +16 -0
  45. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/storage_autogrow.rb +16 -0
  46. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/storage_profile.rb +81 -0
  47. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/tracked_resource.rb +93 -0
  48. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/virtual_network_rule.rb +99 -0
  49. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/virtual_network_rule_list_result.rb +100 -0
  50. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/virtual_network_rule_state.rb +19 -0
  51. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/module_definition.rb +9 -0
  52. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/my_sqlmanagement_client.rb +172 -0
  53. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/operations.rb +112 -0
  54. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/replicas.rb +128 -0
  55. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/server_security_alert_policies.rb +294 -0
  56. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/servers.rb +918 -0
  57. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/virtual_network_rules.rb +676 -0
  58. data/lib/2017-12-01/generated/azure_mgmt_mysql.rb +79 -0
  59. data/lib/2017-12-01/generated/azure_mgmt_mysql/check_name_availability.rb +128 -0
  60. data/lib/2017-12-01/generated/azure_mgmt_mysql/configurations.rb +402 -0
  61. data/lib/2017-12-01/generated/azure_mgmt_mysql/databases.rb +549 -0
  62. data/lib/2017-12-01/generated/azure_mgmt_mysql/firewall_rules.rb +549 -0
  63. data/lib/2017-12-01/generated/azure_mgmt_mysql/location_based_performance_tier.rb +118 -0
  64. data/lib/2017-12-01/generated/azure_mgmt_mysql/log_files.rb +128 -0
  65. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/configuration.rb +132 -0
  66. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/configuration_list_result.rb +55 -0
  67. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/database.rb +84 -0
  68. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/database_list_result.rb +55 -0
  69. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/firewall_rule.rb +92 -0
  70. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/firewall_rule_list_result.rb +55 -0
  71. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/geo_redundant_backup.rb +16 -0
  72. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/log_file.rb +119 -0
  73. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/log_file_list_result.rb +55 -0
  74. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/name_availability.rb +68 -0
  75. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/name_availability_request.rb +57 -0
  76. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/operation.rb +95 -0
  77. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/operation_display.rb +83 -0
  78. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/operation_list_result.rb +55 -0
  79. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/operation_origin.rb +17 -0
  80. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/performance_tier_list_result.rb +56 -0
  81. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/performance_tier_properties.rb +67 -0
  82. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/performance_tier_service_level_objectives.rb +126 -0
  83. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/proxy_resource.rb +71 -0
  84. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server.rb +220 -0
  85. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_for_create.rb +92 -0
  86. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_list_result.rb +55 -0
  87. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_properties_for_create.rb +86 -0
  88. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_properties_for_default_create.rb +100 -0
  89. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_properties_for_geo_restore.rb +88 -0
  90. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_properties_for_replica.rb +87 -0
  91. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_properties_for_restore.rb +99 -0
  92. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_security_alert_policy.rb +166 -0
  93. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_security_alert_policy_state.rb +16 -0
  94. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_state.rb +17 -0
  95. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_update_parameters.rb +126 -0
  96. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_version.rb +16 -0
  97. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/sku.rb +97 -0
  98. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/sku_tier.rb +17 -0
  99. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/ssl_enforcement_enum.rb +16 -0
  100. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/storage_autogrow.rb +16 -0
  101. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/storage_profile.rb +81 -0
  102. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/tracked_resource.rb +93 -0
  103. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/virtual_network_rule.rb +99 -0
  104. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/virtual_network_rule_list_result.rb +100 -0
  105. data/lib/2017-12-01/generated/azure_mgmt_mysql/models/virtual_network_rule_state.rb +19 -0
  106. data/lib/2017-12-01/generated/azure_mgmt_mysql/module_definition.rb +9 -0
  107. data/lib/2017-12-01/generated/azure_mgmt_mysql/my_sqlmanagement_client.rb +172 -0
  108. data/lib/2017-12-01/generated/azure_mgmt_mysql/operations.rb +112 -0
  109. data/lib/2017-12-01/generated/azure_mgmt_mysql/replicas.rb +128 -0
  110. data/lib/2017-12-01/generated/azure_mgmt_mysql/server_security_alert_policies.rb +294 -0
  111. data/lib/2017-12-01/generated/azure_mgmt_mysql/servers.rb +918 -0
  112. data/lib/2017-12-01/generated/azure_mgmt_mysql/virtual_network_rules.rb +676 -0
  113. data/lib/azure_mgmt_mysql.rb +7 -0
  114. data/lib/module_definition.rb +7 -0
  115. data/lib/profiles/latest/modules/mysql_profile_module.rb +245 -0
  116. data/lib/profiles/latest/mysql_latest_profile_client.rb +40 -0
  117. data/lib/profiles/latest/mysql_module_definition.rb +8 -0
  118. data/lib/version.rb +7 -0
  119. metadata +234 -0
@@ -0,0 +1,676 @@
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::V2017_12_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, log files and configurations with
11
+ # new business model.
12
+ #
13
+ class VirtualNetworkRules
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the VirtualNetworkRules 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 virtual network rule.
29
+ #
30
+ # @param resource_group_name [String] The name of the resource group that
31
+ # contains the resource. You can obtain this value from the Azure Resource
32
+ # Manager API or the portal.
33
+ # @param server_name [String] The name of the server.
34
+ # @param virtual_network_rule_name [String] The name of the virtual network
35
+ # rule.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [VirtualNetworkRule] operation results.
40
+ #
41
+ def get(resource_group_name, server_name, virtual_network_rule_name, custom_headers:nil)
42
+ response = get_async(resource_group_name, server_name, virtual_network_rule_name, custom_headers:custom_headers).value!
43
+ response.body unless response.nil?
44
+ end
45
+
46
+ #
47
+ # Gets a virtual network rule.
48
+ #
49
+ # @param resource_group_name [String] The name of the resource group that
50
+ # contains the resource. You can obtain this value from the Azure Resource
51
+ # Manager API or the portal.
52
+ # @param server_name [String] The name of the server.
53
+ # @param virtual_network_rule_name [String] The name of the virtual network
54
+ # rule.
55
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
56
+ # will be added to the HTTP request.
57
+ #
58
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
59
+ #
60
+ def get_with_http_info(resource_group_name, server_name, virtual_network_rule_name, custom_headers:nil)
61
+ get_async(resource_group_name, server_name, virtual_network_rule_name, custom_headers:custom_headers).value!
62
+ end
63
+
64
+ #
65
+ # Gets a virtual network rule.
66
+ #
67
+ # @param resource_group_name [String] The name of the resource group that
68
+ # contains the resource. You can obtain this value from the Azure Resource
69
+ # Manager API or the portal.
70
+ # @param server_name [String] The name of the server.
71
+ # @param virtual_network_rule_name [String] The name of the virtual network
72
+ # rule.
73
+ # @param [Hash{String => String}] A hash of custom headers that will be added
74
+ # to the HTTP request.
75
+ #
76
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
77
+ #
78
+ def get_async(resource_group_name, server_name, virtual_network_rule_name, custom_headers:nil)
79
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
80
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
81
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
82
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
83
+ fail ArgumentError, 'virtual_network_rule_name is nil' if virtual_network_rule_name.nil?
84
+
85
+
86
+ request_headers = {}
87
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
88
+
89
+ # Set Headers
90
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
91
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
92
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}'
93
+
94
+ request_url = @base_url || @client.base_url
95
+
96
+ options = {
97
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
98
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id,'virtualNetworkRuleName' => virtual_network_rule_name},
99
+ query_params: {'api-version' => @client.api_version},
100
+ headers: request_headers.merge(custom_headers || {}),
101
+ base_url: request_url
102
+ }
103
+ promise = @client.make_request_async(:get, path_template, options)
104
+
105
+ promise = promise.then do |result|
106
+ http_response = result.response
107
+ status_code = http_response.status
108
+ response_content = http_response.body
109
+ unless status_code == 200
110
+ error_model = JSON.load(response_content)
111
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
112
+ end
113
+
114
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
115
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
116
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
117
+ # Deserialize Response
118
+ if status_code == 200
119
+ begin
120
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
121
+ result_mapper = Azure::Mysql::Mgmt::V2017_12_01::Models::VirtualNetworkRule.mapper()
122
+ result.body = @client.deserialize(result_mapper, parsed_response)
123
+ rescue Exception => e
124
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
125
+ end
126
+ end
127
+
128
+ result
129
+ end
130
+
131
+ promise.execute
132
+ end
133
+
134
+ #
135
+ # Creates or updates an existing virtual network rule.
136
+ #
137
+ # @param resource_group_name [String] The name of the resource group that
138
+ # contains the resource. You can obtain this value from the Azure Resource
139
+ # Manager API or the portal.
140
+ # @param server_name [String] The name of the server.
141
+ # @param virtual_network_rule_name [String] The name of the virtual network
142
+ # rule.
143
+ # @param parameters [VirtualNetworkRule] The requested virtual Network Rule
144
+ # Resource state.
145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
+ # will be added to the HTTP request.
147
+ #
148
+ # @return [VirtualNetworkRule] operation results.
149
+ #
150
+ def create_or_update(resource_group_name, server_name, virtual_network_rule_name, parameters, custom_headers:nil)
151
+ response = create_or_update_async(resource_group_name, server_name, virtual_network_rule_name, parameters, custom_headers:custom_headers).value!
152
+ response.body unless response.nil?
153
+ end
154
+
155
+ #
156
+ # @param resource_group_name [String] The name of the resource group that
157
+ # contains the resource. You can obtain this value from the Azure Resource
158
+ # Manager API or the portal.
159
+ # @param server_name [String] The name of the server.
160
+ # @param virtual_network_rule_name [String] The name of the virtual network
161
+ # rule.
162
+ # @param parameters [VirtualNetworkRule] The requested virtual Network Rule
163
+ # Resource state.
164
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
165
+ # will be added to the HTTP request.
166
+ #
167
+ # @return [Concurrent::Promise] promise which provides async access to http
168
+ # response.
169
+ #
170
+ def create_or_update_async(resource_group_name, server_name, virtual_network_rule_name, parameters, custom_headers:nil)
171
+ # Send request
172
+ promise = begin_create_or_update_async(resource_group_name, server_name, virtual_network_rule_name, parameters, custom_headers:custom_headers)
173
+
174
+ promise = promise.then do |response|
175
+ # Defining deserialization method.
176
+ deserialize_method = lambda do |parsed_response|
177
+ result_mapper = Azure::Mysql::Mgmt::V2017_12_01::Models::VirtualNetworkRule.mapper()
178
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
179
+ end
180
+
181
+ # Waiting for response.
182
+ @client.get_long_running_operation_result(response, deserialize_method)
183
+ end
184
+
185
+ promise
186
+ end
187
+
188
+ #
189
+ # Deletes the virtual network rule with the given name.
190
+ #
191
+ # @param resource_group_name [String] The name of the resource group that
192
+ # contains the resource. You can obtain this value from the Azure Resource
193
+ # Manager API or the portal.
194
+ # @param server_name [String] The name of the server.
195
+ # @param virtual_network_rule_name [String] The name of the virtual network
196
+ # rule.
197
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
198
+ # will be added to the HTTP request.
199
+ #
200
+ def delete(resource_group_name, server_name, virtual_network_rule_name, custom_headers:nil)
201
+ response = delete_async(resource_group_name, server_name, virtual_network_rule_name, custom_headers:custom_headers).value!
202
+ nil
203
+ end
204
+
205
+ #
206
+ # @param resource_group_name [String] The name of the resource group that
207
+ # contains the resource. You can obtain this value from the Azure Resource
208
+ # Manager API or the portal.
209
+ # @param server_name [String] The name of the server.
210
+ # @param virtual_network_rule_name [String] The name of the virtual network
211
+ # rule.
212
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
213
+ # will be added to the HTTP request.
214
+ #
215
+ # @return [Concurrent::Promise] promise which provides async access to http
216
+ # response.
217
+ #
218
+ def delete_async(resource_group_name, server_name, virtual_network_rule_name, custom_headers:nil)
219
+ # Send request
220
+ promise = begin_delete_async(resource_group_name, server_name, virtual_network_rule_name, custom_headers:custom_headers)
221
+
222
+ promise = promise.then do |response|
223
+ # Defining deserialization method.
224
+ deserialize_method = lambda do |parsed_response|
225
+ end
226
+
227
+ # Waiting for response.
228
+ @client.get_long_running_operation_result(response, deserialize_method)
229
+ end
230
+
231
+ promise
232
+ end
233
+
234
+ #
235
+ # Gets a list of virtual network rules in a server.
236
+ #
237
+ # @param resource_group_name [String] The name of the resource group that
238
+ # contains the resource. You can obtain this value from the Azure Resource
239
+ # Manager API or the portal.
240
+ # @param server_name [String] The name of the server.
241
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
242
+ # will be added to the HTTP request.
243
+ #
244
+ # @return [Array<VirtualNetworkRule>] operation results.
245
+ #
246
+ def list_by_server(resource_group_name, server_name, custom_headers:nil)
247
+ first_page = list_by_server_as_lazy(resource_group_name, server_name, custom_headers:custom_headers)
248
+ first_page.get_all_items
249
+ end
250
+
251
+ #
252
+ # Gets a list of virtual network rules in a server.
253
+ #
254
+ # @param resource_group_name [String] The name of the resource group that
255
+ # contains the resource. You can obtain this value from the Azure Resource
256
+ # Manager API or the portal.
257
+ # @param server_name [String] The name of the server.
258
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
259
+ # will be added to the HTTP request.
260
+ #
261
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
262
+ #
263
+ def list_by_server_with_http_info(resource_group_name, server_name, custom_headers:nil)
264
+ list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
265
+ end
266
+
267
+ #
268
+ # Gets a list of virtual network rules in a server.
269
+ #
270
+ # @param resource_group_name [String] The name of the resource group that
271
+ # contains the resource. You can obtain this value from the Azure Resource
272
+ # Manager API or the portal.
273
+ # @param server_name [String] The name of the server.
274
+ # @param [Hash{String => String}] A hash of custom headers that will be added
275
+ # to the HTTP request.
276
+ #
277
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
278
+ #
279
+ def list_by_server_async(resource_group_name, server_name, custom_headers:nil)
280
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
281
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
282
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
283
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
284
+
285
+
286
+ request_headers = {}
287
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
288
+
289
+ # Set Headers
290
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
291
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
292
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules'
293
+
294
+ request_url = @base_url || @client.base_url
295
+
296
+ options = {
297
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
298
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id},
299
+ query_params: {'api-version' => @client.api_version},
300
+ headers: request_headers.merge(custom_headers || {}),
301
+ base_url: request_url
302
+ }
303
+ promise = @client.make_request_async(:get, path_template, options)
304
+
305
+ promise = promise.then do |result|
306
+ http_response = result.response
307
+ status_code = http_response.status
308
+ response_content = http_response.body
309
+ unless status_code == 200
310
+ error_model = JSON.load(response_content)
311
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
312
+ end
313
+
314
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
315
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
316
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
317
+ # Deserialize Response
318
+ if status_code == 200
319
+ begin
320
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
321
+ result_mapper = Azure::Mysql::Mgmt::V2017_12_01::Models::VirtualNetworkRuleListResult.mapper()
322
+ result.body = @client.deserialize(result_mapper, parsed_response)
323
+ rescue Exception => e
324
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
325
+ end
326
+ end
327
+
328
+ result
329
+ end
330
+
331
+ promise.execute
332
+ end
333
+
334
+ #
335
+ # Creates or updates an existing virtual network rule.
336
+ #
337
+ # @param resource_group_name [String] The name of the resource group that
338
+ # contains the resource. You can obtain this value from the Azure Resource
339
+ # Manager API or the portal.
340
+ # @param server_name [String] The name of the server.
341
+ # @param virtual_network_rule_name [String] The name of the virtual network
342
+ # rule.
343
+ # @param parameters [VirtualNetworkRule] The requested virtual Network Rule
344
+ # Resource state.
345
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
346
+ # will be added to the HTTP request.
347
+ #
348
+ # @return [VirtualNetworkRule] operation results.
349
+ #
350
+ def begin_create_or_update(resource_group_name, server_name, virtual_network_rule_name, parameters, custom_headers:nil)
351
+ response = begin_create_or_update_async(resource_group_name, server_name, virtual_network_rule_name, parameters, custom_headers:custom_headers).value!
352
+ response.body unless response.nil?
353
+ end
354
+
355
+ #
356
+ # Creates or updates an existing virtual network rule.
357
+ #
358
+ # @param resource_group_name [String] The name of the resource group that
359
+ # contains the resource. You can obtain this value from the Azure Resource
360
+ # Manager API or the portal.
361
+ # @param server_name [String] The name of the server.
362
+ # @param virtual_network_rule_name [String] The name of the virtual network
363
+ # rule.
364
+ # @param parameters [VirtualNetworkRule] The requested virtual Network Rule
365
+ # Resource state.
366
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
367
+ # will be added to the HTTP request.
368
+ #
369
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
370
+ #
371
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, virtual_network_rule_name, parameters, custom_headers:nil)
372
+ begin_create_or_update_async(resource_group_name, server_name, virtual_network_rule_name, parameters, custom_headers:custom_headers).value!
373
+ end
374
+
375
+ #
376
+ # Creates or updates an existing virtual network rule.
377
+ #
378
+ # @param resource_group_name [String] The name of the resource group that
379
+ # contains the resource. You can obtain this value from the Azure Resource
380
+ # Manager API or the portal.
381
+ # @param server_name [String] The name of the server.
382
+ # @param virtual_network_rule_name [String] The name of the virtual network
383
+ # rule.
384
+ # @param parameters [VirtualNetworkRule] The requested virtual Network Rule
385
+ # Resource state.
386
+ # @param [Hash{String => String}] A hash of custom headers that will be added
387
+ # to the HTTP request.
388
+ #
389
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
390
+ #
391
+ def begin_create_or_update_async(resource_group_name, server_name, virtual_network_rule_name, parameters, custom_headers:nil)
392
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
393
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
394
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
395
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
396
+ fail ArgumentError, 'virtual_network_rule_name is nil' if virtual_network_rule_name.nil?
397
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
398
+
399
+
400
+ request_headers = {}
401
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
402
+
403
+ # Set Headers
404
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
405
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
406
+
407
+ # Serialize Request
408
+ request_mapper = Azure::Mysql::Mgmt::V2017_12_01::Models::VirtualNetworkRule.mapper()
409
+ request_content = @client.serialize(request_mapper, parameters)
410
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
411
+
412
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}'
413
+
414
+ request_url = @base_url || @client.base_url
415
+
416
+ options = {
417
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
418
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id,'virtualNetworkRuleName' => virtual_network_rule_name},
419
+ query_params: {'api-version' => @client.api_version},
420
+ body: request_content,
421
+ headers: request_headers.merge(custom_headers || {}),
422
+ base_url: request_url
423
+ }
424
+ promise = @client.make_request_async(:put, path_template, options)
425
+
426
+ promise = promise.then do |result|
427
+ http_response = result.response
428
+ status_code = http_response.status
429
+ response_content = http_response.body
430
+ unless status_code == 200 || status_code == 202 || status_code == 201
431
+ error_model = JSON.load(response_content)
432
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
433
+ end
434
+
435
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
436
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
437
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
438
+ # Deserialize Response
439
+ if status_code == 200
440
+ begin
441
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
442
+ result_mapper = Azure::Mysql::Mgmt::V2017_12_01::Models::VirtualNetworkRule.mapper()
443
+ result.body = @client.deserialize(result_mapper, parsed_response)
444
+ rescue Exception => e
445
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
446
+ end
447
+ end
448
+ # Deserialize Response
449
+ if status_code == 201
450
+ begin
451
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
452
+ result_mapper = Azure::Mysql::Mgmt::V2017_12_01::Models::VirtualNetworkRule.mapper()
453
+ result.body = @client.deserialize(result_mapper, parsed_response)
454
+ rescue Exception => e
455
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
456
+ end
457
+ end
458
+
459
+ result
460
+ end
461
+
462
+ promise.execute
463
+ end
464
+
465
+ #
466
+ # Deletes the virtual network rule with the given name.
467
+ #
468
+ # @param resource_group_name [String] The name of the resource group that
469
+ # contains the resource. You can obtain this value from the Azure Resource
470
+ # Manager API or the portal.
471
+ # @param server_name [String] The name of the server.
472
+ # @param virtual_network_rule_name [String] The name of the virtual network
473
+ # rule.
474
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
475
+ # will be added to the HTTP request.
476
+ #
477
+ #
478
+ def begin_delete(resource_group_name, server_name, virtual_network_rule_name, custom_headers:nil)
479
+ response = begin_delete_async(resource_group_name, server_name, virtual_network_rule_name, custom_headers:custom_headers).value!
480
+ nil
481
+ end
482
+
483
+ #
484
+ # Deletes the virtual network rule with the given name.
485
+ #
486
+ # @param resource_group_name [String] The name of the resource group that
487
+ # contains the resource. You can obtain this value from the Azure Resource
488
+ # Manager API or the portal.
489
+ # @param server_name [String] The name of the server.
490
+ # @param virtual_network_rule_name [String] The name of the virtual network
491
+ # rule.
492
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
493
+ # will be added to the HTTP request.
494
+ #
495
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
496
+ #
497
+ def begin_delete_with_http_info(resource_group_name, server_name, virtual_network_rule_name, custom_headers:nil)
498
+ begin_delete_async(resource_group_name, server_name, virtual_network_rule_name, custom_headers:custom_headers).value!
499
+ end
500
+
501
+ #
502
+ # Deletes the virtual network rule with the given name.
503
+ #
504
+ # @param resource_group_name [String] The name of the resource group that
505
+ # contains the resource. You can obtain this value from the Azure Resource
506
+ # Manager API or the portal.
507
+ # @param server_name [String] The name of the server.
508
+ # @param virtual_network_rule_name [String] The name of the virtual network
509
+ # rule.
510
+ # @param [Hash{String => String}] A hash of custom headers that will be added
511
+ # to the HTTP request.
512
+ #
513
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
514
+ #
515
+ def begin_delete_async(resource_group_name, server_name, virtual_network_rule_name, custom_headers:nil)
516
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
517
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
518
+ fail ArgumentError, 'virtual_network_rule_name is nil' if virtual_network_rule_name.nil?
519
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
520
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
521
+
522
+
523
+ request_headers = {}
524
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
525
+
526
+ # Set Headers
527
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
528
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
529
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}'
530
+
531
+ request_url = @base_url || @client.base_url
532
+
533
+ options = {
534
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
535
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'virtualNetworkRuleName' => virtual_network_rule_name,'subscriptionId' => @client.subscription_id},
536
+ query_params: {'api-version' => @client.api_version},
537
+ headers: request_headers.merge(custom_headers || {}),
538
+ base_url: request_url
539
+ }
540
+ promise = @client.make_request_async(:delete, path_template, options)
541
+
542
+ promise = promise.then do |result|
543
+ http_response = result.response
544
+ status_code = http_response.status
545
+ response_content = http_response.body
546
+ unless status_code == 200 || status_code == 202 || status_code == 204
547
+ error_model = JSON.load(response_content)
548
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
549
+ end
550
+
551
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
552
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
553
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
554
+
555
+ result
556
+ end
557
+
558
+ promise.execute
559
+ end
560
+
561
+ #
562
+ # Gets a list of virtual network rules in a server.
563
+ #
564
+ # @param next_page_link [String] The NextLink from the previous successful call
565
+ # to List operation.
566
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
567
+ # will be added to the HTTP request.
568
+ #
569
+ # @return [VirtualNetworkRuleListResult] operation results.
570
+ #
571
+ def list_by_server_next(next_page_link, custom_headers:nil)
572
+ response = list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
573
+ response.body unless response.nil?
574
+ end
575
+
576
+ #
577
+ # Gets a list of virtual network rules in a server.
578
+ #
579
+ # @param next_page_link [String] The NextLink from the previous successful call
580
+ # to List operation.
581
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
582
+ # will be added to the HTTP request.
583
+ #
584
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
585
+ #
586
+ def list_by_server_next_with_http_info(next_page_link, custom_headers:nil)
587
+ list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
588
+ end
589
+
590
+ #
591
+ # Gets a list of virtual network rules in a server.
592
+ #
593
+ # @param next_page_link [String] The NextLink from the previous successful call
594
+ # to List operation.
595
+ # @param [Hash{String => String}] A hash of custom headers that will be added
596
+ # to the HTTP request.
597
+ #
598
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
599
+ #
600
+ def list_by_server_next_async(next_page_link, custom_headers:nil)
601
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
602
+
603
+
604
+ request_headers = {}
605
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
606
+
607
+ # Set Headers
608
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
609
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
610
+ path_template = '{nextLink}'
611
+
612
+ request_url = @base_url || @client.base_url
613
+
614
+ options = {
615
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
616
+ skip_encoding_path_params: {'nextLink' => next_page_link},
617
+ headers: request_headers.merge(custom_headers || {}),
618
+ base_url: request_url
619
+ }
620
+ promise = @client.make_request_async(:get, path_template, options)
621
+
622
+ promise = promise.then do |result|
623
+ http_response = result.response
624
+ status_code = http_response.status
625
+ response_content = http_response.body
626
+ unless status_code == 200
627
+ error_model = JSON.load(response_content)
628
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
629
+ end
630
+
631
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
632
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
633
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
634
+ # Deserialize Response
635
+ if status_code == 200
636
+ begin
637
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
638
+ result_mapper = Azure::Mysql::Mgmt::V2017_12_01::Models::VirtualNetworkRuleListResult.mapper()
639
+ result.body = @client.deserialize(result_mapper, parsed_response)
640
+ rescue Exception => e
641
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
642
+ end
643
+ end
644
+
645
+ result
646
+ end
647
+
648
+ promise.execute
649
+ end
650
+
651
+ #
652
+ # Gets a list of virtual network rules in a server.
653
+ #
654
+ # @param resource_group_name [String] The name of the resource group that
655
+ # contains the resource. You can obtain this value from the Azure Resource
656
+ # Manager API or the portal.
657
+ # @param server_name [String] The name of the server.
658
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
659
+ # will be added to the HTTP request.
660
+ #
661
+ # @return [VirtualNetworkRuleListResult] which provide lazy access to pages of
662
+ # the response.
663
+ #
664
+ def list_by_server_as_lazy(resource_group_name, server_name, custom_headers:nil)
665
+ response = list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
666
+ unless response.nil?
667
+ page = response.body
668
+ page.next_method = Proc.new do |next_page_link|
669
+ list_by_server_next_async(next_page_link, custom_headers:custom_headers)
670
+ end
671
+ page
672
+ end
673
+ end
674
+
675
+ end
676
+ end