Class: VaultPlugin::API::Backend::Client

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/smart_proxy_vault/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#add_token_metadata?, #settings_ttl, #to_seconds, #token_options, #valid_ttl?, #vault_settings

Constructor Details

#initializeClient

Returns a new instance of Client.



20
21
22
# File 'lib/smart_proxy_vault/api.rb', line 20

def initialize
  @connection = ::Vault::Client.new(vault_settings)
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



16
17
18
# File 'lib/smart_proxy_vault/api.rb', line 16

def connection
  @connection
end

Instance Method Details

#issue_role_token(role, options) ⇒ Object



28
29
30
# File 'lib/smart_proxy_vault/api.rb', line 28

def issue_role_token(role, options)
  @connection.auth_token.create_with_role(role, options).auth.client_token
end

#issue_token(options) ⇒ Object



24
25
26
# File 'lib/smart_proxy_vault/api.rb', line 24

def issue_token(options)
  @connection.auth_token.create(options).auth.client_token
end

#lookup_selfObject



32
33
34
# File 'lib/smart_proxy_vault/api.rb', line 32

def lookup_self
  @connection.auth_token.lookup_self
end

#renew_selfObject



36
37
38
# File 'lib/smart_proxy_vault/api.rb', line 36

def renew_self
  @connection.auth_token.renew_self(lookup_self.data[:creation_ttl])
end