Module: Awscli::Errors

Defined in:
lib/awscli/errors.rb

Defined Under Namespace

Classes: Error, LoadError, NotImplemented

Class Method Summary collapse

Class Method Details

.invalid_credentialsObject



60
61
62
63
# File 'lib/awscli/errors.rb', line 60

def self.invalid_credentials
  message = 'Invalid Credentials, Please check your AWS access and secret key id.'
  raise(Awscli::Errors::LoadError.new(message))
end

.invalid_regionObject



65
66
67
68
# File 'lib/awscli/errors.rb', line 65

def self.invalid_region
  message = "Invalid region found in config file (or) passed as an option , Available Regions are #{Awscli::Instances::REGIONS}"
  raise(Awscli::Errors::LoadError.new(message))
end

.missing_config_fileObject



35
36
37
38
39
40
# File 'lib/awscli/errors.rb', line 35

def self.missing_config_file
  message = <<-ERRMSG2.gsub(/^ {8}/, '')
    File Load Error, check if file exists
  ERRMSG2
  raise(Awscli::Errors::LoadError.new(message))
end

.missing_credentialsObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/awscli/errors.rb', line 42

def self.missing_credentials
  message = <<-ERRMSG3.gsub(/^ {8}/, '')
    MISSING CREDENTIALS
    Add the following to your resource config file:
    #############################
    #Aws Credentials
    #Key value pairs should look like this
    #aws_access_key_id: 022QF06E7MXBSAMPLE
    aws_access_key_id:
    aws_secret_access_key:
    region:
    #
    #End of Aws Credentials
    ############################
  ERRMSG3
  raise(Awscli::Errors::LoadError.new(message))
end

.missing_environment_variableObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/awscli/errors.rb', line 20

def self.missing_environment_variable
  message = <<-ERRMSG1.gsub(/^ {8}/, '')
    Missing AWSCLI_CONFIG_FILE environment variable
    Please export the variable 'export AWSCLI_CONFIG_FILE="~/awscli_config.yml"'
    Contents of the file should be:
    #########################################
    #Aws Credentials
    aws_access_key_id: YOUR_ACCESS_KEY
    aws_secret_access_key: YOUR_SECRET_ACCESS_KEY
    #End of Aws Credentials
    ############################
  ERRMSG1
  raise(Awscli::Errors::LoadError.new(message))
end