Help us shape the future of Go! Take the 2026 Go Developer Survey

runtimeexplorer

package
v0.4.24 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ContractVersion = "baseharbor.runtime-explorer/v1"

Variables

This section is empty.

Functions

This section is empty.

Types

type CLIContainerBackend

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

func NewCLIContainerBackend

func NewCLIContainerBackend(runtime DirectContainerRuntime) (*CLIContainerBackend, error)

func (*CLIContainerBackend) ContainerLogs

func (b *CLIContainerBackend) ContainerLogs(ctx context.Context, id string, since *time.Time, tail int, follow bool) (io.ReadCloser, error)

func (*CLIContainerBackend) ContainerTerminal added in v0.4.23

func (b *CLIContainerBackend) ContainerTerminal(ctx context.Context, id string, argv []string, rows, columns int) (terminal.Session, error)

func (*CLIContainerBackend) InventoryResourceKinds

func (b *CLIContainerBackend) InventoryResourceKinds() []ResourceKind

func (*CLIContainerBackend) Kind

func (*CLIContainerBackend) ListInventoryResources

func (b *CLIContainerBackend) ListInventoryResources(ctx context.Context, kind ResourceKind) ([]InventoryResource, error)

func (*CLIContainerBackend) ListRuntimeContainers

func (b *CLIContainerBackend) ListRuntimeContainers(ctx context.Context) ([]runtimecontract.RuntimeContainer, error)

func (*CLIContainerBackend) OperateContainer

func (b *CLIContainerBackend) OperateContainer(ctx context.Context, id string, operation Operation, command []string) (string, error)

func (*CLIContainerBackend) TerminalAvailable added in v0.4.23

func (b *CLIContainerBackend) TerminalAvailable() bool

type Capability

type Capability string
const (
	CapabilityResourceInspect    Capability = "resources.inspect"
	CapabilityResourceMetrics    Capability = "resources.metrics"
	CapabilityLogs               Capability = "logs"
	CapabilityContainerLifecycle Capability = "container.lifecycle"
	CapabilityContainerExec      Capability = "container.exec"
	CapabilityPodInspect         Capability = "pod.inspect"
)
const CapabilityContainerTerminal Capability = "container.terminal"

type CapabilitySet

type CapabilitySet struct {
	ContractVersion string         `json:"contract_version"`
	Provider        string         `json:"provider"`
	Target          string         `json:"target"`
	Capabilities    []Capability   `json:"capabilities"`
	ResourceKinds   []ResourceKind `json:"resource_kinds"`
}

type ConnectorBackend added in v0.4.23

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

func NewConnectorBackend added in v0.4.23

func NewConnectorBackend(pool ConnectorTransport, scope targetenrollment.Scope) (*ConnectorBackend, error)

func (*ConnectorBackend) ContainerLogs added in v0.4.23

func (b *ConnectorBackend) ContainerLogs(ctx context.Context, id string, since *time.Time, tail int, follow bool) (io.ReadCloser, error)

func (*ConnectorBackend) ContainerMetrics added in v0.4.23

func (b *ConnectorBackend) ContainerMetrics(ctx context.Context, id string) (MetricsHandle, error)

func (*ConnectorBackend) ContainerTerminal added in v0.4.23

func (b *ConnectorBackend) ContainerTerminal(ctx context.Context, id string, argv []string, rows, columns int) (terminal.Session, error)

func (*ConnectorBackend) Kind added in v0.4.23

func (*ConnectorBackend) ListRuntimeContainers added in v0.4.23

func (b *ConnectorBackend) ListRuntimeContainers(ctx context.Context) ([]runtimecontract.RuntimeContainer, error)

func (*ConnectorBackend) OperateContainer added in v0.4.23

func (b *ConnectorBackend) OperateContainer(ctx context.Context, id string, operation Operation, argv []string) (string, error)

func (*ConnectorBackend) RuntimeExplorerCapabilities added in v0.4.23

func (b *ConnectorBackend) RuntimeExplorerCapabilities(ctx context.Context) ([]Capability, error)

func (*ConnectorBackend) TerminalAvailable added in v0.4.23

func (b *ConnectorBackend) TerminalAvailable() bool

type ConnectorTransport added in v0.4.23

type ConnectorTransport interface {
	LiveCapabilities(targetenrollment.Scope) (targetsession.Capabilities, error)
	Dispatch(context.Context, targetenrollment.Scope, targetsession.Request) (targetsession.Response, error)
}

ConnectorBackend projects the existing Runtime Explorer primitives through canonical typed transport. Service still evaluates ownership and safety.

type ContainerBackend

type ContainerBackend interface {
	Kind() runtimecontract.ProviderKind
	ListRuntimeContainers(context.Context) ([]runtimecontract.RuntimeContainer, error)
	ContainerLogs(context.Context, string, *time.Time, int, bool) (io.ReadCloser, error)
	OperateContainer(context.Context, string, Operation, []string) (string, error)
}

type DirectContainerRuntime

type DirectContainerRuntime interface {
	Kind() runtimecontract.ProviderKind
	ListRuntimeContainers(context.Context) ([]runtimecontract.RuntimeContainer, error)
	DirectOutput(context.Context, ...string) (string, error)
	DirectStream(context.Context, ...string) (io.ReadCloser, error)
}

type InventoryBackend

type InventoryBackend interface {
	InventoryResourceKinds() []ResourceKind
	ListInventoryResources(context.Context, ResourceKind) ([]InventoryResource, error)
}

type InventoryResource

type InventoryResource struct {
	Kind       ResourceKind
	ResourceID string
	Name       string
	State      string
	Health     string
	References map[string]string
}

type ListRequest

type ListRequest struct {
	Target        string         `json:"target"`
	Kinds         []ResourceKind `json:"kinds,omitempty"`
	Ownership     []Ownership    `json:"ownership,omitempty"`
	ApplicationID string         `json:"application_id,omitempty"`
	DeploymentID  string         `json:"deployment_id,omitempty"`
	Environment   string         `json:"environment,omitempty"`
	Component     string         `json:"component,omitempty"`
}

type LogRequest

type LogRequest struct {
	Resource ResourceRef `json:"resource"`
	Since    *time.Time  `json:"since,omitempty"`
	Tail     int         `json:"tail,omitempty"`
	Follow   bool        `json:"follow,omitempty"`
}

type MetricsHandle

type MetricsHandle struct {
	Available bool           `json:"available"`
	Reference string         `json:"reference,omitempty"`
	Sample    *MetricsSample `json:"sample,omitempty"`
}

type MetricsSample added in v0.4.23

type MetricsSample struct {
	ResourceID  string    `json:"resource_id"`
	ObservedAt  time.Time `json:"observed_at"`
	CPUPercent  string    `json:"cpu_percent,omitempty"`
	MemoryUsage string    `json:"memory_usage,omitempty"`
	NetworkIO   string    `json:"network_io,omitempty"`
}

MetricsSample preserves native runtime units; it is an observation, not a normalized capacity or health decision.

type Operation

type Operation string
const (
	OperationStart   Operation = "start"
	OperationStop    Operation = "stop"
	OperationRestart Operation = "restart"
	OperationExec    Operation = "exec"
)

type OperationRequest

type OperationRequest struct {
	Resource  ResourceRef `json:"resource"`
	Operation Operation   `json:"operation"`
	Command   []string    `json:"command,omitempty"`
}

func (OperationRequest) Validate

func (r OperationRequest) Validate() error

type OperationResult

type OperationResult struct {
	Resource       ResourceRef        `json:"resource"`
	Operation      Operation          `json:"operation"`
	State          ResourceState      `json:"state,omitempty"`
	Reconciliation ReconciliationHint `json:"reconciliation,omitempty"`
}

type Ownership

type Ownership string
const (
	OwnershipManaged   Ownership = "managed"
	OwnershipExternal  Ownership = "external"
	OwnershipUnmanaged Ownership = "unmanaged"
	OwnershipPlatform  Ownership = "platform"
)

type OwnershipEvidence

type OwnershipEvidence struct {
	Ownership      Ownership
	Relationship   Relationship
	Reconciliation ReconciliationHint
}

type ReconciliationHint

type ReconciliationHint struct {
	PreferredOperation            string `json:"preferred_operation,omitempty"`
	DirectMutationMayBeReconciled bool   `json:"direct_mutation_may_be_reconciled,omitempty"`
	Detail                        string `json:"detail,omitempty"`
}

type Relationship

type Relationship struct {
	ApplicationID string `json:"application_id,omitempty"`
	DeploymentID  string `json:"deployment_id,omitempty"`
	Application   string `json:"application,omitempty"`
	Environment   string `json:"environment,omitempty"`
	Component     string `json:"component,omitempty"`
	Provider      string `json:"provider,omitempty"`
}

type Resource

type Resource struct {
	ContractVersion string             `json:"contract_version"`
	Ref             ResourceRef        `json:"ref"`
	DisplayName     string             `json:"display_name,omitempty"`
	RuntimeName     string             `json:"runtime_name,omitempty"`
	Ownership       Ownership          `json:"ownership"`
	Relationship    Relationship       `json:"relationship,omitempty"`
	State           ResourceState      `json:"state,omitempty"`
	CreatedAt       *time.Time         `json:"created_at,omitempty"`
	UpdatedAt       *time.Time         `json:"updated_at,omitempty"`
	References      map[string]string  `json:"references,omitempty"`
	Reconciliation  ReconciliationHint `json:"reconciliation,omitempty"`
	Extension       json.RawMessage    `json:"extension,omitempty"`
}

func (Resource) Validate

func (r Resource) Validate() error

type ResourceKind

type ResourceKind string
const (
	KindContainer ResourceKind = "container"
	KindImage     ResourceKind = "image"
	KindVolume    ResourceKind = "volume"
	KindNetwork   ResourceKind = "network"
	KindPod       ResourceKind = "pod"
)

type ResourceRef

type ResourceRef struct {
	Provider   string       `json:"provider"`
	Target     string       `json:"target"`
	Kind       ResourceKind `json:"kind"`
	ResourceID string       `json:"resource_id"`
}

func (ResourceRef) Validate

func (r ResourceRef) Validate() error

type ResourceState

type ResourceState struct {
	Desired  string `json:"desired,omitempty"`
	Observed string `json:"observed,omitempty"`
	Health   string `json:"health,omitempty"`
	Ready    *bool  `json:"ready,omitempty"`
}

type Service

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

func NewService

func NewService(backend ContainerBackend, target string, resolver OwnershipResolver) (*Service, error)

func (*Service) Capabilities

func (s *Service) Capabilities(ctx context.Context, target string) (CapabilitySet, error)

func (*Service) Exec

func (s *Service) Exec(ctx context.Context, request OperationRequest) (io.ReadCloser, error)

func (*Service) Inspect

func (s *Service) Inspect(ctx context.Context, ref ResourceRef) (Resource, error)

func (*Service) List

func (s *Service) List(ctx context.Context, request ListRequest) ([]Resource, error)

func (*Service) Logs

func (s *Service) Logs(ctx context.Context, request LogRequest) (io.ReadCloser, error)

func (*Service) Metrics

func (s *Service) Metrics(ctx context.Context, ref ResourceRef) (MetricsHandle, error)

func (*Service) Operate

func (s *Service) Operate(ctx context.Context, request OperationRequest) (OperationResult, error)

func (*Service) Terminal added in v0.4.23

func (s *Service) Terminal(ctx context.Context, request OperationRequest, scope machine.OperationContext, rows, columns int) (terminal.Session, error)

type TerminalBackend added in v0.4.23

type TerminalBackend interface {
	ContainerTerminal(context.Context, string, []string, int, int) (terminal.Session, error)
}

Jump to

Keyboard shortcuts

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