Class: Cipherpipe::Vault::API
- Inherits:
-
Vault::Request
- Object
- Vault::Request
- Cipherpipe::Vault::API
- Defined in:
- lib/cipherpipe/vault/api.rb
Instance Method Summary collapse
Instance Method Details
#read(path, options = {}) ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'lib/cipherpipe/vault/api.rb', line 2 def read(path, = {}) headers = extract_headers! json = client.get("/v1/secret/data/#{encode_path(path)}", {}, headers) ::Vault::Secret.decode json[:data] rescue ::Vault::HTTPError => error return nil if error.code == 404 raise error end |
#write(path, data = {}, options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cipherpipe/vault/api.rb', line 12 def write(path, data = {}, = {}) headers = extract_headers! json = Vault.logical.client.post( "/v1/secret/data/#{encode_path path}", JSON.fast_generate(:data => data), headers ) json.nil? ? true : ::Vault::Secret.decode(json) end |