util

package
v0.0.0-...-d8b2627 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: GPL-3.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// TimeLayout is the layout which must follow all time strings stored to and retrieved from database.
	// It can be used with time.ParseInLocation() and time.Format(). Such time strings are perfectly comparable.
	// As they don't contain any time zone information, it should be always parsed with time.Local.
	// So, each time value inside gafaspot are interpreted in the local time zone of the running server.
	TimeLayout = "2006-01-02 15:04"

	// SecEngTypeAD is the type for Active Directory Secrets Engine.
	SecEngTypeAD = "ad"
	// SecEngTypeDB is the type for Database Secrets Engine.
	SecEngTypeDB = "database"
	// SecEngTypeOntap is the type for Ontap Secrets Engine.
	SecEngTypeOntap = "ontap"
	// SecEngTypeSSHPubkey is the type for SSH-Pubkey Secrets Engine.
	SecEngTypeSSHPubkey = "ssh-pubkey"
	// SecEngTypeSSH is the type for SSH Secrets Engine.
	SecEngTypeSSH = "ssh"
)

Variables

This section is empty.

Functions

func CreatePlainIdentifier

func CreatePlainIdentifier(name string) string

CreatePlainIdentifier replaces all characters which are not ascii letters oder numbers through an underscore

Types

type Environment

type Environment struct {
	NiceName    string
	PlainName   string
	HasSSH      bool
	Description template.HTML
}

Environment is a struct to store the information of one row from database table environments. The Description is of type template.HTML, as this type will not be escaped when served with a golang http.Template. This enables the gafaspot config writer to put some HTML code inside the descriptions for the environments.

type EnvironmentConfig

type EnvironmentConfig struct {
	NiceName       string                `mapstructure:"show-name"`
	Description    string                //`yaml:"description"`
	SecretsEngines []SecretsEngineConfig `mapstructure:"secrets-engines"`
}

EnvironmentConfig is a struct to load information about one environment from config file.

type GafaspotConfig

type GafaspotConfig struct {
	WebserviceAddress   string                       `mapstructure:"webservice-address"`
	DisableMlock        bool                         `mapstructure:"disable_mlock"`
	Mailserver          string                       `mapstructure:"mailserver"`
	GafaspotMailAddress string                       `mapstructure:"gafaspot-mailaddress"`
	ScanningInterval    string                       `mapstructure:"scanning-interval"`
	MaxBookingDays      int                          `mapstructure:"max-reservation-duration-days"`
	MaxQueuingMonths    int                          `mapstructure:"max-queuing-time-months"`
	Database            string                       `mapstructure:"db-path"`
	DBTTLmonths         int                          `mapstructure:"database-ttl-months"`
	VaultAddress        string                       `mapstructure:"vault-address"`
	ApproleID           string                       `mapstructure:"approle-roleID"`
	ApproleSecret       string                       `mapstructure:"approle-secretID"`
	UserPolicy          string                       `mapstructure:"ldap-group-policy"`
	Environments        map[string]EnvironmentConfig //`yaml:"environments"`
}

GafaspotConfig is a struct to load every information from config file.

type Reservation

type Reservation struct {
	ID            int
	Status        string
	User          string
	EnvPlainName  string
	Start         time.Time
	End           time.Time
	SendStartMail bool
	SendEndMail   bool
	Subject       string
	Labels        string
}

Reservation is a struct to store the information of one row from database table reservations. (only database column delete_on is not included).

type ReservationCreds

type ReservationCreds struct {
	Res   Reservation
	Env   Environment
	Creds map[string]map[string]interface{}
}

ReservationCreds is a struct to bundle up credentials for a reservation. ReservationCreds can hold the credentials itself, the Environment, they belong to, and the associated Reservation, for which the credentials were created. The Creds attribute is a map to store one map for each Secrets Engine, which contains some key-value pairs as they are retrieved by a KV Secrets Engines.

type SecretsEngineConfig

type SecretsEngineConfig struct {
	NiceName   string `mapstructure:"name"`
	EngineType string `mapstructure:"type"`
	Role       string //`yaml:"role"`
}

SecretsEngineConfig is a struct to load information about one Secret Engine from config file.

Jump to

Keyboard shortcuts

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