def initialize(config)
if config.respond_to?(:config_service?) && config.config_service?
@config = config
else
@config = Fog::Brightbox::Config.new(config)
end
@config = Fog::Brightbox::Compute::Config.new(@config)
@auth_url = @config.auth_url.to_s
@auth_connection = Fog::Core::Connection.new(@auth_url)
@api_url = @config.compute_url.to_s
@connection_options = @config.connection_options
@persistent = @config.connection_persistent?
@connection = Fog::Core::Connection.new(@api_url, @persistent, @connection_options)
client_id = @config.client_id
client_secret = @config.client_secret
username = @config.username
password = @config.password
@configured_account = @config.account
@scoped_account = @configured_account
credential_options = { :username => username, :password => password }
@credentials = CredentialSet.new(client_id, client_secret, credential_options)
@credentials.update_tokens(@config.cached_access_token, @config.cached_refresh_token)
@token_management = @config.managed_tokens?
end