Documentation
¶
Index ¶
- Constants
- type CLIContainerBackend
- func (b *CLIContainerBackend) ContainerLogs(ctx context.Context, id string, since *time.Time, tail int, follow bool) (io.ReadCloser, error)
- func (b *CLIContainerBackend) ContainerResourceEvidence(ctx context.Context, id string) (map[string]string, error)
- func (b *CLIContainerBackend) ContainerTerminal(ctx context.Context, id string, argv []string, rows, columns int) (terminal.Session, error)
- func (b *CLIContainerBackend) InventoryResourceKinds() []ResourceKind
- func (b *CLIContainerBackend) Kind() runtimecontract.ProviderKind
- func (b *CLIContainerBackend) ListInventoryResources(ctx context.Context, kind ResourceKind) ([]InventoryResource, error)
- func (b *CLIContainerBackend) ListRuntimeContainers(ctx context.Context) ([]runtimecontract.RuntimeContainer, error)
- func (b *CLIContainerBackend) OperateContainer(ctx context.Context, id string, operation Operation, command []string) (string, error)
- func (b *CLIContainerBackend) TerminalAvailable() bool
- type Capability
- type CapabilitySet
- type ConnectorBackend
- func (b *ConnectorBackend) ContainerLogs(ctx context.Context, id string, since *time.Time, tail int, follow bool) (io.ReadCloser, error)
- func (b *ConnectorBackend) ContainerMetrics(ctx context.Context, id string) (MetricsHandle, error)
- func (b *ConnectorBackend) ContainerTerminal(ctx context.Context, id string, argv []string, rows, columns int) (terminal.Session, error)
- func (b *ConnectorBackend) Kind() runtimecontract.ProviderKind
- func (b *ConnectorBackend) ListRuntimeContainers(ctx context.Context) ([]runtimecontract.RuntimeContainer, error)
- func (b *ConnectorBackend) OperateContainer(ctx context.Context, id string, operation Operation, argv []string) (string, error)
- func (b *ConnectorBackend) RuntimeExplorerCapabilities(ctx context.Context) ([]Capability, error)
- func (b *ConnectorBackend) TerminalAvailable() bool
- type ConnectorTransport
- type ContainerBackend
- type DirectContainerRuntime
- type Explorer
- type InventoryBackend
- type InventoryResource
- type ListRequest
- type LogRequest
- type MetricsHandle
- type MetricsSample
- type MutationAuthority
- type MutationVerifier
- type Operation
- type OperationRequest
- type OperationResult
- type Ownership
- type OwnershipEvidence
- type OwnershipResolver
- type ReconciliationHint
- type Relationship
- type Resource
- type ResourceKind
- type ResourceRef
- type ResourceState
- type Service
- func (s *Service) Capabilities(ctx context.Context, target string) (CapabilitySet, error)
- func (s *Service) Exec(ctx context.Context, request OperationRequest) (io.ReadCloser, error)
- func (s *Service) Inspect(ctx context.Context, ref ResourceRef) (Resource, error)
- func (s *Service) List(ctx context.Context, request ListRequest) ([]Resource, error)
- func (s *Service) Logs(ctx context.Context, request LogRequest) (io.ReadCloser, error)
- func (s *Service) Metrics(ctx context.Context, ref ResourceRef) (MetricsHandle, error)
- func (s *Service) Operate(ctx context.Context, request OperationRequest) (OperationResult, error)
- func (s *Service) Terminal(ctx context.Context, request OperationRequest, scope machine.OperationContext, ...) (terminal.Session, error)
- type TerminalBackend
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 (*CLIContainerBackend) ContainerResourceEvidence ¶ added in v0.4.25
func (*CLIContainerBackend) ContainerTerminal ¶ added in v0.4.23
func (*CLIContainerBackend) InventoryResourceKinds ¶
func (b *CLIContainerBackend) InventoryResourceKinds() []ResourceKind
func (*CLIContainerBackend) Kind ¶
func (b *CLIContainerBackend) Kind() runtimecontract.ProviderKind
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 (*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 (*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 (*ConnectorBackend) Kind ¶ added in v0.4.23
func (b *ConnectorBackend) Kind() runtimecontract.ProviderKind
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 (*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 Explorer ¶
type Explorer interface {
Capabilities(context.Context, string) (CapabilitySet, error)
List(context.Context, ListRequest) ([]Resource, error)
Inspect(context.Context, ResourceRef) (Resource, error)
Logs(context.Context, LogRequest) (io.ReadCloser, error)
Metrics(context.Context, ResourceRef) (MetricsHandle, error)
Operate(context.Context, OperationRequest) (OperationResult, error)
}
type InventoryBackend ¶
type InventoryBackend interface {
InventoryResourceKinds() []ResourceKind
ListInventoryResources(context.Context, ResourceKind) ([]InventoryResource, error)
}
type InventoryResource ¶
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 MutationAuthority ¶ added in v0.4.25
type MutationAuthority interface {
AuthorizeRuntimeMutation(context.Context, Resource, OperationRequest) (MutationVerifier, error)
}
MutationAuthority is supplied by the existing Target/deployment owner. The returned verifier also runs after a failed backend command: partial physical effects must not disappear behind a command error. It owns no persistent state.
type MutationVerifier ¶ added in v0.4.25
type MutationVerifier func(context.Context, Resource, error) (*application.ProviderImpactScopeResult, error)
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 {
ProviderChangeResult *application.ProviderImpactScopeResult `json:"provider_change_result,omitempty"`
Resource ResourceRef `json:"resource"`
Operation Operation `json:"operation"`
State ResourceState `json:"state,omitempty"`
Reconciliation ReconciliationHint `json:"reconciliation,omitempty"`
}
type OwnershipEvidence ¶
type OwnershipEvidence struct {
Ownership Ownership
Relationship Relationship
Reconciliation ReconciliationHint
}
type OwnershipResolver ¶
type OwnershipResolver interface {
ResolveContainer(context.Context, string, runtimecontract.ProviderKind, runtimecontract.RuntimeContainer) (OwnershipEvidence, error)
}
type ReconciliationHint ¶
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"`
}
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 Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(backend ContainerBackend, target string, resolver OwnershipResolver, authorities ...MutationAuthority) (*Service, error)
func (*Service) Capabilities ¶
func (*Service) Exec ¶
func (s *Service) Exec(ctx context.Context, request OperationRequest) (io.ReadCloser, 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)
Click to show internal directories.
Click to hide internal directories.