Class: Cipherpipe::Vault

Inherits:
Object
  • Object
show all
Defined in:
lib/cipherpipe/vault.rb

Defined Under Namespace

Classes: API, Download, EC2Token, Upload

Class Method Summary collapse

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/cipherpipe/vault.rb', line 2

def self.available?
  true
end

.download(external_source) ⇒ Object



6
7
8
9
10
11
# File 'lib/cipherpipe/vault.rb', line 6

def self.download(external_source)
  require_relative "vault/download"

  set_token external_source
  Cipherpipe::Vault::Download.call external_source
end

.set_token(external_source) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/cipherpipe/vault.rb', line 19

def self.set_token(external_source)
  return unless external_source.ec2_role

  require_relative "vault/ec2_token"
  ::Vault.client.token = Cipherpipe::Vault::EC2Token.call external_source
rescue Cipherpipe::Vault::EC2Token::ConnectionError => error
  warn error.message
end

.upload(external_source, settings) ⇒ Object



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

def self.upload(external_source, settings)
  require_relative "vault/upload"

  Cipherpipe::Vault::Upload.call external_source, settings
end