api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppContext

type AppContext struct {
	Name      string // application name
	Version   string // application version
	CommitID  string // git commit ID
	Namespace string // default installation namespace
	Short     string // short description for CLI
	Long      string // long description for CLI
}

AppContext holds immutable application metadata. This is passed throughout the component tree as the single source of truth for application identity, versioning, and organizational information.

AppContext is separated from App to distinguish between configuration (what the app is) and runtime (how the app runs).

func NewAppContext

func NewAppContext(name string, opts ...ContextOption) *AppContext

NewAppContext creates a new application context with sensible defaults. The only required parameter is the application name; all other fields can be configured via functional options.

func (*AppContext) IdentifierName

func (a *AppContext) IdentifierName() string

IdentifierName returns the application name suitable for programmatic identifiers, replacing hyphens with underscores.

type ContextOption

type ContextOption func(*AppContext)

ContextOption is a functional option for configuring AppContext.

func WithCommitID

func WithCommitID(commitID string) ContextOption

WithCommitID sets the git commit ID.

func WithLongDescription

func WithLongDescription(long string) ContextOption

WithLongDescription sets the long CLI description.

func WithNamespace

func WithNamespace(namespace string) ContextOption

WithNamespace sets the default installation namespace.

func WithShortDescription

func WithShortDescription(short string) ContextOption

WithShortDescription sets the short CLI description.

func WithVersion

func WithVersion(version string) ContextOption

WithVersion sets the application version.

type IntegrationContext

type IntegrationContext = integrations.IntegrationContext

IntegrationContext provides cluster and installer configuration to a URLProvider without exposing internal types. Implementations are supplied by the framework when calling the provider.

This is a re-export of integrations.IntegrationContext for convenience.

type IntegrationModule

type IntegrationModule struct {
	// Name is the unique name of the integration (e.g., "github", "acs").
	Name string

	// Init creates the integration business logic instance.
	Init func(*slog.Logger, k8s.Interface) integration.Interface

	// Command creates the CLI subcommand for this integration.
	// It receives the application context, run context, and initialized integration wrapper.
	Command func(
		*AppContext,
		*runcontext.RunContext,
		*integration.Integration,
	) SubCommand
}

IntegrationModule defines the contract for a pluggable integration. It encapsulates both the integration business logic (integration.Interface) and the CLI representation (SubCommand).

type Runner

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

Runner controls the "subcommands" workflow from end-to-end, each step of it is executed in the predefined sequence: Complete, Validate and Run.

func NewRunner

func NewRunner(subCmd SubCommand) *Runner

NewRunner completes the informed subcommand with the lifecycle methods.

func (*Runner) Cmd

func (r *Runner) Cmd() *cobra.Command

Cmd exposes the subcommand's cobra command instance.

type SubCommand

type SubCommand interface {
	Cmd() *cobra.Command

	// Complete loads the external dependencies for the subcommand, such as
	// configuration files or checking the Kubernetes API client connectivity.
	Complete(_ []string) error

	// Validate checks the subcommand configuration, asserts the required fields
	// are valid before running the primary action.
	Validate() error

	// Run executes the subcommand "business logic".
	Run() error
}

SubCommand defines the interface for a subcommand, as well the sequence of steps every cobra.Command is expected to follow.

type URLProvider

type URLProvider = integrations.URLProvider

URLProvider supplies URLs (callback for authentication, homepage, webhook). Used with framework.WithURLProvider. Implementations receive an IntegrationContext to derive URLs from cluster/config without importing internal.

This is a re-export of integrations.URLProvider for convenience.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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