azure_mgmt_sql 0.10.0 → 0.11.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 +4 -4
- data/lib/generated/azure_mgmt_sql.rb +124 -41
- data/lib/generated/azure_mgmt_sql/capabilities.rb +115 -0
- data/lib/generated/azure_mgmt_sql/databases.rb +2877 -443
- data/lib/generated/azure_mgmt_sql/elastic_pools.rb +407 -30
- data/lib/generated/azure_mgmt_sql/failover_groups.rb +1143 -0
- data/lib/generated/azure_mgmt_sql/firewall_rules.rb +443 -0
- data/lib/generated/azure_mgmt_sql/models/authentication_type.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/backup_long_term_retention_policy.rb +94 -0
- data/lib/generated/azure_mgmt_sql/models/backup_long_term_retention_policy_state.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/backup_long_term_retention_vault.rb +80 -0
- data/lib/generated/azure_mgmt_sql/models/{transparent_data_encryption_states.rb → blob_auditing_policy_state.rb} +3 -3
- data/lib/generated/azure_mgmt_sql/models/capability_status.rb +18 -0
- data/lib/generated/azure_mgmt_sql/models/check_name_availability_reason.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/check_name_availability_request.rb +59 -0
- data/lib/generated/azure_mgmt_sql/models/check_name_availability_response.rb +84 -0
- data/lib/generated/azure_mgmt_sql/models/create_mode.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/data_masking_function.rb +20 -0
- data/lib/generated/azure_mgmt_sql/models/data_masking_policy.rb +131 -0
- data/lib/generated/azure_mgmt_sql/models/data_masking_rule.rb +226 -0
- data/lib/generated/azure_mgmt_sql/models/data_masking_rule_list_result.rb +54 -0
- data/lib/generated/azure_mgmt_sql/models/data_masking_rule_state.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/{server_state.rb → data_masking_state.rb} +4 -4
- data/lib/generated/azure_mgmt_sql/models/database.rb +115 -63
- data/lib/generated/azure_mgmt_sql/models/database_blob_auditing_policy.rb +156 -0
- data/lib/generated/azure_mgmt_sql/models/{database_editions.rb → database_edition.rb} +4 -3
- data/lib/generated/azure_mgmt_sql/models/database_list_result.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/database_security_alert_policy.rb +179 -0
- data/lib/generated/azure_mgmt_sql/models/database_update.rb +464 -0
- data/lib/generated/azure_mgmt_sql/models/{database_metric.rb → database_usage.rb} +13 -11
- data/lib/generated/azure_mgmt_sql/models/{database_metric_list_result.rb → database_usage_list_result.rb} +10 -9
- data/lib/generated/azure_mgmt_sql/models/edition_capability.rb +79 -0
- data/lib/generated/azure_mgmt_sql/models/elastic_pool.rb +15 -14
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_activity.rb +12 -22
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_activity_list_result.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_database_activity.rb +12 -22
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_database_activity_list_result.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_dtu_capability.rb +143 -0
- data/lib/generated/azure_mgmt_sql/models/{elastic_pool_editions.rb → elastic_pool_edition.rb} +3 -3
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_edition_capability.rb +79 -0
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_list_result.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_per_database_max_dtu_capability.rb +79 -0
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_per_database_min_dtu_capability.rb +59 -0
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_state.rb +1 -1
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_update.rb +152 -0
- data/lib/generated/azure_mgmt_sql/models/encryption_protector.rb +137 -0
- data/lib/generated/azure_mgmt_sql/models/encryption_protector_list_result.rb +96 -0
- data/lib/generated/azure_mgmt_sql/models/export_request.rb +101 -0
- data/lib/generated/azure_mgmt_sql/models/failover_group.rb +171 -0
- data/lib/generated/azure_mgmt_sql/models/failover_group_list_result.rb +96 -0
- data/lib/generated/azure_mgmt_sql/models/failover_group_read_only_endpoint.rb +47 -0
- data/lib/generated/azure_mgmt_sql/models/failover_group_read_write_endpoint.rb +58 -0
- data/lib/generated/azure_mgmt_sql/models/failover_group_replication_role.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/{server_firewall_rule.rb → firewall_rule.rb} +6 -5
- data/lib/generated/azure_mgmt_sql/models/{server_firewall_rule_list_result.rb → firewall_rule_list_result.rb} +9 -8
- data/lib/generated/azure_mgmt_sql/models/geo_backup_policy.rb +105 -0
- data/lib/generated/azure_mgmt_sql/models/geo_backup_policy_list_result.rb +53 -0
- data/lib/generated/azure_mgmt_sql/models/geo_backup_policy_state.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/{table_type.rb → identity_type.rb} +4 -5
- data/lib/generated/azure_mgmt_sql/models/import_export_response.rb +158 -0
- data/lib/generated/azure_mgmt_sql/models/import_extension_request.rb +134 -0
- data/lib/generated/azure_mgmt_sql/models/import_request.rb +125 -0
- data/lib/generated/azure_mgmt_sql/models/location_capabilities.rb +80 -0
- data/lib/generated/azure_mgmt_sql/models/max_size_capability.rb +74 -0
- data/lib/generated/azure_mgmt_sql/models/max_size_units.rb +18 -0
- data/lib/generated/azure_mgmt_sql/models/metric.rb +114 -0
- data/lib/generated/azure_mgmt_sql/models/metric_availability.rb +57 -0
- data/lib/generated/azure_mgmt_sql/models/metric_definition.rb +104 -0
- data/lib/generated/azure_mgmt_sql/models/metric_definition_list_result.rb +54 -0
- data/lib/generated/azure_mgmt_sql/models/metric_list_result.rb +53 -0
- data/lib/generated/azure_mgmt_sql/models/metric_name.rb +57 -0
- data/lib/generated/azure_mgmt_sql/models/metric_value.rb +117 -0
- data/lib/generated/azure_mgmt_sql/models/operation.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/operation_display.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/operation_impact.rb +3 -2
- data/lib/generated/azure_mgmt_sql/models/operation_list_result.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/partner_info.rb +68 -0
- data/lib/generated/azure_mgmt_sql/models/performance_level_unit.rb +15 -0
- data/lib/generated/azure_mgmt_sql/models/primary_aggregation_type.rb +20 -0
- data/lib/generated/azure_mgmt_sql/models/proxy_resource.rb +59 -0
- data/lib/generated/azure_mgmt_sql/models/read_only_endpoint_failover_policy.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/read_scale.rb +1 -1
- data/lib/generated/azure_mgmt_sql/models/read_write_endpoint_failover_policy.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool.rb +9 -29
- data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_list_metrics_result.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_list_result.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_metric.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/recommended_index.rb +13 -33
- data/lib/generated/azure_mgmt_sql/models/{recommended_index_actions.rb → recommended_index_action.rb} +3 -3
- data/lib/generated/azure_mgmt_sql/models/{recommended_index_states.rb → recommended_index_state.rb} +3 -3
- data/lib/generated/azure_mgmt_sql/models/{recommended_index_types.rb → recommended_index_type.rb} +3 -3
- data/lib/generated/azure_mgmt_sql/models/recoverable_database.rb +104 -0
- data/lib/generated/azure_mgmt_sql/models/recoverable_database_list_result.rb +53 -0
- data/lib/generated/azure_mgmt_sql/models/replication_link.rb +3 -2
- data/lib/generated/azure_mgmt_sql/models/replication_link_list_result.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/replication_role.rb +1 -1
- data/lib/generated/azure_mgmt_sql/models/replication_state.rb +1 -1
- data/lib/generated/azure_mgmt_sql/models/resource_identity.rb +69 -0
- data/lib/generated/azure_mgmt_sql/models/restorable_dropped_database.rb +159 -0
- data/lib/generated/azure_mgmt_sql/models/restorable_dropped_database_list_result.rb +54 -0
- data/lib/generated/azure_mgmt_sql/models/restore_point.rb +10 -30
- data/lib/generated/azure_mgmt_sql/models/restore_point_list_result.rb +4 -4
- data/lib/generated/azure_mgmt_sql/models/{restore_point_types.rb → restore_point_type.rb} +3 -3
- data/lib/generated/azure_mgmt_sql/models/sample_name.rb +1 -1
- data/lib/generated/azure_mgmt_sql/models/security_alert_policy_email_account_admins.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/security_alert_policy_state.rb +17 -0
- data/lib/generated/azure_mgmt_sql/models/security_alert_policy_use_server_default.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/server.rb +38 -56
- data/lib/generated/azure_mgmt_sql/models/server_administrator_list_result.rb +54 -0
- data/lib/generated/azure_mgmt_sql/models/server_azure_adadministrator.rb +94 -0
- data/lib/generated/azure_mgmt_sql/models/server_communication_link.rb +103 -0
- data/lib/generated/azure_mgmt_sql/models/server_communication_link_list_result.rb +54 -0
- data/lib/generated/azure_mgmt_sql/models/{schema.rb → server_connection_policy.rb} +33 -38
- data/lib/generated/azure_mgmt_sql/models/server_connection_type.rb +17 -0
- data/lib/generated/azure_mgmt_sql/models/server_key.rb +135 -0
- data/lib/generated/azure_mgmt_sql/models/server_key_list_result.rb +96 -0
- data/lib/generated/azure_mgmt_sql/models/server_key_type.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/server_list_result.rb +48 -4
- data/lib/generated/azure_mgmt_sql/models/server_update.rb +106 -0
- data/lib/generated/azure_mgmt_sql/models/{server_metric.rb → server_usage.rb} +6 -5
- data/lib/generated/azure_mgmt_sql/models/{server_metric_list_result.rb → server_usage_list_result.rb} +9 -9
- data/lib/generated/azure_mgmt_sql/models/server_version_capability.rb +99 -0
- data/lib/generated/azure_mgmt_sql/models/service_objective.rb +3 -2
- data/lib/generated/azure_mgmt_sql/models/service_objective_capability.rb +127 -0
- data/lib/generated/azure_mgmt_sql/models/service_objective_list_result.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/service_objective_name.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/service_tier_advisor.rb +3 -2
- data/lib/generated/azure_mgmt_sql/models/service_tier_advisor_list_result.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/slo_usage_metric.rb +8 -3
- data/lib/generated/azure_mgmt_sql/models/sql_sub_resource.rb +3 -2
- data/lib/generated/azure_mgmt_sql/models/storage_key_type.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/sub_resource.rb +54 -0
- data/lib/generated/azure_mgmt_sql/models/{column.rb → tracked_resource.rb} +19 -23
- data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption.rb +6 -5
- data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity.rb +4 -3
- data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity_list_result.rb +2 -1
- data/lib/generated/azure_mgmt_sql/models/{transparent_data_encryption_activity_states.rb → transparent_data_encryption_activity_status.rb} +3 -3
- data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_status.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/unit_definition_type.rb +20 -0
- data/lib/generated/azure_mgmt_sql/models/unit_type.rb +20 -0
- data/lib/generated/azure_mgmt_sql/models/virtual_network_rule.rb +69 -0
- data/lib/generated/azure_mgmt_sql/models/virtual_network_rule_list_result.rb +96 -0
- data/lib/generated/azure_mgmt_sql/module_definition.rb +1 -1
- data/lib/generated/azure_mgmt_sql/operations.rb +109 -0
- data/lib/generated/azure_mgmt_sql/recommended_elastic_pools.rb +21 -22
- data/lib/generated/azure_mgmt_sql/recoverable_databases.rb +229 -0
- data/lib/generated/azure_mgmt_sql/restorable_dropped_databases.rb +229 -0
- data/lib/generated/azure_mgmt_sql/server_azure_adadministrators.rb +575 -0
- data/lib/generated/azure_mgmt_sql/server_communication_links.rb +496 -0
- data/lib/generated/azure_mgmt_sql/server_keys.rb +670 -0
- data/lib/generated/azure_mgmt_sql/servers.rb +1366 -257
- data/lib/generated/azure_mgmt_sql/sql_management_client.rb +44 -85
- data/lib/generated/azure_mgmt_sql/version.rb +2 -2
- data/lib/generated/azure_mgmt_sql/virtual_network_rules.rb +663 -0
- metadata +110 -27
- data/lib/generated/azure_mgmt_sql/models/server_version.rb +0 -16
- data/lib/generated/azure_mgmt_sql/models/table.rb +0 -131
- data/lib/generated/azure_mgmt_sql/models/target_elastic_pool_editions.rb +0 -17
- data/lib/generated/azure_mgmt_sql/models/upgrade_hint.rb +0 -54
- data/lib/generated/azure_mgmt_sql/models/upgrade_recommended_elastic_pool_properties.rb +0 -131
@@ -0,0 +1,1143 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::SQL
|
7
|
+
#
|
8
|
+
# The Azure SQL Database management API provides a RESTful set of web
|
9
|
+
# services that interact with Azure SQL Database services to manage your
|
10
|
+
# databases. The API enables you to create, retrieve, update, and delete
|
11
|
+
# databases.
|
12
|
+
#
|
13
|
+
class FailoverGroups
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
#
|
17
|
+
# Creates and initializes a new instance of the FailoverGroups class.
|
18
|
+
# @param client service class for accessing basic functionality.
|
19
|
+
#
|
20
|
+
def initialize(client)
|
21
|
+
@client = client
|
22
|
+
end
|
23
|
+
|
24
|
+
# @return [SqlManagementClient] reference to the SqlManagementClient
|
25
|
+
attr_reader :client
|
26
|
+
|
27
|
+
#
|
28
|
+
# Gets a failover group.
|
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 containing the failover
|
34
|
+
# group.
|
35
|
+
# @param failover_group_name [String] The name of the failover group.
|
36
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
37
|
+
# will be added to the HTTP request.
|
38
|
+
#
|
39
|
+
# @return [FailoverGroup] operation results.
|
40
|
+
#
|
41
|
+
def get(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
42
|
+
response = get_async(resource_group_name, server_name, failover_group_name, custom_headers).value!
|
43
|
+
response.body unless response.nil?
|
44
|
+
end
|
45
|
+
|
46
|
+
#
|
47
|
+
# Gets a failover group.
|
48
|
+
#
|
49
|
+
# @param resource_group_name [String] The name of the resource group that
|
50
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
51
|
+
# Manager API or the portal.
|
52
|
+
# @param server_name [String] The name of the server containing the failover
|
53
|
+
# group.
|
54
|
+
# @param failover_group_name [String] The name of the failover group.
|
55
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
56
|
+
# will be added to the HTTP request.
|
57
|
+
#
|
58
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
59
|
+
#
|
60
|
+
def get_with_http_info(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
61
|
+
get_async(resource_group_name, server_name, failover_group_name, custom_headers).value!
|
62
|
+
end
|
63
|
+
|
64
|
+
#
|
65
|
+
# Gets a failover group.
|
66
|
+
#
|
67
|
+
# @param resource_group_name [String] The name of the resource group that
|
68
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
69
|
+
# Manager API or the portal.
|
70
|
+
# @param server_name [String] The name of the server containing the failover
|
71
|
+
# group.
|
72
|
+
# @param failover_group_name [String] The name of the failover group.
|
73
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
74
|
+
# to the HTTP request.
|
75
|
+
#
|
76
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
77
|
+
#
|
78
|
+
def get_async(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
79
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
80
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
81
|
+
fail ArgumentError, 'failover_group_name is nil' if failover_group_name.nil?
|
82
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
83
|
+
api_version = '2015-05-01-preview'
|
84
|
+
|
85
|
+
|
86
|
+
request_headers = {}
|
87
|
+
|
88
|
+
# Set Headers
|
89
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
90
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
91
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}'
|
92
|
+
|
93
|
+
request_url = @base_url || @client.base_url
|
94
|
+
|
95
|
+
options = {
|
96
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
97
|
+
path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'failoverGroupName' => failover_group_name,'subscriptionId' => @client.subscription_id},
|
98
|
+
query_params: {'api-version' => api_version},
|
99
|
+
headers: request_headers.merge(custom_headers || {}),
|
100
|
+
base_url: request_url
|
101
|
+
}
|
102
|
+
promise = @client.make_request_async(:get, path_template, options)
|
103
|
+
|
104
|
+
promise = promise.then do |result|
|
105
|
+
http_response = result.response
|
106
|
+
status_code = http_response.status
|
107
|
+
response_content = http_response.body
|
108
|
+
unless status_code == 200
|
109
|
+
error_model = JSON.load(response_content)
|
110
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
111
|
+
end
|
112
|
+
|
113
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
114
|
+
# Deserialize Response
|
115
|
+
if status_code == 200
|
116
|
+
begin
|
117
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
118
|
+
result_mapper = Azure::ARM::SQL::Models::FailoverGroup.mapper()
|
119
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
120
|
+
rescue Exception => e
|
121
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
result
|
126
|
+
end
|
127
|
+
|
128
|
+
promise.execute
|
129
|
+
end
|
130
|
+
|
131
|
+
#
|
132
|
+
# Creates or updates a failover group.
|
133
|
+
#
|
134
|
+
# @param resource_group_name [String] The name of the resource group that
|
135
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
136
|
+
# Manager API or the portal.
|
137
|
+
# @param server_name [String] The name of the server containing the failover
|
138
|
+
# group.
|
139
|
+
# @param failover_group_name [String] The name of the failover group.
|
140
|
+
# @param parameters [FailoverGroup] The failover group parameters.
|
141
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
142
|
+
# will be added to the HTTP request.
|
143
|
+
#
|
144
|
+
# @return [FailoverGroup] operation results.
|
145
|
+
#
|
146
|
+
def create_or_update(resource_group_name, server_name, failover_group_name, parameters, custom_headers = nil)
|
147
|
+
response = create_or_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers).value!
|
148
|
+
response.body unless response.nil?
|
149
|
+
end
|
150
|
+
|
151
|
+
#
|
152
|
+
# @param resource_group_name [String] The name of the resource group that
|
153
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
154
|
+
# Manager API or the portal.
|
155
|
+
# @param server_name [String] The name of the server containing the failover
|
156
|
+
# group.
|
157
|
+
# @param failover_group_name [String] The name of the failover group.
|
158
|
+
# @param parameters [FailoverGroup] The failover group parameters.
|
159
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
160
|
+
# will be added to the HTTP request.
|
161
|
+
#
|
162
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
163
|
+
# response.
|
164
|
+
#
|
165
|
+
def create_or_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers = nil)
|
166
|
+
# Send request
|
167
|
+
promise = begin_create_or_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers)
|
168
|
+
|
169
|
+
promise = promise.then do |response|
|
170
|
+
# Defining deserialization method.
|
171
|
+
deserialize_method = lambda do |parsed_response|
|
172
|
+
result_mapper = Azure::ARM::SQL::Models::FailoverGroup.mapper()
|
173
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
174
|
+
end
|
175
|
+
|
176
|
+
# Waiting for response.
|
177
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
178
|
+
end
|
179
|
+
|
180
|
+
promise
|
181
|
+
end
|
182
|
+
|
183
|
+
#
|
184
|
+
# Deletes a failover group.
|
185
|
+
#
|
186
|
+
# @param resource_group_name [String] The name of the resource group that
|
187
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
188
|
+
# Manager API or the portal.
|
189
|
+
# @param server_name [String] The name of the server containing the failover
|
190
|
+
# group.
|
191
|
+
# @param failover_group_name [String] The name of the failover group.
|
192
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
193
|
+
# will be added to the HTTP request.
|
194
|
+
#
|
195
|
+
def delete(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
196
|
+
response = delete_async(resource_group_name, server_name, failover_group_name, custom_headers).value!
|
197
|
+
nil
|
198
|
+
end
|
199
|
+
|
200
|
+
#
|
201
|
+
# @param resource_group_name [String] The name of the resource group that
|
202
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
203
|
+
# Manager API or the portal.
|
204
|
+
# @param server_name [String] The name of the server containing the failover
|
205
|
+
# group.
|
206
|
+
# @param failover_group_name [String] The name of the failover group.
|
207
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
208
|
+
# will be added to the HTTP request.
|
209
|
+
#
|
210
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
211
|
+
# response.
|
212
|
+
#
|
213
|
+
def delete_async(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
214
|
+
# Send request
|
215
|
+
promise = begin_delete_async(resource_group_name, server_name, failover_group_name, custom_headers)
|
216
|
+
|
217
|
+
promise = promise.then do |response|
|
218
|
+
# Defining deserialization method.
|
219
|
+
deserialize_method = lambda do |parsed_response|
|
220
|
+
end
|
221
|
+
|
222
|
+
# Waiting for response.
|
223
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
224
|
+
end
|
225
|
+
|
226
|
+
promise
|
227
|
+
end
|
228
|
+
|
229
|
+
#
|
230
|
+
# Updates a failover group.
|
231
|
+
#
|
232
|
+
# @param resource_group_name [String] The name of the resource group that
|
233
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
234
|
+
# Manager API or the portal.
|
235
|
+
# @param server_name [String] The name of the server containing the failover
|
236
|
+
# group.
|
237
|
+
# @param failover_group_name [String] The name of the failover group.
|
238
|
+
# @param parameters [FailoverGroup] The failover group parameters.
|
239
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
240
|
+
# will be added to the HTTP request.
|
241
|
+
#
|
242
|
+
# @return [FailoverGroup] operation results.
|
243
|
+
#
|
244
|
+
def update(resource_group_name, server_name, failover_group_name, parameters, custom_headers = nil)
|
245
|
+
response = update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers).value!
|
246
|
+
response.body unless response.nil?
|
247
|
+
end
|
248
|
+
|
249
|
+
#
|
250
|
+
# @param resource_group_name [String] The name of the resource group that
|
251
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
252
|
+
# Manager API or the portal.
|
253
|
+
# @param server_name [String] The name of the server containing the failover
|
254
|
+
# group.
|
255
|
+
# @param failover_group_name [String] The name of the failover group.
|
256
|
+
# @param parameters [FailoverGroup] The failover group parameters.
|
257
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
258
|
+
# will be added to the HTTP request.
|
259
|
+
#
|
260
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
261
|
+
# response.
|
262
|
+
#
|
263
|
+
def update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers = nil)
|
264
|
+
# Send request
|
265
|
+
promise = begin_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers)
|
266
|
+
|
267
|
+
promise = promise.then do |response|
|
268
|
+
# Defining deserialization method.
|
269
|
+
deserialize_method = lambda do |parsed_response|
|
270
|
+
result_mapper = Azure::ARM::SQL::Models::FailoverGroup.mapper()
|
271
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
272
|
+
end
|
273
|
+
|
274
|
+
# Waiting for response.
|
275
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
276
|
+
end
|
277
|
+
|
278
|
+
promise
|
279
|
+
end
|
280
|
+
|
281
|
+
#
|
282
|
+
# Lists the failover groups in a server.
|
283
|
+
#
|
284
|
+
# @param resource_group_name [String] The name of the resource group that
|
285
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
286
|
+
# Manager API or the portal.
|
287
|
+
# @param server_name [String] The name of the server containing the failover
|
288
|
+
# group.
|
289
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
290
|
+
# will be added to the HTTP request.
|
291
|
+
#
|
292
|
+
# @return [Array<FailoverGroup>] operation results.
|
293
|
+
#
|
294
|
+
def list_by_server(resource_group_name, server_name, custom_headers = nil)
|
295
|
+
first_page = list_by_server_as_lazy(resource_group_name, server_name, custom_headers)
|
296
|
+
first_page.get_all_items
|
297
|
+
end
|
298
|
+
|
299
|
+
#
|
300
|
+
# Lists the failover groups in a server.
|
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 server_name [String] The name of the server containing the failover
|
306
|
+
# group.
|
307
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
308
|
+
# will be added to the HTTP request.
|
309
|
+
#
|
310
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
311
|
+
#
|
312
|
+
def list_by_server_with_http_info(resource_group_name, server_name, custom_headers = nil)
|
313
|
+
list_by_server_async(resource_group_name, server_name, custom_headers).value!
|
314
|
+
end
|
315
|
+
|
316
|
+
#
|
317
|
+
# Lists the failover groups in a server.
|
318
|
+
#
|
319
|
+
# @param resource_group_name [String] The name of the resource group that
|
320
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
321
|
+
# Manager API or the portal.
|
322
|
+
# @param server_name [String] The name of the server containing the failover
|
323
|
+
# group.
|
324
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
325
|
+
# to the HTTP request.
|
326
|
+
#
|
327
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
328
|
+
#
|
329
|
+
def list_by_server_async(resource_group_name, server_name, custom_headers = nil)
|
330
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
331
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
332
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
333
|
+
api_version = '2015-05-01-preview'
|
334
|
+
|
335
|
+
|
336
|
+
request_headers = {}
|
337
|
+
|
338
|
+
# Set Headers
|
339
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
340
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
341
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups'
|
342
|
+
|
343
|
+
request_url = @base_url || @client.base_url
|
344
|
+
|
345
|
+
options = {
|
346
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
347
|
+
path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id},
|
348
|
+
query_params: {'api-version' => api_version},
|
349
|
+
headers: request_headers.merge(custom_headers || {}),
|
350
|
+
base_url: request_url
|
351
|
+
}
|
352
|
+
promise = @client.make_request_async(:get, path_template, options)
|
353
|
+
|
354
|
+
promise = promise.then do |result|
|
355
|
+
http_response = result.response
|
356
|
+
status_code = http_response.status
|
357
|
+
response_content = http_response.body
|
358
|
+
unless status_code == 200
|
359
|
+
error_model = JSON.load(response_content)
|
360
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
361
|
+
end
|
362
|
+
|
363
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
364
|
+
# Deserialize Response
|
365
|
+
if status_code == 200
|
366
|
+
begin
|
367
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
368
|
+
result_mapper = Azure::ARM::SQL::Models::FailoverGroupListResult.mapper()
|
369
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
370
|
+
rescue Exception => e
|
371
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
result
|
376
|
+
end
|
377
|
+
|
378
|
+
promise.execute
|
379
|
+
end
|
380
|
+
|
381
|
+
#
|
382
|
+
# Fails over from the current primary server to this server.
|
383
|
+
#
|
384
|
+
# @param resource_group_name [String] The name of the resource group that
|
385
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
386
|
+
# Manager API or the portal.
|
387
|
+
# @param server_name [String] The name of the server containing the failover
|
388
|
+
# group.
|
389
|
+
# @param failover_group_name [String] The name of the failover group.
|
390
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
391
|
+
# will be added to the HTTP request.
|
392
|
+
#
|
393
|
+
# @return [FailoverGroup] operation results.
|
394
|
+
#
|
395
|
+
def failover(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
396
|
+
response = failover_async(resource_group_name, server_name, failover_group_name, custom_headers).value!
|
397
|
+
response.body unless response.nil?
|
398
|
+
end
|
399
|
+
|
400
|
+
#
|
401
|
+
# @param resource_group_name [String] The name of the resource group that
|
402
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
403
|
+
# Manager API or the portal.
|
404
|
+
# @param server_name [String] The name of the server containing the failover
|
405
|
+
# group.
|
406
|
+
# @param failover_group_name [String] The name of the failover group.
|
407
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
408
|
+
# will be added to the HTTP request.
|
409
|
+
#
|
410
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
411
|
+
# response.
|
412
|
+
#
|
413
|
+
def failover_async(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
414
|
+
# Send request
|
415
|
+
promise = begin_failover_async(resource_group_name, server_name, failover_group_name, custom_headers)
|
416
|
+
|
417
|
+
promise = promise.then do |response|
|
418
|
+
# Defining deserialization method.
|
419
|
+
deserialize_method = lambda do |parsed_response|
|
420
|
+
result_mapper = Azure::ARM::SQL::Models::FailoverGroup.mapper()
|
421
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
422
|
+
end
|
423
|
+
|
424
|
+
# Waiting for response.
|
425
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
426
|
+
end
|
427
|
+
|
428
|
+
promise
|
429
|
+
end
|
430
|
+
|
431
|
+
#
|
432
|
+
# Fails over from the current primary server to this server. This operation
|
433
|
+
# might result in data loss.
|
434
|
+
#
|
435
|
+
# @param resource_group_name [String] The name of the resource group that
|
436
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
437
|
+
# Manager API or the portal.
|
438
|
+
# @param server_name [String] The name of the server containing the failover
|
439
|
+
# group.
|
440
|
+
# @param failover_group_name [String] The name of the failover group.
|
441
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
442
|
+
# will be added to the HTTP request.
|
443
|
+
#
|
444
|
+
# @return [FailoverGroup] operation results.
|
445
|
+
#
|
446
|
+
def force_failover_allow_data_loss(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
447
|
+
response = force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers).value!
|
448
|
+
response.body unless response.nil?
|
449
|
+
end
|
450
|
+
|
451
|
+
#
|
452
|
+
# @param resource_group_name [String] The name of the resource group that
|
453
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
454
|
+
# Manager API or the portal.
|
455
|
+
# @param server_name [String] The name of the server containing the failover
|
456
|
+
# group.
|
457
|
+
# @param failover_group_name [String] The name of the failover group.
|
458
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
459
|
+
# will be added to the HTTP request.
|
460
|
+
#
|
461
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
462
|
+
# response.
|
463
|
+
#
|
464
|
+
def force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
465
|
+
# Send request
|
466
|
+
promise = begin_force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers)
|
467
|
+
|
468
|
+
promise = promise.then do |response|
|
469
|
+
# Defining deserialization method.
|
470
|
+
deserialize_method = lambda do |parsed_response|
|
471
|
+
result_mapper = Azure::ARM::SQL::Models::FailoverGroup.mapper()
|
472
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
473
|
+
end
|
474
|
+
|
475
|
+
# Waiting for response.
|
476
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
477
|
+
end
|
478
|
+
|
479
|
+
promise
|
480
|
+
end
|
481
|
+
|
482
|
+
#
|
483
|
+
# Creates or updates a failover group.
|
484
|
+
#
|
485
|
+
# @param resource_group_name [String] The name of the resource group that
|
486
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
487
|
+
# Manager API or the portal.
|
488
|
+
# @param server_name [String] The name of the server containing the failover
|
489
|
+
# group.
|
490
|
+
# @param failover_group_name [String] The name of the failover group.
|
491
|
+
# @param parameters [FailoverGroup] The failover group parameters.
|
492
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
493
|
+
# will be added to the HTTP request.
|
494
|
+
#
|
495
|
+
# @return [FailoverGroup] operation results.
|
496
|
+
#
|
497
|
+
def begin_create_or_update(resource_group_name, server_name, failover_group_name, parameters, custom_headers = nil)
|
498
|
+
response = begin_create_or_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers).value!
|
499
|
+
response.body unless response.nil?
|
500
|
+
end
|
501
|
+
|
502
|
+
#
|
503
|
+
# Creates or updates a failover group.
|
504
|
+
#
|
505
|
+
# @param resource_group_name [String] The name of the resource group that
|
506
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
507
|
+
# Manager API or the portal.
|
508
|
+
# @param server_name [String] The name of the server containing the failover
|
509
|
+
# group.
|
510
|
+
# @param failover_group_name [String] The name of the failover group.
|
511
|
+
# @param parameters [FailoverGroup] The failover group parameters.
|
512
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
513
|
+
# will be added to the HTTP request.
|
514
|
+
#
|
515
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
516
|
+
#
|
517
|
+
def begin_create_or_update_with_http_info(resource_group_name, server_name, failover_group_name, parameters, custom_headers = nil)
|
518
|
+
begin_create_or_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers).value!
|
519
|
+
end
|
520
|
+
|
521
|
+
#
|
522
|
+
# Creates or updates a failover group.
|
523
|
+
#
|
524
|
+
# @param resource_group_name [String] The name of the resource group that
|
525
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
526
|
+
# Manager API or the portal.
|
527
|
+
# @param server_name [String] The name of the server containing the failover
|
528
|
+
# group.
|
529
|
+
# @param failover_group_name [String] The name of the failover group.
|
530
|
+
# @param parameters [FailoverGroup] The failover group parameters.
|
531
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
532
|
+
# to the HTTP request.
|
533
|
+
#
|
534
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
535
|
+
#
|
536
|
+
def begin_create_or_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers = nil)
|
537
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
538
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
539
|
+
fail ArgumentError, 'failover_group_name is nil' if failover_group_name.nil?
|
540
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
541
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
542
|
+
api_version = '2015-05-01-preview'
|
543
|
+
|
544
|
+
|
545
|
+
request_headers = {}
|
546
|
+
|
547
|
+
# Set Headers
|
548
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
549
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
550
|
+
|
551
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
552
|
+
|
553
|
+
# Serialize Request
|
554
|
+
request_mapper = Azure::ARM::SQL::Models::FailoverGroup.mapper()
|
555
|
+
request_content = @client.serialize(request_mapper, parameters)
|
556
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
557
|
+
|
558
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}'
|
559
|
+
|
560
|
+
request_url = @base_url || @client.base_url
|
561
|
+
|
562
|
+
options = {
|
563
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
564
|
+
path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'failoverGroupName' => failover_group_name,'subscriptionId' => @client.subscription_id},
|
565
|
+
query_params: {'api-version' => api_version},
|
566
|
+
body: request_content,
|
567
|
+
headers: request_headers.merge(custom_headers || {}),
|
568
|
+
base_url: request_url
|
569
|
+
}
|
570
|
+
promise = @client.make_request_async(:put, path_template, options)
|
571
|
+
|
572
|
+
promise = promise.then do |result|
|
573
|
+
http_response = result.response
|
574
|
+
status_code = http_response.status
|
575
|
+
response_content = http_response.body
|
576
|
+
unless status_code == 200 || status_code == 202 || status_code == 201
|
577
|
+
error_model = JSON.load(response_content)
|
578
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
579
|
+
end
|
580
|
+
|
581
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
582
|
+
# Deserialize Response
|
583
|
+
if status_code == 200
|
584
|
+
begin
|
585
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
586
|
+
result_mapper = Azure::ARM::SQL::Models::FailoverGroup.mapper()
|
587
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
588
|
+
rescue Exception => e
|
589
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
590
|
+
end
|
591
|
+
end
|
592
|
+
# Deserialize Response
|
593
|
+
if status_code == 201
|
594
|
+
begin
|
595
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
596
|
+
result_mapper = Azure::ARM::SQL::Models::FailoverGroup.mapper()
|
597
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
598
|
+
rescue Exception => e
|
599
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
600
|
+
end
|
601
|
+
end
|
602
|
+
|
603
|
+
result
|
604
|
+
end
|
605
|
+
|
606
|
+
promise.execute
|
607
|
+
end
|
608
|
+
|
609
|
+
#
|
610
|
+
# Deletes a failover group.
|
611
|
+
#
|
612
|
+
# @param resource_group_name [String] The name of the resource group that
|
613
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
614
|
+
# Manager API or the portal.
|
615
|
+
# @param server_name [String] The name of the server containing the failover
|
616
|
+
# group.
|
617
|
+
# @param failover_group_name [String] The name of the failover group.
|
618
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
619
|
+
# will be added to the HTTP request.
|
620
|
+
#
|
621
|
+
#
|
622
|
+
def begin_delete(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
623
|
+
response = begin_delete_async(resource_group_name, server_name, failover_group_name, custom_headers).value!
|
624
|
+
nil
|
625
|
+
end
|
626
|
+
|
627
|
+
#
|
628
|
+
# Deletes a failover group.
|
629
|
+
#
|
630
|
+
# @param resource_group_name [String] The name of the resource group that
|
631
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
632
|
+
# Manager API or the portal.
|
633
|
+
# @param server_name [String] The name of the server containing the failover
|
634
|
+
# group.
|
635
|
+
# @param failover_group_name [String] The name of the failover group.
|
636
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
637
|
+
# will be added to the HTTP request.
|
638
|
+
#
|
639
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
640
|
+
#
|
641
|
+
def begin_delete_with_http_info(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
642
|
+
begin_delete_async(resource_group_name, server_name, failover_group_name, custom_headers).value!
|
643
|
+
end
|
644
|
+
|
645
|
+
#
|
646
|
+
# Deletes a failover group.
|
647
|
+
#
|
648
|
+
# @param resource_group_name [String] The name of the resource group that
|
649
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
650
|
+
# Manager API or the portal.
|
651
|
+
# @param server_name [String] The name of the server containing the failover
|
652
|
+
# group.
|
653
|
+
# @param failover_group_name [String] The name of the failover group.
|
654
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
655
|
+
# to the HTTP request.
|
656
|
+
#
|
657
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
658
|
+
#
|
659
|
+
def begin_delete_async(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
660
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
661
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
662
|
+
fail ArgumentError, 'failover_group_name is nil' if failover_group_name.nil?
|
663
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
664
|
+
api_version = '2015-05-01-preview'
|
665
|
+
|
666
|
+
|
667
|
+
request_headers = {}
|
668
|
+
|
669
|
+
# Set Headers
|
670
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
671
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
672
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}'
|
673
|
+
|
674
|
+
request_url = @base_url || @client.base_url
|
675
|
+
|
676
|
+
options = {
|
677
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
678
|
+
path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'failoverGroupName' => failover_group_name,'subscriptionId' => @client.subscription_id},
|
679
|
+
query_params: {'api-version' => api_version},
|
680
|
+
headers: request_headers.merge(custom_headers || {}),
|
681
|
+
base_url: request_url
|
682
|
+
}
|
683
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
684
|
+
|
685
|
+
promise = promise.then do |result|
|
686
|
+
http_response = result.response
|
687
|
+
status_code = http_response.status
|
688
|
+
response_content = http_response.body
|
689
|
+
unless status_code == 200 || status_code == 202 || status_code == 204
|
690
|
+
error_model = JSON.load(response_content)
|
691
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
692
|
+
end
|
693
|
+
|
694
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
695
|
+
|
696
|
+
result
|
697
|
+
end
|
698
|
+
|
699
|
+
promise.execute
|
700
|
+
end
|
701
|
+
|
702
|
+
#
|
703
|
+
# Updates a failover group.
|
704
|
+
#
|
705
|
+
# @param resource_group_name [String] The name of the resource group that
|
706
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
707
|
+
# Manager API or the portal.
|
708
|
+
# @param server_name [String] The name of the server containing the failover
|
709
|
+
# group.
|
710
|
+
# @param failover_group_name [String] The name of the failover group.
|
711
|
+
# @param parameters [FailoverGroup] The failover group parameters.
|
712
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
713
|
+
# will be added to the HTTP request.
|
714
|
+
#
|
715
|
+
# @return [FailoverGroup] operation results.
|
716
|
+
#
|
717
|
+
def begin_update(resource_group_name, server_name, failover_group_name, parameters, custom_headers = nil)
|
718
|
+
response = begin_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers).value!
|
719
|
+
response.body unless response.nil?
|
720
|
+
end
|
721
|
+
|
722
|
+
#
|
723
|
+
# Updates a failover group.
|
724
|
+
#
|
725
|
+
# @param resource_group_name [String] The name of the resource group that
|
726
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
727
|
+
# Manager API or the portal.
|
728
|
+
# @param server_name [String] The name of the server containing the failover
|
729
|
+
# group.
|
730
|
+
# @param failover_group_name [String] The name of the failover group.
|
731
|
+
# @param parameters [FailoverGroup] The failover group parameters.
|
732
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
733
|
+
# will be added to the HTTP request.
|
734
|
+
#
|
735
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
736
|
+
#
|
737
|
+
def begin_update_with_http_info(resource_group_name, server_name, failover_group_name, parameters, custom_headers = nil)
|
738
|
+
begin_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers).value!
|
739
|
+
end
|
740
|
+
|
741
|
+
#
|
742
|
+
# Updates a failover group.
|
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 containing the failover
|
748
|
+
# group.
|
749
|
+
# @param failover_group_name [String] The name of the failover group.
|
750
|
+
# @param parameters [FailoverGroup] The failover group parameters.
|
751
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
752
|
+
# to the HTTP request.
|
753
|
+
#
|
754
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
755
|
+
#
|
756
|
+
def begin_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers = nil)
|
757
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
758
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
759
|
+
fail ArgumentError, 'failover_group_name is nil' if failover_group_name.nil?
|
760
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
761
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
762
|
+
api_version = '2015-05-01-preview'
|
763
|
+
|
764
|
+
|
765
|
+
request_headers = {}
|
766
|
+
|
767
|
+
# Set Headers
|
768
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
769
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
770
|
+
|
771
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
772
|
+
|
773
|
+
# Serialize Request
|
774
|
+
request_mapper = Azure::ARM::SQL::Models::FailoverGroup.mapper()
|
775
|
+
request_content = @client.serialize(request_mapper, parameters)
|
776
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
777
|
+
|
778
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}'
|
779
|
+
|
780
|
+
request_url = @base_url || @client.base_url
|
781
|
+
|
782
|
+
options = {
|
783
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
784
|
+
path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'failoverGroupName' => failover_group_name,'subscriptionId' => @client.subscription_id},
|
785
|
+
query_params: {'api-version' => api_version},
|
786
|
+
body: request_content,
|
787
|
+
headers: request_headers.merge(custom_headers || {}),
|
788
|
+
base_url: request_url
|
789
|
+
}
|
790
|
+
promise = @client.make_request_async(:patch, path_template, options)
|
791
|
+
|
792
|
+
promise = promise.then do |result|
|
793
|
+
http_response = result.response
|
794
|
+
status_code = http_response.status
|
795
|
+
response_content = http_response.body
|
796
|
+
unless status_code == 200 || status_code == 202
|
797
|
+
error_model = JSON.load(response_content)
|
798
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
799
|
+
end
|
800
|
+
|
801
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
802
|
+
# Deserialize Response
|
803
|
+
if status_code == 200
|
804
|
+
begin
|
805
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
806
|
+
result_mapper = Azure::ARM::SQL::Models::FailoverGroup.mapper()
|
807
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
808
|
+
rescue Exception => e
|
809
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
810
|
+
end
|
811
|
+
end
|
812
|
+
|
813
|
+
result
|
814
|
+
end
|
815
|
+
|
816
|
+
promise.execute
|
817
|
+
end
|
818
|
+
|
819
|
+
#
|
820
|
+
# Fails over from the current primary server to this server.
|
821
|
+
#
|
822
|
+
# @param resource_group_name [String] The name of the resource group that
|
823
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
824
|
+
# Manager API or the portal.
|
825
|
+
# @param server_name [String] The name of the server containing the failover
|
826
|
+
# group.
|
827
|
+
# @param failover_group_name [String] The name of the failover group.
|
828
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
829
|
+
# will be added to the HTTP request.
|
830
|
+
#
|
831
|
+
# @return [FailoverGroup] operation results.
|
832
|
+
#
|
833
|
+
def begin_failover(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
834
|
+
response = begin_failover_async(resource_group_name, server_name, failover_group_name, custom_headers).value!
|
835
|
+
response.body unless response.nil?
|
836
|
+
end
|
837
|
+
|
838
|
+
#
|
839
|
+
# Fails over from the current primary server to this server.
|
840
|
+
#
|
841
|
+
# @param resource_group_name [String] The name of the resource group that
|
842
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
843
|
+
# Manager API or the portal.
|
844
|
+
# @param server_name [String] The name of the server containing the failover
|
845
|
+
# group.
|
846
|
+
# @param failover_group_name [String] The name of the failover group.
|
847
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
848
|
+
# will be added to the HTTP request.
|
849
|
+
#
|
850
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
851
|
+
#
|
852
|
+
def begin_failover_with_http_info(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
853
|
+
begin_failover_async(resource_group_name, server_name, failover_group_name, custom_headers).value!
|
854
|
+
end
|
855
|
+
|
856
|
+
#
|
857
|
+
# Fails over from the current primary server to this server.
|
858
|
+
#
|
859
|
+
# @param resource_group_name [String] The name of the resource group that
|
860
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
861
|
+
# Manager API or the portal.
|
862
|
+
# @param server_name [String] The name of the server containing the failover
|
863
|
+
# group.
|
864
|
+
# @param failover_group_name [String] The name of the failover group.
|
865
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
866
|
+
# to the HTTP request.
|
867
|
+
#
|
868
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
869
|
+
#
|
870
|
+
def begin_failover_async(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
871
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
872
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
873
|
+
fail ArgumentError, 'failover_group_name is nil' if failover_group_name.nil?
|
874
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
875
|
+
api_version = '2015-05-01-preview'
|
876
|
+
|
877
|
+
|
878
|
+
request_headers = {}
|
879
|
+
|
880
|
+
# Set Headers
|
881
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
882
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
883
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/failover'
|
884
|
+
|
885
|
+
request_url = @base_url || @client.base_url
|
886
|
+
|
887
|
+
options = {
|
888
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
889
|
+
path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'failoverGroupName' => failover_group_name,'subscriptionId' => @client.subscription_id},
|
890
|
+
query_params: {'api-version' => api_version},
|
891
|
+
headers: request_headers.merge(custom_headers || {}),
|
892
|
+
base_url: request_url
|
893
|
+
}
|
894
|
+
promise = @client.make_request_async(:post, path_template, options)
|
895
|
+
|
896
|
+
promise = promise.then do |result|
|
897
|
+
http_response = result.response
|
898
|
+
status_code = http_response.status
|
899
|
+
response_content = http_response.body
|
900
|
+
unless status_code == 200 || status_code == 202
|
901
|
+
error_model = JSON.load(response_content)
|
902
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
903
|
+
end
|
904
|
+
|
905
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
906
|
+
# Deserialize Response
|
907
|
+
if status_code == 200
|
908
|
+
begin
|
909
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
910
|
+
result_mapper = Azure::ARM::SQL::Models::FailoverGroup.mapper()
|
911
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
912
|
+
rescue Exception => e
|
913
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
914
|
+
end
|
915
|
+
end
|
916
|
+
|
917
|
+
result
|
918
|
+
end
|
919
|
+
|
920
|
+
promise.execute
|
921
|
+
end
|
922
|
+
|
923
|
+
#
|
924
|
+
# Fails over from the current primary server to this server. This operation
|
925
|
+
# might result in data loss.
|
926
|
+
#
|
927
|
+
# @param resource_group_name [String] The name of the resource group that
|
928
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
929
|
+
# Manager API or the portal.
|
930
|
+
# @param server_name [String] The name of the server containing the failover
|
931
|
+
# group.
|
932
|
+
# @param failover_group_name [String] The name of the failover group.
|
933
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
934
|
+
# will be added to the HTTP request.
|
935
|
+
#
|
936
|
+
# @return [FailoverGroup] operation results.
|
937
|
+
#
|
938
|
+
def begin_force_failover_allow_data_loss(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
939
|
+
response = begin_force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers).value!
|
940
|
+
response.body unless response.nil?
|
941
|
+
end
|
942
|
+
|
943
|
+
#
|
944
|
+
# Fails over from the current primary server to this server. This operation
|
945
|
+
# might result in data loss.
|
946
|
+
#
|
947
|
+
# @param resource_group_name [String] The name of the resource group that
|
948
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
949
|
+
# Manager API or the portal.
|
950
|
+
# @param server_name [String] The name of the server containing the failover
|
951
|
+
# group.
|
952
|
+
# @param failover_group_name [String] The name of the failover group.
|
953
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
954
|
+
# will be added to the HTTP request.
|
955
|
+
#
|
956
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
957
|
+
#
|
958
|
+
def begin_force_failover_allow_data_loss_with_http_info(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
959
|
+
begin_force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers).value!
|
960
|
+
end
|
961
|
+
|
962
|
+
#
|
963
|
+
# Fails over from the current primary server to this server. This operation
|
964
|
+
# might result in data loss.
|
965
|
+
#
|
966
|
+
# @param resource_group_name [String] The name of the resource group that
|
967
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
968
|
+
# Manager API or the portal.
|
969
|
+
# @param server_name [String] The name of the server containing the failover
|
970
|
+
# group.
|
971
|
+
# @param failover_group_name [String] The name of the failover group.
|
972
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
973
|
+
# to the HTTP request.
|
974
|
+
#
|
975
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
976
|
+
#
|
977
|
+
def begin_force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers = nil)
|
978
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
979
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
980
|
+
fail ArgumentError, 'failover_group_name is nil' if failover_group_name.nil?
|
981
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
982
|
+
api_version = '2015-05-01-preview'
|
983
|
+
|
984
|
+
|
985
|
+
request_headers = {}
|
986
|
+
|
987
|
+
# Set Headers
|
988
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
989
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
990
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss'
|
991
|
+
|
992
|
+
request_url = @base_url || @client.base_url
|
993
|
+
|
994
|
+
options = {
|
995
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
996
|
+
path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'failoverGroupName' => failover_group_name,'subscriptionId' => @client.subscription_id},
|
997
|
+
query_params: {'api-version' => api_version},
|
998
|
+
headers: request_headers.merge(custom_headers || {}),
|
999
|
+
base_url: request_url
|
1000
|
+
}
|
1001
|
+
promise = @client.make_request_async(:post, path_template, options)
|
1002
|
+
|
1003
|
+
promise = promise.then do |result|
|
1004
|
+
http_response = result.response
|
1005
|
+
status_code = http_response.status
|
1006
|
+
response_content = http_response.body
|
1007
|
+
unless status_code == 200 || status_code == 202
|
1008
|
+
error_model = JSON.load(response_content)
|
1009
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1010
|
+
end
|
1011
|
+
|
1012
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1013
|
+
# Deserialize Response
|
1014
|
+
if status_code == 200
|
1015
|
+
begin
|
1016
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1017
|
+
result_mapper = Azure::ARM::SQL::Models::FailoverGroup.mapper()
|
1018
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1019
|
+
rescue Exception => e
|
1020
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1021
|
+
end
|
1022
|
+
end
|
1023
|
+
|
1024
|
+
result
|
1025
|
+
end
|
1026
|
+
|
1027
|
+
promise.execute
|
1028
|
+
end
|
1029
|
+
|
1030
|
+
#
|
1031
|
+
# Lists the failover groups in a server.
|
1032
|
+
#
|
1033
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1034
|
+
# to List operation.
|
1035
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1036
|
+
# will be added to the HTTP request.
|
1037
|
+
#
|
1038
|
+
# @return [FailoverGroupListResult] operation results.
|
1039
|
+
#
|
1040
|
+
def list_by_server_next(next_page_link, custom_headers = nil)
|
1041
|
+
response = list_by_server_next_async(next_page_link, custom_headers).value!
|
1042
|
+
response.body unless response.nil?
|
1043
|
+
end
|
1044
|
+
|
1045
|
+
#
|
1046
|
+
# Lists the failover groups in a server.
|
1047
|
+
#
|
1048
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1049
|
+
# to List operation.
|
1050
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1051
|
+
# will be added to the HTTP request.
|
1052
|
+
#
|
1053
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1054
|
+
#
|
1055
|
+
def list_by_server_next_with_http_info(next_page_link, custom_headers = nil)
|
1056
|
+
list_by_server_next_async(next_page_link, custom_headers).value!
|
1057
|
+
end
|
1058
|
+
|
1059
|
+
#
|
1060
|
+
# Lists the failover groups in a server.
|
1061
|
+
#
|
1062
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
1063
|
+
# to List operation.
|
1064
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1065
|
+
# to the HTTP request.
|
1066
|
+
#
|
1067
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1068
|
+
#
|
1069
|
+
def list_by_server_next_async(next_page_link, custom_headers = nil)
|
1070
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1071
|
+
|
1072
|
+
|
1073
|
+
request_headers = {}
|
1074
|
+
|
1075
|
+
# Set Headers
|
1076
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1077
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1078
|
+
path_template = '{nextLink}'
|
1079
|
+
|
1080
|
+
request_url = @base_url || @client.base_url
|
1081
|
+
|
1082
|
+
options = {
|
1083
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1084
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1085
|
+
headers: request_headers.merge(custom_headers || {}),
|
1086
|
+
base_url: request_url
|
1087
|
+
}
|
1088
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1089
|
+
|
1090
|
+
promise = promise.then do |result|
|
1091
|
+
http_response = result.response
|
1092
|
+
status_code = http_response.status
|
1093
|
+
response_content = http_response.body
|
1094
|
+
unless status_code == 200
|
1095
|
+
error_model = JSON.load(response_content)
|
1096
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1100
|
+
# Deserialize Response
|
1101
|
+
if status_code == 200
|
1102
|
+
begin
|
1103
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1104
|
+
result_mapper = Azure::ARM::SQL::Models::FailoverGroupListResult.mapper()
|
1105
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1106
|
+
rescue Exception => e
|
1107
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1108
|
+
end
|
1109
|
+
end
|
1110
|
+
|
1111
|
+
result
|
1112
|
+
end
|
1113
|
+
|
1114
|
+
promise.execute
|
1115
|
+
end
|
1116
|
+
|
1117
|
+
#
|
1118
|
+
# Lists the failover groups in a server.
|
1119
|
+
#
|
1120
|
+
# @param resource_group_name [String] The name of the resource group that
|
1121
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
1122
|
+
# Manager API or the portal.
|
1123
|
+
# @param server_name [String] The name of the server containing the failover
|
1124
|
+
# group.
|
1125
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1126
|
+
# will be added to the HTTP request.
|
1127
|
+
#
|
1128
|
+
# @return [FailoverGroupListResult] which provide lazy access to pages of the
|
1129
|
+
# response.
|
1130
|
+
#
|
1131
|
+
def list_by_server_as_lazy(resource_group_name, server_name, custom_headers = nil)
|
1132
|
+
response = list_by_server_async(resource_group_name, server_name, custom_headers).value!
|
1133
|
+
unless response.nil?
|
1134
|
+
page = response.body
|
1135
|
+
page.next_method = Proc.new do |next_page_link|
|
1136
|
+
list_by_server_next_async(next_page_link, custom_headers)
|
1137
|
+
end
|
1138
|
+
page
|
1139
|
+
end
|
1140
|
+
end
|
1141
|
+
|
1142
|
+
end
|
1143
|
+
end
|