Class: Aws::Session::Credentials::Cache

Inherits:
Object
  • Object
show all
Includes:
FileProvider::YamlFileProvider, ProfileStorage
Defined in:
lib/aws/session/credentials/cache.rb

Overview

Holds session credentials

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FileProvider::YamlFileProvider

#[], #[]=, #read, #write

Methods included from ProfileStorage

#print_profiles, #profile, #profiles, #profiles=, #set_profile

Constructor Details

#initialize(options = {}) ⇒ Cache

Returns a new instance of Cache.



11
12
13
# File 'lib/aws/session/credentials/cache.rb', line 11

def initialize(options = {})
  @path = File.expand_path(options[:path] || default_path)
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/aws/session/credentials/cache.rb', line 9

def path
  @path
end

Instance Method Details

#default_pathObject



15
16
17
# File 'lib/aws/session/credentials/cache.rb', line 15

def default_path
  File.join(%w(~ .aws aws-session-cache.yml))
end

#profiles_hashHash<String,Hash>

Returns:

  • (Hash<String,Hash>)


20
21
22
# File 'lib/aws/session/credentials/cache.rb', line 20

def profiles_hash
  self[:profiles] || {}
end

#profiles_hash=(hsh) ⇒ Object

Parameters:

  • hsh (Hash)


25
26
27
# File 'lib/aws/session/credentials/cache.rb', line 25

def profiles_hash=(hsh)
  self[:profiles] = hsh
end