model

package
v4.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImageStatusNew      = ImageStatus("new")
	ImageStatusUpdate   = ImageStatus("update")
	ImageStatusUnchange = ImageStatus("unchange")
)

Image status constants

View Source
const (
	RegOptSelectorName  = RegOptSelector("name")
	RegOptSelectorImage = RegOptSelector("image")
)

RegOpt selector constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Cli

type Cli struct {
	Version   kong.VersionFlag
	Cfgfile   string `kong:"name='config',env='CONFIG',help='Diun configuration file.'"`
	Timezone  string `kong:"name='timezone',env='TZ',default='UTC',help='Timezone assigned to Diun.'"`
	LogLevel  string `kong:"name='log-level',env='LOG_LEVEL',default='info',help='Set log level.'"`
	LogJSON   bool   `kong:"name='log-json',env='LOG_JSON',default='false',help='Enable JSON logging output.'"`
	LogCaller bool   `kong:"name='log-caller',env='LOG_CALLER',default='false',help='Add file:line of the caller to log output.'"`
	TestNotif bool   `kong:"name='test-notif',default='false',help='Test notification settings.'"`
}

Cli holds command line args, flags and cmds

type Db

type Db struct {
	Path string `yaml:"path,omitempty" json:"path,omitempty" validate:"required"`
}

Db holds data necessary for database configuration

func (*Db) GetDefaults

func (s *Db) GetDefaults() *Db

GetDefaults gets the default values

func (*Db) SetDefaults

func (s *Db) SetDefaults()

SetDefaults sets the default values

type Image

type Image struct {
	Name        string        `yaml:"name,omitempty" json:",omitempty"`
	Platform    ImagePlatform `yaml:"platform,omitempty" json:",omitempty"`
	RegOpt      string        `yaml:"regopt,omitempty" json:",omitempty"`
	WatchRepo   bool          `yaml:"watch_repo,omitempty" json:",omitempty"`
	MaxTags     int           `yaml:"max_tags,omitempty" json:",omitempty"`
	IncludeTags []string      `yaml:"include_tags,omitempty" json:",omitempty"`
	ExcludeTags []string      `yaml:"exclude_tags,omitempty" json:",omitempty"`
	HubTpl      string        `yaml:"hub_tpl,omitempty" json:",omitempty"`
}

Image holds image configuration

type ImagePlatform

type ImagePlatform struct {
	Os      string `yaml:"os,omitempty" json:",omitempty"`
	Arch    string `yaml:"arch,omitempty" json:",omitempty"`
	Variant string `yaml:"variant,omitempty" json:",omitempty"`
}

ImagePlatform holds image platform configuration

type ImageStatus

type ImageStatus string

ImageStatus holds Docker image status analysis

type Job

type Job struct {
	Provider   string
	Image      Image
	RegImage   registry.Image
	Registry   *registry.Client
	FirstCheck bool
}

Job holds job configuration

type Meta

type Meta struct {
	ID        string
	Name      string
	Desc      string
	URL       string
	Author    string
	Version   string
	UserAgent string
	Hostname  string
}

Meta holds application details

type Notif

type Notif struct {
	Amqp       *NotifAmqp       `yaml:"amqp,omitempty" json:"amqp,omitempty"`
	Discord    *NotifDiscord    `yaml:"discord,omitempty" json:"discord,omitempty"`
	Gotify     *NotifGotify     `yaml:"gotify,omitempty" json:"gotify,omitempty"`
	Mail       *NotifMail       `yaml:"mail,omitempty" json:"mail,omitempty"`
	RocketChat *NotifRocketChat `yaml:"rocketchat,omitempty" json:"rocketchat,omitempty"`
	Script     *NotifScript     `yaml:"script,omitempty" json:"script,omitempty"`
	Slack      *NotifSlack      `yaml:"slack,omitempty" json:"slack,omitempty"`
	Teams      *NotifTeams      `yaml:"teams,omitempty" json:"teams,omitempty"`
	Telegram   *NotifTelegram   `yaml:"telegram,omitempty" json:"telegram,omitempty"`
	Webhook    *NotifWebhook    `yaml:"webhook,omitempty" json:"webhook,omitempty"`
}

Notif holds data necessary for notification configuration

func (*Notif) GetDefaults

func (s *Notif) GetDefaults() *Notif

GetDefaults gets the default values

func (*Notif) SetDefaults

func (s *Notif) SetDefaults()

SetDefaults sets the default values

type NotifAmqp

type NotifAmqp struct {
	Username     string `yaml:"username,omitempty" json:"username,omitempty" validate:"omitempty"`
	UsernameFile string `yaml:"usernameFile,omitempty" json:"usernameFile,omitempty" validate:"omitempty,file"`
	Password     string `yaml:"password,omitempty" json:"password,omitempty" validate:"omitempty"`
	PasswordFile string `yaml:"passwordFile,omitempty" json:"passwordFile,omitempty" validate:"omitempty,file"`
	Host         string `yaml:"host,omitempty" json:"host,omitempty" validate:"required"`
	Port         int    `yaml:"port,omitempty" json:"port,omitempty" validate:"required,min=1"`
	Queue        string `yaml:"queue,omitempty" json:"queue,omitempty" validate:"required"`
	Exchange     string `yaml:"exchange,omitempty" json:"exchange,omitempty" validate:"omitempty"`
}

NotifAmqp holds amqp notification configuration details

func (*NotifAmqp) GetDefaults

func (s *NotifAmqp) GetDefaults() *NotifAmqp

GetDefaults gets the default values

func (*NotifAmqp) SetDefaults

func (s *NotifAmqp) SetDefaults()

SetDefaults sets the default values

type NotifDiscord added in v4.1.0

type NotifDiscord struct {
	WebhookURL string         `yaml:"webhookURL,omitempty" json:"webhookURL,omitempty" validate:"required"`
	Timeout    *time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty" validate:"required"`
}

NotifDiscord holds Discord notification configuration details

func (*NotifDiscord) GetDefaults added in v4.1.0

func (s *NotifDiscord) GetDefaults() *NotifDiscord

GetDefaults gets the default values

func (*NotifDiscord) SetDefaults added in v4.1.0

func (s *NotifDiscord) SetDefaults()

SetDefaults sets the default values

type NotifEntry

type NotifEntry struct {
	Status   ImageStatus       `json:"status,omitempty"`
	Provider string            `json:"provider,omitempty"`
	Image    registry.Image    `json:"image,omitempty"`
	Manifest registry.Manifest `json:"manifest,omitempty"`
}

NotifEntry represents a notification entry

type NotifGotify

type NotifGotify struct {
	Endpoint string         `yaml:"endpoint,omitempty" json:"endpoint,omitempty" validate:"required"`
	Token    string         `yaml:"token,omitempty" json:"token,omitempty" validate:"required"`
	Priority int            `yaml:"priority,omitempty" json:"priority,omitempty" validate:"omitempty,min=0"`
	Timeout  *time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty" validate:"required"`
}

NotifGotify holds gotify notification configuration details

func (*NotifGotify) GetDefaults

func (s *NotifGotify) GetDefaults() *NotifGotify

GetDefaults gets the default values

func (*NotifGotify) SetDefaults

func (s *NotifGotify) SetDefaults()

SetDefaults sets the default values

type NotifMail

type NotifMail struct {
	Host               string `yaml:"host,omitempty" json:"host,omitempty" validate:"required"`
	Port               int    `yaml:"port,omitempty" json:"port,omitempty" validate:"required,min=1"`
	SSL                *bool  `yaml:"ssl,omitempty" json:"ssl,omitempty" validate:"required"`
	InsecureSkipVerify *bool  `yaml:"insecureSkipVerify,omitempty" json:"insecureSkipVerify,omitempty" validate:"required"`
	Username           string `yaml:"username,omitempty" json:"username,omitempty" validate:"omitempty"`
	UsernameFile       string `yaml:"usernameFile,omitempty" json:"usernameFile,omitempty" validate:"omitempty,file"`
	Password           string `yaml:"password,omitempty" json:"password,omitempty" validate:"omitempty"`
	PasswordFile       string `yaml:"passwordFile,omitempty" json:"passwordFile,omitempty" validate:"omitempty,file"`
	From               string `yaml:"from,omitempty" json:"from,omitempty" validate:"required,email"`
	To                 string `yaml:"to,omitempty" json:"to,omitempty" validate:"required,email"`
}

NotifMail holds mail notification configuration details

func (*NotifMail) GetDefaults

func (s *NotifMail) GetDefaults() *NotifMail

GetDefaults gets the default values

func (*NotifMail) SetDefaults

func (s *NotifMail) SetDefaults()

SetDefaults sets the default values

type NotifRocketChat

type NotifRocketChat struct {
	Endpoint string         `yaml:"endpoint,omitempty" json:"endpoint,omitempty" validate:"required"`
	Channel  string         `yaml:"channel,omitempty" json:"channel,omitempty" validate:"required"`
	UserID   string         `yaml:"userID,omitempty" json:"userID,omitempty" validate:"required"`
	Token    string         `yaml:"token,omitempty" json:"token,omitempty" validate:"required"`
	Timeout  *time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty" validate:"required"`
}

NotifRocketChat holds Rocket.Chat notification configuration details

func (*NotifRocketChat) GetDefaults

func (s *NotifRocketChat) GetDefaults() *NotifRocketChat

GetDefaults gets the default values

func (*NotifRocketChat) SetDefaults

func (s *NotifRocketChat) SetDefaults()

SetDefaults sets the default values

type NotifScript

type NotifScript struct {
	Cmd  string   `yaml:"cmd,omitempty" json:"cmd,omitempty" validate:"required"`
	Args []string `yaml:"args,omitempty" json:"args,omitempty" validate:"omitempty"`
	Dir  string   `yaml:"dir,omitempty" json:"dir,omitempty" validate:"omitempty,dir"`
}

NotifScript holds script notification configuration details

func (*NotifScript) GetDefaults

func (s *NotifScript) GetDefaults() *NotifScript

GetDefaults gets the default values

func (*NotifScript) SetDefaults

func (s *NotifScript) SetDefaults()

SetDefaults sets the default values

type NotifSlack

type NotifSlack struct {
	WebhookURL string `yaml:"webhookURL,omitempty" json:"webhookURL,omitempty" validate:"required"`
}

NotifSlack holds slack notification configuration details

func (*NotifSlack) GetDefaults

func (s *NotifSlack) GetDefaults() *NotifSlack

GetDefaults gets the default values

func (*NotifSlack) SetDefaults

func (s *NotifSlack) SetDefaults()

SetDefaults sets the default values

type NotifTeams

type NotifTeams struct {
	WebhookURL string `yaml:"webhookURL,omitempty" json:"webhookURL,omitempty" validate:"required"`
}

NotifTeams holds Teams notification configuration details

func (*NotifTeams) GetDefaults

func (s *NotifTeams) GetDefaults() *NotifTeams

GetDefaults gets the default values

func (*NotifTeams) SetDefaults

func (s *NotifTeams) SetDefaults()

SetDefaults sets the default values

type NotifTelegram

type NotifTelegram struct {
	Token   string  `yaml:"token,omitempty" json:"token,omitempty" validate:"required"`
	ChatIDs []int64 `yaml:"chatIDs,omitempty" json:"chatIDs,omitempty" validate:"required"`
}

NotifTelegram holds Telegram notification configuration details

func (*NotifTelegram) GetDefaults

func (s *NotifTelegram) GetDefaults() *NotifTelegram

GetDefaults gets the default values

func (*NotifTelegram) SetDefaults

func (s *NotifTelegram) SetDefaults()

SetDefaults sets the default values

type NotifWebhook

type NotifWebhook struct {
	Endpoint string            `yaml:"endpoint,omitempty" json:"endpoint,omitempty" validate:"required"`
	Method   string            `yaml:"method,omitempty" json:"method,omitempty" validate:"required"`
	Headers  map[string]string `yaml:"headers,omitempty" json:"headers,omitempty" validate:"omitempty"`
	Timeout  *time.Duration    `yaml:"timeout,omitempty" json:"timeout,omitempty" validate:"required"`
}

NotifWebhook holds webhook notification configuration details

func (*NotifWebhook) GetDefaults

func (s *NotifWebhook) GetDefaults() *NotifWebhook

GetDefaults gets the default values

func (*NotifWebhook) SetDefaults

func (s *NotifWebhook) SetDefaults()

SetDefaults sets the default values

type PrdDocker

type PrdDocker struct {
	Endpoint       string `yaml:"endpoint" json:"endpoint,omitempty" validate:"omitempty"`
	APIVersion     string `yaml:"apiVersion" json:"apiVersion,omitempty" validate:"omitempty"`
	TLSCertsPath   string `yaml:"tlsCertsPath" json:"tlsCertsPath,omitempty" validate:"omitempty"`
	TLSVerify      *bool  `yaml:"tlsVerify" json:"tlsVerify,omitempty" validate:"required"`
	WatchByDefault *bool  `yaml:"watchByDefault" json:"watchByDefault,omitempty" validate:"required"`
	WatchStopped   *bool  `yaml:"watchStopped" json:"watchStopped,omitempty" validate:"required"`
}

PrdDocker holds docker provider configuration

func (*PrdDocker) GetDefaults

func (s *PrdDocker) GetDefaults() *PrdDocker

GetDefaults gets the default values

func (*PrdDocker) SetDefaults

func (s *PrdDocker) SetDefaults()

SetDefaults sets the default values

type PrdFile

type PrdFile struct {
	Filename  string `yaml:"filename,omitempty" json:"filename,omitempty" validate:"omitempty,file"`
	Directory string `yaml:"directory,omitempty" json:"directory,omitempty" validate:"omitempty,dir"`
}

PrdFile holds file provider configuration

func (*PrdFile) GetDefaults

func (s *PrdFile) GetDefaults() *PrdFile

GetDefaults gets the default values

func (*PrdFile) SetDefaults

func (s *PrdFile) SetDefaults()

SetDefaults sets the default values

type PrdKubernetes

type PrdKubernetes struct {
	Endpoint         string   `yaml:"endpoint" json:"endpoint,omitempty" validate:"omitempty"`
	Token            string   `yaml:"token,omitempty" json:"token,omitempty" validate:"omitempty"`
	TokenFile        string   `yaml:"tokenFile,omitempty" json:"tokenFile,omitempty" validate:"omitempty,file"`
	CertAuthFilePath string   `yaml:"certAuthFilePath" json:"certAuthFilePath,omitempty" validate:"omitempty"`
	TLSInsecure      *bool    `yaml:"tlsInsecure" json:"tlsInsecure,omitempty" validate:"required"`
	Namespaces       []string `yaml:"namespaces" json:"namespaces,omitempty" validate:"omitempty"`
	WatchByDefault   *bool    `yaml:"watchByDefault" json:"watchByDefault,omitempty" validate:"required"`
}

PrdKubernetes holds kubernetes provider configuration

func (*PrdKubernetes) GetDefaults

func (s *PrdKubernetes) GetDefaults() *PrdKubernetes

GetDefaults gets the default values

func (*PrdKubernetes) SetDefaults

func (s *PrdKubernetes) SetDefaults()

SetDefaults sets the default values

type PrdSwarm

type PrdSwarm struct {
	Endpoint       string `yaml:"endpoint,omitempty" json:"endpoint,omitempty" validate:"omitempty"`
	APIVersion     string `yaml:"apiVersion,omitempty" json:"apiVersion,omitempty" validate:"omitempty"`
	TLSCertsPath   string `yaml:"tlsCertsPath,omitempty" json:"tlsCertsPath,omitempty" validate:"omitempty"`
	TLSVerify      *bool  `yaml:"tlsVerify,omitempty" json:"tlsVerify,omitempty" validate:"required"`
	WatchByDefault *bool  `yaml:"watchByDefault,omitempty" json:"watchByDefault,omitempty" validate:"required"`
}

PrdSwarm holds swarm provider configuration

func (*PrdSwarm) GetDefaults

func (s *PrdSwarm) GetDefaults() *PrdSwarm

GetDefaults gets the default values

func (*PrdSwarm) SetDefaults

func (s *PrdSwarm) SetDefaults()

SetDefaults sets the default values

type Providers

type Providers struct {
	Docker     *PrdDocker     `yaml:"docker,omitempty" json:"docker,omitempty" label:"allowEmpty" file:"allowEmpty"`
	Swarm      *PrdSwarm      `yaml:"swarm,omitempty" json:"swarm,omitempty" label:"allowEmpty" file:"allowEmpty"`
	Kubernetes *PrdKubernetes `yaml:"kubernetes,omitempty" json:"kubernetes,omitempty" label:"allowEmpty" file:"allowEmpty"`
	File       *PrdFile       `yaml:"file,omitempty" json:"file,omitempty"`
}

Providers represents a provider configuration

func (*Providers) GetDefaults

func (s *Providers) GetDefaults() *Providers

GetDefaults gets the default values

func (*Providers) SetDefaults

func (s *Providers) SetDefaults()

SetDefaults sets the default values

type RegOpt

type RegOpt struct {
	Name         string         `yaml:"name,omitempty" json:"name,omitempty" validate:"required"`
	Selector     RegOptSelector `yaml:"selector,omitempty" json:"selector,omitempty" validate:"required,oneof=name image"`
	Username     string         `yaml:"username,omitempty" json:"username,omitempty" validate:"omitempty"`
	UsernameFile string         `yaml:"usernameFile,omitempty" json:"usernameFile,omitempty" validate:"omitempty,file"`
	Password     string         `yaml:"password,omitempty" json:"password,omitempty" validate:"omitempty"`
	PasswordFile string         `yaml:"passwordFile,omitempty" json:"passwordFile,omitempty" validate:"omitempty,file"`
	InsecureTLS  *bool          `yaml:"insecureTLS,omitempty" json:"insecureTLS,omitempty" validate:"required"`
	Timeout      *time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty" validate:"required"`
}

RegOpt holds registry options configuration

func (*RegOpt) GetDefaults

func (s *RegOpt) GetDefaults() *RegOpt

GetDefaults gets the default values

func (*RegOpt) SetDefaults

func (s *RegOpt) SetDefaults()

SetDefaults sets the default values

type RegOptSelector

type RegOptSelector string

RegOptSelector holds registry options selector

type RegOpts

type RegOpts []RegOpt

RegOpts holds slice of registry options

func (*RegOpts) Select

func (s *RegOpts) Select(name string, image registry.Image) (*RegOpt, error)

Select returns a registry based on its selector

type Watch

type Watch struct {
	Workers         int    `yaml:"workers,omitempty" json:"workers,omitempty" validate:"required,min=1"`
	Schedule        string `yaml:"schedule,omitempty" json:"schedule,omitempty" validate:"required"`
	FirstCheckNotif *bool  `yaml:"firstCheckNotif,omitempty" json:"firstCheckNotif,omitempty" validate:"required"`
}

Watch holds data necessary for watch configuration

func (*Watch) GetDefaults

func (s *Watch) GetDefaults() *Watch

GetDefaults gets the default values

func (*Watch) SetDefaults

func (s *Watch) SetDefaults()

SetDefaults sets the default values

Jump to

Keyboard shortcuts

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