Sha256: dbba5579aa78f88cb55e5e9e1a197a816f43fdc36e9617cc34be18456f1135a4
Contents?: true
Size: 1.77 KB
Versions: 18
Compression:
Stored size: 1.77 KB
Contents
class Jets::Cfn::TemplateBuilders class RuleBuilder < BaseChildBuilder def compose add_common_parameters add_functions add_config_rules end def add_config_rules # @app_klass is PostsController, HardRule, Hello, or HelloFunction, or GameRule @app_klass.tasks.each do |task| map = Jets::Cfn::TemplateMappers::ConfigRuleMapper.new(task) add_config_rule(task, map) add_permission(map) end end def add_config_rule(task, map) # Usually we build the properties with the mappers but in the case for # a config_rule it makes more sense to grab properties from the task # using config_rule_properties add_resource(map.logical_id, "AWS::Config::ConfigRule", Properties: task.config_rule_properties, DependsOn: map.permission_logical_id ) # Example: # add_resource("GameRuleProtectConfigRule", "AWS::Config::ConfigRule", # "ConfigRuleName" : String, # "Description" : String, # "InputParameters" : { ParameterName : Value }, # "MaximumExecutionFrequency" : String, # "Scope" : Scope, # "Source" : Source # ) end def add_permission(map) add_resource(map.permission_logical_id, "AWS::Lambda::Permission", FunctionName: "!GetAtt #{map.lambda_function_logical_id}.Arn", Action: "lambda:InvokeFunction", Principal: "config.amazonaws.com" ) # Example: # add_resource("GameRuleProtectConfigRulePermission", "AWS::Lambda::Permission", # FunctionName: "!GetAtt GameRuleProtectLambdaFunction.Arn", # Action: "lambda:InvokeFunction", # Principal: "config.amazonaws.com", # SourceArn: "!GetAtt ScheduledEventHardRuleDig.Arn" # ) end end end
Version data entries
18 entries across 18 versions & 1 rubygems