models

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2017 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveAccessToken

func SaveAccessToken(
	state, code, expectedState, env, controllerURL string,
	hosts map[string]string,
	fs FileSystem,
	client ClientInterface,
) error

SaveAccessToken get access token from authorization code and saves locally

Types

type ClientInterface added in v1.2.0

type ClientInterface interface {
	Get(url, host string) ([]byte, int, error)
	GetToStdOut(url, host string) error
	Put(url string, body map[string]interface{}) ([]byte, int, error)
	Delete(url string) ([]byte, int, error)
}

ClientInterface interface

type ColumnPrinter

type ColumnPrinter struct {
	Title  string
	Column []interface{}
}

ColumnPrinter implements the Printer interface

func (*ColumnPrinter) Print

func (j *ColumnPrinter) Print()

Print formats and prints a JSON

type Config

type Config struct {
	Token          string `json:"token"`
	ControllerURL  string `json:"controllerUrl"`
	ControllerHost string `json:"controllerHost"`
	LoggerHost     string `json:"loggerHost"`
	Env            string `json:"env"`
}

Config struct

func NewConfig

func NewConfig(env, token, controllerURL string, hosts map[string]string) *Config

NewConfig ctor

func ReadConfig

func ReadConfig(fs FileSystem, env string) (*Config, error)

ReadConfig from file

func (*Config) Write

func (c *Config) Write(fs FileSystem) error

Write the config file to disk

type DNSServer

type DNSServer struct {
	Domains []string

	PointTo string

	RouterDomain string
	// contains filtered or unexported fields
}

DNSServer struct

func NewDNSServer

func NewDNSServer(domains []string, forwardToDNS, routerURL, routerDomain string, port int, logger *logrus.Logger) (*DNSServer, error)

NewDNSServer ctor

func (*DNSServer) Serve

func (d *DNSServer) Serve()

Serve starts the local dns server

type ErrorPrinter

type ErrorPrinter struct {
	ErrorMap map[string]interface{}
	Status   int
	Error    string
}

ErrorPrinter implements the Printer interface

func NewErrorPrinter

func NewErrorPrinter(body []byte, status int) *ErrorPrinter

NewErrorPrinter is the ErrorPrinter ctor

func (*ErrorPrinter) Print

func (e *ErrorPrinter) Print()

Print formats and prints a JSON

type FileSystem added in v1.2.0

type FileSystem interface {
	MkdirAll(path string, perm os.FileMode) error
	Create(name string) (afero.File, error)
	RemoveAll(path string) error
	IsNotExist(err error) bool
	Stat(name string) (os.FileInfo, error)
}

FileSystem interface

type LogPrinter

type LogPrinter struct {
	Message string
	Title   string
}

LogPrinter implements the Printer interface

func NewLogPrinter

func NewLogPrinter(body []byte, title string) *LogPrinter

NewLogPrinter is the LogPrinter ctor

func NewStrLogPrinter added in v1.0.0

func NewStrLogPrinter(body string, title string) *LogPrinter

NewLogPrinter is the LogPrinter ctor

func (*LogPrinter) Print

func (l *LogPrinter) Print()

Print prints log

type Login

type Login struct {
	OAuthState    string
	ControllerURL string
}

Login gets an authorization code from google

func NewLogin

func NewLogin(controllerURL string) *Login

NewLogin is the Login ctor

func (*Login) Perform

func (l *Login) Perform() (map[string]string, error)

Perform makes a request to googleapis

type MockFS added in v1.2.0

type MockFS struct {
	AppFS afero.Fs
	// contains filtered or unexported fields
}

MockFS implements FileSystem interface

func NewMockFS added in v1.2.0

func NewMockFS(err error) *MockFS

NewMockFS constructs a new mock

func (*MockFS) Create added in v1.2.0

func (m *MockFS) Create(name string) (afero.File, error)

Create creates a mock file

func (*MockFS) IsNotExist added in v1.2.0

func (m *MockFS) IsNotExist(err error) bool

IsNotExist returns true if err if of type FileNotExists

func (*MockFS) MkdirAll added in v1.2.0

func (m *MockFS) MkdirAll(path string, perm os.FileMode) error

MkdirAll creates a mock directory

func (*MockFS) RemoveAll added in v1.2.0

func (m *MockFS) RemoveAll(path string) error

RemoveAll removes a file

func (*MockFS) Stat added in v1.2.0

func (m *MockFS) Stat(name string) (os.FileInfo, error)

Stat returns the FileInfo describing the the file

type MyStackHTTPClient

type MyStackHTTPClient struct {
	// contains filtered or unexported fields
}

MyStackHTTPClient struct

func NewMyStackHTTPClient

func NewMyStackHTTPClient(config *Config) *MyStackHTTPClient

NewMyStackHTTPClient ctor

func (*MyStackHTTPClient) Delete

func (c *MyStackHTTPClient) Delete(url string) ([]byte, int, error)

Delete does a put request

func (*MyStackHTTPClient) Get

func (c *MyStackHTTPClient) Get(url, host string) ([]byte, int, error)

Get does a get request

func (*MyStackHTTPClient) GetToStdOut added in v1.0.0

func (c *MyStackHTTPClient) GetToStdOut(url, host string) error

GetToStdOut streams the content received from server to stdout

func (*MyStackHTTPClient) Put

func (c *MyStackHTTPClient) Put(url string, body map[string]interface{}) ([]byte, int, error)

Put does a put request

type ObjPrinter

type ObjPrinter struct {
	Title       string
	ClusterName string
	Obj         interface{}
}

ObjPrinter implements the Printer interface

func (*ObjPrinter) Print

func (j *ObjPrinter) Print()

Print formats and prints a JSON

type PortForwardPrinter added in v1.1.0

type PortForwardPrinter struct {
	// contains filtered or unexported fields
}

PortForwardPrinter implements the Printer interface It prints the port binded for each mystack service of a cluster

func NewPortForwarderPrinter added in v1.1.0

func NewPortForwarderPrinter() *PortForwardPrinter

NewPortForwarderPrinter returns a PortForwardPrinter

func (*PortForwardPrinter) AddApp added in v1.2.0

func (p *PortForwardPrinter) AddApp(app, host string)

Add a new port binded to a app

func (*PortForwardPrinter) AddSvc added in v1.2.0

func (p *PortForwardPrinter) AddSvc(service, host string)

Add a new port binded to a service

func (*PortForwardPrinter) Print added in v1.1.0

func (p *PortForwardPrinter) Print()

Print formats and prints the ports for each service

type Printer

type Printer interface {
	Print()
}

Printer is the printer interface Helps unifying printers that print in different ways

type Proxy added in v1.1.0

type Proxy struct {
	// contains filtered or unexported fields
}

func NewProxy added in v1.1.0

func NewProxy(from, to string, messages map[string]interface{}) *Proxy

func (*Proxy) Start added in v1.1.0

func (p *Proxy) Start() error

func (*Proxy) Stop added in v1.1.0

func (p *Proxy) Stop()

type RealFS added in v1.2.0

type RealFS struct{}

RealFS implements FileSystem interface

func NewRealFS added in v1.2.0

func NewRealFS() *RealFS

NewRealFS constructs a new mock

func (*RealFS) Create added in v1.2.0

func (m *RealFS) Create(name string) (afero.File, error)

Create creates a mock file

func (*RealFS) IsNotExist added in v1.2.0

func (m *RealFS) IsNotExist(err error) bool

IsNotExist returns true if err if of type FileNotExists

func (*RealFS) MkdirAll added in v1.2.0

func (m *RealFS) MkdirAll(path string, perm os.FileMode) error

MkdirAll creates a mock directory

func (*RealFS) RemoveAll added in v1.2.0

func (m *RealFS) RemoveAll(path string) error

RemoveAll removes a file

func (*RealFS) Stat added in v1.2.0

func (m *RealFS) Stat(name string) (os.FileInfo, error)

Stat returns the FileInfo describing the the file

type RoutePrinter

type RoutePrinter struct {
	Apps   map[string][]string
	Domain string
}

RoutePrinter implements the Printer interface

func (*RoutePrinter) Print

func (j *RoutePrinter) Print()

Print formats and prints a JSON

type ServerControl

type ServerControl struct {
	CloseServer chan bool
	// contains filtered or unexported fields
}

ServerControl starts a go routine to end the server after callback

func NewServerControl

func NewServerControl(listener net.Listener) *ServerControl

NewServerControl is the ServerControl ctor

Jump to

Keyboard shortcuts

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