lib/jets/rule/dsl.rb in jets-4.0.12 vs lib/jets/rule/dsl.rb in jets-5.0.0.beta1
- old
+ new
@@ -25,17 +25,17 @@
# Array: scope ["AWS::EC2::SecurityGroup"]
# Hash: scope {"ComplianceResourceTypes" => ["AWS::EC2::SecurityGroup"]}
def scope(value)
scope = case value
when String
- {compliance_resource_types: [value]}
+ {ComplianceResourceTypes: [value]}
when Array
- {compliance_resource_types: value}
+ {ComplianceResourceTypes: value}
else # default to hash
value
end
- associated_properties(scope: scope)
+ associated_properties(Scope: scope)
end
# Convenience method that set properties. List based on https://amzn.to/2oSph1P
# Not all properties are included because some properties are not meant to be set
# directly. For example, function_name is a calculated setting by Jets.
@@ -51,17 +51,17 @@
def default_associated_resource_definition(meth)
config_rule_definition(meth)
end
def config_rule_definition(meth)
- resource = Jets::Resource::Config::ConfigRule.new(self, meth, associated_properties)
+ resource = Jets::Cfn::Resource::Config::ConfigRule.new(self, meth, associated_properties)
resource.definition # returns a definition to be added by associated_resources
end
def managed_rule(name)
name = name.to_s
- managed_rule = Jets::Resource::Config::ManagedRule.new(self, name, associated_properties)
+ managed_rule = Jets::Cfn::Resource::Config::ManagedRule.new(self, name, associated_properties)
resource(managed_rule.definition) # Sets @associated_resources
# The key to not register the task to all_tasks to avoid creating a Lambda function.
# Instead we store it in all_managed_rules.
register_managed_rule(name, managed_rule.definition)
@@ -73,11 +73,11 @@
# Mimic task to grab base_replacements, namely namespace.
# Do not actually use the task to create a Lambda function for managed rules.
# Only using the task for base_replacements.
resources = [definition]
meth = name
- task = Jets::Lambda::Task.new(self.name, meth,
+ task = Jets::Lambda::Definition.new(self.name, meth,
resources: resources,
replacements: replacements(meth))
all_managed_rules[name] = { definition: definition, replacements: task.replacements }
clear_properties
end
@@ -100,10 +100,10 @@
all_managed_rules.values
end
# Override Lambda::Dsl.build? to account for possible managed_rules
def build?
- !tasks.empty? || !managed_rules.empty?
+ !definitions.empty? || !managed_rules.empty?
end
end
end
end