Documentation
¶
Index ¶
- Constants
- func ReceiptPath(executable string) string
- type Backend
- type Channel
- type CheckResult
- type Error
- type ErrorKind
- type FileLocker
- type FileReceiptStore
- func (FileReceiptStore) Load(executable string) (InstallReceipt, error)
- func (FileReceiptStore) LoadPrevious(executable string) (InstallReceipt, error)
- func (FileReceiptStore) RemovePrevious(executable string) error
- func (FileReceiptStore) Save(receipt InstallReceipt) error
- func (FileReceiptStore) SavePrevious(receipt InstallReceipt) error
- type GitHubBackendConfig
- type InstallReceipt
- type Installation
- type InstallationResolver
- type Locker
- type Owner
- type Plan
- type PlanAction
- type PortableInstallationResolver
- type ReceiptStore
- type Release
- type ReleaseQuery
- type Request
- type Resolution
- type Result
- type ResultStatus
- type Service
- func (s *Service) Apply(ctx context.Context, plan Plan) (Result, error)
- func (s *Service) Check(ctx context.Context, resolution Resolution) (CheckResult, error)
- func (s *Service) Plan(check CheckResult) (Plan, error)
- func (s *Service) Resolve(ctx context.Context, request Request) (Resolution, error)
- func (s *Service) Rollback(ctx context.Context) (Result, error)
- type SignatureVerifier
Constants ¶
View Source
const Repository = "kaaanata/jetkvm-cli"
Variables ¶
This section is empty.
Functions ¶
func ReceiptPath ¶
Types ¶
type Backend ¶
type Backend interface {
Resolve(context.Context, ReleaseQuery) (Release, error)
Apply(context.Context, Release, string, string) error
ReplaceFromFile(context.Context, string, string, string) error
}
func NewGitHubBackend ¶
func NewGitHubBackend(config GitHubBackendConfig) (Backend, error)
type CheckResult ¶
type CheckResult struct {
Installation Installation `json:"installation"`
Request Request `json:"request"`
Release Release `json:"release"`
Available bool `json:"available"`
Downgrade bool `json:"downgrade,omitzero"`
}
type Error ¶
type ErrorKind ¶
type ErrorKind string
const ( ErrInvalidRequest ErrorKind = "invalid_request" ErrInvalidReceipt ErrorKind = "invalid_install_receipt" ErrReceiptMismatch ErrorKind = "install_receipt_mismatch" ErrUnsupportedOwner ErrorKind = "unsupported_install_owner" ErrReleaseNotFound ErrorKind = "release_not_found" ErrReleaseResolution ErrorKind = "release_resolution_failed" ErrUpdateInProgress ErrorKind = "update_in_progress" ErrChecksumMismatch ErrorKind = "checksum_mismatch" ErrSignatureVerification ErrorKind = "signature_verification_failed" ErrApplyFailed ErrorKind = "update_apply_failed" ErrRollbackFailed ErrorKind = "rollback_failed" )
type FileLocker ¶
type FileLocker struct {
// contains filtered or unexported fields
}
func NewFileLocker ¶
func NewFileLocker(executable string) *FileLocker
type FileReceiptStore ¶
type FileReceiptStore struct{}
func (FileReceiptStore) Load ¶
func (FileReceiptStore) Load(executable string) (InstallReceipt, error)
func (FileReceiptStore) LoadPrevious ¶
func (FileReceiptStore) LoadPrevious(executable string) (InstallReceipt, error)
func (FileReceiptStore) RemovePrevious ¶
func (FileReceiptStore) RemovePrevious(executable string) error
func (FileReceiptStore) Save ¶
func (FileReceiptStore) Save(receipt InstallReceipt) error
func (FileReceiptStore) SavePrevious ¶
func (FileReceiptStore) SavePrevious(receipt InstallReceipt) error
type GitHubBackendConfig ¶
type InstallReceipt ¶
type InstallReceipt struct {
SchemaVersion int `json:"schema_version"`
InstallID string `json:"install_id"`
Owner Owner `json:"owner"`
Executable string `json:"executable"`
Version string `json:"version"`
Repository string `json:"repository"`
Channel Channel `json:"channel"`
InstalledAt time.Time `json:"installed_at"`
}
func NewStandaloneReceipt ¶
func (InstallReceipt) Installation ¶
func (r InstallReceipt) Installation() Installation
func (InstallReceipt) Validate ¶
func (r InstallReceipt) Validate(currentExecutable string) error
type Installation ¶
type InstallationResolver ¶
type InstallationResolver interface {
ResolveInstallation(context.Context) (Installation, error)
}
type Plan ¶
type Plan struct {
Action PlanAction `json:"action"`
Owner Owner `json:"owner"`
CurrentVersion string `json:"current_version"`
TargetVersion string `json:"target_version"`
Executable string `json:"executable"`
Channel Channel `json:"channel"`
Command []string `json:"command,omitempty"`
Release Release `json:"release"`
InstallID string `json:"install_id,omitempty"`
}
type PlanAction ¶
type PlanAction string
const ( ActionNone PlanAction = "none" ActionSelfReplace PlanAction = "self_replace" ActionRequired PlanAction = "action_required" )
type PortableInstallationResolver ¶
type PortableInstallationResolver struct {
Executable string
Receipts ReceiptStore
MissingOwner Owner
Version string
Channel Channel
}
func (PortableInstallationResolver) ResolveInstallation ¶
func (r PortableInstallationResolver) ResolveInstallation(context.Context) (Installation, error)
type ReceiptStore ¶
type ReceiptStore interface {
Load(executable string) (InstallReceipt, error)
Save(InstallReceipt) error
LoadPrevious(executable string) (InstallReceipt, error)
SavePrevious(InstallReceipt) error
RemovePrevious(executable string) error
}
type ReleaseQuery ¶
type Resolution ¶
type Resolution struct {
Installation Installation `json:"installation"`
Request Request `json:"request"`
}
type Result ¶
type Result struct {
Status ResultStatus `json:"status"`
Owner Owner `json:"owner"`
PreviousVersion string `json:"previous_version,omitempty"`
CurrentVersion string `json:"current_version"`
Verified bool `json:"verified,omitzero"`
RollbackAvailable bool `json:"rollback_available,omitzero"`
ActionRequired []string `json:"action_required,omitempty"`
}
type ResultStatus ¶
type ResultStatus string
const ( StatusUpToDate ResultStatus = "up_to_date" StatusActionRequired ResultStatus = "action_required" StatusApplied ResultStatus = "applied" StatusRolledBack ResultStatus = "rolled_back" )
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(installations InstallationResolver, backend Backend, receipts ReceiptStore, locker Locker) (*Service, error)
func (*Service) Check ¶
func (s *Service) Check(ctx context.Context, resolution Resolution) (CheckResult, error)
type SignatureVerifier ¶
func NewSigstoreVerifier ¶
func NewSigstoreVerifier() SignatureVerifier
NewSigstoreVerifier returns the production verifier for JetKVM release checksums. Trust material is loaded from Sigstore's public-good TUF repository for every verification operation so key rotations are honored.
Click to show internal directories.
Click to hide internal directories.