Documentation
¶
Index ¶
- Constants
- Variables
- func APIError(err error) error
- func AddOptFormat(cmd *cobra.Command, p *string)
- func CheckUpdate() (string, error)
- func Debugf(format string, v ...interface{})
- func PrintUsers(users []iam.User, outputType string, single bool) error
- func ReadPassword(confirm bool) (string, error)
- func YesNo(prompt string, yesDefault bool) (bool, error)
- type CmdFactory
- type UserClaims
Constants ¶
View Source
const ( // TableDateFormat is the date format used for table output TableDateFormat = "2006-01-02 15:04:05" // DateOnlyFormat is a date format only containing the date DateOnlyFormat = "2006-01-02" // UpdateRepo is the repository to check for updates on UpdateRepo = "netsoc/cli" )
Variables ¶
View Source
var ( // ErrPasswordMismatch indicates that a user entered two different passwords ErrPasswordMismatch = errors.New("passwords didn't match") )
View Source
var IsDebug bool
IsDebug determines if debugging is enabled
Functions ¶
func AddOptFormat ¶ added in v0.1.0
AddOptFormat adds the output format option to a command
func CheckUpdate ¶ added in v0.1.0
CheckUpdate checks to see if a new version is available
func Debugf ¶
func Debugf(format string, v ...interface{})
Debugf prints log messages only if debugging is enabled
func PrintUsers ¶ added in v0.1.0
PrintUsers renders a list of users (with various output options)
func ReadPassword ¶
ReadPassword reads a password from stdin
Types ¶
type CmdFactory ¶
type CmdFactory struct {
Config func() (*config.Config, error)
Claims func() (*UserClaims, error)
IAMClient func() (*iam.APIClient, error)
}
CmdFactory provides methods to obtain commonly used structures
func NewDefaultCmdFactory ¶
func NewDefaultCmdFactory(configFlag, debugFlag *pflag.Flag) *CmdFactory
NewDefaultCmdFactory creates a new command factory
type UserClaims ¶
type UserClaims struct {
jwt.StandardClaims
IsAdmin bool `json:"is_admin"`
Version uint `json:"version"`
}
UserClaims represents claims in an auth JWT
Click to show internal directories.
Click to hide internal directories.