controller

package
v0.0.0-...-c835c4b Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

CORSMiddleware sets CORS policy

func FindUser

func FindUser(key string, value string) (model.User, error)

FindUser queries collection users for user information

func Graph

func Graph() map[string]interface{}

func Login

func Login(c *gin.Context) string

Login handles user input for login

func NewHandler

func NewHandler(c *Config)

NewHandler initializes the handler with required injected services along with http routes Does not return as it deals directly with a reference to the gin Engine

func SaveUser

func SaveUser(username string, email string, encodedPass string, fullname string, department string, role string) error

SaveUser writes a new user information to collection

func SendToQueue

func SendToQueue(body []byte)

SendToQueue - Send POST data to RabbitMQ

func SignUp

func SignUp(c *gin.Context) (string, error)

SignUp handles user input for signup

func Today

func Today() int

func Total

func Total() int

func ValidateMongoConnection

func ValidateMongoConnection()

ValidateMongoConnection makes sure that the connection to Mongo works

func ValidateRabbitMQConnection

func ValidateRabbitMQConnection() bool

ValidateRabbitMQConnection makes a connection to RabbitMQ

Types

type Config

type Config struct {
	R *gin.Engine
}

Config will hold services that will eventually be injected into this handler layer on handler initialization

type Handler

type Handler struct{}

Handler struct holds required services for handler to function

func (*Handler) HandleLoadState

func (h *Handler) HandleLoadState(c *gin.Context)

HandleLoadState returns all stored data in DB

func (*Handler) HandleLogin

func (h *Handler) HandleLogin(c *gin.Context)

HandleLogin authenticates users

func (*Handler) HandlePing

func (h *Handler) HandlePing(c *gin.Context)

HandlePing handles /ping

func (*Handler) HandlePublish

func (h *Handler) HandlePublish(c *gin.Context)

HandlePublish handles incoming requests

func (*Handler) HandleSignup

func (h *Handler) HandleSignup(c *gin.Context)

HandleSignup authenticates users

func (*Handler) HandleStatistic

func (h *Handler) HandleStatistic(c *gin.Context)

HandleStatistic handles today's

func (*Handler) Healthz

func (h *Handler) Healthz(c *gin.Context)

Healthz returns /healthz status

func (*Handler) Livez

func (h *Handler) Livez(c *gin.Context)

Livez returns /livez status

func (*Handler) Readyz

func (h *Handler) Readyz(c *gin.Context)

Readyz returns /readyz status

type State

type State struct {
	ID       primitive.ObjectID `bson:"_id" json:"id,omitempty"`
	Image    string             `bson:"image" json:"image,omitempty"`
	OldTag   string             `bson:"oldtag" json:"oldtag,omitempty"`
	NewTag   string             `bson:"newtag" json:"newtag,omitempty"`
	Cluster  string             `bson:"cluster" json:"cluster,omitempty"`
	BlobName string             `bson:"blob" json:"blob,omitempty"`
	Time     string             `bson:"time" json:"time,omitempty"`
	Status   string             `bson:"status" json:"status,omitempty"`
	Metadata string             `bson:"metadata" json:"metadata,omitempty"`
}

State structs deployment status

func LoadState

func LoadState() []State

LoadState loads documents from MongoDB

func RegexFind

func RegexFind(pattern string) []State

RegexFind loads documents using regex

Jump to

Keyboard shortcuts

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