rest

package
v0.0.0-...-71a9569 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2015 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package rest implements REST API methods for remotely managing govisor.

Index

Constants

View Source
const (
	// PollHeader should be set to the last Etag on an incoming request.
	// If set we will wait until the resource has an ETag that is different
	// from the supplied value, yielding a form of long polling.
	// This is only valid with GET requests.  Note that the service may
	// return early without actually waiting, even if the ETag has not
	// changed.  Typically there is a default timeout of around a minute
	// to make sure that the client is alive and well.
	PollEtagHeader = "X-Govisor-Poll-Etag"
	PollTimeHeader = "X-Govisor-Poll-Time"
)
View Source
const (
	MimeJson = "application/json; charset=UTF-8"
)

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(t *http.Transport, baseURI string) *Client

NewClient returns a Client handle. The transport maybe nil to use a default transport, but it may also be adjusted to support additional options such as TLS. baseURI is the base URL to use.

func (*Client) ClearService

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

func (*Client) DisableService

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

func (*Client) EnableService

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

func (*Client) GetLog

func (c *Client) GetLog(name string) (*LogInfo, error)

func (*Client) GetService

func (c *Client) GetService(name string) (*ServiceInfo, error)

func (*Client) RestartService

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

func (*Client) Services

func (c *Client) Services() ([]string, error)

Services returns a list of service names known to the implementation

func (*Client) SetAuth

func (c *Client) SetAuth(user string, pass string)

func (*Client) Watch

func (c *Client) Watch(ctx context.Context, etag string) (string, error)

func (*Client) WatchLog

func (c *Client) WatchLog(ctx context.Context, name string, last *LogInfo) (*LogInfo, error)

func (*Client) WatchService

func (c *Client) WatchService(ctx context.Context, name string, last *ServiceInfo) (*ServiceInfo, error)

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (*Error) Error

func (e *Error) Error() string

type LogInfo

type LogInfo struct {
	Records []LogRecord
	// contains filtered or unexported fields
}

type LogRecord

type LogRecord struct {
	Id   string    `json:"id"`
	Time time.Time `json:"time"`
	Text string    `json:"text"`
}

type ManagerInfo

type ManagerInfo struct {
	Name       string    `json:"name"`
	Serial     string    `json:"serial"`
	CreateTime time.Time `json:"created"`
	UpdateTime time.Time `json:"updated"`
	// contains filtered or unexported fields
}

type ServiceInfo

type ServiceInfo struct {
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Enabled     bool      `json:"enabled"`
	Running     bool      `json:"running"`
	Failed      bool      `json:"failed"`
	Provides    []string  `json:"provides"`
	Depends     []string  `json:"depends"`
	Conflicts   []string  `json:"conflicts"`
	Status      string    `json:"status"`
	TimeStamp   time.Time `json:"tstamp"`
	Serial      string    `json:"serial"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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