templater

package
v0.0.0-...-473ff8e Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APKConfigFile = "/etc/apk/repositories"
View Source
var CacheFilePath = "/var/cache/templater.db"

Functions

func Load

func Load(path string, v interface{}) error

func Save

func Save(path string, v interface{}) error

Types

type APKRepository

type APKRepository struct {
	Repository
}

func (*APKRepository) Add

func (hr *APKRepository) Add() error

func (*APKRepository) Delete

func (hr *APKRepository) Delete() error

FIXME

func (*APKRepository) Manage

func (hr *APKRepository) Manage() error

func (*APKRepository) Update

func (hr *APKRepository) Update() error

type ConfigFile

type ConfigFile struct {
	Destination  string `form:"destination" json:"destination"` // Where do we write the configuration file
	Source       string `form:"source" json:"source"`           // The template file short name
	TemplateType string `json:"type"`                           // The template file type (hcl or gotemplate)
	Mode         string `form:"mod" json:"mode"`                // The configuration file final permissions (mode)
	Owner        string `json:"owner"`                          // The configuration file owner
	Service      string `json:"service"`                        // Service to restart after configuration generation
	Group        string `json:"group"`                          // The configuration file group owner
	TemplateDir  string
}

func (*ConfigFile) Generate

func (cf *ConfigFile) Generate(root string, templateDir string, values []byte) error

Generate the configuration file from the template (hcl or json)

func (*ConfigFile) ProcessTemplate

func (cf *ConfigFile) ProcessTemplate(root string, values []byte) (string, error)

Process the template with the provided values

type DebRepository

type DebRepository struct {
	Repository
}

func (*DebRepository) Add

func (hr *DebRepository) Add() error

func (*DebRepository) Delete

func (hr *DebRepository) Delete() error

func (*DebRepository) Manage

func (hr *DebRepository) Manage() error

func (*DebRepository) Update

func (hr *DebRepository) Update() error

type HelmRepository

type HelmRepository struct {
	Repository
}

func (*HelmRepository) Add

func (hr *HelmRepository) Add() error

func (*HelmRepository) Delete

func (hr *HelmRepository) Delete() error

func (*HelmRepository) Manage

func (hr *HelmRepository) Manage() error

func (*HelmRepository) Update

func (hr *HelmRepository) Update() error

type PackageRepository

type PackageRepository interface {
	Manage() error
	Update() error
	Add() error
	Delete() error
}

type Repository

type Repository struct {
	Actions PackageRepository

	Name    string `json:"name"`
	Type    string `json:"type"`
	URL     string `json:"url"`
	Enabled bool   `json:"enabled"`
}

type Service

type Service struct {
	ConfigFiles []ConfigFile             `json:"ConfigFiles"`
	Vars        map[string]interface{}   `json:"Vars"`
	Daemons     map[string]SystemService `json:"Daemons"`
	Users       map[string]SystemUser    `json:"Users"`
	Repos       map[string]Repository    `json:"Repositories"`
	Packages    map[string]SystemPackage `json:"Packages"`
}

func (*Service) Manage

func (s *Service) Manage(templateDir string, rootDir string) error

type SystemGroup

type SystemGroup struct {
	GroupName string `json:"groupname"`
}

func (*SystemGroup) Create

func (sg *SystemGroup) Create() error

func (*SystemGroup) Delete

func (sg *SystemGroup) Delete() error

func (*SystemGroup) Manage

func (sg *SystemGroup) Manage() error

func (*SystemGroup) Update

func (sg *SystemGroup) Update() error

type SystemPackage

type SystemPackage struct {
	Name         string `json:"name"`
	Type         string `json:"type"`
	Action       string `json:"action"`
	OS           string `json:"os"`
	Distribution string `json:"distribution"`
}

func (*SystemPackage) Manage

func (p *SystemPackage) Manage() error

func (*SystemPackage) SetDistribution

func (p *SystemPackage) SetDistribution() error

func (*SystemPackage) SetOS

func (p *SystemPackage) SetOS() error

type SystemService

type SystemService struct {
	Name    string `json:"name"`
	Enabled bool   `json:"enabled"`
	Type    string `json:"type"`
	ToStart bool   `json:"start"`
}

func (*SystemService) Action

func (sys *SystemService) Action() error

func (*SystemService) Enable

func (sys *SystemService) Enable() error

func (*SystemService) Manage

func (sys *SystemService) Manage() error

func (*SystemService) Restart

func (sys *SystemService) Restart() error

func (*SystemService) SetType

func (sys *SystemService) SetType()

func (*SystemService) Start

func (sys *SystemService) Start() error

func (*SystemService) Stop

func (sys *SystemService) Stop() error

type SystemUser

type SystemUser struct {
	UserName string `json:"username"`
	Group    string `json:"group"`
	Home     string `json:"home"`
	Shell    string `json:"shell"`
}

func (*SystemUser) Create

func (su *SystemUser) Create() error

func (*SystemUser) Delete

func (su *SystemUser) Delete() error

func (*SystemUser) Manage

func (su *SystemUser) Manage() error

func (*SystemUser) Update

func (su *SystemUser) Update() error

type TemplaterConfig

type TemplaterConfig struct {
	Name              string             `json:"Name"`
	TemplateDirectory string             `json:"TemplateDirectory"`
	RootDirectory     string             `json:"RootDirectory"`
	Services          map[string]Service `json:"Services"`
	GlobalService     Service            `json:"Globals"`
}

func (*TemplaterConfig) ManageServices

func (tc *TemplaterConfig) ManageServices(dryRun bool) error

Process the services contained in the configuration "object"

func (*TemplaterConfig) New

func (tc *TemplaterConfig) New(confpath string, templateDir string, rootDir string) error

Create new configuration "object"

Jump to

Keyboard shortcuts

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