azure_mgmt_postgresql 0.17.0 → 0.17.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +5 -5
  2. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql.rb +18 -10
  3. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/check_name_availability.rb +4 -2
  4. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/configurations.rb +8 -2
  5. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/databases.rb +10 -2
  6. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/firewall_rules.rb +10 -2
  7. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/location_based_performance_tier.rb +4 -2
  8. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/log_files.rb +4 -2
  9. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server.rb +1 -1
  10. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_create.rb +1 -1
  11. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_security_alert_policy.rb +166 -0
  12. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_security_alert_policy_state.rb +16 -0
  13. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_update_parameters.rb +12 -1
  14. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_version.rb +4 -0
  15. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/storage_autogrow.rb +16 -0
  16. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/storage_profile.rb +12 -0
  17. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/virtual_network_rule.rb +99 -0
  18. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/virtual_network_rule_list_result.rb +100 -0
  19. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/virtual_network_rule_state.rb +19 -0
  20. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/operations.rb +4 -2
  21. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/postgre_sqlmanagement_client.rb +9 -1
  22. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/replicas.rb +4 -2
  23. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/server_security_alert_policies.rb +294 -0
  24. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/servers.rb +145 -2
  25. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/virtual_network_rules.rb +676 -0
  26. data/lib/2017-12-01/generated/azure_mgmt_postgresql.rb +1 -0
  27. data/lib/2017-12-01/generated/azure_mgmt_postgresql/check_name_availability.rb +2 -0
  28. data/lib/2017-12-01/generated/azure_mgmt_postgresql/configurations.rb +6 -0
  29. data/lib/2017-12-01/generated/azure_mgmt_postgresql/databases.rb +8 -0
  30. data/lib/2017-12-01/generated/azure_mgmt_postgresql/firewall_rules.rb +8 -0
  31. data/lib/2017-12-01/generated/azure_mgmt_postgresql/location_based_performance_tier.rb +2 -0
  32. data/lib/2017-12-01/generated/azure_mgmt_postgresql/log_files.rb +2 -0
  33. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server.rb +1 -1
  34. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_create.rb +1 -1
  35. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_update_parameters.rb +1 -1
  36. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_version.rb +1 -0
  37. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/storage_autogrow.rb +16 -0
  38. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/storage_profile.rb +12 -0
  39. data/lib/2017-12-01/generated/azure_mgmt_postgresql/operations.rb +2 -0
  40. data/lib/2017-12-01/generated/azure_mgmt_postgresql/postgre_sqlmanagement_client.rb +1 -1
  41. data/lib/2017-12-01/generated/azure_mgmt_postgresql/replicas.rb +2 -0
  42. data/lib/2017-12-01/generated/azure_mgmt_postgresql/server_security_alert_policies.rb +4 -0
  43. data/lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb +14 -0
  44. data/lib/2017-12-01/generated/azure_mgmt_postgresql/virtual_network_rules.rb +10 -0
  45. data/lib/profiles/latest/modules/postgresql_profile_module.rb +4 -0
  46. data/lib/version.rb +1 -1
  47. metadata +14 -5
@@ -7,8 +7,8 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
7
7
  #
8
8
  # The Microsoft Azure management API provides create, read, update, and
9
9
  # delete functionality for Azure PostgreSQL resources including servers,
10
- # databases, firewall rules, log files and configurations with new business
11
- # model.
10
+ # databases, firewall rules, VNET rules, security alert policies, log files
11
+ # and configurations with new business model.
12
12
  #
13
13
  class Servers
14
14
  include MsRestAzure
@@ -248,6 +248,8 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
248
248
  end
249
249
 
250
250
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
251
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
252
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
251
253
  # Deserialize Response
252
254
  if status_code == 200
253
255
  begin
@@ -342,6 +344,8 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
342
344
  end
343
345
 
344
346
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
347
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
348
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
345
349
  # Deserialize Response
346
350
  if status_code == 200
347
351
  begin
@@ -426,6 +430,8 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
426
430
  end
427
431
 
428
432
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
433
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
434
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
429
435
  # Deserialize Response
430
436
  if status_code == 200
431
437
  begin
@@ -443,6 +449,48 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
443
449
  promise.execute
444
450
  end
445
451
 
452
+ #
453
+ # Restarts a server.
454
+ #
455
+ # @param resource_group_name [String] The name of the resource group that
456
+ # contains the resource. You can obtain this value from the Azure Resource
457
+ # Manager API or the portal.
458
+ # @param server_name [String] The name of the server.
459
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
460
+ # will be added to the HTTP request.
461
+ #
462
+ def restart(resource_group_name, server_name, custom_headers:nil)
463
+ response = restart_async(resource_group_name, server_name, custom_headers:custom_headers).value!
464
+ nil
465
+ end
466
+
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 custom_headers [Hash{String => String}] A hash of custom headers that
473
+ # will be added to the HTTP request.
474
+ #
475
+ # @return [Concurrent::Promise] promise which provides async access to http
476
+ # response.
477
+ #
478
+ def restart_async(resource_group_name, server_name, custom_headers:nil)
479
+ # Send request
480
+ promise = begin_restart_async(resource_group_name, server_name, custom_headers:custom_headers)
481
+
482
+ promise = promise.then do |response|
483
+ # Defining deserialization method.
484
+ deserialize_method = lambda do |parsed_response|
485
+ end
486
+
487
+ # Waiting for response.
488
+ @client.get_long_running_operation_result(response, deserialize_method)
489
+ end
490
+
491
+ promise
492
+ end
493
+
446
494
  #
447
495
  # Creates a new server, or will overwrite an existing server.
448
496
  #
@@ -538,6 +586,8 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
538
586
  end
539
587
 
540
588
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
589
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
590
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
541
591
  # Deserialize Response
542
592
  if status_code == 200
543
593
  begin
@@ -663,6 +713,8 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
663
713
  end
664
714
 
665
715
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
716
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
717
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
666
718
  # Deserialize Response
667
719
  if status_code == 200
668
720
  begin
@@ -760,6 +812,97 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
760
812
  end
761
813
 
762
814
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
815
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
816
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
817
+
818
+ result
819
+ end
820
+
821
+ promise.execute
822
+ end
823
+
824
+ #
825
+ # Restarts a server.
826
+ #
827
+ # @param resource_group_name [String] The name of the resource group that
828
+ # contains the resource. You can obtain this value from the Azure Resource
829
+ # Manager API or the portal.
830
+ # @param server_name [String] The name of the server.
831
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
832
+ # will be added to the HTTP request.
833
+ #
834
+ #
835
+ def begin_restart(resource_group_name, server_name, custom_headers:nil)
836
+ response = begin_restart_async(resource_group_name, server_name, custom_headers:custom_headers).value!
837
+ nil
838
+ end
839
+
840
+ #
841
+ # Restarts a server.
842
+ #
843
+ # @param resource_group_name [String] The name of the resource group that
844
+ # contains the resource. You can obtain this value from the Azure Resource
845
+ # Manager API or the portal.
846
+ # @param server_name [String] The name of the server.
847
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
848
+ # will be added to the HTTP request.
849
+ #
850
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
851
+ #
852
+ def begin_restart_with_http_info(resource_group_name, server_name, custom_headers:nil)
853
+ begin_restart_async(resource_group_name, server_name, custom_headers:custom_headers).value!
854
+ end
855
+
856
+ #
857
+ # Restarts a server.
858
+ #
859
+ # @param resource_group_name [String] The name of the resource group that
860
+ # contains the resource. You can obtain this value from the Azure Resource
861
+ # Manager API or the portal.
862
+ # @param server_name [String] The name of the server.
863
+ # @param [Hash{String => String}] A hash of custom headers that will be added
864
+ # to the HTTP request.
865
+ #
866
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
867
+ #
868
+ def begin_restart_async(resource_group_name, server_name, custom_headers:nil)
869
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
870
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
871
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
872
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
873
+
874
+
875
+ request_headers = {}
876
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
877
+
878
+ # Set Headers
879
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
880
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
881
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart'
882
+
883
+ request_url = @base_url || @client.base_url
884
+
885
+ options = {
886
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
887
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
888
+ query_params: {'api-version' => @client.api_version},
889
+ headers: request_headers.merge(custom_headers || {}),
890
+ base_url: request_url
891
+ }
892
+ promise = @client.make_request_async(:post, path_template, options)
893
+
894
+ promise = promise.then do |result|
895
+ http_response = result.response
896
+ status_code = http_response.status
897
+ response_content = http_response.body
898
+ unless status_code == 200 || status_code == 202
899
+ error_model = JSON.load(response_content)
900
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
901
+ end
902
+
903
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
904
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
905
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
763
906
 
764
907
  result
765
908
  end
@@ -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::Postgresql::Mgmt::V2017_12_01_preview
7
+ #
8
+ # The Microsoft Azure management API provides create, read, update, and
9
+ # delete functionality for Azure PostgreSQL resources including servers,
10
+ # databases, firewall rules, VNET rules, security alert policies, log files
11
+ # and configurations with 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 [PostgreSQLManagementClient] reference to the PostgreSQLManagementClient
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.DBforPostgreSQL/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::Postgresql::Mgmt::V2017_12_01_preview::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::Postgresql::Mgmt::V2017_12_01_preview::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.DBforPostgreSQL/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::Postgresql::Mgmt::V2017_12_01_preview::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::Postgresql::Mgmt::V2017_12_01_preview::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.DBforPostgreSQL/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::Postgresql::Mgmt::V2017_12_01_preview::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::Postgresql::Mgmt::V2017_12_01_preview::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.DBforPostgreSQL/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::Postgresql::Mgmt::V2017_12_01_preview::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