types

package
v0.0.0-...-e864873 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyCommander = key.NewBinding(
		key.WithKeys(":"),
		key.WithHelp(":", "cmds"),
	)
	KeyFilter = key.NewBinding(
		key.WithKeys("/", "ctrl+f"),
		key.WithHelp("/", "filter"),
	)
	KeyUp = key.NewBinding(
		key.WithKeys("up", "k"),
		key.WithHelp("↑/k", "up"),
	)
	KeyDown = key.NewBinding(
		key.WithKeys("down", "j"),
		key.WithHelp("↓/j", "down"),
	)
	KeyLeft = key.NewBinding(
		key.WithKeys("left", "h"),
		key.WithHelp("←/h", "left"),
	)
	KeyRight = key.NewBinding(
		key.WithKeys("right", "l"),
		key.WithHelp("→/l", "right"),
	)
	KeyPageUp = key.NewBinding(
		key.WithKeys("b", "pgup"),
		key.WithHelp("b/pgup", "page up"),
	)
	KeyPageDown = key.NewBinding(
		key.WithKeys("f", "pgdown"),
		key.WithHelp("f/pgdn", "page down"),
	)
	KeyGoToTop = key.NewBinding(
		key.WithKeys("home", "g"),
		key.WithHelp("g/home", "go to start"),
	)
	KeyGoToBottom = key.NewBinding(
		key.WithKeys("end", "G"),
		key.WithHelp("G/end", "go to end"),
	)
	KeySelectItem = key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "select item"),
	)
	KeySelectItemAlt = key.NewBinding(
		key.WithKeys("space"),
		key.WithHelp("space", "select item"),
	)
	KeyCancel = key.NewBinding(
		key.WithKeys("esc"),
		key.WithHelp("esc", "cancel"),
	)
	KeyRefresh = key.NewBinding(
		key.WithKeys("ctrl+r"),
		key.WithHelp("ctrl+r", "refresh"),
	)
	KeyDetails = key.NewBinding(
		key.WithKeys("d"),
		key.WithHelp("d", "view details"),
	)
	KeyCopy = key.NewBinding(
		key.WithKeys("c"),
		key.WithHelp("c", "copy"),
	)
	KeyTabForward = key.NewBinding(
		key.WithKeys("tab"),
		key.WithHelp("tab", "tab forward"),
	)
	KeyTabBackward = key.NewBinding(
		key.WithKeys("shift+tab"),
		key.WithHelp("shift+tab", "tab backward"),
	)
	KeyHelp = key.NewBinding(
		key.WithKeys("?"),
		key.WithHelp("?", "help"),
	)
	KeyQuit = key.NewBinding(
		key.WithKeys("ctrl+c"),
		key.WithHelp("ctrl+c", "quit"),
	)
	KeyDelete = key.NewBinding(
		key.WithKeys("ctrl+d"),
		key.WithHelp("ctrl+d", "delete"),
	)
	KeyDestroy = key.NewBinding(
		key.WithKeys("ctrl+k"),
		key.WithHelp("ctrl+k", "destroy"),
	)
	KeyOpenEditor = key.NewBinding(
		key.WithKeys("ctrl+e"),
		key.WithHelp("ctrl+e", "open in editor"),
	)

	KeyToggleMask = key.NewBinding(
		key.WithKeys("x"),
		key.WithHelp("x", "unmask"),
	)
	KeyToggleMaskAll = key.NewBinding(
		key.WithKeys("ctrl+x"),
		key.WithHelp("ctrl+x", "unmask all"),
	)
	KeyRenderJSON = key.NewBinding(
		key.WithKeys("z"),
		key.WithHelp("z", "view json"),
	)
	KeyListRecursive = key.NewBinding(
		key.WithKeys("r"),
		key.WithHelp("r", "list secrets recursively"),
	)

	KeysTable = []key.Binding{
		KeyUp,
		KeyDown,
		KeyLeft,
		KeyRight,
		KeyPageUp,
		KeyPageDown,
		KeyGoToTop,
		KeyGoToBottom,
	}
)

Functions

func AddStatusOperation

func AddStatusOperation(id int64, text string) tea.Cmd

AddStatusOperation is a helper function to add a status operation message.

func AppFilter

func AppFilter(uuid, text string) tea.Cmd

func AppQuit

func AppQuit() tea.Cmd

AppQuit is sent when the user wants to quit the application. Don't use tea.Quit, as different state may need to be cleaned up before quitting.

func ClearAppFilter

func ClearAppFilter() tea.Cmd

func ClearStatusOperation

func ClearStatusOperation(id int64) tea.Cmd

ClearStatusOperation is a helper function to clear a status operation message.

func CloseActiveDialog

func CloseActiveDialog() tea.Cmd

func CloseActivePage

func CloseActivePage() tea.Cmd

func CmdAfterDuration

func CmdAfterDuration(cmd tea.Cmd, duration time.Duration) tea.Cmd

CmdAfterDuration is a helper function to invoke the tea.Cmd after the duration.

func CmdMsg

func CmdMsg(msg tea.Msg) tea.Cmd

CmdMsg is a helper function to create a tea.Cmd that just returns the provided message.

func FocusChange

func FocusChange(id FocusID) tea.Cmd

func KeyBindingContains

func KeyBindingContains(keys []key.Binding, against key.Binding) bool

func KeyBindingContainsFull

func KeyBindingContainsFull(keys [][]key.Binding, against key.Binding) bool

func MsgAfterDuration

func MsgAfterDuration(msg tea.Msg, duration time.Duration) tea.Cmd

MsgAfterDuration is a helper function to create a tea.Cmd that returns the provided message after the duration.

func OpenDialog

func OpenDialog(d Dialog) tea.Cmd

func OpenPage

func OpenPage(p Page, isRoot bool) tea.Cmd

func OpenTempEditor

func OpenTempEditor(uuid, pathTemplate, content string, cb func(EditorResultMsg) tea.Cmd) tea.Cmd

OpenTempEditor opens a temporary editor for the given path template, and default content.

func OverrideHelp

func OverrideHelp(b key.Binding, help string) key.Binding

OverrideHelp overrides the help text for a key binding, returning a new key binding with the same keys and the new help text.

func PageClearState

func PageClearState() tea.Cmd

func PageErrors

func PageErrors(errors ...error) tea.Cmd

PageErrors bubbles up errors from the current page to page state to render.

func PageLoading

func PageLoading() tea.Cmd

func RefreshData

func RefreshData(uuid string) tea.Cmd

RefreshData is a helper for triggering a data refresh. It also helps reduce the chance of duplicate data refreshes, as the page state tracker uses debounce logic to prevent duplicate refreshes.

func RequestPreviousFocus

func RequestPreviousFocus() tea.Cmd

func SendStatus

func SendStatus(text string, status Status, duration time.Duration) tea.Cmd

SendStatus is a message to display a temporary status text message.

func SetClipboard

func SetClipboard(content string) tea.Cmd

Types

type AppFilterClearedMsg

type AppFilterClearedMsg struct{}

type AppFilterMsg

type AppFilterMsg struct {
	UUID string
	Text string
}

AppFilterMsg is sent when the user provides a filter in the status bar.

type AppFocusChangedMsg

type AppFocusChangedMsg struct {
	ID FocusID
}

type AppQuitMsg

type AppQuitMsg struct{}

type AppRequestPreviousFocusMsg

type AppRequestPreviousFocusMsg struct{}

type AppState

type AppState interface {
	Page() PageState
	Dialog() DialogState
	Client() Client
}

type AtomicExpires

type AtomicExpires[T any] struct {
	// contains filtered or unexported fields
}

func (*AtomicExpires[T]) Get

func (a *AtomicExpires[T]) Get() *T

func (*AtomicExpires[T]) Set

func (a *AtomicExpires[T]) Set(v *T, ttl time.Duration)

type AtomicSlice

type AtomicSlice[T any] struct {
	// contains filtered or unexported fields
}

func (*AtomicSlice[T]) Clear

func (a *AtomicSlice[T]) Clear()

func (*AtomicSlice[T]) Get

func (a *AtomicSlice[T]) Get() []T

func (*AtomicSlice[T]) Iter

func (a *AtomicSlice[T]) Iter() iter.Seq2[int, T]

func (*AtomicSlice[T]) IterValues

func (a *AtomicSlice[T]) IterValues() iter.Seq[T]

func (*AtomicSlice[T]) Len

func (a *AtomicSlice[T]) Len() int

func (*AtomicSlice[T]) Peek

func (a *AtomicSlice[T]) Peek() T

func (*AtomicSlice[T]) Pop

func (a *AtomicSlice[T]) Pop() (T, bool)

func (*AtomicSlice[T]) Push

func (a *AtomicSlice[T]) Push(v T)

func (*AtomicSlice[T]) Set

func (a *AtomicSlice[T]) Set(v []T)

type ClearStatusOperationMsg

type ClearStatusOperationMsg struct {
	ID int64
}

ClearStatusOperationMsg is a message to clear a status operation message. Should always be wrapped in a StatusMsg.

type ClearStatusTextMsg

type ClearStatusTextMsg struct {
	ID int64
}

ClearStatusTextMsg is a message to clear a status text message. Should always be wrapped in a StatusMsg.

type Client

type Client interface {
	Init() tea.Cmd
	Update(msg tea.Msg) tea.Cmd
	// GetHealth returns a command to get the health of the Vault server.
	GetHealth(uuid string) tea.Cmd
	// TokenLookupSelf returns a command to lookup the current token.
	TokenLookupSelf(uuid string) tea.Cmd

	// ListMounts returns a command to list the mounts of the Vault server.
	ListMounts(uuid string) tea.Cmd
	// ListSecrets returns a command to list the secrets of the Vault server,
	// under a given mount and path. If path is empty, it will list all secrets
	// under the mount.
	ListSecrets(uuid string, mount *Mount, path string) tea.Cmd
	// ListAllSecretsRecursive returns a command to list all secrets of the Vault
	// server. If mount is nil, it will list all secrets under all mounts.
	ListAllSecretsRecursive(uuid string, mount *Mount) tea.Cmd
	// ListKVv2Versions returns a command to list the versions of a KVv2 secret
	// under a given mount and path.
	ListKVv2Versions(uuid string, mount *Mount, path string) tea.Cmd

	// GetKVSecret returns a command to get a secret from the Vault server,
	// under a given mount and path.
	GetKVSecret(uuid string, mount *Mount, path string, version int) tea.Cmd
	// GetKVv2Metadata returns a command to get the metadata of a KVv2 secret
	// under a given mount and path.
	GetKVv2Metadata(uuid string, mount *Mount, path string) tea.Cmd

	// DeleteKVSecret deletes a secret, under a given mount and path.
	DeleteKVSecret(uuid string, mount *Mount, path string, versions ...int) tea.Cmd
	// UndeleteKVSecret undeletes a secret, under a given mount and path.
	UndeleteKVSecret(uuid string, mount *Mount, path string, versions ...int) tea.Cmd
	// DestroyKVSecret destroys a secret, under a given mount and path.
	DestroyKVSecret(uuid string, mount *Mount, path string, versions ...int) tea.Cmd

	// ListACLPolicies returns a command to list the ACL policies of the Vault
	// server.
	ListACLPolicies(uuid string) tea.Cmd
	// GetACLPolicy returns a command to get an ACL policy of the Vault server.
	GetACLPolicy(uuid string, policyName string) tea.Cmd
	// GetConfigState returns a command to get the configuration of the Vault
	// server.
	GetConfigState(uuid string) tea.Cmd
}

Client is an interface for interacting with a Vault server.

type ClientCapabilities

type ClientCapabilities []ClientCapability

func (ClientCapabilities) Contains

func (c ClientCapabilities) Contains(capability ClientCapability) bool

Contains returns true if the capabilities contain the given capability. Accounts for root, sudo, and deny and their associated precedence.

func (ClientCapabilities) String

func (c ClientCapabilities) String() string

type ClientCapability

type ClientCapability string

ClientCapability contains the capabilities of a given identity, meant to determine the level of permissions for a given mount/path/etc.

var (
	CapabilityRoot      ClientCapability = "root"
	CapabilityDeny      ClientCapability = "deny"
	CapabilitySudo      ClientCapability = "sudo"
	CapabilityWrite     ClientCapability = "write"
	CapabilitySubscribe ClientCapability = "subscribe"
	CapabilityRecover   ClientCapability = "recover"

	CapabilityRead   ClientCapability = "read"   // GET.
	CapabilityList   ClientCapability = "list"   // LIST.
	CapabilityDelete ClientCapability = "delete" // DELETE.
	CapabilityCreate ClientCapability = "create" // POST/PUT.
	CapabilityUpdate ClientCapability = "update" // POST/PUT.
	CapabilityPatch  ClientCapability = "patch"  // PATCH.
)

type ClientConfigMsg

type ClientConfigMsg struct {
	Address string               `json:"address"`
	Health  *vapi.HealthResponse `json:"health,omitempty"`
}

ClientConfigMsg is a message containing the Vault configuration. Health field is nil if the last health check failed.

type ClientConfigStateMsg

type ClientConfigStateMsg struct {
	Data json.RawMessage `json:"data"`
}

ClientConfigStateMsg is a message containing the configuration state of the cluster.

type ClientGetACLPolicyMsg

type ClientGetACLPolicyMsg struct {
	Name    string `json:"name"`
	Content string `json:"content"`
}

ClientGetACLPolicyMsg is a message containing the data of an ACL policy.

type ClientGetKVv2MetadataMsg

type ClientGetKVv2MetadataMsg struct {
	Mount    *Mount           `json:"mount"`
	Path     string           `json:"path"`
	Metadata *vapi.KVMetadata `json:"metadata"`
}

ClientGetKVv2MetadataMsg is a message containing the metadata of a KVv2, under a given mount and path.

type ClientGetSecretMsg

type ClientGetSecretMsg struct {
	Mount *Mount         `json:"mount"`
	Path  string         `json:"path"`
	Data  map[string]any `json:"data"`
}

ClientGetSecretMsg is a message containing the data of a secret, under a given mount and path.

type ClientListACLPoliciesMsg

type ClientListACLPoliciesMsg struct {
	Policies []string `json:"policies"`
}

ClientListACLPoliciesMsg is a message containing a list of all ACL policies.

type ClientListAllSecretsRecursiveMsg

type ClientListAllSecretsRecursiveMsg struct {
	Tree            ClientSecretTree `json:"tree"`
	RequestAttempts int64            `json:"request_attempts"`
	Requests        int64            `json:"requests"`
	MaxRequests     int64            `json:"max_requests"`
}

ClientListAllSecretsRecursiveMsg is a message containing the results of a recursive list of a given mount/path/etc.

type ClientListKVv2VersionsMsg

type ClientListKVv2VersionsMsg struct {
	Mount    *Mount                   `json:"mount"`
	Path     string                   `json:"path"`
	Versions []vapi.KVVersionMetadata `json:"versions"`
}

ClientListKVv2VersionsMsg is a message containing the versions of a KVv2 secret, under a given mount and path.

type ClientListMountsMsg

type ClientListMountsMsg struct {
	Mounts []*Mount `json:"mounts"`
}

ClientListMountsMsg is a message containing the list of mounts of the Vault server.

type ClientListSecretsMsg

type ClientListSecretsMsg struct {
	Values []*SecretListRef `json:"values"`
}

ClientListSecretsMsg is a message containing the list of secrets, under a given mount and path.

type ClientMsg

type ClientMsg struct {
	UUID  string `json:"uuid"`
	Msg   any    `json:"msg,omitempty"`
	Error error  `json:"error,omitempty"`
}

ClientMsg is a wrapper for any message relating to Vault API/client/etc responses.

type ClientRequestConfigMsg

type ClientRequestConfigMsg struct{}

ClientRequestConfigMsg is a message to request the Vault configuration.

type ClientSecretTree

type ClientSecretTree []*ClientSecretTreeRef

func (ClientSecretTree) IterRefs

IterRefs iterates over all the leaf refs in the tree, recursively.

func (ClientSecretTree) SetParentOnLeafs

func (c ClientSecretTree) SetParentOnLeafs(parent *ClientSecretTreeRef)

SetParentOnLeafs sets the parent on all leafs in the tree.

type ClientSecretTreeRef

type ClientSecretTreeRef struct {
	Parent *ClientSecretTreeRef `json:"-"`
	Mount  *Mount               `json:"mount"`

	Path         string             `json:"path"`
	Leafs        ClientSecretTree   `json:"leafs,omitempty"`
	Capabilities ClientCapabilities `json:"capabilities,omitempty"`
	Incomplete   bool               `json:"incomplete"`
}

ClientSecretTreeRef is a reference to a path.

func (*ClientSecretTreeRef) ApplyCapabilities

func (c *ClientSecretTreeRef) ApplyCapabilities(path string, caps ClientCapabilities) bool

ApplyCapabilities applies the given capabilities to the secret tree ref assuming the path matches.

func (*ClientSecretTreeRef) ClientSecretListRef

func (c *ClientSecretTreeRef) ClientSecretListRef() *SecretListRef

ClientSecretListRef returns a SecretListRef for the secret tree ref.

func (*ClientSecretTreeRef) GetFullPath

func (c *ClientSecretTreeRef) GetFullPath(withMount bool) string

GetFullPath returns the full path of the secret, combining all parent paths. If withMount is false, the mount path will not be included.

func (*ClientSecretTreeRef) HasLeafs

func (c *ClientSecretTreeRef) HasLeafs() bool

HasLeafs returns true if the path has any leafs (children).

func (*ClientSecretTreeRef) IsFolder

func (c *ClientSecretTreeRef) IsFolder() bool

IsFolder returns true if the path is a folder.

func (*ClientSecretTreeRef) IsSecret

func (c *ClientSecretTreeRef) IsSecret() bool

IsSecret returns true if the path is a secret.

func (*ClientSecretTreeRef) IterRefs

IterRefs iterates over all the leaf refs in this leaf, recursively.

type ClientSuccessMsg

type ClientSuccessMsg struct{}

type ClientTokenLookupSelfMsg

type ClientTokenLookupSelfMsg struct {
	Result *TokenLookupResult `json:"result"`
}

ClientTokenLookupSelfMsg is a message containing the result of a token lookup.

type CloseActiveDialogMsg

type CloseActiveDialogMsg struct{}

CloseActiveDialogMsg is a message that is sent to close the active dialog.

type CloseActivePageMsg

type CloseActivePageMsg struct{}

type Component

type Component interface {
	// GetUUID returns the UUID of the component.
	UUID() string

	// Init handles any initialisation that needs to be done for the component state.
	// This is called when the component state is first created.
	Init() tea.Cmd

	// Update handles any updates that need to be done for the component state,
	// propagating messages to the active component (or inactive components if applicable).
	Update(msg tea.Msg) tea.Cmd

	// This returns the rendered view for the component.
	View() string

	// GetHeight returns the height of the component.
	GetHeight() int

	// GetWidth returns the width of the component.
	GetWidth() int

	// GetSize returns the size of the component.
	GetSize() (x, y int)
}

type ComponentModel

type ComponentModel struct {
	Height int
	Width  int
	// contains filtered or unexported fields
}

func (*ComponentModel) GetHeight

func (b *ComponentModel) GetHeight() int

func (*ComponentModel) GetSize

func (b *ComponentModel) GetSize() (x, y int)

func (*ComponentModel) GetWidth

func (b *ComponentModel) GetWidth() int

func (*ComponentModel) UUID

func (b *ComponentModel) UUID() string

type Dialog

type Dialog interface {
	// UUID returns the UUID of the dialog.
	UUID() string

	// This handles any initialisation that needs to be done for the dialog.
	// This is called when the dialog is first created.
	Init() tea.Cmd

	// This handles any updates that need to be done for the dialog, potentially
	// propagating messages to downstream components.
	Update(msg tea.Msg) tea.Cmd

	// This returns the rendered view for the dialog.
	View() string

	// HasInputFocus returns whether the page captures focus for keybinds (and we
	// should send all keybinds to the page). This is stubbed to false by default.
	HasInputFocus() bool

	// GetSize returns the size of the dialog.
	GetSize() DialogSize

	// GetHeight returns the height of the dialog.
	GetHeight() int

	// GetWidth returns the width of the dialog.
	GetWidth() int

	// GetTitle returns the title of the dialog. Defaults to the ID of the dialog,
	// but can be overridden by the dialog implementation.
	GetTitle() string

	// DisablesChildren returns whether the dialog disables children (i.e. something
	// like a quit dialog).
	DisablesChildren() bool

	// ShortHelp returns the short help for the dialog.
	ShortHelp() []key.Binding

	// FullHelp returns the full help for the dialog.
	FullHelp() [][]key.Binding

	// IsCoreDialog returns whether the dialog is a core dialog, i.e. one that should
	// by typically skipped when checking for keybinds, some propagation, etc.
	IsCoreDialog() bool

	// Close is a callback which is invoked when the dialog is closed. Defaults
	// to a no-op but can be overridden by the dialog implementation.
	Close() tea.Cmd
}

type DialogModel

type DialogModel struct {
	Size            DialogSize
	Height          int
	Width           int
	DisableChildren bool
	ShortKeyBinds   []key.Binding
	FullKeyBinds    [][]key.Binding
	// contains filtered or unexported fields
}

DialogModel is the base model for a dialog.

func (*DialogModel) Close

func (m *DialogModel) Close() tea.Cmd

func (*DialogModel) DisablesChildren

func (m *DialogModel) DisablesChildren() bool

func (*DialogModel) FullHelp

func (m *DialogModel) FullHelp() [][]key.Binding

func (*DialogModel) GetHeight

func (m *DialogModel) GetHeight() int

func (*DialogModel) GetSize

func (m *DialogModel) GetSize() DialogSize

func (*DialogModel) GetTitle

func (m *DialogModel) GetTitle() string

func (*DialogModel) GetWidth

func (m *DialogModel) GetWidth() int

func (*DialogModel) HasInputFocus

func (m *DialogModel) HasInputFocus() bool

func (*DialogModel) IsCoreDialog

func (m *DialogModel) IsCoreDialog() bool

func (*DialogModel) ShortHelp

func (m *DialogModel) ShortHelp() []key.Binding

func (*DialogModel) UUID

func (m *DialogModel) UUID() string

type DialogMsg

type DialogMsg struct {
	Msg any
}

DialogMsg is a message that is sent to a dialog.

type DialogSize

type DialogSize string
const (
	DialogSizeSmall  DialogSize = "small"
	DialogSizeMedium DialogSize = "medium"
	DialogSizeLarge  DialogSize = "large"
	DialogSizeFull   DialogSize = "full"
	DialogSizeCustom DialogSize = "custom"
)

type DialogState

type DialogState interface {
	// Init handles any initialisation that needs to be done for the dialog state.
	// This is called when the dialog state is first created.
	Init() tea.Cmd

	// Update handles any updates that need to be done for the dialog state,
	// propagating messages to the active dialog (or inactive dialogs if applicable).
	Update(msg tea.Msg) tea.Cmd

	// Len returns the number of dialogs in the dialog state.
	Len(skipCore bool) int

	// Get returns the currently active dialog. If skipCore is true, the dialog
	// will be returned if it is not a core dialog (e.g. help, commander, etc).
	Get(skipCore bool) Dialog

	// ShortHelp returns the short help for the dialog state.
	ShortHelp() []key.Binding

	// FullHelp returns the full help for the dialog state.
	FullHelp() [][]key.Binding

	// SetLayers adds the layers for the dialog state to the base layer.
	SetLayers(baseLayer *lipgloss.Layer) *lipgloss.Layer
}

type EditorResultMsg

type EditorResultMsg struct {
	// UUID is used to which internal model is associated with the editor operation.
	UUID string

	// Before is the original content used for the file, if any.
	Before string

	// After is the content of the file after the editor operation.
	After string

	// HasChanged is true if the content of the file has changed.
	HasChanged bool

	// MD5SumBefore is the MD5 sum of the original content.
	MD5SumBefore string

	// MD5SumAfter is the MD5 sum of the content after the editor operation.
	MD5SumAfter string
}

EditorResultMsg is a message to indicate the result of an external editor operation.

type FocusID

type FocusID string
const (
	FocusPage      FocusID = "page"
	FocusDialog    FocusID = "dialog"
	FocusStatusBar FocusID = "statusbar"
)

type KeyBindingGroup

type KeyBindingGroup struct {
	Title    string
	Bindings [][]key.Binding
}

type Mount

type Mount struct {
	*vapi.MountOutput `json:",inline"`

	// Path is the path of the mount.
	Path string `json:"path"`

	// Capabilities are the capabilities of the mount. Not always available,
	// depends on the query made.
	Capabilities ClientCapabilities `json:"capabilities"`
}

Mount is a mount of the Vault server.

func (*Mount) KVVersion

func (m *Mount) KVVersion() int

KVVersion returns the version of the KV mount, if the mount is a KV mount, returning -1 otherwise.

func (*Mount) PrefixPaths

func (m *Mount) PrefixPaths(paths ...string) (prefixed []string)

PrefixPaths prefixes the given paths with the mount path.

type OpenDialogMsg

type OpenDialogMsg struct {
	Dialog Dialog
}

OpenDialogMsg is a message that is sent to open a dialog.

type OpenPageMsg

type OpenPageMsg struct {
	Page Page
	Root bool
}

type OrderedMap

type OrderedMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewOrderedMap

func NewOrderedMap[K comparable, V any]() *OrderedMap[K, V]

func (*OrderedMap[K, V]) Clear

func (o *OrderedMap[K, V]) Clear()

func (*OrderedMap[K, V]) ClearAndSet

func (o *OrderedMap[K, V]) ClearAndSet(k K, v V)

func (*OrderedMap[K, V]) Delete

func (o *OrderedMap[K, V]) Delete(key K)

func (*OrderedMap[K, V]) Exists

func (o *OrderedMap[K, V]) Exists(key K) bool

func (*OrderedMap[K, V]) Get

func (o *OrderedMap[K, V]) Get(key K) (V, bool)

func (*OrderedMap[K, V]) Keys

func (o *OrderedMap[K, V]) Keys() []K

func (*OrderedMap[K, V]) Len

func (o *OrderedMap[K, V]) Len() int

func (*OrderedMap[K, V]) Peek

func (o *OrderedMap[K, V]) Peek() (K, V)

func (*OrderedMap[K, V]) Pop

func (o *OrderedMap[K, V]) Pop() (K, V)

func (*OrderedMap[K, V]) Set

func (o *OrderedMap[K, V]) Set(k K, v V)

func (*OrderedMap[K, V]) Values

func (o *OrderedMap[K, V]) Values() (values []V)

type Page

type Page interface {
	// UUID returns the UUID of the page.
	UUID() string

	// Init handles any initialisation that needs to be done for page.
	Init() tea.Cmd

	// Update handles any updates that need to be done for the page.
	Update(msg tea.Msg) tea.Cmd

	// View returns the view for the page.
	View() string

	// HasInputFocus returns whether the page captures focus for keybinds (and we
	// should send all keybinds to the page). This is stubbed to false by default.
	HasInputFocus() bool

	// GetRefreshInterval returns the refresh interval for the page. Refresh
	// support only configured if interval is greater than 0.
	GetRefreshInterval() time.Duration

	// GetCommands returns the commands of the page (if one is defined).
	GetCommands() []string

	// GetSupportFiltering returns whether the page supports filtering.
	GetSupportFiltering() bool

	// ShortHelp returns the short help for the page.
	ShortHelp() []key.Binding

	// FullHelp returns the full help for the page.
	FullHelp() [][]key.Binding

	// GetTitle returns the title of the page.
	GetTitle() string

	// Close is a callback which is invoked when the page is closed. Defaults
	// to a no-op but can be overridden by the page implementation.
	Close() tea.Cmd
}

type PageBlurredMsg

type PageBlurredMsg struct{}

PageBlurredMsg is sent when the active page is blurred, to the active page ONLY. Sent when things like a dialog is opened in front of the page.

type PageClearStateMsg

type PageClearStateMsg struct{}

PageClearStateMsg is sent from the active page when the page wants to clear any temporary state (loading, errors, etc).

type PageErrorsMsg

type PageErrorsMsg struct {
	Errors []error
}

PageErrorsMsg is sent from the active page when the page has errors.

type PageHiddenMsg

type PageHiddenMsg struct{}

PageHiddenMsg is sent when the active page is made hidden, to the active page ONLY. It's sent when the page is no longer being actively rendered (e.g. child page is being displayed).

type PageLoadingMsg

type PageLoadingMsg struct{}

PageLoadingMsg is sent from the active page when the page is loading.

type PageModel

type PageModel struct {
	Commands         []string
	SupportFiltering bool
	RefreshInterval  time.Duration
	ShortKeyBinds    []key.Binding
	FullKeyBinds     [][]key.Binding
	// contains filtered or unexported fields
}

func (*PageModel) Close

func (b *PageModel) Close() tea.Cmd

func (*PageModel) FullHelp

func (b *PageModel) FullHelp() [][]key.Binding

func (*PageModel) GetCommands

func (b *PageModel) GetCommands() []string

func (*PageModel) GetRefreshInterval

func (b *PageModel) GetRefreshInterval() time.Duration

func (*PageModel) GetSupportFiltering

func (b *PageModel) GetSupportFiltering() bool

func (*PageModel) GetTitle

func (b *PageModel) GetTitle() string

GetTitle is the title of the page. Defaults to the command of the page if defined, otherwise the ID. Can be overridden by the page.

func (*PageModel) HasInputFocus

func (b *PageModel) HasInputFocus() bool

func (*PageModel) Init

func (b *PageModel) Init() tea.Cmd

func (*PageModel) ShortHelp

func (b *PageModel) ShortHelp() []key.Binding

func (*PageModel) UUID

func (b *PageModel) UUID() string

func (*PageModel) Update

func (b *PageModel) Update(msg tea.Msg) tea.Cmd

func (*PageModel) View

func (b *PageModel) View() string

type PageRefocusedMsg

type PageRefocusedMsg struct{}

PageRefocusedMsg is sent when the active page is refocused, to the active page ONLY. It's not sent on initial page load, only when the page is refocused.

type PageState

type PageState interface {
	// Init handles any initialisation that needs to be done for page state tracking.
	Init() tea.Cmd

	// Update handles any updates that need to be done for page state tracking, including
	// propagating messages to the active page (or inactive pages if applicable).
	Update(msg tea.Msg) tea.Cmd

	// View returns the view for the active page.
	View() string

	// All returns all pages in the page stack.
	All() []Page

	// UUIDs returns all the UUIDs of the pages in the page stack.
	UUIDs() []string

	// Get returns the current active page.
	Get() Page

	// ShortHelp returns the short help for the page state.
	ShortHelp() []key.Binding

	// FullHelp returns the full help for the page state.
	FullHelp() [][]key.Binding

	// HasParent returns whether the page has a parent page.
	HasParent() bool
}

type PageVisibleMsg

type PageVisibleMsg struct{}

PageVisibleMsg is sent when the active page is made visible, to the active page ONLY. It is not send on initial page creation, only in situations like when a child page is closed, and the parent page is made visible again.

type RefreshDataMsg

type RefreshDataMsg struct {
	UUID string
}

RefreshDataMsg is sent when the data for a page should be refreshed.

type SecretListRef

type SecretListRef struct {
	Mount        *Mount             `json:"mount"`
	Path         string             `json:"path"`
	Capabilities ClientCapabilities `json:"capabilities"`
}

SecretListRef is a reference to a secret.

func (*SecretListRef) FullPath

func (r *SecretListRef) FullPath() string

FullPath returns the full path of the secret (including the mount path).

type Status

type Status string

Status represents the state of a temporary message that we want to display to the user.

const (
	Success Status = "success"
	Info    Status = "info"
	Warning Status = "warning"
	Error   Status = "error"
)

type StatusMsg

type StatusMsg struct {
	Msg any
}

StatusMsg wraps all status related messages.

type StatusOperationMsg

type StatusOperationMsg struct {
	ID   int64
	Text string
}

StatusOperationMsg is a message to add an operation to the statusbar. Should always be wrapped in a StatusMsg.

type StatusTextMsg

type StatusTextMsg struct {
	Status   Status
	Text     string
	Duration time.Duration

	ID int64 // ID of the status text message. Automatically set by [SendStatus*] functions.
}

StatusTextMsg is a message to display a status text message. Should always be wrapped in a StatusMsg.

type TokenLookupResult

type TokenLookupResult struct {
	Accessor       string         `json:"accessor,omitempty"`
	CreationTime   int64          `json:"creation_time,omitempty"`
	CreationTTL    int64          `json:"creation_ttl,omitempty"`
	DisplayName    string         `json:"display_name,omitempty"`
	EntityID       string         `json:"entity_id,omitempty"`
	ExpireTime     time.Time      `json:"expire_time,omitempty"`
	ExplicitMaxTTL int64          `json:"explicit_max_ttl,omitempty"`
	ID             string         `json:"id,omitempty"`
	IssueTime      time.Time      `json:"issue_time,omitempty"`
	Meta           map[string]any `json:"meta,omitempty"`
	NumUses        int64          `json:"num_uses,omitempty"`
	Orphan         bool           `json:"orphan,omitempty"`
	Path           string         `json:"path,omitempty"`
	Policies       []string       `json:"policies,omitempty"`
	Renewable      bool           `json:"renewable,omitempty"`
	TTL            int64          `json:"ttl,omitempty"`
	Type           string         `json:"type,omitempty"`
}

TokenLookupResult is the result of a token lookup.

func (*TokenLookupResult) WhenExpires

func (r *TokenLookupResult) WhenExpires() time.Duration

WhenExpires returns the duration until the token expires.

Jump to

Keyboard shortcuts

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