Sha256: 21768823264a359b22ce794b5d46759476029451e6f3c553fbc886729daa7ef4

Contents?: true

Size: 1.25 KB

Versions: 74

Compression:

Stored size: 1.25 KB

Contents

module Jets::Stack::Main::Dsl
  module Base
    def ref(value)
      "!Ref #{value.to_s.camelize}"
    end

    def getatt(value, attribute=:arn)
      "!GetAtt #{value.to_s.camelize}.#{attribute.to_s.camelize}"
    end

    def logical_id(value)
      value.to_s.camelize
    end

    def depends_on(*stacks)
      if stacks == []
        @depends_on
      else
        @depends_on ||= []
        @depends_on += stacks
      end
    end

    # Due to `if Jets::Stack.has_resources?` check early on in the bootstraping process
    # The code has not been built at that point. So we use a placeholder and will replace
    # the placeholder as part of the cfn template build process after the code has been built
    # and the code_s3_key with md5 is available.
    def code_s3_key
      "code_s3_key_placeholder"
    end

    # resource(:hello,
    #   function_name: "hello",
    #   code: {
    #     s3_bucket: "!Ref S3Bucket",
    #     s3_key: code_s3_key
    #   },
    #   description: "Hello world",
    #   handler: handler_function("hello.lambda_handler"),
    #   memory_size: 128,
    #   role: "!Ref IamRole",
    #   runtime: "python3.6",
    #   timeout: 20,
    # )
    def handler(name)
      "handlers/shared/functions/#{name}" # generated handler
    end
  end
end

Version data entries

74 entries across 74 versions & 2 rubygems

Version Path
jets-2.3.1 lib/jets/stack/main/dsl/base.rb
jets-2.3.0 lib/jets/stack/main/dsl/base.rb
jets-2.2.5 lib/jets/stack/main/dsl/base.rb
jets-2.2.4 lib/jets/stack/main/dsl/base.rb
jets-2.2.3 lib/jets/stack/main/dsl/base.rb
jets-2.2.2 lib/jets/stack/main/dsl/base.rb
jets-2.2.1 lib/jets/stack/main/dsl/base.rb
jets-2.2.0 lib/jets/stack/main/dsl/base.rb
jets-2.1.7 lib/jets/stack/main/dsl/base.rb
jets-2.1.6 lib/jets/stack/main/dsl/base.rb
jets-2.1.5 lib/jets/stack/main/dsl/base.rb
jets-2.1.4 lib/jets/stack/main/dsl/base.rb
jets-2.1.3 lib/jets/stack/main/dsl/base.rb
jets-2.1.2 lib/jets/stack/main/dsl/base.rb
jets_bb_fork-0.0.4 lib/jets/stack/main/dsl/base.rb
jets-2.1.1 lib/jets/stack/main/dsl/base.rb
jets-2.1.0 lib/jets/stack/main/dsl/base.rb
jets-2.0.6 lib/jets/stack/main/dsl/base.rb
jets-2.0.5 lib/jets/stack/main/dsl/base.rb
jets-2.0.4 lib/jets/stack/main/dsl/base.rb