Module: Vault

Defined in:
lib/vault/persistent.rb,
lib/vault.rb,
lib/vault/api.rb,
lib/vault/client.rb,
lib/vault/encode.rb,
lib/vault/errors.rb,
lib/vault/api/sys.rb,
lib/vault/request.rb,
lib/vault/version.rb,
lib/vault/api/auth.rb,
lib/vault/api/help.rb,
lib/vault/defaults.rb,
lib/vault/response.rb,
lib/vault/api/secret.rb,
lib/vault/api/approle.rb,
lib/vault/api/logical.rb,
lib/vault/api/auth_tls.rb,
lib/vault/api/sys/auth.rb,
lib/vault/api/sys/init.rb,
lib/vault/api/sys/seal.rb,
lib/vault/configurable.rb,
lib/vault/api/sys/audit.rb,
lib/vault/api/sys/lease.rb,
lib/vault/api/sys/mount.rb,
lib/vault/api/auth_token.rb,
lib/vault/api/sys/health.rb,
lib/vault/api/sys/leader.rb,
lib/vault/api/sys/policy.rb,
lib/vault/persistent/pool.rb,
lib/vault/persistent/connection.rb,
lib/vault/vendor/connection_pool.rb,
lib/vault/persistent/timed_stack_multi.rb,
lib/vault/vendor/connection_pool/version.rb,
lib/vault/vendor/connection_pool/timed_stack.rb,
lib/vault/vendor/connection_pool/timed_stack.rb

Overview

Examples:

ts = TimedStack.new(1) { MyConnection.new }

# fetch a connection
conn = ts.pop

# return a connection
ts.push conn

conn = ts.pop
ts.pop timeout: 5
#=> raises Timeout::Error after 5 seconds

Defined Under Namespace

Modules: API, Configurable, Defaults, EncodePath Classes: AppRole, Audit, Auth, AuthConfig, AuthTLS, AuthToken, Authenticate, Client, ConnectionPool, HTTPClientError, HTTPConnectionError, HTTPError, HTTPServerError, HealthStatus, Help, InitResponse, InitStatus, LeaderStatus, Logical, MissingTokenError, Mount, PersistentHTTP, Policy, Request, Response, SealStatus, Secret, SecretAuth, Sys, VaultError, WrapInfo

Constant Summary collapse

VERSION =
"0.12.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.clientVault::Client (readonly)

API client object based off the configured options in Configurable.

Returns:



15
16
17
# File 'lib/vault.rb', line 15

def client
  @client
end

Class Method Details

.method_missing(m, *args, &block) ⇒ Object

Delegate all methods to the client object, essentially making the module object behave like a Client.



33
34
35
36
37
38
39
# File 'lib/vault.rb', line 33

def method_missing(m, *args, &block)
  if @client.respond_to?(m)
    @client.send(m, *args, &block)
  else
    super
  end
end

.respond_to_missing?(m, include_private = false) ⇒ Boolean

Delegating respond_to to the Client.

Returns:

  • (Boolean)


42
43
44
# File 'lib/vault.rb', line 42

def respond_to_missing?(m, include_private = false)
  @client.respond_to?(m, include_private) || super
end

.setup!Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/vault.rb', line 17

def setup!
  @client = Vault::Client.new

  # Set secure SSL options
  OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options].tap do |opts|
    opts &= ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS if defined?(OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS)
    opts |= OpenSSL::SSL::OP_NO_COMPRESSION if defined?(OpenSSL::SSL::OP_NO_COMPRESSION)
    opts |= OpenSSL::SSL::OP_NO_SSLv2 if defined?(OpenSSL::SSL::OP_NO_SSLv2)
    opts |= OpenSSL::SSL::OP_NO_SSLv3 if defined?(OpenSSL::SSL::OP_NO_SSLv3)
  end

  self
end