controllers

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateEnvironmentCommand

type CreateEnvironmentCommand struct {
	TeamName    string `json:"team_name" form:"team_name" validate:"required"`
	ProjectName string `json:"project_name" form:"project_name" validate:"required"`
	Name        string `json:"name" form:"name" validate:"required,min=1,max=255,alphanum,lowercase"`
	Username    string `json:"username" form:"username" validate:"required,min=1,max=255"`
	Password    string `json:"password" form:"password" validate:"required,min=1,max=255"`
}

CreateEnvironmentCommand ...

type CreateProjectCommand

type CreateProjectCommand struct {
	TeamName    string `json:"team_name" form:"team_name" validate:"required"`
	Name        string `json:"name" form:"name" validate:"required,min=1,max=255,alphanum,lowercase"`
	Description string `json:"description" form:"description" validate:"omitempty,min=3,max=2048"`
}

CreateProjectCommand ...

type CreateSnapshotCommand

type CreateSnapshotCommand struct {
	Title       string
	Description string
	StateID     uuid.UUID
}

CreateSnapshotCommand ...

type CreateTeamCommand

type CreateTeamCommand struct {
	// Name is the name of the team.
	Name string `json:"name" form:"name" validate:"required,min=1,max=255,alphanum,lowercase"`
	// Description is the description of the team.
	Description string `json:"description" form:"description"`
}

CreateTeamCommand ...

type DeleteEnvironmentCommand

type DeleteEnvironmentCommand struct {
	TeamName        string `json:"team_name" form:"team_name" validate:"required"`
	ProjectName     string `json:"project_name" form:"project_name" validate:"required"`
	EnvironmentName string `json:"environment_name" form:"environment_name" validate:"required"`
}

DeleteEnvironmentCommand ...

type DeleteProjectCommand

type DeleteProjectCommand struct {
	TeamName    string `json:"team_name" form:"team_name" validate:"required"`
	ProjectName string `json:"project_name" form:"project_name" validate:"required"`
}

DeleteProjectCommand ...

type DeleteTeamCommand

type DeleteTeamCommand struct {
	// TeamName is the name of the team.
	TeamName string `json:"team_name" form:"team_name"`
}

DeleteTeamCommand ...

type EnvironmentController

type EnvironmentController interface {
	// CreateEnvironment ...
	CreateEnvironment(ctx context.Context, cmd CreateEnvironmentCommand) error
	// ListEnvironments ...
	ListEnvironments(ctx context.Context, query ListEnvironmentsQuery) (tables.Results[models.Environment], error)
	// GetEnvironment ...
	GetEnvironment(ctx context.Context, query GetEnvironmentQuery) (models.Environment, error)
	// DeleteEnvironment ...
	DeleteEnvironment(ctx context.Context, cmd DeleteEnvironmentCommand) error
	// ListStates ...
	ListStates(ctx context.Context, query ListStatesQuery) (tables.Results[models.State], error)
}

EnvironmentController ...

type EnvironmentControllerImpl

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

EnvironmentControllerImpl ...

func NewEnvironmentController

func NewEnvironmentController(store dbx.Database[ports.ReadTx, ports.ReadWriteTx]) *EnvironmentControllerImpl

NewEnvironmentController ...

func (*EnvironmentControllerImpl) CreateEnvironment

CreateEnvironment ...

func (*EnvironmentControllerImpl) DeleteEnvironment

DeleteEnvironment ...

func (*EnvironmentControllerImpl) GetEnvironment

GetEnvironment ...

func (*EnvironmentControllerImpl) ListEnvironments

ListEnvironments ...

func (*EnvironmentControllerImpl) ListStates

ListStates ...

type GetEnvironmentQuery

type GetEnvironmentQuery struct {
	TeamName        string `json:"team_name" form:"team_name" validate:"required"`
	ProjectName     string `json:"project_name" form:"project_name" validate:"required"`
	EnvironmentName string `json:"environment_name" form:"environment_name" validate:"required"`
}

GetEnvironmentQuery ...

type GetProjectQuery

type GetProjectQuery struct {
	TeamName    string `json:"team_name" form:"team_name" validate:"required"`
	ProjectName string `json:"project_name" form:"project_name" validate:"required"`
}

GetProjectQuery ...

type GetStateControllerQuery

type GetStateControllerQuery struct {
	// Team is the team of the lock.
	Team string `json:"team" form:"team"`
	// Project is the project of the lock.
	Project string `json:"project" form:"project"`
	// Environment is the environment of the lock.
	Environment string `json:"environment" form:"environment"`
}

GetStateControllerQuery ...

type GetTeamQuery

type GetTeamQuery struct {
	// ID is the ID of the team.
	TeamName string `json:"team_name" form:"team_name"`
}

GetTeamQuery ...

type ListEnvironmentsQuery

type ListEnvironmentsQuery struct {
	TeamName    string `json:"team_name" form:"team_name" validate:"required"`
	ProjectName string `json:"project_name" form:"project_name" validate:"required"`
	Limit       int    `json:"limit" form:"limit" validate:"omitempty,min=1,max=100"`
	Offset      int    `json:"offset" form:"offset" validate:"omitempty,min=0"`
}

ListEnvironmentsQuery ...

type ListProjectsQuery

type ListProjectsQuery struct {
	TeamName string `json:"team_name" form:"team_name" validate:"required"`
	Limit    int    `json:"limit" form:"limit"`
	Offset   int    `json:"offset" form:"offset"`
	Sort     string `json:"sort" form:"sort"`
}

ListProjectsQuery ...

type ListStatesQuery

type ListStatesQuery struct {
	TeamName        string `json:"team_name" form:"team_name" validate:"required"`
	ProjectName     string `json:"project_name" form:"project_name" validate:"required"`
	EnvironmentName string `json:"environment_name" form:"environment_name" validate:"required"`
	Limit           int    `json:"limit" form:"limit" validate:"omitempty,min=1,max=100"`
	Offset          int    `json:"offset" form:"offset" validate:"omitempty,min=0"`
}

ListStatesQuery ...

type ListTeamsQuery

type ListTeamsQuery struct {
	// Limit is the maximum number of teams to return.
	Limit int `json:"limit" form:"limit"`
	// Offset is the number of teams to skip.
	Offset int `json:"offset" form:"offset"`
}

ListTeamsQuery ...

type LockControllerCommand

type LockControllerCommand struct {
	// ID is the ID of the lock.
	ID uuid.UUID `json:"id" form:"id"`
	// Team is the team of the lock.
	Team string `json:"team" form:"team"`
	// Project is the project of the lock.
	Project string `json:"project" form:"project"`
	// Environment is the environment of the lock.
	Environment string `json:"environment" form:"environment"`
	// Info is the info of the lock.
	Info string `json:"info" form:"info"`
	// Operation is the operation of the lock.
	Operation string `json:"operation" form:"operation"`
	// Path is the path of the lock.
	Path string `json:"path" form:"path"`
	// Version is the version of the lock.
	Version string `json:"version" form:"version"`
	// Who is the who of the lock.
	Who string `json:"who" form:"who"`
}

LockControllerCommand ...

type LocksController

type LocksController interface {
	// Lock ...
	Lock(ctx context.Context, cmd LockControllerCommand) error
	// Unlock ...
	Unlock(ctx context.Context, cmd UnlockControllerCommand) error
}

LocksController ...

type LocksControllerImpl

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

LocksControllerImpl is the controller for operators.

func NewLocksController

func NewLocksController(store dbx.Database[ports.ReadTx, ports.ReadWriteTx]) *LocksControllerImpl

NewLocksController returns a new LocksControllerImpl.

func (*LocksControllerImpl) Lock

Lock ...

func (*LocksControllerImpl) Unlock

Unlock ...

type ProjectController

type ProjectController interface {
	// CreateProject ...
	CreateProject(ctx context.Context, cmd CreateProjectCommand) error
	// GetProject ...
	GetProject(ctx context.Context, cmd GetProjectQuery) (models.Project, error)
	// ListProjects ...
	ListProjects(ctx context.Context, cmd ListProjectsQuery) (tables.Results[models.Project], error)
	// DeleteProject ...
	DeleteProject(ctx context.Context, cmd DeleteProjectCommand) error
}

ProjectController ...

type ProjectControllerImpl

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

ProjectControllerImpl ...

func NewProjectController

func NewProjectController(store dbx.Database[ports.ReadTx, ports.ReadWriteTx]) *ProjectControllerImpl

NewProjectController ...

func (*ProjectControllerImpl) CreateProject

func (c *ProjectControllerImpl) CreateProject(ctx context.Context, cmd CreateProjectCommand) error

CreateProject ...

func (*ProjectControllerImpl) DeleteProject

func (c *ProjectControllerImpl) DeleteProject(ctx context.Context, cmd DeleteProjectCommand) error

DeleteProject ...

func (*ProjectControllerImpl) GetProject

GetProject ...

func (*ProjectControllerImpl) ListProjects

ListProjects ...

type SnapshotController

type SnapshotController interface {
	// CreateSnapshot ...
	CreateSnapshot(ctx context.Context, cmd CreateSnapshotCommand) (models.Snapshot, error)
}

SnapshotController ...

type SnapshotControllerImpl

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

SnapshotControllerImpl ...

func NewSnapshotController

func NewSnapshotController(store dbx.Database[ports.ReadTx, ports.ReadWriteTx]) *SnapshotControllerImpl

NewSnapshotController ...

func (*SnapshotControllerImpl) CreateSnapshot

CreateSnapshot ...

type StateController

type StateController interface {
	// GetState ...
	GetState(ctx context.Context, query GetStateControllerQuery) (map[string]interface{}, error)
	// UpdateState ...
	UpdateState(ctx context.Context, cmd UpdateStateControllerCommand) error
}

StateController ...

type StateControllerImpl

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

StateControllerImpl is the controller for the state.

func NewStateController

func NewStateController(store dbx.Database[ports.ReadTx, ports.ReadWriteTx]) *StateControllerImpl

NewStateController returns a new LocksControllerImpl.

func (*StateControllerImpl) GetState

func (c *StateControllerImpl) GetState(ctx context.Context, query GetStateControllerQuery) (map[string]interface{}, error)

GetState ...

func (*StateControllerImpl) UpdateState

UpdateState ...

type TeamController

type TeamController interface {
	// CreateTeam creates a new team.
	CreateTeam(ctx context.Context, cmd CreateTeamCommand) error
	// GetTeam gets a team.
	GetTeam(ctx context.Context, query GetTeamQuery) (models.Team, error)
	// DeleteTeam deletes a team.
	DeleteTeam(ctx context.Context, cmd DeleteTeamCommand) error
	// ListTeams lists teams.
	ListTeams(ctx context.Context, query ListTeamsQuery) (tables.Results[models.Team], error)
}

TeamController ...

type TeamControllerImpl

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

TeamControllerImpl is the controller for teams.

func NewTeamController

func NewTeamController(store dbx.Database[ports.ReadTx, ports.ReadWriteTx]) *TeamControllerImpl

NewTeamController returns a new instance of TeamController.

func (*TeamControllerImpl) CreateTeam

func (c *TeamControllerImpl) CreateTeam(ctx context.Context, cmd CreateTeamCommand) error

CreateTeam creates a new team.

func (*TeamControllerImpl) DeleteTeam

func (c *TeamControllerImpl) DeleteTeam(ctx context.Context, cmd DeleteTeamCommand) error

DeleteTeam deletes a team.

func (*TeamControllerImpl) GetTeam

func (c *TeamControllerImpl) GetTeam(ctx context.Context, query GetTeamQuery) (models.Team, error)

GetTeam gets a team.

func (*TeamControllerImpl) ListTeams

ListTeams lists teams.

type UnlockControllerCommand

type UnlockControllerCommand struct {
	// ID is the ID of the lock.
	ID uuid.UUID `json:"id" form:"id"`
	// Team is the team of the lock.
	Team string `json:"team" form:"team"`
	// Project is the project of the lock.
	Project string `json:"project" form:"project"`
	// Environment is the environment of the lock.
	Environment string `json:"environment" form:"environment"`
}

UnlockControllerCommand ...

type UpdateStateControllerCommand

type UpdateStateControllerCommand struct {
	// Team is the team of the lock.
	Team string `json:"team" form:"team"`
	// Project is the project of the lock.
	Project string `json:"project" form:"project"`
	// Environment is the environment of the lock.
	Environment string `json:"environment" form:"environment"`
	// LockID is the ID of the lock.
	LockID uuid.UUID `json:"lock_id" form:"lock_id"`
	// State is the state of the lock.
	State *map[string]interface{} `json:"state" form:"state"`
}

UpdateStateControllerCommand ...

Jump to

Keyboard shortcuts

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