Class: Jets::Cfn::Resource::Iam::Policy
- Defined in:
- lib/jets/cfn/resource/iam/policy.rb
Instance Method Summary collapse
- #definition ⇒ Object
-
#initialize(role) ⇒ Policy
constructor
A new instance of Policy.
- #policy_logical_id ⇒ Object
Methods inherited from Base
#attributes, #logical_id, #outputs, #parameters, #permission, #properties, #replacements, #replacer, #standarize, #template, truncate_id, #type
Methods included from Util::Camelize
Constructor Details
#initialize(role) ⇒ Policy
Returns a new instance of Policy.
3 4 5 |
# File 'lib/jets/cfn/resource/iam/policy.rb', line 3 def initialize(role) @role = role end |
Instance Method Details
#definition ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/jets/cfn/resource/iam/policy.rb', line 12 def definition logical_id = policy_logical_id # Do not assign pretty role_name because long controller names might hit the 64-char # limit. Also, IAM roles are global, so assigning role names prevents cross region deploys. definition = { logical_id => { Type: "AWS::IAM::Policy", Properties: { Roles: [Ref: role_logical_id.camelize], PolicyName: "#{policy_name[0..127]}", # required, limited to 128-chars PolicyDocument: policy_document, } } } definition end |
#policy_logical_id ⇒ Object
8 9 10 |
# File 'lib/jets/cfn/resource/iam/policy.rb', line 8 def policy_logical_id role_logical_id.sub(/Role$/, "Policy") end |