cfmysql

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 15, 2018 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

View Source
const ServiceKeyName = "cf-mysql"
View Source
const SleepTime = 100

Variables

This section is empty.

Functions

func NewApiClient added in v1.3.4

func NewApiClient(httpClient HttpWrapper) *apiClient

func NewCfService added in v1.3.4

func NewCfService(apiClient ApiClient, runner SshRunner, waiter PortWaiter, httpClient HttpWrapper, randWrapper RandWrapper, logWriter io.Writer) *cfService

func NewRequestDumper

func NewRequestDumper(osWrapper OsWrapper, writer io.Writer) *conditionalRequestDumper

Types

type ApiClient

type ApiClient interface {
	GetStartedApps(cliConnection plugin.CliConnection) ([]sdkModels.GetAppsModel, error)
	GetService(cliConnection plugin.CliConnection, spaceGuid string, name string) (pluginModels.ServiceInstance, error)
	GetServiceKey(cliConnection plugin.CliConnection, serviceInstanceGuid string, keyName string) (key pluginModels.ServiceKey, found bool, err error)
	CreateServiceKey(cliConnection plugin.CliConnection, serviceInstanceGuid string, keyName string) (pluginModels.ServiceKey, error)
}

type BindingResult added in v1.3.1

type BindingResult struct {
	Bindings []pluginModels.ServiceBinding
	Err      error
}

type CfService added in v1.3.4

type CfService interface {
	GetStartedApps(cliConnection plugin.CliConnection) ([]sdkModels.GetAppsModel, error)
	OpenSshTunnel(cliConnection plugin.CliConnection, toService MysqlService, apps []sdkModels.GetAppsModel, localPort int)
	GetService(connection plugin.CliConnection, name string) (MysqlService, error)
}

type CliConfig

type CliConfig struct {
	AccessToken string
	ApiEndpoint string
	SslDisabled bool
}

type DefaultLocaleReader

type DefaultLocaleReader struct{}

func (*DefaultLocaleReader) Locale

func (self *DefaultLocaleReader) Locale() string

type ExecWrapper

type ExecWrapper interface {
	LookPath(file string) (string, error)
	Run(*exec.Cmd) error
}

func NewExecWrapper

func NewExecWrapper() ExecWrapper

type HttpClientFactory added in v1.4.0

type HttpClientFactory interface {
	NewClient(sslDisabled bool) *http.Client
}

func NewHttpClientFactory added in v1.4.0

func NewHttpClientFactory() HttpClientFactory

type HttpWrapper added in v1.3.1

type HttpWrapper interface {
	Get(endpoint string, accessToken string, skipSsl bool) ([]byte, error)
	Post(url string, body io.Reader, accessToken string, sslDisabled bool) ([]byte, error)
}

func NewHttpWrapper

func NewHttpWrapper(factory HttpClientFactory, requestDumper net.RequestDumperInterface) HttpWrapper

type MysqlPlugin

type MysqlPlugin struct {
	In          io.Reader
	Out         io.Writer
	Err         io.Writer
	CfService   CfService
	MysqlRunner MysqlRunner
	PortFinder  PortFinder
	// contains filtered or unexported fields
}

func NewMysqlPlugin

func NewMysqlPlugin(conf PluginConf) *MysqlPlugin

func (*MysqlPlugin) FormatUsage

func (self *MysqlPlugin) FormatUsage() string

func (*MysqlPlugin) GetExitCode

func (self *MysqlPlugin) GetExitCode() int

func (*MysqlPlugin) GetMetadata

func (self *MysqlPlugin) GetMetadata() plugin.PluginMetadata

func (*MysqlPlugin) Run

func (self *MysqlPlugin) Run(cliConnection plugin.CliConnection, args []string)

type MysqlRunner

type MysqlRunner interface {
	RunMysql(hostname string, port int, dbName string, username string, password string, args ...string) error
	RunMysqlDump(hostname string, port int, dbName string, username string, password string, args ...string) error
}

func NewMysqlRunner

func NewMysqlRunner(execWrapper ExecWrapper) MysqlRunner

type MysqlService

type MysqlService struct {
	Name     string
	Hostname string
	Port     string
	DbName   string
	Username string
	Password string
}

type NetWrapper

type NetWrapper interface {
	Dial(network, address string) (net.Conn, error)
	Close(conn net.Conn) error
}

func NewNetWrapper

func NewNetWrapper() NetWrapper

type OsWrapper

type OsWrapper interface {
	LookupEnv(key string) (string, bool)
}

func NewOsWrapper

func NewOsWrapper() OsWrapper

type PluginConf

type PluginConf struct {
	In          io.Reader
	Out         io.Writer
	Err         io.Writer
	CfService   CfService
	MysqlRunner MysqlRunner
	PortFinder  PortFinder
}

type PortFinder

type PortFinder interface {
	GetPort() int
}

func NewPortFinder

func NewPortFinder() PortFinder

type PortWaiter

type PortWaiter interface {
	WaitUntilOpen(localPort int)
}

func NewPortWaiter

func NewPortWaiter(netWrapper NetWrapper) PortWaiter

type RandWrapper

type RandWrapper interface {
	Intn(n int) int
}

func NewRandWrapper

func NewRandWrapper() RandWrapper

type ServiceKeyRequest

type ServiceKeyRequest struct {
	Name                string `json:"name"`
	ServiceInstanceGuid string `json:"service_instance_guid"`
}

type SshRunner

type SshRunner interface {
	OpenSshTunnel(cliConnection plugin.CliConnection, toService MysqlService, throughApp string, localPort int)
}

func NewSshRunner

func NewSshRunner() SshRunner

type StartedAppsResult added in v1.3.1

type StartedAppsResult struct {
	Apps []plugin_models.GetAppsModel
	Err  error
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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