bao

package
v0.0.0-...-56270e8 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TLS_CERTS_NAME = "fullchain.pem"
	TLS_KEY_NAME   = "leaf-key.pem"
)
View Source
const (
	SERVICE_LOG_NAME = "service.log"
	EXEC_JSON_NAME   = "exec.json"
)
View Source
const (
	NodeJsonName       = "node.json"
	InstanceConfigName = "config.hcl"
)
View Source
const (
	PKIProfile      string = "pki"
	TransitProfile  string = "transit"
	UserpassProfile string = "userpass"
)
View Source
const (
	ClusterJsonName = "cluster.json"
)
View Source
const (
	HAClusterType string = "HA"
)

Variables

This section is empty.

Functions

func ClusterBaseDirectory

func ClusterBaseDirectory() string

func ClusterExists

func ClusterExists(name string) (bool, error)

func Exec

func Exec(env *ExecEnvironment) error

func ExecBao

func ExecBao(env *ExecEnvironment) error

func ExecVault

func ExecVault(env *ExecEnvironment) error

func ListClusters

func ListClusters() ([]string, error)

func ListNodes

func ListNodes() ([]string, error)

func ListProfiles

func ListProfiles() []string

func NodeBaseDirectory

func NodeBaseDirectory() string

func NodeExists

func NodeExists(name string) (bool, error)

func PrefixedAppend

func PrefixedAppend(slice []string, prefix string, values ...string) []string

func ProfileDescription

func ProfileDescription(name string) string

func ProfilePKIMountRemove

func ProfilePKIMountRemove(client *api.Client) ([]string, error)

func ProfilePKIMountSetup

func ProfilePKIMountSetup(client *api.Client) ([]string, error)

func ProfileRemove

func ProfileRemove(client *api.Client, profile string) ([]string, error)

func ProfileSetup

func ProfileSetup(client *api.Client, profile string) ([]string, error)

func ProfileTransitSealMountRemove

func ProfileTransitSealMountRemove(client *api.Client) ([]string, error)

func ProfileTransitSealMountSetup

func ProfileTransitSealMountSetup(client *api.Client) ([]string, error)

func ProfileUserpassMountRemove

func ProfileUserpassMountRemove(client *api.Client) ([]string, error)

func ProfileUserpassMountSetup

func ProfileUserpassMountSetup(client *api.Client) ([]string, error)

Types

type ArgBuilder

type ArgBuilder interface {
	AddArgs(directory string) ([]string, error)
}

type Cluster

type Cluster struct {
	Name string `json:"name"`
	Type string `json:"type"`

	Nodes []string `json:"nodes"`
}

func BuildHACluster

func BuildHACluster(clusterName string, nodeName string) (*Cluster, error)

func LoadCluster

func LoadCluster(name string) (*Cluster, error)

func LoadClusterUnvalidated

func LoadClusterUnvalidated(name string) (*Cluster, error)

func (*Cluster) Clean

func (c *Cluster) Clean(force bool) error

func (*Cluster) FromInterface

func (c *Cluster) FromInterface(iface map[string]interface{}) error

func (*Cluster) GetDirectory

func (c *Cluster) GetDirectory() string

func (*Cluster) GetLeader

func (c *Cluster) GetLeader() (*Node, *api.Client, error)

func (*Cluster) JoinNodeHACluster

func (c *Cluster) JoinNodeHACluster(node *Node) error

func (*Cluster) LoadConfig

func (c *Cluster) LoadConfig() error

func (*Cluster) RemoveNodeHACluster

func (c *Cluster) RemoveNodeHACluster(node *Node) error

func (*Cluster) SaveConfig

func (c *Cluster) SaveConfig() error

func (*Cluster) Validate

func (c *Cluster) Validate() error

type ConfigBuilder

type ConfigBuilder interface {
	Unmarshable
	ToConfig(directory string) (string, error)
}

type DevConfig

type DevConfig struct {
	Token   string `json:"token,omitempty"`
	Address string `json:"address,omitempty"`
}

func (*DevConfig) AddArgs

func (d *DevConfig) AddArgs(_ string) ([]string, error)

func (*DevConfig) FromInterface

func (d *DevConfig) FromInterface(iface map[string]interface{}) error

type ExecEnvironment

type ExecEnvironment struct {
	Binary    string   `json:"binary"`
	Args      []string `json:"args"`
	Directory string   `json:"directory"`

	ConnectAddress string `json:"connection_address"`

	Pid int `json:"pid"`
}

func (*ExecEnvironment) Kill

func (e *ExecEnvironment) Kill() error

func (*ExecEnvironment) ReadLogs

func (e *ExecEnvironment) ReadLogs() (string, error)

func (*ExecEnvironment) SaveConfig

func (e *ExecEnvironment) SaveConfig(pid int) error

func (*ExecEnvironment) ValidateRunning

func (e *ExecEnvironment) ValidateRunning() error

func (*ExecEnvironment) WaitAlive

func (e *ExecEnvironment) WaitAlive(logPath string) error

type FileStorage

type FileStorage struct{}

func (*FileStorage) FromInterface

func (f *FileStorage) FromInterface(iface map[string]interface{}) error

func (*FileStorage) ToConfig

func (f *FileStorage) ToConfig(directory string) (string, error)

type InmemStorage

type InmemStorage struct{}

func (*InmemStorage) FromInterface

func (i *InmemStorage) FromInterface(iface map[string]interface{}) error

func (*InmemStorage) ToConfig

func (i *InmemStorage) ToConfig(_ string) (string, error)

type Listener

type Listener interface {
	ConfigBuilder
	GetConnectAddr() (string, error)
}

type Node

type Node struct {
	Name string `json:"name"`
	Type string `json:"type"`

	Exec   *ExecEnvironment `json:"exec"`
	Config NodeConfig       `json:"config"`

	Addr       string   `json:"addr"`
	Token      string   `json:"token"`
	UnsealKeys []string `json:"unseal_keys,omitempty"`

	Cluster string `json:"cluster,omitempty"`
}

func BuildNode

func BuildNode(name string, product string, opts ...NodeConfigOpt) (*Node, error)

func LoadNode

func LoadNode(name string) (*Node, error)

func LoadNodeUnvalidated

func LoadNodeUnvalidated(name string) (*Node, error)

func (*Node) Clean

func (n *Node) Clean(force bool) error

func (*Node) FromInterface

func (n *Node) FromInterface(iface map[string]interface{}) error

func (*Node) GetClient

func (n *Node) GetClient() (*api.Client, error)

func (*Node) GetConnectAddr

func (n *Node) GetConnectAddr() (string, error)

func (*Node) GetDirectory

func (n *Node) GetDirectory() string

func (*Node) GetEnv

func (n *Node) GetEnv() (map[string]string, error)

func (*Node) Initialize

func (n *Node) Initialize() error

func (*Node) Kill

func (n *Node) Kill() error

func (*Node) LoadConfig

func (n *Node) LoadConfig() error

func (*Node) Resume

func (n *Node) Resume() error

func (*Node) SaveConfig

func (n *Node) SaveConfig() error

func (*Node) SaveInstanceConfig

func (n *Node) SaveInstanceConfig(config string) (string, error)

func (*Node) SetAddress

func (n *Node) SetAddress(addr string) (bool, error)

func (*Node) SetToken

func (n *Node) SetToken(token string) (bool, error)

func (*Node) Start

func (n *Node) Start() error

func (*Node) Unseal

func (n *Node) Unseal() (bool, error)

func (*Node) Validate

func (n *Node) Validate() error

func (*Node) ValidateAddress

func (n *Node) ValidateAddress() error

func (*Node) ValidateToken

func (n *Node) ValidateToken(token string) error

type NodeConfig

type NodeConfig struct {
	Dev           *DevConfig `json:"dev,omitempty"`
	ListenerTypes []string   `json:"listener_types,omitempty"`
	Listeners     []Listener `json:"listeners,omitempty"`
	StorageType   string     `json:"storage_type,omitempty"`
	Storage       Storage    `json:"storage,omitempty"`
	SealTypes     []string   `json:"seal_types,omitempty"`
	Seals         []Seal     `json:"seals,omitempty"`
}

func (*NodeConfig) AddArgs

func (n *NodeConfig) AddArgs(directory string) ([]string, error)

func (*NodeConfig) FromInterface

func (n *NodeConfig) FromInterface(iface map[string]interface{}) error

func (*NodeConfig) GetConnectAddr

func (n *NodeConfig) GetConnectAddr() (string, bool, error)

func (*NodeConfig) ToConfig

func (n *NodeConfig) ToConfig(directory string) (string, error)

func (*NodeConfig) Validate

func (n *NodeConfig) Validate() error

type NodeConfigOpt

type NodeConfigOpt interface{}

type RaftStorage

type RaftStorage struct{}

func (*RaftStorage) FromInterface

func (r *RaftStorage) FromInterface(iface map[string]interface{}) error

func (*RaftStorage) ToConfig

func (r *RaftStorage) ToConfig(directory string) (string, error)

type Seal

type Seal interface {
	ConfigBuilder

	UnsealHelper(client *api.Client) error
}

type Storage

type Storage interface {
	ConfigBuilder
}

type TCPListener

type TCPListener struct {
	Address string     `json:"address"`
	TLS     *TLSConfig `json:"tls,omitempty"`
}

func (*TCPListener) FromInterface

func (t *TCPListener) FromInterface(iface map[string]interface{}) error

func (*TCPListener) GetConnectAddr

func (t *TCPListener) GetConnectAddr() (string, error)

func (*TCPListener) ToConfig

func (t *TCPListener) ToConfig(directory string) (string, error)

type TLSConfig

type TLSConfig struct {
	Certificates []string `json:"certs"`
	Key          string   `json:"key"`
}

func (*TLSConfig) GetCA

func (t *TLSConfig) GetCA() (*x509.Certificate, string, error)

func (*TLSConfig) Write

func (t *TLSConfig) Write(certPath string, keyPath string) error

type TransitSeal

type TransitSeal struct {
	Address   string `json:"address"`
	Token     string `json:"token"`
	MountPath string `json:"mount_path"`
	KeyName   string `json:"key_name"`
	Disabled  bool   `json:"disabled"`
}

func (*TransitSeal) FromInterface

func (t *TransitSeal) FromInterface(iface map[string]interface{}) error

func (*TransitSeal) ToConfig

func (t *TransitSeal) ToConfig(directory string) (string, error)

func (*TransitSeal) UnsealHelper

func (t *TransitSeal) UnsealHelper(client *api.Client) error

type UnixListener

type UnixListener struct {
	Path string `json:"path"`
}

func (*UnixListener) FromInterface

func (u *UnixListener) FromInterface(iface map[string]interface{}) error

func (*UnixListener) GetConnectAddr

func (u *UnixListener) GetConnectAddr() (string, error)

func (*UnixListener) ToConfig

func (u *UnixListener) ToConfig(directory string) (string, error)

type Unmarshable

type Unmarshable interface {
	FromInterface(iface map[string]interface{}) error
}

Jump to

Keyboard shortcuts

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