Class: Dsv::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/dsv/client.rb

Constant Summary collapse

CLIENTS_RESOURCE =
"clients".freeze

Class Method Summary collapse

Class Method Details

.create(vault, role_name) ⇒ Object

Create the client for the desired Vault

Parameters:

  • vault (Vault)

    The initialized Vault

  • role_Name (String)

    Name of the role to create



28
29
30
31
32
33
# File 'lib/dsv/client.rb', line 28

def self.create(vault, role_name)
  client_data = {
    role: role_name
  }
  vault.accessResource("POST", CLIENTS_RESOURCE, "/", client_data)
end

.delete(vault, id) ⇒ Object

Mark the client as ready to be removed

Parameters:

  • vault (Vault)

    The initialized Vault

  • id (String)

    The ID of the client



20
21
22
# File 'lib/dsv/client.rb', line 20

def self.delete(vault, id)
  vault.accessResource("DELETE", CLIENTS_RESOURCE, id, nil, nil)
end

.fetch(vault, id) ⇒ Object

Fetch desired client information from the specified Vault

Parameters:

  • vault (Vault)

    The initialized Vault

  • id (String)

    The ID of the client



11
12
13
14
# File 'lib/dsv/client.rb', line 11

def self.fetch(vault, id)
  @vault = vault
  client = @vault.accessResource("GET", CLIENTS_RESOURCE, id, nil)
end