client

package
v0.0.0-...-1b1fa67 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2017 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrNotFound indicates kkok server returned 404.
	ErrNotFound = errors.New("not found")
)

Functions

func AlertsCommand

func AlertsCommand() subcommands.Command

AlertsCommand implements "alerts" subcommand.

func AlertsListCommand

func AlertsListCommand() subcommands.Command

AlertsListCommand implements "alerts list" subcommand.

func AlertsPostCommand

func AlertsPostCommand() subcommands.Command

AlertsPostCommand implements "alerts post" subcommand.

func AlertsPostJSONCommand

func AlertsPostJSONCommand() subcommands.Command

AlertsPostJSONCommand implements "alerts postJSON" subcommand.

func Call

func Call(ctx context.Context, method, api string, j interface{}) ([]byte, error)

Call makes a REST API call to kkok server. method is HTTP method. api is API request path such as /version. If j is []byte, it will be used as the request body. If j is not []byte nor nil, it will be encoded into JSON and be used as request body.

If server returns 200, this returns the response body and nil. If server returns 404, this returns nil and ErrNotFound. For other status codes, this will return non-nil errors.

func FiltersCommand

func FiltersCommand() subcommands.Command

FiltersCommand implements "filters" subcommand.

func FiltersDeleteCommand

func FiltersDeleteCommand() subcommands.Command

FiltersDeleteCommand implements "filters delete" subcommand.

func FiltersDisableCommand

func FiltersDisableCommand() subcommands.Command

FiltersDisableCommand implements "filters disable" subcommand.

func FiltersEnableCommand

func FiltersEnableCommand() subcommands.Command

FiltersEnableCommand implements "filters enable" subcommand.

func FiltersInactivateCommand

func FiltersInactivateCommand() subcommands.Command

FiltersInactivateCommand implements "filters inactivate" subcommand.

func FiltersListCommand

func FiltersListCommand() subcommands.Command

FiltersListCommand implements "filters list" subcommand.

func FiltersPutCommand

func FiltersPutCommand() subcommands.Command

FiltersPutCommand implements "filters put" subcommand.

func FiltersShowCommand

func FiltersShowCommand() subcommands.Command

FiltersShowCommand implements "filters show" subcommand.

func NewCommander

func NewCommander(f *flag.FlagSet, name string) *subcommands.Commander

NewCommander creates a subcommands.Commander for nested sub commands. This registers "flags" and "help" sub commands for the new commander.

func RoutesCommand

func RoutesCommand() subcommands.Command

RoutesCommand implements "routes" subcommand.

func RoutesListCommand

func RoutesListCommand() subcommands.Command

RoutesListCommand implements "routes list" subcommand.

func RoutesPutCommand

func RoutesPutCommand() subcommands.Command

RoutesPutCommand implements "routes put" subcommand.

func RoutesShowCommand

func RoutesShowCommand() subcommands.Command

RoutesShowCommand implements "routes show" subcommand.

func Setup

func Setup(u *url.URL, token string)

Setup configures REST API client.

func VersionCommand

func VersionCommand() subcommands.Command

VersionCommand implements "version" subcommand.

Types

type Command

type Command interface {
	SetFlags(f *flag.FlagSet)
	Execute(ctx context.Context, f *flag.FlagSet) subcommands.ExitStatus
}

Command is the interface for NewCommand

Jump to

Keyboard shortcuts

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