Documentation
¶
Index ¶
- Constants
- func CachePath(path ...string) string
- func DoBasicConnectivityCheck(endpoint string, trustedCertFingerprint string) (api.ExternalConnectivityStatus, *x509.Certificate)
- func FileCopy(source string, dest string) error
- func GetOwnerMode(fInfo os.FileInfo) (os.FileMode, int, int)
- func GetTOFUServerConfig(serverCert *x509.Certificate) *tls.Config
- func IsDebianOrDerivative(osString string) bool
- func IsDir(name string) bool
- func IsRHELOrDerivative(osString string) bool
- func IsSUSEOrDerivative(osString string) bool
- func IsUnixSocket(path string) bool
- func LogPath(path ...string) string
- func RenderTable(w io.Writer, format string, header []string, data [][]string, raw any) error
- func RunConcurrentList[T any](entities []T, f func(T) error) error
- func RunConcurrentMap[K comparable, V any](entities map[K]V, f func(K, V) error) error
- func RunPath(path ...string) string
- func VarPath(path ...string) string
- type Column
- type SortColumnsNaturally
Constants ¶
const ( TableFormatCSV = "csv" TableFormatJSON = "json" TableFormatTable = "table" TableFormatYAML = "yaml" TableFormatCompact = "compact" )
Table list format.
const ( // TableOptionNoHeader hides the table header when possible. TableOptionNoHeader = "noheader" // TableOptionHeader adds header to csv. TableOptionHeader = "header" )
Variables ¶
This section is empty.
Functions ¶
func CachePath ¶
CachePath returns the directory that migration manager should use for caching assets. If MIGRATION_MANAGER_DIR is set, this path is $MIGRATION_MANAGER_DIR/cache, otherwise it is /var/cache/migration-manager.
func DoBasicConnectivityCheck ¶
func DoBasicConnectivityCheck(endpoint string, trustedCertFingerprint string) (api.ExternalConnectivityStatus, *x509.Certificate)
func GetTOFUServerConfig ¶
func GetTOFUServerConfig(serverCert *x509.Certificate) *tls.Config
func IsDebianOrDerivative ¶
func IsRHELOrDerivative ¶
func IsSUSEOrDerivative ¶
func IsUnixSocket ¶
IsUnixSocket returns true if the given path is either a Unix socket or a symbolic link pointing at a Unix socket.
func LogPath ¶
LogPath returns the directory that migration manager should put logs under. If MIGRATION_MANAGER_DIR is set, this path is $MIGRATION_MANAGER_DIR/logs, otherwise it is /var/log.
func RenderTable ¶
RenderTable renders tabular data in various formats.
func RunConcurrentList ¶
RunConcurrentList runs the given function concurrently for each entity in the given list. Any encountered errors will be logged, and when the run finishes, the last encountered error is returned.
func RunConcurrentMap ¶
func RunConcurrentMap[K comparable, V any](entities map[K]V, f func(K, V) error) error
RunConcurrentMap runs the given function concurrently for each entity in the given map. Any encountered errors will be logged, and when the run finishes, the last encountered error is returned.
Types ¶
type Column ¶
type Column struct {
Header string
// DataFunc is a method to retrieve data for this column. The argument to this function will be an element of the
// "data" slice that is passed into RenderSlice.
DataFunc func(any) (string, error)
}
Column represents a single column in a table.
type SortColumnsNaturally ¶
type SortColumnsNaturally [][]string
SortColumnsNaturally represents the type for sorting columns in a natural order from left to right.
func (SortColumnsNaturally) Len ¶
func (a SortColumnsNaturally) Len() int
func (SortColumnsNaturally) Less ¶
func (a SortColumnsNaturally) Less(i, j int) bool
func (SortColumnsNaturally) Swap ¶
func (a SortColumnsNaturally) Swap(i, j int)