Class: SettingsReader::VaultResolver::Engines::Abstract

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/settings_reader/vault_resolver/engines/abstract.rb

Overview

Abstract interface for Vault Backends

Direct Known Subclasses

Auth, Aws, Database, KV2

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

#debug, #error, #info, #warn

Constructor Details

#initialize(config) ⇒ Abstract

Returns a new instance of Abstract.



10
11
12
# File 'lib/settings_reader/vault_resolver/engines/abstract.rb', line 10

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'lib/settings_reader/vault_resolver/engines/abstract.rb', line 8

def config
  @config
end

Instance Method Details

#get(address) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/settings_reader/vault_resolver/engines/abstract.rb', line 18

def get(address)
  return unless (vault_secret = get_and_retry_auth(address))

  wrap_secret(address, vault_secret)
rescue Vault::VaultError => e
  raise SettingsReader::VaultResolver::Error, e.message
end

#renew(entry) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/settings_reader/vault_resolver/engines/abstract.rb', line 26

def renew(entry)
  return unless entry.renewable?

  new_secret = renew_and_retry_auth(entry)
  entry.update_renewed(new_secret)
  true
end

#retrieves?(_address) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/settings_reader/vault_resolver/engines/abstract.rb', line 14

def retrieves?(_address)
  raise NotImplementedError
end