azure_mgmt_sql 0.7.0 → 0.8.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 +63 -6
- data/lib/generated/azure_mgmt_sql/databases.rb +2170 -0
- data/lib/generated/azure_mgmt_sql/elastic_pools.rb +950 -0
- data/lib/generated/azure_mgmt_sql/models/column.rb +90 -0
- data/lib/generated/azure_mgmt_sql/models/create_mode.rb +21 -0
- data/lib/generated/azure_mgmt_sql/models/database.rb +366 -0
- data/lib/generated/azure_mgmt_sql/models/database_editions.rb +22 -0
- data/lib/generated/azure_mgmt_sql/models/database_list_result.rb +53 -0
- data/lib/generated/azure_mgmt_sql/models/database_metric.rb +100 -0
- data/lib/generated/azure_mgmt_sql/models/database_metric_list_result.rb +53 -0
- data/lib/generated/azure_mgmt_sql/models/elastic_pool.rb +158 -0
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_activity.rb +257 -0
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_activity_list_result.rb +54 -0
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_database_activity.rb +249 -0
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_database_activity_list_result.rb +54 -0
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_editions.rb +17 -0
- data/lib/generated/azure_mgmt_sql/models/elastic_pool_list_result.rb +53 -0
- data/lib/generated/azure_mgmt_sql/models/{state.rb → elastic_pool_state.rb} +5 -5
- data/lib/generated/azure_mgmt_sql/models/operation_impact.rb +80 -0
- data/lib/generated/azure_mgmt_sql/models/recommended_database_properties.rb +68 -0
- data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool.rb +216 -0
- data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_list_metrics_result.rb +54 -0
- data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_list_result.rb +54 -0
- data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_metric.rb +65 -0
- data/lib/generated/azure_mgmt_sql/models/recommended_index.rb +260 -0
- data/lib/generated/azure_mgmt_sql/models/recommended_index_actions.rb +17 -0
- data/lib/generated/azure_mgmt_sql/models/recommended_index_states.rb +25 -0
- data/lib/generated/azure_mgmt_sql/models/recommended_index_types.rb +18 -0
- data/lib/generated/azure_mgmt_sql/models/replication_link.rb +149 -0
- data/lib/generated/azure_mgmt_sql/models/replication_link_list_result.rb +54 -0
- data/lib/generated/azure_mgmt_sql/models/replication_role.rb +19 -0
- data/lib/generated/azure_mgmt_sql/models/replication_state.rb +18 -0
- data/lib/generated/azure_mgmt_sql/models/restore_point.rb +117 -0
- data/lib/generated/azure_mgmt_sql/models/restore_point_list_result.rb +54 -0
- data/lib/generated/azure_mgmt_sql/models/restore_point_types.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/schema.rb +98 -0
- data/lib/generated/azure_mgmt_sql/models/{server_security_alert_policy.rb → server.rb} +32 -37
- data/lib/generated/azure_mgmt_sql/models/server_firewall_rule.rb +95 -0
- data/lib/generated/azure_mgmt_sql/models/server_firewall_rule_list_result.rb +53 -0
- data/lib/generated/azure_mgmt_sql/models/server_list_result.rb +52 -0
- data/lib/generated/azure_mgmt_sql/models/server_metric.rb +100 -0
- data/lib/generated/azure_mgmt_sql/models/server_metric_list_result.rb +53 -0
- data/lib/generated/azure_mgmt_sql/models/server_version.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/service_objective.rb +107 -0
- data/lib/generated/azure_mgmt_sql/models/service_objective_list_result.rb +54 -0
- data/lib/generated/azure_mgmt_sql/models/service_objective_name.rb +22 -0
- data/lib/generated/azure_mgmt_sql/models/service_tier_advisor.rb +282 -0
- data/lib/generated/azure_mgmt_sql/models/service_tier_advisor_list_result.rb +53 -0
- data/lib/generated/azure_mgmt_sql/models/slo_usage_metric.rb +111 -0
- data/lib/generated/azure_mgmt_sql/models/sql_sub_resource.rb +56 -0
- data/lib/generated/azure_mgmt_sql/models/table.rb +131 -0
- data/lib/generated/azure_mgmt_sql/models/table_type.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/target_database_editions.rb +20 -0
- data/lib/generated/azure_mgmt_sql/models/target_elastic_pool_editions.rb +17 -0
- data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption.rb +63 -0
- data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity.rb +74 -0
- data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity_list_result.rb +55 -0
- data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity_states.rb +16 -0
- data/lib/generated/azure_mgmt_sql/models/{email_account_admins.rb → transparent_data_encryption_states.rb} +3 -3
- data/lib/generated/azure_mgmt_sql/models/upgrade_hint.rb +99 -0
- data/lib/generated/azure_mgmt_sql/models/upgrade_recommended_elastic_pool_properties.rb +132 -0
- data/lib/generated/azure_mgmt_sql/module_definition.rb +1 -1
- data/lib/generated/azure_mgmt_sql/recommended_elastic_pools.rb +555 -0
- data/lib/generated/azure_mgmt_sql/servers.rb +1233 -0
- data/lib/generated/azure_mgmt_sql/sql_management_client.rb +31 -10
- data/lib/generated/azure_mgmt_sql/version.rb +2 -2
- metadata +66 -9
- data/lib/generated/azure_mgmt_sql/models/server_security_alert_policy_create_or_update_parameters.rb +0 -85
- data/lib/generated/azure_mgmt_sql/security_alert_policy.rb +0 -296
|
@@ -0,0 +1,1233 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.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 Servers
|
|
14
|
+
include Azure::ARM::SQL::Models
|
|
15
|
+
include MsRestAzure
|
|
16
|
+
|
|
17
|
+
#
|
|
18
|
+
# Creates and initializes a new instance of the Servers class.
|
|
19
|
+
# @param client service class for accessing basic functionality.
|
|
20
|
+
#
|
|
21
|
+
def initialize(client)
|
|
22
|
+
@client = client
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# @return [SqlManagementClient] reference to the SqlManagementClient
|
|
26
|
+
attr_reader :client
|
|
27
|
+
|
|
28
|
+
#
|
|
29
|
+
# Creates or updates an Azure SQL server firewall rule.
|
|
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 Azure SQL server.
|
|
35
|
+
# @param firewall_rule_name [String] The name of the Azure SQL server firewall
|
|
36
|
+
# rule.
|
|
37
|
+
# @param parameters [ServerFirewallRule] The required parameters for creating
|
|
38
|
+
# or updating a firewall rule.
|
|
39
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
40
|
+
# will be added to the HTTP request.
|
|
41
|
+
#
|
|
42
|
+
# @return [ServerFirewallRule] operation results.
|
|
43
|
+
#
|
|
44
|
+
def create_or_update_firewall_rule(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers = nil)
|
|
45
|
+
response = create_or_update_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers).value!
|
|
46
|
+
response.body unless response.nil?
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
#
|
|
50
|
+
# Creates or updates an Azure SQL server firewall rule.
|
|
51
|
+
#
|
|
52
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
53
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
54
|
+
# Manager API or the portal.
|
|
55
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
56
|
+
# @param firewall_rule_name [String] The name of the Azure SQL server firewall
|
|
57
|
+
# rule.
|
|
58
|
+
# @param parameters [ServerFirewallRule] The required parameters for creating
|
|
59
|
+
# or updating a firewall rule.
|
|
60
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
61
|
+
# will be added to the HTTP request.
|
|
62
|
+
#
|
|
63
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
64
|
+
#
|
|
65
|
+
def create_or_update_firewall_rule_with_http_info(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers = nil)
|
|
66
|
+
create_or_update_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers).value!
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
#
|
|
70
|
+
# Creates or updates an Azure SQL server firewall rule.
|
|
71
|
+
#
|
|
72
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
73
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
74
|
+
# Manager API or the portal.
|
|
75
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
76
|
+
# @param firewall_rule_name [String] The name of the Azure SQL server firewall
|
|
77
|
+
# rule.
|
|
78
|
+
# @param parameters [ServerFirewallRule] The required parameters for creating
|
|
79
|
+
# or updating a firewall rule.
|
|
80
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
81
|
+
# to the HTTP request.
|
|
82
|
+
#
|
|
83
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
84
|
+
#
|
|
85
|
+
def create_or_update_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers = nil)
|
|
86
|
+
api_version = '2014-04-01'
|
|
87
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
88
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
89
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
90
|
+
fail ArgumentError, 'firewall_rule_name is nil' if firewall_rule_name.nil?
|
|
91
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
request_headers = {}
|
|
95
|
+
|
|
96
|
+
# Set Headers
|
|
97
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
98
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
99
|
+
|
|
100
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
101
|
+
|
|
102
|
+
# Serialize Request
|
|
103
|
+
request_mapper = ServerFirewallRule.mapper()
|
|
104
|
+
request_content = @client.serialize(request_mapper, parameters, 'parameters')
|
|
105
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
|
106
|
+
|
|
107
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}'
|
|
108
|
+
|
|
109
|
+
request_url = @base_url || @client.base_url
|
|
110
|
+
|
|
111
|
+
options = {
|
|
112
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
113
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'firewallRuleName' => firewall_rule_name},
|
|
114
|
+
query_params: {'api-version' => api_version},
|
|
115
|
+
body: request_content,
|
|
116
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
117
|
+
base_url: request_url
|
|
118
|
+
}
|
|
119
|
+
promise = @client.make_request_async(:put, path_template, options)
|
|
120
|
+
|
|
121
|
+
promise = promise.then do |result|
|
|
122
|
+
http_response = result.response
|
|
123
|
+
status_code = http_response.status
|
|
124
|
+
response_content = http_response.body
|
|
125
|
+
unless status_code == 200 || status_code == 201
|
|
126
|
+
error_model = JSON.load(response_content)
|
|
127
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
131
|
+
# Deserialize Response
|
|
132
|
+
if status_code == 200
|
|
133
|
+
begin
|
|
134
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
135
|
+
result_mapper = ServerFirewallRule.mapper()
|
|
136
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
137
|
+
rescue Exception => e
|
|
138
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
# Deserialize Response
|
|
142
|
+
if status_code == 201
|
|
143
|
+
begin
|
|
144
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
145
|
+
result_mapper = ServerFirewallRule.mapper()
|
|
146
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
147
|
+
rescue Exception => e
|
|
148
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
result
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
promise.execute
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
#
|
|
159
|
+
# Deletes an Azure SQL server firewall rule.
|
|
160
|
+
#
|
|
161
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
162
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
163
|
+
# Manager API or the portal.
|
|
164
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
165
|
+
# @param firewall_rule_name [String] The name of the Azure SQL server firewall
|
|
166
|
+
# rule.
|
|
167
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
168
|
+
# will be added to the HTTP request.
|
|
169
|
+
#
|
|
170
|
+
#
|
|
171
|
+
def delete_firewall_rule(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
|
|
172
|
+
response = delete_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, custom_headers).value!
|
|
173
|
+
nil
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
#
|
|
177
|
+
# Deletes an Azure SQL server firewall rule.
|
|
178
|
+
#
|
|
179
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
180
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
181
|
+
# Manager API or the portal.
|
|
182
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
183
|
+
# @param firewall_rule_name [String] The name of the Azure SQL server firewall
|
|
184
|
+
# rule.
|
|
185
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
186
|
+
# will be added to the HTTP request.
|
|
187
|
+
#
|
|
188
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
189
|
+
#
|
|
190
|
+
def delete_firewall_rule_with_http_info(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
|
|
191
|
+
delete_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, custom_headers).value!
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
#
|
|
195
|
+
# Deletes an Azure SQL server firewall rule.
|
|
196
|
+
#
|
|
197
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
198
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
199
|
+
# Manager API or the portal.
|
|
200
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
201
|
+
# @param firewall_rule_name [String] The name of the Azure SQL server firewall
|
|
202
|
+
# rule.
|
|
203
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
204
|
+
# to the HTTP request.
|
|
205
|
+
#
|
|
206
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
207
|
+
#
|
|
208
|
+
def delete_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
|
|
209
|
+
api_version = '2014-04-01'
|
|
210
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
211
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
212
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
213
|
+
fail ArgumentError, 'firewall_rule_name is nil' if firewall_rule_name.nil?
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
request_headers = {}
|
|
217
|
+
|
|
218
|
+
# Set Headers
|
|
219
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
220
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
221
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}'
|
|
222
|
+
|
|
223
|
+
request_url = @base_url || @client.base_url
|
|
224
|
+
|
|
225
|
+
options = {
|
|
226
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
227
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'firewallRuleName' => firewall_rule_name},
|
|
228
|
+
query_params: {'api-version' => api_version},
|
|
229
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
230
|
+
base_url: request_url
|
|
231
|
+
}
|
|
232
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
|
233
|
+
|
|
234
|
+
promise = promise.then do |result|
|
|
235
|
+
http_response = result.response
|
|
236
|
+
status_code = http_response.status
|
|
237
|
+
response_content = http_response.body
|
|
238
|
+
unless status_code == 200 || status_code == 204
|
|
239
|
+
error_model = JSON.load(response_content)
|
|
240
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
244
|
+
|
|
245
|
+
result
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
promise.execute
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
#
|
|
252
|
+
# Returns an Azure SQL server firewall rule.
|
|
253
|
+
#
|
|
254
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
255
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
256
|
+
# Manager API or the portal.
|
|
257
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
258
|
+
# @param firewall_rule_name [String] The name of the Azure SQL server firewall
|
|
259
|
+
# rule.
|
|
260
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
261
|
+
# will be added to the HTTP request.
|
|
262
|
+
#
|
|
263
|
+
# @return [ServerFirewallRule] operation results.
|
|
264
|
+
#
|
|
265
|
+
def get_firewall_rule(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
|
|
266
|
+
response = get_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, custom_headers).value!
|
|
267
|
+
response.body unless response.nil?
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
#
|
|
271
|
+
# Returns an Azure SQL server firewall rule.
|
|
272
|
+
#
|
|
273
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
274
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
275
|
+
# Manager API or the portal.
|
|
276
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
277
|
+
# @param firewall_rule_name [String] The name of the Azure SQL server firewall
|
|
278
|
+
# rule.
|
|
279
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
280
|
+
# will be added to the HTTP request.
|
|
281
|
+
#
|
|
282
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
283
|
+
#
|
|
284
|
+
def get_firewall_rule_with_http_info(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
|
|
285
|
+
get_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, custom_headers).value!
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
#
|
|
289
|
+
# Returns an Azure SQL server firewall rule.
|
|
290
|
+
#
|
|
291
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
292
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
293
|
+
# Manager API or the portal.
|
|
294
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
295
|
+
# @param firewall_rule_name [String] The name of the Azure SQL server firewall
|
|
296
|
+
# rule.
|
|
297
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
298
|
+
# to the HTTP request.
|
|
299
|
+
#
|
|
300
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
301
|
+
#
|
|
302
|
+
def get_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
|
|
303
|
+
api_version = '2014-04-01'
|
|
304
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
305
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
306
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
307
|
+
fail ArgumentError, 'firewall_rule_name is nil' if firewall_rule_name.nil?
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
request_headers = {}
|
|
311
|
+
|
|
312
|
+
# Set Headers
|
|
313
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
314
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
315
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}'
|
|
316
|
+
|
|
317
|
+
request_url = @base_url || @client.base_url
|
|
318
|
+
|
|
319
|
+
options = {
|
|
320
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
321
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'firewallRuleName' => firewall_rule_name},
|
|
322
|
+
query_params: {'api-version' => api_version},
|
|
323
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
324
|
+
base_url: request_url
|
|
325
|
+
}
|
|
326
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
327
|
+
|
|
328
|
+
promise = promise.then do |result|
|
|
329
|
+
http_response = result.response
|
|
330
|
+
status_code = http_response.status
|
|
331
|
+
response_content = http_response.body
|
|
332
|
+
unless status_code == 200
|
|
333
|
+
error_model = JSON.load(response_content)
|
|
334
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
338
|
+
# Deserialize Response
|
|
339
|
+
if status_code == 200
|
|
340
|
+
begin
|
|
341
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
342
|
+
result_mapper = ServerFirewallRule.mapper()
|
|
343
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
344
|
+
rescue Exception => e
|
|
345
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
346
|
+
end
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
result
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
promise.execute
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
#
|
|
356
|
+
# Returns a list of Azure SQL server firewall rules.
|
|
357
|
+
#
|
|
358
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
359
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
360
|
+
# Manager API or the portal.
|
|
361
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
362
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
363
|
+
# will be added to the HTTP request.
|
|
364
|
+
#
|
|
365
|
+
# @return [ServerFirewallRuleListResult] operation results.
|
|
366
|
+
#
|
|
367
|
+
def list_firewall_rules(resource_group_name, server_name, custom_headers = nil)
|
|
368
|
+
response = list_firewall_rules_async(resource_group_name, server_name, custom_headers).value!
|
|
369
|
+
response.body unless response.nil?
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
#
|
|
373
|
+
# Returns a list of Azure SQL server firewall rules.
|
|
374
|
+
#
|
|
375
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
376
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
377
|
+
# Manager API or the portal.
|
|
378
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
379
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
380
|
+
# will be added to the HTTP request.
|
|
381
|
+
#
|
|
382
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
383
|
+
#
|
|
384
|
+
def list_firewall_rules_with_http_info(resource_group_name, server_name, custom_headers = nil)
|
|
385
|
+
list_firewall_rules_async(resource_group_name, server_name, custom_headers).value!
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
#
|
|
389
|
+
# Returns a list of Azure SQL server firewall rules.
|
|
390
|
+
#
|
|
391
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
392
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
393
|
+
# Manager API or the portal.
|
|
394
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
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_firewall_rules_async(resource_group_name, server_name, custom_headers = nil)
|
|
401
|
+
api_version = '2014-04-01'
|
|
402
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
403
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
404
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
request_headers = {}
|
|
408
|
+
|
|
409
|
+
# Set Headers
|
|
410
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
411
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
412
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules'
|
|
413
|
+
|
|
414
|
+
request_url = @base_url || @client.base_url
|
|
415
|
+
|
|
416
|
+
options = {
|
|
417
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
418
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
|
419
|
+
query_params: {'api-version' => api_version},
|
|
420
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
421
|
+
base_url: request_url
|
|
422
|
+
}
|
|
423
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
424
|
+
|
|
425
|
+
promise = promise.then do |result|
|
|
426
|
+
http_response = result.response
|
|
427
|
+
status_code = http_response.status
|
|
428
|
+
response_content = http_response.body
|
|
429
|
+
unless status_code == 200
|
|
430
|
+
error_model = JSON.load(response_content)
|
|
431
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
435
|
+
# Deserialize Response
|
|
436
|
+
if status_code == 200
|
|
437
|
+
begin
|
|
438
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
439
|
+
result_mapper = ServerFirewallRuleListResult.mapper()
|
|
440
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
441
|
+
rescue Exception => e
|
|
442
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
443
|
+
end
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
result
|
|
447
|
+
end
|
|
448
|
+
|
|
449
|
+
promise.execute
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
#
|
|
453
|
+
# Returns information about an Azure SQL server.
|
|
454
|
+
#
|
|
455
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
456
|
+
# will be added to the HTTP request.
|
|
457
|
+
#
|
|
458
|
+
# @return [ServerListResult] operation results.
|
|
459
|
+
#
|
|
460
|
+
def list(custom_headers = nil)
|
|
461
|
+
response = list_async(custom_headers).value!
|
|
462
|
+
response.body unless response.nil?
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
#
|
|
466
|
+
# Returns information about an Azure SQL server.
|
|
467
|
+
#
|
|
468
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
469
|
+
# will be added to the HTTP request.
|
|
470
|
+
#
|
|
471
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
472
|
+
#
|
|
473
|
+
def list_with_http_info(custom_headers = nil)
|
|
474
|
+
list_async(custom_headers).value!
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
#
|
|
478
|
+
# Returns information about an Azure SQL server.
|
|
479
|
+
#
|
|
480
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
481
|
+
# to the HTTP request.
|
|
482
|
+
#
|
|
483
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
484
|
+
#
|
|
485
|
+
def list_async(custom_headers = nil)
|
|
486
|
+
api_version = '2014-04-01'
|
|
487
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
request_headers = {}
|
|
491
|
+
|
|
492
|
+
# Set Headers
|
|
493
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
494
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
495
|
+
path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers'
|
|
496
|
+
|
|
497
|
+
request_url = @base_url || @client.base_url
|
|
498
|
+
|
|
499
|
+
options = {
|
|
500
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
501
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
|
502
|
+
query_params: {'api-version' => api_version},
|
|
503
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
504
|
+
base_url: request_url
|
|
505
|
+
}
|
|
506
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
507
|
+
|
|
508
|
+
promise = promise.then do |result|
|
|
509
|
+
http_response = result.response
|
|
510
|
+
status_code = http_response.status
|
|
511
|
+
response_content = http_response.body
|
|
512
|
+
unless status_code == 200
|
|
513
|
+
error_model = JSON.load(response_content)
|
|
514
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
515
|
+
end
|
|
516
|
+
|
|
517
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
518
|
+
# Deserialize Response
|
|
519
|
+
if status_code == 200
|
|
520
|
+
begin
|
|
521
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
522
|
+
result_mapper = ServerListResult.mapper()
|
|
523
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
524
|
+
rescue Exception => e
|
|
525
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
526
|
+
end
|
|
527
|
+
end
|
|
528
|
+
|
|
529
|
+
result
|
|
530
|
+
end
|
|
531
|
+
|
|
532
|
+
promise.execute
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
#
|
|
536
|
+
# Creates a new Azure SQL 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 Azure SQL server.
|
|
542
|
+
# @param parameters [Server] The required parameters for creating or updating a
|
|
543
|
+
# server.
|
|
544
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
545
|
+
# will be added to the HTTP request.
|
|
546
|
+
#
|
|
547
|
+
# @return [Server] operation results.
|
|
548
|
+
#
|
|
549
|
+
def create_or_update(resource_group_name, server_name, parameters, custom_headers = nil)
|
|
550
|
+
response = create_or_update_async(resource_group_name, server_name, parameters, custom_headers).value!
|
|
551
|
+
response.body unless response.nil?
|
|
552
|
+
end
|
|
553
|
+
|
|
554
|
+
#
|
|
555
|
+
# Creates a new Azure SQL server.
|
|
556
|
+
#
|
|
557
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
558
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
559
|
+
# Manager API or the portal.
|
|
560
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
561
|
+
# @param parameters [Server] The required parameters for creating or updating a
|
|
562
|
+
# server.
|
|
563
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
564
|
+
# will be added to the HTTP request.
|
|
565
|
+
#
|
|
566
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
567
|
+
#
|
|
568
|
+
def create_or_update_with_http_info(resource_group_name, server_name, parameters, custom_headers = nil)
|
|
569
|
+
create_or_update_async(resource_group_name, server_name, parameters, custom_headers).value!
|
|
570
|
+
end
|
|
571
|
+
|
|
572
|
+
#
|
|
573
|
+
# Creates a new Azure SQL server.
|
|
574
|
+
#
|
|
575
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
576
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
577
|
+
# Manager API or the portal.
|
|
578
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
579
|
+
# @param parameters [Server] The required parameters for creating or updating a
|
|
580
|
+
# server.
|
|
581
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
582
|
+
# to the HTTP request.
|
|
583
|
+
#
|
|
584
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
585
|
+
#
|
|
586
|
+
def create_or_update_async(resource_group_name, server_name, parameters, custom_headers = nil)
|
|
587
|
+
api_version = '2014-04-01'
|
|
588
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
589
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
590
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
591
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
request_headers = {}
|
|
595
|
+
|
|
596
|
+
# Set Headers
|
|
597
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
598
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
599
|
+
|
|
600
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
601
|
+
|
|
602
|
+
# Serialize Request
|
|
603
|
+
request_mapper = Server.mapper()
|
|
604
|
+
request_content = @client.serialize(request_mapper, parameters, 'parameters')
|
|
605
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
|
606
|
+
|
|
607
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}'
|
|
608
|
+
|
|
609
|
+
request_url = @base_url || @client.base_url
|
|
610
|
+
|
|
611
|
+
options = {
|
|
612
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
613
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
|
614
|
+
query_params: {'api-version' => api_version},
|
|
615
|
+
body: request_content,
|
|
616
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
617
|
+
base_url: request_url
|
|
618
|
+
}
|
|
619
|
+
promise = @client.make_request_async(:put, path_template, options)
|
|
620
|
+
|
|
621
|
+
promise = promise.then do |result|
|
|
622
|
+
http_response = result.response
|
|
623
|
+
status_code = http_response.status
|
|
624
|
+
response_content = http_response.body
|
|
625
|
+
unless status_code == 200 || status_code == 201
|
|
626
|
+
error_model = JSON.load(response_content)
|
|
627
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
628
|
+
end
|
|
629
|
+
|
|
630
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
631
|
+
# Deserialize Response
|
|
632
|
+
if status_code == 200
|
|
633
|
+
begin
|
|
634
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
635
|
+
result_mapper = Server.mapper()
|
|
636
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
637
|
+
rescue Exception => e
|
|
638
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
639
|
+
end
|
|
640
|
+
end
|
|
641
|
+
# Deserialize Response
|
|
642
|
+
if status_code == 201
|
|
643
|
+
begin
|
|
644
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
645
|
+
result_mapper = Server.mapper()
|
|
646
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
647
|
+
rescue Exception => e
|
|
648
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
649
|
+
end
|
|
650
|
+
end
|
|
651
|
+
|
|
652
|
+
result
|
|
653
|
+
end
|
|
654
|
+
|
|
655
|
+
promise.execute
|
|
656
|
+
end
|
|
657
|
+
|
|
658
|
+
#
|
|
659
|
+
# Deletes a SQL server.
|
|
660
|
+
#
|
|
661
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
662
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
663
|
+
# Manager API or the portal.
|
|
664
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
665
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
666
|
+
# will be added to the HTTP request.
|
|
667
|
+
#
|
|
668
|
+
#
|
|
669
|
+
def delete(resource_group_name, server_name, custom_headers = nil)
|
|
670
|
+
response = delete_async(resource_group_name, server_name, custom_headers).value!
|
|
671
|
+
nil
|
|
672
|
+
end
|
|
673
|
+
|
|
674
|
+
#
|
|
675
|
+
# Deletes a SQL server.
|
|
676
|
+
#
|
|
677
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
678
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
679
|
+
# Manager API or the portal.
|
|
680
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
681
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
682
|
+
# will be added to the HTTP request.
|
|
683
|
+
#
|
|
684
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
685
|
+
#
|
|
686
|
+
def delete_with_http_info(resource_group_name, server_name, custom_headers = nil)
|
|
687
|
+
delete_async(resource_group_name, server_name, custom_headers).value!
|
|
688
|
+
end
|
|
689
|
+
|
|
690
|
+
#
|
|
691
|
+
# Deletes a SQL server.
|
|
692
|
+
#
|
|
693
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
694
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
695
|
+
# Manager API or the portal.
|
|
696
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
697
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
698
|
+
# to the HTTP request.
|
|
699
|
+
#
|
|
700
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
701
|
+
#
|
|
702
|
+
def delete_async(resource_group_name, server_name, custom_headers = nil)
|
|
703
|
+
api_version = '2014-04-01'
|
|
704
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
705
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
706
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
request_headers = {}
|
|
710
|
+
|
|
711
|
+
# Set Headers
|
|
712
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
713
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
714
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}'
|
|
715
|
+
|
|
716
|
+
request_url = @base_url || @client.base_url
|
|
717
|
+
|
|
718
|
+
options = {
|
|
719
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
720
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
|
721
|
+
query_params: {'api-version' => api_version},
|
|
722
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
723
|
+
base_url: request_url
|
|
724
|
+
}
|
|
725
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
|
726
|
+
|
|
727
|
+
promise = promise.then do |result|
|
|
728
|
+
http_response = result.response
|
|
729
|
+
status_code = http_response.status
|
|
730
|
+
response_content = http_response.body
|
|
731
|
+
unless status_code == 200 || status_code == 204
|
|
732
|
+
error_model = JSON.load(response_content)
|
|
733
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
734
|
+
end
|
|
735
|
+
|
|
736
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
737
|
+
|
|
738
|
+
result
|
|
739
|
+
end
|
|
740
|
+
|
|
741
|
+
promise.execute
|
|
742
|
+
end
|
|
743
|
+
|
|
744
|
+
#
|
|
745
|
+
# Gets information about an Azure SQL server.
|
|
746
|
+
#
|
|
747
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
748
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
749
|
+
# Manager API or the portal.
|
|
750
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
751
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
752
|
+
# will be added to the HTTP request.
|
|
753
|
+
#
|
|
754
|
+
# @return [Server] operation results.
|
|
755
|
+
#
|
|
756
|
+
def get_by_resource_group(resource_group_name, server_name, custom_headers = nil)
|
|
757
|
+
response = get_by_resource_group_async(resource_group_name, server_name, custom_headers).value!
|
|
758
|
+
response.body unless response.nil?
|
|
759
|
+
end
|
|
760
|
+
|
|
761
|
+
#
|
|
762
|
+
# Gets information about an Azure SQL server.
|
|
763
|
+
#
|
|
764
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
765
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
766
|
+
# Manager API or the portal.
|
|
767
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
768
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
769
|
+
# will be added to the HTTP request.
|
|
770
|
+
#
|
|
771
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
772
|
+
#
|
|
773
|
+
def get_by_resource_group_with_http_info(resource_group_name, server_name, custom_headers = nil)
|
|
774
|
+
get_by_resource_group_async(resource_group_name, server_name, custom_headers).value!
|
|
775
|
+
end
|
|
776
|
+
|
|
777
|
+
#
|
|
778
|
+
# Gets information about an Azure SQL server.
|
|
779
|
+
#
|
|
780
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
781
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
782
|
+
# Manager API or the portal.
|
|
783
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
784
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
785
|
+
# to the HTTP request.
|
|
786
|
+
#
|
|
787
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
788
|
+
#
|
|
789
|
+
def get_by_resource_group_async(resource_group_name, server_name, custom_headers = nil)
|
|
790
|
+
api_version = '2014-04-01'
|
|
791
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
792
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
793
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
request_headers = {}
|
|
797
|
+
|
|
798
|
+
# Set Headers
|
|
799
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
800
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
801
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}'
|
|
802
|
+
|
|
803
|
+
request_url = @base_url || @client.base_url
|
|
804
|
+
|
|
805
|
+
options = {
|
|
806
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
807
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
|
808
|
+
query_params: {'api-version' => api_version},
|
|
809
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
810
|
+
base_url: request_url
|
|
811
|
+
}
|
|
812
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
813
|
+
|
|
814
|
+
promise = promise.then do |result|
|
|
815
|
+
http_response = result.response
|
|
816
|
+
status_code = http_response.status
|
|
817
|
+
response_content = http_response.body
|
|
818
|
+
unless status_code == 200
|
|
819
|
+
error_model = JSON.load(response_content)
|
|
820
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
821
|
+
end
|
|
822
|
+
|
|
823
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
824
|
+
# Deserialize Response
|
|
825
|
+
if status_code == 200
|
|
826
|
+
begin
|
|
827
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
828
|
+
result_mapper = Server.mapper()
|
|
829
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
830
|
+
rescue Exception => e
|
|
831
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
832
|
+
end
|
|
833
|
+
end
|
|
834
|
+
|
|
835
|
+
result
|
|
836
|
+
end
|
|
837
|
+
|
|
838
|
+
promise.execute
|
|
839
|
+
end
|
|
840
|
+
|
|
841
|
+
#
|
|
842
|
+
# Returns information about an Azure SQL server.
|
|
843
|
+
#
|
|
844
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
845
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
846
|
+
# Manager API or the portal.
|
|
847
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
848
|
+
# will be added to the HTTP request.
|
|
849
|
+
#
|
|
850
|
+
# @return [ServerListResult] operation results.
|
|
851
|
+
#
|
|
852
|
+
def list_by_resource_group(resource_group_name, custom_headers = nil)
|
|
853
|
+
response = list_by_resource_group_async(resource_group_name, custom_headers).value!
|
|
854
|
+
response.body unless response.nil?
|
|
855
|
+
end
|
|
856
|
+
|
|
857
|
+
#
|
|
858
|
+
# Returns information about an Azure SQL server.
|
|
859
|
+
#
|
|
860
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
861
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
862
|
+
# Manager API or the portal.
|
|
863
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
864
|
+
# will be added to the HTTP request.
|
|
865
|
+
#
|
|
866
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
867
|
+
#
|
|
868
|
+
def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
|
|
869
|
+
list_by_resource_group_async(resource_group_name, custom_headers).value!
|
|
870
|
+
end
|
|
871
|
+
|
|
872
|
+
#
|
|
873
|
+
# Returns information about an Azure SQL server.
|
|
874
|
+
#
|
|
875
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
876
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
877
|
+
# Manager API or the portal.
|
|
878
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
879
|
+
# to the HTTP request.
|
|
880
|
+
#
|
|
881
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
882
|
+
#
|
|
883
|
+
def list_by_resource_group_async(resource_group_name, custom_headers = nil)
|
|
884
|
+
api_version = '2014-04-01'
|
|
885
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
886
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
request_headers = {}
|
|
890
|
+
|
|
891
|
+
# Set Headers
|
|
892
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
893
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
894
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers'
|
|
895
|
+
|
|
896
|
+
request_url = @base_url || @client.base_url
|
|
897
|
+
|
|
898
|
+
options = {
|
|
899
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
900
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
|
|
901
|
+
query_params: {'api-version' => api_version},
|
|
902
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
903
|
+
base_url: request_url
|
|
904
|
+
}
|
|
905
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
906
|
+
|
|
907
|
+
promise = promise.then do |result|
|
|
908
|
+
http_response = result.response
|
|
909
|
+
status_code = http_response.status
|
|
910
|
+
response_content = http_response.body
|
|
911
|
+
unless status_code == 200
|
|
912
|
+
error_model = JSON.load(response_content)
|
|
913
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
914
|
+
end
|
|
915
|
+
|
|
916
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
917
|
+
# Deserialize Response
|
|
918
|
+
if status_code == 200
|
|
919
|
+
begin
|
|
920
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
921
|
+
result_mapper = ServerListResult.mapper()
|
|
922
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
923
|
+
rescue Exception => e
|
|
924
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
925
|
+
end
|
|
926
|
+
end
|
|
927
|
+
|
|
928
|
+
result
|
|
929
|
+
end
|
|
930
|
+
|
|
931
|
+
promise.execute
|
|
932
|
+
end
|
|
933
|
+
|
|
934
|
+
#
|
|
935
|
+
# Returns information about Azure SQL server usage.
|
|
936
|
+
#
|
|
937
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
938
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
939
|
+
# Manager API or the portal.
|
|
940
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
941
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
942
|
+
# will be added to the HTTP request.
|
|
943
|
+
#
|
|
944
|
+
# @return [ServerMetricListResult] operation results.
|
|
945
|
+
#
|
|
946
|
+
def list_usages(resource_group_name, server_name, custom_headers = nil)
|
|
947
|
+
response = list_usages_async(resource_group_name, server_name, custom_headers).value!
|
|
948
|
+
response.body unless response.nil?
|
|
949
|
+
end
|
|
950
|
+
|
|
951
|
+
#
|
|
952
|
+
# Returns information about Azure SQL server usage.
|
|
953
|
+
#
|
|
954
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
955
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
956
|
+
# Manager API or the portal.
|
|
957
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
958
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
959
|
+
# will be added to the HTTP request.
|
|
960
|
+
#
|
|
961
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
962
|
+
#
|
|
963
|
+
def list_usages_with_http_info(resource_group_name, server_name, custom_headers = nil)
|
|
964
|
+
list_usages_async(resource_group_name, server_name, custom_headers).value!
|
|
965
|
+
end
|
|
966
|
+
|
|
967
|
+
#
|
|
968
|
+
# Returns information about Azure SQL server usage.
|
|
969
|
+
#
|
|
970
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
971
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
972
|
+
# Manager API or the portal.
|
|
973
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
974
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
975
|
+
# to the HTTP request.
|
|
976
|
+
#
|
|
977
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
978
|
+
#
|
|
979
|
+
def list_usages_async(resource_group_name, server_name, custom_headers = nil)
|
|
980
|
+
api_version = '2014-04-01'
|
|
981
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
982
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
983
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
request_headers = {}
|
|
987
|
+
|
|
988
|
+
# Set Headers
|
|
989
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
990
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
991
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages'
|
|
992
|
+
|
|
993
|
+
request_url = @base_url || @client.base_url
|
|
994
|
+
|
|
995
|
+
options = {
|
|
996
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
997
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
|
998
|
+
query_params: {'api-version' => api_version},
|
|
999
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
1000
|
+
base_url: request_url
|
|
1001
|
+
}
|
|
1002
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
1003
|
+
|
|
1004
|
+
promise = promise.then do |result|
|
|
1005
|
+
http_response = result.response
|
|
1006
|
+
status_code = http_response.status
|
|
1007
|
+
response_content = http_response.body
|
|
1008
|
+
unless status_code == 200
|
|
1009
|
+
error_model = JSON.load(response_content)
|
|
1010
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
1011
|
+
end
|
|
1012
|
+
|
|
1013
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
1014
|
+
# Deserialize Response
|
|
1015
|
+
if status_code == 200
|
|
1016
|
+
begin
|
|
1017
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
1018
|
+
result_mapper = ServerMetricListResult.mapper()
|
|
1019
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
1020
|
+
rescue Exception => e
|
|
1021
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
1022
|
+
end
|
|
1023
|
+
end
|
|
1024
|
+
|
|
1025
|
+
result
|
|
1026
|
+
end
|
|
1027
|
+
|
|
1028
|
+
promise.execute
|
|
1029
|
+
end
|
|
1030
|
+
|
|
1031
|
+
#
|
|
1032
|
+
# Gets information about an Azure SQL database Service Objective.
|
|
1033
|
+
#
|
|
1034
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
1035
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
1036
|
+
# Manager API or the portal.
|
|
1037
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
1038
|
+
# @param service_objective_name [String] The name of the service objective to
|
|
1039
|
+
# retrieve.
|
|
1040
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
1041
|
+
# will be added to the HTTP request.
|
|
1042
|
+
#
|
|
1043
|
+
# @return [ServiceObjective] operation results.
|
|
1044
|
+
#
|
|
1045
|
+
def get_service_objective(resource_group_name, server_name, service_objective_name, custom_headers = nil)
|
|
1046
|
+
response = get_service_objective_async(resource_group_name, server_name, service_objective_name, custom_headers).value!
|
|
1047
|
+
response.body unless response.nil?
|
|
1048
|
+
end
|
|
1049
|
+
|
|
1050
|
+
#
|
|
1051
|
+
# Gets information about an Azure SQL database Service Objective.
|
|
1052
|
+
#
|
|
1053
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
1054
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
1055
|
+
# Manager API or the portal.
|
|
1056
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
1057
|
+
# @param service_objective_name [String] The name of the service objective to
|
|
1058
|
+
# retrieve.
|
|
1059
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
1060
|
+
# will be added to the HTTP request.
|
|
1061
|
+
#
|
|
1062
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
1063
|
+
#
|
|
1064
|
+
def get_service_objective_with_http_info(resource_group_name, server_name, service_objective_name, custom_headers = nil)
|
|
1065
|
+
get_service_objective_async(resource_group_name, server_name, service_objective_name, custom_headers).value!
|
|
1066
|
+
end
|
|
1067
|
+
|
|
1068
|
+
#
|
|
1069
|
+
# Gets information about an Azure SQL database Service Objective.
|
|
1070
|
+
#
|
|
1071
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
1072
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
1073
|
+
# Manager API or the portal.
|
|
1074
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
1075
|
+
# @param service_objective_name [String] The name of the service objective to
|
|
1076
|
+
# retrieve.
|
|
1077
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
1078
|
+
# to the HTTP request.
|
|
1079
|
+
#
|
|
1080
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
1081
|
+
#
|
|
1082
|
+
def get_service_objective_async(resource_group_name, server_name, service_objective_name, custom_headers = nil)
|
|
1083
|
+
api_version = '2014-04-01'
|
|
1084
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
1085
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
1086
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
1087
|
+
fail ArgumentError, 'service_objective_name is nil' if service_objective_name.nil?
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
request_headers = {}
|
|
1091
|
+
|
|
1092
|
+
# Set Headers
|
|
1093
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
1094
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
1095
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}'
|
|
1096
|
+
|
|
1097
|
+
request_url = @base_url || @client.base_url
|
|
1098
|
+
|
|
1099
|
+
options = {
|
|
1100
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
1101
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'serviceObjectiveName' => service_objective_name},
|
|
1102
|
+
query_params: {'api-version' => api_version},
|
|
1103
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
1104
|
+
base_url: request_url
|
|
1105
|
+
}
|
|
1106
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
1107
|
+
|
|
1108
|
+
promise = promise.then do |result|
|
|
1109
|
+
http_response = result.response
|
|
1110
|
+
status_code = http_response.status
|
|
1111
|
+
response_content = http_response.body
|
|
1112
|
+
unless status_code == 200
|
|
1113
|
+
error_model = JSON.load(response_content)
|
|
1114
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
1115
|
+
end
|
|
1116
|
+
|
|
1117
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
1118
|
+
# Deserialize Response
|
|
1119
|
+
if status_code == 200
|
|
1120
|
+
begin
|
|
1121
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
1122
|
+
result_mapper = ServiceObjective.mapper()
|
|
1123
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
1124
|
+
rescue Exception => e
|
|
1125
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
1126
|
+
end
|
|
1127
|
+
end
|
|
1128
|
+
|
|
1129
|
+
result
|
|
1130
|
+
end
|
|
1131
|
+
|
|
1132
|
+
promise.execute
|
|
1133
|
+
end
|
|
1134
|
+
|
|
1135
|
+
#
|
|
1136
|
+
# Returns information about Azure SQL database Service Objectives.
|
|
1137
|
+
#
|
|
1138
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
1139
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
1140
|
+
# Manager API or the portal.
|
|
1141
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
1142
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
1143
|
+
# will be added to the HTTP request.
|
|
1144
|
+
#
|
|
1145
|
+
# @return [ServiceObjectiveListResult] operation results.
|
|
1146
|
+
#
|
|
1147
|
+
def list_service_objectives(resource_group_name, server_name, custom_headers = nil)
|
|
1148
|
+
response = list_service_objectives_async(resource_group_name, server_name, custom_headers).value!
|
|
1149
|
+
response.body unless response.nil?
|
|
1150
|
+
end
|
|
1151
|
+
|
|
1152
|
+
#
|
|
1153
|
+
# Returns information about Azure SQL database Service Objectives.
|
|
1154
|
+
#
|
|
1155
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
1156
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
1157
|
+
# Manager API or the portal.
|
|
1158
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
1159
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
1160
|
+
# will be added to the HTTP request.
|
|
1161
|
+
#
|
|
1162
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
1163
|
+
#
|
|
1164
|
+
def list_service_objectives_with_http_info(resource_group_name, server_name, custom_headers = nil)
|
|
1165
|
+
list_service_objectives_async(resource_group_name, server_name, custom_headers).value!
|
|
1166
|
+
end
|
|
1167
|
+
|
|
1168
|
+
#
|
|
1169
|
+
# Returns information about Azure SQL database Service Objectives.
|
|
1170
|
+
#
|
|
1171
|
+
# @param resource_group_name [String] The name of the resource group that
|
|
1172
|
+
# contains the resource. You can obtain this value from the Azure Resource
|
|
1173
|
+
# Manager API or the portal.
|
|
1174
|
+
# @param server_name [String] The name of the Azure SQL server.
|
|
1175
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
1176
|
+
# to the HTTP request.
|
|
1177
|
+
#
|
|
1178
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
1179
|
+
#
|
|
1180
|
+
def list_service_objectives_async(resource_group_name, server_name, custom_headers = nil)
|
|
1181
|
+
api_version = '2014-04-01'
|
|
1182
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
1183
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
1184
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
request_headers = {}
|
|
1188
|
+
|
|
1189
|
+
# Set Headers
|
|
1190
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
1191
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
1192
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives'
|
|
1193
|
+
|
|
1194
|
+
request_url = @base_url || @client.base_url
|
|
1195
|
+
|
|
1196
|
+
options = {
|
|
1197
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
1198
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
|
|
1199
|
+
query_params: {'api-version' => api_version},
|
|
1200
|
+
headers: request_headers.merge(custom_headers || {}),
|
|
1201
|
+
base_url: request_url
|
|
1202
|
+
}
|
|
1203
|
+
promise = @client.make_request_async(:get, path_template, options)
|
|
1204
|
+
|
|
1205
|
+
promise = promise.then do |result|
|
|
1206
|
+
http_response = result.response
|
|
1207
|
+
status_code = http_response.status
|
|
1208
|
+
response_content = http_response.body
|
|
1209
|
+
unless status_code == 200
|
|
1210
|
+
error_model = JSON.load(response_content)
|
|
1211
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
|
1212
|
+
end
|
|
1213
|
+
|
|
1214
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
1215
|
+
# Deserialize Response
|
|
1216
|
+
if status_code == 200
|
|
1217
|
+
begin
|
|
1218
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
1219
|
+
result_mapper = ServiceObjectiveListResult.mapper()
|
|
1220
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
1221
|
+
rescue Exception => e
|
|
1222
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
1223
|
+
end
|
|
1224
|
+
end
|
|
1225
|
+
|
|
1226
|
+
result
|
|
1227
|
+
end
|
|
1228
|
+
|
|
1229
|
+
promise.execute
|
|
1230
|
+
end
|
|
1231
|
+
|
|
1232
|
+
end
|
|
1233
|
+
end
|