Class: Jets::Resource::Iam::ManagedPolicy

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Defined in:
lib/jets/resource/iam/managed_policy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*definitions) ⇒ ManagedPolicy

Returns a new instance of ManagedPolicy.



6
7
8
# File 'lib/jets/resource/iam/managed_policy.rb', line 6

def initialize(*definitions)
  @definitions = definitions.flatten.compact
end

Instance Attribute Details

#definitionsObject (readonly)

Returns the value of attribute definitions.



5
6
7
# File 'lib/jets/resource/iam/managed_policy.rb', line 5

def definitions
  @definitions
end

Instance Method Details

#arnsObject



10
11
12
# File 'lib/jets/resource/iam/managed_policy.rb', line 10

def arns
  definitions.map { |definition| standardize(definition) }
end

#standardize(definition) ⇒ Object

AmazonEC2ReadOnlyAccess => arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess



16
17
18
19
20
# File 'lib/jets/resource/iam/managed_policy.rb', line 16

def standardize(definition)
  return definition if definition.include?('iam::aws:policy')

  "arn:aws:iam::aws:policy/#{definition}"
end