Module: Vault

Defined in:
lib/vault.rb,
lib/vault/api.rb,
lib/vault/client.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/logical.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/leader.rb,
lib/vault/api/sys/policy.rb

Defined Under Namespace

Modules: API, Configurable, Defaults, Response Classes: Audit, Auth, AuthToken, Authenticate, Client, HTTPConnectionError, HTTPError, Help, InitResponse, InitStatus, LeaderStatus, Logical, MissingTokenError, Mount, Policy, Request, SealStatus, Secret, SecretAuth, Sys, VaultError

Constant Summary collapse

VERSION =
"0.1.4"

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.



31
32
33
34
35
36
37
# File 'lib/vault.rb', line 31

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)


40
41
42
# File 'lib/vault.rb', line 40

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
# File 'lib/vault.rb', line 17

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

  # Set secure SSL options
  OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] &= ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS
  OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_COMPRESSION
  OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_SSLv2
  OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_SSLv3

  self
end