Sha256: 72cd62e0d36a0094b85d2f6aee68533c829a5bf4cdaecb4ff4d01c8b2c1aca45
Contents?: true
Size: 1.68 KB
Versions: 22
Compression:
Stored size: 1.68 KB
Contents
# frozen_string_literal: true # # AWS Configuration # module AwsConfiguration extend ActiveSupport::Concern def self.included(base) base.class_eval do # # Fields # field :aws_region, type: String field :aws_access_key_id, type: String field :aws_secret_access_key, type: String field :aws_auto_scaling_group_name, type: String field :aws_bucket_name, type: String end end # # Make sure the password doesn't get blanked out on an update # def secure_fields super + %i[aws_secret_access_key] end # # Determine if AWS is configured # def aws_configured? [aws_region.present?, aws_access_key_id.present?, aws_secret_access_key.present?].all? end # # Determine if auto scaling group is configured # def aws_auto_scaling_configured? aws_configured? && aws_auto_scaling_group_name.present? end # # AWS client. # def aws_ec2_client return nil unless aws_configured? @aws_ec2_client ||= Aws::EC2::Client.new(region: aws_region, credentials: Aws::Credentials.new(aws_access_key_id, aws_secret_access_key)) end # # S3 Client # def aws_s3_client return nil unless aws_configured? # We want this to remake itself each time because it is possible that the # => user would change the access keys in between actions. Huh? @aws_s3_client ||= Aws::S3::Client.new(region: aws_region, access_key_id: aws_access_key_id, secret_access_key: aws_secret_access_key) end end
Version data entries
22 entries across 22 versions & 1 rubygems