Module: Smash::CloudPowers::Auth
- Extended by:
- Zenv
- Included in:
- Smash::CloudPowers, AwsResources, Delegator, Node
- Defined in:
- lib/cloud_powers/auth.rb
Overview
Provides authentication to cloud resources, e.g. AWS
Class Method Summary collapse
-
.creds ⇒ Object
This method is usable before an object is instantiated in order to provide an Aws::Credentials object that will allow access to all the resources in the account that zfind searches for, using the ACCOUNT_NUMBER key.
-
.region ⇒ Object
This method is able to be called before an object is instantiated in order to provide a region in AWS-landia.
Methods included from Zenv
env_vars, file_tree_search, i_vars, project_root, project_root=, system_vars, zfind
Methods included from Helper
#attr_map!, #available_resources, #called_from, #create_logger, #deep_modify_keys_with, #format_error_message, #log_file, #logger, #modify_keys_with, #smart_retry, #task_path, #task_require_path, #to_camel, #to_hyph, #to_i_var, #to_pascal, #to_ruby_file_name, #to_snake, #update_message_body, #valid_json?, #valid_url?
Class Method Details
.creds ⇒ Object
This method is usable before an object is instantiated in order to provide an Aws::Credentials object that will allow access to all the resources in the account that zfind searches for, using the ACCOUNT_NUMBER key.
Returns Aws::Credentials
Example Auth.creds => Aws::Credentials # can be used to authenticate to AWS
Notes
- This method relies on
#zfind()to locate the key/secret strings - See
Smash::CloudPowers::Zenv#zfind()
26 27 28 29 30 31 |
# File 'lib/cloud_powers/auth.rb', line 26 def self.creds @creds ||= Aws::Credentials.new( zfind(:aws_access_key_id), zfind(:aws_secret_access_key) ) end |
.region ⇒ Object
This method is able to be called before an object is instantiated in order to provide a region in AWS-landia.
Returns The region set in configuration or a 'us-west-2' default String
Example Auth.region => 'us-east-1'
42 43 44 |
# File 'lib/cloud_powers/auth.rb', line 42 def self.region zfind(:aws_region) || 'us-west-2' end |