cfpsql

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2018 License: Apache-2.0 Imports: 24 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func NewApiClient

func NewApiClient(httpClient HttpWrapper) *apiClient

func NewCfService

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

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

type CfService

type CfService interface {
	GetStartedApps(cliConnection plugin.CliConnection) ([]sdkModels.GetAppsModel, error)
	OpenSshTunnel(cliConnection plugin.CliConnection, toService PsqlService, apps []sdkModels.GetAppsModel, localPort int)
	GetService(connection plugin.CliConnection, name string) (PsqlService, 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

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

func NewHttpClientFactory

func NewHttpClientFactory() HttpClientFactory

type HttpWrapper

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 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
	PsqlRunner PsqlRunner
	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 PsqlPlugin

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

func NewPsqlPlugin

func NewPsqlPlugin(conf PluginConf) *PsqlPlugin

func (*PsqlPlugin) FormatUsage

func (self *PsqlPlugin) FormatUsage() string

func (*PsqlPlugin) GetExitCode

func (self *PsqlPlugin) GetExitCode() int

func (*PsqlPlugin) GetMetadata

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

func (*PsqlPlugin) Run

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

type PsqlRunner

type PsqlRunner interface {
	RunPsql(hostname string, port int, dbName string, username string, password string, args ...string) error
}

func NewPsqlRunner

func NewPsqlRunner(execWrapper ExecWrapper) PsqlRunner

type PsqlService

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

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 PsqlService, throughApp string, localPort int)
}

func NewSshRunner

func NewSshRunner() SshRunner

type StartedAppsResult

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