module OpenStax::Aws

Constants

VERSION

Public Class Methods

configuration() click to toggle source
# File lib/openstax_aws.rb, line 38
def self.configuration
  @configuration ||= Configuration.new
end
configure() { |configuration| ... } click to toggle source
# File lib/openstax_aws.rb, line 34
def self.configure
  yield configuration
end
logger() click to toggle source
# File lib/openstax_aws.rb, line 42
def self.logger
  configuration.logger
end
verify_secrets_populated!() click to toggle source
# File lib/openstax_aws.rb, line 18
def self.verify_secrets_populated!
  if ENV['AWS_ACCESS_KEY_ID'].nil? || ENV['AWS_SECRET_ACCESS_KEY'].nil?
    raise "AWS key and secret are not both set!"
  end
end
verify_template_bucket_access!() click to toggle source
# File lib/openstax_aws.rb, line 24
def self.verify_template_bucket_access!
  begin
    ::Aws::S3::Client.new(region: configuration.cfn_template_bucket_region)
                   .head_bucket(bucket: configuration.cfn_template_bucket_name)
  rescue ::Aws::S3::Errors::Forbidden => ee
    raise "The provided AWS credentials cannot access the template bucket. Please " \
          "verify that you are using the correct credentials for the targeted AWS account."
  end
end