client

package
v0.0.0-...-218c583 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2017 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StatusCodePrefix = "F1E49A85-0AD7-4AEF-A618-C249C6E6568D:"

this just needs to be random enough to never show up again in a byte stream

Functions

This section is empty.

Types

type App

type App struct {
	Name    string `json:"name"`
	Release string `json:"release"`
	Status  string `json:"status"`
}

type Apps

type Apps []App

type Auth

type Auth struct {
	ID string `json:"id"`
}

Auth is used to transfer the id of the authenticating user when authing against the console API. When authing against a rack the id will be blank as user ids are a console concept

type Build

type Build struct {
	Id       string `json:"id"`
	App      string `json:"app"`
	Logs     string `json:"logs"`
	Manifest string `json:"manifest"`
	Release  string `json:"release"`
	Status   string `json:"status"`

	Description string `json:"description"`

	Started time.Time `json:"started"`
	Ended   time.Time `json:"ended"`
}

type Builds

type Builds []Build

type Certificate

type Certificate struct {
	Id         string    `json:"id"`
	Domain     string    `json:"domain"`
	Expiration time.Time `json:"expiration"`
}

type Certificates

type Certificates []Certificate

type Client

type Client struct {
	Host     string
	Password string
	Version  string

	Rack string
}

func New

func New(host, password, version string) *Client

func (*Client) AddRegistry

func (c *Client) AddRegistry(server, username, password, email string) (*Registry, error)

func (*Client) Auth

func (c *Client) Auth() (*Auth, error)

Auth is a request that simply checks whether the password is valid in the case of console the users id will be returned, a rack will return an empty string

func (*Client) CancelApp

func (c *Client) CancelApp(name string) error

func (*Client) CopyBuild

func (c *Client) CopyBuild(app, id, destApp string) (*Build, error)

func (*Client) CreateApp

func (c *Client) CreateApp(name string) (*App, error)

func (*Client) CreateBuildIndex

func (c *Client) CreateBuildIndex(app string, index Index, cache bool, config string, description string) (*Build, error)

func (*Client) CreateBuildSource

func (c *Client) CreateBuildSource(app string, source io.Reader, opts CreateBuildSourceOptions) (*Build, error)

CreateBuildSource will create a new build from source

func (*Client) CreateBuildUrl

func (c *Client) CreateBuildUrl(app string, url string, cache bool, config string, description string) (*Build, error)

func (*Client) CreateCertificate

func (c *Client) CreateCertificate(pub, key, chain string) (*Certificate, error)
func (c *Client) CreateLink(app, name string) (*Resource, error)

CreateLink creates a link between an app and a resource.

func (*Client) CreateResource

func (c *Client) CreateResource(kind string, options map[string]string) (*Resource, error)

CreateResource creates a new resource.

func (*Client) Delete

func (c *Client) Delete(path string, out interface{}) error

func (*Client) DeleteApp

func (c *Client) DeleteApp(name string) (*App, error)

func (*Client) DeleteBuild

func (c *Client) DeleteBuild(app, id string) (*Build, error)

func (*Client) DeleteCertificate

func (c *Client) DeleteCertificate(id string) error

func (*Client) DeleteEnvironment

func (c *Client) DeleteEnvironment(app, key string) (Environment, string, error)
func (c *Client) DeleteLink(app, name string) (*Resource, error)

DeleteLink deletes a link between an app and a resource.

func (*Client) DeleteResource

func (c *Client) DeleteResource(name string) (*Resource, error)

DeleteResource deletes a resource.

func (*Client) DeleteResponse

func (c *Client) DeleteResponse(path string, out interface{}) (*http.Response, error)

func (*Client) ExecProcessAttached

func (c *Client) ExecProcessAttached(app, pid, command string, in io.Reader, out io.WriteCloser, height, width int) (int, error)

func (*Client) ExportBuild

func (c *Client) ExportBuild(app, id string, w io.Writer) error

ExportBuild creats an artifact, representing a build, to be used with another Rack

func (*Client) GenerateCertificate

func (c *Client) GenerateCertificate(domains []string) (*Certificate, error)

func (*Client) Get

func (c *Client) Get(path string, out interface{}) error

func (*Client) GetApp

func (c *Client) GetApp(name string) (*App, error)

func (*Client) GetApps

func (c *Client) GetApps() (Apps, error)

func (*Client) GetBuild

func (c *Client) GetBuild(app, id string) (*Build, error)

func (*Client) GetBuilds

func (c *Client) GetBuilds(app string) (Builds, error)

func (*Client) GetBuildsWithLimit

func (c *Client) GetBuildsWithLimit(app string, limit int) (Builds, error)

GetBuildsWithLimit returns a list of the latest builds, with the length specified in limit

func (*Client) GetEnvironment

func (c *Client) GetEnvironment(app string) (Environment, error)

func (*Client) GetInstances

func (c *Client) GetInstances() ([]*Instance, error)

func (*Client) GetProcess

func (c *Client) GetProcess(app, id string) (*Process, error)

func (*Client) GetProcesses

func (c *Client) GetProcesses(app string, stats bool) (Processes, error)

func (*Client) GetRelease

func (c *Client) GetRelease(app, id string) (*Release, error)

func (*Client) GetReleases

func (c *Client) GetReleases(app string) (Releases, error)

func (*Client) GetReleasesWithLimit

func (c *Client) GetReleasesWithLimit(app string, limit int) (Releases, error)

GetReleasesWithLimit requests releases of an app, overriding the default limit.

func (*Client) GetResource

func (c *Client) GetResource(name string) (*Resource, error)

GetResource retrieves a resource by name.

func (*Client) GetResources

func (c *Client) GetResources() (Resources, error)

GetResources retrieves a list of resources.

func (*Client) GetSystem

func (c *Client) GetSystem() (*System, error)

func (*Client) GetSystemCapacity

func (c *Client) GetSystemCapacity() (*SystemCapacity, error)

func (*Client) GetSystemProcesses

func (c *Client) GetSystemProcesses(opts structs.SystemProcessesOptions) (Processes, error)

func (*Client) GetSystemReleases

func (c *Client) GetSystemReleases() (Releases, error)

func (*Client) ImportBuild

func (c *Client) ImportBuild(app string, r io.Reader, opts ImportBuildOptions) (*structs.Build, error)

ImportBuild imports a build artifact

func (*Client) IndexMissing

func (c *Client) IndexMissing(index Index) ([]string, error)

func (*Client) IndexUpdate

func (c *Client) IndexUpdate(update io.Reader, opts IndexUpdateOptions) error

IndexUpdate uploads a tarball of changes to the index

func (*Client) InstanceKeyroll

func (c *Client) InstanceKeyroll() error

func (*Client) ListCertificates

func (c *Client) ListCertificates() (Certificates, error)

func (*Client) ListFormation

func (c *Client) ListFormation(app string) (Formation, error)

func (*Client) ListParameters

func (c *Client) ListParameters(app string) (Parameters, error)

func (*Client) ListRegistries

func (c *Client) ListRegistries() (*Registries, error)

func (*Client) ListSSL

func (c *Client) ListSSL(app string) (*SSLs, error)

func (*Client) Post

func (c *Client) Post(path string, params Params, out interface{}) error

func (*Client) PostBody

func (c *Client) PostBody(path string, body io.Reader, out interface{}) error

func (*Client) PostBodyResponse

func (c *Client) PostBodyResponse(path string, body io.Reader, out interface{}) (*http.Response, error)

func (*Client) PostMultipart

func (c *Client) PostMultipart(path string, opts PostMultipartOptions, out interface{}) error

PostMultipart posts a multipart message in the MIME internet format.

func (*Client) PromoteRelease

func (c *Client) PromoteRelease(app, id string) (*Release, error)

func (*Client) Proxy

func (c *Client) Proxy(host string, port int, rw io.ReadWriteCloser) error

func (*Client) Put

func (c *Client) Put(path string, params Params, out interface{}) error

func (*Client) PutBody

func (c *Client) PutBody(path string, body io.Reader, out interface{}) error

func (*Client) Racks

func (c *Client) Racks() (racks []Rack, err error)

func (*Client) RegenerateToken

func (c *Client) RegenerateToken(email, password string) (string, error)

func (*Client) RemoveRegistry

func (c *Client) RemoveRegistry(server string) error

func (*Client) Request

func (c *Client) Request(method, path string, body io.Reader) (*http.Request, error)

Request wraps http.Request and sets some Convox-specific headers

func (*Client) RunProcessAttached

func (c *Client) RunProcessAttached(app, process, command, release string, height, width int, in io.Reader, out io.WriteCloser) (int, error)

func (*Client) RunProcessDetached

func (c *Client) RunProcessDetached(app, process, command, release string) error

func (*Client) SSHInstance

func (c *Client) SSHInstance(id, cmd string, height, width int, isTerm bool, in io.Reader, out io.WriteCloser) (int, error)

func (*Client) ScaleSystem

func (c *Client) ScaleSystem(count int, typ string) (*System, error)

func (*Client) SetEnvironment

func (c *Client) SetEnvironment(app string, body io.Reader) (Environment, string, error)

func (*Client) SetFormation

func (c *Client) SetFormation(app, process string, opts FormationOptions) error

SetFormation updates the Count, CPU, or Memory parameters for a process

func (*Client) SetParameters

func (c *Client) SetParameters(app string, params map[string]string) error

func (*Client) StopProcess

func (c *Client) StopProcess(app, id string) (*Process, error)

func (*Client) Stream

func (c *Client) Stream(path string, headers map[string]string, in io.Reader, out io.Writer) error

func (*Client) StreamAppLogs

func (c *Client) StreamAppLogs(app, filter string, follow bool, since time.Duration, output io.WriteCloser) error

func (*Client) StreamBuildLogs

func (c *Client) StreamBuildLogs(app, id string, output io.Writer) error

func (*Client) StreamRackLogs

func (c *Client) StreamRackLogs(filter string, follow bool, since time.Duration, output io.WriteCloser) error

StreamRackLogs streams the logs for a Rack

func (*Client) StreamReleaseLogs

func (c *Client) StreamReleaseLogs(app, id string, output io.WriteCloser) error

func (*Client) Switch

func (c *Client) Switch(rackName string) (success map[string]string, err error)

func (*Client) TerminateInstance

func (c *Client) TerminateInstance(id string) error

func (*Client) UpdateBuild

func (c *Client) UpdateBuild(app, id, manifest, status, reason string) (*Build, error)

func (*Client) UpdateResource

func (c *Client) UpdateResource(name string, options map[string]string) (*Resource, error)

UpdateResource updates a resource.

func (*Client) UpdateSSL

func (c *Client) UpdateSSL(app, process, port, id string) (*SSL, error)

func (*Client) UpdateSystem

func (c *Client) UpdateSystem(version string) (*System, error)

func (*Client) UpdateSystemOriginal

func (c *Client) UpdateSystemOriginal(version string) (*System, error)

type CreateBuildSourceOptions

type CreateBuildSourceOptions struct {
	Cache       bool
	Config      string
	Description string
	Progress    Progress
}

type Environment

type Environment map[string]string

type Error

type Error struct {
	Error string `json:"error"`
}

type Files

type Files map[string]io.Reader

type Formation

type Formation []FormationEntry

type FormationEntry

type FormationEntry struct {
	Balancer string `json:"balancer"`
	Name     string `json:"name"`
	Count    int    `json:"count"`
	Memory   int    `json:"memory"`
	CPU      int    `json:"cpu"`
	Ports    []int  `json:"ports"`
}

type FormationOptions

type FormationOptions struct {
	Count  string
	CPU    string
	Memory string
}

FormationOptions carries the numeric dimensions that can change for a process type. Empty string indicates no change.

type ImportBuildOptions

type ImportBuildOptions struct {
	Progress Progress
}

type Index

type Index map[string]IndexItem

type IndexItem

type IndexItem struct {
	Name    string      `json:"name"`
	Mode    os.FileMode `json:"mode"`
	ModTime time.Time   `json:"mtime"`
	Size    int         `json:"-"`
}

type IndexUpdateOptions

type IndexUpdateOptions struct {
	Progress Progress
}

type Instance

type Instance struct {
	Agent     bool      `json:"agent"`
	Cpu       float64   `json:"cpu"`
	Id        string    `json:"id"`
	Memory    float64   `json:"memory"`
	PrivateIp string    `json:"private-ip"`
	Processes int       `json:"processes"`
	PublicIp  string    `json:"public-ip"`
	Status    string    `json:"status"`
	Started   time.Time `json:"started"`
}

type NotifyEvent

type NotifyEvent struct {
	Action    string            `json:"action"`
	Status    string            `json:"status"`
	Data      map[string]string `json:"data"`
	Timestamp time.Time         `json:"timestamp"`
}

a NotifyEvent is the payload of any webhook services it is serialized to json

type Organization

type Organization struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type Parameters

type Parameters map[string]string

type Params

type Params map[string]string

type PostMultipartOptions

type PostMultipartOptions struct {
	Files    Files
	Params   Params
	Progress Progress
}

type Process

type Process struct {
	Id      string    `json:"id"`
	App     string    `json:"app"`
	Command string    `json:"command"`
	Host    string    `json:"host"`
	Image   string    `json:"image"`
	Name    string    `json:"name"`
	Ports   []string  `json:"ports"`
	Release string    `json:"release"`
	Cpu     float64   `json:"cpu"`
	Memory  float64   `json:"memory"`
	Started time.Time `json:"started"`
}

type Processes

type Processes []Process

type Progress

type Progress interface {
	Start(total int64)
	Progress(current int64)
	Finish()
}

type ProgressReader

type ProgressReader struct {
	io.Reader
	// contains filtered or unexported fields
}

func NewProgressReader

func NewProgressReader(r io.Reader, tick func(int64)) *ProgressReader

func (*ProgressReader) Read

func (pr *ProgressReader) Read(p []byte) (int, error)

type Rack

type Rack struct {
	Name         string        `json:"name"`
	Status       string        `json:"status"`
	Organization *Organization `json:"organization"`
}

type Registries

type Registries []Registry

type Registry

type Registry struct {
	Server   string `json:"server"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type Release

type Release struct {
	Id       string    `json:"id"`
	App      string    `json:"app"`
	Build    string    `json:"build"`
	Env      string    `json:"env"`
	Manifest string    `json:"manifest"`
	Created  time.Time `json:"created"`
}

type Releases

type Releases []Release

type Resource

type Resource struct {
	Name         string            `json:"name"`
	Status       string            `json:"status"`
	StatusReason string            `json:"status-reason"`
	Type         string            `json:"type"`
	Exports      map[string]string `json:"exports"`
	// DEPRECATED: should inject any data in Exports
	// we only set this on the outgoing response for old clients
	URL string `json:"url"`

	Outputs    map[string]string `json:"-"`
	Parameters map[string]string `json:"-"`
	Tags       map[string]string `json:"-"`
}

Resource is an external resource.

type Resources

type Resources []Resource

Resources is a list of resources.

type SSL

type SSL struct {
	Certificate string    `json:"certificate"`
	Domain      string    `json:"domain"`
	Expiration  time.Time `json:"expiration"`
	Port        int       `json:"port"`
	Process     string    `json:"process"`
	Secure      bool      `json:"secure"`
}

type SSLs

type SSLs []SSL

type System

type System struct {
	Count             int    `json:"count"`
	Name              string `json:"name"`
	Region            string `json:"region"`
	Status            string `json:"status"`
	Type              string `json:"type"`
	Version           string `json:"version"`
	BuildInstanceType string `json:"buildinstance"`
}

type SystemCapacity

type SystemCapacity struct {
	ClusterMemory  int64 `json:"cluster-memory"`
	InstanceMemory int64 `json:"instance-memory"`
	ProcessCount   int64 `json:"process-count"`
	ProcessMemory  int64 `json:"process-memory"`
	ProcessWidth   int64 `json:"process-width"`
}

Jump to

Keyboard shortcuts

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