user

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrUserNotFoundMsg is the error message for ErrUserNotFound error.
	ErrUserNotFoundMsg = "user not found on server side"

	// ErrUserBadRequestMsg is the error message for ErrUserBadRequest error.
	ErrUserBadRequestMsg = "Unsatisfied with constraints of the user creation/modification."

	// ErrUserMismatchMsg is the error message for ErrUserMismatch error.
	ErrUserMismatchMsg = "id/name pair not found on server side"

	// ErrUserAlreadyExistMsg is the error message for ErrUserAlreadyExists error.
	ErrUserAlreadyExistsMsg = "user with this username already exists"

	// ErrUserInvalidIDMsg is the error message for ErrUserInvalidID error.
	ErrUserInvalidIDMsg = "invalid user ID"

	// ErrUserPasswordInvalid  is the error message for ErrUserPasswordInvalid error.
	ErrUserPasswordInvalidMsg = "invalid user password"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	NewUser(ctx context.Context, username, email, realname, password, comments string)
	GetUser(ctx context.Context, username string) (*model.User, error)
	DeleteUser(ctx context.Context, u *model.User) error
	UpdateUser(ctx context.Context, u *model.User) error
	UpdateUserPassword(ctx context.Context, id int64, password *model.Password) error
}

type ErrUserAlreadyExists

type ErrUserAlreadyExists struct{}

ErrUserAlreadyExists describes an error indicating that this user already exists.

func (*ErrUserAlreadyExists) Error

func (e *ErrUserAlreadyExists) Error() string

Error returns the error message.

type ErrUserBadRequest

type ErrUserBadRequest struct{}

ErrUserBadRequest describes a formal error when creating or updating a user (such as bad password).

func (*ErrUserBadRequest) Error

func (e *ErrUserBadRequest) Error() string

Error returns the error message.

type ErrUserInvalidID

type ErrUserInvalidID struct{}

ErrUserInvalidID describes an error indicating an invalid user id.

func (*ErrUserInvalidID) Error

func (e *ErrUserInvalidID) Error() string

Error returns the error message.

type ErrUserMismatch

type ErrUserMismatch struct{}

ErrUserMismatch describes an error when the id and name of a user do not match on server side.

func (*ErrUserMismatch) Error

func (e *ErrUserMismatch) Error() string

Error returns the error message.

type ErrUserNotFound

type ErrUserNotFound struct{}

ErrUserNotFound describes an error when a specific user was not found on server side.

func (*ErrUserNotFound) Error

func (e *ErrUserNotFound) Error() string

Error returns the error message.

type ErrUserPasswordInvalid

type ErrUserPasswordInvalid struct{}

ErrUserPasswordInvalid describes an error indicating an invalid password

func (*ErrUserPasswordInvalid) Error

func (e *ErrUserPasswordInvalid) Error() string

type RESTClient

type RESTClient struct {
	// The swagger client
	Client *client.Harbor

	// AuthInfo contain auth information, which are provided on API calls.
	AuthInfo runtime.ClientAuthInfoWriter
}

RESTClient is a subclient for handling user related actions.

func NewClient

func NewClient(cl *client.Harbor, authInfo runtime.ClientAuthInfoWriter) *RESTClient

func (*RESTClient) DeleteUser

func (c *RESTClient) DeleteUser(ctx context.Context, u *model.User) error

DeleteUser deletes the specified user.

func (*RESTClient) GetUser

func (c *RESTClient) GetUser(ctx context.Context, username string) (*model.User, error)

GetUser returns an existing user or an error in case of failure.

func (*RESTClient) NewUser

func (c *RESTClient) NewUser(ctx context.Context, username, email, realname, password,
	comments string) (*model.User, error)

NewUser creates and returns a new user, or error in case of failure. Username is a unique username. email is the Email of the user. realname is the fullname of the user. password is the password for this user. comments as a comment attached to the user.

func (*RESTClient) UpdateUser

func (c *RESTClient) UpdateUser(ctx context.Context, u *model.User) error

UpdateUser updates a user with the specified data. Note that only realname, email and comment properties are updateable.

func (*RESTClient) UpdateUserPassword

func (c *RESTClient) UpdateUserPassword(ctx context.Context, id int64, password *model.Password) error

UpdateUserPassword updates a users password

func (*RESTClient) UserExists

func (c *RESTClient) UserExists(ctx context.Context, u *model.User) (bool, error)

Jump to

Keyboard shortcuts

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