azure_mgmt_mysql 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql.rb +79 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/check_name_availability.rb +128 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/configurations.rb +402 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/databases.rb +549 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/firewall_rules.rb +549 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/location_based_performance_tier.rb +118 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/log_files.rb +128 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/configuration.rb +132 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/configuration_list_result.rb +55 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/database.rb +84 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/database_list_result.rb +55 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/firewall_rule.rb +92 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/firewall_rule_list_result.rb +55 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/geo_redundant_backup.rb +16 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/log_file.rb +119 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/log_file_list_result.rb +55 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/name_availability.rb +68 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/name_availability_request.rb +57 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/operation.rb +95 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/operation_display.rb +83 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/operation_list_result.rb +55 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/operation_origin.rb +17 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/performance_tier_list_result.rb +56 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/performance_tier_properties.rb +67 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/performance_tier_service_level_objectives.rb +126 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/proxy_resource.rb +71 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server.rb +220 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_for_create.rb +92 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_list_result.rb +55 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_properties_for_create.rb +86 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_properties_for_default_create.rb +100 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_properties_for_geo_restore.rb +88 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_properties_for_replica.rb +87 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_properties_for_restore.rb +99 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_security_alert_policy.rb +166 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_security_alert_policy_state.rb +16 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_state.rb +17 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_update_parameters.rb +126 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/server_version.rb +16 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/sku.rb +97 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/sku_tier.rb +17 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/ssl_enforcement_enum.rb +16 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/storage_autogrow.rb +16 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/storage_profile.rb +81 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/tracked_resource.rb +93 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/virtual_network_rule.rb +99 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/virtual_network_rule_list_result.rb +100 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/models/virtual_network_rule_state.rb +19 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/module_definition.rb +9 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/my_sqlmanagement_client.rb +172 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/operations.rb +112 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/replicas.rb +128 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/server_security_alert_policies.rb +294 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/servers.rb +918 -0
- data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/virtual_network_rules.rb +676 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql.rb +79 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/check_name_availability.rb +128 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/configurations.rb +402 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/databases.rb +549 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/firewall_rules.rb +549 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/location_based_performance_tier.rb +118 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/log_files.rb +128 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/configuration.rb +132 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/configuration_list_result.rb +55 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/database.rb +84 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/database_list_result.rb +55 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/firewall_rule.rb +92 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/firewall_rule_list_result.rb +55 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/geo_redundant_backup.rb +16 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/log_file.rb +119 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/log_file_list_result.rb +55 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/name_availability.rb +68 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/name_availability_request.rb +57 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/operation.rb +95 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/operation_display.rb +83 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/operation_list_result.rb +55 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/operation_origin.rb +17 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/performance_tier_list_result.rb +56 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/performance_tier_properties.rb +67 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/performance_tier_service_level_objectives.rb +126 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/proxy_resource.rb +71 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server.rb +220 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_for_create.rb +92 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_list_result.rb +55 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_properties_for_create.rb +86 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_properties_for_default_create.rb +100 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_properties_for_geo_restore.rb +88 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_properties_for_replica.rb +87 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_properties_for_restore.rb +99 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_security_alert_policy.rb +166 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_security_alert_policy_state.rb +16 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_state.rb +17 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_update_parameters.rb +126 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/server_version.rb +16 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/sku.rb +97 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/sku_tier.rb +17 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/ssl_enforcement_enum.rb +16 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/storage_autogrow.rb +16 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/storage_profile.rb +81 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/tracked_resource.rb +93 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/virtual_network_rule.rb +99 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/virtual_network_rule_list_result.rb +100 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/models/virtual_network_rule_state.rb +19 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/module_definition.rb +9 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/my_sqlmanagement_client.rb +172 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/operations.rb +112 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/replicas.rb +128 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/server_security_alert_policies.rb +294 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/servers.rb +918 -0
- data/lib/2017-12-01/generated/azure_mgmt_mysql/virtual_network_rules.rb +676 -0
- data/lib/azure_mgmt_mysql.rb +7 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/modules/mysql_profile_module.rb +245 -0
- data/lib/profiles/latest/mysql_latest_profile_client.rb +40 -0
- data/lib/profiles/latest/mysql_module_definition.rb +8 -0
- data/lib/version.rb +7 -0
- metadata +234 -0
@@ -0,0 +1,128 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::Mysql::Mgmt::V2017_12_01_preview
|
7
|
+
#
|
8
|
+
# The Microsoft Azure management API provides create, read, update, and
|
9
|
+
# delete functionality for Azure MySQL resources including servers,
|
10
|
+
# databases, firewall rules, VNET rules, log files and configurations with
|
11
|
+
# new business model.
|
12
|
+
#
|
13
|
+
class 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 [MySQLManagementClient] reference to the MySQLManagementClient
|
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.DBforMySQL/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
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
109
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
110
|
+
# Deserialize Response
|
111
|
+
if status_code == 200
|
112
|
+
begin
|
113
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
114
|
+
result_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::ServerListResult.mapper()
|
115
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
116
|
+
rescue Exception => e
|
117
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
result
|
122
|
+
end
|
123
|
+
|
124
|
+
promise.execute
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,294 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::Mysql::Mgmt::V2017_12_01_preview
|
7
|
+
#
|
8
|
+
# The Microsoft Azure management API provides create, read, update, and
|
9
|
+
# delete functionality for Azure MySQL resources including servers,
|
10
|
+
# databases, firewall rules, VNET rules, log files and configurations with
|
11
|
+
# new business model.
|
12
|
+
#
|
13
|
+
class 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 [MySQLManagementClient] reference to the MySQLManagementClient
|
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.DBforMySQL/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
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
110
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
111
|
+
# Deserialize Response
|
112
|
+
if status_code == 200
|
113
|
+
begin
|
114
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
115
|
+
result_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::ServerSecurityAlertPolicy.mapper()
|
116
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
117
|
+
rescue Exception => e
|
118
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
result
|
123
|
+
end
|
124
|
+
|
125
|
+
promise.execute
|
126
|
+
end
|
127
|
+
|
128
|
+
#
|
129
|
+
# Creates or updates a threat detection policy.
|
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 parameters [ServerSecurityAlertPolicy] The server security alert
|
136
|
+
# policy.
|
137
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
138
|
+
# will be added to the HTTP request.
|
139
|
+
#
|
140
|
+
# @return [ServerSecurityAlertPolicy] operation results.
|
141
|
+
#
|
142
|
+
def create_or_update(resource_group_name, server_name, parameters, custom_headers:nil)
|
143
|
+
response = create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
144
|
+
response.body unless response.nil?
|
145
|
+
end
|
146
|
+
|
147
|
+
#
|
148
|
+
# @param resource_group_name [String] The name of the resource group that
|
149
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
150
|
+
# Manager API or the portal.
|
151
|
+
# @param server_name [String] The name of the server.
|
152
|
+
# @param parameters [ServerSecurityAlertPolicy] The server security alert
|
153
|
+
# policy.
|
154
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
155
|
+
# will be added to the HTTP request.
|
156
|
+
#
|
157
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
158
|
+
# response.
|
159
|
+
#
|
160
|
+
def create_or_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
|
161
|
+
# Send request
|
162
|
+
promise = begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)
|
163
|
+
|
164
|
+
promise = promise.then do |response|
|
165
|
+
# Defining deserialization method.
|
166
|
+
deserialize_method = lambda do |parsed_response|
|
167
|
+
result_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::ServerSecurityAlertPolicy.mapper()
|
168
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
169
|
+
end
|
170
|
+
|
171
|
+
# Waiting for response.
|
172
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
173
|
+
end
|
174
|
+
|
175
|
+
promise
|
176
|
+
end
|
177
|
+
|
178
|
+
#
|
179
|
+
# Creates or updates a threat detection policy.
|
180
|
+
#
|
181
|
+
# @param resource_group_name [String] The name of the resource group that
|
182
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
183
|
+
# Manager API or the portal.
|
184
|
+
# @param server_name [String] The name of the server.
|
185
|
+
# @param parameters [ServerSecurityAlertPolicy] The server security alert
|
186
|
+
# policy.
|
187
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
188
|
+
# will be added to the HTTP request.
|
189
|
+
#
|
190
|
+
# @return [ServerSecurityAlertPolicy] operation results.
|
191
|
+
#
|
192
|
+
def begin_create_or_update(resource_group_name, server_name, parameters, custom_headers:nil)
|
193
|
+
response = begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
194
|
+
response.body unless response.nil?
|
195
|
+
end
|
196
|
+
|
197
|
+
#
|
198
|
+
# Creates or updates a threat detection policy.
|
199
|
+
#
|
200
|
+
# @param resource_group_name [String] The name of the resource group that
|
201
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
202
|
+
# Manager API or the portal.
|
203
|
+
# @param server_name [String] The name of the server.
|
204
|
+
# @param parameters [ServerSecurityAlertPolicy] The server security alert
|
205
|
+
# policy.
|
206
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
207
|
+
# will be added to the HTTP request.
|
208
|
+
#
|
209
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
210
|
+
#
|
211
|
+
def begin_create_or_update_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
|
212
|
+
begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
213
|
+
end
|
214
|
+
|
215
|
+
#
|
216
|
+
# Creates or updates a threat detection policy.
|
217
|
+
#
|
218
|
+
# @param resource_group_name [String] The name of the resource group that
|
219
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
220
|
+
# Manager API or the portal.
|
221
|
+
# @param server_name [String] The name of the server.
|
222
|
+
# @param parameters [ServerSecurityAlertPolicy] The server security alert
|
223
|
+
# policy.
|
224
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
225
|
+
# to the HTTP request.
|
226
|
+
#
|
227
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
228
|
+
#
|
229
|
+
def begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
|
230
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
231
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
232
|
+
security_alert_policy_name = 'Default'
|
233
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
234
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
235
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
236
|
+
|
237
|
+
|
238
|
+
request_headers = {}
|
239
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
240
|
+
|
241
|
+
# Set Headers
|
242
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
243
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
244
|
+
|
245
|
+
# Serialize Request
|
246
|
+
request_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::ServerSecurityAlertPolicy.mapper()
|
247
|
+
request_content = @client.serialize(request_mapper, parameters)
|
248
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
249
|
+
|
250
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}'
|
251
|
+
|
252
|
+
request_url = @base_url || @client.base_url
|
253
|
+
|
254
|
+
options = {
|
255
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
256
|
+
path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'securityAlertPolicyName' => security_alert_policy_name,'subscriptionId' => @client.subscription_id},
|
257
|
+
query_params: {'api-version' => @client.api_version},
|
258
|
+
body: request_content,
|
259
|
+
headers: request_headers.merge(custom_headers || {}),
|
260
|
+
base_url: request_url
|
261
|
+
}
|
262
|
+
promise = @client.make_request_async(:put, path_template, options)
|
263
|
+
|
264
|
+
promise = promise.then do |result|
|
265
|
+
http_response = result.response
|
266
|
+
status_code = http_response.status
|
267
|
+
response_content = http_response.body
|
268
|
+
unless status_code == 200 || status_code == 202
|
269
|
+
error_model = JSON.load(response_content)
|
270
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
271
|
+
end
|
272
|
+
|
273
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
274
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
275
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
276
|
+
# Deserialize Response
|
277
|
+
if status_code == 200
|
278
|
+
begin
|
279
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
280
|
+
result_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::ServerSecurityAlertPolicy.mapper()
|
281
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
282
|
+
rescue Exception => e
|
283
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
result
|
288
|
+
end
|
289
|
+
|
290
|
+
promise.execute
|
291
|
+
end
|
292
|
+
|
293
|
+
end
|
294
|
+
end
|
@@ -0,0 +1,918 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::Mysql::Mgmt::V2017_12_01_preview
|
7
|
+
#
|
8
|
+
# The Microsoft Azure management API provides create, read, update, and
|
9
|
+
# delete functionality for Azure MySQL resources including servers,
|
10
|
+
# databases, firewall rules, VNET rules, log files and configurations with
|
11
|
+
# new business model.
|
12
|
+
#
|
13
|
+
class 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 [MySQLManagementClient] reference to the MySQLManagementClient
|
25
|
+
attr_reader :client
|
26
|
+
|
27
|
+
#
|
28
|
+
# Creates a new server or updates an existing server. The update action will
|
29
|
+
# overwrite the existing server.
|
30
|
+
#
|
31
|
+
# @param resource_group_name [String] The name of the resource group that
|
32
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
33
|
+
# Manager API or the portal.
|
34
|
+
# @param server_name [String] The name of the server.
|
35
|
+
# @param parameters [ServerForCreate] The required parameters for creating or
|
36
|
+
# updating a server.
|
37
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
38
|
+
# will be added to the HTTP request.
|
39
|
+
#
|
40
|
+
# @return [Server] operation results.
|
41
|
+
#
|
42
|
+
def create(resource_group_name, server_name, parameters, custom_headers:nil)
|
43
|
+
response = create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
44
|
+
response.body unless response.nil?
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# @param resource_group_name [String] The name of the resource group that
|
49
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
50
|
+
# Manager API or the portal.
|
51
|
+
# @param server_name [String] The name of the server.
|
52
|
+
# @param parameters [ServerForCreate] The required parameters for creating or
|
53
|
+
# updating a server.
|
54
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
55
|
+
# will be added to the HTTP request.
|
56
|
+
#
|
57
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
58
|
+
# response.
|
59
|
+
#
|
60
|
+
def create_async(resource_group_name, server_name, parameters, custom_headers:nil)
|
61
|
+
# Send request
|
62
|
+
promise = begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)
|
63
|
+
|
64
|
+
promise = promise.then do |response|
|
65
|
+
# Defining deserialization method.
|
66
|
+
deserialize_method = lambda do |parsed_response|
|
67
|
+
result_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::Server.mapper()
|
68
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Waiting for response.
|
72
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
73
|
+
end
|
74
|
+
|
75
|
+
promise
|
76
|
+
end
|
77
|
+
|
78
|
+
#
|
79
|
+
# Updates an existing server. The request body can contain one to many of the
|
80
|
+
# properties present in the normal server definition.
|
81
|
+
#
|
82
|
+
# @param resource_group_name [String] The name of the resource group that
|
83
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
84
|
+
# Manager API or the portal.
|
85
|
+
# @param server_name [String] The name of the server.
|
86
|
+
# @param parameters [ServerUpdateParameters] The required parameters for
|
87
|
+
# updating a server.
|
88
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
89
|
+
# will be added to the HTTP request.
|
90
|
+
#
|
91
|
+
# @return [Server] operation results.
|
92
|
+
#
|
93
|
+
def update(resource_group_name, server_name, parameters, custom_headers:nil)
|
94
|
+
response = update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
95
|
+
response.body unless response.nil?
|
96
|
+
end
|
97
|
+
|
98
|
+
#
|
99
|
+
# @param resource_group_name [String] The name of the resource group that
|
100
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
101
|
+
# Manager API or the portal.
|
102
|
+
# @param server_name [String] The name of the server.
|
103
|
+
# @param parameters [ServerUpdateParameters] The required parameters for
|
104
|
+
# updating a server.
|
105
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
106
|
+
# will be added to the HTTP request.
|
107
|
+
#
|
108
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
109
|
+
# response.
|
110
|
+
#
|
111
|
+
def update_async(resource_group_name, server_name, parameters, custom_headers:nil)
|
112
|
+
# Send request
|
113
|
+
promise = begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)
|
114
|
+
|
115
|
+
promise = promise.then do |response|
|
116
|
+
# Defining deserialization method.
|
117
|
+
deserialize_method = lambda do |parsed_response|
|
118
|
+
result_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::Server.mapper()
|
119
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Waiting for response.
|
123
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
124
|
+
end
|
125
|
+
|
126
|
+
promise
|
127
|
+
end
|
128
|
+
|
129
|
+
#
|
130
|
+
# Deletes a server.
|
131
|
+
#
|
132
|
+
# @param resource_group_name [String] The name of the resource group that
|
133
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
134
|
+
# Manager API or the portal.
|
135
|
+
# @param server_name [String] The name of the server.
|
136
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
137
|
+
# will be added to the HTTP request.
|
138
|
+
#
|
139
|
+
def delete(resource_group_name, server_name, custom_headers:nil)
|
140
|
+
response = delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
141
|
+
nil
|
142
|
+
end
|
143
|
+
|
144
|
+
#
|
145
|
+
# @param resource_group_name [String] The name of the resource group that
|
146
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
147
|
+
# Manager API or the portal.
|
148
|
+
# @param server_name [String] The name of the server.
|
149
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
150
|
+
# will be added to the HTTP request.
|
151
|
+
#
|
152
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
153
|
+
# response.
|
154
|
+
#
|
155
|
+
def delete_async(resource_group_name, server_name, custom_headers:nil)
|
156
|
+
# Send request
|
157
|
+
promise = begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers)
|
158
|
+
|
159
|
+
promise = promise.then do |response|
|
160
|
+
# Defining deserialization method.
|
161
|
+
deserialize_method = lambda do |parsed_response|
|
162
|
+
end
|
163
|
+
|
164
|
+
# Waiting for response.
|
165
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
166
|
+
end
|
167
|
+
|
168
|
+
promise
|
169
|
+
end
|
170
|
+
|
171
|
+
#
|
172
|
+
# Gets information about a server.
|
173
|
+
#
|
174
|
+
# @param resource_group_name [String] The name of the resource group that
|
175
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
176
|
+
# Manager API or the portal.
|
177
|
+
# @param server_name [String] The name of the server.
|
178
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
179
|
+
# will be added to the HTTP request.
|
180
|
+
#
|
181
|
+
# @return [Server] operation results.
|
182
|
+
#
|
183
|
+
def get(resource_group_name, server_name, custom_headers:nil)
|
184
|
+
response = get_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
185
|
+
response.body unless response.nil?
|
186
|
+
end
|
187
|
+
|
188
|
+
#
|
189
|
+
# Gets information about a server.
|
190
|
+
#
|
191
|
+
# @param resource_group_name [String] The name of the resource group that
|
192
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
193
|
+
# Manager API or the portal.
|
194
|
+
# @param server_name [String] The name of the server.
|
195
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
196
|
+
# will be added to the HTTP request.
|
197
|
+
#
|
198
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
199
|
+
#
|
200
|
+
def get_with_http_info(resource_group_name, server_name, custom_headers:nil)
|
201
|
+
get_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
202
|
+
end
|
203
|
+
|
204
|
+
#
|
205
|
+
# Gets information about a server.
|
206
|
+
#
|
207
|
+
# @param resource_group_name [String] The name of the resource group that
|
208
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
209
|
+
# Manager API or the portal.
|
210
|
+
# @param server_name [String] The name of the server.
|
211
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
212
|
+
# to the HTTP request.
|
213
|
+
#
|
214
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
215
|
+
#
|
216
|
+
def get_async(resource_group_name, server_name, custom_headers:nil)
|
217
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
218
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
219
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
220
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
221
|
+
|
222
|
+
|
223
|
+
request_headers = {}
|
224
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
225
|
+
|
226
|
+
# Set Headers
|
227
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
228
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
229
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}'
|
230
|
+
|
231
|
+
request_url = @base_url || @client.base_url
|
232
|
+
|
233
|
+
options = {
|
234
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
235
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
236
|
+
query_params: {'api-version' => @client.api_version},
|
237
|
+
headers: request_headers.merge(custom_headers || {}),
|
238
|
+
base_url: request_url
|
239
|
+
}
|
240
|
+
promise = @client.make_request_async(:get, path_template, options)
|
241
|
+
|
242
|
+
promise = promise.then do |result|
|
243
|
+
http_response = result.response
|
244
|
+
status_code = http_response.status
|
245
|
+
response_content = http_response.body
|
246
|
+
unless status_code == 200
|
247
|
+
error_model = JSON.load(response_content)
|
248
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
249
|
+
end
|
250
|
+
|
251
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
252
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
253
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
254
|
+
# Deserialize Response
|
255
|
+
if status_code == 200
|
256
|
+
begin
|
257
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
258
|
+
result_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::Server.mapper()
|
259
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
260
|
+
rescue Exception => e
|
261
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
result
|
266
|
+
end
|
267
|
+
|
268
|
+
promise.execute
|
269
|
+
end
|
270
|
+
|
271
|
+
#
|
272
|
+
# List all the servers in a given resource group.
|
273
|
+
#
|
274
|
+
# @param resource_group_name [String] The name of the resource group that
|
275
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
276
|
+
# Manager API or the portal.
|
277
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
278
|
+
# will be added to the HTTP request.
|
279
|
+
#
|
280
|
+
# @return [ServerListResult] operation results.
|
281
|
+
#
|
282
|
+
def list_by_resource_group(resource_group_name, custom_headers:nil)
|
283
|
+
response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
|
284
|
+
response.body unless response.nil?
|
285
|
+
end
|
286
|
+
|
287
|
+
#
|
288
|
+
# List all the servers in a given resource group.
|
289
|
+
#
|
290
|
+
# @param resource_group_name [String] The name of the resource group that
|
291
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
292
|
+
# Manager API or the portal.
|
293
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
294
|
+
# will be added to the HTTP request.
|
295
|
+
#
|
296
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
297
|
+
#
|
298
|
+
def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
|
299
|
+
list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
|
300
|
+
end
|
301
|
+
|
302
|
+
#
|
303
|
+
# List all the servers in a given resource group.
|
304
|
+
#
|
305
|
+
# @param resource_group_name [String] The name of the resource group that
|
306
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
307
|
+
# Manager API or the portal.
|
308
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
309
|
+
# to the HTTP request.
|
310
|
+
#
|
311
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
312
|
+
#
|
313
|
+
def list_by_resource_group_async(resource_group_name, custom_headers:nil)
|
314
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
315
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
316
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
317
|
+
|
318
|
+
|
319
|
+
request_headers = {}
|
320
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
321
|
+
|
322
|
+
# Set Headers
|
323
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
324
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
325
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers'
|
326
|
+
|
327
|
+
request_url = @base_url || @client.base_url
|
328
|
+
|
329
|
+
options = {
|
330
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
331
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
|
332
|
+
query_params: {'api-version' => @client.api_version},
|
333
|
+
headers: request_headers.merge(custom_headers || {}),
|
334
|
+
base_url: request_url
|
335
|
+
}
|
336
|
+
promise = @client.make_request_async(:get, path_template, options)
|
337
|
+
|
338
|
+
promise = promise.then do |result|
|
339
|
+
http_response = result.response
|
340
|
+
status_code = http_response.status
|
341
|
+
response_content = http_response.body
|
342
|
+
unless status_code == 200
|
343
|
+
error_model = JSON.load(response_content)
|
344
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
345
|
+
end
|
346
|
+
|
347
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
348
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
349
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
350
|
+
# Deserialize Response
|
351
|
+
if status_code == 200
|
352
|
+
begin
|
353
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
354
|
+
result_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::ServerListResult.mapper()
|
355
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
356
|
+
rescue Exception => e
|
357
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
result
|
362
|
+
end
|
363
|
+
|
364
|
+
promise.execute
|
365
|
+
end
|
366
|
+
|
367
|
+
#
|
368
|
+
# List all the servers in a given subscription.
|
369
|
+
#
|
370
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
371
|
+
# will be added to the HTTP request.
|
372
|
+
#
|
373
|
+
# @return [ServerListResult] operation results.
|
374
|
+
#
|
375
|
+
def list(custom_headers:nil)
|
376
|
+
response = list_async(custom_headers:custom_headers).value!
|
377
|
+
response.body unless response.nil?
|
378
|
+
end
|
379
|
+
|
380
|
+
#
|
381
|
+
# List all the servers in a given subscription.
|
382
|
+
#
|
383
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
384
|
+
# will be added to the HTTP request.
|
385
|
+
#
|
386
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
387
|
+
#
|
388
|
+
def list_with_http_info(custom_headers:nil)
|
389
|
+
list_async(custom_headers:custom_headers).value!
|
390
|
+
end
|
391
|
+
|
392
|
+
#
|
393
|
+
# List all the servers in a given subscription.
|
394
|
+
#
|
395
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
396
|
+
# to the HTTP request.
|
397
|
+
#
|
398
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
399
|
+
#
|
400
|
+
def list_async(custom_headers:nil)
|
401
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
402
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
403
|
+
|
404
|
+
|
405
|
+
request_headers = {}
|
406
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
407
|
+
|
408
|
+
# Set Headers
|
409
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
410
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
411
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/servers'
|
412
|
+
|
413
|
+
request_url = @base_url || @client.base_url
|
414
|
+
|
415
|
+
options = {
|
416
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
417
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
418
|
+
query_params: {'api-version' => @client.api_version},
|
419
|
+
headers: request_headers.merge(custom_headers || {}),
|
420
|
+
base_url: request_url
|
421
|
+
}
|
422
|
+
promise = @client.make_request_async(:get, path_template, options)
|
423
|
+
|
424
|
+
promise = promise.then do |result|
|
425
|
+
http_response = result.response
|
426
|
+
status_code = http_response.status
|
427
|
+
response_content = http_response.body
|
428
|
+
unless status_code == 200
|
429
|
+
error_model = JSON.load(response_content)
|
430
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
431
|
+
end
|
432
|
+
|
433
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
434
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
435
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
436
|
+
# Deserialize Response
|
437
|
+
if status_code == 200
|
438
|
+
begin
|
439
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
440
|
+
result_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::ServerListResult.mapper()
|
441
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
442
|
+
rescue Exception => e
|
443
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
result
|
448
|
+
end
|
449
|
+
|
450
|
+
promise.execute
|
451
|
+
end
|
452
|
+
|
453
|
+
#
|
454
|
+
# Restarts a server.
|
455
|
+
#
|
456
|
+
# @param resource_group_name [String] The name of the resource group that
|
457
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
458
|
+
# Manager API or the portal.
|
459
|
+
# @param server_name [String] The name of the server.
|
460
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
461
|
+
# will be added to the HTTP request.
|
462
|
+
#
|
463
|
+
def restart(resource_group_name, server_name, custom_headers:nil)
|
464
|
+
response = restart_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
465
|
+
nil
|
466
|
+
end
|
467
|
+
|
468
|
+
#
|
469
|
+
# @param resource_group_name [String] The name of the resource group that
|
470
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
471
|
+
# Manager API or the portal.
|
472
|
+
# @param server_name [String] The name of the server.
|
473
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
474
|
+
# will be added to the HTTP request.
|
475
|
+
#
|
476
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
477
|
+
# response.
|
478
|
+
#
|
479
|
+
def restart_async(resource_group_name, server_name, custom_headers:nil)
|
480
|
+
# Send request
|
481
|
+
promise = begin_restart_async(resource_group_name, server_name, custom_headers:custom_headers)
|
482
|
+
|
483
|
+
promise = promise.then do |response|
|
484
|
+
# Defining deserialization method.
|
485
|
+
deserialize_method = lambda do |parsed_response|
|
486
|
+
end
|
487
|
+
|
488
|
+
# Waiting for response.
|
489
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
490
|
+
end
|
491
|
+
|
492
|
+
promise
|
493
|
+
end
|
494
|
+
|
495
|
+
#
|
496
|
+
# Creates a new server or updates an existing server. The update action will
|
497
|
+
# overwrite the existing server.
|
498
|
+
#
|
499
|
+
# @param resource_group_name [String] The name of the resource group that
|
500
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
501
|
+
# Manager API or the portal.
|
502
|
+
# @param server_name [String] The name of the server.
|
503
|
+
# @param parameters [ServerForCreate] The required parameters for creating or
|
504
|
+
# updating a server.
|
505
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
506
|
+
# will be added to the HTTP request.
|
507
|
+
#
|
508
|
+
# @return [Server] operation results.
|
509
|
+
#
|
510
|
+
def begin_create(resource_group_name, server_name, parameters, custom_headers:nil)
|
511
|
+
response = begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
512
|
+
response.body unless response.nil?
|
513
|
+
end
|
514
|
+
|
515
|
+
#
|
516
|
+
# Creates a new server or updates an existing server. The update action will
|
517
|
+
# overwrite the existing server.
|
518
|
+
#
|
519
|
+
# @param resource_group_name [String] The name of the resource group that
|
520
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
521
|
+
# Manager API or the portal.
|
522
|
+
# @param server_name [String] The name of the server.
|
523
|
+
# @param parameters [ServerForCreate] The required parameters for creating or
|
524
|
+
# updating a server.
|
525
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
526
|
+
# will be added to the HTTP request.
|
527
|
+
#
|
528
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
529
|
+
#
|
530
|
+
def begin_create_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
|
531
|
+
begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
532
|
+
end
|
533
|
+
|
534
|
+
#
|
535
|
+
# Creates a new server or updates an existing server. The update action will
|
536
|
+
# overwrite the existing server.
|
537
|
+
#
|
538
|
+
# @param resource_group_name [String] The name of the resource group that
|
539
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
540
|
+
# Manager API or the portal.
|
541
|
+
# @param server_name [String] The name of the server.
|
542
|
+
# @param parameters [ServerForCreate] The required parameters for creating or
|
543
|
+
# updating a server.
|
544
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
545
|
+
# to the HTTP request.
|
546
|
+
#
|
547
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
548
|
+
#
|
549
|
+
def begin_create_async(resource_group_name, server_name, parameters, custom_headers:nil)
|
550
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
551
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
552
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
553
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
554
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
555
|
+
|
556
|
+
|
557
|
+
request_headers = {}
|
558
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
559
|
+
|
560
|
+
# Set Headers
|
561
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
562
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
563
|
+
|
564
|
+
# Serialize Request
|
565
|
+
request_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::ServerForCreate.mapper()
|
566
|
+
request_content = @client.serialize(request_mapper, parameters)
|
567
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
568
|
+
|
569
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}'
|
570
|
+
|
571
|
+
request_url = @base_url || @client.base_url
|
572
|
+
|
573
|
+
options = {
|
574
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
575
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
576
|
+
query_params: {'api-version' => @client.api_version},
|
577
|
+
body: request_content,
|
578
|
+
headers: request_headers.merge(custom_headers || {}),
|
579
|
+
base_url: request_url
|
580
|
+
}
|
581
|
+
promise = @client.make_request_async(:put, path_template, options)
|
582
|
+
|
583
|
+
promise = promise.then do |result|
|
584
|
+
http_response = result.response
|
585
|
+
status_code = http_response.status
|
586
|
+
response_content = http_response.body
|
587
|
+
unless status_code == 200 || status_code == 201 || status_code == 202
|
588
|
+
error_model = JSON.load(response_content)
|
589
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
590
|
+
end
|
591
|
+
|
592
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
593
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
594
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
595
|
+
# Deserialize Response
|
596
|
+
if status_code == 200
|
597
|
+
begin
|
598
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
599
|
+
result_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::Server.mapper()
|
600
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
601
|
+
rescue Exception => e
|
602
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
603
|
+
end
|
604
|
+
end
|
605
|
+
# Deserialize Response
|
606
|
+
if status_code == 201
|
607
|
+
begin
|
608
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
609
|
+
result_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::Server.mapper()
|
610
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
611
|
+
rescue Exception => e
|
612
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
613
|
+
end
|
614
|
+
end
|
615
|
+
|
616
|
+
result
|
617
|
+
end
|
618
|
+
|
619
|
+
promise.execute
|
620
|
+
end
|
621
|
+
|
622
|
+
#
|
623
|
+
# Updates an existing server. The request body can contain one to many of the
|
624
|
+
# properties present in the normal server definition.
|
625
|
+
#
|
626
|
+
# @param resource_group_name [String] The name of the resource group that
|
627
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
628
|
+
# Manager API or the portal.
|
629
|
+
# @param server_name [String] The name of the server.
|
630
|
+
# @param parameters [ServerUpdateParameters] The required parameters for
|
631
|
+
# updating a server.
|
632
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
633
|
+
# will be added to the HTTP request.
|
634
|
+
#
|
635
|
+
# @return [Server] operation results.
|
636
|
+
#
|
637
|
+
def begin_update(resource_group_name, server_name, parameters, custom_headers:nil)
|
638
|
+
response = begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
639
|
+
response.body unless response.nil?
|
640
|
+
end
|
641
|
+
|
642
|
+
#
|
643
|
+
# Updates an existing server. The request body can contain one to many of the
|
644
|
+
# properties present in the normal server definition.
|
645
|
+
#
|
646
|
+
# @param resource_group_name [String] The name of the resource group that
|
647
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
648
|
+
# Manager API or the portal.
|
649
|
+
# @param server_name [String] The name of the server.
|
650
|
+
# @param parameters [ServerUpdateParameters] The required parameters for
|
651
|
+
# updating a server.
|
652
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
653
|
+
# will be added to the HTTP request.
|
654
|
+
#
|
655
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
656
|
+
#
|
657
|
+
def begin_update_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
|
658
|
+
begin_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
|
659
|
+
end
|
660
|
+
|
661
|
+
#
|
662
|
+
# Updates an existing server. The request body can contain one to many of the
|
663
|
+
# properties present in the normal server definition.
|
664
|
+
#
|
665
|
+
# @param resource_group_name [String] The name of the resource group that
|
666
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
667
|
+
# Manager API or the portal.
|
668
|
+
# @param server_name [String] The name of the server.
|
669
|
+
# @param parameters [ServerUpdateParameters] The required parameters for
|
670
|
+
# updating a server.
|
671
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
672
|
+
# to the HTTP request.
|
673
|
+
#
|
674
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
675
|
+
#
|
676
|
+
def begin_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
|
677
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
678
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
679
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
680
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
681
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
682
|
+
|
683
|
+
|
684
|
+
request_headers = {}
|
685
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
686
|
+
|
687
|
+
# Set Headers
|
688
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
689
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
690
|
+
|
691
|
+
# Serialize Request
|
692
|
+
request_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::ServerUpdateParameters.mapper()
|
693
|
+
request_content = @client.serialize(request_mapper, parameters)
|
694
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
695
|
+
|
696
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}'
|
697
|
+
|
698
|
+
request_url = @base_url || @client.base_url
|
699
|
+
|
700
|
+
options = {
|
701
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
702
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
703
|
+
query_params: {'api-version' => @client.api_version},
|
704
|
+
body: request_content,
|
705
|
+
headers: request_headers.merge(custom_headers || {}),
|
706
|
+
base_url: request_url
|
707
|
+
}
|
708
|
+
promise = @client.make_request_async(:patch, path_template, options)
|
709
|
+
|
710
|
+
promise = promise.then do |result|
|
711
|
+
http_response = result.response
|
712
|
+
status_code = http_response.status
|
713
|
+
response_content = http_response.body
|
714
|
+
unless status_code == 200 || status_code == 202
|
715
|
+
error_model = JSON.load(response_content)
|
716
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
717
|
+
end
|
718
|
+
|
719
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
720
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
721
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
722
|
+
# Deserialize Response
|
723
|
+
if status_code == 200
|
724
|
+
begin
|
725
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
726
|
+
result_mapper = Azure::Mysql::Mgmt::V2017_12_01_preview::Models::Server.mapper()
|
727
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
728
|
+
rescue Exception => e
|
729
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
730
|
+
end
|
731
|
+
end
|
732
|
+
|
733
|
+
result
|
734
|
+
end
|
735
|
+
|
736
|
+
promise.execute
|
737
|
+
end
|
738
|
+
|
739
|
+
#
|
740
|
+
# Deletes a server.
|
741
|
+
#
|
742
|
+
# @param resource_group_name [String] The name of the resource group that
|
743
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
744
|
+
# Manager API or the portal.
|
745
|
+
# @param server_name [String] The name of the server.
|
746
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
747
|
+
# will be added to the HTTP request.
|
748
|
+
#
|
749
|
+
#
|
750
|
+
def begin_delete(resource_group_name, server_name, custom_headers:nil)
|
751
|
+
response = begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
752
|
+
nil
|
753
|
+
end
|
754
|
+
|
755
|
+
#
|
756
|
+
# Deletes a server.
|
757
|
+
#
|
758
|
+
# @param resource_group_name [String] The name of the resource group that
|
759
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
760
|
+
# Manager API or the portal.
|
761
|
+
# @param server_name [String] The name of the server.
|
762
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
763
|
+
# will be added to the HTTP request.
|
764
|
+
#
|
765
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
766
|
+
#
|
767
|
+
def begin_delete_with_http_info(resource_group_name, server_name, custom_headers:nil)
|
768
|
+
begin_delete_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
769
|
+
end
|
770
|
+
|
771
|
+
#
|
772
|
+
# Deletes a server.
|
773
|
+
#
|
774
|
+
# @param resource_group_name [String] The name of the resource group that
|
775
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
776
|
+
# Manager API or the portal.
|
777
|
+
# @param server_name [String] The name of the server.
|
778
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
779
|
+
# to the HTTP request.
|
780
|
+
#
|
781
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
782
|
+
#
|
783
|
+
def begin_delete_async(resource_group_name, server_name, custom_headers:nil)
|
784
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
785
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
786
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
787
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
788
|
+
|
789
|
+
|
790
|
+
request_headers = {}
|
791
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
792
|
+
|
793
|
+
# Set Headers
|
794
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
795
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
796
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}'
|
797
|
+
|
798
|
+
request_url = @base_url || @client.base_url
|
799
|
+
|
800
|
+
options = {
|
801
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
802
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
803
|
+
query_params: {'api-version' => @client.api_version},
|
804
|
+
headers: request_headers.merge(custom_headers || {}),
|
805
|
+
base_url: request_url
|
806
|
+
}
|
807
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
808
|
+
|
809
|
+
promise = promise.then do |result|
|
810
|
+
http_response = result.response
|
811
|
+
status_code = http_response.status
|
812
|
+
response_content = http_response.body
|
813
|
+
unless status_code == 200 || status_code == 202 || status_code == 204
|
814
|
+
error_model = JSON.load(response_content)
|
815
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
816
|
+
end
|
817
|
+
|
818
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
819
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
820
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
821
|
+
|
822
|
+
result
|
823
|
+
end
|
824
|
+
|
825
|
+
promise.execute
|
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
|
+
#
|
839
|
+
def begin_restart(resource_group_name, server_name, custom_headers:nil)
|
840
|
+
response = begin_restart_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
841
|
+
nil
|
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 custom_headers [Hash{String => String}] A hash of custom headers that
|
852
|
+
# will be added to the HTTP request.
|
853
|
+
#
|
854
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
855
|
+
#
|
856
|
+
def begin_restart_with_http_info(resource_group_name, server_name, custom_headers:nil)
|
857
|
+
begin_restart_async(resource_group_name, server_name, custom_headers:custom_headers).value!
|
858
|
+
end
|
859
|
+
|
860
|
+
#
|
861
|
+
# Restarts a server.
|
862
|
+
#
|
863
|
+
# @param resource_group_name [String] The name of the resource group that
|
864
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
865
|
+
# Manager API or the portal.
|
866
|
+
# @param server_name [String] The name of the server.
|
867
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
868
|
+
# to the HTTP request.
|
869
|
+
#
|
870
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
871
|
+
#
|
872
|
+
def begin_restart_async(resource_group_name, server_name, custom_headers:nil)
|
873
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
874
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
875
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
876
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
877
|
+
|
878
|
+
|
879
|
+
request_headers = {}
|
880
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
881
|
+
|
882
|
+
# Set Headers
|
883
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
884
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
885
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/restart'
|
886
|
+
|
887
|
+
request_url = @base_url || @client.base_url
|
888
|
+
|
889
|
+
options = {
|
890
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
891
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
892
|
+
query_params: {'api-version' => @client.api_version},
|
893
|
+
headers: request_headers.merge(custom_headers || {}),
|
894
|
+
base_url: request_url
|
895
|
+
}
|
896
|
+
promise = @client.make_request_async(:post, path_template, options)
|
897
|
+
|
898
|
+
promise = promise.then do |result|
|
899
|
+
http_response = result.response
|
900
|
+
status_code = http_response.status
|
901
|
+
response_content = http_response.body
|
902
|
+
unless status_code == 200 || status_code == 202
|
903
|
+
error_model = JSON.load(response_content)
|
904
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
905
|
+
end
|
906
|
+
|
907
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
908
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
909
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
910
|
+
|
911
|
+
result
|
912
|
+
end
|
913
|
+
|
914
|
+
promise.execute
|
915
|
+
end
|
916
|
+
|
917
|
+
end
|
918
|
+
end
|