Module: AwsAssumeRole::Store::Serialization

Defined in:
lib/aws_assume_role/store/serialization.rb

Class Method Summary collapse

Class Method Details

.credentials_from_hash(credentials) ⇒ Object


4
5
6
7
8
9
# File 'lib/aws_assume_role/store/serialization.rb', line 4

def credentials_from_hash(credentials)
    creds_for_deserialization = credentials.respond_to?("[]") ? credentials : credentials_to_hash(credentials)
    Aws::Credentials.new(creds_for_deserialization[:access_key_id],
                         creds_for_deserialization[:secret_access_key],
                         creds_for_deserialization[:session_token])
end

.credentials_to_hash(credentials) ⇒ Object


11
12
13
14
15
16
17
# File 'lib/aws_assume_role/store/serialization.rb', line 11

def credentials_to_hash(credentials)
    {
        access_key_id: credentials.access_key_id,
        secret_access_key: credentials.secret_access_key,
        session_token: credentials.session_token,
    }
end