Class: ForemanVault::VaultAuthMethod

Inherits:
Object
  • Object
show all
Defined in:
app/services/foreman_vault/vault_auth_method.rb

Instance Method Summary collapse

Constructor Details

#initialize(host) ⇒ VaultAuthMethod

Returns a new instance of VaultAuthMethod.



5
6
7
# File 'app/services/foreman_vault/vault_auth_method.rb', line 5

def initialize(host)
  @host = host
end

Instance Method Details

#deleteObject



25
26
27
28
29
# File 'app/services/foreman_vault/vault_auth_method.rb', line 25

def delete
  return false unless valid?

  delete_certificate(name)
end

#nameObject



13
14
15
16
17
# File 'app/services/foreman_vault/vault_auth_method.rb', line 13

def name
  return if !host || !vault_policy_name

  [host, vault_policy_name].join('-').parameterize
end

#saveObject



19
20
21
22
23
# File 'app/services/foreman_vault/vault_auth_method.rb', line 19

def save
  return false unless valid?

  set_certificate(name, options)
end

#valid?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'app/services/foreman_vault/vault_auth_method.rb', line 9

def valid?
  name.present? && options[:certificate].present?
end