cmd

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(_ *cli.Context) (int, error)

Apply ..

func ExecWrapper

func ExecWrapper(f func(ctx *cli.Context) (int, error)) cli.ActionFunc

ExecWrapper gracefully logs and exits our `run` functions

func Init

func Init(_ *cli.Context) (int, error)

Init ..

func KVGetPath

func KVGetPath(_ *cli.Context) (int, error)

KVGetPath ..

func KVGetVersion

func KVGetVersion(_ *cli.Context) (int, error)

KVGetVersion ..

func KVSetPath

func KVSetPath(ctx *cli.Context) (int, error)

KVSetPath ..

func KVSetVersion

func KVSetVersion(ctx *cli.Context) (int, error)

KVSetVersion ..

func Plan

func Plan(_ *cli.Context) (int, error)

Plan ..

func SecretDelete

func SecretDelete(ctx *cli.Context) (int, error)

SecretDelete ..

func SecretList

func SecretList(ctx *cli.Context) (int, error)

SecretList ..

func SecretRead

func SecretRead(ctx *cli.Context) (int, error)

SecretRead ..

func SecretRotateFrom

func SecretRotateFrom(ctx *cli.Context) (int, error)

SecretRotateFrom ..

func SecretWrite

func SecretWrite(ctx *cli.Context) (int, error)

SecretWrite ..

func Status

func Status(_ *cli.Context) (int, error)

Status ..

func TransitCreate

func TransitCreate(ctx *cli.Context) (int, error)

TransitCreate ..

func TransitDelete

func TransitDelete(ctx *cli.Context) (int, error)

TransitDelete ..

func TransitInfo

func TransitInfo(_ *cli.Context) (int, error)

TransitInfo ..

func TransitList

func TransitList(_ *cli.Context) (int, error)

TransitList ..

func TransitUse

func TransitUse(ctx *cli.Context) (int, error)

TransitUse ..

Types

type State

type State struct {
	Vault struct {
		TransitKey string
		KV         struct {
			Path    string
			Version int
		}
	}
	Secrets map[string]map[string]string
	Config  *StateConfig `yaml:"-"`
}

State : Handles state information

func (*State) DeleteSecret

func (s *State) DeleteSecret(secret string)

DeleteSecret : Delete a secret from the statefile based on its name

func (*State) DeleteSecretKey

func (s *State) DeleteSecretKey(secret, key string)

DeleteSecretKey : Delete a secret:key from the statefile based on the secret and key names

func (*State) Init

func (s *State) Init()

Init : Generates an empty state file at the configured state file location

func (*State) ListSecrets

func (s *State) ListSecrets(secret string)

ListSecrets : List the secrets, safely stored into the statefile

func (*State) Load

func (s *State) Load()

Load : Loads the statefile content in memory

func (*State) ReadSecretKey

func (s *State) ReadSecretKey(secret, key string) string

ReadSecretKey : Read the value of a SecretKey

func (*State) RotateFromOldTransitKey

func (s *State) RotateFromOldTransitKey(key string)

RotateFromOldTransitKey : Replace locally ciphered values with new transit key

func (*State) SetVaultKVPath

func (s *State) SetVaultKVPath(value string)

SetVaultKVPath : Update state file with a Vault/Secret/Path value

func (*State) SetVaultKVVersion

func (s *State) SetVaultKVVersion(version int)

SetVaultKVVersion : Update state file with a Vault/Secret/Version value

func (*State) SetVaultTransitKey

func (s *State) SetVaultTransitKey(value string)

SetVaultTransitKey : Update state file with a Vault/TransitKey value

func (*State) Status

func (s *State) Status()

Status : Returns information about statefile content

func (*State) VaultKVPath

func (s *State) VaultKVPath() string

VaultKVPath : Returns the value of the configured Vault/Secret/Path

func (*State) VaultKVVersion

func (s *State) VaultKVVersion() int

VaultKVVersion : Returns the value of the configured Vault/Secret/Version

func (*State) VaultTransitKey

func (s *State) VaultTransitKey() string

VaultTransitKey : Returns the value of the configured Vault/TransitKey

func (*State) WriteSecretKey

func (s *State) WriteSecretKey(secret, key, value string)

WriteSecretKey : Add or Update a key value within a secret

type StateConfig

type StateConfig struct {
	Path string
}

StateConfig handles state client configuration

type Vault

type Vault struct {
	Client *api.Client
}

Vault : Handles a Vault API Client

func (*Vault) Cipher

func (v *Vault) Cipher(value string) string

Cipher : Cipher a value using the TransitKey

func (*Vault) CreateTransitKey

func (v *Vault) CreateTransitKey(key string)

CreateTransitKey : Create a new transit key in Vault

func (*Vault) Decipher

func (v *Vault) Decipher(value string) string

Decipher : Decipher a value using the TransitKey

func (*Vault) DeleteSecret

func (v *Vault) DeleteSecret(secret string)

DeleteSecret : DeleteSecret a secret from Vault

func (*Vault) DeleteSecretKey

func (v *Vault) DeleteSecretKey(secret, key string)

DeleteSecretKey : Delete a key of a secret from Vault

func (*Vault) DeleteTransitKey

func (v *Vault) DeleteTransitKey(key string)

DeleteTransitKey : Delete a transit key from Vault

func (*Vault) GetTransitInfo

func (v *Vault) GetTransitInfo()

GetTransitInfo : Fetch some information from Vault about the configured TransitKey

func (*Vault) ListSecrets

func (v *Vault) ListSecrets()

ListSecrets : Do what it says

func (*Vault) ListTransitKeys

func (v *Vault) ListTransitKeys()

ListTransitKeys : List available transit keys from Vault

func (*Vault) Status

func (v *Vault) Status()

Status : Return information about Vault API endpoint/cluster

func (*Vault) WriteSecret

func (v *Vault) WriteSecret(secret string, data map[string]interface{})

WriteSecret : Write a secret into Vault

type VaultConfig

type VaultConfig struct {
	Address  string
	Token    string
	RoleID   string
	SecretID string
}

VaultConfig handles Vault configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL