Class: CferExt::AWS::IAM::PolicyGenerator

Inherits:
Cfer::Block
  • Object
show all
Defined in:
lib/cferext/aws/iam/policy_generator.rb

Instance Method Summary collapse

Methods inherited from Cfer::Block

#build_from_block, #build_from_file, #build_from_string, #include_file, #post_block, #pre_block

Constructor Details

#initializePolicyGenerator

Returns a new instance of PolicyGenerator.



7
8
9
10
# File 'lib/cferext/aws/iam/policy_generator.rb', line 7

def initialize
  self[:Version] = '2012-10-17'
  self[:Statement] = []
end

Instance Method Details

#allow(&block) ⇒ Object



19
20
21
# File 'lib/cferext/aws/iam/policy_generator.rb', line 19

def allow(&block)
  statement Effect: :Allow, &block
end

#deny(&block) ⇒ Object



23
24
25
# File 'lib/cferext/aws/iam/policy_generator.rb', line 23

def deny(&block)
  statement Effect: :Deny, &block
end

#statement(**options, &block) ⇒ Object



12
13
14
15
16
17
# File 'lib/cferext/aws/iam/policy_generator.rb', line 12

def statement(**options, &block)
  statement = ::Cfer::BlockHash.new(&block)
  statement.merge! options
  statement.build_from_block(&block)
  self[:Statement].unshift statement
end