client

package
v0.0.0-...-f620936 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(endpoint string, client string, clientSecret string, httpClient boshhttp.HTTPClient, logger boshlog.Logger) Client

func (Client) CreateIncident

func (c Client) CreateIncident(req incident.Request) (incident.Response, error)

func (Client) GetIncident

func (c Client) GetIncident(id string) (incident.Response, error)

func (Client) StopTask

func (c Client) StopTask(id string) error

type ClientRequest

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

func NewClientRequest

func NewClientRequest(
	endpoint string,
	client string,
	clientSecret string,
	httpClient boshhttp.HTTPClient,
	logger boshlog.Logger,
) ClientRequest

func (ClientRequest) Get

func (r ClientRequest) Get(path string, response interface{}) error

func (ClientRequest) Post

func (r ClientRequest) Post(path string, request interface{}, response interface{}) error

type Config

type Config struct {
	Host string
	Port int

	Username string
	Password string

	CACert string
}

func NewConfigFromEnv

func NewConfigFromEnv() Config

func (Config) CACertPool

func (c Config) CACertPool() (*x509.CertPool, error)

func (Config) Validate

func (c Config) Validate() error

type Factory

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

func NewFactory

func NewFactory(logger boshlog.Logger) Factory

func (Factory) New

func (f Factory) New(config Config) Turbulence

type Incident

type Incident interface {
	Wait() // todo add timeout?

	TasksOfType(tasks.Options) []Task
	HasTaskErrors() bool

	// ExecutionStartedAt is expected to always return time,
	// unlike ExecutionCompletedAt which may return nil
	// when execution is not yet finished
	ExecutionStartedAt() time.Time
	ExecutionCompletedAt() *time.Time
}

type IncidentImpl

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

func (IncidentImpl) ExecutionCompletedAt

func (i IncidentImpl) ExecutionCompletedAt() *time.Time

func (IncidentImpl) ExecutionStartedAt

func (i IncidentImpl) ExecutionStartedAt() time.Time

func (IncidentImpl) HasTaskErrors

func (i IncidentImpl) HasTaskErrors() bool

func (IncidentImpl) TasksOfType

func (i IncidentImpl) TasksOfType(example tasks.Options) []Task

func (IncidentImpl) Wait

func (i IncidentImpl) Wait()

type Instance

type Instance struct {
	ID         string
	Group      string
	Deployment string
	AZ         string
}

type Task

type Task interface {
	Stop()

	Instance() Instance
	Error() string

	ExecutionStartedAt() time.Time
	ExecutionCompletedAt() *time.Time
}

type TaskImpl

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

func (TaskImpl) Error

func (t TaskImpl) Error() string

func (TaskImpl) ExecutionCompletedAt

func (t TaskImpl) ExecutionCompletedAt() *time.Time

func (TaskImpl) ExecutionStartedAt

func (t TaskImpl) ExecutionStartedAt() time.Time

func (TaskImpl) Instance

func (t TaskImpl) Instance() Instance

func (TaskImpl) Stop

func (t TaskImpl) Stop()

type Turbulence

type Turbulence interface {
	CreateIncident(incident.Request) Incident
}

Turbulence client is designed to be test friendly hence it does not return errors but rather panics.

type TurbulenceImpl

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

func (TurbulenceImpl) CreateIncident

func (t TurbulenceImpl) CreateIncident(req incident.Request) Incident

Jump to

Keyboard shortcuts

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