Documentation
¶
Overview ¶
Package cli holds commands for accounts command.
Package cli holds commands for accounts command.
Index ¶
- Constants
- Variables
- func PopulateNewPassword(ctx context.Context) (string, error)
- func PopulatePassword(ctx context.Context) (string, error)
- func PopulateUsername(ctx context.Context) (string, error)
- func ValidatePassword(password string) error
- func ValidateUsername(username string) error
- type Accounts
- func (c *Accounts) Create(ctx context.Context, opts CreateOptions) error
- func (c *Accounts) CreateRSAKeyPair(ctx context.Context) error
- func (c *Accounts) Delete(ctx context.Context, username string) error
- func (c *Accounts) GetInitAdminPassword(ctx context.Context) (string, error)
- func (c *Accounts) List(ctx context.Context, opts ListOptions) error
- func (c *Accounts) SetPassword(ctx context.Context, opts SetPasswordOptions) error
- func (c *Accounts) WithAccountManager(m accounts.Interface)
- type Config
- type CreateOptions
- type ListOptions
- type SetPasswordOptions
Constants ¶
const ( // ColumnUser is the column name for the user. ColumnUser = "user" // ColumnCapabilities is the column name for the capabilities. ColumnCapabilities = "capabilities" // ColumnEnabled is the column name for the enabled status. ColumnEnabled = "enabled" )
Variables ¶
var ( // ErrInvalidUsername is returned when the username doesn't match criteria. ErrInvalidUsername = errors.New(strings.ToLower(usernameCriteria)) // ErrInvalidNewPassword is returned when the new password doesn't match criteria. ErrInvalidNewPassword = errors.New(strings.ToLower(passwordCriteria)) )
Functions ¶
func PopulateNewPassword ¶ added in v1.5.0
PopulateNewPassword function to fill the new password. This function shall be called only in cases when there is no other way to obtain new password value. User will be asked to provide the new password and password confirmation in interactive mode.
func PopulatePassword ¶ added in v1.5.0
PopulatePassword function to fill the password. This function shall be called only in cases when there is no other way to obtain password value. User will be asked to provide the password in interactive mode.
func PopulateUsername ¶ added in v1.5.0
PopulateUsername function to fill the username. This function shall be called only in cases when there is no other way to obtain username value. User will be asked to provide the username in interactive mode.
func ValidatePassword ¶ added in v1.5.0
ValidatePassword validates the provided password.
func ValidateUsername ¶ added in v1.5.0
ValidateUsername validates the provided username.
Types ¶
type Accounts ¶ added in v1.5.0
type Accounts struct {
// contains filtered or unexported fields
}
Accounts provides functionality for managing user accounts via the Accounts.
func NewAccounts ¶ added in v1.5.0
func NewAccounts(c Config, l *zap.SugaredLogger) (*Accounts, error)
NewAccounts creates a new Accounts for running accounts commands.
func (*Accounts) Create ¶ added in v1.5.0
func (c *Accounts) Create(ctx context.Context, opts CreateOptions) error
Create a new user account.
func (*Accounts) CreateRSAKeyPair ¶ added in v1.5.0
CreateRSAKeyPair creates a new RSA key pair for user authentication. New RSA key pair is stored in the Kubernetes secret.
func (*Accounts) GetInitAdminPassword ¶ added in v1.5.0
GetInitAdminPassword returns the initial admin password.
func (*Accounts) List ¶ added in v1.5.0
func (c *Accounts) List(ctx context.Context, opts ListOptions) error
List all user accounts in the system.
func (*Accounts) SetPassword ¶ added in v1.5.0
func (c *Accounts) SetPassword(ctx context.Context, opts SetPasswordOptions) error
SetPassword sets the password for an existing account.
func (*Accounts) WithAccountManager ¶ added in v1.5.0
WithAccountManager sets the account manager for the Accounts.
type Config ¶ added in v1.5.0
type Config struct {
// KubeconfigPath is a path to a kubeconfig
KubeconfigPath string
// If set, we will print the pretty output.
Pretty bool
}
Config holds the configuration for the accounts subcommands.
type CreateOptions ¶ added in v1.5.0
type CreateOptions struct {
// Username is the username for the account.
Username string
// Password is the password for the account.
Password string
}
CreateOptions holds options for creating a new user accounts.
type ListOptions ¶
ListOptions holds options for listing user accounts.
type SetPasswordOptions ¶ added in v1.5.0
type SetPasswordOptions struct {
// Username is the username for the account.
Username string
// NewPassword is a new password for the account.
NewPassword string
}
SetPasswordOptions holds options for setting a new password for user accounts.