Class: Ufo::Role::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/ufo/role/dsl.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ DSL

Returns a new instance of DSL.



3
4
5
# File 'lib/ufo/role/dsl.rb', line 3

def initialize(path)
  @path = path # IE: .ufo/iam_roles/task_role.rb
end

Instance Method Details

#evaluateObject



7
8
9
# File 'lib/ufo/role/dsl.rb', line 7

def evaluate
  instance_eval(IO.read(@path), @path)
end

#iam_policy(policy_name, statements) ⇒ Object



11
12
13
14
# File 'lib/ufo/role/dsl.rb', line 11

def iam_policy(policy_name, statements)
  role_type = File.basename(@path).sub('.rb','') # task_role or execution_role
  Registry.register_policy(role_type, policy_name, statements)
end

#managed_iam_policy(*policies) ⇒ Object



16
17
18
19
# File 'lib/ufo/role/dsl.rb', line 16

def managed_iam_policy(*policies)
  role_type = File.basename(@path).sub('.rb','') # task_role or execution_role
  Registry.register_managed_policy(role_type, policies)
end