azure_mgmt_postgresql 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql.rb +71 -0
  4. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/check_name_availability.rb +126 -0
  5. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/configurations.rb +396 -0
  6. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/databases.rb +541 -0
  7. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/firewall_rules.rb +541 -0
  8. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/location_based_performance_tier.rb +116 -0
  9. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/log_files.rb +126 -0
  10. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/configuration.rb +132 -0
  11. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/configuration_list_result.rb +55 -0
  12. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/database.rb +84 -0
  13. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/database_list_result.rb +55 -0
  14. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/firewall_rule.rb +92 -0
  15. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/firewall_rule_list_result.rb +55 -0
  16. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/geo_redundant_backup.rb +16 -0
  17. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/log_file.rb +119 -0
  18. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/log_file_list_result.rb +55 -0
  19. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/name_availability.rb +68 -0
  20. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/name_availability_request.rb +57 -0
  21. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/operation.rb +95 -0
  22. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/operation_display.rb +83 -0
  23. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/operation_list_result.rb +55 -0
  24. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/operation_origin.rb +17 -0
  25. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/performance_tier_list_result.rb +56 -0
  26. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/performance_tier_properties.rb +67 -0
  27. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/performance_tier_service_level_objectives.rb +126 -0
  28. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/proxy_resource.rb +71 -0
  29. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server.rb +220 -0
  30. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_for_create.rb +92 -0
  31. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_list_result.rb +55 -0
  32. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_create.rb +86 -0
  33. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_default_create.rb +100 -0
  34. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_geo_restore.rb +88 -0
  35. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_replica.rb +87 -0
  36. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_restore.rb +99 -0
  37. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_state.rb +17 -0
  38. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_update_parameters.rb +115 -0
  39. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_version.rb +16 -0
  40. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/sku.rb +97 -0
  41. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/sku_tier.rb +17 -0
  42. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/ssl_enforcement_enum.rb +16 -0
  43. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/storage_profile.rb +69 -0
  44. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/tracked_resource.rb +93 -0
  45. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/module_definition.rb +9 -0
  46. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/operations.rb +110 -0
  47. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/postgre_sqlmanagement_client.rb +164 -0
  48. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/replicas.rb +126 -0
  49. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/servers.rb +771 -0
  50. data/lib/2017-12-01/generated/azure_mgmt_postgresql.rb +78 -0
  51. data/lib/2017-12-01/generated/azure_mgmt_postgresql/check_name_availability.rb +126 -0
  52. data/lib/2017-12-01/generated/azure_mgmt_postgresql/configurations.rb +396 -0
  53. data/lib/2017-12-01/generated/azure_mgmt_postgresql/databases.rb +541 -0
  54. data/lib/2017-12-01/generated/azure_mgmt_postgresql/firewall_rules.rb +541 -0
  55. data/lib/2017-12-01/generated/azure_mgmt_postgresql/location_based_performance_tier.rb +116 -0
  56. data/lib/2017-12-01/generated/azure_mgmt_postgresql/log_files.rb +126 -0
  57. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/configuration.rb +132 -0
  58. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/configuration_list_result.rb +55 -0
  59. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/database.rb +84 -0
  60. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/database_list_result.rb +55 -0
  61. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/firewall_rule.rb +92 -0
  62. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/firewall_rule_list_result.rb +55 -0
  63. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/geo_redundant_backup.rb +16 -0
  64. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/log_file.rb +119 -0
  65. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/log_file_list_result.rb +55 -0
  66. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/name_availability.rb +68 -0
  67. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/name_availability_request.rb +57 -0
  68. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/operation.rb +95 -0
  69. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/operation_display.rb +83 -0
  70. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/operation_list_result.rb +55 -0
  71. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/operation_origin.rb +17 -0
  72. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/performance_tier_list_result.rb +56 -0
  73. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/performance_tier_properties.rb +67 -0
  74. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/performance_tier_service_level_objectives.rb +126 -0
  75. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/proxy_resource.rb +71 -0
  76. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server.rb +220 -0
  77. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_for_create.rb +92 -0
  78. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_list_result.rb +55 -0
  79. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_create.rb +86 -0
  80. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_default_create.rb +100 -0
  81. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_geo_restore.rb +88 -0
  82. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_replica.rb +87 -0
  83. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_restore.rb +99 -0
  84. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_security_alert_policy.rb +166 -0
  85. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_security_alert_policy_state.rb +16 -0
  86. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_state.rb +17 -0
  87. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_update_parameters.rb +126 -0
  88. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_version.rb +19 -0
  89. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/sku.rb +97 -0
  90. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/sku_tier.rb +17 -0
  91. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/ssl_enforcement_enum.rb +16 -0
  92. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/storage_profile.rb +69 -0
  93. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/tracked_resource.rb +93 -0
  94. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/virtual_network_rule.rb +99 -0
  95. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/virtual_network_rule_list_result.rb +100 -0
  96. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/virtual_network_rule_state.rb +19 -0
  97. data/lib/2017-12-01/generated/azure_mgmt_postgresql/module_definition.rb +9 -0
  98. data/lib/2017-12-01/generated/azure_mgmt_postgresql/operations.rb +110 -0
  99. data/lib/2017-12-01/generated/azure_mgmt_postgresql/postgre_sqlmanagement_client.rb +172 -0
  100. data/lib/2017-12-01/generated/azure_mgmt_postgresql/replicas.rb +126 -0
  101. data/lib/2017-12-01/generated/azure_mgmt_postgresql/server_security_alert_policies.rb +290 -0
  102. data/lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb +900 -0
  103. data/lib/2017-12-01/generated/azure_mgmt_postgresql/virtual_network_rules.rb +666 -0
  104. data/lib/azure_mgmt_postgresql.rb +7 -0
  105. data/lib/module_definition.rb +7 -0
  106. data/lib/profiles/latest/modules/postgresql_profile_module.rb +241 -0
  107. data/lib/profiles/latest/postgresql_latest_profile_client.rb +40 -0
  108. data/lib/profiles/latest/postgresql_module_definition.rb +8 -0
  109. data/lib/version.rb +7 -0
  110. metadata +225 -0
@@ -0,0 +1,126 @@
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, log files and configurations with new business
11
+ # model.
12
+ #
13
+ class Replicas
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Replicas 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
+ # List all the replicas for a given server.
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 custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [ServerListResult] operation results.
38
+ #
39
+ def list_by_server(resource_group_name, server_name, custom_headers:nil)
40
+ response = list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # List all the replicas for a given server.
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group that
48
+ # contains the resource. You can obtain this value from the Azure Resource
49
+ # Manager API or the portal.
50
+ # @param server_name [String] The name of the server.
51
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
52
+ # will be added to the HTTP request.
53
+ #
54
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
55
+ #
56
+ def list_by_server_with_http_info(resource_group_name, server_name, custom_headers:nil)
57
+ list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
58
+ end
59
+
60
+ #
61
+ # List all the replicas for a given server.
62
+ #
63
+ # @param resource_group_name [String] The name of the resource group that
64
+ # contains the resource. You can obtain this value from the Azure Resource
65
+ # Manager API or the portal.
66
+ # @param server_name [String] The name of the server.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def list_by_server_async(resource_group_name, server_name, custom_headers:nil)
73
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
74
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
75
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
76
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
77
+
78
+
79
+ request_headers = {}
80
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
81
+
82
+ # Set Headers
83
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
84
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
85
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/Replicas'
86
+
87
+ request_url = @base_url || @client.base_url
88
+
89
+ options = {
90
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
91
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
92
+ query_params: {'api-version' => @client.api_version},
93
+ headers: request_headers.merge(custom_headers || {}),
94
+ base_url: request_url
95
+ }
96
+ promise = @client.make_request_async(:get, path_template, options)
97
+
98
+ promise = promise.then do |result|
99
+ http_response = result.response
100
+ status_code = http_response.status
101
+ response_content = http_response.body
102
+ unless status_code == 200
103
+ error_model = JSON.load(response_content)
104
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
105
+ end
106
+
107
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
108
+ # Deserialize Response
109
+ if status_code == 200
110
+ begin
111
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
112
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01_preview::Models::ServerListResult.mapper()
113
+ result.body = @client.deserialize(result_mapper, parsed_response)
114
+ rescue Exception => e
115
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
116
+ end
117
+ end
118
+
119
+ result
120
+ end
121
+
122
+ promise.execute
123
+ end
124
+
125
+ end
126
+ end
@@ -0,0 +1,771 @@
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, log files and configurations with new business
11
+ # model.
12
+ #
13
+ class Servers
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Servers 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
+ # Creates a new server, or will overwrite an existing server.
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 parameters [ServerForCreate] The required parameters for creating or
35
+ # updating a server.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [Server] operation results.
40
+ #
41
+ def create(resource_group_name, server_name, parameters, custom_headers:nil)
42
+ response = create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
43
+ response.body unless response.nil?
44
+ end
45
+
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group that
48
+ # contains the resource. You can obtain this value from the Azure Resource
49
+ # Manager API or the portal.
50
+ # @param server_name [String] The name of the server.
51
+ # @param parameters [ServerForCreate] The required parameters for creating or
52
+ # updating a server.
53
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
54
+ # will be added to the HTTP request.
55
+ #
56
+ # @return [Concurrent::Promise] promise which provides async access to http
57
+ # response.
58
+ #
59
+ def create_async(resource_group_name, server_name, parameters, custom_headers:nil)
60
+ # Send request
61
+ promise = begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)
62
+
63
+ promise = promise.then do |response|
64
+ # Defining deserialization method.
65
+ deserialize_method = lambda do |parsed_response|
66
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01_preview::Models::Server.mapper()
67
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
68
+ end
69
+
70
+ # Waiting for response.
71
+ @client.get_long_running_operation_result(response, deserialize_method)
72
+ end
73
+
74
+ promise
75
+ end
76
+
77
+ #
78
+ # Updates an existing server. The request body can contain one to many of the
79
+ # properties present in the normal server definition.
80
+ #
81
+ # @param resource_group_name [String] The name of the resource group that
82
+ # contains the resource. You can obtain this value from the Azure Resource
83
+ # Manager API or the portal.
84
+ # @param server_name [String] The name of the server.
85
+ # @param parameters [ServerUpdateParameters] The required parameters for
86
+ # updating a server.
87
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
88
+ # will be added to the HTTP request.
89
+ #
90
+ # @return [Server] operation results.
91
+ #
92
+ def update(resource_group_name, server_name, parameters, custom_headers:nil)
93
+ response = update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
94
+ response.body unless response.nil?
95
+ end
96
+
97
+ #
98
+ # @param resource_group_name [String] The name of the resource group that
99
+ # contains the resource. You can obtain this value from the Azure Resource
100
+ # Manager API or the portal.
101
+ # @param server_name [String] The name of the server.
102
+ # @param parameters [ServerUpdateParameters] The required parameters for
103
+ # updating a server.
104
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
105
+ # will be added to the HTTP request.
106
+ #
107
+ # @return [Concurrent::Promise] promise which provides async access to http
108
+ # response.
109
+ #
110
+ def update_async(resource_group_name, server_name, parameters, custom_headers:nil)
111
+ # Send request
112
+ promise = begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)
113
+
114
+ promise = promise.then do |response|
115
+ # Defining deserialization method.
116
+ deserialize_method = lambda do |parsed_response|
117
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01_preview::Models::Server.mapper()
118
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
119
+ end
120
+
121
+ # Waiting for response.
122
+ @client.get_long_running_operation_result(response, deserialize_method)
123
+ end
124
+
125
+ promise
126
+ end
127
+
128
+ #
129
+ # Deletes a server.
130
+ #
131
+ # @param resource_group_name [String] The name of the resource group that
132
+ # contains the resource. You can obtain this value from the Azure Resource
133
+ # Manager API or the portal.
134
+ # @param server_name [String] The name of the server.
135
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
136
+ # will be added to the HTTP request.
137
+ #
138
+ def delete(resource_group_name, server_name, custom_headers:nil)
139
+ response = delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
140
+ nil
141
+ end
142
+
143
+ #
144
+ # @param resource_group_name [String] The name of the resource group that
145
+ # contains the resource. You can obtain this value from the Azure Resource
146
+ # Manager API or the portal.
147
+ # @param server_name [String] The name of the server.
148
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
149
+ # will be added to the HTTP request.
150
+ #
151
+ # @return [Concurrent::Promise] promise which provides async access to http
152
+ # response.
153
+ #
154
+ def delete_async(resource_group_name, server_name, custom_headers:nil)
155
+ # Send request
156
+ promise = begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers)
157
+
158
+ promise = promise.then do |response|
159
+ # Defining deserialization method.
160
+ deserialize_method = lambda do |parsed_response|
161
+ end
162
+
163
+ # Waiting for response.
164
+ @client.get_long_running_operation_result(response, deserialize_method)
165
+ end
166
+
167
+ promise
168
+ end
169
+
170
+ #
171
+ # Gets information about a server.
172
+ #
173
+ # @param resource_group_name [String] The name of the resource group that
174
+ # contains the resource. You can obtain this value from the Azure Resource
175
+ # Manager API or the portal.
176
+ # @param server_name [String] The name of the server.
177
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
178
+ # will be added to the HTTP request.
179
+ #
180
+ # @return [Server] operation results.
181
+ #
182
+ def get(resource_group_name, server_name, custom_headers:nil)
183
+ response = get_async(resource_group_name, server_name, custom_headers:custom_headers).value!
184
+ response.body unless response.nil?
185
+ end
186
+
187
+ #
188
+ # Gets information about a server.
189
+ #
190
+ # @param resource_group_name [String] The name of the resource group that
191
+ # contains the resource. You can obtain this value from the Azure Resource
192
+ # Manager API or the portal.
193
+ # @param server_name [String] The name of the server.
194
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
195
+ # will be added to the HTTP request.
196
+ #
197
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
198
+ #
199
+ def get_with_http_info(resource_group_name, server_name, custom_headers:nil)
200
+ get_async(resource_group_name, server_name, custom_headers:custom_headers).value!
201
+ end
202
+
203
+ #
204
+ # Gets information about a server.
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 [Hash{String => String}] A hash of custom headers that will be added
211
+ # to the HTTP request.
212
+ #
213
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
214
+ #
215
+ def get_async(resource_group_name, server_name, custom_headers:nil)
216
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
217
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
218
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
219
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
220
+
221
+
222
+ request_headers = {}
223
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
224
+
225
+ # Set Headers
226
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
227
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
228
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}'
229
+
230
+ request_url = @base_url || @client.base_url
231
+
232
+ options = {
233
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
234
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
235
+ query_params: {'api-version' => @client.api_version},
236
+ headers: request_headers.merge(custom_headers || {}),
237
+ base_url: request_url
238
+ }
239
+ promise = @client.make_request_async(:get, path_template, options)
240
+
241
+ promise = promise.then do |result|
242
+ http_response = result.response
243
+ status_code = http_response.status
244
+ response_content = http_response.body
245
+ unless status_code == 200
246
+ error_model = JSON.load(response_content)
247
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
248
+ end
249
+
250
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
251
+ # Deserialize Response
252
+ if status_code == 200
253
+ begin
254
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
255
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01_preview::Models::Server.mapper()
256
+ result.body = @client.deserialize(result_mapper, parsed_response)
257
+ rescue Exception => e
258
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
259
+ end
260
+ end
261
+
262
+ result
263
+ end
264
+
265
+ promise.execute
266
+ end
267
+
268
+ #
269
+ # List all the servers in a given resource group.
270
+ #
271
+ # @param resource_group_name [String] The name of the resource group that
272
+ # contains the resource. You can obtain this value from the Azure Resource
273
+ # Manager API or the portal.
274
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
275
+ # will be added to the HTTP request.
276
+ #
277
+ # @return [ServerListResult] operation results.
278
+ #
279
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
280
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
281
+ response.body unless response.nil?
282
+ end
283
+
284
+ #
285
+ # List all the servers in a given resource group.
286
+ #
287
+ # @param resource_group_name [String] The name of the resource group that
288
+ # contains the resource. You can obtain this value from the Azure Resource
289
+ # Manager API or the portal.
290
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
291
+ # will be added to the HTTP request.
292
+ #
293
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
294
+ #
295
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
296
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
297
+ end
298
+
299
+ #
300
+ # List all the servers in a given resource group.
301
+ #
302
+ # @param resource_group_name [String] The name of the resource group that
303
+ # contains the resource. You can obtain this value from the Azure Resource
304
+ # Manager API or the portal.
305
+ # @param [Hash{String => String}] A hash of custom headers that will be added
306
+ # to the HTTP request.
307
+ #
308
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
309
+ #
310
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
311
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
312
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
313
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
314
+
315
+
316
+ request_headers = {}
317
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
318
+
319
+ # Set Headers
320
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
321
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
322
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers'
323
+
324
+ request_url = @base_url || @client.base_url
325
+
326
+ options = {
327
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
328
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
329
+ query_params: {'api-version' => @client.api_version},
330
+ headers: request_headers.merge(custom_headers || {}),
331
+ base_url: request_url
332
+ }
333
+ promise = @client.make_request_async(:get, path_template, options)
334
+
335
+ promise = promise.then do |result|
336
+ http_response = result.response
337
+ status_code = http_response.status
338
+ response_content = http_response.body
339
+ unless status_code == 200
340
+ error_model = JSON.load(response_content)
341
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
342
+ end
343
+
344
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
345
+ # Deserialize Response
346
+ if status_code == 200
347
+ begin
348
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
349
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01_preview::Models::ServerListResult.mapper()
350
+ result.body = @client.deserialize(result_mapper, parsed_response)
351
+ rescue Exception => e
352
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
353
+ end
354
+ end
355
+
356
+ result
357
+ end
358
+
359
+ promise.execute
360
+ end
361
+
362
+ #
363
+ # List all the servers in a given subscription.
364
+ #
365
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
366
+ # will be added to the HTTP request.
367
+ #
368
+ # @return [ServerListResult] operation results.
369
+ #
370
+ def list(custom_headers:nil)
371
+ response = list_async(custom_headers:custom_headers).value!
372
+ response.body unless response.nil?
373
+ end
374
+
375
+ #
376
+ # List all the servers in a given subscription.
377
+ #
378
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
379
+ # will be added to the HTTP request.
380
+ #
381
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
382
+ #
383
+ def list_with_http_info(custom_headers:nil)
384
+ list_async(custom_headers:custom_headers).value!
385
+ end
386
+
387
+ #
388
+ # List all the servers in a given subscription.
389
+ #
390
+ # @param [Hash{String => String}] A hash of custom headers that will be added
391
+ # to the HTTP request.
392
+ #
393
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
394
+ #
395
+ def list_async(custom_headers:nil)
396
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
397
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers'
407
+
408
+ request_url = @base_url || @client.base_url
409
+
410
+ options = {
411
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
412
+ path_params: {'subscriptionId' => @client.subscription_id},
413
+ query_params: {'api-version' => @client.api_version},
414
+ headers: request_headers.merge(custom_headers || {}),
415
+ base_url: request_url
416
+ }
417
+ promise = @client.make_request_async(:get, 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
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::Postgresql::Mgmt::V2017_12_01_preview::Models::ServerListResult.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
+
440
+ result
441
+ end
442
+
443
+ promise.execute
444
+ end
445
+
446
+ #
447
+ # Creates a new server, or will overwrite an existing server.
448
+ #
449
+ # @param resource_group_name [String] The name of the resource group that
450
+ # contains the resource. You can obtain this value from the Azure Resource
451
+ # Manager API or the portal.
452
+ # @param server_name [String] The name of the server.
453
+ # @param parameters [ServerForCreate] The required parameters for creating or
454
+ # updating a server.
455
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
456
+ # will be added to the HTTP request.
457
+ #
458
+ # @return [Server] operation results.
459
+ #
460
+ def begin_create(resource_group_name, server_name, parameters, custom_headers:nil)
461
+ response = begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
462
+ response.body unless response.nil?
463
+ end
464
+
465
+ #
466
+ # Creates a new server, or will overwrite an existing server.
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 parameters [ServerForCreate] The required parameters for creating or
473
+ # updating a server.
474
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
475
+ # will be added to the HTTP request.
476
+ #
477
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
478
+ #
479
+ def begin_create_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
480
+ begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
481
+ end
482
+
483
+ #
484
+ # Creates a new server, or will overwrite an existing server.
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 parameters [ServerForCreate] The required parameters for creating or
491
+ # updating a server.
492
+ # @param [Hash{String => String}] A hash of custom headers that will be added
493
+ # to the HTTP request.
494
+ #
495
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
496
+ #
497
+ def begin_create_async(resource_group_name, server_name, parameters, custom_headers:nil)
498
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
499
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
500
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
501
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
502
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
503
+
504
+
505
+ request_headers = {}
506
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
507
+
508
+ # Set Headers
509
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
510
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
511
+
512
+ # Serialize Request
513
+ request_mapper = Azure::Postgresql::Mgmt::V2017_12_01_preview::Models::ServerForCreate.mapper()
514
+ request_content = @client.serialize(request_mapper, parameters)
515
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
516
+
517
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}'
518
+
519
+ request_url = @base_url || @client.base_url
520
+
521
+ options = {
522
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
523
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
524
+ query_params: {'api-version' => @client.api_version},
525
+ body: request_content,
526
+ headers: request_headers.merge(custom_headers || {}),
527
+ base_url: request_url
528
+ }
529
+ promise = @client.make_request_async(:put, path_template, options)
530
+
531
+ promise = promise.then do |result|
532
+ http_response = result.response
533
+ status_code = http_response.status
534
+ response_content = http_response.body
535
+ unless status_code == 200 || status_code == 201 || status_code == 202
536
+ error_model = JSON.load(response_content)
537
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
538
+ end
539
+
540
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
541
+ # Deserialize Response
542
+ if status_code == 200
543
+ begin
544
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
545
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01_preview::Models::Server.mapper()
546
+ result.body = @client.deserialize(result_mapper, parsed_response)
547
+ rescue Exception => e
548
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
549
+ end
550
+ end
551
+ # Deserialize Response
552
+ if status_code == 201
553
+ begin
554
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
555
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01_preview::Models::Server.mapper()
556
+ result.body = @client.deserialize(result_mapper, parsed_response)
557
+ rescue Exception => e
558
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
559
+ end
560
+ end
561
+
562
+ result
563
+ end
564
+
565
+ promise.execute
566
+ end
567
+
568
+ #
569
+ # Updates an existing server. The request body can contain one to many of the
570
+ # properties present in the normal server definition.
571
+ #
572
+ # @param resource_group_name [String] The name of the resource group that
573
+ # contains the resource. You can obtain this value from the Azure Resource
574
+ # Manager API or the portal.
575
+ # @param server_name [String] The name of the server.
576
+ # @param parameters [ServerUpdateParameters] The required parameters for
577
+ # updating a server.
578
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
579
+ # will be added to the HTTP request.
580
+ #
581
+ # @return [Server] operation results.
582
+ #
583
+ def begin_update(resource_group_name, server_name, parameters, custom_headers:nil)
584
+ response = begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
585
+ response.body unless response.nil?
586
+ end
587
+
588
+ #
589
+ # Updates an existing server. The request body can contain one to many of the
590
+ # properties present in the normal server definition.
591
+ #
592
+ # @param resource_group_name [String] The name of the resource group that
593
+ # contains the resource. You can obtain this value from the Azure Resource
594
+ # Manager API or the portal.
595
+ # @param server_name [String] The name of the server.
596
+ # @param parameters [ServerUpdateParameters] The required parameters for
597
+ # updating a server.
598
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
599
+ # will be added to the HTTP request.
600
+ #
601
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
602
+ #
603
+ def begin_update_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
604
+ begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
605
+ end
606
+
607
+ #
608
+ # Updates an existing server. The request body can contain one to many of the
609
+ # properties present in the normal server definition.
610
+ #
611
+ # @param resource_group_name [String] The name of the resource group that
612
+ # contains the resource. You can obtain this value from the Azure Resource
613
+ # Manager API or the portal.
614
+ # @param server_name [String] The name of the server.
615
+ # @param parameters [ServerUpdateParameters] The required parameters for
616
+ # updating a server.
617
+ # @param [Hash{String => String}] A hash of custom headers that will be added
618
+ # to the HTTP request.
619
+ #
620
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
621
+ #
622
+ def begin_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
623
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
624
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
625
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
626
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
627
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
628
+
629
+
630
+ request_headers = {}
631
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
632
+
633
+ # Set Headers
634
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
635
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
636
+
637
+ # Serialize Request
638
+ request_mapper = Azure::Postgresql::Mgmt::V2017_12_01_preview::Models::ServerUpdateParameters.mapper()
639
+ request_content = @client.serialize(request_mapper, parameters)
640
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
641
+
642
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}'
643
+
644
+ request_url = @base_url || @client.base_url
645
+
646
+ options = {
647
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
648
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
649
+ query_params: {'api-version' => @client.api_version},
650
+ body: request_content,
651
+ headers: request_headers.merge(custom_headers || {}),
652
+ base_url: request_url
653
+ }
654
+ promise = @client.make_request_async(:patch, path_template, options)
655
+
656
+ promise = promise.then do |result|
657
+ http_response = result.response
658
+ status_code = http_response.status
659
+ response_content = http_response.body
660
+ unless status_code == 200 || status_code == 202
661
+ error_model = JSON.load(response_content)
662
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
663
+ end
664
+
665
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
666
+ # Deserialize Response
667
+ if status_code == 200
668
+ begin
669
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
670
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01_preview::Models::Server.mapper()
671
+ result.body = @client.deserialize(result_mapper, parsed_response)
672
+ rescue Exception => e
673
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
674
+ end
675
+ end
676
+
677
+ result
678
+ end
679
+
680
+ promise.execute
681
+ end
682
+
683
+ #
684
+ # Deletes a server.
685
+ #
686
+ # @param resource_group_name [String] The name of the resource group that
687
+ # contains the resource. You can obtain this value from the Azure Resource
688
+ # Manager API or the portal.
689
+ # @param server_name [String] The name of the server.
690
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
691
+ # will be added to the HTTP request.
692
+ #
693
+ #
694
+ def begin_delete(resource_group_name, server_name, custom_headers:nil)
695
+ response = begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
696
+ nil
697
+ end
698
+
699
+ #
700
+ # Deletes a server.
701
+ #
702
+ # @param resource_group_name [String] The name of the resource group that
703
+ # contains the resource. You can obtain this value from the Azure Resource
704
+ # Manager API or the portal.
705
+ # @param server_name [String] The name of the server.
706
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
707
+ # will be added to the HTTP request.
708
+ #
709
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
710
+ #
711
+ def begin_delete_with_http_info(resource_group_name, server_name, custom_headers:nil)
712
+ begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
713
+ end
714
+
715
+ #
716
+ # Deletes a server.
717
+ #
718
+ # @param resource_group_name [String] The name of the resource group that
719
+ # contains the resource. You can obtain this value from the Azure Resource
720
+ # Manager API or the portal.
721
+ # @param server_name [String] The name of the server.
722
+ # @param [Hash{String => String}] A hash of custom headers that will be added
723
+ # to the HTTP request.
724
+ #
725
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
726
+ #
727
+ def begin_delete_async(resource_group_name, server_name, custom_headers:nil)
728
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
729
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
730
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
731
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
732
+
733
+
734
+ request_headers = {}
735
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
736
+
737
+ # Set Headers
738
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
739
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
740
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}'
741
+
742
+ request_url = @base_url || @client.base_url
743
+
744
+ options = {
745
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
746
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
747
+ query_params: {'api-version' => @client.api_version},
748
+ headers: request_headers.merge(custom_headers || {}),
749
+ base_url: request_url
750
+ }
751
+ promise = @client.make_request_async(:delete, path_template, options)
752
+
753
+ promise = promise.then do |result|
754
+ http_response = result.response
755
+ status_code = http_response.status
756
+ response_content = http_response.body
757
+ unless status_code == 200 || status_code == 202 || status_code == 204
758
+ error_model = JSON.load(response_content)
759
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
760
+ end
761
+
762
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
763
+
764
+ result
765
+ end
766
+
767
+ promise.execute
768
+ end
769
+
770
+ end
771
+ end