lib/fog/azurerm/requests/sql/delete_database.rb in fog-azure-rm-0.1.0 vs lib/fog/azurerm/requests/sql/delete_database.rb in fog-azure-rm-0.1.1
- old
+ new
@@ -4,20 +4,20 @@
# Real class for Sql Database Request
class Real
def delete_database(resource_group, server_name, name)
msg = "Deleting SQL Database: #{name}."
Fog::Logger.debug msg
- resource_url = "#{AZURE_RESOURCE}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.Sql/servers/#{server_name}/databases/#{name}?api-version=2014-04-01-preview"
+ resource_url = "#{resource_manager_endpoint_url}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.Sql/servers/#{server_name}/databases/#{name}?api-version=2014-04-01-preview"
begin
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
RestClient.delete(
resource_url,
accept: :json,
content_type: :json,
authorization: token
)
rescue RestClient::Exception => e
- raise JSON.parse(e.response)['message']
+ raise_azure_exception(e, msg)
end
Fog::Logger.debug "SQL Database: #{name} deleted successfully."
true
end
end