watch

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatJSONStream    = "json-stream"
	FormatSummaryStream = "summary-stream"
	FormatEventLog      = "event-log"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BundleWatcher

type BundleWatcher struct {
	WorkloadAPISocket string
	Format            string
	BundleType        string // "x509" or "jwt"
	Output            io.Writer
}

BundleWatcher streams bundle updates from the Workload API.

func (*BundleWatcher) Watch

func (w *BundleWatcher) Watch(ctx context.Context) error

Watch connects to the Workload API and emits bundle update events until ctx is cancelled.

type Formatter

type Formatter struct {
	// contains filtered or unexported fields
}

Formatter writes watch events to an output stream in the configured format.

func NewFormatter

func NewFormatter(format string, out io.Writer) (*Formatter, error)

NewFormatter creates a Formatter for the given format name.

func (*Formatter) Emit

func (f *Formatter) Emit(event WatchEvent)

Emit writes a single event to the output. If Timestamp is empty it is set to now.

type JWTSVIDWatcher

type JWTSVIDWatcher struct {
	WorkloadAPISocket string
	Audiences         []string
	Format            string
	Interval          time.Duration
	Output            io.Writer
}

JWTSVIDWatcher periodically fetches JWT SVIDs and emits events. The Workload API does not stream JWT SVIDs; this watcher re-fetches at a configurable interval.

func (*JWTSVIDWatcher) Watch

func (w *JWTSVIDWatcher) Watch(ctx context.Context) error

Watch connects to the Workload API and periodically fetches JWT SVIDs, emitting events for each fetch until ctx is cancelled.

type WatchEvent

type WatchEvent struct {
	Timestamp   string `json:"timestamp"`
	Event       string `json:"event"`
	SpiffeID    string `json:"spiffe_id,omitempty"`
	Expiry      string `json:"expiry,omitempty"`
	TrustDomain string `json:"trust_domain,omitempty"`
	KeyCount    int    `json:"key_count,omitempty"`
	Error       string `json:"error,omitempty"`
}

WatchEvent represents a single event emitted during a watch operation.

type X509SVIDWatcher

type X509SVIDWatcher struct {
	WorkloadAPISocket string
	Format            string
	Output            io.Writer
}

X509SVIDWatcher streams X.509 SVID updates from the Workload API.

func (*X509SVIDWatcher) Watch

func (w *X509SVIDWatcher) Watch(ctx context.Context) error

Watch connects to the Workload API and emits X.509 SVID update events until ctx is cancelled.

Jump to

Keyboard shortcuts

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