models

package
v0.0.0-...-119a651 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	Token string `json:"token"`
}

func NewAccessToken

func NewAccessToken(user User, jwtKey string) (AccessToken, error)

func NewAccessTokenFromCookie

func NewAccessTokenFromCookie(r *http.Request) (AccessToken, error)

func NewAccessTokenFromRequest

func NewAccessTokenFromRequest(r *http.Request) AccessToken

func (AccessToken) Verify

func (a AccessToken) Verify(jwtKey string) error

type Container

type Container struct {
	// the container ID
	Id string `json:"id"`

	// the container name
	Name string `json:"name"`

	// true if it is an pod infra container
	IsInfra bool `json:"is_infra"`

	// true if belongs to a pod, false else
	IsInPod bool `json:"is_in_pod"`

	// ID of the pod it belongs to. "" if standalone
	PodId string `json:"pod_id"`

	// the container IP address in the podman network
	IpAddress string `json:"ip_address"`

	// the port exposed by the container
	// set manually by the user
	ExposedPort int `json:"exposed_port"`

	// the container status
	Status ContainerStatus `json:"state"`
}

func NewContainer

func NewContainer(container *libpod.Container) (*Container, error)

func NewContainerFromRow

func NewContainerFromRow(scan func(dest ...interface{}) error) (Container, error)

func (Container) String

func (c Container) String() string

type ContainerStatus

type ContainerStatus string
const (
	Configured ContainerStatus = "configured"
	Created    ContainerStatus = "created"
	Running    ContainerStatus = "running"
	Stopped    ContainerStatus = "stopped"
	Paused     ContainerStatus = "paused"
	Exited     ContainerStatus = "exited"
	Removing   ContainerStatus = "removing"
	Unknown    ContainerStatus = "unknown"
	BadState   ContainerStatus = "bad_state"
)

func NewContainerStatus

func NewContainerStatus(s string) ContainerStatus

func (ContainerStatus) String

func (p ContainerStatus) String() string

type DomainName

type DomainName struct {
	Name string `json:"name"`
	Live bool   `json:"live"`
}

func NewDomainName

func NewDomainName(scan func(dest ...interface{}) error) (DomainName, error)

type Infra

type Infra struct {
}

func NewInfra

func NewInfra() Infra

func (Infra) GetCpuUsage

func (i Infra) GetCpuUsage(d time.Duration) (float32, error)

func (Infra) GetDiskUsage

func (i Infra) GetDiskUsage() (float32, error)

func (Infra) GetMemUsage

func (i Infra) GetMemUsage() (float32, error)

type InfraLog

type InfraLog struct {
	Timestamp time.Time `json:"timestamp"`

	Cpu    float32 `json:"cpu"`
	Memory float32 `json:"memory"`
	Disk   float32 `json:"disk"`
}

func NewInfraLog

func NewInfraLog(scan func(dest ...interface{}) error) (InfraLog, error)

type LogResponseWriter

type LogResponseWriter struct {
	http.ResponseWriter
	StatusCode int
	Buf        bytes.Buffer
}

https://stackoverflow.com/questions/64243247/go-gorilla-log-each-request-duration-and-status-code

func NewLogResponseWriter

func NewLogResponseWriter(w http.ResponseWriter) *LogResponseWriter

func (*LogResponseWriter) Write

func (w *LogResponseWriter) Write(body []byte) (int, error)

func (*LogResponseWriter) WriteHeader

func (w *LogResponseWriter) WriteHeader(code int)

type NetworkLog

type NetworkLog struct {
	Timestamp time.Time `json:"timestamp"`

	RequestHost   string `json:"request_host"`
	RequestMethod string `json:"request_method"`
	RequestPath   string `json:"request_path"`
	RequestBody   []byte `json:"request_body"`
	RequestArgs   string `json:"request_args"`

	ResponseStatusCode int    `json:"response_status_code"`
	ResponseDuration   int    `json:"response_duration"`
	ResponseBody       []byte `json:"response_body"`
}

func NewNetworkLog

func NewNetworkLog(scan func(dest ...interface{}) error) (NetworkLog, error)

func NewNetworkLogFromRequest

func NewNetworkLogFromRequest(req *http.Request,
	responseCode int, responseDuration time.Duration, responseBody []byte) (NetworkLog, error)

type PodmanPod

type PodmanPod struct {
	Id             string       `json:"id"`
	Name           string       `json:"name"`
	CreatedAt      time.Time    `json:"created_at"`
	InfraContainer *Container   `json:"infra_container"`
	Containers     []*Container `json:"containers"`
}

func NewPodmanPod

func NewPodmanPod(pod *libpod.Pod, infra *Container) (*PodmanPod, error)

type Rule

type Rule struct {
	Id            int    `json:"id"`
	DomainName    string `json:"domain_name"`
	ContainerName string `json:"container_name"`
}

func NewRule

func NewRule(scan func(dest ...interface{}) error) (Rule, error)

func (Rule) String

func (r Rule) String() string

type User

type User struct {
	Name           string `json:"user"`
	HashedPassword string `json:"hashed_password"`
}

func NewUser

func NewUser(scan func(dest ...interface{}) error) (User, error)

Jump to

Keyboard shortcuts

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