Documentation ¶
Index ¶
- Variables
- func GetOsReleaseInfo(ctx context.Context, s system.System) (*osrelease.Info, error)
- func PackageNameFilter(names ...string) func(pkg *Package) bool
- func PackageStateFiler(state PackageState) func(pkg *Package) bool
- type CatCommand
- type ChgrpCommand
- type ChmodCommand
- type ChownCommand
- type Command
- type CommandResult
- type CompositeCommand
- type ExecuteCommandOption
- type ExecuteCommandOptions
- type File
- type FileClient
- type FileClientOpt
- type Folder
- type FolderClient
- type Group
- type GroupClient
- type IdentityInfo
- type InfoClient
- type InputCommand
- type Link
- type LinkClient
- type MkdirCommand
- type Package
- type PackageClient
- type PackageManager
- type PackageMap
- type PackageState
- type PackageVersion
- type Packages
- type ReleaseInfo
- type Service
- type ServiceApplyOption
- type ServiceApplyOptions
- type ServiceClient
- type ServiceGetArgs
- type ServiceStatus
- type ServiceSupervisor
- type SimpleCommand
- type User
- type UserClient
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrFile = typederror.NewRoot("file resource") ErrFileExists = typederror.New("file exists", ErrFile) ErrFileNotFound = typederror.New("file not found", ErrFile) ErrFileUnexpected = typederror.New("unexpected error", ErrFile) )
View Source
var ( ErrFolder = typederror.NewRoot("folder resource") ErrFolderPathExists = typederror.New("folder path exists", ErrFile) ErrFolderNotFound = typederror.New("folder not found", ErrFile) ErrFolderUnexpected = typederror.New("unexpected error", ErrFile) )
View Source
var ( ErrGroup = typederror.NewRoot("group resource") ErrGroupNotFound = typederror.New("group not found", ErrGroup) ErrGroupNameExists = typederror.New("group name exists", ErrGroup) ErrGroupGidExists = typederror.New("group gid exists", ErrGroup) ErrGroupUnexpected = typederror.New("unexpected error", ErrGroup) )
View Source
var ( ErrInfo = typederror.NewRoot("info resource") ErrInfoUnexpected = typederror.New("unexpected error", ErrInfo) )
View Source
var ( ErrLink = typederror.NewRoot("link resource") ErrLinkExists = typederror.New("link exists", ErrLink) ErrLinkNotFound = typederror.New("link not found", ErrLink) ErrLinkUnexpected = typederror.New("unexpected error", ErrLink) )
View Source
var ( ErrApkPackage = typederror.NewRoot("apk package resource") ErrApkPackageManagerNotAvailable = typederror.New("apk not available", ErrApkPackage) ErrApkPackageManager = typederror.New("apk error", ErrApkPackage) ErrApkPackageUnexpected = typederror.New("unexpected error", ErrApkPackage) )
View Source
var ( ErrAptPackage = typederror.NewRoot("apt package resource") ErrAptPackageManagerNotAvailable = typederror.New("apt not available", ErrAptPackage) ErrAptPackageManager = typederror.New("apt error", ErrAptPackage) ErrAptPackageUnexpected = typederror.New("unexpected error", ErrAptPackage) )
View Source
var ( ErrService = typederror.NewRoot("service resource") ErrServiceNotFound = typederror.New("service not found", ErrService) ErrServiceRunlevelNotFound = typederror.New("runlevel not found", ErrService) ErrServiceOperation = typederror.New("failed service operation", ErrService) ErrServiceUnexpected = typederror.New("unexpected error", ErrService) )
View Source
var ( ErrUser = typederror.NewRoot("user resource") ErrUserNotFound = typederror.New("user not found", ErrUser) ErrUserNameExists = typederror.New("user name exists", ErrUser) ErrUserUidExists = typederror.New("user uid exists", ErrUser) ErrUserGroupNotFound = typederror.New("primary group not found", ErrUser) ErrUserUnexpected = typederror.New("unexpected error", ErrUser) )
Functions ¶
func GetOsReleaseInfo ¶
GetOsReleaseInfo returns an osrelease.Info based on the /etc/os-release of the provided system.System
func PackageNameFilter ¶
func PackageStateFiler ¶
func PackageStateFiler(state PackageState) func(pkg *Package) bool
Types ¶
type CatCommand ¶
type CatCommand struct {
Path string
}
func (*CatCommand) Command ¶
func (c *CatCommand) Command() string
type ChgrpCommand ¶
type ChgrpCommand struct { Path string Group string // NoDereference: affect each symbolic link instead of any referenced file NoDereference bool }
func (*ChgrpCommand) Command ¶
func (c *ChgrpCommand) Command() string
type ChmodCommand ¶
func (*ChmodCommand) Command ¶
func (c *ChmodCommand) Command() string
type ChownCommand ¶
type ChownCommand struct { Path string User string Group string // NoDereference: affect each symbolic link instead of any referenced file NoDereference bool }
func (*ChownCommand) Command ¶
func (c *ChownCommand) Command() string
type CommandResult ¶
func ExecuteCommand ¶
func ExecuteCommandWithOptions ¶
func ExecuteCommandWithOptions(ctx context.Context, s system.System, c Command, opts ...ExecuteCommandOption) (*CommandResult, error)
func (*CommandResult) Error ¶
func (c *CommandResult) Error() error
Error returns an error if the CommandResult has a non-negative exit code
func (*CommandResult) StderrString ¶
func (c *CommandResult) StderrString() string
func (*CommandResult) StdoutString ¶
func (c *CommandResult) StdoutString() string
type CompositeCommand ¶
type CompositeCommand []Command
func (CompositeCommand) Command ¶
func (c CompositeCommand) Command() string
type ExecuteCommandOption ¶
type ExecuteCommandOption func(*ExecuteCommandOptions)
func WithStderr ¶
func WithStderr() ExecuteCommandOption
func WithStderrFunc ¶
func WithStderrFunc(f func(writer io.Writer) io.Writer) ExecuteCommandOption
func WithStdout ¶
func WithStdout() ExecuteCommandOption
func WithStdoutFunc ¶
func WithStdoutFunc(f func(writer io.Writer) io.Writer) ExecuteCommandOption
type ExecuteCommandOptions ¶
type ExecuteCommandOptions struct {
// contains filtered or unexported fields
}
type FileClient ¶
type FileClient interface { Get(ctx context.Context, path string) (*File, error) Create(ctx context.Context, f File) error Update(ctx context.Context, f File) error Delete(ctx context.Context, path string) error }
func NewFileClient ¶
func NewFileClient(s system.System, opts ...FileClientOpt) FileClient
type FileClientOpt ¶
type FileClientOpt func(c *fileClient)
func FileClientCompression ¶
func FileClientCompression(enabled bool) FileClientOpt
func FileClientIncludeContent ¶
func FileClientIncludeContent(include bool) FileClientOpt
type FolderClient ¶
type FolderClient interface { Get(ctx context.Context, path string) (*Folder, error) Create(ctx context.Context, folder Folder) error Update(ctx context.Context, folder Folder) error Delete(ctx context.Context, path string) error }
func NewFolderClient ¶
func NewFolderClient(s system.System) FolderClient
type GroupClient ¶
type GroupClient interface { Get(ctx context.Context, gid int) (*Group, error) Create(ctx context.Context, group Group) (int, error) Update(ctx context.Context, group Group) error Delete(ctx context.Context, gid int) error }
func NewGroupClient ¶
func NewGroupClient(s system.System) GroupClient
type InfoClient ¶
type InfoClient interface { GetRelease(ctx context.Context) (*ReleaseInfo, error) GetIdentity(ctx context.Context) (*IdentityInfo, error) }
func NewInfoClient ¶
func NewInfoClient(s system.System) InfoClient
type InputCommand ¶
func NewInputCommand ¶
func NewInputCommand(c string, in io.Reader) InputCommand
type LinkClient ¶
type LinkClient interface { Get(ctx context.Context, path string) (*Link, error) Create(ctx context.Context, l Link) error Update(ctx context.Context, l Link) error Delete(ctx context.Context, path string) error }
func NewLinkClient ¶
func NewLinkClient(s system.System) LinkClient
type MkdirCommand ¶
func (*MkdirCommand) Command ¶
func (c *MkdirCommand) Command() string
type Package ¶
type Package struct { // Manager is an id of the responsible package management system // Supported values are "apk" Manager PackageManager // Name is the name of the package Name string Version PackageVersion State PackageState }
type PackageClient ¶
type PackageClient interface { Get(ctx context.Context) (Packages, error) Apply(ctx context.Context, pkgs Packages) error }
func NewApkPackageClient ¶
func NewApkPackageClient(s system.System) PackageClient
func NewAptPackageClient ¶
func NewAptPackageClient(s system.System) PackageClient
type PackageManager ¶
type PackageManager string
const ApkPackageManager PackageManager = "apk"
const AptPackageManager PackageManager = "apt"
type PackageMap ¶
PackageMap is a map of *Package indexed by package name
func (PackageMap) ToList ¶
func (p PackageMap) ToList() Packages
ToList returns Packages sorted by package name
type PackageState ¶
type PackageState uint8
const ( PackageInstalled PackageState = 0 PackageNotInstalled PackageState = 1 )
type PackageVersion ¶
type Packages ¶
type Packages []*Package
Packages is a list of *Package
func (Packages) ToMap ¶
func (p Packages) ToMap() PackageMap
type ReleaseInfo ¶
type Service ¶
type Service struct { Supervisor ServiceSupervisor Name string Target string Runlevel string Enabled *bool Status *ServiceStatus }
type ServiceApplyOption ¶
type ServiceApplyOption func(*ServiceApplyOptions)
func ServiceReload ¶ added in v0.2.0
func ServiceReload() ServiceApplyOption
ServiceReload is an option for Apply to ensure a service is reloaded
func ServiceRestart ¶ added in v0.2.0
func ServiceRestart() ServiceApplyOption
ServiceRestart is an option for Apply to ensure a service is restarted
type ServiceApplyOptions ¶
type ServiceApplyOptions struct {
// contains filtered or unexported fields
}
type ServiceClient ¶
type ServiceClient interface { Get(ctx context.Context, args ServiceGetArgs) (*Service, error) Apply(ctx context.Context, s Service, opts ...ServiceApplyOption) error }
func NewOpenRcServiceClient ¶
func NewOpenRcServiceClient(s system.System) ServiceClient
func NewSystemdServiceClient ¶
func NewSystemdServiceClient(s system.System) ServiceClient
type ServiceGetArgs ¶
type ServiceStatus ¶
type ServiceStatus string
const ( ServiceStatusStarted ServiceStatus = "started" ServiceStatusStarting ServiceStatus = "starting" ServiceStatusStopped ServiceStatus = "stopped" ServiceStatusStopping ServiceStatus = "stopping" ServiceStatusUndefined ServiceStatus = "undefined" )
func ServiceStatusPtr ¶
func ServiceStatusPtr(s ServiceStatus) *ServiceStatus
func (ServiceStatus) IsPending ¶
func (s ServiceStatus) IsPending() bool
type ServiceSupervisor ¶
type ServiceSupervisor string
const ServiceSupervisorOpenRC ServiceSupervisor = "openrc"
const ServiceSupervisorSystemd ServiceSupervisor = "systemd"
type SimpleCommand ¶
type SimpleCommand string
func (SimpleCommand) Command ¶
func (a SimpleCommand) Command() string
type UserClient ¶
type UserClient interface { Get(ctx context.Context, uid int) (*User, error) Create(ctx context.Context, user User) (int, error) Update(ctx context.Context, user User) error Delete(ctx context.Context, uid int) error }
func NewUserClient ¶
func NewUserClient(s system.System) UserClient
Source Files ¶
Click to show internal directories.
Click to hide internal directories.