Documentation
¶
Index ¶
- Constants
- Variables
- func BackupNfs(password, ip string, dest io.Writer) (err error)
- 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 RunBackupPipeline(...) (err error)
- func RunRestorePipeline(...) (err error)
- type BackupContext
- type CCJob
- type CloudController
- type CloudControllerDeploymentParser
- type CloudControllerJobs
- type ElasticRuntime
- type ElasticRuntimeBuilder
- type InstallationCompareObject
- type IpPasswordParser
- type MysqlInfo
- type NFSBackup
- type NfsInfo
- type OpsManager
- type OpsManagerBuilder
- type PersistanceBackup
- type PgInfo
- type SystemDump
- type SystemInfo
- type Tile
- type VMObject
Constants ¶
const ( BACKUP_LOGGER_NAME = "Backup" RESTORE_LOGGER_NAME = "Restore" )
const ( ER_DEFAULT_SYSTEM_USER = "vcap" ER_DIRECTOR_INFO_URL = "https://%s:25555/info" ER_BACKUP_DIR = "elasticruntime" ER_VMS_URL = "https://%s:25555/deployments/%s/vms" ER_DIRECTOR = "DirectorInfo" ER_CONSOLE = "ConsoledbInfo" ER_UAA = "UaadbInfo" ER_CC = "CcdbInfo" ER_MYSQL = "MysqldbInfo" ER_NFS = "NfsInfo" ER_BACKUP_FILE_FORMAT = "%s.backup" ER_INVALID_DIRECTOR_CREDS_MSG = "invalid director credentials" ER_NO_PERSISTENCE_ARCHIVES = "there are no persistence stores in the list" ER_FILE_DOES_NOT_EXIST = "file does not exist" ER_DB_BACKUP_FAILURE = "failed to backup database" )
const ( IMPORT_ARCHIVE = iota EXPORT_ARCHIVE )
const ( NFS_DIR_PATH string = "/var/vcap/store" NFS_ARCHIVE_DIR string = "shared" NFS_DEFAULT_SSH_USER string = "vcap" )
const ( OPSMGR_INSTALLATION_SETTINGS_FILENAME string = "installation.json" OPSMGR_INSTALLATION_SETTINGS_POSTFIELD_NAME string = "installation[file]" OPSMGR_INSTALLATION_ASSETS_FILENAME string = "installation.zip" OPSMGR_INSTALLATION_ASSETS_POSTFIELD_NAME string = "installation[file]" OPSMGR_DEPLOYMENTS_FILENAME string = "deployments.tar.gz" OPSMGR_ENCRYPTIONKEY_FILENAME string = "cc_db_encryption_key.txt" OPSMGR_BACKUP_DIR string = "opsmanager" OPSMGR_DEPLOYMENTS_DIR string = "deployments" OPSMGR_DEFAULT_USER string = "tempest" OPSMGR_DEFAULT_SSH_PORT int = 22 OPSMGR_INSTALLATION_SETTINGS_URL string = "https://%s/api/installation_settings" OPSMGR_INSTALLATION_ASSETS_URL string = "https://%s/api/installation_asset_collection" OPSMGR_DEPLOYMENTS_FILE string = "/var/tempest/workspaces/default/deployments/bosh-deployments.yml" )
Variables ¶
var ( TILE_RESTORE_ACTION = func(t Tile) func() error { return t.Restore } TILE_BACKUP_ACTION = func(t Tile) func() error { return t.Backup } )
var ( ER_ERROR_DIRECTOR_CREDS = errors.New(ER_INVALID_DIRECTOR_CREDS_MSG) ER_ERROR_EMPTY_DB_LIST = errors.New(ER_NO_PERSISTENCE_ARCHIVES) ER_ERROR_INVALID_PATH = &os.PathError{Err: errors.New(ER_FILE_DOES_NOT_EXIST)} ER_DB_BACKUP = errors.New(ER_DB_BACKUP_FAILURE) )
var NewDirector = func(ip, username, password string, port int) bosh.Bosh { return bosh.NewBoshDirector(ip, username, password, port, NewHttpGateway()) }
var NewElasticRuntime = func(jsonFile string, target string) *ElasticRuntime { var ( uaadbInfo *PgInfo = &PgInfo{ SystemInfo: SystemInfo{ Product: "cf", Component: "uaadb", Identity: "root", }, Database: "uaa", } consoledbInfo *PgInfo = &PgInfo{ SystemInfo: SystemInfo{ Product: "cf", Component: "consoledb", Identity: "root", }, Database: "console", } ccdbInfo *PgInfo = &PgInfo{ SystemInfo: SystemInfo{ Product: "cf", Component: "ccdb", Identity: "admin", }, Database: "ccdb", } mysqldbInfo *MysqlInfo = &MysqlInfo{ SystemInfo: SystemInfo{ Product: "cf", Component: "mysql", Identity: "root", }, Database: "mysql", } directorInfo *SystemInfo = &SystemInfo{ Product: "microbosh", Component: "director", Identity: "director", } nfsInfo *NfsInfo = &NfsInfo{ SystemInfo: SystemInfo{ Product: "cf", Component: "nfs_server", Identity: "vcap", }, } ) context := &ElasticRuntime{ JsonFile: jsonFile, BackupContext: BackupContext{ TargetDir: target, }, SystemsInfo: map[string]SystemDump{ ER_DIRECTOR: directorInfo, ER_CONSOLE: consoledbInfo, ER_UAA: uaadbInfo, ER_CC: ccdbInfo, ER_MYSQL: mysqldbInfo, ER_NFS: nfsInfo, }, PersistentSystems: []SystemDump{ consoledbInfo, uaadbInfo, ccdbInfo, nfsInfo, mysqldbInfo, }, } return context }
NewElasticRuntime initializes an ElasticRuntime intance
var NewOpsManager = func(opsManagerHostname string, adminUsername string, adminPassword string, opsManagerUsername string, opsManagerPassword string, target string) (context *OpsManager, err error) { var remoteExecuter command.Executer if remoteExecuter, err = createExecuter(opsManagerHostname, opsManagerUsername, opsManagerPassword, OPSMGR_DEFAULT_SSH_PORT); err == nil { settingsHttpRequestor := ghttp.NewHttpGateway() settingsMultiHttpRequestor := ghttp.MultiPartUpload assetsHttpRequestor := ghttp.NewHttpGateway() assetsMultiHttpRequestor := ghttp.MultiPartUpload context = &OpsManager{ SettingsUploader: settingsMultiHttpRequestor, AssetsUploader: assetsMultiHttpRequestor, SettingsRequestor: settingsHttpRequestor, AssetsRequestor: assetsHttpRequestor, DeploymentDir: path.Join(target, OPSMGR_BACKUP_DIR, OPSMGR_DEPLOYMENTS_DIR), Hostname: opsManagerHostname, Username: adminUsername, Password: adminPassword, BackupContext: BackupContext{ TargetDir: target, }, Executer: remoteExecuter, LocalExecuter: command.NewLocalExecuter(), OpsmanagerBackupDir: OPSMGR_BACKUP_DIR, } } return }
NewOpsManager initializes an OpsManager instance
var NfsNewRemoteExecuter func(command.SshConfig) (command.Executer, error) = command.NewRemoteExecutor
var RunPipeline = func(actionBuilder func(Tile) func() error, tiles []Tile) (err error) { var pipeline []action for _, tile := range tiles { pipeline = append(pipeline, actionBuilder(tile)) } err = runActions(pipeline) return }
Runs a pipeline action (restore/backup) on a list of tiles
var TaskPingFreq time.Duration = 1000 * time.Millisecond
Not ping server so frequently and exausted the resources
Functions ¶
func ExtractEncryptionKey ¶
func GetDeploymentName ¶
func GetDeploymentName(jsonObj InstallationCompareObject) (deploymentName string, err error)
func GetPasswordAndIP ¶
func GetPasswordAndIP(jsonObj InstallationCompareObject, product, component, username string) (ip, password string, err error)
func RunBackupPipeline ¶
func RunBackupPipeline(hostname, adminUsername, adminPassword, opsManagerUsername, opsManagerPassword, destination string) (err error)
Backup the list of all default tiles
func RunRestorePipeline ¶
func RunRestorePipeline(hostname, adminUsername, adminPassword, opsManagerUser, opsManagerPassword, destination string) (err error)
Restore the list of all default tiles
Types ¶
type BackupContext ¶
type BackupContext struct {
TargetDir string
}
type CloudController ¶
type CloudController struct {
// contains filtered or unexported fields
}
func NewCloudController ¶
func NewCloudController(ip, username, password, deploymentName, manifest string, cloudControllers CloudControllerJobs) *CloudController
func (*CloudController) Start ¶
func (c *CloudController) Start() error
func (*CloudController) Stop ¶
func (c *CloudController) Stop() error
type CloudControllerDeploymentParser ¶
type CloudControllerDeploymentParser struct {
// contains filtered or unexported fields
}
type CloudControllerJobs ¶
type CloudControllerJobs []CCJob
type ElasticRuntime ¶
type ElasticRuntime struct { JsonFile string SystemsInfo map[string]SystemDump PersistentSystems []SystemDump HttpGateway HttpGateway InstallationName string BackupContext }
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)
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 []SystemDump, action int) (err error)
type ElasticRuntimeBuilder ¶ added in v0.1.22
type ElasticRuntimeBuilder struct{}
ElasticRuntimeBuilder -- an object that can build an elastic runtime pre-initialized
func (*ElasticRuntimeBuilder) New ¶ added in v0.1.22
func (s *ElasticRuntimeBuilder) New(tileSpec tileregistry.TileSpec) (elasticRuntime tileregistry.Tile, err error)
New -- method to generate an initialized elastic runtime
type InstallationCompareObject ¶
type InstallationCompareObject struct { Guid string Installation_Version string Products []productCompareObject Infrastructure infrastructure }
func ReadAndUnmarshal ¶
func ReadAndUnmarshal(src io.Reader) (jsonObj InstallationCompareObject, err error)
type IpPasswordParser ¶
type IpPasswordParser struct { Product string Component string Username string // contains filtered or unexported fields }
func (*IpPasswordParser) Parse ¶
func (s *IpPasswordParser) Parse(jsonObj InstallationCompareObject) (ip, password string, err error)
type MysqlInfo ¶
type MysqlInfo struct { SystemInfo Database string }
func (*MysqlInfo) GetPersistanceBackup ¶
func (s *MysqlInfo) GetPersistanceBackup() (dumper PersistanceBackup, err error)
type NFSBackup ¶
func NewNFSBackup ¶
type NfsInfo ¶
type NfsInfo struct {
SystemInfo
}
func (*NfsInfo) GetPersistanceBackup ¶
func (s *NfsInfo) GetPersistanceBackup() (dumper PersistanceBackup, err error)
type OpsManager ¶
type OpsManager struct { BackupContext Hostname string Username string Password string TempestPassword string DbEncryptionKey string Executer command.Executer LocalExecuter command.Executer SettingsUploader httpUploader AssetsUploader httpUploader SettingsRequestor httpRequestor AssetsRequestor httpRequestor DeploymentDir string OpsmanagerBackupDir string }
OpsManager contains the location and credentials of a Pivotal Ops Manager instance
func (*OpsManager) Backup ¶
func (context *OpsManager) Backup() (err error)
Backup performs a backup of a Pivotal Ops Manager instance
func (*OpsManager) Restore ¶
func (context *OpsManager) Restore() (err error)
Restore performs a restore of a Pivotal Ops Manager instance
type OpsManagerBuilder ¶ added in v0.1.22
type OpsManagerBuilder struct{}
OpsManagerBuilder - an object that can build ops manager objects
func (*OpsManagerBuilder) New ¶ added in v0.1.22
func (s *OpsManagerBuilder) New(tileSpec tileregistry.TileSpec) (opsManager tileregistry.Tile, err error)
New -- builds a new ops manager object pre initialized
type PersistanceBackup ¶
type PgInfo ¶
type PgInfo struct { SystemInfo Database string }
func (*PgInfo) GetPersistanceBackup ¶
func (s *PgInfo) GetPersistanceBackup() (dumper PersistanceBackup, err error)
type SystemDump ¶
type SystemDump interface { Error() error GetPersistanceBackup() (dumper PersistanceBackup, err error) // contains filtered or unexported methods }
type SystemInfo ¶
type SystemInfo struct { goutil.GetSet Product string Component string Identity string Ip string User string Pass string VcapUser string VcapPass string }
func (*SystemInfo) Error ¶
func (s *SystemInfo) Error() (err error)
func (*SystemInfo) Get ¶
func (s *SystemInfo) Get(name string) string
func (*SystemInfo) GetPersistanceBackup ¶
func (s *SystemInfo) GetPersistanceBackup() (dumper PersistanceBackup, err error)
func (*SystemInfo) Set ¶
func (s *SystemInfo) Set(name string, val string)
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/github.com/kr/fs
Package fs provides filesystem-related functions.
|
Package fs provides filesystem-related functions. |
_workspace/src/github.com/onsi/ginkgo
Ginkgo is a BDD-style testing framework for Golang The godoc documentation describes Ginkgo's API.
|
Ginkgo is a BDD-style testing framework for Golang The godoc documentation describes Ginkgo's API. |
_workspace/src/github.com/onsi/ginkgo/config
Ginkgo accepts a number of configuration options.
|
Ginkgo accepts a number of configuration options. |
_workspace/src/github.com/onsi/ginkgo/ginkgo
The Ginkgo CLI The Ginkgo CLI is fully documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) You can also learn more by running: ginkgo help Here are some of the more commonly used commands: To install: go install github.com/onsi/ginkgo/ginkgo To run tests: ginkgo To run tests in all subdirectories: ginkgo -r To run tests in particular packages: ginkgo <flags> /path/to/package /path/to/another/package To pass arguments/flags to your tests: ginkgo <flags> <packages> -- <pass-throughs> To run tests in parallel ginkgo -p this will automatically detect the optimal number of nodes to use.
|
The Ginkgo CLI The Ginkgo CLI is fully documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) You can also learn more by running: ginkgo help Here are some of the more commonly used commands: To install: go install github.com/onsi/ginkgo/ginkgo To run tests: ginkgo To run tests in all subdirectories: ginkgo -r To run tests in particular packages: ginkgo <flags> /path/to/package /path/to/another/package To pass arguments/flags to your tests: ginkgo <flags> <packages> -- <pass-throughs> To run tests in parallel ginkgo -p this will automatically detect the optimal number of nodes to use. |
_workspace/src/github.com/onsi/ginkgo/internal/remote
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete.
|
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete. |
_workspace/src/github.com/onsi/ginkgo/reporters
Ginkgo's Default Reporter A number of command line flags are available to tweak Ginkgo's default output.
|
Ginkgo's Default Reporter A number of command line flags are available to tweak Ginkgo's default output. |
_workspace/src/github.com/onsi/gomega
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
|
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library. |
_workspace/src/github.com/onsi/gomega/format
Gomega's format package pretty-prints objects.
|
Gomega's format package pretty-prints objects. |
_workspace/src/github.com/onsi/gomega/gbytes
Package gbytes provides a buffer that supports incrementally detecting input.
|
Package gbytes provides a buffer that supports incrementally detecting input. |
_workspace/src/github.com/onsi/gomega/gexec
Package gexec provides support for testing external processes.
|
Package gexec provides support for testing external processes. |
_workspace/src/github.com/onsi/gomega/ghttp
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
|
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers. |
_workspace/src/github.com/onsi/gomega/ghttp/protobuf
Package protobuf is a generated protocol buffer package.
|
Package protobuf is a generated protocol buffer package. |
_workspace/src/github.com/onsi/gomega/matchers
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported.
|
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported. |
_workspace/src/github.com/op/go-logging
Package logging implements a logging infrastructure for Go.
|
Package logging implements a logging infrastructure for Go. |
_workspace/src/github.com/pkg/sftp
Package sftp implements the SSH File Transfer Protocol as described in https://filezilla-project.org/specs/draft-ietf-secsh-filexfer-02.txt
|
Package sftp implements the SSH File Transfer Protocol as described in https://filezilla-project.org/specs/draft-ietf-secsh-filexfer-02.txt |
_workspace/src/github.com/pkg/sftp/examples/buffered-read-benchmark
buffered-read-benchmark benchmarks the peformance of reading from /dev/zero on the server to a []byte on the client via io.Copy.
|
buffered-read-benchmark benchmarks the peformance of reading from /dev/zero on the server to a []byte on the client via io.Copy. |
_workspace/src/github.com/pkg/sftp/examples/buffered-write-benchmark
buffered-write-benchmark benchmarks the peformance of writing a single large []byte on the client to /dev/null on the server via io.Copy.
|
buffered-write-benchmark benchmarks the peformance of writing a single large []byte on the client to /dev/null on the server via io.Copy. |
_workspace/src/github.com/pkg/sftp/examples/streaming-read-benchmark
streaming-read-benchmark benchmarks the peformance of reading from /dev/zero on the server to /dev/null on the client via io.Copy.
|
streaming-read-benchmark benchmarks the peformance of reading from /dev/zero on the server to /dev/null on the client via io.Copy. |
_workspace/src/github.com/pkg/sftp/examples/streaming-write-benchmark
streaming-write-benchmark benchmarks the peformance of writing from /dev/zero on the client to /dev/null on the server via io.Copy.
|
streaming-write-benchmark benchmarks the peformance of writing from /dev/zero on the client to /dev/null on the server via io.Copy. |
_workspace/src/golang.org/x/crypto/ssh
Package ssh implements an SSH client and server.
|
Package ssh implements an SSH client and server. |
_workspace/src/golang.org/x/crypto/ssh/agent
Package agent implements a client to an ssh-agent daemon.
|
Package agent implements a client to an ssh-agent daemon. |
_workspace/src/golang.org/x/crypto/ssh/terminal
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems.
|
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems. |
_workspace/src/golang.org/x/crypto/ssh/test
This package contains integration tests for the code.google.com/p/go.crypto/ssh package.
|
This package contains integration tests for the code.google.com/p/go.crypto/ssh package. |
_workspace/src/gopkg.in/yaml.v1
Package yaml implements YAML support for the Go language.
|
Package yaml implements YAML support for the Go language. |