Method: IAM::AssumeRolePolicyDocument.from_role

Defined in:
lib/w-stdlib/aws.rb

.from_role(role) ⇒ Object

initializes from a hash of params. it supports docs as url encoded json strings, like the aws api returns or docs that are nested hashes and arrays



45
46
47
48
49
50
51
52
53
# File 'lib/w-stdlib/aws.rb', line 45

def self.from_role(role)
  doc = role[:assume_role_policy_document]
  doc = role["AssumeRolePolicyDocument"] unless doc
  raise 'invalid role' unless doc

  doc = doc.url_decode.from_json if doc.is_a? String

  self.new doc
end