Class: Jets::Resource::Iam::FunctionRole
Instance Attribute Summary
#managed_policy_definitions, #policy_definitions
Instance Method Summary
collapse
#definition
Methods inherited from Base
#resource
Constructor Details
Returns a new instance of FunctionRole.
5
6
7
8
9
|
# File 'lib/jets/resource/iam/function_role.rb', line 5
def initialize(task)
@task = task
@policy_definitions = task.iam_policy || [] @managed_policy_definitions = task.managed_iam_policy || [] end
|
Instance Method Details
#application_role ⇒ Object
#class_role ⇒ Object
44
45
46
|
# File 'lib/jets/resource/iam/function_role.rb', line 44
def class_role
Jets::Resource::Iam::ClassRole.new(@task.class_name.constantize)
end
|
#inherit? ⇒ Boolean
40
41
42
|
# File 'lib/jets/resource/iam/function_role.rb', line 40
def inherit?
!@policy_definitions.empty? || !@managed_policy_definitions.empty?
end
|
#managed_policy_arns ⇒ Object
33
34
35
36
37
38
|
# File 'lib/jets/resource/iam/function_role.rb', line 33
def managed_policy_arns
if inherit?
@managed_policy_definitions += class_role.managed_policy_definitions + application_role.managed_policy_definitions
end
super
end
|
#policy_document ⇒ Object
26
27
28
29
30
31
|
# File 'lib/jets/resource/iam/function_role.rb', line 26
def policy_document
if inherit?
@policy_definitions += class_role.policy_definitions + application_role.policy_definitions
end
super
end
|
#policy_name ⇒ Object
15
16
17
18
|
# File 'lib/jets/resource/iam/function_role.rb', line 15
def policy_name
funcion_namespace = replacements[:namespace].underscore.dasherize
"#{Jets.config.project_namespace}-#{funcion_namespace}-policy" end
|
#replacements ⇒ Object
20
21
22
23
24
|
# File 'lib/jets/resource/iam/function_role.rb', line 20
def replacements
{
namespace: "#{@task.class_name.gsub('::','')}#{@task.meth.to_s.camelize}", }
end
|
#role_logical_id ⇒ Object
11
12
13
|
# File 'lib/jets/resource/iam/function_role.rb', line 11
def role_logical_id
"{namespace}_iam_role".underscore
end
|