Module: Vault

Defined in:
lib/vault.rb,
lib/vault/api.rb,
lib/vault/api/kv.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/persistent.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/sys/quota.rb,
lib/vault/api/transform.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/api/sys/namespace.rb,
lib/vault/api/transform/role.rb,
lib/vault/persistent/connection.rb,
lib/vault/api/transform/alphabet.rb,
lib/vault/api/transform/template.rb,
lib/vault/vendor/connection_pool.rb,
lib/vault/api/transform/transformation.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, KV, LeaderStatus, LeaseCountQuota, Logical, MissingRequiredStateError, MissingTokenError, Mount, MountTune, Namespace, PersistentHTTP, Policy, Quota, RateLimitQuota, Request, Response, SealStatus, Secret, SecretAuth, Sys, Transform, VaultError, WrapInfo

Constant Summary collapse

VERSION =
"0.18.2"

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:



18
19
20
# File 'lib/vault.rb', line 18

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.



37
38
39
40
41
42
43
# File 'lib/vault.rb', line 37

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)


46
47
48
# File 'lib/vault.rb', line 46

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

.setup!Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/vault.rb', line 20

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

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

  self
end