elasticruntime

package
v0.1.158 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ERDefaultSystemUser - default user for system vms
	ERDefaultSystemUser = "vcap"
	//ERDirectorInfoURL - url format for a director info endpoint
	ERDirectorInfoURL = "https://%s:25555/info"
	//ERBackupDir - default er backup dir
	ERBackupDir = "elasticruntime"
	//ERVmsURL - url format for a vms url
	ERVmsURL = "https://%s:25555/deployments/%s/vms"
	//ERDirector -- key
	ERDirector = "DirectorInfo"
	//ERConsole -- key
	ERConsole = "ConsoledbInfo"
	//ERUaa -- key
	ERUaa = "UaadbInfo"
	//ERCc -- key
	ERCc = "CcdbInfo"
	//ERMySQL -- key
	ERMySQL = "MysqldbInfo"
	//ERNfs -- key
	ERNfs = "NfsInfo"
	//ERBackupFileFormat -- format of archive filename
	ERBackupFileFormat = "%s.backup"
	//ERInvalidDirectorCredsMsg -- error message for invalid creds on director
	ERInvalidDirectorCredsMsg = "invalid director credentials"
	//ERNoPersistenceArchives -- error message for persistence stores
	ERNoPersistenceArchives = "there are no persistence stores in the list"
	//ERFileDoesNotExist -- error message for file does not exist
	ERFileDoesNotExist = "file does not exist"
	//ErrERDBBackupFailure -- error message for backup failure
	ErrERDBBackupFailure = "failed to backup database"
)

Variables

View Source
var (
	//ErrERDirectorCreds - error for director creds
	ErrERDirectorCreds = errors.New(ERInvalidDirectorCredsMsg)
	//ErrEREmptyDBList - error for db list empty
	ErrEREmptyDBList = errors.New(ERNoPersistenceArchives)
	//ErrERInvalidPath - invalid filepath error
	ErrERInvalidPath = &os.PathError{Err: errors.New(ERFileDoesNotExist)}
	//ErrERDBBackup - error for db backup failures
	ErrERDBBackup = errors.New(ErrERDBBackupFailure)
)
View Source
var GetInstallationSettings = func(tileSpec tileregistry.TileSpec) (settings io.Reader, err error) {
	var (
		opsManager *opsmanager.OpsManager
	)

	if opsManager, err = opsmanager.NewOpsManager(tileSpec.OpsManagerHost, tileSpec.AdminUser, tileSpec.AdminPass, tileSpec.AdminToken, tileSpec.OpsManagerUser, tileSpec.OpsManagerPass, tileSpec.OpsManagerPassphrase, tileSpec.ClientID, tileSpec.ClientSecret, tileSpec.ArchiveDirectory, tileSpec.CryptKey); err == nil {
		settings, err = opsManager.GetInstallationSettings()
	}
	return
}

GetInstallationSettings - makes a call to ops manager and returns a io.reader containing the contents of the installation settings file.

View Source
var NewElasticRuntime = func(jsonFile string, target string, sshKey string, cryptKey string, nfs string) *ElasticRuntime {

	if _, err := os.Stat(jsonFile); err != nil {
		lo.G.Error("installation settings not found: ", err)
		lo.G.Panic("exiting program, cant work without a valid installation settings...")
	}
	systemsInfo := cfbackup.NewSystemsInfo(jsonFile, sshKey, nfs)
	context := &ElasticRuntime{
		SSHPrivateKey:     sshKey,
		JSONFile:          jsonFile,
		BackupContext:     cfbackup.NewBackupContext(target, cfenv.CurrentEnv(), cryptKey),
		SystemsInfo:       systemsInfo,
		PersistentSystems: systemsInfo.PersistentSystems(),
	}
	return context
}

NewElasticRuntime initializes an ElasticRuntime intance

Functions

This section is empty.

Types

type ElasticRuntime

type ElasticRuntime struct {
	cfbackup.BackupContext
	JSONFile          string
	SystemsInfo       cfbackup.SystemsInfo
	PersistentSystems []cfbackup.SystemDump
	HTTPGateway       ghttp.HttpGateway
	InstallationName  string
	SSHPrivateKey     string
	NFS               string
}

ElasticRuntime contains information about a Pivotal Elastic Runtime deployment

func (*ElasticRuntime) Backup

func (context *ElasticRuntime) Backup() (err error)

Backup performs a backup of a Pivotal Elastic Runtime deployment

func (*ElasticRuntime) ReadAllUserCredentials

func (context *ElasticRuntime) ReadAllUserCredentials() (err error)

ReadAllUserCredentials - get all user creds from the installation json

func (*ElasticRuntime) Restore

func (context *ElasticRuntime) Restore() (err error)

Restore performs a restore of a Pivotal Elastic Runtime deployment

func (*ElasticRuntime) RunDbAction

func (context *ElasticRuntime) RunDbAction(dbInfoList []cfbackup.SystemDump, action int) (err error)

RunDbAction - run a db action dump/import against a list of systemdump types

type ElasticRuntimeBuilder

type ElasticRuntimeBuilder struct{}

ElasticRuntimeBuilder -- an object that can build an elastic runtime pre-initialized

func (*ElasticRuntimeBuilder) New

func (s *ElasticRuntimeBuilder) New(tileSpec tileregistry.TileSpec) (elasticRuntimeCloser tileregistry.TileCloser, err error)

New -- method to generate an initialized elastic runtime

type TempFile added in v0.1.122

type TempFile struct {
	FileRef *os.File
}

TempFile -- a wrapper around temp files to make a closer

func NewTempFile added in v0.1.122

func NewTempFile(filename string) (*TempFile, error)

NewTempFile - creates a temporary file which can be cleaned up

func (*TempFile) Close added in v0.1.122

func (s *TempFile) Close()

Close - allows us to clean up the tmp file (delete, close)

Jump to

Keyboard shortcuts

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