Class: ConfigOMat::LoadedSecret
- Inherits:
-
ConfigItem
- Object
- ConfigItem
- ConfigOMat::LoadedSecret
- Defined in:
- lib/config_o_mat/shared/types.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#secret_id ⇒ Object
readonly
Returns the value of attribute secret_id.
-
#version_id ⇒ Object
readonly
Returns the value of attribute version_id.
Attributes inherited from ConfigItem
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name, secret_id, version_id, secret_string, content_type) ⇒ LoadedSecret
constructor
A new instance of LoadedSecret.
- #validate ⇒ Object
Methods inherited from ConfigItem
#==, #error, #errors?, #validate!
Constructor Details
#initialize(name, secret_id, version_id, secret_string, content_type) ⇒ LoadedSecret
Returns a new instance of LoadedSecret.
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
# File 'lib/config_o_mat/shared/types.rb', line 421 def initialize(name, secret_id, version_id, secret_string, content_type) @name = name @secret_id = secret_id @version_id = version_id begin @contents = LoadedAppconfigProfile::PARSERS[content_type].call(secret_string) if @contents.kind_of?(Hash) @contents.default_proc = proc do |hash, key| raise KeyError.new("No key #{key.inspect} in secret #{name}", key: key, receiver: hash) end end rescue StandardError => e error :contents, e end end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
419 420 421 |
# File 'lib/config_o_mat/shared/types.rb', line 419 def contents @contents end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
419 420 421 |
# File 'lib/config_o_mat/shared/types.rb', line 419 def name @name end |
#secret_id ⇒ Object (readonly)
Returns the value of attribute secret_id.
419 420 421 |
# File 'lib/config_o_mat/shared/types.rb', line 419 def secret_id @secret_id end |
#version_id ⇒ Object (readonly)
Returns the value of attribute version_id.
419 420 421 |
# File 'lib/config_o_mat/shared/types.rb', line 419 def version_id @version_id end |
Instance Method Details
#eql?(other) ⇒ Boolean
447 448 449 450 451 452 453 454 455 456 |
# File 'lib/config_o_mat/shared/types.rb', line 447 def eql?(other) return false if !super(other) if other.name != name || other.secret_id != secret_id || other.version_id != version_id || other.contents != contents return false end true end |
#hash ⇒ Object
443 444 445 |
# File 'lib/config_o_mat/shared/types.rb', line 443 def hash @name.hash ^ @secret_id.hash ^ @version_id.hash ^ @contents.hash end |
#validate ⇒ Object
438 439 440 441 |
# File 'lib/config_o_mat/shared/types.rb', line 438 def validate # Since name and version_id are coming from AWS and must be present, I'm not going to check # them here. end |