Class: App::AWSProfile

Inherits:
Object
  • Object
show all
Defined in:
lib/core/aws_profile.rb

Constant Summary collapse

@@profile =
nil
@@credentials =
nil

Class Method Summary collapse

Class Method Details

.getObject

Get the AWS profile. Returns either the profile (or nil).

Returns:

  • string



31
32
33
# File 'lib/core/aws_profile.rb', line 31

def self.get
    @@profile
end

.get_profile_nameObject

Convenience method to just get the profile name.

Returns:

  • string



37
38
39
40
# File 'lib/core/aws_profile.rb', line 37

def self.get_profile_name
    return nil if @@credentials.nil?
    @@profile[PROFILE]
end

.init(config_data) ⇒ Object

Reads the config data and attempts to extract the profile.

Returns:

  • void



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/core/aws_profile.rb', line 10

def self.init(config_data)

    errors                     = []

    # Get the profile out of the config YML.
    @@profile                  = config_data['AWS']['Profile'] if config_data.has_key?('AWS')

    # If no profile found, return.
    return if @@profile.nil?

    # Check the credentials exist.
    @@credentials, more_errors = Blufin::AWS::get_aws_credentials(@@profile)
    errors.concat(more_errors)

    # If anything is wrong, output error(s).
    Blufin::Config::invalid_configuration(App::GEM_NAME, errors) if errors.any?

end