Class: Jets::Resource::Iam::ManagedPolicy
- Inherits:
-
Object
- Object
- Jets::Resource::Iam::ManagedPolicy
- Extended by:
- Memoist
- Defined in:
- lib/jets/resource/iam/managed_policy.rb
Instance Attribute Summary collapse
-
#definitions ⇒ Object
readonly
Returns the value of attribute definitions.
Instance Method Summary collapse
- #arns ⇒ Object
-
#initialize(*definitions) ⇒ ManagedPolicy
constructor
A new instance of ManagedPolicy.
-
#standardize(definition) ⇒ Object
AmazonEC2ReadOnlyAccess => arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess.
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
#definitions ⇒ Object (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
#arns ⇒ Object
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 |