Class: LogStash::Util::CloudSettingAuth
- Inherits:
-
Object
- Object
- LogStash::Util::CloudSettingAuth
- Defined in:
- lib/logstash/util/cloud_setting_auth.rb
Instance Attribute Summary collapse
-
#original ⇒ Object
readonly
Returns the value of attribute original.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(value) ⇒ CloudSettingAuth
constructor
A new instance of CloudSettingAuth.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(value) ⇒ CloudSettingAuth
Returns a new instance of CloudSettingAuth.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/logstash/util/cloud_setting_auth.rb', line 7 def initialize(value) return if value.nil? unless value.is_a?(String) raise ArgumentError.new("Cloud Auth must be String. Received: #{value.class}") end @original = value @username, sep, password = @original.partition(":") if @username.empty? || sep.empty? || password.empty? raise ArgumentError.new("Cloud Auth username and password format should be \"<username>:<password>\".") end @password = LogStash::Util::Password.new(password) end |
Instance Attribute Details
#original ⇒ Object (readonly)
Returns the value of attribute original.
5 6 7 |
# File 'lib/logstash/util/cloud_setting_auth.rb', line 5 def original @original end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
5 6 7 |
# File 'lib/logstash/util/cloud_setting_auth.rb', line 5 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
5 6 7 |
# File 'lib/logstash/util/cloud_setting_auth.rb', line 5 def username @username end |
Instance Method Details
#inspect ⇒ Object
25 26 27 |
# File 'lib/logstash/util/cloud_setting_auth.rb', line 25 def inspect to_s end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/logstash/util/cloud_setting_auth.rb', line 21 def to_s "#{@username}:#{@password}" end |