module Awsam::Accounts
Public Class Methods
active()
click to toggle source
# File lib/awsam/accounts.rb, line 22 def self.active active = ENV['AWSAM_ACTIVE_ACCOUNT'] return nil unless active acct = find(active) unless acct puts "No account named '#{active}' found." return nil end acct end
find(name)
click to toggle source
# File lib/awsam/accounts.rb, line 39 def self.find(name) @@accounts[name] end
get()
click to toggle source
# File lib/awsam/accounts.rb, line 35 def self.get return @@accounts end
get_default()
click to toggle source
# File lib/awsam/accounts.rb, line 52 def self.get_default dflt = Utils::get_default(Awsam::get_accts_dir) dflt ? find(dflt) : nil end
load!()
click to toggle source
# File lib/awsam/accounts.rb, line 11 def self.load! accts = Hash.new accts_dir = Awsam::get_accts_dir Utils::confdir_scan(accts_dir) do |name| acct = Account::load_from_disk(File.join(accts_dir, name)) accts[name] = acct if acct end @@accounts = accts end
remove_default()
click to toggle source
# File lib/awsam/accounts.rb, line 57 def self.remove_default Utils::remove_default(Awsam::get_accts_dir) end
set_default(name)
click to toggle source
# File lib/awsam/accounts.rb, line 43 def self.set_default(name) unless find(name) $stderr.puts "Failed to find account #{name}" return false end Utils::set_default(Awsam::get_accts_dir, name) end