Class: ConfigOMat::Secret
- Inherits:
-
ConfigItem
- Object
- ConfigItem
- ConfigOMat::Secret
- Defined in:
- lib/config_o_mat/shared/types.rb
Constant Summary collapse
- VALID_CONTENT_TYPES =
LoadedAppconfigProfile::PARSERS.keys.freeze
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#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.
-
#version_stage ⇒ Object
readonly
Returns the value of attribute version_stage.
Attributes inherited from ConfigItem
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name, opts) ⇒ Secret
constructor
A new instance of Secret.
- #validate ⇒ Object
Methods inherited from ConfigItem
#==, #error, #errors?, #validate!
Constructor Details
#initialize(name, opts) ⇒ Secret
Returns a new instance of Secret.
382 383 384 385 386 387 388 389 390 391 392 393 394 |
# File 'lib/config_o_mat/shared/types.rb', line 382 def initialize(name, opts) @name = name @secret_id = opts[:secret_id] @version_id = opts[:version_id] @version_stage = opts[:version_stage] @content_type = opts[:content_type]&.downcase if (@version_id.nil? || @version_id.empty?) && (@version_stage.nil? || @version_stage.empty?) @version_stage = 'AWSCURRENT' end @content_type ||= 'application/json' end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
380 381 382 |
# File 'lib/config_o_mat/shared/types.rb', line 380 def content_type @content_type end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
380 381 382 |
# File 'lib/config_o_mat/shared/types.rb', line 380 def name @name end |
#secret_id ⇒ Object (readonly)
Returns the value of attribute secret_id.
380 381 382 |
# File 'lib/config_o_mat/shared/types.rb', line 380 def secret_id @secret_id end |
#version_id ⇒ Object (readonly)
Returns the value of attribute version_id.
380 381 382 |
# File 'lib/config_o_mat/shared/types.rb', line 380 def version_id @version_id end |
#version_stage ⇒ Object (readonly)
Returns the value of attribute version_stage.
380 381 382 |
# File 'lib/config_o_mat/shared/types.rb', line 380 def version_stage @version_stage end |
Instance Method Details
#eql?(other) ⇒ Boolean
405 406 407 408 409 410 411 412 413 414 415 |
# File 'lib/config_o_mat/shared/types.rb', line 405 def eql?(other) return false if !super(other) if other.name != name || other.secret_id != secret_id || other.version_id != version_id || other.version_stage != version_stage || other.content_type != content_type return false end true end |
#hash ⇒ Object
401 402 403 |
# File 'lib/config_o_mat/shared/types.rb', line 401 def hash secret_id.hash ^ version_id.hash ^ version_stage.hash & content_type.hash end |
#validate ⇒ Object
396 397 398 399 |
# File 'lib/config_o_mat/shared/types.rb', line 396 def validate error :secret_id, PRESENCE_ERROR_MSG if @secret_id.nil? || @secret_id.empty? error :content_type, "must be one of #{VALID_CONTENT_TYPES}" unless VALID_CONTENT_TYPES.include?(@content_type) end |