Documentation
¶
Index ¶
- Constants
- func CommandPathNames(path CommandPath) []string
- func CommandPathString(path CommandPath) string
- func ContributionID(extensionID string, path CommandPath) string
- func EnsureCompatible(manifest Manifest, cliVersion string) error
- func ExtensionID(publisher, name string) string
- func IsClosedBuiltInRoot(name string) bool
- func IsOpenBuiltInRoot(name string) bool
- func NormalizeAndValidateManifest(manifest *Manifest) error
- func PrintExtensionHelp(w io.Writer, extensionID string, contribution CommandPath) error
- func RegisterCommands(root *cobra.Command, store Store, extensions []Extension) error
- func RegisterInstalledCommands(root *cobra.Command, store Store) error
- func ResolveRuntime(root, command string) (string, error)
- func SplitExtensionID(id string) (string, string, error)
- func ValidateCompatibility(compatibility Compatibility) error
- func ValidateExtensionCommands(root *cobra.Command, ext Extension) error
- func ValidateExtensionID(id string) error
- func ValidateIdentitySegment(field, value string) error
- func ValidateRuntimeCommand(command string) error
- type Argument
- type CommandCache
- type CommandPath
- type Compatibility
- type CompatibilityResult
- type Extension
- type FetchedGitHubSource
- func FetchGitHubReleaseAsset(ctx context.Context, source GitHubSource, tempRoot string) (FetchedGitHubSource, error)
- func FetchGitHubSource(ctx context.Context, source GitHubSource, tempRoot string) (FetchedGitHubSource, error)
- func FetchGitHubSourceClone(ctx context.Context, source GitHubSource, tempRoot string) (FetchedGitHubSource, error)
- type Flag
- type GitHubSource
- type HostContext
- type InstallResult
- type InstallState
- type InstallType
- type InvocationContext
- type JQContext
- type LinkState
- type Manifest
- type MatchedCommandPath
- type OutputContext
- type PackageObservation
- type PathSegment
- type ResolvedContext
- type Runtime
- type RuntimeContext
- type SessionContext
- type SourceState
- type SplitArgsResult
- type Store
- func (s Store) DataDir(id string) (string, error)
- func (s Store) Dispatch(ctx context.Context, streams *iostreams.IOStreams, cfg config.Hook, ...) error
- func (s Store) Get(id string) (Extension, error)
- func (s Store) InstallGitHubSource(sourceRoot string, fetched FetchedGitHubSource, cliVersion string, ...) (InstallResult, error)
- func (s Store) InstallLocal(source, cliVersion string, now time.Time) (InstallResult, error)
- func (s Store) LinkLocal(source, cliVersion string, now time.Time) (Extension, error)
- func (s Store) List() ([]Extension, error)
- func (s Store) ResolveRuntime(ext Extension) (string, error)
- func (s Store) Root() string
- func (s Store) RuntimeDir() string
- func (s Store) TempDir() string
- func (s Store) Uninstall(id string, removeData bool) (UninstallResult, error)
- func (s Store) VerifyInstalledRuntime(ext Extension) (string, error)
- type TrustState
- type UninstallResult
- type UpgradeState
Constants ¶
View Source
const ( SourceTypeLocalPath = "local_path" SourceTypeGitHubSource = "github_source" SourceTypeGitHubReleaseAsset = "github_release_asset" )
View Source
const ( ManifestFileName = "kongctl-extension.yaml" ManifestSchemaV1 = 1 MaxManifestBytes = 256 * 1024 )
View Source
const ( ContextEnvName = "KONGCTL_EXTENSION_CONTEXT" KonnectPATEnvName = "KONGCTL_EXTENSION_KONNECT_PAT" // #nosec G101 MaxDepth = 5 )
Variables ¶
This section is empty.
Functions ¶
func CommandPathNames ¶
func CommandPathNames(path CommandPath) []string
func CommandPathString ¶
func CommandPathString(path CommandPath) string
func ContributionID ¶
func ContributionID(extensionID string, path CommandPath) string
func EnsureCompatible ¶
func ExtensionID ¶
func IsClosedBuiltInRoot ¶
func IsOpenBuiltInRoot ¶
func PrintExtensionHelp ¶
func PrintExtensionHelp(w io.Writer, extensionID string, contribution CommandPath) error
func RegisterCommands ¶
func ResolveRuntime ¶
func ValidateCompatibility ¶
func ValidateCompatibility(compatibility Compatibility) error
func ValidateExtensionID ¶
func ValidateIdentitySegment ¶
func ValidateRuntimeCommand ¶
Types ¶
type CommandCache ¶
type CommandCache struct {
SchemaVersion int `json:"schema_version"`
ID string `json:"id"`
GeneratedAt string `json:"generated_at"`
InstallType InstallType `json:"install_type"`
Manifest Manifest `json:"manifest"`
CommandPaths []CommandPath `json:"command_paths"`
}
type CommandPath ¶
type CommandPath struct {
ID string `json:"id" yaml:"id,omitempty"`
Path []PathSegment `json:"path" yaml:"path"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Usage string `json:"usage,omitempty" yaml:"usage,omitempty"`
Examples []string `json:"examples,omitempty" yaml:"examples,omitempty"`
Args []Argument `json:"args,omitempty" yaml:"args,omitempty"`
Flags []Flag `json:"flags,omitempty" yaml:"flags,omitempty"`
}
type Compatibility ¶
type CompatibilityResult ¶
type CompatibilityResult struct {
Compatible bool
Unknown bool
CurrentVersion string
Constraint string
}
func CheckCompatibility ¶
func CheckCompatibility(manifest Manifest, cliVersion string) (CompatibilityResult, error)
type Extension ¶
type Extension struct {
ID string `json:"id"`
InstallType InstallType `json:"install_type"`
Manifest Manifest `json:"manifest"`
CommandPaths []CommandPath `json:"command_paths"`
PackageDir string `json:"package_dir,omitempty"`
LinkedDir string `json:"linked_dir,omitempty"`
Install *InstallState `json:"install,omitempty"`
Link *LinkState `json:"link,omitempty"`
}
func LoadLocalExtension ¶
func LoadLocalExtension(source string, installType InstallType) (Extension, error)
type FetchedGitHubSource ¶
type FetchedGitHubSource struct {
SourceType string
Dir string
Repository string
URL string
Ref string
ResolvedCommit string
ReleaseTag string
AssetName string
AssetURL string
Cleanup func()
}
func FetchGitHubReleaseAsset ¶
func FetchGitHubReleaseAsset(ctx context.Context, source GitHubSource, tempRoot string) (FetchedGitHubSource, error)
func FetchGitHubSource ¶
func FetchGitHubSource(ctx context.Context, source GitHubSource, tempRoot string) (FetchedGitHubSource, error)
func FetchGitHubSourceClone ¶
func FetchGitHubSourceClone(ctx context.Context, source GitHubSource, tempRoot string) (FetchedGitHubSource, error)
type GitHubSource ¶
func ParseGitHubSource ¶
func ParseGitHubSource(source, ref string) (GitHubSource, bool, error)
func (GitHubSource) CloneURL ¶
func (s GitHubSource) CloneURL() string
func (GitHubSource) Repository ¶
func (s GitHubSource) Repository() string
func (GitHubSource) RepositoryURL ¶
func (s GitHubSource) RepositoryURL() string
type HostContext ¶
type InstallResult ¶
type InstallState ¶
type InstallState struct {
SchemaVersion int `json:"schema_version"`
ID string `json:"id"`
InstalledAt string `json:"installed_at"`
CLIVersion string `json:"cli_version"`
Source SourceState `json:"source"`
ManifestHash string `json:"manifest_hash"`
RuntimeHash string `json:"runtime_hash"`
PackageHash string `json:"package_hash,omitempty"`
RuntimeCommand string `json:"runtime_command"`
Trust TrustState `json:"trust"`
Upgrade UpgradeState `json:"upgrade"`
}
type InstallType ¶
type InstallType string
const ( InstallTypeInstalled InstallType = "installed" InstallTypeLinked InstallType = "linked" )
type InvocationContext ¶
type Manifest ¶
type Manifest struct {
SchemaVersion int `json:"schema_version" yaml:"schema_version"`
Publisher string `json:"publisher" yaml:"publisher"`
Name string `json:"name" yaml:"name"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Runtime Runtime `json:"runtime" yaml:"runtime"`
Compatibility Compatibility `json:"compatibility" yaml:"compatibility,omitempty"`
CommandPaths []CommandPath `json:"command_paths" yaml:"command_paths"`
}
func ParseManifest ¶
type MatchedCommandPath ¶
type OutputContext ¶
type PackageObservation ¶
type PackageObservation struct {
Manifest Manifest `json:"manifest"`
ManifestHash string `json:"manifest_hash"`
RuntimeHash string `json:"runtime_hash"`
PackageHash string `json:"package_hash"`
RuntimeCommand string `json:"runtime_command"`
}
PackageObservation captures the observable package identity shown before a remote executable extension is trusted.
func ObservePackage ¶
func ObservePackage(sourceRoot string) (PackageObservation, error)
ObservePackage computes package identity and integrity hashes without modifying managed extension state.
type PathSegment ¶
type ResolvedContext ¶
type ResolvedContext struct {
Profile string `json:"profile"`
BaseURL string `json:"base_url"`
Output string `json:"output"`
LogLevel string `json:"log_level"`
ColorTheme string `json:"color_theme,omitempty"`
ConfigFile string `json:"config_file"`
ExtensionDataDir string `json:"extension_data_dir"`
AuthMode string `json:"auth_mode"`
AuthSource string `json:"auth_source"`
}
type RuntimeContext ¶
type RuntimeContext struct {
SchemaVersion int `json:"schema_version"`
MatchedCommandPath MatchedCommandPath `json:"matched_command_path"`
Invocation InvocationContext `json:"invocation"`
Resolved ResolvedContext `json:"resolved"`
Output OutputContext `json:"output"`
Host HostContext `json:"host"`
Session SessionContext `json:"session"`
}
func LoadRuntimeContextFromEnv ¶
func LoadRuntimeContextFromEnv() (*RuntimeContext, error)
type SessionContext ¶
type SourceState ¶
type SourceState struct {
Type string `json:"type"`
Path string `json:"path,omitempty"`
Repository string `json:"repository,omitempty"`
URL string `json:"url,omitempty"`
Ref string `json:"ref,omitempty"`
ResolvedCommit string `json:"resolved_commit,omitempty"`
ReleaseTag string `json:"release_tag,omitempty"`
AssetName string `json:"asset_name,omitempty"`
AssetURL string `json:"asset_url,omitempty"`
}
type SplitArgsResult ¶
func SplitExtensionArgs ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func DefaultStore ¶
func (Store) InstallGitHubSource ¶
func (s Store) InstallGitHubSource( sourceRoot string, fetched FetchedGitHubSource, cliVersion string, now time.Time, trustConfirmed bool, ) (InstallResult, error)
func (Store) InstallLocal ¶
func (Store) RuntimeDir ¶
type TrustState ¶
type UninstallResult ¶
type UpgradeState ¶
type UpgradeState struct {
Policy string `json:"policy"`
}
Click to show internal directories.
Click to hide internal directories.