Documentation ¶
Overview ¶
* Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0
Index ¶
- func AddGroup(ctx context.Context, groupName string) error
- func AddUser(ctx context.Context, username, fullname, password string) error
- func AssociateUserToGroup(ctx context.Context, username, groupName string) error
- func BootTime() (bootime time.Time, err error)
- func ConvertError(err error) error
- func ConvertUserGroupError(err error) error
- func DefineSudoCommand(args ...string)
- func DefineUser(ctx context.Context, user *user.User, password string) (err error)
- func DeleteUser(ctx context.Context, user *user.User) (err error)
- func DissociateUserFromGroup(ctx context.Context, username, groupName string) error
- func HasGroup(groupName string) (found bool, err error)
- func HasUser(username string) (found bool, err error)
- func Hostname() (string, error)
- func IsWindows() bool
- func LineSeparator() string
- func NodeName() (nodename string, err error)
- func PlatformInformation() (information string, err error)
- func RemoveGroup(ctx context.Context, groupName string) error
- func RemoveUser(ctx context.Context, username string) error
- func SystemInformation() (information string, err error)
- func Uname() (string, error)
- func UnixLineSeparator() string
- func UpTime() (uptime time.Duration, err error)
- type RAM
- type VirtualMemory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssociateUserToGroup ¶ added in v1.44.0
AssociateUserToGroup adds a user to a group.
func ConvertError ¶ added in v1.18.0
ConvertError converts a platform error into a commonerrors
func ConvertUserGroupError ¶ added in v1.44.0
ConvertUserGroupError converts errors related to users in common errors.
func DefineSudoCommand ¶ added in v1.44.0
func DefineSudoCommand(args ...string)
DefineSudoCommand defines the command to run to be `root` or a user with enough privileges to manage accounts. e.g.
- args="sudo" to run commands as `root`
- args="su", "tom" if `tom` has enough privileges to run the command
- args="gosu", "tom" if `tom` has enough privileges to run the command in a container and `gosu` is installed
func DefineUser ¶ added in v1.44.0
DefineUser adds a new user to the platform
func DeleteUser ¶ added in v1.44.0
DeleteUser removes a user from the platform when the user is specified using a `user.User` structure.
func DissociateUserFromGroup ¶ added in v1.44.1
DissociateUserFromGroup removes a user from a group.
func PlatformInformation ¶
PlatformInformation returns the platform information (equivalent to uname -s).
func RemoveGroup ¶ added in v1.44.0
RemoveGroup removes a group from the platform
func RemoveUser ¶ added in v1.44.0
RemoveUser removes a user from the platform when only the username is known.
func SystemInformation ¶
SystemInformation returns the system information (equivalent to uname -a)
func UnixLineSeparator ¶ added in v1.1.0
func UnixLineSeparator() string
UnixLineSeparator returns the line separator on Unix platform.
Types ¶
type RAM ¶
type RAM interface { // GetTotal returns total amount of RAM on this system GetTotal() uint64 // GetAvailable returns RAM available for programs to allocate GetAvailable() uint64 // GetUsed returns RAM used by programs GetUsed() uint64 // GetUsedPercent returns Percentage of RAM used by programs GetUsedPercent() float64 // GetFree returns kernel's notion of free memory GetFree() uint64 }
type VirtualMemory ¶
type VirtualMemory struct { Total uint64 Available uint64 Used uint64 UsedPercent float64 Free uint64 }
func (*VirtualMemory) GetAvailable ¶
func (m *VirtualMemory) GetAvailable() uint64
func (*VirtualMemory) GetFree ¶
func (m *VirtualMemory) GetFree() uint64
func (*VirtualMemory) GetTotal ¶
func (m *VirtualMemory) GetTotal() uint64
func (*VirtualMemory) GetUsed ¶
func (m *VirtualMemory) GetUsed() uint64
func (*VirtualMemory) GetUsedPercent ¶
func (m *VirtualMemory) GetUsedPercent() float64