lib/fog/azurerm/requests/sql/get_database.rb in fog-azure-rm-0.1.1 vs lib/fog/azurerm/requests/sql/get_database.rb in fog-azure-rm-0.1.2
- old
+ new
@@ -1,48 +1,48 @@
-module Fog
- module Sql
- class AzureRM
- # Real class for Sql Database Request
- class Real
- def get_database(resource_group, server_name, name)
- msg = "Getting Sql Database: #{name} in Resource Group: #{resource_group}."
- Fog::Logger.debug msg
- 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)
- response = RestClient.get(
- resource_url,
- accept: :json,
- content_type: :json,
- authorization: token
- )
- rescue RestClient::Exception => e
- raise_azure_exception(e, msg)
- end
- Fog::Logger.debug "Sql Database fetched successfully in Resource Group: #{resource_group}"
- Fog::JSON.decode(response)
- end
- end
-
- # Mock class for Sql Database Request
- class Mock
- def get_database(*)
- {
- 'location' => '{database-location}',
- 'properties' => {
- 'createMode' => '{creation-mode}',
- 'sourceDatabaseId' => '{source-database-id}',
- 'edition' => '{database-edition}',
- 'collation' => '{collation-name}',
- 'maxSizeBytes' => '{max-database-size}',
- 'requestedServiceObjectiveId' => '{requested-service-id}',
- 'requestedServiceObjectiveName' => '{requested-service-id}',
- 'restorePointInTime' => '{restore-time}',
- 'sourceDatabaseDeletionDate' => '{source-deletion-date}',
- 'elasticPoolName' => '{elastic-pool-name}'
- }
- }
- end
- end
- end
- end
-end
+module Fog
+ module Sql
+ class AzureRM
+ # Real class for Sql Database Request
+ class Real
+ def get_database(resource_group, server_name, name)
+ msg = "Getting Sql Database: #{name} in Resource Group: #{resource_group}."
+ Fog::Logger.debug msg
+ 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)
+ response = RestClient.get(
+ resource_url,
+ accept: :json,
+ content_type: :json,
+ authorization: token
+ )
+ rescue RestClient::Exception => e
+ raise_azure_exception(e, msg)
+ end
+ Fog::Logger.debug "Sql Database fetched successfully in Resource Group: #{resource_group}"
+ Fog::JSON.decode(response)
+ end
+ end
+
+ # Mock class for Sql Database Request
+ class Mock
+ def get_database(*)
+ {
+ 'location' => '{database-location}',
+ 'properties' => {
+ 'createMode' => '{creation-mode}',
+ 'sourceDatabaseId' => '{source-database-id}',
+ 'edition' => '{database-edition}',
+ 'collation' => '{collation-name}',
+ 'maxSizeBytes' => '{max-database-size}',
+ 'requestedServiceObjectiveId' => '{requested-service-id}',
+ 'requestedServiceObjectiveName' => '{requested-service-id}',
+ 'restorePointInTime' => '{restore-time}',
+ 'sourceDatabaseDeletionDate' => '{source-deletion-date}',
+ 'elasticPoolName' => '{elastic-pool-name}'
+ }
+ }
+ end
+ end
+ end
+ end
+end