cli

package
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package cli holds commands for accounts command.

Package cli holds commands for accounts command.

Index

Constants

View Source
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

View Source
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

func PopulateNewPassword(ctx context.Context) (string, error)

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

func PopulatePassword(ctx context.Context) (string, error)

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

func PopulateUsername(ctx context.Context) (string, error)

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

func ValidatePassword(password string) error

ValidatePassword validates the provided password.

func ValidateUsername added in v1.5.0

func ValidateUsername(username string) error

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

func (c *Accounts) CreateRSAKeyPair(ctx context.Context) error

CreateRSAKeyPair creates a new RSA key pair for user authentication. New RSA key pair is stored in the Kubernetes secret.

func (*Accounts) Delete added in v1.5.0

func (c *Accounts) Delete(ctx context.Context, username string) error

Delete an existing user account.

func (*Accounts) GetInitAdminPassword added in v1.5.0

func (c *Accounts) GetInitAdminPassword(ctx context.Context) (string, error)

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

func (c *Accounts) WithAccountManager(m accounts.Interface)

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

type ListOptions struct {
	NoHeaders bool
	Columns   []string
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL