synchers

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const LOCAL_ENVIRONMENT_NAME = "local"
View Source
const ShellToUse = "bash"

Variables

This section is empty.

Functions

func RunSyncProcess

func RunSyncProcess(sourceEnvironment Environment, targetEnvironment Environment, lagoonSyncer Syncer, dryRun bool) error

func Shellout

func Shellout(command string) (error, string, string)

func SyncCleanUp

func SyncCleanUp(environment Environment, syncer Syncer, dryRun bool) error

func SyncRunSourceCommand

func SyncRunSourceCommand(remoteEnvironment Environment, syncer Syncer, dryRun bool) error

func SyncRunTargetCommand

func SyncRunTargetCommand(targetEnvironment Environment, syncer Syncer, dryRun bool) error

func SyncRunTransfer

func SyncRunTransfer(sourceEnvironment Environment, targetEnvironment Environment, syncer Syncer, dryRun bool) error

Types

type BaseDrupalconfigSync

type BaseDrupalconfigSync struct {
	SyncPath        string
	OutputDirectory string
}

type BaseFilesSync

type BaseFilesSync struct {
	SyncPath string `yaml:"sync-directory"`
	Exclude  []string
}

type BaseMariaDbSync

type BaseMariaDbSync struct {
	DbHostname      string   `yaml:"hostname"`
	DbUsername      string   `yaml:"username"`
	DbPassword      string   `yaml:"password"`
	DbPort          string   `yaml:"port"`
	DbDatabase      string   `yaml:"database"`
	IgnoreTable     []string `yaml:"ignore-table"`
	IgnoreTableData []string `yaml:"ignore-table-data"`
	OutputDirectory string
}

type BasePostgresSync

type BasePostgresSync struct {
	DbHostname       string   `yaml:"hostname"`
	DbUsername       string   `yaml:"username"`
	DbPassword       string   `yaml:"password"`
	DbPort           string   `yaml:"port"`
	DbDatabase       string   `yaml:"database"`
	ExcludeTable     []string `yaml:"exclude-table"`
	ExcludeTableData []string `yaml:"exclude-table-data"`
	OutputDirectory  string
}

type DrupalconfigSyncLocal

type DrupalconfigSyncLocal struct {
	Config BaseDrupalconfigSync
}

type DrupalconfigSyncRoot

type DrupalconfigSyncRoot struct {
	Config         BaseDrupalconfigSync
	LocalOverrides DrupalconfigSyncLocal `yaml:"local"`
	TransferId     string
}

func (DrupalconfigSyncRoot) GetLocalCommand

func (m DrupalconfigSyncRoot) GetLocalCommand(environment Environment) SyncCommand

func (DrupalconfigSyncRoot) GetOutputDirectory

func (root DrupalconfigSyncRoot) GetOutputDirectory() string

func (DrupalconfigSyncRoot) GetRemoteCommand

func (root DrupalconfigSyncRoot) GetRemoteCommand(environment Environment) SyncCommand

func (DrupalconfigSyncRoot) GetTransferResource

func (m DrupalconfigSyncRoot) GetTransferResource(environment Environment) SyncerTransferResource

func (DrupalconfigSyncRoot) PrepareSyncer

func (root DrupalconfigSyncRoot) PrepareSyncer() (Syncer, error)

type Environment

type Environment struct {
	ProjectName     string
	EnvironmentName string
}

type FilesSyncLocal

type FilesSyncLocal struct {
	Config BaseFilesSync
}

type FilesSyncRoot

type FilesSyncRoot struct {
	Config         BaseFilesSync
	LocalOverrides FilesSyncLocal `yaml:"local"`
	TransferId     string
}

func (FilesSyncRoot) GetLocalCommand

func (m FilesSyncRoot) GetLocalCommand(environment Environment) SyncCommand

func (FilesSyncRoot) GetRemoteCommand

func (root FilesSyncRoot) GetRemoteCommand(environment Environment) SyncCommand

func (FilesSyncRoot) GetTransferResource

func (m FilesSyncRoot) GetTransferResource(environment Environment) SyncerTransferResource

func (FilesSyncRoot) PrepareSyncer

func (root FilesSyncRoot) PrepareSyncer() (Syncer, error)

type LagoonSync

type LagoonSync struct {
	Mariadb      MariadbSyncRoot      `yaml:"mariadb"`
	Postgres     PostgresSyncRoot     `yaml:"postgres"`
	Drupalconfig DrupalconfigSyncRoot `yaml:"drupalconfig"`
	Filesconfig  FilesSyncRoot        `yaml:"files"`
	TransferId   string               // a unique id which can be used to identify this entire transaction
}

The following is the root structure for unmarshalling yaml configurations Each syncer must register its structure here

type MariadbSyncLocal

type MariadbSyncLocal struct {
	Config BaseMariaDbSync
}

type MariadbSyncRoot

type MariadbSyncRoot struct {
	Config         BaseMariaDbSync
	LocalOverrides MariadbSyncLocal `yaml:"local"`
	TransferId     string
}

func (MariadbSyncRoot) GetLocalCommand

func (m MariadbSyncRoot) GetLocalCommand(targetEnvironment Environment) SyncCommand

func (MariadbSyncRoot) GetOutputDirectory

func (root MariadbSyncRoot) GetOutputDirectory() string

func (MariadbSyncRoot) GetRemoteCommand

func (root MariadbSyncRoot) GetRemoteCommand(sourceEnvironment Environment) SyncCommand

func (MariadbSyncRoot) GetTransferResource

func (m MariadbSyncRoot) GetTransferResource(environment Environment) SyncerTransferResource

func (MariadbSyncRoot) PrepareSyncer

func (root MariadbSyncRoot) PrepareSyncer() (Syncer, error)

type PostgresSyncLocal

type PostgresSyncLocal struct {
	Config BasePostgresSync
}

type PostgresSyncRoot

type PostgresSyncRoot struct {
	Config         BasePostgresSync  `yaml:"config"`
	LocalOverrides PostgresSyncLocal `yaml:"local"`
	TransferId     string
}

func (PostgresSyncRoot) GetLocalCommand

func (m PostgresSyncRoot) GetLocalCommand(environment Environment) SyncCommand

func (PostgresSyncRoot) GetOutputDirectory

func (root PostgresSyncRoot) GetOutputDirectory() string

func (PostgresSyncRoot) GetRemoteCommand

func (root PostgresSyncRoot) GetRemoteCommand(environment Environment) SyncCommand

func (PostgresSyncRoot) GetTransferResource

func (m PostgresSyncRoot) GetTransferResource(environment Environment) SyncerTransferResource

func (PostgresSyncRoot) PrepareSyncer

func (root PostgresSyncRoot) PrepareSyncer() (Syncer, error)

type SyncCommand

type SyncCommand struct {
	NoOp bool // NoOp can be set to true if this command performs no operation (in situations like file transfers)
	// contains filtered or unexported fields
}

func (SyncCommand) GetCommand

func (c SyncCommand) GetCommand() (string, error)

type Syncer

type Syncer interface {
	// GetRemoteCommand will return the command to be run on the source system
	GetRemoteCommand(environment Environment) SyncCommand
	// GetLocalCommand will return the command to be run on the target system
	GetLocalCommand(environment Environment) SyncCommand
	GetTransferResource(environment Environment) SyncerTransferResource
	// PrepareSyncer does any preparations required on a Syncer before it is used
	PrepareSyncer() (Syncer, error)
}

type SyncerTransferResource

type SyncerTransferResource struct {
	Name             string
	IsDirectory      bool
	ExcludeResources []string // ExcludeResources is a string list of any resources that aren't to be included in the transfer
	SkipCleanup      bool
}

SyncerTransferResource describes what it is the is produced by the actions of GetRemoteCommand()

type SyncherConfigRoot

type SyncherConfigRoot struct {
	Project    string
	LagoonSync LagoonSync `yaml:"lagoon-sync"`
}

SyncherConfigRoot is used to unmarshall yaml config details generally

func UnmarshallLagoonYamlToLagoonSyncStructure

func UnmarshallLagoonYamlToLagoonSyncStructure(data []byte) (SyncherConfigRoot, error)

UnmarshallLagoonYamlToLagoonSyncStructure will take a bytestream and return a fully parsed lagoon sync config structure

Jump to

Keyboard shortcuts

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