azure_mgmt_sql 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_sql.rb +63 -6
  3. data/lib/generated/azure_mgmt_sql/databases.rb +2170 -0
  4. data/lib/generated/azure_mgmt_sql/elastic_pools.rb +950 -0
  5. data/lib/generated/azure_mgmt_sql/models/column.rb +90 -0
  6. data/lib/generated/azure_mgmt_sql/models/create_mode.rb +21 -0
  7. data/lib/generated/azure_mgmt_sql/models/database.rb +366 -0
  8. data/lib/generated/azure_mgmt_sql/models/database_editions.rb +22 -0
  9. data/lib/generated/azure_mgmt_sql/models/database_list_result.rb +53 -0
  10. data/lib/generated/azure_mgmt_sql/models/database_metric.rb +100 -0
  11. data/lib/generated/azure_mgmt_sql/models/database_metric_list_result.rb +53 -0
  12. data/lib/generated/azure_mgmt_sql/models/elastic_pool.rb +158 -0
  13. data/lib/generated/azure_mgmt_sql/models/elastic_pool_activity.rb +257 -0
  14. data/lib/generated/azure_mgmt_sql/models/elastic_pool_activity_list_result.rb +54 -0
  15. data/lib/generated/azure_mgmt_sql/models/elastic_pool_database_activity.rb +249 -0
  16. data/lib/generated/azure_mgmt_sql/models/elastic_pool_database_activity_list_result.rb +54 -0
  17. data/lib/generated/azure_mgmt_sql/models/elastic_pool_editions.rb +17 -0
  18. data/lib/generated/azure_mgmt_sql/models/elastic_pool_list_result.rb +53 -0
  19. data/lib/generated/azure_mgmt_sql/models/{state.rb → elastic_pool_state.rb} +5 -5
  20. data/lib/generated/azure_mgmt_sql/models/operation_impact.rb +80 -0
  21. data/lib/generated/azure_mgmt_sql/models/recommended_database_properties.rb +68 -0
  22. data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool.rb +216 -0
  23. data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_list_metrics_result.rb +54 -0
  24. data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_list_result.rb +54 -0
  25. data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_metric.rb +65 -0
  26. data/lib/generated/azure_mgmt_sql/models/recommended_index.rb +260 -0
  27. data/lib/generated/azure_mgmt_sql/models/recommended_index_actions.rb +17 -0
  28. data/lib/generated/azure_mgmt_sql/models/recommended_index_states.rb +25 -0
  29. data/lib/generated/azure_mgmt_sql/models/recommended_index_types.rb +18 -0
  30. data/lib/generated/azure_mgmt_sql/models/replication_link.rb +149 -0
  31. data/lib/generated/azure_mgmt_sql/models/replication_link_list_result.rb +54 -0
  32. data/lib/generated/azure_mgmt_sql/models/replication_role.rb +19 -0
  33. data/lib/generated/azure_mgmt_sql/models/replication_state.rb +18 -0
  34. data/lib/generated/azure_mgmt_sql/models/restore_point.rb +117 -0
  35. data/lib/generated/azure_mgmt_sql/models/restore_point_list_result.rb +54 -0
  36. data/lib/generated/azure_mgmt_sql/models/restore_point_types.rb +16 -0
  37. data/lib/generated/azure_mgmt_sql/models/schema.rb +98 -0
  38. data/lib/generated/azure_mgmt_sql/models/{server_security_alert_policy.rb → server.rb} +32 -37
  39. data/lib/generated/azure_mgmt_sql/models/server_firewall_rule.rb +95 -0
  40. data/lib/generated/azure_mgmt_sql/models/server_firewall_rule_list_result.rb +53 -0
  41. data/lib/generated/azure_mgmt_sql/models/server_list_result.rb +52 -0
  42. data/lib/generated/azure_mgmt_sql/models/server_metric.rb +100 -0
  43. data/lib/generated/azure_mgmt_sql/models/server_metric_list_result.rb +53 -0
  44. data/lib/generated/azure_mgmt_sql/models/server_version.rb +16 -0
  45. data/lib/generated/azure_mgmt_sql/models/service_objective.rb +107 -0
  46. data/lib/generated/azure_mgmt_sql/models/service_objective_list_result.rb +54 -0
  47. data/lib/generated/azure_mgmt_sql/models/service_objective_name.rb +22 -0
  48. data/lib/generated/azure_mgmt_sql/models/service_tier_advisor.rb +282 -0
  49. data/lib/generated/azure_mgmt_sql/models/service_tier_advisor_list_result.rb +53 -0
  50. data/lib/generated/azure_mgmt_sql/models/slo_usage_metric.rb +111 -0
  51. data/lib/generated/azure_mgmt_sql/models/sql_sub_resource.rb +56 -0
  52. data/lib/generated/azure_mgmt_sql/models/table.rb +131 -0
  53. data/lib/generated/azure_mgmt_sql/models/table_type.rb +16 -0
  54. data/lib/generated/azure_mgmt_sql/models/target_database_editions.rb +20 -0
  55. data/lib/generated/azure_mgmt_sql/models/target_elastic_pool_editions.rb +17 -0
  56. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption.rb +63 -0
  57. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity.rb +74 -0
  58. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity_list_result.rb +55 -0
  59. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity_states.rb +16 -0
  60. data/lib/generated/azure_mgmt_sql/models/{email_account_admins.rb → transparent_data_encryption_states.rb} +3 -3
  61. data/lib/generated/azure_mgmt_sql/models/upgrade_hint.rb +99 -0
  62. data/lib/generated/azure_mgmt_sql/models/upgrade_recommended_elastic_pool_properties.rb +132 -0
  63. data/lib/generated/azure_mgmt_sql/module_definition.rb +1 -1
  64. data/lib/generated/azure_mgmt_sql/recommended_elastic_pools.rb +555 -0
  65. data/lib/generated/azure_mgmt_sql/servers.rb +1233 -0
  66. data/lib/generated/azure_mgmt_sql/sql_management_client.rb +31 -10
  67. data/lib/generated/azure_mgmt_sql/version.rb +2 -2
  68. metadata +66 -9
  69. data/lib/generated/azure_mgmt_sql/models/server_security_alert_policy_create_or_update_parameters.rb +0 -85
  70. data/lib/generated/azure_mgmt_sql/security_alert_policy.rb +0 -296
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab0c40061cdecef1ebd6074b9a043e1e85b1c333
4
- data.tar.gz: 5027386d26c94aad6f6a0b2e909368d49249f8a7
3
+ metadata.gz: 2968138c4cb4cc55abff37c7444a76a442d463c4
4
+ data.tar.gz: d45ba92cc69b32560e7939fb90e9861bc0b9c6c1
5
5
  SHA512:
6
- metadata.gz: d70541b77c8d997c1464b0eb8aed6cbd32b68e2fadc8e49afde42e217979d9fe031427a560741b61547febe78f1f46352df8b5c4b1305cb97e77fe05431274ea
7
- data.tar.gz: d5e5e3fe08c2698175db5ea776e10690e30d8694ce4eb640dd08ba91b59849240ad7571c44450b24fa53b74d32388d64d31448e596b3b94b5419b152f933cdef
6
+ metadata.gz: fe64300f79bedff9a3b64a21d8c6029432388ad517c01f9d4c81bcad3b218af0d4a56ee0cb2f65309c062c514887f5bc434d8580f8421388bbf53bf857affb4c
7
+ data.tar.gz: 54e447646559a309c53206e237663a3d9839e7d8d03ab8a9d367e84cb4d8246c392598d412b556911aea9cf412aa96bf426aa161049990691bbb4a55b537df37
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -20,13 +20,70 @@ require 'generated/azure_mgmt_sql/module_definition'
20
20
  require 'ms_rest_azure'
21
21
 
22
22
  module Azure::ARM::SQL
23
- autoload :SecurityAlertPolicy, 'generated/azure_mgmt_sql/security_alert_policy.rb'
23
+ autoload :Servers, 'generated/azure_mgmt_sql/servers.rb'
24
+ autoload :Databases, 'generated/azure_mgmt_sql/databases.rb'
25
+ autoload :ElasticPools, 'generated/azure_mgmt_sql/elastic_pools.rb'
26
+ autoload :RecommendedElasticPools, 'generated/azure_mgmt_sql/recommended_elastic_pools.rb'
24
27
  autoload :SqlManagementClient, 'generated/azure_mgmt_sql/sql_management_client.rb'
25
28
 
26
29
  module Models
27
- autoload :ServerSecurityAlertPolicyCreateOrUpdateParameters, 'generated/azure_mgmt_sql/models/server_security_alert_policy_create_or_update_parameters.rb'
28
- autoload :ServerSecurityAlertPolicy, 'generated/azure_mgmt_sql/models/server_security_alert_policy.rb'
29
- autoload :State, 'generated/azure_mgmt_sql/models/state.rb'
30
- autoload :EmailAccountAdmins, 'generated/azure_mgmt_sql/models/email_account_admins.rb'
30
+ autoload :ElasticPoolListResult, 'generated/azure_mgmt_sql/models/elastic_pool_list_result.rb'
31
+ autoload :DatabaseMetricListResult, 'generated/azure_mgmt_sql/models/database_metric_list_result.rb'
32
+ autoload :ServerFirewallRuleListResult, 'generated/azure_mgmt_sql/models/server_firewall_rule_list_result.rb'
33
+ autoload :DatabaseMetric, 'generated/azure_mgmt_sql/models/database_metric.rb'
34
+ autoload :OperationImpact, 'generated/azure_mgmt_sql/models/operation_impact.rb'
35
+ autoload :RecommendedElasticPoolMetric, 'generated/azure_mgmt_sql/models/recommended_elastic_pool_metric.rb'
36
+ autoload :RestorePointListResult, 'generated/azure_mgmt_sql/models/restore_point_list_result.rb'
37
+ autoload :TransparentDataEncryptionActivityListResult, 'generated/azure_mgmt_sql/models/transparent_data_encryption_activity_list_result.rb'
38
+ autoload :DatabaseListResult, 'generated/azure_mgmt_sql/models/database_list_result.rb'
39
+ autoload :ServiceTierAdvisorListResult, 'generated/azure_mgmt_sql/models/service_tier_advisor_list_result.rb'
40
+ autoload :RecommendedElasticPoolListResult, 'generated/azure_mgmt_sql/models/recommended_elastic_pool_list_result.rb'
41
+ autoload :ServerMetric, 'generated/azure_mgmt_sql/models/server_metric.rb'
42
+ autoload :RecommendedElasticPoolListMetricsResult, 'generated/azure_mgmt_sql/models/recommended_elastic_pool_list_metrics_result.rb'
43
+ autoload :ReplicationLinkListResult, 'generated/azure_mgmt_sql/models/replication_link_list_result.rb'
44
+ autoload :RecommendedDatabaseProperties, 'generated/azure_mgmt_sql/models/recommended_database_properties.rb'
45
+ autoload :ServiceObjectiveListResult, 'generated/azure_mgmt_sql/models/service_objective_list_result.rb'
46
+ autoload :UpgradeRecommendedElasticPoolProperties, 'generated/azure_mgmt_sql/models/upgrade_recommended_elastic_pool_properties.rb'
47
+ autoload :SqlSubResource, 'generated/azure_mgmt_sql/models/sql_sub_resource.rb'
48
+ autoload :ServerListResult, 'generated/azure_mgmt_sql/models/server_list_result.rb'
49
+ autoload :ServerMetricListResult, 'generated/azure_mgmt_sql/models/server_metric_list_result.rb'
50
+ autoload :ElasticPoolDatabaseActivityListResult, 'generated/azure_mgmt_sql/models/elastic_pool_database_activity_list_result.rb'
51
+ autoload :ElasticPoolActivityListResult, 'generated/azure_mgmt_sql/models/elastic_pool_activity_list_result.rb'
52
+ autoload :ServerFirewallRule, 'generated/azure_mgmt_sql/models/server_firewall_rule.rb'
53
+ autoload :ReplicationLink, 'generated/azure_mgmt_sql/models/replication_link.rb'
54
+ autoload :Database, 'generated/azure_mgmt_sql/models/database.rb'
55
+ autoload :ServiceTierAdvisor, 'generated/azure_mgmt_sql/models/service_tier_advisor.rb'
56
+ autoload :SloUsageMetric, 'generated/azure_mgmt_sql/models/slo_usage_metric.rb'
57
+ autoload :UpgradeHint, 'generated/azure_mgmt_sql/models/upgrade_hint.rb'
58
+ autoload :Schema, 'generated/azure_mgmt_sql/models/schema.rb'
59
+ autoload :Table, 'generated/azure_mgmt_sql/models/table.rb'
60
+ autoload :Column, 'generated/azure_mgmt_sql/models/column.rb'
61
+ autoload :RecommendedIndex, 'generated/azure_mgmt_sql/models/recommended_index.rb'
62
+ autoload :TransparentDataEncryption, 'generated/azure_mgmt_sql/models/transparent_data_encryption.rb'
63
+ autoload :RecommendedElasticPool, 'generated/azure_mgmt_sql/models/recommended_elastic_pool.rb'
64
+ autoload :ElasticPool, 'generated/azure_mgmt_sql/models/elastic_pool.rb'
65
+ autoload :ElasticPoolActivity, 'generated/azure_mgmt_sql/models/elastic_pool_activity.rb'
66
+ autoload :ElasticPoolDatabaseActivity, 'generated/azure_mgmt_sql/models/elastic_pool_database_activity.rb'
67
+ autoload :Server, 'generated/azure_mgmt_sql/models/server.rb'
68
+ autoload :RestorePoint, 'generated/azure_mgmt_sql/models/restore_point.rb'
69
+ autoload :ServiceObjective, 'generated/azure_mgmt_sql/models/service_objective.rb'
70
+ autoload :TransparentDataEncryptionActivity, 'generated/azure_mgmt_sql/models/transparent_data_encryption_activity.rb'
71
+ autoload :ReplicationRole, 'generated/azure_mgmt_sql/models/replication_role.rb'
72
+ autoload :ReplicationState, 'generated/azure_mgmt_sql/models/replication_state.rb'
73
+ autoload :ElasticPoolEditions, 'generated/azure_mgmt_sql/models/elastic_pool_editions.rb'
74
+ autoload :CreateMode, 'generated/azure_mgmt_sql/models/create_mode.rb'
75
+ autoload :DatabaseEditions, 'generated/azure_mgmt_sql/models/database_editions.rb'
76
+ autoload :ServiceObjectiveName, 'generated/azure_mgmt_sql/models/service_objective_name.rb'
77
+ autoload :TableType, 'generated/azure_mgmt_sql/models/table_type.rb'
78
+ autoload :RecommendedIndexActions, 'generated/azure_mgmt_sql/models/recommended_index_actions.rb'
79
+ autoload :RecommendedIndexStates, 'generated/azure_mgmt_sql/models/recommended_index_states.rb'
80
+ autoload :RecommendedIndexTypes, 'generated/azure_mgmt_sql/models/recommended_index_types.rb'
81
+ autoload :TransparentDataEncryptionStates, 'generated/azure_mgmt_sql/models/transparent_data_encryption_states.rb'
82
+ autoload :TargetDatabaseEditions, 'generated/azure_mgmt_sql/models/target_database_editions.rb'
83
+ autoload :ElasticPoolState, 'generated/azure_mgmt_sql/models/elastic_pool_state.rb'
84
+ autoload :ServerVersion, 'generated/azure_mgmt_sql/models/server_version.rb'
85
+ autoload :TargetElasticPoolEditions, 'generated/azure_mgmt_sql/models/target_elastic_pool_editions.rb'
86
+ autoload :RestorePointTypes, 'generated/azure_mgmt_sql/models/restore_point_types.rb'
87
+ autoload :TransparentDataEncryptionActivityStates, 'generated/azure_mgmt_sql/models/transparent_data_encryption_activity_states.rb'
31
88
  end
32
89
  end
@@ -0,0 +1,2170 @@
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 Databases
14
+ include Azure::ARM::SQL::Models
15
+ include MsRestAzure
16
+
17
+ #
18
+ # Creates and initializes a new instance of the Databases 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
+ # Deletes the Azure SQL database replication link with the given ID. Cannot be
30
+ # done during failover.
31
+ #
32
+ # @param resource_group_name [String] The name of the resource group that
33
+ # contains the resource. You can obtain this value from the Azure Resource
34
+ # Manager API or the portal.
35
+ # @param server_name [String] The name of the Azure SQL server.
36
+ # @param database_name [String] The name of the Azure SQL database that has the
37
+ # replication link to be dropped.
38
+ # @param link_id [String] The ID of the replication link to be deleted.
39
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
40
+ # will be added to the HTTP request.
41
+ #
42
+ #
43
+ def delete_replication_link(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
44
+ response = delete_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
45
+ nil
46
+ end
47
+
48
+ #
49
+ # Deletes the Azure SQL database replication link with the given ID. Cannot be
50
+ # done during failover.
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 database_name [String] The name of the Azure SQL database that has the
57
+ # replication link to be dropped.
58
+ # @param link_id [String] The ID of the replication link to be deleted.
59
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
60
+ # will be added to the HTTP request.
61
+ #
62
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
63
+ #
64
+ def delete_replication_link_with_http_info(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
65
+ delete_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
66
+ end
67
+
68
+ #
69
+ # Deletes the Azure SQL database replication link with the given ID. Cannot be
70
+ # done during failover.
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 database_name [String] The name of the Azure SQL database that has the
77
+ # replication link to be dropped.
78
+ # @param link_id [String] The ID of the replication link to be deleted.
79
+ # @param [Hash{String => String}] A hash of custom headers that will be added
80
+ # to the HTTP request.
81
+ #
82
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
83
+ #
84
+ def delete_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
85
+ api_version = '2014-04-01'
86
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
87
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
88
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
89
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
90
+ fail ArgumentError, 'link_id is nil' if link_id.nil?
91
+
92
+
93
+ request_headers = {}
94
+
95
+ # Set Headers
96
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
97
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
98
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}'
99
+
100
+ request_url = @base_url || @client.base_url
101
+
102
+ options = {
103
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
104
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'linkId' => link_id},
105
+ query_params: {'api-version' => api_version},
106
+ headers: request_headers.merge(custom_headers || {}),
107
+ base_url: request_url
108
+ }
109
+ promise = @client.make_request_async(:delete, path_template, options)
110
+
111
+ promise = promise.then do |result|
112
+ http_response = result.response
113
+ status_code = http_response.status
114
+ response_content = http_response.body
115
+ unless status_code == 200 || status_code == 204
116
+ error_model = JSON.load(response_content)
117
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
118
+ end
119
+
120
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
121
+
122
+ result
123
+ end
124
+
125
+ promise.execute
126
+ end
127
+
128
+ #
129
+ # Gets information about an Azure SQL database replication link.
130
+ #
131
+ # @param resource_group_name [String] The name of the resource group that
132
+ # contains the resource. You can obtain this value from the Azure Resource
133
+ # Manager API or the portal.
134
+ # @param server_name [String] The name of the Azure SQL server.
135
+ # @param database_name [String] The name of the Azure SQL database to get the
136
+ # link for.
137
+ # @param link_id [String] The replication link ID to be retrieved.
138
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
139
+ # will be added to the HTTP request.
140
+ #
141
+ # @return [ReplicationLink] operation results.
142
+ #
143
+ def get_replication_link(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
144
+ response = get_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
145
+ response.body unless response.nil?
146
+ end
147
+
148
+ #
149
+ # Gets information about an Azure SQL database replication link.
150
+ #
151
+ # @param resource_group_name [String] The name of the resource group that
152
+ # contains the resource. You can obtain this value from the Azure Resource
153
+ # Manager API or the portal.
154
+ # @param server_name [String] The name of the Azure SQL server.
155
+ # @param database_name [String] The name of the Azure SQL database to get the
156
+ # link for.
157
+ # @param link_id [String] The replication link ID to be retrieved.
158
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
159
+ # will be added to the HTTP request.
160
+ #
161
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
162
+ #
163
+ def get_replication_link_with_http_info(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
164
+ get_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
165
+ end
166
+
167
+ #
168
+ # Gets information about an Azure SQL database replication link.
169
+ #
170
+ # @param resource_group_name [String] The name of the resource group that
171
+ # contains the resource. You can obtain this value from the Azure Resource
172
+ # Manager API or the portal.
173
+ # @param server_name [String] The name of the Azure SQL server.
174
+ # @param database_name [String] The name of the Azure SQL database to get the
175
+ # link for.
176
+ # @param link_id [String] The replication link ID to be retrieved.
177
+ # @param [Hash{String => String}] A hash of custom headers that will be added
178
+ # to the HTTP request.
179
+ #
180
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
181
+ #
182
+ def get_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
183
+ api_version = '2014-04-01'
184
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
185
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
186
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
187
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
188
+ fail ArgumentError, 'link_id is nil' if link_id.nil?
189
+
190
+
191
+ request_headers = {}
192
+
193
+ # Set Headers
194
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
195
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
196
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}'
197
+
198
+ request_url = @base_url || @client.base_url
199
+
200
+ options = {
201
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
202
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'linkId' => link_id},
203
+ query_params: {'api-version' => api_version},
204
+ headers: request_headers.merge(custom_headers || {}),
205
+ base_url: request_url
206
+ }
207
+ promise = @client.make_request_async(:get, path_template, options)
208
+
209
+ promise = promise.then do |result|
210
+ http_response = result.response
211
+ status_code = http_response.status
212
+ response_content = http_response.body
213
+ unless status_code == 200
214
+ error_model = JSON.load(response_content)
215
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
216
+ end
217
+
218
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
219
+ # Deserialize Response
220
+ if status_code == 200
221
+ begin
222
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
223
+ result_mapper = ReplicationLink.mapper()
224
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
225
+ rescue Exception => e
226
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
227
+ end
228
+ end
229
+
230
+ result
231
+ end
232
+
233
+ promise.execute
234
+ end
235
+
236
+ #
237
+ # Failover the Azure SQL database replication link with the given ID.
238
+ #
239
+ # @param resource_group_name [String] The name of the resource group that
240
+ # contains the resource. You can obtain this value from the Azure Resource
241
+ # Manager API or the portal.
242
+ # @param server_name [String] The name of the Azure SQL server.
243
+ # @param database_name [String] The name of the Azure SQL database that has the
244
+ # replication link to be failed over.
245
+ # @param link_id [String] The ID of the replication link to be failed over.
246
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
247
+ # will be added to the HTTP request.
248
+ #
249
+ def failover_replication_link(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
250
+ response = failover_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
251
+ nil
252
+ end
253
+
254
+ #
255
+ # @param resource_group_name [String] The name of the resource group that
256
+ # contains the resource. You can obtain this value from the Azure Resource
257
+ # Manager API or the portal.
258
+ # @param server_name [String] The name of the Azure SQL server.
259
+ # @param database_name [String] The name of the Azure SQL database that has the
260
+ # replication link to be failed over.
261
+ # @param link_id [String] The ID of the replication link to be failed over.
262
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
263
+ # will be added to the HTTP request.
264
+ #
265
+ # @return [Concurrent::Promise] promise which provides async access to http
266
+ # response.
267
+ #
268
+ def failover_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
269
+ # Send request
270
+ promise = begin_failover_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers)
271
+
272
+ promise = promise.then do |response|
273
+ # Defining deserialization method.
274
+ deserialize_method = lambda do |parsed_response|
275
+ end
276
+
277
+ # Waiting for response.
278
+ @client.get_long_running_operation_result(response, deserialize_method)
279
+ end
280
+
281
+ promise
282
+ end
283
+
284
+ #
285
+ # Force failover the Azure SQL database replication link with the given ID
286
+ # which may result in data loss.
287
+ #
288
+ # @param resource_group_name [String] The name of the resource group that
289
+ # contains the resource. You can obtain this value from the Azure Resource
290
+ # Manager API or the portal.
291
+ # @param server_name [String] The name of the Azure SQL server.
292
+ # @param database_name [String] The name of the Azure SQL database that has the
293
+ # replication link to be failed over.
294
+ # @param link_id [String] The ID of the replication link to be failed over.
295
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
296
+ # will be added to the HTTP request.
297
+ #
298
+ def failover_replication_link_allow_data_loss(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
299
+ response = failover_replication_link_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
300
+ nil
301
+ end
302
+
303
+ #
304
+ # @param resource_group_name [String] The name of the resource group that
305
+ # contains the resource. You can obtain this value from the Azure Resource
306
+ # Manager API or the portal.
307
+ # @param server_name [String] The name of the Azure SQL server.
308
+ # @param database_name [String] The name of the Azure SQL database that has the
309
+ # replication link to be failed over.
310
+ # @param link_id [String] The ID of the replication link to be failed over.
311
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
312
+ # will be added to the HTTP request.
313
+ #
314
+ # @return [Concurrent::Promise] promise which provides async access to http
315
+ # response.
316
+ #
317
+ def failover_replication_link_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
318
+ # Send request
319
+ promise = begin_failover_replication_link_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers)
320
+
321
+ promise = promise.then do |response|
322
+ # Defining deserialization method.
323
+ deserialize_method = lambda do |parsed_response|
324
+ end
325
+
326
+ # Waiting for response.
327
+ @client.get_long_running_operation_result(response, deserialize_method)
328
+ end
329
+
330
+ promise
331
+ end
332
+
333
+ #
334
+ # Gets information about Azure SQL database replication links.
335
+ #
336
+ # @param resource_group_name [String] The name of the resource group that
337
+ # contains the resource. You can obtain this value from the Azure Resource
338
+ # Manager API or the portal.
339
+ # @param server_name [String] The name of the Azure SQL server.
340
+ # @param database_name [String] The name of the Azure SQL database to retrieve
341
+ # links for.
342
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
343
+ # will be added to the HTTP request.
344
+ #
345
+ # @return [ReplicationLinkListResult] operation results.
346
+ #
347
+ def list_replication_links(resource_group_name, server_name, database_name, custom_headers = nil)
348
+ response = list_replication_links_async(resource_group_name, server_name, database_name, custom_headers).value!
349
+ response.body unless response.nil?
350
+ end
351
+
352
+ #
353
+ # Gets information about Azure SQL database replication links.
354
+ #
355
+ # @param resource_group_name [String] The name of the resource group that
356
+ # contains the resource. You can obtain this value from the Azure Resource
357
+ # Manager API or the portal.
358
+ # @param server_name [String] The name of the Azure SQL server.
359
+ # @param database_name [String] The name of the Azure SQL database to retrieve
360
+ # links for.
361
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
362
+ # will be added to the HTTP request.
363
+ #
364
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
365
+ #
366
+ def list_replication_links_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
367
+ list_replication_links_async(resource_group_name, server_name, database_name, custom_headers).value!
368
+ end
369
+
370
+ #
371
+ # Gets information about Azure SQL database replication links.
372
+ #
373
+ # @param resource_group_name [String] The name of the resource group that
374
+ # contains the resource. You can obtain this value from the Azure Resource
375
+ # Manager API or the portal.
376
+ # @param server_name [String] The name of the Azure SQL server.
377
+ # @param database_name [String] The name of the Azure SQL database to retrieve
378
+ # links for.
379
+ # @param [Hash{String => String}] A hash of custom headers that will be added
380
+ # to the HTTP request.
381
+ #
382
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
383
+ #
384
+ def list_replication_links_async(resource_group_name, server_name, database_name, custom_headers = nil)
385
+ api_version = '2014-04-01'
386
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
387
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
388
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
389
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
390
+
391
+
392
+ request_headers = {}
393
+
394
+ # Set Headers
395
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
396
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
397
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks'
398
+
399
+ request_url = @base_url || @client.base_url
400
+
401
+ options = {
402
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
403
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name},
404
+ query_params: {'api-version' => api_version},
405
+ headers: request_headers.merge(custom_headers || {}),
406
+ base_url: request_url
407
+ }
408
+ promise = @client.make_request_async(:get, path_template, options)
409
+
410
+ promise = promise.then do |result|
411
+ http_response = result.response
412
+ status_code = http_response.status
413
+ response_content = http_response.body
414
+ unless status_code == 200
415
+ error_model = JSON.load(response_content)
416
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
417
+ end
418
+
419
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
420
+ # Deserialize Response
421
+ if status_code == 200
422
+ begin
423
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
424
+ result_mapper = ReplicationLinkListResult.mapper()
425
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
426
+ rescue Exception => e
427
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
428
+ end
429
+ end
430
+
431
+ result
432
+ end
433
+
434
+ promise.execute
435
+ end
436
+
437
+ #
438
+ # Pause an Azure SQL Data Warehouse database.
439
+ #
440
+ # @param resource_group_name [String] The name of the resource group that
441
+ # contains the resource. You can obtain this value from the Azure Resource
442
+ # Manager API or the portal.
443
+ # @param server_name [String] The name of the Azure SQL server.
444
+ # @param database_name [String] The name of the Azure SQL Data Warehouse
445
+ # database to pause.
446
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
447
+ # will be added to the HTTP request.
448
+ #
449
+ def pause_data_warehouse(resource_group_name, server_name, database_name, custom_headers = nil)
450
+ response = pause_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers).value!
451
+ nil
452
+ end
453
+
454
+ #
455
+ # @param resource_group_name [String] The name of the resource group that
456
+ # contains the resource. You can obtain this value from the Azure Resource
457
+ # Manager API or the portal.
458
+ # @param server_name [String] The name of the Azure SQL server.
459
+ # @param database_name [String] The name of the Azure SQL Data Warehouse
460
+ # database to pause.
461
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
462
+ # will be added to the HTTP request.
463
+ #
464
+ # @return [Concurrent::Promise] promise which provides async access to http
465
+ # response.
466
+ #
467
+ def pause_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers = nil)
468
+ # Send request
469
+ promise = begin_pause_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers)
470
+
471
+ promise = promise.then do |response|
472
+ # Defining deserialization method.
473
+ deserialize_method = lambda do |parsed_response|
474
+ end
475
+
476
+ # Waiting for response.
477
+ @client.get_long_running_operation_result(response, deserialize_method)
478
+ end
479
+
480
+ promise
481
+ end
482
+
483
+ #
484
+ # Resume an Azure SQL Data Warehouse database.
485
+ #
486
+ # @param resource_group_name [String] The name of the resource group that
487
+ # contains the resource. You can obtain this value from the Azure Resource
488
+ # Manager API or the portal.
489
+ # @param server_name [String] The name of the Azure SQL server.
490
+ # @param database_name [String] The name of the Azure SQL Data Warehouse
491
+ # database to resume.
492
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
493
+ # will be added to the HTTP request.
494
+ #
495
+ def resume_data_warehouse(resource_group_name, server_name, database_name, custom_headers = nil)
496
+ response = resume_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers).value!
497
+ nil
498
+ end
499
+
500
+ #
501
+ # @param resource_group_name [String] The name of the resource group that
502
+ # contains the resource. You can obtain this value from the Azure Resource
503
+ # Manager API or the portal.
504
+ # @param server_name [String] The name of the Azure SQL server.
505
+ # @param database_name [String] The name of the Azure SQL Data Warehouse
506
+ # database to resume.
507
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
508
+ # will be added to the HTTP request.
509
+ #
510
+ # @return [Concurrent::Promise] promise which provides async access to http
511
+ # response.
512
+ #
513
+ def resume_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers = nil)
514
+ # Send request
515
+ promise = begin_resume_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers)
516
+
517
+ promise = promise.then do |response|
518
+ # Defining deserialization method.
519
+ deserialize_method = lambda do |parsed_response|
520
+ end
521
+
522
+ # Waiting for response.
523
+ @client.get_long_running_operation_result(response, deserialize_method)
524
+ end
525
+
526
+ promise
527
+ end
528
+
529
+ #
530
+ # Returns a list of Azure SQL database restore points.
531
+ #
532
+ # @param resource_group_name [String] The name of the resource group that
533
+ # contains the resource. You can obtain this value from the Azure Resource
534
+ # Manager API or the portal.
535
+ # @param server_name [String] The name of the Azure SQL server.
536
+ # @param database_name [String] The name of the Azure SQL database from which
537
+ # to retrieve available restore points.
538
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
539
+ # will be added to the HTTP request.
540
+ #
541
+ # @return [RestorePointListResult] operation results.
542
+ #
543
+ def list_restore_points(resource_group_name, server_name, database_name, custom_headers = nil)
544
+ response = list_restore_points_async(resource_group_name, server_name, database_name, custom_headers).value!
545
+ response.body unless response.nil?
546
+ end
547
+
548
+ #
549
+ # Returns a list of Azure SQL database restore points.
550
+ #
551
+ # @param resource_group_name [String] The name of the resource group that
552
+ # contains the resource. You can obtain this value from the Azure Resource
553
+ # Manager API or the portal.
554
+ # @param server_name [String] The name of the Azure SQL server.
555
+ # @param database_name [String] The name of the Azure SQL database from which
556
+ # to retrieve available restore points.
557
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
558
+ # will be added to the HTTP request.
559
+ #
560
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
561
+ #
562
+ def list_restore_points_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
563
+ list_restore_points_async(resource_group_name, server_name, database_name, custom_headers).value!
564
+ end
565
+
566
+ #
567
+ # Returns a list of Azure SQL database restore points.
568
+ #
569
+ # @param resource_group_name [String] The name of the resource group that
570
+ # contains the resource. You can obtain this value from the Azure Resource
571
+ # Manager API or the portal.
572
+ # @param server_name [String] The name of the Azure SQL server.
573
+ # @param database_name [String] The name of the Azure SQL database from which
574
+ # to retrieve available restore points.
575
+ # @param [Hash{String => String}] A hash of custom headers that will be added
576
+ # to the HTTP request.
577
+ #
578
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
579
+ #
580
+ def list_restore_points_async(resource_group_name, server_name, database_name, custom_headers = nil)
581
+ api_version = '2014-04-01'
582
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
583
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
584
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
585
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
586
+
587
+
588
+ request_headers = {}
589
+
590
+ # Set Headers
591
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
592
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
593
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints'
594
+
595
+ request_url = @base_url || @client.base_url
596
+
597
+ options = {
598
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
599
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name},
600
+ query_params: {'api-version' => api_version},
601
+ headers: request_headers.merge(custom_headers || {}),
602
+ base_url: request_url
603
+ }
604
+ promise = @client.make_request_async(:get, path_template, options)
605
+
606
+ promise = promise.then do |result|
607
+ http_response = result.response
608
+ status_code = http_response.status
609
+ response_content = http_response.body
610
+ unless status_code == 200
611
+ error_model = JSON.load(response_content)
612
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
613
+ end
614
+
615
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
616
+ # Deserialize Response
617
+ if status_code == 200
618
+ begin
619
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
620
+ result_mapper = RestorePointListResult.mapper()
621
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
622
+ rescue Exception => e
623
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
624
+ end
625
+ end
626
+
627
+ result
628
+ end
629
+
630
+ promise.execute
631
+ end
632
+
633
+ #
634
+ # Creates a new Azure SQL database or updates an existing Azure SQL database.
635
+ # Location is a required property in the request body, and it must be the same
636
+ # as the location of the SQL server.
637
+ #
638
+ # @param resource_group_name [String] The name of the resource group that
639
+ # contains the resource. You can obtain this value from the Azure Resource
640
+ # Manager API or the portal.
641
+ # @param server_name [String] The name of the Azure SQL server.
642
+ # @param database_name [String] The name of the Azure SQL database to be
643
+ # operated on (updated or created).
644
+ # @param parameters [Database] The required parameters for creating or updating
645
+ # a database.
646
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
647
+ # will be added to the HTTP request.
648
+ #
649
+ # @return [Database] operation results.
650
+ #
651
+ def create_or_update(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
652
+ response = create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
653
+ response.body unless response.nil?
654
+ end
655
+
656
+ #
657
+ # @param resource_group_name [String] The name of the resource group that
658
+ # contains the resource. You can obtain this value from the Azure Resource
659
+ # Manager API or the portal.
660
+ # @param server_name [String] The name of the Azure SQL server.
661
+ # @param database_name [String] The name of the Azure SQL database to be
662
+ # operated on (updated or created).
663
+ # @param parameters [Database] The required parameters for creating or updating
664
+ # a database.
665
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
666
+ # will be added to the HTTP request.
667
+ #
668
+ # @return [Concurrent::Promise] promise which provides async access to http
669
+ # response.
670
+ #
671
+ def create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
672
+ # Send request
673
+ promise = begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers)
674
+
675
+ promise = promise.then do |response|
676
+ # Defining deserialization method.
677
+ deserialize_method = lambda do |parsed_response|
678
+ result_mapper = Database.mapper()
679
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
680
+ end
681
+
682
+ # Waiting for response.
683
+ @client.get_long_running_operation_result(response, deserialize_method)
684
+ end
685
+
686
+ promise
687
+ end
688
+
689
+ #
690
+ # Deletes an Azure SQL database.
691
+ #
692
+ # @param resource_group_name [String] The name of the resource group that
693
+ # contains the resource. You can obtain this value from the Azure Resource
694
+ # Manager API or the portal.
695
+ # @param server_name [String] The name of the Azure SQL server.
696
+ # @param database_name [String] The name of the Azure SQL database to be
697
+ # deleted.
698
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
699
+ # will be added to the HTTP request.
700
+ #
701
+ #
702
+ def delete(resource_group_name, server_name, database_name, custom_headers = nil)
703
+ response = delete_async(resource_group_name, server_name, database_name, custom_headers).value!
704
+ nil
705
+ end
706
+
707
+ #
708
+ # Deletes an Azure SQL database.
709
+ #
710
+ # @param resource_group_name [String] The name of the resource group that
711
+ # contains the resource. You can obtain this value from the Azure Resource
712
+ # Manager API or the portal.
713
+ # @param server_name [String] The name of the Azure SQL server.
714
+ # @param database_name [String] The name of the Azure SQL database to be
715
+ # deleted.
716
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
717
+ # will be added to the HTTP request.
718
+ #
719
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
720
+ #
721
+ def delete_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
722
+ delete_async(resource_group_name, server_name, database_name, custom_headers).value!
723
+ end
724
+
725
+ #
726
+ # Deletes an Azure SQL database.
727
+ #
728
+ # @param resource_group_name [String] The name of the resource group that
729
+ # contains the resource. You can obtain this value from the Azure Resource
730
+ # Manager API or the portal.
731
+ # @param server_name [String] The name of the Azure SQL server.
732
+ # @param database_name [String] The name of the Azure SQL database to be
733
+ # deleted.
734
+ # @param [Hash{String => String}] A hash of custom headers that will be added
735
+ # to the HTTP request.
736
+ #
737
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
738
+ #
739
+ def delete_async(resource_group_name, server_name, database_name, custom_headers = nil)
740
+ api_version = '2014-04-01'
741
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
742
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
743
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
744
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
745
+
746
+
747
+ request_headers = {}
748
+
749
+ # Set Headers
750
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
751
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
752
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'
753
+
754
+ request_url = @base_url || @client.base_url
755
+
756
+ options = {
757
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
758
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name},
759
+ query_params: {'api-version' => api_version},
760
+ headers: request_headers.merge(custom_headers || {}),
761
+ base_url: request_url
762
+ }
763
+ promise = @client.make_request_async(:delete, path_template, options)
764
+
765
+ promise = promise.then do |result|
766
+ http_response = result.response
767
+ status_code = http_response.status
768
+ response_content = http_response.body
769
+ unless status_code == 200 || status_code == 204
770
+ error_model = JSON.load(response_content)
771
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
772
+ end
773
+
774
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
775
+
776
+ result
777
+ end
778
+
779
+ promise.execute
780
+ end
781
+
782
+ #
783
+ # Gets information about an Azure SQL database.
784
+ #
785
+ # @param resource_group_name [String] The name of the resource group that
786
+ # contains the resource. You can obtain this value from the Azure Resource
787
+ # Manager API or the portal.
788
+ # @param server_name [String] The name of the Azure SQL server.
789
+ # @param database_name [String] The name of the Azure SQL database to be
790
+ # retrieved.
791
+ # @param expand [String] The comma separated list of child objects to expand in
792
+ # the response. Possible properties: serviceTierAdvisors, upgradeHint,
793
+ # transparentDataEncryption.
794
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
795
+ # will be added to the HTTP request.
796
+ #
797
+ # @return [Database] operation results.
798
+ #
799
+ def get(resource_group_name, server_name, database_name, expand = nil, custom_headers = nil)
800
+ response = get_async(resource_group_name, server_name, database_name, expand, custom_headers).value!
801
+ response.body unless response.nil?
802
+ end
803
+
804
+ #
805
+ # Gets information about an Azure SQL database.
806
+ #
807
+ # @param resource_group_name [String] The name of the resource group that
808
+ # contains the resource. You can obtain this value from the Azure Resource
809
+ # Manager API or the portal.
810
+ # @param server_name [String] The name of the Azure SQL server.
811
+ # @param database_name [String] The name of the Azure SQL database to be
812
+ # retrieved.
813
+ # @param expand [String] The comma separated list of child objects to expand in
814
+ # the response. Possible properties: serviceTierAdvisors, upgradeHint,
815
+ # transparentDataEncryption.
816
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
817
+ # will be added to the HTTP request.
818
+ #
819
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
820
+ #
821
+ def get_with_http_info(resource_group_name, server_name, database_name, expand = nil, custom_headers = nil)
822
+ get_async(resource_group_name, server_name, database_name, expand, custom_headers).value!
823
+ end
824
+
825
+ #
826
+ # Gets information about an Azure SQL database.
827
+ #
828
+ # @param resource_group_name [String] The name of the resource group that
829
+ # contains the resource. You can obtain this value from the Azure Resource
830
+ # Manager API or the portal.
831
+ # @param server_name [String] The name of the Azure SQL server.
832
+ # @param database_name [String] The name of the Azure SQL database to be
833
+ # retrieved.
834
+ # @param expand [String] The comma separated list of child objects to expand in
835
+ # the response. Possible properties: serviceTierAdvisors, upgradeHint,
836
+ # transparentDataEncryption.
837
+ # @param [Hash{String => String}] A hash of custom headers that will be added
838
+ # to the HTTP request.
839
+ #
840
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
841
+ #
842
+ def get_async(resource_group_name, server_name, database_name, expand = nil, custom_headers = nil)
843
+ api_version = '2014-04-01'
844
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
845
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
846
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
847
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
848
+
849
+
850
+ request_headers = {}
851
+
852
+ # Set Headers
853
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
854
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
855
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'
856
+
857
+ request_url = @base_url || @client.base_url
858
+
859
+ options = {
860
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
861
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name},
862
+ query_params: {'api-version' => api_version,'$expand' => expand},
863
+ headers: request_headers.merge(custom_headers || {}),
864
+ base_url: request_url
865
+ }
866
+ promise = @client.make_request_async(:get, path_template, options)
867
+
868
+ promise = promise.then do |result|
869
+ http_response = result.response
870
+ status_code = http_response.status
871
+ response_content = http_response.body
872
+ unless status_code == 200
873
+ error_model = JSON.load(response_content)
874
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
875
+ end
876
+
877
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
878
+ # Deserialize Response
879
+ if status_code == 200
880
+ begin
881
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
882
+ result_mapper = Database.mapper()
883
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
884
+ rescue Exception => e
885
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
886
+ end
887
+ end
888
+
889
+ result
890
+ end
891
+
892
+ promise.execute
893
+ end
894
+
895
+ #
896
+ # Returns information about an Azure SQL database.
897
+ #
898
+ # @param resource_group_name [String] The name of the resource group that
899
+ # contains the resource. You can obtain this value from the Azure Resource
900
+ # Manager API or the portal.
901
+ # @param server_name [String] The name of the Azure SQL server.
902
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
903
+ # will be added to the HTTP request.
904
+ #
905
+ # @return [DatabaseListResult] operation results.
906
+ #
907
+ def list_by_server(resource_group_name, server_name, custom_headers = nil)
908
+ response = list_by_server_async(resource_group_name, server_name, custom_headers).value!
909
+ response.body unless response.nil?
910
+ end
911
+
912
+ #
913
+ # Returns information about an Azure SQL database.
914
+ #
915
+ # @param resource_group_name [String] The name of the resource group that
916
+ # contains the resource. You can obtain this value from the Azure Resource
917
+ # Manager API or the portal.
918
+ # @param server_name [String] The name of the Azure SQL server.
919
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
920
+ # will be added to the HTTP request.
921
+ #
922
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
923
+ #
924
+ def list_by_server_with_http_info(resource_group_name, server_name, custom_headers = nil)
925
+ list_by_server_async(resource_group_name, server_name, custom_headers).value!
926
+ end
927
+
928
+ #
929
+ # Returns information about an Azure SQL database.
930
+ #
931
+ # @param resource_group_name [String] The name of the resource group that
932
+ # contains the resource. You can obtain this value from the Azure Resource
933
+ # Manager API or the portal.
934
+ # @param server_name [String] The name of the Azure SQL server.
935
+ # @param [Hash{String => String}] A hash of custom headers that will be added
936
+ # to the HTTP request.
937
+ #
938
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
939
+ #
940
+ def list_by_server_async(resource_group_name, server_name, custom_headers = nil)
941
+ api_version = '2014-04-01'
942
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
943
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
944
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
945
+
946
+
947
+ request_headers = {}
948
+
949
+ # Set Headers
950
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
951
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
952
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases'
953
+
954
+ request_url = @base_url || @client.base_url
955
+
956
+ options = {
957
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
958
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
959
+ query_params: {'api-version' => api_version},
960
+ headers: request_headers.merge(custom_headers || {}),
961
+ base_url: request_url
962
+ }
963
+ promise = @client.make_request_async(:get, path_template, options)
964
+
965
+ promise = promise.then do |result|
966
+ http_response = result.response
967
+ status_code = http_response.status
968
+ response_content = http_response.body
969
+ unless status_code == 200
970
+ error_model = JSON.load(response_content)
971
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
972
+ end
973
+
974
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
975
+ # Deserialize Response
976
+ if status_code == 200
977
+ begin
978
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
979
+ result_mapper = DatabaseListResult.mapper()
980
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
981
+ rescue Exception => e
982
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
983
+ end
984
+ end
985
+
986
+ result
987
+ end
988
+
989
+ promise.execute
990
+ end
991
+
992
+ #
993
+ # Returns information about Azure SQL database usages.
994
+ #
995
+ # @param resource_group_name [String] The name of the resource group that
996
+ # contains the resource. You can obtain this value from the Azure Resource
997
+ # Manager API or the portal.
998
+ # @param server_name [String] The name of the Azure SQL server.
999
+ # @param database_name [String] The name of the Azure SQL database.
1000
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1001
+ # will be added to the HTTP request.
1002
+ #
1003
+ # @return [DatabaseMetricListResult] operation results.
1004
+ #
1005
+ def list_usages(resource_group_name, server_name, database_name, custom_headers = nil)
1006
+ response = list_usages_async(resource_group_name, server_name, database_name, custom_headers).value!
1007
+ response.body unless response.nil?
1008
+ end
1009
+
1010
+ #
1011
+ # Returns information about Azure SQL database usages.
1012
+ #
1013
+ # @param resource_group_name [String] The name of the resource group that
1014
+ # contains the resource. You can obtain this value from the Azure Resource
1015
+ # Manager API or the portal.
1016
+ # @param server_name [String] The name of the Azure SQL server.
1017
+ # @param database_name [String] The name of the Azure SQL database.
1018
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1019
+ # will be added to the HTTP request.
1020
+ #
1021
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1022
+ #
1023
+ def list_usages_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
1024
+ list_usages_async(resource_group_name, server_name, database_name, custom_headers).value!
1025
+ end
1026
+
1027
+ #
1028
+ # Returns information about Azure SQL database usages.
1029
+ #
1030
+ # @param resource_group_name [String] The name of the resource group that
1031
+ # contains the resource. You can obtain this value from the Azure Resource
1032
+ # Manager API or the portal.
1033
+ # @param server_name [String] The name of the Azure SQL server.
1034
+ # @param database_name [String] The name of the Azure SQL database.
1035
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1036
+ # to the HTTP request.
1037
+ #
1038
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1039
+ #
1040
+ def list_usages_async(resource_group_name, server_name, database_name, custom_headers = nil)
1041
+ api_version = '2014-04-01'
1042
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1043
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1044
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1045
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1046
+
1047
+
1048
+ request_headers = {}
1049
+
1050
+ # Set Headers
1051
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1052
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1053
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages'
1054
+
1055
+ request_url = @base_url || @client.base_url
1056
+
1057
+ options = {
1058
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1059
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name},
1060
+ query_params: {'api-version' => api_version},
1061
+ headers: request_headers.merge(custom_headers || {}),
1062
+ base_url: request_url
1063
+ }
1064
+ promise = @client.make_request_async(:get, path_template, options)
1065
+
1066
+ promise = promise.then do |result|
1067
+ http_response = result.response
1068
+ status_code = http_response.status
1069
+ response_content = http_response.body
1070
+ unless status_code == 200
1071
+ error_model = JSON.load(response_content)
1072
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1073
+ end
1074
+
1075
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1076
+ # Deserialize Response
1077
+ if status_code == 200
1078
+ begin
1079
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1080
+ result_mapper = DatabaseMetricListResult.mapper()
1081
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1082
+ rescue Exception => e
1083
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1084
+ end
1085
+ end
1086
+
1087
+ result
1088
+ end
1089
+
1090
+ promise.execute
1091
+ end
1092
+
1093
+ #
1094
+ # Gets information about a service tier advisor.
1095
+ #
1096
+ # @param resource_group_name [String] The name of the resource group that
1097
+ # contains the resource. You can obtain this value from the Azure Resource
1098
+ # Manager API or the portal.
1099
+ # @param server_name [String] The name of the Azure SQL server.
1100
+ # @param database_name [String] The name of database.
1101
+ # @param service_tier_advisor_name [String] The name of service tier advisor.
1102
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1103
+ # will be added to the HTTP request.
1104
+ #
1105
+ # @return [ServiceTierAdvisor] operation results.
1106
+ #
1107
+ def get_service_tier_advisor(resource_group_name, server_name, database_name, service_tier_advisor_name, custom_headers = nil)
1108
+ response = get_service_tier_advisor_async(resource_group_name, server_name, database_name, service_tier_advisor_name, custom_headers).value!
1109
+ response.body unless response.nil?
1110
+ end
1111
+
1112
+ #
1113
+ # Gets information about a service tier advisor.
1114
+ #
1115
+ # @param resource_group_name [String] The name of the resource group that
1116
+ # contains the resource. You can obtain this value from the Azure Resource
1117
+ # Manager API or the portal.
1118
+ # @param server_name [String] The name of the Azure SQL server.
1119
+ # @param database_name [String] The name of database.
1120
+ # @param service_tier_advisor_name [String] The name of service tier advisor.
1121
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1122
+ # will be added to the HTTP request.
1123
+ #
1124
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1125
+ #
1126
+ def get_service_tier_advisor_with_http_info(resource_group_name, server_name, database_name, service_tier_advisor_name, custom_headers = nil)
1127
+ get_service_tier_advisor_async(resource_group_name, server_name, database_name, service_tier_advisor_name, custom_headers).value!
1128
+ end
1129
+
1130
+ #
1131
+ # Gets information about a service tier advisor.
1132
+ #
1133
+ # @param resource_group_name [String] The name of the resource group that
1134
+ # contains the resource. You can obtain this value from the Azure Resource
1135
+ # Manager API or the portal.
1136
+ # @param server_name [String] The name of the Azure SQL server.
1137
+ # @param database_name [String] The name of database.
1138
+ # @param service_tier_advisor_name [String] The name of service tier advisor.
1139
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1140
+ # to the HTTP request.
1141
+ #
1142
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1143
+ #
1144
+ def get_service_tier_advisor_async(resource_group_name, server_name, database_name, service_tier_advisor_name, custom_headers = nil)
1145
+ api_version = '2014-04-01'
1146
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1147
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1148
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1149
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1150
+ fail ArgumentError, 'service_tier_advisor_name is nil' if service_tier_advisor_name.nil?
1151
+
1152
+
1153
+ request_headers = {}
1154
+
1155
+ # Set Headers
1156
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1157
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1158
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}'
1159
+
1160
+ request_url = @base_url || @client.base_url
1161
+
1162
+ options = {
1163
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1164
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'serviceTierAdvisorName' => service_tier_advisor_name},
1165
+ query_params: {'api-version' => api_version},
1166
+ headers: request_headers.merge(custom_headers || {}),
1167
+ base_url: request_url
1168
+ }
1169
+ promise = @client.make_request_async(:get, path_template, options)
1170
+
1171
+ promise = promise.then do |result|
1172
+ http_response = result.response
1173
+ status_code = http_response.status
1174
+ response_content = http_response.body
1175
+ unless status_code == 200
1176
+ error_model = JSON.load(response_content)
1177
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1178
+ end
1179
+
1180
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1181
+ # Deserialize Response
1182
+ if status_code == 200
1183
+ begin
1184
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1185
+ result_mapper = ServiceTierAdvisor.mapper()
1186
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1187
+ rescue Exception => e
1188
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1189
+ end
1190
+ end
1191
+
1192
+ result
1193
+ end
1194
+
1195
+ promise.execute
1196
+ end
1197
+
1198
+ #
1199
+ # Returns information about service tier advisors for specified database.
1200
+ #
1201
+ # @param resource_group_name [String] The name of the resource group that
1202
+ # contains the resource. You can obtain this value from the Azure Resource
1203
+ # Manager API or the portal.
1204
+ # @param server_name [String] The name of the Azure SQL server.
1205
+ # @param database_name [String] The name of database.
1206
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1207
+ # will be added to the HTTP request.
1208
+ #
1209
+ # @return [ServiceTierAdvisorListResult] operation results.
1210
+ #
1211
+ def list_service_tier_advisors(resource_group_name, server_name, database_name, custom_headers = nil)
1212
+ response = list_service_tier_advisors_async(resource_group_name, server_name, database_name, custom_headers).value!
1213
+ response.body unless response.nil?
1214
+ end
1215
+
1216
+ #
1217
+ # Returns information about service tier advisors for specified database.
1218
+ #
1219
+ # @param resource_group_name [String] The name of the resource group that
1220
+ # contains the resource. You can obtain this value from the Azure Resource
1221
+ # Manager API or the portal.
1222
+ # @param server_name [String] The name of the Azure SQL server.
1223
+ # @param database_name [String] The name of database.
1224
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1225
+ # will be added to the HTTP request.
1226
+ #
1227
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1228
+ #
1229
+ def list_service_tier_advisors_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
1230
+ list_service_tier_advisors_async(resource_group_name, server_name, database_name, custom_headers).value!
1231
+ end
1232
+
1233
+ #
1234
+ # Returns information about service tier advisors for specified database.
1235
+ #
1236
+ # @param resource_group_name [String] The name of the resource group that
1237
+ # contains the resource. You can obtain this value from the Azure Resource
1238
+ # Manager API or the portal.
1239
+ # @param server_name [String] The name of the Azure SQL server.
1240
+ # @param database_name [String] The name of database.
1241
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1242
+ # to the HTTP request.
1243
+ #
1244
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1245
+ #
1246
+ def list_service_tier_advisors_async(resource_group_name, server_name, database_name, custom_headers = nil)
1247
+ api_version = '2014-04-01'
1248
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1249
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1250
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1251
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1252
+
1253
+
1254
+ request_headers = {}
1255
+
1256
+ # Set Headers
1257
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1258
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1259
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors'
1260
+
1261
+ request_url = @base_url || @client.base_url
1262
+
1263
+ options = {
1264
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1265
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name},
1266
+ query_params: {'api-version' => api_version},
1267
+ headers: request_headers.merge(custom_headers || {}),
1268
+ base_url: request_url
1269
+ }
1270
+ promise = @client.make_request_async(:get, path_template, options)
1271
+
1272
+ promise = promise.then do |result|
1273
+ http_response = result.response
1274
+ status_code = http_response.status
1275
+ response_content = http_response.body
1276
+ unless status_code == 200
1277
+ error_model = JSON.load(response_content)
1278
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1279
+ end
1280
+
1281
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1282
+ # Deserialize Response
1283
+ if status_code == 200
1284
+ begin
1285
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1286
+ result_mapper = ServiceTierAdvisorListResult.mapper()
1287
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1288
+ rescue Exception => e
1289
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1290
+ end
1291
+ end
1292
+
1293
+ result
1294
+ end
1295
+
1296
+ promise.execute
1297
+ end
1298
+
1299
+ #
1300
+ # Creates or updates an Azure SQL Database Transparent Data Encryption
1301
+ # Operation.
1302
+ #
1303
+ # @param resource_group_name [String] The name of the resource group that
1304
+ # contains the resource. You can obtain this value from the Azure Resource
1305
+ # Manager API or the portal.
1306
+ # @param server_name [String] The name of the Azure SQL server.
1307
+ # @param database_name [String] The name of the Azure SQL database for which
1308
+ # setting the Transparent Data Encryption applies.
1309
+ # @param parameters [TransparentDataEncryption] The required parameters for
1310
+ # creating or updating transparent data encryption.
1311
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1312
+ # will be added to the HTTP request.
1313
+ #
1314
+ # @return [TransparentDataEncryption] operation results.
1315
+ #
1316
+ def create_or_update_transparent_data_encryption_configuration(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
1317
+ response = create_or_update_transparent_data_encryption_configuration_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
1318
+ response.body unless response.nil?
1319
+ end
1320
+
1321
+ #
1322
+ # Creates or updates an Azure SQL Database Transparent Data Encryption
1323
+ # Operation.
1324
+ #
1325
+ # @param resource_group_name [String] The name of the resource group that
1326
+ # contains the resource. You can obtain this value from the Azure Resource
1327
+ # Manager API or the portal.
1328
+ # @param server_name [String] The name of the Azure SQL server.
1329
+ # @param database_name [String] The name of the Azure SQL database for which
1330
+ # setting the Transparent Data Encryption applies.
1331
+ # @param parameters [TransparentDataEncryption] The required parameters for
1332
+ # creating or updating transparent data encryption.
1333
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1334
+ # will be added to the HTTP request.
1335
+ #
1336
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1337
+ #
1338
+ def create_or_update_transparent_data_encryption_configuration_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
1339
+ create_or_update_transparent_data_encryption_configuration_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
1340
+ end
1341
+
1342
+ #
1343
+ # Creates or updates an Azure SQL Database Transparent Data Encryption
1344
+ # Operation.
1345
+ #
1346
+ # @param resource_group_name [String] The name of the resource group that
1347
+ # contains the resource. You can obtain this value from the Azure Resource
1348
+ # Manager API or the portal.
1349
+ # @param server_name [String] The name of the Azure SQL server.
1350
+ # @param database_name [String] The name of the Azure SQL database for which
1351
+ # setting the Transparent Data Encryption applies.
1352
+ # @param parameters [TransparentDataEncryption] The required parameters for
1353
+ # creating or updating transparent data encryption.
1354
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1355
+ # to the HTTP request.
1356
+ #
1357
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1358
+ #
1359
+ def create_or_update_transparent_data_encryption_configuration_async(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
1360
+ api_version = '2014-04-01'
1361
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1362
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1363
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1364
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1365
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1366
+
1367
+
1368
+ request_headers = {}
1369
+
1370
+ # Set Headers
1371
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1372
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1373
+
1374
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1375
+
1376
+ # Serialize Request
1377
+ request_mapper = TransparentDataEncryption.mapper()
1378
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
1379
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1380
+
1381
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current'
1382
+
1383
+ request_url = @base_url || @client.base_url
1384
+
1385
+ options = {
1386
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1387
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name},
1388
+ query_params: {'api-version' => api_version},
1389
+ body: request_content,
1390
+ headers: request_headers.merge(custom_headers || {}),
1391
+ base_url: request_url
1392
+ }
1393
+ promise = @client.make_request_async(:put, path_template, options)
1394
+
1395
+ promise = promise.then do |result|
1396
+ http_response = result.response
1397
+ status_code = http_response.status
1398
+ response_content = http_response.body
1399
+ unless status_code == 200 || status_code == 201
1400
+ error_model = JSON.load(response_content)
1401
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1402
+ end
1403
+
1404
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1405
+ # Deserialize Response
1406
+ if status_code == 200
1407
+ begin
1408
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1409
+ result_mapper = TransparentDataEncryption.mapper()
1410
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1411
+ rescue Exception => e
1412
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1413
+ end
1414
+ end
1415
+ # Deserialize Response
1416
+ if status_code == 201
1417
+ begin
1418
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1419
+ result_mapper = TransparentDataEncryption.mapper()
1420
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1421
+ rescue Exception => e
1422
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1423
+ end
1424
+ end
1425
+
1426
+ result
1427
+ end
1428
+
1429
+ promise.execute
1430
+ end
1431
+
1432
+ #
1433
+ # Gets an Azure SQL Database Transparent Data Encryption Response.
1434
+ #
1435
+ # @param resource_group_name [String] The name of the resource group that
1436
+ # contains the resource. You can obtain this value from the Azure Resource
1437
+ # Manager API or the portal.
1438
+ # @param server_name [String] The name of the Azure SQL server.
1439
+ # @param database_name [String] The name of the Azure SQL database for which
1440
+ # the Transparent Data Encryption applies.
1441
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1442
+ # will be added to the HTTP request.
1443
+ #
1444
+ # @return [TransparentDataEncryption] operation results.
1445
+ #
1446
+ def get_transparent_data_encryption_configuration(resource_group_name, server_name, database_name, custom_headers = nil)
1447
+ response = get_transparent_data_encryption_configuration_async(resource_group_name, server_name, database_name, custom_headers).value!
1448
+ response.body unless response.nil?
1449
+ end
1450
+
1451
+ #
1452
+ # Gets an Azure SQL Database Transparent Data Encryption Response.
1453
+ #
1454
+ # @param resource_group_name [String] The name of the resource group that
1455
+ # contains the resource. You can obtain this value from the Azure Resource
1456
+ # Manager API or the portal.
1457
+ # @param server_name [String] The name of the Azure SQL server.
1458
+ # @param database_name [String] The name of the Azure SQL database for which
1459
+ # the Transparent Data Encryption applies.
1460
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1461
+ # will be added to the HTTP request.
1462
+ #
1463
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1464
+ #
1465
+ def get_transparent_data_encryption_configuration_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
1466
+ get_transparent_data_encryption_configuration_async(resource_group_name, server_name, database_name, custom_headers).value!
1467
+ end
1468
+
1469
+ #
1470
+ # Gets an Azure SQL Database Transparent Data Encryption Response.
1471
+ #
1472
+ # @param resource_group_name [String] The name of the resource group that
1473
+ # contains the resource. You can obtain this value from the Azure Resource
1474
+ # Manager API or the portal.
1475
+ # @param server_name [String] The name of the Azure SQL server.
1476
+ # @param database_name [String] The name of the Azure SQL database for which
1477
+ # the Transparent Data Encryption applies.
1478
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1479
+ # to the HTTP request.
1480
+ #
1481
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1482
+ #
1483
+ def get_transparent_data_encryption_configuration_async(resource_group_name, server_name, database_name, custom_headers = nil)
1484
+ api_version = '2014-04-01'
1485
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1486
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1487
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1488
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1489
+
1490
+
1491
+ request_headers = {}
1492
+
1493
+ # Set Headers
1494
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1495
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1496
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current'
1497
+
1498
+ request_url = @base_url || @client.base_url
1499
+
1500
+ options = {
1501
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1502
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name},
1503
+ query_params: {'api-version' => api_version},
1504
+ headers: request_headers.merge(custom_headers || {}),
1505
+ base_url: request_url
1506
+ }
1507
+ promise = @client.make_request_async(:get, path_template, options)
1508
+
1509
+ promise = promise.then do |result|
1510
+ http_response = result.response
1511
+ status_code = http_response.status
1512
+ response_content = http_response.body
1513
+ unless status_code == 200
1514
+ error_model = JSON.load(response_content)
1515
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1516
+ end
1517
+
1518
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1519
+ # Deserialize Response
1520
+ if status_code == 200
1521
+ begin
1522
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1523
+ result_mapper = TransparentDataEncryption.mapper()
1524
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1525
+ rescue Exception => e
1526
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1527
+ end
1528
+ end
1529
+
1530
+ result
1531
+ end
1532
+
1533
+ promise.execute
1534
+ end
1535
+
1536
+ #
1537
+ # Returns an Azure SQL Database Transparent Data Encryption Activity Response.
1538
+ #
1539
+ # @param resource_group_name [String] The name of the resource group that
1540
+ # contains the resource. You can obtain this value from the Azure Resource
1541
+ # Manager API or the portal.
1542
+ # @param server_name [String] The name of the Azure SQL server.
1543
+ # @param database_name [String] The name of the Azure SQL database for which
1544
+ # the Transparent Data Encryption applies.
1545
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1546
+ # will be added to the HTTP request.
1547
+ #
1548
+ # @return [TransparentDataEncryptionActivityListResult] operation results.
1549
+ #
1550
+ def list_transparent_data_encryption_activity(resource_group_name, server_name, database_name, custom_headers = nil)
1551
+ response = list_transparent_data_encryption_activity_async(resource_group_name, server_name, database_name, custom_headers).value!
1552
+ response.body unless response.nil?
1553
+ end
1554
+
1555
+ #
1556
+ # Returns an Azure SQL Database Transparent Data Encryption Activity Response.
1557
+ #
1558
+ # @param resource_group_name [String] The name of the resource group that
1559
+ # contains the resource. You can obtain this value from the Azure Resource
1560
+ # Manager API or the portal.
1561
+ # @param server_name [String] The name of the Azure SQL server.
1562
+ # @param database_name [String] The name of the Azure SQL database for which
1563
+ # the Transparent Data Encryption applies.
1564
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1565
+ # will be added to the HTTP request.
1566
+ #
1567
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1568
+ #
1569
+ def list_transparent_data_encryption_activity_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
1570
+ list_transparent_data_encryption_activity_async(resource_group_name, server_name, database_name, custom_headers).value!
1571
+ end
1572
+
1573
+ #
1574
+ # Returns an Azure SQL Database Transparent Data Encryption Activity Response.
1575
+ #
1576
+ # @param resource_group_name [String] The name of the resource group that
1577
+ # contains the resource. You can obtain this value from the Azure Resource
1578
+ # Manager API or the portal.
1579
+ # @param server_name [String] The name of the Azure SQL server.
1580
+ # @param database_name [String] The name of the Azure SQL database for which
1581
+ # the Transparent Data Encryption applies.
1582
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1583
+ # to the HTTP request.
1584
+ #
1585
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1586
+ #
1587
+ def list_transparent_data_encryption_activity_async(resource_group_name, server_name, database_name, custom_headers = nil)
1588
+ api_version = '2014-04-01'
1589
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1590
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1591
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1592
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1593
+
1594
+
1595
+ request_headers = {}
1596
+
1597
+ # Set Headers
1598
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1599
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1600
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current/operationResults'
1601
+
1602
+ request_url = @base_url || @client.base_url
1603
+
1604
+ options = {
1605
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1606
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name},
1607
+ query_params: {'api-version' => api_version},
1608
+ headers: request_headers.merge(custom_headers || {}),
1609
+ base_url: request_url
1610
+ }
1611
+ promise = @client.make_request_async(:get, path_template, options)
1612
+
1613
+ promise = promise.then do |result|
1614
+ http_response = result.response
1615
+ status_code = http_response.status
1616
+ response_content = http_response.body
1617
+ unless status_code == 200
1618
+ error_model = JSON.load(response_content)
1619
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1620
+ end
1621
+
1622
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1623
+ # Deserialize Response
1624
+ if status_code == 200
1625
+ begin
1626
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1627
+ result_mapper = TransparentDataEncryptionActivityListResult.mapper()
1628
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1629
+ rescue Exception => e
1630
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1631
+ end
1632
+ end
1633
+
1634
+ result
1635
+ end
1636
+
1637
+ promise.execute
1638
+ end
1639
+
1640
+ #
1641
+ # Failover the Azure SQL database replication link with the given ID.
1642
+ #
1643
+ # @param resource_group_name [String] The name of the resource group that
1644
+ # contains the resource. You can obtain this value from the Azure Resource
1645
+ # Manager API or the portal.
1646
+ # @param server_name [String] The name of the Azure SQL server.
1647
+ # @param database_name [String] The name of the Azure SQL database that has the
1648
+ # replication link to be failed over.
1649
+ # @param link_id [String] The ID of the replication link to be failed over.
1650
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1651
+ # will be added to the HTTP request.
1652
+ #
1653
+ #
1654
+ def begin_failover_replication_link(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
1655
+ response = begin_failover_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
1656
+ nil
1657
+ end
1658
+
1659
+ #
1660
+ # Failover the Azure SQL database replication link with the given ID.
1661
+ #
1662
+ # @param resource_group_name [String] The name of the resource group that
1663
+ # contains the resource. You can obtain this value from the Azure Resource
1664
+ # Manager API or the portal.
1665
+ # @param server_name [String] The name of the Azure SQL server.
1666
+ # @param database_name [String] The name of the Azure SQL database that has the
1667
+ # replication link to be failed over.
1668
+ # @param link_id [String] The ID of the replication link to be failed over.
1669
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1670
+ # will be added to the HTTP request.
1671
+ #
1672
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1673
+ #
1674
+ def begin_failover_replication_link_with_http_info(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
1675
+ begin_failover_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
1676
+ end
1677
+
1678
+ #
1679
+ # Failover the Azure SQL database replication link with the given ID.
1680
+ #
1681
+ # @param resource_group_name [String] The name of the resource group that
1682
+ # contains the resource. You can obtain this value from the Azure Resource
1683
+ # Manager API or the portal.
1684
+ # @param server_name [String] The name of the Azure SQL server.
1685
+ # @param database_name [String] The name of the Azure SQL database that has the
1686
+ # replication link to be failed over.
1687
+ # @param link_id [String] The ID of the replication link to be failed over.
1688
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1689
+ # to the HTTP request.
1690
+ #
1691
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1692
+ #
1693
+ def begin_failover_replication_link_async(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
1694
+ api_version = '2014-04-01'
1695
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1696
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1697
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1698
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1699
+ fail ArgumentError, 'link_id is nil' if link_id.nil?
1700
+
1701
+
1702
+ request_headers = {}
1703
+
1704
+ # Set Headers
1705
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1706
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1707
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover'
1708
+
1709
+ request_url = @base_url || @client.base_url
1710
+
1711
+ options = {
1712
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1713
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'linkId' => link_id},
1714
+ query_params: {'api-version' => api_version},
1715
+ headers: request_headers.merge(custom_headers || {}),
1716
+ base_url: request_url
1717
+ }
1718
+ promise = @client.make_request_async(:post, path_template, options)
1719
+
1720
+ promise = promise.then do |result|
1721
+ http_response = result.response
1722
+ status_code = http_response.status
1723
+ response_content = http_response.body
1724
+ unless status_code == 204 || status_code == 202
1725
+ error_model = JSON.load(response_content)
1726
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1727
+ end
1728
+
1729
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1730
+
1731
+ result
1732
+ end
1733
+
1734
+ promise.execute
1735
+ end
1736
+
1737
+ #
1738
+ # Force failover the Azure SQL database replication link with the given ID
1739
+ # which may result in data loss.
1740
+ #
1741
+ # @param resource_group_name [String] The name of the resource group that
1742
+ # contains the resource. You can obtain this value from the Azure Resource
1743
+ # Manager API or the portal.
1744
+ # @param server_name [String] The name of the Azure SQL server.
1745
+ # @param database_name [String] The name of the Azure SQL database that has the
1746
+ # replication link to be failed over.
1747
+ # @param link_id [String] The ID of the replication link to be failed over.
1748
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1749
+ # will be added to the HTTP request.
1750
+ #
1751
+ #
1752
+ def begin_failover_replication_link_allow_data_loss(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
1753
+ response = begin_failover_replication_link_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
1754
+ nil
1755
+ end
1756
+
1757
+ #
1758
+ # Force failover the Azure SQL database replication link with the given ID
1759
+ # which may result in data loss.
1760
+ #
1761
+ # @param resource_group_name [String] The name of the resource group that
1762
+ # contains the resource. You can obtain this value from the Azure Resource
1763
+ # Manager API or the portal.
1764
+ # @param server_name [String] The name of the Azure SQL server.
1765
+ # @param database_name [String] The name of the Azure SQL database that has the
1766
+ # replication link to be failed over.
1767
+ # @param link_id [String] The ID of the replication link to be failed over.
1768
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1769
+ # will be added to the HTTP request.
1770
+ #
1771
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1772
+ #
1773
+ def begin_failover_replication_link_allow_data_loss_with_http_info(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
1774
+ begin_failover_replication_link_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers).value!
1775
+ end
1776
+
1777
+ #
1778
+ # Force failover the Azure SQL database replication link with the given ID
1779
+ # which may result in data loss.
1780
+ #
1781
+ # @param resource_group_name [String] The name of the resource group that
1782
+ # contains the resource. You can obtain this value from the Azure Resource
1783
+ # Manager API or the portal.
1784
+ # @param server_name [String] The name of the Azure SQL server.
1785
+ # @param database_name [String] The name of the Azure SQL database that has the
1786
+ # replication link to be failed over.
1787
+ # @param link_id [String] The ID of the replication link to be failed over.
1788
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1789
+ # to the HTTP request.
1790
+ #
1791
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1792
+ #
1793
+ def begin_failover_replication_link_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers = nil)
1794
+ api_version = '2014-04-01'
1795
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1796
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1797
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1798
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1799
+ fail ArgumentError, 'link_id is nil' if link_id.nil?
1800
+
1801
+
1802
+ request_headers = {}
1803
+
1804
+ # Set Headers
1805
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1806
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1807
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss'
1808
+
1809
+ request_url = @base_url || @client.base_url
1810
+
1811
+ options = {
1812
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1813
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'linkId' => link_id},
1814
+ query_params: {'api-version' => api_version},
1815
+ headers: request_headers.merge(custom_headers || {}),
1816
+ base_url: request_url
1817
+ }
1818
+ promise = @client.make_request_async(:post, path_template, options)
1819
+
1820
+ promise = promise.then do |result|
1821
+ http_response = result.response
1822
+ status_code = http_response.status
1823
+ response_content = http_response.body
1824
+ unless status_code == 204 || status_code == 202
1825
+ error_model = JSON.load(response_content)
1826
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1827
+ end
1828
+
1829
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1830
+
1831
+ result
1832
+ end
1833
+
1834
+ promise.execute
1835
+ end
1836
+
1837
+ #
1838
+ # Pause an Azure SQL Data Warehouse database.
1839
+ #
1840
+ # @param resource_group_name [String] The name of the resource group that
1841
+ # contains the resource. You can obtain this value from the Azure Resource
1842
+ # Manager API or the portal.
1843
+ # @param server_name [String] The name of the Azure SQL server.
1844
+ # @param database_name [String] The name of the Azure SQL Data Warehouse
1845
+ # database to pause.
1846
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1847
+ # will be added to the HTTP request.
1848
+ #
1849
+ #
1850
+ def begin_pause_data_warehouse(resource_group_name, server_name, database_name, custom_headers = nil)
1851
+ response = begin_pause_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers).value!
1852
+ nil
1853
+ end
1854
+
1855
+ #
1856
+ # Pause an Azure SQL Data Warehouse database.
1857
+ #
1858
+ # @param resource_group_name [String] The name of the resource group that
1859
+ # contains the resource. You can obtain this value from the Azure Resource
1860
+ # Manager API or the portal.
1861
+ # @param server_name [String] The name of the Azure SQL server.
1862
+ # @param database_name [String] The name of the Azure SQL Data Warehouse
1863
+ # database to pause.
1864
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1865
+ # will be added to the HTTP request.
1866
+ #
1867
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1868
+ #
1869
+ def begin_pause_data_warehouse_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
1870
+ begin_pause_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers).value!
1871
+ end
1872
+
1873
+ #
1874
+ # Pause an Azure SQL Data Warehouse database.
1875
+ #
1876
+ # @param resource_group_name [String] The name of the resource group that
1877
+ # contains the resource. You can obtain this value from the Azure Resource
1878
+ # Manager API or the portal.
1879
+ # @param server_name [String] The name of the Azure SQL server.
1880
+ # @param database_name [String] The name of the Azure SQL Data Warehouse
1881
+ # database to pause.
1882
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1883
+ # to the HTTP request.
1884
+ #
1885
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1886
+ #
1887
+ def begin_pause_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers = nil)
1888
+ api_version = '2014-04-01'
1889
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1890
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1891
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1892
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1893
+
1894
+
1895
+ request_headers = {}
1896
+
1897
+ # Set Headers
1898
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1899
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1900
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause'
1901
+
1902
+ request_url = @base_url || @client.base_url
1903
+
1904
+ options = {
1905
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1906
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name},
1907
+ query_params: {'api-version' => api_version},
1908
+ headers: request_headers.merge(custom_headers || {}),
1909
+ base_url: request_url
1910
+ }
1911
+ promise = @client.make_request_async(:post, path_template, options)
1912
+
1913
+ promise = promise.then do |result|
1914
+ http_response = result.response
1915
+ status_code = http_response.status
1916
+ response_content = http_response.body
1917
+ unless status_code == 200 || status_code == 202
1918
+ error_model = JSON.load(response_content)
1919
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1920
+ end
1921
+
1922
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1923
+
1924
+ result
1925
+ end
1926
+
1927
+ promise.execute
1928
+ end
1929
+
1930
+ #
1931
+ # Resume an Azure SQL Data Warehouse database.
1932
+ #
1933
+ # @param resource_group_name [String] The name of the resource group that
1934
+ # contains the resource. You can obtain this value from the Azure Resource
1935
+ # Manager API or the portal.
1936
+ # @param server_name [String] The name of the Azure SQL server.
1937
+ # @param database_name [String] The name of the Azure SQL Data Warehouse
1938
+ # database to resume.
1939
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1940
+ # will be added to the HTTP request.
1941
+ #
1942
+ #
1943
+ def begin_resume_data_warehouse(resource_group_name, server_name, database_name, custom_headers = nil)
1944
+ response = begin_resume_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers).value!
1945
+ nil
1946
+ end
1947
+
1948
+ #
1949
+ # Resume an Azure SQL Data Warehouse database.
1950
+ #
1951
+ # @param resource_group_name [String] The name of the resource group that
1952
+ # contains the resource. You can obtain this value from the Azure Resource
1953
+ # Manager API or the portal.
1954
+ # @param server_name [String] The name of the Azure SQL server.
1955
+ # @param database_name [String] The name of the Azure SQL Data Warehouse
1956
+ # database to resume.
1957
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1958
+ # will be added to the HTTP request.
1959
+ #
1960
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1961
+ #
1962
+ def begin_resume_data_warehouse_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
1963
+ begin_resume_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers).value!
1964
+ end
1965
+
1966
+ #
1967
+ # Resume an Azure SQL Data Warehouse database.
1968
+ #
1969
+ # @param resource_group_name [String] The name of the resource group that
1970
+ # contains the resource. You can obtain this value from the Azure Resource
1971
+ # Manager API or the portal.
1972
+ # @param server_name [String] The name of the Azure SQL server.
1973
+ # @param database_name [String] The name of the Azure SQL Data Warehouse
1974
+ # database to resume.
1975
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1976
+ # to the HTTP request.
1977
+ #
1978
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1979
+ #
1980
+ def begin_resume_data_warehouse_async(resource_group_name, server_name, database_name, custom_headers = nil)
1981
+ api_version = '2014-04-01'
1982
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1983
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1984
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1985
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1986
+
1987
+
1988
+ request_headers = {}
1989
+
1990
+ # Set Headers
1991
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1992
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1993
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume'
1994
+
1995
+ request_url = @base_url || @client.base_url
1996
+
1997
+ options = {
1998
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1999
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name},
2000
+ query_params: {'api-version' => api_version},
2001
+ headers: request_headers.merge(custom_headers || {}),
2002
+ base_url: request_url
2003
+ }
2004
+ promise = @client.make_request_async(:post, path_template, options)
2005
+
2006
+ promise = promise.then do |result|
2007
+ http_response = result.response
2008
+ status_code = http_response.status
2009
+ response_content = http_response.body
2010
+ unless status_code == 202 || status_code == 200
2011
+ error_model = JSON.load(response_content)
2012
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2013
+ end
2014
+
2015
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2016
+
2017
+ result
2018
+ end
2019
+
2020
+ promise.execute
2021
+ end
2022
+
2023
+ #
2024
+ # Creates a new Azure SQL database or updates an existing Azure SQL database.
2025
+ # Location is a required property in the request body, and it must be the same
2026
+ # as the location of the SQL server.
2027
+ #
2028
+ # @param resource_group_name [String] The name of the resource group that
2029
+ # contains the resource. You can obtain this value from the Azure Resource
2030
+ # Manager API or the portal.
2031
+ # @param server_name [String] The name of the Azure SQL server.
2032
+ # @param database_name [String] The name of the Azure SQL database to be
2033
+ # operated on (updated or created).
2034
+ # @param parameters [Database] The required parameters for creating or updating
2035
+ # a database.
2036
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2037
+ # will be added to the HTTP request.
2038
+ #
2039
+ # @return [Database] operation results.
2040
+ #
2041
+ def begin_create_or_update(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
2042
+ response = begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
2043
+ response.body unless response.nil?
2044
+ end
2045
+
2046
+ #
2047
+ # Creates a new Azure SQL database or updates an existing Azure SQL database.
2048
+ # Location is a required property in the request body, and it must be the same
2049
+ # as the location of the SQL server.
2050
+ #
2051
+ # @param resource_group_name [String] The name of the resource group that
2052
+ # contains the resource. You can obtain this value from the Azure Resource
2053
+ # Manager API or the portal.
2054
+ # @param server_name [String] The name of the Azure SQL server.
2055
+ # @param database_name [String] The name of the Azure SQL database to be
2056
+ # operated on (updated or created).
2057
+ # @param parameters [Database] The required parameters for creating or updating
2058
+ # a database.
2059
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2060
+ # will be added to the HTTP request.
2061
+ #
2062
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2063
+ #
2064
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
2065
+ begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
2066
+ end
2067
+
2068
+ #
2069
+ # Creates a new Azure SQL database or updates an existing Azure SQL database.
2070
+ # Location is a required property in the request body, and it must be the same
2071
+ # as the location of the SQL server.
2072
+ #
2073
+ # @param resource_group_name [String] The name of the resource group that
2074
+ # contains the resource. You can obtain this value from the Azure Resource
2075
+ # Manager API or the portal.
2076
+ # @param server_name [String] The name of the Azure SQL server.
2077
+ # @param database_name [String] The name of the Azure SQL database to be
2078
+ # operated on (updated or created).
2079
+ # @param parameters [Database] The required parameters for creating or updating
2080
+ # a database.
2081
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2082
+ # to the HTTP request.
2083
+ #
2084
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2085
+ #
2086
+ def begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
2087
+ api_version = '2014-04-01'
2088
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2089
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2090
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
2091
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2092
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
2093
+
2094
+
2095
+ request_headers = {}
2096
+
2097
+ # Set Headers
2098
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2099
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2100
+
2101
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2102
+
2103
+ # Serialize Request
2104
+ request_mapper = Database.mapper()
2105
+ request_content = @client.serialize(request_mapper, parameters, 'parameters')
2106
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2107
+
2108
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'
2109
+
2110
+ request_url = @base_url || @client.base_url
2111
+
2112
+ options = {
2113
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2114
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name},
2115
+ query_params: {'api-version' => api_version},
2116
+ body: request_content,
2117
+ headers: request_headers.merge(custom_headers || {}),
2118
+ base_url: request_url
2119
+ }
2120
+ promise = @client.make_request_async(:put, path_template, options)
2121
+
2122
+ promise = promise.then do |result|
2123
+ http_response = result.response
2124
+ status_code = http_response.status
2125
+ response_content = http_response.body
2126
+ unless status_code == 200 || status_code == 201 || status_code == 202
2127
+ error_model = JSON.load(response_content)
2128
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2129
+ end
2130
+
2131
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2132
+ # Deserialize Response
2133
+ if status_code == 200
2134
+ begin
2135
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2136
+ result_mapper = Database.mapper()
2137
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
2138
+ rescue Exception => e
2139
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2140
+ end
2141
+ end
2142
+ # Deserialize Response
2143
+ if status_code == 201
2144
+ begin
2145
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2146
+ result_mapper = Database.mapper()
2147
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
2148
+ rescue Exception => e
2149
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2150
+ end
2151
+ end
2152
+ # Deserialize Response
2153
+ if status_code == 202
2154
+ begin
2155
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2156
+ result_mapper = Database.mapper()
2157
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
2158
+ rescue Exception => e
2159
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2160
+ end
2161
+ end
2162
+
2163
+ result
2164
+ end
2165
+
2166
+ promise.execute
2167
+ end
2168
+
2169
+ end
2170
+ end