lib/jets/lambda/dsl.rb in jets-0.5.8 vs lib/jets/lambda/dsl.rb in jets-0.6.0
- old
+ new
@@ -74,10 +74,28 @@
@properties ||= {}
@properties.deep_merge!(options)
end
alias_method :props, :properties
+ # definitions: one more many definitions
+ def class_iam_policy(*definitions)
+ if definitions.empty?
+ @class_iam_policy
+ else
+ @class_iam_policy = definitions.flatten
+ end
+ end
+
+ # definitions: one more many definitions
+ def iam_policy(*definitions)
+ if definitions.empty?
+ @iam_policy
+ else
+ @iam_policy = definitions.flatten
+ end
+ end
+
# meth is a Symbol
def method_added(meth)
return if %w[initialize method_missing].include?(meth.to_s)
return unless public_method_defined?(meth)
@@ -87,11 +105,11 @@
def register_task(meth, lang=:ruby)
# Note: for anonymous classes like for app/functions self.name is ""
# We adjust the class name when we build the functions later in
# FunctionContstructor#adjust_tasks.
all_tasks[meth] = Jets::Lambda::Task.new(self.name, meth,
- properties: @properties, lang: lang)
+ properties: @properties, iam_policy: @iam_policy, lang: lang)
# Done storing options, clear out for the next added method.
clear_properties
# Important to clear @properties at the end of registering outside of
# register_task because register_task is overridden in Jets::Job::Dsl
@@ -104,9 +122,10 @@
true
end
def clear_properties
@properties = nil
+ @iam_policy = nil
end
# Returns the all tasks for this class with their method names as keys.
#
# ==== Returns