controllers

package
v0.1.37 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAccountsController

func NewAccountsController(db ports.Repositories) *accountsController

NewAccountsController ...

func NewTeamsController

func NewTeamsController(db ports.Teams) *teamsController

NewTeamsController ...

Types

type AccountsController

type AccountsController interface {
	// CreateAccount creates a new account.
	CreateAccount(ctx context.Context, cmd CreateAccountCommand) (models.Account, error)
	// DeleteToken deletes a token.
	DeleteToken(ctx context.Context, accountID uuid.UUID) error
	// CreateSigningKeyGroup creates a new signing key group.
	CreateSigningKeyGroup(ctx context.Context) (*models.Account, error)
	// ListSigningKeys of an account.
	ListSigningKeys(ctx context.Context, accountID uuid.UUID, pagination models.Pagination[models.NKey]) (models.Pagination[models.NKey], error)
	// ListAccounts ...
	ListAccounts(ctx context.Context, req ListAccountsQuery) (models.Pagination[models.Account], error)
	// GetAccount ...
	GetAccount(ctx context.Context, query GetAccountQuery) (models.Account, error)
	// GetAccountToken ...
	GetAccountToken(ctx context.Context, query GetAccountTokenQuery) (models.Token, error)
}

AccountsController is the interface that wraps the methods to access accounts.

type CreateAccountCommand added in v0.1.15

type CreateAccountCommand struct {
	Name        string    `json:"name"`
	Description string    `json:"description"`
	OperatorID  uuid.UUID `json:"operator_id"`
	TeamID      uuid.UUID `json:"team_id"`
}

CreateAccountCommand ...

type CreateOperatorCommand added in v0.1.15

type CreateOperatorCommand struct {
	Name        string `json:"name" validate:"required,min=3,max=255"`
	Description string `json:"description" validate:"max=1024"`
}

CreateOperatorCommand ...

type CreateOperatorSigningKeyGroupCommand added in v0.1.15

type CreateOperatorSigningKeyGroupCommand struct {
	OperatorID  uuid.UUID `json:"operator_id" validate:"required"`
	Name        string    `json:"name" validate:"required,min=3,max=255"`
	Description string    `json:"description" validate:"max=1024"`
}

CreateOperatorSigningKeyGroupCommand ...

type CreateSystemCommand added in v0.1.15

type CreateSystemCommand struct {
	Name        string    `json:"name" validate:"required,min=3,max=255"`
	Description string    `json:"description" validate:"max=1024"`
	OperatorID  uuid.UUID `json:"operator_id" validate:"required"`
}

CreateSystemCommand ...

type CreateTeamCommand added in v0.1.15

type CreateTeamCommand struct {
	Name        string `json:"name" validate:"required,min=3,max=255"`
	Description string `json:"description" validate:"max=1024"`
}

CreateTeamCommand ...

type CreateUserCommand added in v0.1.15

type CreateUserCommand struct {
	AccountID   uuid.UUID `json:"account_id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
}

CreateUserCommand ...

type DeleteOperatorCommand added in v0.1.15

type DeleteOperatorCommand struct {
	ID uuid.UUID `json:"id" validate:"required"`
}

DeleteOperatorCommand ...

type DeleteSystemCommand added in v0.1.15

type DeleteSystemCommand struct {
	ID uuid.UUID `json:"id" validate:"required"`
}

DeleteSystemCommand ...

type DeleteTeamCommand added in v0.1.15

type DeleteTeamCommand struct {
	ID uuid.UUID `json:"id" validate:"required"`
}

DeleteTeamCommand ...

type DeleteUserCommand added in v0.1.15

type DeleteUserCommand struct {
	UserID uuid.UUID `json:"user_id"`
}

DeleteUserCommand ...

type GetAccountQuery added in v0.1.15

type GetAccountQuery struct {
	AccountID uuid.UUID `json:"account_id"`
}

GetAccountQuery ...

type GetAccountTokenQuery added in v0.1.15

type GetAccountTokenQuery struct {
	AccountID uuid.UUID `json:"account_id"`
}

GetAccountTokenQuery ...

type GetOperatorQuery added in v0.1.15

type GetOperatorQuery struct {
	ID uuid.UUID `json:"id" validate:"required"`
}

GetOperatorQuery ...

type GetOperatorSystemAccountQuery added in v0.1.15

type GetOperatorSystemAccountQuery struct {
	OperatorID uuid.UUID `json:"operator_id" validate:"required"`
}

GetOperatorSystemAccountQuery ...

type GetOperatorTokenQuery added in v0.1.15

type GetOperatorTokenQuery struct {
	ID uuid.UUID `json:"id" validate:"required"`
}

GetOperatorTokenQuery ...

type GetSystemQuery added in v0.1.15

type GetSystemQuery struct {
	ID uuid.UUID `json:"id" validate:"required"`
}

GetSystemQuery ...

type GetTeamQuery added in v0.1.15

type GetTeamQuery struct {
	ID uuid.UUID `json:"id" validate:"required"`
}

GetTeamQuery ...

type GetUserCredentialsQuery added in v0.1.15

type GetUserCredentialsQuery struct {
	UserID uuid.UUID `json:"user_id"`
}

GetUserCredentialsQuery ...

type GetUserQuery added in v0.1.15

type GetUserQuery struct {
	UserID uuid.UUID `json:"user_id"`
}

GetUserQuery ...

type ListAccountsQuery added in v0.1.15

type ListAccountsQuery struct {
	OperatorID uuid.UUID `json:"system_id"`
	Limit      int       `json:"limit"`
	Offset     int       `json:"offset"`
}

ListAccountsQuery ...

type ListOperatorsQuery added in v0.1.15

type ListOperatorsQuery struct {
	Limit  int    `json:"limit" validate:"required"`
	Offset int    `json:"offset" validate:"required"`
	Search string `json:"search"`
	Sort   string `json:"sort"`
}

ListOperatorsQuery ...

type ListSystemsQuery added in v0.1.15

type ListSystemsQuery struct {
	Limit  int    `json:"limit" validate:"required"`
	Offset int    `json:"offset" validate:"required"`
	Search string `json:"search"`
	Sort   string `json:"sort"`
}

ListSystemsQuery ...

type ListTeamsQuery added in v0.1.15

type ListTeamsQuery struct {
	Offset int    `json:"offset" validate:"required"`
	Limit  int    `json:"limit" validate:"required"`
	Sort   string `json:"sort" validate:"required"`
	Search string `json:"search" validate:"required"`
}

ListTeamsQuery ...

type ListUsersQuery added in v0.1.15

type ListUsersQuery struct {
	AccountID uuid.UUID `json:"account_id"`
}

ListUsersQuery ...

type OperatorsController

type OperatorsController interface {
	// CreateOperator creates a new operator.
	CreateOperator(ctx context.Context, cmd CreateOperatorCommand) (models.Operator, error)
	// GetOperator gets an operator.
	GetOperator(ctx context.Context, query GetOperatorQuery) (models.Operator, error)
	// CreateOperatorSigningKeyGroup creates a new signing key group.
	CreateOperatorSigningKeyGroup(ctx context.Context, cmd CreateOperatorSigningKeyGroupCommand) (models.SigningKeyGroup, error)
	// GetOperatorToken gets an operator token.
	GetOperatorToken(ctx context.Context, query GetOperatorTokenQuery) (models.Token, error)
	// ListOperators lists operators.
	ListOperators(ctx context.Context, query ListOperatorsQuery) (models.Pagination[models.Operator], error)
	// DeleteOperator deletes an operator.
	DeleteOperator(ctx context.Context, cmd DeleteOperatorCommand) error
	// UpdateOperatorSystemAccount ...
	UpdateOperatorSystemAccount(ctx context.Context, cmd UpdateOperatorSystemAccountCommand) (models.Account, error)
	// GetOperatorSystemAccount ...
	GetOperatorSystemAccount(ctx context.Context, query GetOperatorSystemAccountQuery) (models.Account, error)
}

OperatorsController is the interface that wraps the methods to access operators.

type OperatorsControllerImpl added in v0.1.15

type OperatorsControllerImpl struct {
	// contains filtered or unexported fields
}

OperatorsControllerImpl is the controller for operators.

func NewOperatorsController

func NewOperatorsController(db ports.Repositories) *OperatorsControllerImpl

NewOperatorsController returns a new OperatorsController.

func (*OperatorsControllerImpl) CreateOperator added in v0.1.15

CreateOperator is the method to create a new operator.

func (*OperatorsControllerImpl) CreateOperatorSigningKeyGroup added in v0.1.15

CreateOperatorSigningKeyGroup ...

func (*OperatorsControllerImpl) DeleteOperator added in v0.1.15

DeleteOperator ...

func (*OperatorsControllerImpl) GetOperator added in v0.1.15

GetOperator ...

func (*OperatorsControllerImpl) GetOperatorSystemAccount added in v0.1.15

func (c *OperatorsControllerImpl) GetOperatorSystemAccount(ctx context.Context, query GetOperatorSystemAccountQuery) (models.Account, error)

GetOperatorSystemAccount ...

func (*OperatorsControllerImpl) GetOperatorToken added in v0.1.15

func (c *OperatorsControllerImpl) GetOperatorToken(ctx context.Context, query GetOperatorTokenQuery) (models.Token, error)

GetOperatorToken ...

func (*OperatorsControllerImpl) ListOperators added in v0.1.15

ListOperators is the method to list operators.

func (*OperatorsControllerImpl) UpdateOperatorSystemAccount added in v0.1.15

UpdateOperatorSystemAccount ...

type SystemsController

type SystemsController interface {
	// CreateSystem creates a new system.
	CreateSystem(ctx context.Context, cmd CreateSystemCommand) (models.System, error)
	// DeleteSystem deletes a system.
	DeleteSystem(ctx context.Context, cmd DeleteSystemCommand) error
	// GetSystem retrieves a system by its ID.
	GetSystem(ctx context.Context, query GetSystemQuery) (models.System, error)
	// ListSystems retrieves a list of systems.
	ListSystems(ctx context.Context, query ListSystemsQuery) (models.Pagination[models.System], error)
}

SystemsController is the controller for systems.

type SystemsControllerImpl added in v0.1.15

type SystemsControllerImpl struct {
	// contains filtered or unexported fields
}

SystemsControllerImpl ...

func NewSystemsController

func NewSystemsController(db ports.Systems) *SystemsControllerImpl

NewSystemsController ...

func (*SystemsControllerImpl) CreateSystem added in v0.1.15

CreateSystem is the implementation of the CreateSystem method.

func (*SystemsControllerImpl) DeleteSystem added in v0.1.15

DeleteSystem is deleting a system.

func (*SystemsControllerImpl) GetSystem added in v0.1.15

GetSystem ...

func (*SystemsControllerImpl) ListSystems added in v0.1.15

ListSystems ...

func (*SystemsControllerImpl) UpdateSystemOperator added in v0.1.15

func (s *SystemsControllerImpl) UpdateSystemOperator(ctx context.Context, systemId, operatorID uuid.UUID) (models.System, error)

UpdateSystemOperator ...

type TeamsController

type TeamsController interface {
	// CreateTeam ...
	CreateTeam(ctx context.Context, cmd CreateTeamCommand) (adapters.GothTeam, error)
	// DeleteTeam ...
	DeleteTeam(ctx context.Context, cmd DeleteTeamCommand) error
	// GetTeam ...
	GetTeam(ctx context.Context, query GetTeamQuery) (adapters.GothTeam, error)
	// ListTeams ...
	ListTeams(ctx context.Context, query ListTeamsQuery) (models.Pagination[adapters.GothTeam], error)
}

TeamsController ...

type UpdateOperatorSystemAccountCommand added in v0.1.15

type UpdateOperatorSystemAccountCommand struct {
	OperatorID uuid.UUID `json:"operator_id" validate:"required"`
	AccountID  uuid.UUID `json:"system_id" validate:"required"`
}

UpdateOperatorSystemAccountCommand ..,

type UsersController

type UsersController interface {
	// CreateUser creates a new user.
	CreateUser(ctx context.Context, cmd CreateUserCommand) (models.User, error)
	// GetCredentials returns the credentials for a user.
	GetCredentials(ctx context.Context, query GetUserCredentialsQuery) ([]byte, error)
	// GetUser retrieves a user by its ID.
	GetUser(ctx context.Context, query GetUserQuery) (models.User, error)
	// ListUsers retrieves a list of users.
	ListUsers(ctx context.Context, query ListUsersQuery) (models.Pagination[models.User], error)
	// DeleteUser deletes a user by its ID.
	DeleteUser(ctx context.Context, cmd DeleteUserCommand) error
}

UsersController is the interface that wraps the methods to access users.

type UsersControllerImpl added in v0.1.15

type UsersControllerImpl struct {
	// contains filtered or unexported fields
}

func NewUsersController

func NewUsersController(db ports.Repositories) *UsersControllerImpl

NewUsersController ...

func (*UsersControllerImpl) CreateUser added in v0.1.15

CreateUser ...

func (*UsersControllerImpl) DeleteUser added in v0.1.15

func (c *UsersControllerImpl) DeleteUser(ctx context.Context, cmd DeleteUserCommand) error

DeleteUser ...

func (*UsersControllerImpl) GetCredentials added in v0.1.15

func (c *UsersControllerImpl) GetCredentials(ctx context.Context, query GetUserCredentialsQuery) ([]byte, error)

GetCredentials ...

func (*UsersControllerImpl) GetUser added in v0.1.15

func (c *UsersControllerImpl) GetUser(ctx context.Context, query GetUserQuery) (models.User, error)

GetUser ...

func (*UsersControllerImpl) ListUsers added in v0.1.15

ListUsers ...

type VersionController

type VersionController struct {
	// contains filtered or unexported fields
}

VersionController ...

func NewVersionController

func NewVersionController(v ports.Build) *VersionController

NewVersionController ...

func (*VersionController) Build

func (c *VersionController) Build() (string, error)

Build ...

func (*VersionController) Date

func (c *VersionController) Date() (string, error)

Date ...

func (*VersionController) Version

func (c *VersionController) Version() (string, error)

Version ...

Jump to

Keyboard shortcuts

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