Class: Putpaws::Provision::Resources::TaskDefinition::TemplateContext
- Inherits:
-
Object
- Object
- Putpaws::Provision::Resources::TaskDefinition::TemplateContext
- Defined in:
- lib/putpaws/provision/resources/task_definition.rb
Overview
Variables exposed to taskdef ERB templates.
Instance Attribute Summary collapse
-
#account_id ⇒ Object
readonly
Returns the value of attribute account_id.
-
#container_port ⇒ Object
readonly
Returns the value of attribute container_port.
-
#cpu ⇒ Object
readonly
Returns the value of attribute cpu.
-
#env_json ⇒ Object
readonly
Returns the value of attribute env_json.
-
#execution_role_arn ⇒ Object
readonly
Returns the value of attribute execution_role_arn.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#log_group ⇒ Object
readonly
Returns the value of attribute log_group.
-
#memory ⇒ Object
readonly
Returns the value of attribute memory.
-
#nginx_image ⇒ Object
readonly
Returns the value of attribute nginx_image.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#secrets_json ⇒ Object
readonly
Returns the value of attribute secrets_json.
-
#service_name ⇒ Object
readonly
Returns the value of attribute service_name.
-
#task_role_arn ⇒ Object
readonly
Returns the value of attribute task_role_arn.
Instance Method Summary collapse
- #get_binding ⇒ Object
-
#initialize(config) ⇒ TemplateContext
constructor
A new instance of TemplateContext.
Constructor Details
#initialize(config) ⇒ TemplateContext
Returns a new instance of TemplateContext.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 18 def initialize(config) settings = config.settings @service_name = config.service_name @region = config.region @account_id = config.account_id @cpu = settings[:cpu].to_s @memory = settings[:memory].to_s @container_port = (settings[:container_port] || 3000).to_i @image = config.ecr_image_uri @nginx_image = settings[:nginx_image] || 'public.ecr.aws/nginx/nginx:stable' @log_group = config.log_group @execution_role_arn = config.roles[:task_execution_role_arn] @task_role_arn = config.roles[:task_role_arn] @env_json = JSON.generate( (settings[:env] || {}).map{|k, v| {name: k.to_s, value: v.to_s}} ) @secrets_json = JSON.generate( config.resolved_secrets.map{|name, path| {name: name, valueFrom: "arn:aws:ssm:#{config.region}:#{config.account_id}:parameter#{path}"} } ) end |
Instance Attribute Details
#account_id ⇒ Object (readonly)
Returns the value of attribute account_id.
13 14 15 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 13 def account_id @account_id end |
#container_port ⇒ Object (readonly)
Returns the value of attribute container_port.
13 14 15 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 13 def container_port @container_port end |
#cpu ⇒ Object (readonly)
Returns the value of attribute cpu.
13 14 15 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 13 def cpu @cpu end |
#env_json ⇒ Object (readonly)
Returns the value of attribute env_json.
13 14 15 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 13 def env_json @env_json end |
#execution_role_arn ⇒ Object (readonly)
Returns the value of attribute execution_role_arn.
13 14 15 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 13 def execution_role_arn @execution_role_arn end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
13 14 15 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 13 def image @image end |
#log_group ⇒ Object (readonly)
Returns the value of attribute log_group.
13 14 15 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 13 def log_group @log_group end |
#memory ⇒ Object (readonly)
Returns the value of attribute memory.
13 14 15 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 13 def memory @memory end |
#nginx_image ⇒ Object (readonly)
Returns the value of attribute nginx_image.
13 14 15 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 13 def nginx_image @nginx_image end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
13 14 15 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 13 def region @region end |
#secrets_json ⇒ Object (readonly)
Returns the value of attribute secrets_json.
13 14 15 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 13 def secrets_json @secrets_json end |
#service_name ⇒ Object (readonly)
Returns the value of attribute service_name.
13 14 15 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 13 def service_name @service_name end |
#task_role_arn ⇒ Object (readonly)
Returns the value of attribute task_role_arn.
13 14 15 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 13 def task_role_arn @task_role_arn end |
Instance Method Details
#get_binding ⇒ Object
41 42 43 |
# File 'lib/putpaws/provision/resources/task_definition.rb', line 41 def get_binding binding end |