azure_mgmt_postgresql 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql.rb +71 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/check_name_availability.rb +126 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/configurations.rb +396 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/databases.rb +541 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/firewall_rules.rb +541 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/location_based_performance_tier.rb +116 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/log_files.rb +126 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/configuration.rb +132 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/configuration_list_result.rb +55 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/database.rb +84 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/database_list_result.rb +55 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/firewall_rule.rb +92 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/firewall_rule_list_result.rb +55 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/geo_redundant_backup.rb +16 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/log_file.rb +119 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/log_file_list_result.rb +55 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/name_availability.rb +68 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/name_availability_request.rb +57 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/operation.rb +95 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/operation_display.rb +83 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/operation_list_result.rb +55 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/operation_origin.rb +17 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/performance_tier_list_result.rb +56 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/performance_tier_properties.rb +67 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/performance_tier_service_level_objectives.rb +126 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/proxy_resource.rb +71 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server.rb +220 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_for_create.rb +92 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_list_result.rb +55 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_create.rb +86 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_default_create.rb +100 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_geo_restore.rb +88 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_replica.rb +87 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_restore.rb +99 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_state.rb +17 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_update_parameters.rb +115 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_version.rb +16 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/sku.rb +97 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/sku_tier.rb +17 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/ssl_enforcement_enum.rb +16 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/storage_profile.rb +69 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/tracked_resource.rb +93 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/module_definition.rb +9 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/operations.rb +110 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/postgre_sqlmanagement_client.rb +164 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/replicas.rb +126 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/servers.rb +771 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql.rb +78 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/check_name_availability.rb +126 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/configurations.rb +396 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/databases.rb +541 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/firewall_rules.rb +541 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/location_based_performance_tier.rb +116 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/log_files.rb +126 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/configuration.rb +132 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/configuration_list_result.rb +55 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/database.rb +84 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/database_list_result.rb +55 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/firewall_rule.rb +92 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/firewall_rule_list_result.rb +55 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/geo_redundant_backup.rb +16 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/log_file.rb +119 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/log_file_list_result.rb +55 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/name_availability.rb +68 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/name_availability_request.rb +57 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/operation.rb +95 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/operation_display.rb +83 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/operation_list_result.rb +55 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/operation_origin.rb +17 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/performance_tier_list_result.rb +56 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/performance_tier_properties.rb +67 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/performance_tier_service_level_objectives.rb +126 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/proxy_resource.rb +71 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server.rb +220 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_for_create.rb +92 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_list_result.rb +55 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_create.rb +86 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_default_create.rb +100 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_geo_restore.rb +88 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_replica.rb +87 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_restore.rb +99 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_security_alert_policy.rb +166 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_security_alert_policy_state.rb +16 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_state.rb +17 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_update_parameters.rb +126 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_version.rb +19 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/sku.rb +97 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/sku_tier.rb +17 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/ssl_enforcement_enum.rb +16 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/storage_profile.rb +69 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/tracked_resource.rb +93 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/virtual_network_rule.rb +99 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/virtual_network_rule_list_result.rb +100 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/virtual_network_rule_state.rb +19 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/module_definition.rb +9 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/operations.rb +110 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/postgre_sqlmanagement_client.rb +172 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/replicas.rb +126 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/server_security_alert_policies.rb +290 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb +900 -0
- data/lib/2017-12-01/generated/azure_mgmt_postgresql/virtual_network_rules.rb +666 -0
- data/lib/azure_mgmt_postgresql.rb +7 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/modules/postgresql_profile_module.rb +241 -0
- data/lib/profiles/latest/postgresql_latest_profile_client.rb +40 -0
- data/lib/profiles/latest/postgresql_module_definition.rb +8 -0
- data/lib/version.rb +7 -0
- 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
|
|
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 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::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,290 @@
|
|
|
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
|
|
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 ServerSecurityAlertPolicies
|
|
14
|
+
include MsRestAzure
|
|
15
|
+
|
|
16
|
+
#
|
|
17
|
+
# Creates and initializes a new instance of the ServerSecurityAlertPolicies 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
|
+
# Get a server's security alert policy.
|
|
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 [ServerSecurityAlertPolicy] operation results.
|
|
38
|
+
#
|
|
39
|
+
def get(resource_group_name, server_name, custom_headers:nil)
|
|
40
|
+
response = get_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
|
41
|
+
response.body unless response.nil?
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
#
|
|
45
|
+
# Get a server's security alert policy.
|
|
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 get_with_http_info(resource_group_name, server_name, custom_headers:nil)
|
|
57
|
+
get_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
#
|
|
61
|
+
# Get a server's security alert policy.
|
|
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 get_async(resource_group_name, server_name, custom_headers:nil)
|
|
73
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
74
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
75
|
+
security_alert_policy_name = 'Default'
|
|
76
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
77
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
request_headers = {}
|
|
81
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
82
|
+
|
|
83
|
+
# Set Headers
|
|
84
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
85
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
86
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}'
|
|
87
|
+
|
|
88
|
+
request_url = @base_url || @client.base_url
|
|
89
|
+
|
|
90
|
+
options = {
|
|
91
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
92
|
+
path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'securityAlertPolicyName' => security_alert_policy_name,'subscriptionId' => @client.subscription_id},
|
|
93
|
+
query_params: {'api-version' => @client.api_version},
|
|
94
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
95
|
+
base_url: request_url
|
|
96
|
+
}
|
|
97
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
98
|
+
|
|
99
|
+
promise = promise.then do |result|
|
|
100
|
+
http_response = result.response
|
|
101
|
+
status_code = http_response.status
|
|
102
|
+
response_content = http_response.body
|
|
103
|
+
unless status_code == 200
|
|
104
|
+
error_model = JSON.load(response_content)
|
|
105
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
109
|
+
# Deserialize Response
|
|
110
|
+
if status_code == 200
|
|
111
|
+
begin
|
|
112
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
113
|
+
result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::ServerSecurityAlertPolicy.mapper()
|
|
114
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
115
|
+
rescue Exception => e
|
|
116
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
result
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
promise.execute
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
#
|
|
127
|
+
# Creates or updates a threat detection policy.
|
|
128
|
+
#
|
|
129
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
130
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
131
|
+
# Manager API or the portal.
|
|
132
|
+
# @param server_name [String] The name of the server.
|
|
133
|
+
# @param parameters [ServerSecurityAlertPolicy] The server security alert
|
|
134
|
+
# policy.
|
|
135
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
136
|
+
# will be added to the HTTP request.
|
|
137
|
+
#
|
|
138
|
+
# @return [ServerSecurityAlertPolicy] operation results.
|
|
139
|
+
#
|
|
140
|
+
def create_or_update(resource_group_name, server_name, parameters, custom_headers:nil)
|
|
141
|
+
response = create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
|
142
|
+
response.body unless response.nil?
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
#
|
|
146
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
147
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
148
|
+
# Manager API or the portal.
|
|
149
|
+
# @param server_name [String] The name of the server.
|
|
150
|
+
# @param parameters [ServerSecurityAlertPolicy] The server security alert
|
|
151
|
+
# policy.
|
|
152
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
153
|
+
# will be added to the HTTP request.
|
|
154
|
+
#
|
|
155
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
|
156
|
+
# response.
|
|
157
|
+
#
|
|
158
|
+
def create_or_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
|
|
159
|
+
# Send request
|
|
160
|
+
promise = begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)
|
|
161
|
+
|
|
162
|
+
promise = promise.then do |response|
|
|
163
|
+
# Defining deserialization method.
|
|
164
|
+
deserialize_method = lambda do |parsed_response|
|
|
165
|
+
result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::ServerSecurityAlertPolicy.mapper()
|
|
166
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Waiting for response.
|
|
170
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
promise
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
#
|
|
177
|
+
# Creates or updates a threat detection policy.
|
|
178
|
+
#
|
|
179
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
180
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
181
|
+
# Manager API or the portal.
|
|
182
|
+
# @param server_name [String] The name of the server.
|
|
183
|
+
# @param parameters [ServerSecurityAlertPolicy] The server security alert
|
|
184
|
+
# policy.
|
|
185
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
186
|
+
# will be added to the HTTP request.
|
|
187
|
+
#
|
|
188
|
+
# @return [ServerSecurityAlertPolicy] operation results.
|
|
189
|
+
#
|
|
190
|
+
def begin_create_or_update(resource_group_name, server_name, parameters, custom_headers:nil)
|
|
191
|
+
response = begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
|
192
|
+
response.body unless response.nil?
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
#
|
|
196
|
+
# Creates or updates a threat detection policy.
|
|
197
|
+
#
|
|
198
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
199
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
200
|
+
# Manager API or the portal.
|
|
201
|
+
# @param server_name [String] The name of the server.
|
|
202
|
+
# @param parameters [ServerSecurityAlertPolicy] The server security alert
|
|
203
|
+
# policy.
|
|
204
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
205
|
+
# will be added to the HTTP request.
|
|
206
|
+
#
|
|
207
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
208
|
+
#
|
|
209
|
+
def begin_create_or_update_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
|
|
210
|
+
begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
#
|
|
214
|
+
# Creates or updates a threat detection policy.
|
|
215
|
+
#
|
|
216
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
217
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
218
|
+
# Manager API or the portal.
|
|
219
|
+
# @param server_name [String] The name of the server.
|
|
220
|
+
# @param parameters [ServerSecurityAlertPolicy] The server security alert
|
|
221
|
+
# policy.
|
|
222
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
223
|
+
# to the HTTP request.
|
|
224
|
+
#
|
|
225
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
226
|
+
#
|
|
227
|
+
def begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
|
|
228
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
229
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
230
|
+
security_alert_policy_name = 'Default'
|
|
231
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
|
232
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
233
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
request_headers = {}
|
|
237
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
238
|
+
|
|
239
|
+
# Set Headers
|
|
240
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
241
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
242
|
+
|
|
243
|
+
# Serialize Request
|
|
244
|
+
request_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::ServerSecurityAlertPolicy.mapper()
|
|
245
|
+
request_content = @client.serialize(request_mapper, parameters)
|
|
246
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
|
247
|
+
|
|
248
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}'
|
|
249
|
+
|
|
250
|
+
request_url = @base_url || @client.base_url
|
|
251
|
+
|
|
252
|
+
options = {
|
|
253
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
254
|
+
path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'securityAlertPolicyName' => security_alert_policy_name,'subscriptionId' => @client.subscription_id},
|
|
255
|
+
query_params: {'api-version' => @client.api_version},
|
|
256
|
+
body: request_content,
|
|
257
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
258
|
+
base_url: request_url
|
|
259
|
+
}
|
|
260
|
+
promise = @client.make_request_async(:put, path_template, options)
|
|
261
|
+
|
|
262
|
+
promise = promise.then do |result|
|
|
263
|
+
http_response = result.response
|
|
264
|
+
status_code = http_response.status
|
|
265
|
+
response_content = http_response.body
|
|
266
|
+
unless status_code == 200 || status_code == 202
|
|
267
|
+
error_model = JSON.load(response_content)
|
|
268
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
272
|
+
# Deserialize Response
|
|
273
|
+
if status_code == 200
|
|
274
|
+
begin
|
|
275
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
276
|
+
result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::ServerSecurityAlertPolicy.mapper()
|
|
277
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
278
|
+
rescue Exception => e
|
|
279
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
result
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
promise.execute
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
end
|
|
290
|
+
end
|
|
@@ -0,0 +1,900 @@
|
|
|
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
|
|
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 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::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::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::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::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::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
|
+
# Restarts a 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 custom_headers [Hash{String => String}] A hash of custom headers that
|
|
454
|
+
# will be added to the HTTP request.
|
|
455
|
+
#
|
|
456
|
+
def restart(resource_group_name, server_name, custom_headers:nil)
|
|
457
|
+
response = restart_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
|
458
|
+
nil
|
|
459
|
+
end
|
|
460
|
+
|
|
461
|
+
#
|
|
462
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
463
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
464
|
+
# Manager API or the portal.
|
|
465
|
+
# @param server_name [String] The name of the server.
|
|
466
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
467
|
+
# will be added to the HTTP request.
|
|
468
|
+
#
|
|
469
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
|
470
|
+
# response.
|
|
471
|
+
#
|
|
472
|
+
def restart_async(resource_group_name, server_name, custom_headers:nil)
|
|
473
|
+
# Send request
|
|
474
|
+
promise = begin_restart_async(resource_group_name, server_name, custom_headers:custom_headers)
|
|
475
|
+
|
|
476
|
+
promise = promise.then do |response|
|
|
477
|
+
# Defining deserialization method.
|
|
478
|
+
deserialize_method = lambda do |parsed_response|
|
|
479
|
+
end
|
|
480
|
+
|
|
481
|
+
# Waiting for response.
|
|
482
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
|
483
|
+
end
|
|
484
|
+
|
|
485
|
+
promise
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
#
|
|
489
|
+
# Creates a new server, or will overwrite an existing server.
|
|
490
|
+
#
|
|
491
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
492
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
493
|
+
# Manager API or the portal.
|
|
494
|
+
# @param server_name [String] The name of the server.
|
|
495
|
+
# @param parameters [ServerForCreate] The required parameters for creating or
|
|
496
|
+
# updating a server.
|
|
497
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
498
|
+
# will be added to the HTTP request.
|
|
499
|
+
#
|
|
500
|
+
# @return [Server] operation results.
|
|
501
|
+
#
|
|
502
|
+
def begin_create(resource_group_name, server_name, parameters, custom_headers:nil)
|
|
503
|
+
response = begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
|
504
|
+
response.body unless response.nil?
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
#
|
|
508
|
+
# Creates a new server, or will overwrite an existing server.
|
|
509
|
+
#
|
|
510
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
511
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
512
|
+
# Manager API or the portal.
|
|
513
|
+
# @param server_name [String] The name of the server.
|
|
514
|
+
# @param parameters [ServerForCreate] The required parameters for creating or
|
|
515
|
+
# updating a server.
|
|
516
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
517
|
+
# will be added to the HTTP request.
|
|
518
|
+
#
|
|
519
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
520
|
+
#
|
|
521
|
+
def begin_create_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
|
|
522
|
+
begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
|
523
|
+
end
|
|
524
|
+
|
|
525
|
+
#
|
|
526
|
+
# Creates a new server, or will overwrite an existing server.
|
|
527
|
+
#
|
|
528
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
529
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
530
|
+
# Manager API or the portal.
|
|
531
|
+
# @param server_name [String] The name of the server.
|
|
532
|
+
# @param parameters [ServerForCreate] The required parameters for creating or
|
|
533
|
+
# updating a server.
|
|
534
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
535
|
+
# to the HTTP request.
|
|
536
|
+
#
|
|
537
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
538
|
+
#
|
|
539
|
+
def begin_create_async(resource_group_name, server_name, parameters, custom_headers:nil)
|
|
540
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
541
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
542
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
543
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
544
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
request_headers = {}
|
|
548
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
549
|
+
|
|
550
|
+
# Set Headers
|
|
551
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
552
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
553
|
+
|
|
554
|
+
# Serialize Request
|
|
555
|
+
request_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::ServerForCreate.mapper()
|
|
556
|
+
request_content = @client.serialize(request_mapper, parameters)
|
|
557
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
|
558
|
+
|
|
559
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}'
|
|
560
|
+
|
|
561
|
+
request_url = @base_url || @client.base_url
|
|
562
|
+
|
|
563
|
+
options = {
|
|
564
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
565
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
|
566
|
+
query_params: {'api-version' => @client.api_version},
|
|
567
|
+
body: request_content,
|
|
568
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
569
|
+
base_url: request_url
|
|
570
|
+
}
|
|
571
|
+
promise = @client.make_request_async(:put, path_template, options)
|
|
572
|
+
|
|
573
|
+
promise = promise.then do |result|
|
|
574
|
+
http_response = result.response
|
|
575
|
+
status_code = http_response.status
|
|
576
|
+
response_content = http_response.body
|
|
577
|
+
unless status_code == 200 || status_code == 201 || status_code == 202
|
|
578
|
+
error_model = JSON.load(response_content)
|
|
579
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
580
|
+
end
|
|
581
|
+
|
|
582
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
583
|
+
# Deserialize Response
|
|
584
|
+
if status_code == 200
|
|
585
|
+
begin
|
|
586
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
587
|
+
result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::Server.mapper()
|
|
588
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
589
|
+
rescue Exception => e
|
|
590
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
591
|
+
end
|
|
592
|
+
end
|
|
593
|
+
# Deserialize Response
|
|
594
|
+
if status_code == 201
|
|
595
|
+
begin
|
|
596
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
597
|
+
result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::Server.mapper()
|
|
598
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
599
|
+
rescue Exception => e
|
|
600
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
601
|
+
end
|
|
602
|
+
end
|
|
603
|
+
|
|
604
|
+
result
|
|
605
|
+
end
|
|
606
|
+
|
|
607
|
+
promise.execute
|
|
608
|
+
end
|
|
609
|
+
|
|
610
|
+
#
|
|
611
|
+
# Updates an existing server. The request body can contain one to many of the
|
|
612
|
+
# properties present in the normal server definition.
|
|
613
|
+
#
|
|
614
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
615
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
616
|
+
# Manager API or the portal.
|
|
617
|
+
# @param server_name [String] The name of the server.
|
|
618
|
+
# @param parameters [ServerUpdateParameters] The required parameters for
|
|
619
|
+
# updating a server.
|
|
620
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
621
|
+
# will be added to the HTTP request.
|
|
622
|
+
#
|
|
623
|
+
# @return [Server] operation results.
|
|
624
|
+
#
|
|
625
|
+
def begin_update(resource_group_name, server_name, parameters, custom_headers:nil)
|
|
626
|
+
response = begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
|
627
|
+
response.body unless response.nil?
|
|
628
|
+
end
|
|
629
|
+
|
|
630
|
+
#
|
|
631
|
+
# Updates an existing server. The request body can contain one to many of the
|
|
632
|
+
# properties present in the normal server definition.
|
|
633
|
+
#
|
|
634
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
635
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
636
|
+
# Manager API or the portal.
|
|
637
|
+
# @param server_name [String] The name of the server.
|
|
638
|
+
# @param parameters [ServerUpdateParameters] The required parameters for
|
|
639
|
+
# updating a server.
|
|
640
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
641
|
+
# will be added to the HTTP request.
|
|
642
|
+
#
|
|
643
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
644
|
+
#
|
|
645
|
+
def begin_update_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
|
|
646
|
+
begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
|
647
|
+
end
|
|
648
|
+
|
|
649
|
+
#
|
|
650
|
+
# Updates an existing server. The request body can contain one to many of the
|
|
651
|
+
# properties present in the normal server definition.
|
|
652
|
+
#
|
|
653
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
654
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
655
|
+
# Manager API or the portal.
|
|
656
|
+
# @param server_name [String] The name of the server.
|
|
657
|
+
# @param parameters [ServerUpdateParameters] The required parameters for
|
|
658
|
+
# updating a server.
|
|
659
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
660
|
+
# to the HTTP request.
|
|
661
|
+
#
|
|
662
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
663
|
+
#
|
|
664
|
+
def begin_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
|
|
665
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
666
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
667
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
668
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
669
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
request_headers = {}
|
|
673
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
674
|
+
|
|
675
|
+
# Set Headers
|
|
676
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
677
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
678
|
+
|
|
679
|
+
# Serialize Request
|
|
680
|
+
request_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::ServerUpdateParameters.mapper()
|
|
681
|
+
request_content = @client.serialize(request_mapper, parameters)
|
|
682
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
|
683
|
+
|
|
684
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}'
|
|
685
|
+
|
|
686
|
+
request_url = @base_url || @client.base_url
|
|
687
|
+
|
|
688
|
+
options = {
|
|
689
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
690
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
|
691
|
+
query_params: {'api-version' => @client.api_version},
|
|
692
|
+
body: request_content,
|
|
693
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
694
|
+
base_url: request_url
|
|
695
|
+
}
|
|
696
|
+
promise = @client.make_request_async(:patch, path_template, options)
|
|
697
|
+
|
|
698
|
+
promise = promise.then do |result|
|
|
699
|
+
http_response = result.response
|
|
700
|
+
status_code = http_response.status
|
|
701
|
+
response_content = http_response.body
|
|
702
|
+
unless status_code == 200 || status_code == 202
|
|
703
|
+
error_model = JSON.load(response_content)
|
|
704
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
705
|
+
end
|
|
706
|
+
|
|
707
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
708
|
+
# Deserialize Response
|
|
709
|
+
if status_code == 200
|
|
710
|
+
begin
|
|
711
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
712
|
+
result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::Server.mapper()
|
|
713
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
|
714
|
+
rescue Exception => e
|
|
715
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
716
|
+
end
|
|
717
|
+
end
|
|
718
|
+
|
|
719
|
+
result
|
|
720
|
+
end
|
|
721
|
+
|
|
722
|
+
promise.execute
|
|
723
|
+
end
|
|
724
|
+
|
|
725
|
+
#
|
|
726
|
+
# Deletes a server.
|
|
727
|
+
#
|
|
728
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
729
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
730
|
+
# Manager API or the portal.
|
|
731
|
+
# @param server_name [String] The name of the server.
|
|
732
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
733
|
+
# will be added to the HTTP request.
|
|
734
|
+
#
|
|
735
|
+
#
|
|
736
|
+
def begin_delete(resource_group_name, server_name, custom_headers:nil)
|
|
737
|
+
response = begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
|
738
|
+
nil
|
|
739
|
+
end
|
|
740
|
+
|
|
741
|
+
#
|
|
742
|
+
# Deletes a server.
|
|
743
|
+
#
|
|
744
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
745
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
746
|
+
# Manager API or the portal.
|
|
747
|
+
# @param server_name [String] The name of the server.
|
|
748
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
749
|
+
# will be added to the HTTP request.
|
|
750
|
+
#
|
|
751
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
752
|
+
#
|
|
753
|
+
def begin_delete_with_http_info(resource_group_name, server_name, custom_headers:nil)
|
|
754
|
+
begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
|
755
|
+
end
|
|
756
|
+
|
|
757
|
+
#
|
|
758
|
+
# Deletes a server.
|
|
759
|
+
#
|
|
760
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
761
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
762
|
+
# Manager API or the portal.
|
|
763
|
+
# @param server_name [String] The name of the server.
|
|
764
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
765
|
+
# to the HTTP request.
|
|
766
|
+
#
|
|
767
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
768
|
+
#
|
|
769
|
+
def begin_delete_async(resource_group_name, server_name, custom_headers:nil)
|
|
770
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
771
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
772
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
773
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
request_headers = {}
|
|
777
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
778
|
+
|
|
779
|
+
# Set Headers
|
|
780
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
781
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
782
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}'
|
|
783
|
+
|
|
784
|
+
request_url = @base_url || @client.base_url
|
|
785
|
+
|
|
786
|
+
options = {
|
|
787
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
788
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
|
789
|
+
query_params: {'api-version' => @client.api_version},
|
|
790
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
791
|
+
base_url: request_url
|
|
792
|
+
}
|
|
793
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
|
794
|
+
|
|
795
|
+
promise = promise.then do |result|
|
|
796
|
+
http_response = result.response
|
|
797
|
+
status_code = http_response.status
|
|
798
|
+
response_content = http_response.body
|
|
799
|
+
unless status_code == 200 || status_code == 202 || status_code == 204
|
|
800
|
+
error_model = JSON.load(response_content)
|
|
801
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
802
|
+
end
|
|
803
|
+
|
|
804
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
805
|
+
|
|
806
|
+
result
|
|
807
|
+
end
|
|
808
|
+
|
|
809
|
+
promise.execute
|
|
810
|
+
end
|
|
811
|
+
|
|
812
|
+
#
|
|
813
|
+
# Restarts a server.
|
|
814
|
+
#
|
|
815
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
816
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
817
|
+
# Manager API or the portal.
|
|
818
|
+
# @param server_name [String] The name of the server.
|
|
819
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
820
|
+
# will be added to the HTTP request.
|
|
821
|
+
#
|
|
822
|
+
#
|
|
823
|
+
def begin_restart(resource_group_name, server_name, custom_headers:nil)
|
|
824
|
+
response = begin_restart_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
|
825
|
+
nil
|
|
826
|
+
end
|
|
827
|
+
|
|
828
|
+
#
|
|
829
|
+
# Restarts a server.
|
|
830
|
+
#
|
|
831
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
832
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
833
|
+
# Manager API or the portal.
|
|
834
|
+
# @param server_name [String] The name of the server.
|
|
835
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
836
|
+
# will be added to the HTTP request.
|
|
837
|
+
#
|
|
838
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
839
|
+
#
|
|
840
|
+
def begin_restart_with_http_info(resource_group_name, server_name, custom_headers:nil)
|
|
841
|
+
begin_restart_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
|
842
|
+
end
|
|
843
|
+
|
|
844
|
+
#
|
|
845
|
+
# Restarts a server.
|
|
846
|
+
#
|
|
847
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
848
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
849
|
+
# Manager API or the portal.
|
|
850
|
+
# @param server_name [String] The name of the server.
|
|
851
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
852
|
+
# to the HTTP request.
|
|
853
|
+
#
|
|
854
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
855
|
+
#
|
|
856
|
+
def begin_restart_async(resource_group_name, server_name, custom_headers:nil)
|
|
857
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
858
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
859
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
860
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
request_headers = {}
|
|
864
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
865
|
+
|
|
866
|
+
# Set Headers
|
|
867
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
868
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
869
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart'
|
|
870
|
+
|
|
871
|
+
request_url = @base_url || @client.base_url
|
|
872
|
+
|
|
873
|
+
options = {
|
|
874
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
875
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
|
876
|
+
query_params: {'api-version' => @client.api_version},
|
|
877
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
878
|
+
base_url: request_url
|
|
879
|
+
}
|
|
880
|
+
promise = @client.make_request_async(:post, path_template, options)
|
|
881
|
+
|
|
882
|
+
promise = promise.then do |result|
|
|
883
|
+
http_response = result.response
|
|
884
|
+
status_code = http_response.status
|
|
885
|
+
response_content = http_response.body
|
|
886
|
+
unless status_code == 200 || status_code == 202
|
|
887
|
+
error_model = JSON.load(response_content)
|
|
888
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
889
|
+
end
|
|
890
|
+
|
|
891
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
892
|
+
|
|
893
|
+
result
|
|
894
|
+
end
|
|
895
|
+
|
|
896
|
+
promise.execute
|
|
897
|
+
end
|
|
898
|
+
|
|
899
|
+
end
|
|
900
|
+
end
|