Class: Cody::Role
- Defined in:
- lib/cody/role.rb
Constant Summary
Constants included from Dsl::Role
Instance Attribute Summary
Attributes inherited from Dsl::Base
#full_project_name, #options, #project_name, #type
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Role
constructor
A new instance of Role.
- #run ⇒ Object
Methods included from Dsl::Role
#aws, #iam_policy, #managed_iam_policy, #standardize_iam_policy, #standardize_managed_iam_policy
Methods included from Variables
#load_variables, #load_variables_file
Methods included from Evaluate
Methods included from Evaluate::Interface
#full_project_name, #project_name
Methods inherited from Dsl::Base
Constructor Details
#initialize(options = {}) ⇒ Role
Returns a new instance of Role.
9 10 11 12 13 |
# File 'lib/cody/role.rb', line 9 def initialize(={}) super @role_path = [:role_path] || get_role_path @iam_policy = {} end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cody/role.rb', line 15 def run load_variables evaluate_file(@role_path) if File.exist?(@role_path) # registers definitions to registry build # build definitions from registry. can set: @iam_statements and @managed_policy_arns @properties[:Policies] = [{ PolicyName: "CodeBuildAccess", PolicyDocument: { Version: "2012-10-17", Statement: derived_iam_statements } }] @properties[:ManagedPolicyArns] ||= @managed_policy_arns || default_managed_policy_arns resource = { IamRole: { Type: "AWS::IAM::Role", Properties: @properties } } auto_camelize(resource) end |