Class: Ros::Sdk::Credential
- Inherits:
-
Object
- Object
- Ros::Sdk::Credential
- Defined in:
- lib/ros_sdk/sdk.rb
Class Attribute Summary collapse
-
.access_key_id ⇒ Object
Returns the value of attribute access_key_id.
-
.authorization ⇒ Object
Returns the value of attribute authorization.
-
.partition ⇒ Object
Returns the value of attribute partition.
-
.profile ⇒ Object
Returns the value of attribute profile.
-
.region ⇒ Object
Returns the value of attribute region.
-
.secret_access_key ⇒ Object
Returns the value of attribute secret_access_key.
Class Method Summary collapse
Class Attribute Details
.access_key_id ⇒ Object
Returns the value of attribute access_key_id.
29 30 31 |
# File 'lib/ros_sdk/sdk.rb', line 29 def access_key_id @access_key_id end |
.authorization ⇒ Object
Returns the value of attribute authorization.
29 30 31 |
# File 'lib/ros_sdk/sdk.rb', line 29 def @authorization end |
.partition ⇒ Object
Returns the value of attribute partition.
29 30 31 |
# File 'lib/ros_sdk/sdk.rb', line 29 def partition @partition end |
.profile ⇒ Object
Returns the value of attribute profile.
29 30 31 |
# File 'lib/ros_sdk/sdk.rb', line 29 def profile @profile end |
.region ⇒ Object
Returns the value of attribute region.
29 30 31 |
# File 'lib/ros_sdk/sdk.rb', line 29 def region @region end |
.secret_access_key ⇒ Object
Returns the value of attribute secret_access_key.
29 30 31 |
# File 'lib/ros_sdk/sdk.rb', line 29 def secret_access_key @secret_access_key end |
Class Method Details
.configure(profile: (ENV["#{partition.upcase}_PROFILE"] || 'default'), access_key_id: , secret_access_key: ) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ros_sdk/sdk.rb', line 31 def configure(profile: (ENV["#{partition.upcase}_PROFILE"] || 'default'), access_key_id: ENV["#{partition.upcase}_ACCESS_KEY_ID"], secret_access_key: ENV["#{partition.upcase}_SECRET_ACCESS_KEY"]) return if self.access_key_id = access_key_id and self.secret_access_key = secret_access_key credentials_file = "#{Dir.home}/.#{partition}/credentials" return unless File.exists?(credentials_file) if credentials = IniFile.load(credentials_file)[profile] self.profile = profile self.access_key_id = credentials["#{partition}_access_key_id"] self.secret_access_key = credentials["#{partition}_secret_access_key"] end end |