Sha256: 4ae5a39452205acbcd27e57734f831eef02dddf6703106e5ec58ffd98b4fa2f2
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
module Fog module Sql class AzureRM # Real class for Sql Server Request class Real def get_sql_server(resource_group, server_name) msg = "Getting Sql Server: #{server_name} in Resource Group: #{resource_group}..." Fog::Logger.debug msg resource_url = "#{AZURE_RESOURCE}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.Sql/servers/#{server_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 JSON.parse(e.response)['message'] end Fog::Logger.debug "Sql Server fetched successfully in Resource Group: #{resource_group}" JSON.parse(response) end end # Mock class for Sql Server Request class Mock def get_sql_server(*) { '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.0 | lib/fog/azurerm/requests/sql/get_sql_server.rb |