lib

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: PostgreSQL Imports: 7 Imported by: 0

Documentation

Overview

Package lib contains code and structs shared between the manage and agent modules.

Package lib contains shared code and structs for the manage and agent modules.

Package lib is a general library of utilities and things.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatJSON

func FormatJSON(j []byte) (string, error)

FormatJSON converts a byte array to formatted string.

func GetLatestTagFromRepository

func GetLatestTagFromRepository(repo *git.Repository) (string, error)

GetLatestTagFromRepository will get the latest tag from the git repository. See https://github.com/src-d/go-git/issues/1030#issuecomment-443679681

Types

type AgentTemplate

type AgentTemplate struct {
	Source   Source   `hcl:"source,block" json:"source"`
	Storage  Storage  `hcl:"storage,block" json:"storage"`
	Restic   Restic   `hcl:"restic,block" json:"restic"`
	Tactical Tactical `hcl:"tactical,block" json:"tactical"`
	Hosting  Hosting  `hcl:"hosting,block" json:"hosting,omitempty"`
}

AgentTemplate manages the HCL config for the backup agent.

type Azure

type Azure struct {
	AccountName *string `hcl:"azure_account_name,attr" json:"azure_account_name,omitempty"`
	AccountKey  *string `hcl:"azure_account_key,attr" json:"azure_account_key,omitempty"`
}

Azure config

type Backblaze

type Backblaze struct {
	AccountID  *string `hcl:"b2_account_id,attr" json:"b2_account_id,omitempty"`
	AccountKey *string `hcl:"b2_account_key,attr" json:"b2_account_key,omitempty"`
}

Backblaze config

type Google

type Google struct {
	ProjectID              *string `hcl:"google_project_id,attr" json:"google_project_id,omitempty"`
	ApplicationCredentials *string `hcl:"google_application_credentials,attr" json:"google_application_credentials,omitempty"`
}

Google config

type Hosting

type Hosting struct {
	// TODO: File hosting does not belong in the agent config.
	Upload struct {
		Domain        *string `hcl:"domain"`
		Path          *string `hcl:"path"`
		BasicUsername *string `hcl:"basic_username"`
		BasicPassword *string `hcl:"basic_password"`
		// Filename is the base filename without the os and arch.
		// The actual filename will be {filename}_{GOOS}_{GOARCH}[.ext]
		Filename *string `hcl:"filename"`
	} `hcl:"upload,block" json:"-"`
	Download struct {
		URL           *string `hcl:"url" json:"url"`
		BasicUsername *string `hcl:"basic_username" json:"basic_username"`
		BasicPassword *string `hcl:"basic_password" json:"basic_password"`
		// Filename is the base filename without the os and arch.
		// The actual filename will be {filename}_{GOOS}_{GOARCH}[.ext]
		Filename *string `hcl:"filename" json:"filename"`
	} `hcl:"download,block" json:"download"`
	OS   *string `hcl:"os" json:"os,omitempty"`
	Arch *string `hcl:"arch" json:"arch,omitempty"`
}

Hosting is for the Tactical script that runs on the endpoint. It needs to know where to download the backup AgentConfig and the format of the URL.

type Rest

type Rest struct {
	Host     *string `hcl:"host,attr" json:"host,omitempty"`
	Port     *string `hcl:"port,attr" json:"port,omitempty" default:"443"`
	Username *string `hcl:"username,attr" json:"username,omitempty"`
	Password *string `hcl:"password,attr" json:"password,omitempty"`
	Path     *string `hcl:"path,attr" json:"path,omitempty" default:""`
}

Rest config for a rest-server

type Restic

type Restic struct {
	Repository                   *string `hcl:"repository,attr" json:"repository"`
	Password                     *string `hcl:"password,attr" json:"password,omitempty"` // Encryption password
	KeyHint                      *string `hcl:"key_hint,attr" json:"key_hint,omitempty"`
	OSStorageUrl                 *string `hcl:"os_storage_url,attr" json:"os_storage_url,omitempty"`
	OSAuthToken                  *string `hcl:"os_auth_token,attr" json:"os_auth_token,omitempty"`
	B2AccountID                  *string `hcl:"b2_account_id,attr" json:"b2_account_id,omitempty"`
	B2AccountKey                 *string `hcl:"b2_account_key,attr" json:"b2_account_key,omitempty"`
	AzureAccountName             *string `hcl:"azure_account_name,attr" json:"azure_account_name,omitempty"`
	AzureAccountKey              *string `hcl:"azure_account_key,attr" json:"azure_account_key,omitempty"`
	GoogleProjectID              *string `hcl:"google_project_id,attr" json:"google_project_id,omitempty"`
	GoogleApplicationCredentials *string `hcl:"google_application_credentials,attr" json:"google_application_credentials,omitempty"`
	BWLimit                      *string `hcl:"bw_limit,attr" json:"bw_limit,omitempty"`
}

Restic config See https://restic.readthedocs.io/en/latest/040_backup.html#environment-variables

type Source

type Source struct {
	Paths []string `hcl:"paths,attr" json:"paths"`
}

Source is a list of sources to back up.

type Storage

type Storage struct {
	Provider  string     `hcl:"provider,attr" json:"provider,omitempty" default:"rest"`
	Rest      *Rest      `hcl:"rest,block" json:"rest"`
	Backblaze *Backblaze `hcl:"backblaze,block" json:"backblaze"`
	Azure     *Azure     `hcl:"azure,block" json:"azure"`
	Google    *Google    `hcl:"google,block" json:"google"`
}

Storage is the storage provider for the restic repository.

type Tactical

type Tactical struct {
	Client *string `hcl:"client,attr" json:"client"`
	Site   *string `hcl:"site,attr" json:"site"`
	Agent  *string `hcl:"agent,attr" json:"agent"`
}

Tactical is for user reference only. It might be used in the future.

Directories

Path Synopsis
Package crypto contains code and structs shared between the manage and agent modules.
Package crypto contains code and structs shared between the manage and agent modules.
Package fs is a general library of filesystem things.
Package fs is a general library of filesystem things.
Package pkg deals with downloading and installing packages from git repositories.
Package pkg deals with downloading and installing packages from git repositories.

Jump to

Keyboard shortcuts

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