Documentation ¶
Index ¶
- Constants
- Variables
- func BoshName() (bosh string)
- func ExtractEncryptionKey(dest io.Writer, deploymentDir string) (err error)
- func GetDeploymentName(jsonObj InstallationCompareObject) (deploymentName string, err error)
- func GetPasswordAndIP(jsonObj InstallationCompareObject, product, component, username string) (ip, password string, err error)
- func GetUploader(backupContext BackupContext) (uploader httpUploader)
- func SetPGDumpUtilVersions()
- type BackupContext
- type CCJob
- type CloudController
- type CloudControllerDeploymentParser
- type CloudControllerJobs
- type ConfigurationParser
- type DirectorInfo
- type DiskProvider
- type IPPasswordParser
- type IaaSConfiguration
- type Infrastructure
- type InstallationCompareObject
- type InstallationSettings
- type Instances
- type Jobs
- type MysqlInfo
- type NFSBackup
- type NfsInfo
- type PersistanceBackup
- type PgInfo
- type Products
- type Properties
- type S3Provider
- type StorageProvider
- type SystemDump
- type SystemInfo
- type SystemsInfo
- type Tile
- type VMObject
Constants ¶
const ( //AccessKeyIDVarname - s3 key flag AccessKeyIDVarname = "S3_ACCESS_KEY_ID" //SecretAccessKeyVarname - s3 secret key SecretAccessKeyVarname = "S3_SECRET_ACCESS_KEY" //BucketNameVarname - bucket name var flag BucketNameVarname = "S3_BUCKET_NAME" //S3Domain - s3 domain value S3Domain = "S3_DOMAIN" //IsS3Varname - s3 persistence true|false IsS3Varname = "S3_ACTIVE" //NfsDirPath - this is where the nfs store lives NfsDirPath string = "/var/vcap/store" //NfsArchiveDir - this is the archive dir name NfsArchiveDir string = "shared" //NfsDefaultSSHUser - this is the default ssh user for nfs NfsDefaultSSHUser string = "vcap" //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" //ERVersionEnvFlag -- env flag from ER version toggle ERVersionEnvFlag = "ER_VERSION" //ERVersion16 -- value for 1.6 toggle ERVersion16 = "1.6" //BackupLoggerName -- BackupLoggerName = "Backup" //RestoreLoggerName -- RestoreLoggerName = "Restore" //SDProduct -- SDProduct string = "Product" //SDComponent -- SDComponent string = "Component" //SDIdentity -- SDIdentity string = "Identity" //SDIP -- SDIP string = "Ip" //SDUser -- SDUser string = "User" //SDPass -- SDPass string = "Pass" //SDVcapUser -- SDVcapUser string = "VcapUser" //SDVcapPass -- SDVcapPass string = "VcapPass" )
const ( //ImportArchive -- ImportArchive = iota //ExportArchive -- ExportArchive )
Variables ¶
var ( //NfsNewRemoteExecuter - this is a function which is able to execute a remote command against the nfs server NfsNewRemoteExecuter = command.NewRemoteExecutor //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) //TileRestoreAction -- executes a restore action on the given tile TileRestoreAction = func(t Tile) func() error { return t.Restore } //TileBackupAction - executes a backup action on a given tile TileBackupAction = func(t Tile) func() error { return t.Backup } )
var NewDirector = func(ip, username, password string, port int) bosh.Bosh { return bosh.NewBoshDirector(ip, username, password, port, NewHttpGateway()) }
NewDirector - a function representing a constructor for a director object
var TaskPingFreq = 1000 * time.Millisecond
Not ping server so frequently and exausted the resources
Functions ¶
func BoshName ¶ added in v1.1.18
func BoshName() (bosh string)
BoshName - function which returns proper bosh component name for given version
func ExtractEncryptionKey ¶
ExtractEncryptionKey - extract the encryptionKey from a deployment archive
func GetDeploymentName ¶
func GetDeploymentName(jsonObj InstallationCompareObject) (deploymentName string, err error)
GetDeploymentName - returns the name of the deployment
func GetPasswordAndIP ¶
func GetPasswordAndIP(jsonObj InstallationCompareObject, product, component, username string) (ip, password string, err error)
GetPasswordAndIP - returns password and ip from the installation settings from a given component
func GetUploader ¶
func GetUploader(backupContext BackupContext) (uploader httpUploader)
GetUploader - returns an uploader from a given backup context
func SetPGDumpUtilVersions ¶ added in v1.1.19
func SetPGDumpUtilVersions()
SetPGDumpUtilVersions -- set version paths for pgdump/pgrestore utils
Types ¶
type BackupContext ¶
type BackupContext struct { TargetDir string IsS3 bool StorageProvider }
BackupContext - stores the base context information for a backup/restore
func NewBackupContext ¶
func NewBackupContext(targetDir string, env map[string]string) (backupContext BackupContext)
NewBackupContext initializes a BackupContext
type CloudController ¶
type CloudController struct {
// contains filtered or unexported fields
}
CloudController - a struct representing a cloud controller
func NewCloudController ¶
func NewCloudController(ip, username, password, deploymentName, manifest string, cloudControllers CloudControllerJobs) *CloudController
NewCloudController - a function representing a constructor for a cloud controller
func (*CloudController) Start ¶
func (c *CloudController) Start() error
Start - a method to execute a start event on a cloud controller
func (*CloudController) Stop ¶
func (c *CloudController) Stop() error
Stop - a method which executes a stop against a cloud controller
type CloudControllerDeploymentParser ¶
type CloudControllerDeploymentParser struct {
// contains filtered or unexported fields
}
CloudControllerDeploymentParser - a struct which will handle the parsing of deployments
type CloudControllerJobs ¶
type CloudControllerJobs []CCJob
CloudControllerJobs - array storing a list of CCJobs
type ConfigurationParser ¶
type ConfigurationParser struct {
InstallationSettings InstallationSettings
}
ConfigurationParser - the parser to handle installation settings file parsing
func NewConfigurationParser ¶
func NewConfigurationParser(installationFilePath string) *ConfigurationParser
NewConfigurationParser - constructor for a ConfigurationParser from a json installationsettings file
func NewConfigurationParserFromReader ¶
func NewConfigurationParserFromReader(settings io.Reader) *ConfigurationParser
NewConfigurationParserFromReader - constructor for a ConfigurationParser from a json installationsettings file
func (*ConfigurationParser) FindCFPostgresJobs ¶
func (s *ConfigurationParser) FindCFPostgresJobs() []Jobs
FindCFPostgresJobs finds all the postgres jobs in the cf product
func (*ConfigurationParser) FindJobsByProductID ¶
func (s *ConfigurationParser) FindJobsByProductID(id string) []Jobs
FindJobsByProductID finds all the jobs in an installation by product id
func (*ConfigurationParser) GetIaaS ¶
func (s *ConfigurationParser) GetIaaS() (config IaaSConfiguration, hasSSHKey bool)
GetIaaS - get the iaas elements from the installation settings
func (*ConfigurationParser) GetProducts ¶
func (s *ConfigurationParser) GetProducts() (products []Products)
GetProducts - get the products array
type DirectorInfo ¶
type DirectorInfo struct { SystemInfo Database string }
DirectorInfo - a struct representing a director systemdump implementation
func (*DirectorInfo) GetPersistanceBackup ¶
func (s *DirectorInfo) GetPersistanceBackup() (dumper PersistanceBackup, err error)
GetPersistanceBackup - the constructor for a new DirectorInfo object
type DiskProvider ¶
type DiskProvider struct {
Directory string
}
DiskProvider is a storage provider that stores your Docker images on local disk.
func (*DiskProvider) Reader ¶
func (d *DiskProvider) Reader(path ...string) (io.ReadCloser, error)
Reader returns an io.ReadCloser for the specified path
func (*DiskProvider) Writer ¶
func (d *DiskProvider) Writer(path ...string) (io.WriteCloser, error)
Writer returns an io.WriteCloser for the specified path
type IPPasswordParser ¶
type IPPasswordParser struct { Product string Component string Username string // contains filtered or unexported fields }
IPPasswordParser - parses the passwords out of a installation settings
func (*IPPasswordParser) Parse ¶
func (s *IPPasswordParser) Parse(jsonObj InstallationCompareObject) (ip, password string, err error)
Parse - parse a given installation compare object
type IaaSConfiguration ¶
type IaaSConfiguration struct {
SSHPrivateKey string `json:"ssh_private_key"`
}
IaaSConfiguration - a struct to house the IaaSConfiguration block elements from the json
type Infrastructure ¶
type Infrastructure struct { Type string `json:"type"` IaaSConfig IaaSConfiguration `json:"iaas_configuration"` }
Infrastructure - a struct to house Infrastructure block elements from the json
type InstallationCompareObject ¶
type InstallationCompareObject struct { Guid string InstallationVersion string `json:"installation_version"` Products []productCompareObject Infrastructure infrastructure }
InstallationCompareObject --
func ReadAndUnmarshal ¶
func ReadAndUnmarshal(src io.Reader) (jsonObj InstallationCompareObject, err error)
ReadAndUnmarshal - takes an io.reader and unmarshals its contents into a compare object
type InstallationSettings ¶
type InstallationSettings struct { Infrastructure Infrastructure `json:"infrastructure"` Products []Products `json:"products"` }
InstallationSettings - an object to house installationsettings elements from the json
type Jobs ¶
type Jobs struct { Identifier string `json:"identifier"` Properties []Properties `json:"properties"` Instances []Instances `json:"instances"` GUID string `json: "guid"` InstallationName string `json: "installation_name"` Partitions []map[string]interface{} `json: "partitions"` Resources []map[string]interface{} `json: "resources"` }
Jobs contains job settings for a product
type MysqlInfo ¶
type MysqlInfo struct { SystemInfo Database string }
MysqlInfo - a struct representing a mysql systemdump implementation
func (*MysqlInfo) GetPersistanceBackup ¶
func (s *MysqlInfo) GetPersistanceBackup() (dumper PersistanceBackup, err error)
GetPersistanceBackup - the constructor for a new mysqlinfo object
type NFSBackup ¶
NFSBackup - this is a nfs backup object
func NewNFSBackup ¶
NewNFSBackup - constructor for an nfsbackup object
type NfsInfo ¶
type NfsInfo struct {
SystemInfo
}
NfsInfo - a struct representing a nfs systemdump implementation
func (*NfsInfo) GetPersistanceBackup ¶
func (s *NfsInfo) GetPersistanceBackup() (dumper PersistanceBackup, err error)
GetPersistanceBackup - the constructor for a new nfsinfo object
type PersistanceBackup ¶
PersistanceBackup - a struct representing a persistence backup
type PgInfo ¶
type PgInfo struct { SystemInfo Database string }
PgInfo - a struct representing a pgres systemdump implementation
func (*PgInfo) GetPersistanceBackup ¶
func (s *PgInfo) GetPersistanceBackup() (dumper PersistanceBackup, err error)
GetPersistanceBackup - the constructor for a new pginfo object
type Products ¶
type Products struct { Identifier string `json:"identifier"` IPS map[string][]string `json:"ips"` Jobs []Jobs `json:"jobs"` ProductVersion string `json:"product_version"` AZReference []string `json:"availability_zone_references"` DisabledPostDeployErrandNames []string `json:"disabled_post_deploy_errand_names"` DeploymentNetworkReference string `json:"deployment_network_reference"` GUID string `json: "guid"` InfrastructureNetworkReference string `json:"infrastructure_network_reference"` InstallationName string `json:"installation_name"` SingletonAvailabilityZoneReference string `json: "sigleton_availability_zone_reference"` Stemcell interface{} `json: "stemcell"` }
Products contains installation settings for a product
type Properties ¶
type Properties struct { Identifier string `json:"identifier"` Value interface{} `json:"value"` }
Properties contains property settings for a job
type S3Provider ¶
type S3Provider struct { S3Domain string BucketName string AccessKeyID string SecretAccessKey string }
S3Provider is a storage provider that allows backups to be stored to an S3 compatible blobstore
func (*S3Provider) Reader ¶
func (s *S3Provider) Reader(path ...string) (io.ReadCloser, error)
Reader for reading from an S3 bucket
func (*S3Provider) Writer ¶
func (s *S3Provider) Writer(path ...string) (io.WriteCloser, error)
Writer for writing to an S3 bucket
type StorageProvider ¶
type StorageProvider interface { Reader(path ...string) (io.ReadCloser, error) Writer(path ...string) (io.WriteCloser, error) }
StorageProvider is responsible for obtaining/managing a reader/writer to a storage type (eg disk/s3)
func NewDiskProvider ¶
func NewDiskProvider() StorageProvider
NewDiskProvider creates a new disk storage provider instance
func NewS3Provider ¶
func NewS3Provider(domain, key, secret, bucket string) StorageProvider
NewS3Provider creates a new instance of the S3 storage provider
type SystemDump ¶
type SystemDump interface { Error() error GetPersistanceBackup() (dumper PersistanceBackup, err error) // contains filtered or unexported methods }
SystemDump - definition for a SystemDump interface
type SystemInfo ¶
type SystemInfo struct { goutil.GetSet Product string Component string Identity string Ip string User string Pass string VcapUser string VcapPass string SSHPrivateKey string // contains filtered or unexported fields }
SystemInfo - a struct representing a base systemdump implementation
func (*SystemInfo) Error ¶
func (s *SystemInfo) Error() (err error)
Error - method making systeminfo implement the error interface
func (*SystemInfo) Get ¶
func (s *SystemInfo) Get(name string) string
Get - a getter for a systeminfo object
func (*SystemInfo) GetPersistanceBackup ¶
func (s *SystemInfo) GetPersistanceBackup() (dumper PersistanceBackup, err error)
GetPersistanceBackup - the constructor for a systeminfo object
func (*SystemInfo) Set ¶
func (s *SystemInfo) Set(name string, val string)
Set - a setter for a systeminfo object
type SystemsInfo ¶
type SystemsInfo struct {
SystemDumps map[string]SystemDump
}
SystemsInfo holds the values for all the supported SystemDump used by an installation
func NewSystemsInfo ¶
func NewSystemsInfo(installationSettingsFile string, sshKey string) SystemsInfo
NewSystemsInfo creates a map of SystemDumps that are configured based on the installation settings fetched from ops manager
func (SystemsInfo) PersistentSystems ¶
func (s SystemsInfo) PersistentSystems() []SystemDump
PersistentSystems returns a slice of all the jobs that need to be backed up