Class: Jets::Cfn::Iam::ManagedPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/jets/cfn/iam/managed_policy.rb

Overview

Examples: config.codebuild.iam.managed_policies = [AmazonSSMReadOnlyAccess]

Instance Method Summary collapse

Constructor Details

#initialize(policies) ⇒ ManagedPolicy

Returns a new instance of ManagedPolicy.



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

def initialize(policies)
  @policies = policies.compact.flatten.uniq
end

Instance Method Details

#standardizeObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/jets/cfn/iam/managed_policy.rb', line 9

def standardize
  return if @policies.nil? || @policies.empty?

  @policies.map do |policy|
    if policy.include?("arn:")
      policy
    else
      "arn:aws:iam::aws:policy/#{policy}"
    end
  end
end