Class: Bauble::Resources::RubyFunction

Inherits:
Resource
  • Object
show all
Defined in:
lib/bauble/resources/ruby_function.rb

Overview

a ruby lambda function

Instance Attribute Summary collapse

Attributes inherited from Resource

#app

Instance Method Summary collapse

Methods inherited from Resource

#resource_name

Constructor Details

#initialize(app, **kwargs) ⇒ RubyFunction

Returns a new instance of RubyFunction.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bauble/resources/ruby_function.rb', line 13

def initialize(app, **kwargs)
  super(app)
  @name = kwargs[:name]
  @handler = kwargs[:handler]
  @role = kwargs[:role]
  @layers = kwargs.fetch(:layers, [])
  @image_uri = kwargs.fetch(:image_uri, nil)
  @function_url = kwargs.fetch(:function_url, false)
  @env_vars = kwargs.fetch(:env_vars, {})
  @timeout = kwargs.fetch(:timeout, 30) # default to 30 seconds
  @memory_size = kwargs.fetch(:memory_size, 128) # default to 128 MB
  @reserved_concurrent_executions = kwargs.fetch(:reserved_concurrent_executions, nil) # no limit by default
  @vpc_config = kwargs.fetch(:vpc_config, nil) # VPC config is optional
end

Instance Attribute Details

#env_varsObject

Returns the value of attribute env_vars.



10
11
12
# File 'lib/bauble/resources/ruby_function.rb', line 10

def env_vars
  @env_vars
end

#function_urlObject

Returns the value of attribute function_url.



10
11
12
# File 'lib/bauble/resources/ruby_function.rb', line 10

def function_url
  @function_url
end

#handlerObject

Returns the value of attribute handler.



10
11
12
# File 'lib/bauble/resources/ruby_function.rb', line 10

def handler
  @handler
end

#image_uriObject

Returns the value of attribute image_uri.



10
11
12
# File 'lib/bauble/resources/ruby_function.rb', line 10

def image_uri
  @image_uri
end

#layersObject

Returns the value of attribute layers.



10
11
12
# File 'lib/bauble/resources/ruby_function.rb', line 10

def layers
  @layers
end

#memory_sizeObject

Returns the value of attribute memory_size.



10
11
12
# File 'lib/bauble/resources/ruby_function.rb', line 10

def memory_size
  @memory_size
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/bauble/resources/ruby_function.rb', line 10

def name
  @name
end

#reserved_concurrent_executionsObject

Returns the value of attribute reserved_concurrent_executions.



10
11
12
# File 'lib/bauble/resources/ruby_function.rb', line 10

def reserved_concurrent_executions
  @reserved_concurrent_executions
end

#roleObject

Returns the value of attribute role.



10
11
12
# File 'lib/bauble/resources/ruby_function.rb', line 10

def role
  @role
end

#timeoutObject

Returns the value of attribute timeout.



10
11
12
# File 'lib/bauble/resources/ruby_function.rb', line 10

def timeout
  @timeout
end

#vpc_configObject

Returns the value of attribute vpc_config.



10
11
12
# File 'lib/bauble/resources/ruby_function.rb', line 10

def vpc_config
  @vpc_config
end

Instance Method Details

#bundleObject



28
29
30
# File 'lib/bauble/resources/ruby_function.rb', line 28

def bundle
  true
end

#synthesizeObject



32
33
34
35
36
37
# File 'lib/bauble/resources/ruby_function.rb', line 32

def synthesize
  template = function_hash
  template[@name]['properties'].merge!(code_hash)
  template.merge!(function_url_template_addon) if @function_url
  template
end