Sha256: 82930d0355eda9425b85507a13efeaf0afff0ae54a681f2e7537c3afcfb8ad2d
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 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 = "#{AZURE_RESOURCE}/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 MsRestAzure::AzureOperationError => e raise_azure_exception(e, JSON.parse(e.response)['message']) end Fog::Logger.debug "Sql Servers listed successfully in Resource Group: #{resource_group}" JSON.parse(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.0.9 | lib/fog/azurerm/requests/sql/list_sql_servers.rb |