azure_mgmt_mariadb 0.17.0

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