Class: RenderCFN::Role
Instance Method Summary collapse
- #addPolicy(name, action = Array.new, resource = Array.new) ⇒ Object
-
#initialize(name) ⇒ Role
constructor
A new instance of Role.
Methods inherited from AwsObject
Constructor Details
#initialize(name) ⇒ Role
Returns a new instance of Role.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/renderCFN/role.rb', line 5 def initialize( name) @name = "#{name}Role" @awsObject = { @name => { 'Type' => 'AWS::IAM::Role', 'Properties' => { 'AssumeRolePolicyDocument' => { 'Statement' => [ 'Effect' => 'Allow', 'Principal' => { 'Service' => [ 'ec2.amazonaws.com' ] }, 'Action' => [ 'sts:AssumeRole' ] ] }, 'Path' => '/', 'Policies' => [] } } } end |
Instance Method Details
#addPolicy(name, action = Array.new, resource = Array.new) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/renderCFN/role.rb', line 31 def addPolicy( name, action = Array.new, resource = Array.new) @awsObject[@name]['Properties']['Policies'].push( 'PolicyName' => name, 'PolicyDocument' => { 'Statement' => [ 'Effect' => 'Allow', 'Action' => action, 'Resource' => resource ] } ) end |