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.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/logstash/util/cloud_setting_auth.rb', line 8 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.
6 7 8 |
# File 'lib/logstash/util/cloud_setting_auth.rb', line 6 def original @original end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
6 7 8 |
# File 'lib/logstash/util/cloud_setting_auth.rb', line 6 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
6 7 8 |
# File 'lib/logstash/util/cloud_setting_auth.rb', line 6 def username @username end |
Instance Method Details
#inspect ⇒ Object
26 27 28 |
# File 'lib/logstash/util/cloud_setting_auth.rb', line 26 def inspect to_s end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/logstash/util/cloud_setting_auth.rb', line 22 def to_s "#{@username}:#{@password}" end |