capi

package module
v0.0.0-...-86c7684 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2018 License: MIT Imports: 11 Imported by: 6

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(addr, appGuid, spaceGuid string, d Doer) *Client

func (*Client) CreateTask

func (c *Client) CreateTask(ctx context.Context, command string, interval time.Duration) error

func (*Client) GetAppGuid

func (c *Client) GetAppGuid(ctx context.Context, appName string) (string, error)

func (*Client) GetDropletGuid

func (c *Client) GetDropletGuid(ctx context.Context, appGuid string) (string, error)

func (*Client) GetEnvironmentVariables

func (c *Client) GetEnvironmentVariables(ctx context.Context, appGuid string) (map[string]string, error)

func (*Client) GetPackageGuid

func (c *Client) GetPackageGuid(ctx context.Context, appGuid string) (guid, downloadAddr string, err error)

func (*Client) GetTask

func (c *Client) GetTask(ctx context.Context, guid string) (Task, error)

func (*Client) LastEvent

func (c *Client) LastEvent(ctx context.Context, appGuid string) (Event, error)

func (*Client) ListTasks

func (c *Client) ListTasks(ctx context.Context, appGuid string, query map[string][]string) ([]Task, error)

func (*Client) ProcessStats

func (c *Client) ProcessStats(ctx context.Context, processGuid string) ([]ProcessStats, error)

func (*Client) Processes

func (c *Client) Processes(ctx context.Context, appGuid string) ([]Process, error)

func (*Client) Restart

func (c *Client) Restart(ctx context.Context, appGuid string) error

func (*Client) RunTask

func (c *Client) RunTask(ctx context.Context, command, name, droplet, appGuid string) (Task, error)

func (*Client) Scale

func (c *Client) Scale(ctx context.Context, appGuid string, instances int) error

func (*Client) SetEnvironmentVariables

func (c *Client) SetEnvironmentVariables(ctx context.Context, appGuid string, vars map[string]string) error

type Doer

type Doer interface {
	Do(req *http.Request) (*http.Response, error)
}

type Event

type Event struct {
	Resources []struct {
		MetaData struct {
			CreatedAt time.Time `json:"created_at"`
			UpdatedAt time.Time `json:"updated_at"`
		} `json:"metadata"`
		Entity struct {
			Type string `json:"type"`
		} `json:"entity"`
	} `json:"resources"`
}

type HealthCheck

type HealthCheck struct {
	Type string `json:"type"`
	Data struct {
		Timeout           int    `json:"timeout"`
		InvocationTimeout int    `json:"invocation_timeout"`
		Endpoint          string `json:"endpoint"`
	} `json:"data"`
}
type Links struct {
	Href   string `json:"href"`
	Method string `json:"method"`
}

type Process

type Process struct {
	Type        string           `json:"type"`
	Command     string           `json:"command"`
	Instances   int              `json:"instances"`
	MemoryInMB  int              `json:"memory_in_mb"`
	DiskInMB    int              `json:"disk_in_mb"`
	HealthCheck HealthCheck      `json:"health_check"`
	Guid        string           `json:"guid"`
	CreatedAt   time.Time        `json:"created_at"`
	UpdatedAt   time.Time        `json:"updated_at"`
	Links       map[string]Links `json:"links"`
}

type ProcessStats

type ProcessStats struct {
	Type  string `json:"type"`
	Index int    `json:"index"`
	State string `json:"state"`
	Usage struct {
		Time time.Time `json:"time"`
		CPU  float64   `json:"cpu"`
		Mem  float64   `json:"mem"`
		Disk int       `json:"disk"`
	} `json:"usage"`
	Host      string `json:"host"`
	Uptime    int    `json:"uptime"`
	MemQuota  int    `json:"mem_quota"`
	DiskQuota int    `json:"disk_quota"`
	FdsQuota  int    `json:"fds_quota"`
}

type Task

type Task struct {
	SequenceID  int              `json:"sequence_id"`
	Name        string           `json:"name"`
	Command     string           `json:"command"`
	DiskInMB    int              `json:"disk_in_mb"`
	MemoryInMB  int              `json:"memory_in_mb"`
	State       string           `json:"state"`
	DropletGuid string           `json:"droplet_guid"`
	Guid        string           `json:"guid"`
	CreatedAt   time.Time        `json:"created_at"`
	UpdatedAt   time.Time        `json:"updated_at"`
	Links       map[string]Links `json:"links"`
}

Jump to

Keyboard shortcuts

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