Sha256: 649205f04b8599e0256592fe5409c019212a40e52d49512967a6a3a2381f74c5
Contents?: true
Size: 1.67 KB
Versions: 5
Compression:
Stored size: 1.67 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 def aws_credentials @aws_credentials ||= Aws::Credentials.new(aws_access_key_id, aws_secret_access_key) 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); 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
5 entries across 5 versions & 1 rubygems