Class: Jets::Cfn::Stack::Template
- Inherits:
-
Object
- Object
- Jets::Cfn::Stack::Template
- Extended by:
- Memoist
- Includes:
- AwsServices
- Defined in:
- lib/jets/cfn/stack/template.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#stack_name ⇒ Object
readonly
Returns the value of attribute stack_name.
Instance Method Summary collapse
-
#body ⇒ Object
Only use filesystem on initial bootstrap.
-
#initialize(options = {}) ⇒ Template
constructor
A new instance of Template.
- #template_option ⇒ Object
-
#url ⇒ Object
uploads to s3 lazily on first call.
Methods included from AwsServices
#apigateway, #aws_options, #cfn, #codebuild, #dynamodb, #lambda_client, #logs, #s3, #s3_resource, #sns, #sqs, #ssm, #sts, #wafv2
Methods included from AwsServices::StackStatus
Methods included from AwsServices::GlobalMemoist
Constructor Details
#initialize(options = {}) ⇒ Template
Returns a new instance of Template.
9 10 11 12 13 |
# File 'lib/jets/cfn/stack/template.rb', line 9 def initialize( = {}) @options = @path = Jets::Names.parent_template_path @stack_name = Jets::Names.parent_stack_name end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/jets/cfn/stack/template.rb', line 8 def path @path end |
#stack_name ⇒ Object (readonly)
Returns the value of attribute stack_name.
8 9 10 |
# File 'lib/jets/cfn/stack/template.rb', line 8 def stack_name @stack_name end |
Instance Method Details
#body ⇒ Object
Only use filesystem on initial bootstrap
33 34 35 |
# File 'lib/jets/cfn/stack/template.rb', line 33 def body IO.read(path) end |
#template_option ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/jets/cfn/stack/template.rb', line 15 def template_option if upload_to_s3? {template_url: url} else {template_body: body} end end |
#url ⇒ Object
uploads to s3 lazily on first call
24 25 26 27 28 29 |
# File 'lib/jets/cfn/stack/template.rb', line 24 def url s3_key = "jets/cfn/#{File.basename(path)}" object = s3_resource.bucket(s3_bucket).object(s3_key) object.upload_file(path) "https://s3.amazonaws.com/#{s3_bucket}/#{s3_key}" end |