class Azure::SQL::Mgmt::V2017_03_01_preview::Databases
The Azure
SQL
Database management API provides a RESTful set of web services that interact with Azure
SQL
Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases.
Attributes
@return [SqlManagementClient] reference to the SqlManagementClient
Public Class Methods
Creates and initializes a new instance of the Databases
class. @param client service class for accessing basic functionality.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 20 def initialize(client) @client = client end
Public Instance Methods
Creates a new database or updates an existing database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [Database] The requested database resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Database] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 748 def begin_create_or_update(resource_group_name, server_name, database_name, parameters, custom_headers:nil) response = begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value! response.body unless response.nil? end
Creates a new database or updates an existing database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [Database] The requested database resource state. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 785 def begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'database_name is nil' if database_name.nil? fail ArgumentError, 'parameters is nil' if parameters.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper() request_content = @client.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:put, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 || status_code == 202 || status_code == 201 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end # Deserialize Response if status_code == 201 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Creates a new database or updates an existing database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [Database] The requested database resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 767 def begin_create_or_update_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers:nil) begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value! end
Deletes the database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 871 def begin_delete(resource_group_name, server_name, database_name, custom_headers:nil) response = begin_delete_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value! nil end
Deletes the database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 906 def begin_delete_async(resource_group_name, server_name, database_name, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'database_name is nil' if database_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 || status_code == 202 || status_code == 204 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? result end promise.execute end
Deletes the database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 889 def begin_delete_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil) begin_delete_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value! end
Exports a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [ImportExportDatabaseDefinition] The database export request parameters. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [ImportExportOperationResult] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1082 def begin_export(resource_group_name, server_name, database_name, parameters, custom_headers:nil) response = begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value! response.body unless response.nil? end
Exports a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [ImportExportDatabaseDefinition] The database export request parameters. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1121 def begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'database_name is nil' if database_name.nil? fail ArgumentError, 'parameters is nil' if parameters.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::ImportExportDatabaseDefinition.mapper() request_content = @client.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::ImportExportOperationResult.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Exports a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [ImportExportDatabaseDefinition] The database export request parameters. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1102 def begin_export_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers:nil) begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value! end
Pauses a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database to be paused. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Database] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1198 def begin_pause(resource_group_name, server_name, database_name, custom_headers:nil) response = begin_pause_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Pauses a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database to be paused. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1233 def begin_pause_async(resource_group_name, server_name, database_name, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'database_name is nil' if database_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Pauses a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database to be paused. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1216 def begin_pause_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil) begin_pause_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value! end
Resumes a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database to be resumed. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Database] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1302 def begin_resume(resource_group_name, server_name, database_name, custom_headers:nil) response = begin_resume_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Resumes a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database to be resumed. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1337 def begin_resume_async(resource_group_name, server_name, database_name, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'database_name is nil' if database_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Resumes a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database to be resumed. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1320 def begin_resume_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil) begin_resume_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value! end
Updates an existing database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [DatabaseUpdate] The requested database resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Database] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 966 def begin_update(resource_group_name, server_name, database_name, parameters, custom_headers:nil) response = begin_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value! response.body unless response.nil? end
Updates an existing database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [DatabaseUpdate] The requested database resource state. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1003 def begin_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'database_name is nil' if database_name.nil? fail ArgumentError, 'parameters is nil' if parameters.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::DatabaseUpdate.mapper() request_content = @client.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:patch, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Updates an existing database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [DatabaseUpdate] The requested database resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 985 def begin_update_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers:nil) begin_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value! end
Creates a new database or updates an existing database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [Database] The requested database resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Database] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 245 def create_or_update(resource_group_name, server_name, database_name, parameters, custom_headers:nil) response = create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value! response.body unless response.nil? end
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [Database] The requested database resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 263 def create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil) # Send request promise = begin_create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end
Deletes the database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 292 def delete(resource_group_name, server_name, database_name, custom_headers:nil) response = delete_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value! nil end
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 309 def delete_async(resource_group_name, server_name, database_name, custom_headers:nil) # Send request promise = begin_delete_async(resource_group_name, server_name, database_name, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end
Exports a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [ImportExportDatabaseDefinition] The database export request parameters. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [ImportExportOperationResult] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 390 def export(resource_group_name, server_name, database_name, parameters, custom_headers:nil) response = export_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value! response.body unless response.nil? end
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [ImportExportDatabaseDefinition] The database export request parameters. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 409 def export_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil) # Send request promise = begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::ImportExportOperationResult.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end
Gets a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Database] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 140 def get(resource_group_name, server_name, database_name, custom_headers:nil) response = get_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 175 def get_async(resource_group_name, server_name, database_name, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'database_name is nil' if database_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Gets a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 158 def get_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil) get_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value! end
Gets a list of databases in an elastic pool.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param elastic_pool_name [String] The name of the elastic pool. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<Database>] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 488 def list_by_elastic_pool(resource_group_name, server_name, elastic_pool_name, custom_headers:nil) first_page = list_by_elastic_pool_as_lazy(resource_group_name, server_name, elastic_pool_name, custom_headers:custom_headers) first_page.get_all_items end
Gets a list of databases in an elastic pool.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param elastic_pool_name [String] The name of the elastic pool. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [DatabaseListResult] which provide lazy access to pages of the response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1611 def list_by_elastic_pool_as_lazy(resource_group_name, server_name, elastic_pool_name, custom_headers:nil) response = list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, custom_headers:custom_headers).value! unless response.nil? page = response.body page.next_method = Proc.new do |next_page_link| list_by_elastic_pool_next_async(next_page_link, custom_headers:custom_headers) end page end end
Gets a list of databases in an elastic pool.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param elastic_pool_name [String] The name of the elastic pool. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 523 def list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'elastic_pool_name is nil' if elastic_pool_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'elasticPoolName' => elastic_pool_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::DatabaseListResult.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Gets a list of databases in an elastic pool.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [DatabaseListResult] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1493 def list_by_elastic_pool_next(next_page_link, custom_headers:nil) response = list_by_elastic_pool_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets a list of databases in an elastic pool.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1522 def list_by_elastic_pool_next_async(next_page_link, custom_headers:nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '{nextLink}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], skip_encoding_path_params: {'nextLink' => next_page_link}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::DatabaseListResult.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Gets a list of databases in an elastic pool.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1508 def list_by_elastic_pool_next_with_http_info(next_page_link, custom_headers:nil) list_by_elastic_pool_next_async(next_page_link, custom_headers:custom_headers).value! end
Gets a list of databases in an elastic pool.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param elastic_pool_name [String] The name of the elastic pool. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 506 def list_by_elastic_pool_with_http_info(resource_group_name, server_name, elastic_pool_name, custom_headers:nil) list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, custom_headers:custom_headers).value! end
Gets a list of databases.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<Database>] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 39 def list_by_server(resource_group_name, server_name, custom_headers:nil) first_page = list_by_server_as_lazy(resource_group_name, server_name, custom_headers:custom_headers) first_page.get_all_items end
Gets a list of databases.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [DatabaseListResult] which provide lazy access to pages of the response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1586 def list_by_server_as_lazy(resource_group_name, server_name, custom_headers:nil) response = list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value! unless response.nil? page = response.body page.next_method = Proc.new do |next_page_link| list_by_server_next_async(next_page_link, custom_headers:custom_headers) end page end end
Gets a list of databases.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 72 def list_by_server_async(resource_group_name, server_name, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::DatabaseListResult.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Gets a list of databases.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [DatabaseListResult] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1403 def list_by_server_next(next_page_link, custom_headers:nil) response = list_by_server_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets a list of databases.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1432 def list_by_server_next_async(next_page_link, custom_headers:nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '{nextLink}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], skip_encoding_path_params: {'nextLink' => next_page_link}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::DatabaseListResult.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Gets a list of databases.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 1418 def list_by_server_next_with_http_info(next_page_link, custom_headers:nil) list_by_server_next_async(next_page_link, custom_headers:custom_headers).value! end
Gets a list of databases.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 56 def list_by_server_with_http_info(resource_group_name, server_name, custom_headers:nil) list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value! end
Pauses a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database to be paused. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Database] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 440 def pause(resource_group_name, server_name, database_name, custom_headers:nil) response = pause_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value! response.body unless response.nil? end
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database to be paused. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 457 def pause_async(resource_group_name, server_name, database_name, custom_headers:nil) # Send request promise = begin_pause_async(resource_group_name, server_name, database_name, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end
Renames a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database to rename. @param parameters [ResourceMoveDefinition] The resource move definition for renaming this database. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 641 def rename(resource_group_name, server_name, database_name, parameters, custom_headers:nil) response = rename_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value! nil end
Renames a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database to rename. @param parameters [ResourceMoveDefinition] The resource move definition for renaming this database. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 680 def rename_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'database_name is nil' if database_name.nil? fail ArgumentError, 'parameters is nil' if parameters.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::ResourceMoveDefinition.mapper() request_content = @client.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? result end promise.execute end
Renames a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database to rename. @param parameters [ResourceMoveDefinition] The resource move definition for renaming this database. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 661 def rename_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers:nil) rename_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value! end
Resumes a database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database to be resumed. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Database] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 592 def resume(resource_group_name, server_name, database_name, custom_headers:nil) response = resume_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value! response.body unless response.nil? end
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database to be resumed. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 609 def resume_async(resource_group_name, server_name, database_name, custom_headers:nil) # Send request promise = begin_resume_async(resource_group_name, server_name, database_name, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end
Updates an existing database.
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [DatabaseUpdate] The requested database resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Database] operation results.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 339 def update(resource_group_name, server_name, database_name, parameters, custom_headers:nil) response = update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value! response.body unless response.nil? end
@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure
Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database. @param parameters [DatabaseUpdate] The requested database resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http response.
# File lib/2017-03-01-preview/generated/azure_mgmt_sql/databases.rb, line 357 def update_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil) # Send request promise = begin_update_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::Database.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response) end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end