Documentation ¶
Overview ¶
Package mktmpio provides easy access to the database servier provisioning services at https://mktmp.io/
Index ¶
- Constants
- func ConfigPath() string
- type Client
- func (c Client) Attach(id string) (io.ReadWriteCloser, error)
- func (c Client) AttachStdio(id string) (io.WriteCloser, io.Reader, io.Reader, error)
- func (c Client) Create(service string) (*Instance, error)
- func (c Client) Destroy(id string) error
- func (c Client) List() ([]Instance, error)
- func (c *Client) SetLogger(logger *log.Logger)
- type Config
- type Instance
Constants ¶
const ( Copyright = "Copyright Datajin Technologies, Inc. 2015,2016. All rights reserved." LicenseName = "Artistic-2.0" LicenseURL = "http://opensource.org/licenses/Artistic-2.0" )
exposed for package introspection and
const MKtmpioCfgFile = "~/.mktmpio.yml"
MKtmpioCfgFile is the path to the user's config
const MktmpioURL = "https://mktmp.io/api/v1"
MktmpioURL is the root of the current version of the mktmpio HTTP API
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct { UserAgent string // contains filtered or unexported fields }
Client provides authenticated API access for creating, listing, and destroying database servers.
func NewClient ¶
NewClient creates a mktmpio Client using credentials loaded from the user config stored in ~/.mktmpio.yml
func (Client) Attach ¶
func (c Client) Attach(id string) (io.ReadWriteCloser, error)
Attach creates a remote shell for the instance identified by `id` and then returns a Reader and a Writer for communicating with it via a pseudo-TTY. The bytes read from the channel will include TTY control sequences. This type of connection is most appropriate for connecting directly to a local TTY.
func (Client) AttachStdio ¶
AttachStdio creates a remote shell for the instance identified by `id` and returns an io.WriteCloser for that shell's stdin and an io.Reader for each of stdout and stderr on that shell. This is for non-interactive shells, like one would use for piping a script into a shell or for piping the output from.
type Config ¶
type Config struct { Token string URL string `yaml:",omitempty"` // contains filtered or unexported fields }
Config contains the user config options used for accessing the mktmpio API.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a configuration with only the default values set
func EnvConfig ¶
func EnvConfig() *Config
EnvConfig returns a configuration with only values provided by environment variables
func FileConfig ¶
FileConfig returns a configuration with any values provided by the given YAML config file
func LoadConfig ¶
func LoadConfig() *Config
LoadConfig loads the configuration stored in `~/.mktmpio.yml`, returning it as a Config type instance.
func (*Config) Apply ¶
Apply creates a new Config with non-empty values from the provided Config overriding the options of the base Config
type Instance ¶
type Instance struct { ID string Host string Port int Error string RemoteShell shell Type string Username string Password string ContainerShell []string // contains filtered or unexported fields }
Instance represents a server that has been created on the mktmpio service.
func (*Instance) Cmd ¶
Cmd returns an exec.Cmd that is pre-populated with the command, arguments, and environment variables required for spawning a local shell connected to the remote server.