module Formatron::S3::Configuration
manage the configuration stored on S3
Constants
- FILE_NAME
Public Class Methods
deploy(aws:, kms_key:, bucket:, name:, target:, configuration:)
click to toggle source
rubocop:disable Metrics/ParameterLists
# File lib/formatron/s3/configuration.rb, line 11 def self.deploy(aws:, kms_key:, bucket:, name:, target:, configuration:) key = self.key name: name, target: target Formatron::LOG.info do "Upload configuration to #{bucket}/#{key}" end aws.upload_file( kms_key: kms_key, bucket: bucket, key: key, content: "#{JSON.pretty_generate(configuration)}\n" ) end
destroy(aws:, bucket:, name:, target:)
click to toggle source
# File lib/formatron/s3/configuration.rb, line 38 def self.destroy(aws:, bucket:, name:, target:) key = self.key name: name, target: target Formatron::LOG.info do "Delete configuration from #{bucket}/#{key}" end aws.delete_file( bucket: bucket, key: key ) end
get(aws:, bucket:, name:, target:)
click to toggle source
rubocop:enable Metrics/ParameterLists
# File lib/formatron/s3/configuration.rb, line 25 def self.get(aws:, bucket:, name:, target:) key = self.key name: name, target: target Formatron::LOG.info do "Get configuration from #{bucket}/#{key}" end JSON.parse( aws.get_file( bucket: bucket, key: key ) ) end
key(name:, target:)
click to toggle source
# File lib/formatron/s3/configuration.rb, line 49 def self.key(name:, target:) Path.key( name: name, target: target, sub_key: FILE_NAME ) end