Sha256: 747ac555c8924806fa1ff3ac084235d888dcfc7b72a5e077de0d0f15db7b4dd0
Contents?: true
Size: 1.76 KB
Versions: 1
Compression:
Stored size: 1.76 KB
Contents
module Fog module Sql class AzureRM # Real class for Sql Server Request class Real def list_sql_servers(resource_group) msg = "Listing Sql Servers 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?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 Servers listed successfully in Resource Group: #{resource_group}" Fog::JSON.decode(response)['value'] end end # Mock class for Sql Server Request class Mock def list_sql_servers(*) [ { 'location' => '{server-location}', 'properties' => { 'version' => '{server-version}', 'administratorLogin' => '{admin-name}', 'administratorLoginPassword' => '{admin-password}' } }, { 'location' => '{server-location}', 'properties' => { 'version' => '{server-version}', 'administratorLogin' => '{admin-name}', 'administratorLoginPassword' => '{admin-password}' } } ] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fog-azure-rm-0.1.1 | lib/fog/azurerm/requests/sql/list_sql_servers.rb |