module Formatron::S3::CloudFormationTemplate

manage the CloudFormation template stored on S3

Constants

FILE_NAME

Public Class Methods

deploy( aws:, kms_key:, bucket:, name:, target:, cloud_formation_template: ) click to toggle source

rubocop:disable Metrics/ParameterLists rubocop:disable Metrics/MethodLength

# File lib/formatron/s3/cloud_formation_template.rb, line 12
def self.deploy(
  aws:, kms_key:, bucket:, name:, target:, cloud_formation_template:
)
  key = Path.key(
    name: name,
    target: target,
    sub_key: FILE_NAME
  )
  Formatron::LOG.info do
    "Upload CloudFormation template to #{bucket}/#{key}"
  end
  aws.upload_file(
    kms_key: kms_key,
    bucket: bucket,
    key: key,
    content: cloud_formation_template
  )
end
destroy(aws:, bucket:, name:, target:) click to toggle source

rubocop:disable Metrics/MethodLength

# File lib/formatron/s3/cloud_formation_template.rb, line 46
def self.destroy(aws:, bucket:, name:, target:)
  key = Path.key(
    name: name,
    target: target,
    sub_key: FILE_NAME
  )
  Formatron::LOG.info do
    "Delete CloudFormation template from #{bucket}/#{key}"
  end
  aws.delete_file(
    bucket: bucket,
    key: key
  )
end
exists?(aws:, bucket:, name:, target:) click to toggle source

rubocop:enable Metrics/MethodLength rubocop:enable Metrics/ParameterLists

# File lib/formatron/s3/cloud_formation_template.rb, line 33
def self.exists?(aws:, bucket:, name:, target:)
  key = Path.key(
    name: name,
    target: target,
    sub_key: FILE_NAME
  )
  aws.file_exists?(
    bucket: bucket,
    key: key
  )
end
url(region:, bucket:, name:, target:) click to toggle source

rubocop:enable Metrics/MethodLength

# File lib/formatron/s3/cloud_formation_template.rb, line 62
def self.url(region:, bucket:, name:, target:)
  Path.url(
    region: region,
    bucket: bucket,
    name: name,
    target: target,
    sub_key: FILE_NAME
  )
end