client

package
v1.3.0-rc4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2017 License: MIT Imports: 13 Imported by: 0

README

Kapacitor HTTP API Go client

This package provides an official Go client package for the Kapacitor HTTP API.

API stability

NOTE: This package will not be considered stable until the 1.0 release of Kapacitor.

This is version 1 of the client, after the 1.0 release no breaking changes will be made to this package. Future versions may be added as necessary.

Docs

Documentation

Overview

Kapacitor HTTP API client written in Go

Index

Constants

View Source
const DefaultUserAgent = "KapacitorClient"

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationMethod added in v1.0.0

type AuthenticationMethod int

AuthenticationMethod defines the type of authentication used.

const (
	UserAuthentication AuthenticationMethod
	BearerAuthentication
)

Supported authentication methods.

type Client

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

Basic HTTP client

func New

func New(conf Config) (*Client, error)

Create a new client.

func (*Client) Backup added in v1.3.0

func (c *Client) Backup() (int64, io.ReadCloser, error)

Backup requests a backup of all storage from Kapacitor. A short read is possible, to verify that the backup was successful check that the number of bytes read matches the returned size.

func (*Client) BaseURL added in v1.0.0

func (c *Client) BaseURL() url.URL

func (*Client) ConfigElement added in v1.1.0

func (c *Client) ConfigElement(link Link) (ConfigElement, error)

ConfigElement returns the running configuration for a given section and element.

func (c *Client) ConfigElementLink(section, element string) Link

func (*Client) ConfigSection added in v1.1.0

func (c *Client) ConfigSection(link Link) (ConfigSection, error)

ConfigSection returns the running configuration for a section.

func (c *Client) ConfigSectionLink(section string) Link

func (*Client) ConfigSections added in v1.1.0

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

ConfigSections returns all the running configuration sections that can be modified.

func (*Client) ConfigUpdate added in v1.1.0

func (c *Client) ConfigUpdate(link Link, action ConfigUpdateAction) error

ConfigUpdate performs a given ConfigUpdateAction against a given section or element.

func (*Client) CreateReplay

func (c *Client) CreateReplay(opt CreateReplayOptions) (Replay, error)

Replay a recording for a task.

func (*Client) CreateTask

func (c *Client) CreateTask(opt CreateTaskOptions) (Task, error)

Create a new task. Errors if the task already exists.

func (*Client) CreateTemplate added in v1.0.0

func (c *Client) CreateTemplate(opt CreateTemplateOptions) (Template, error)

Create a new template. Errors if the template already exists.

func (*Client) CreateTopicHandler added in v1.3.0

func (c *Client) CreateTopicHandler(link Link, opt TopicHandlerOptions) (TopicHandler, error)

CreateTopicHandler creates a new alert handler. Errors if the handler already exists.

func (*Client) DebugVars added in v1.0.0

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

Get all Kapacitor vars

func (*Client) DeleteRecording

func (c *Client) DeleteRecording(link Link) error

Delete a recording.

func (*Client) DeleteReplay

func (c *Client) DeleteReplay(link Link) error

Delete a replay. This will cancel a running replay.

func (*Client) DeleteTask

func (c *Client) DeleteTask(link Link) error

Delete a task.

func (*Client) DeleteTemplate added in v1.0.0

func (c *Client) DeleteTemplate(link Link) error

Delete a template.

func (*Client) DeleteTopic added in v1.2.0

func (c *Client) DeleteTopic(link Link) error

func (*Client) DeleteTopicHandler added in v1.3.0

func (c *Client) DeleteTopicHandler(link Link) error

DeleteTopicHandler deletes a handler.

func (*Client) Do added in v1.0.0

func (c *Client) Do(req *http.Request, result interface{}, codes ...int) (*http.Response, error)

Perform the request. If result is not nil the response body is JSON decoded into result. Codes is a list of valid response codes.

func (*Client) DoServiceTest added in v1.1.0

func (c *Client) DoServiceTest(link Link, sto ServiceTestOptions) (ServiceTestResult, error)

DoServiceTest performs a test for a service.

func (*Client) DoStorageAction added in v1.3.0

func (c *Client) DoStorageAction(l Link, opt StorageActionOptions) error

func (*Client) ListRecordings

func (c *Client) ListRecordings(opt *ListRecordingsOptions) ([]Recording, error)

Get information about recordings. If rids is empty than all recordings are returned.

func (*Client) ListReplays

func (c *Client) ListReplays(opt *ListReplaysOptions) ([]Replay, error)

Get information about replays. If rids is empty than all replays are returned.

func (*Client) ListServiceTests added in v1.1.0

func (c *Client) ListServiceTests(opt *ListServiceTestsOptions) (ServiceTests, error)

ServiceTests returns the list of services available for testing.

func (*Client) ListStorage added in v1.3.0

func (c *Client) ListStorage() (StorageList, error)

func (*Client) ListTasks

func (c *Client) ListTasks(opt *ListTasksOptions) ([]Task, error)

Get tasks.

func (*Client) ListTemplates added in v1.0.0

func (c *Client) ListTemplates(opt *ListTemplatesOptions) ([]Template, error)

Get templates.

func (*Client) ListTopicEvents added in v1.2.0

func (c *Client) ListTopicEvents(link Link, opt *ListTopicEventsOptions) (TopicEvents, error)

ListTopicEvents returns the current state for events within a topic.

func (*Client) ListTopicHandlers added in v1.2.0

func (c *Client) ListTopicHandlers(link Link, opt *ListTopicHandlersOptions) (TopicHandlers, error)

func (*Client) ListTopics added in v1.2.0

func (c *Client) ListTopics(opt *ListTopicsOptions) (Topics, error)

func (*Client) LogLevel

func (c *Client) LogLevel(level string) error

Set the logging level. Level must be one of DEBUG, INFO, WARN, ERROR, or OFF

func (*Client) PatchTopicHandler added in v1.3.0

func (c *Client) PatchTopicHandler(link Link, patch JSONPatch) (TopicHandler, error)

PatchTopicHandler applies a patch operation to an existing handler.

func (*Client) Ping

func (c *Client) Ping() (time.Duration, string, error)

Ping the server for a response. Ping returns how long the request took, the version of the server it connected to, and an error if one occurred.

func (*Client) RecordBatch

func (c *Client) RecordBatch(opt RecordBatchOptions) (Recording, error)

Record the batch queries for a task. Returns once the recording is started.

func (*Client) RecordQuery

func (c *Client) RecordQuery(opt RecordQueryOptions) (Recording, error)

Record the results of a query. The recordingType must be one of "stream", or "batch". Returns once the recording is started.

func (*Client) RecordStream

func (c *Client) RecordStream(opt RecordStreamOptions) (Recording, error)

Record the stream for a task. Returns once the recording is started.

func (*Client) Recording

func (c *Client) Recording(link Link) (Recording, error)

Get information about a recording.

func (c *Client) RecordingLink(id string) Link

func (*Client) ReplaceTopicHandler added in v1.3.0

func (c *Client) ReplaceTopicHandler(link Link, opt TopicHandlerOptions) (TopicHandler, error)

ReplaceTopicHandler replaces an existing handler, with the new definition.

func (*Client) Replay

func (c *Client) Replay(link Link) (Replay, error)

Return the replay information

func (*Client) ReplayBatch added in v1.0.0

func (c *Client) ReplayBatch(opt ReplayBatchOptions) (Replay, error)

Replay a query against a task.

func (c *Client) ReplayLink(id string) Link

func (*Client) ReplayQuery added in v1.0.0

func (c *Client) ReplayQuery(opt ReplayQueryOptions) (Replay, error)

Replay a query against a task.

func (*Client) ServiceTest added in v1.1.0

func (c *Client) ServiceTest(link Link) (ServiceTest, error)

ServiceTest returns the options available for a service test.

func (c *Client) ServiceTestLink(service string) Link
func (c *Client) StorageLink(name string) Link

func (*Client) Task

func (c *Client) Task(link Link, opt *TaskOptions) (Task, error)

Get information about a task. Options can be nil and the default options will be used. By default the DOT content will use attributes for stats. Use DotView="labels" to generate a purley labels based DOT content, which can accurately be rendered but is less readable. By default the TICKscript contents are formatted, use ScriptFormat="raw" to return the TICKscript unmodified.

func (c *Client) TaskLink(id string) Link

func (*Client) TaskOutput

func (c *Client) TaskOutput(link Link, name string) (*influxql.Result, error)

func (*Client) Template added in v1.0.0

func (c *Client) Template(link Link, opt *TemplateOptions) (Template, error)

Get information about a template. Options can be nil and the default options will be used. By default the TICKscript contents are formatted, use ScriptFormat="raw" to return the TICKscript unmodified.

func (c *Client) TemplateLink(id string) Link

func (*Client) Topic added in v1.2.0

func (c *Client) Topic(link Link) (Topic, error)

func (*Client) TopicEvent added in v1.2.0

func (c *Client) TopicEvent(link Link) (TopicEvent, error)

TopicEvent retrieves details for a single event of a topic Errors if no event exists.

func (c *Client) TopicEventLink(topic, event string) Link
func (c *Client) TopicEventsLink(topic string) Link

func (*Client) TopicHandler added in v1.3.0

func (c *Client) TopicHandler(link Link) (TopicHandler, error)

TopicHandler retrieves an alert handler. Errors if no handler exists.

func (c *Client) TopicHandlerLink(topic, id string) Link
func (c *Client) TopicHandlersLink(topic string) Link
func (c *Client) TopicLink(id string) Link

func (*Client) URL added in v1.0.0

func (c *Client) URL() string

func (*Client) UpdateTask

func (c *Client) UpdateTask(link Link, opt UpdateTaskOptions) (Task, error)

Update an existing task. Only fields that are not their default value will be updated.

func (*Client) UpdateTemplate added in v1.0.0

func (c *Client) UpdateTemplate(link Link, opt UpdateTemplateOptions) (Template, error)

Update an existing template. Only fields that are not their default value will be updated.

type Clock

type Clock int
const (
	Fast Clock = iota
	Real
)

func (Clock) MarshalText

func (c Clock) MarshalText() ([]byte, error)

func (Clock) String

func (c Clock) String() string

func (*Clock) UnmarshalText

func (c *Clock) UnmarshalText(text []byte) error

type Config

type Config struct {
	// The URL of the Kapacitor server.
	URL string

	// Timeout for API requests, defaults to no timeout.
	Timeout time.Duration

	// UserAgent is the http User Agent, defaults to "KapacitorClient".
	UserAgent string

	// InsecureSkipVerify gets passed to the http client, if true, it will
	// skip https certificate verification. Defaults to false.
	InsecureSkipVerify bool

	// TLSConfig allows the user to set their own TLS config for the HTTP
	// Client. If set, this option overrides InsecureSkipVerify.
	TLSConfig *tls.Config

	// Optional credentials for authenticating with the server.
	Credentials *Credentials
}

HTTP configuration for connecting to Kapacitor

type ConfigElement added in v1.1.0

type ConfigElement struct {
	Link     Link                   `json:"link"`
	Options  map[string]interface{} `json:"options"`
	Redacted []string               `json:"redacted"`
}

type ConfigSection added in v1.1.0

type ConfigSection struct {
	Link     Link            `json:"link"`
	Elements []ConfigElement `json:"elements"`
}

type ConfigSections added in v1.1.0

type ConfigSections struct {
	Link     Link                     `json:"link"`
	Sections map[string]ConfigSection `json:"sections"`
}

type ConfigUpdateAction added in v1.1.0

type ConfigUpdateAction struct {
	Set    map[string]interface{} `json:"set,omitempty"`
	Delete []string               `json:"delete,omitempty"`
	Add    map[string]interface{} `json:"add,omitempty"`
	Remove []string               `json:"remove,omitempty"`
}

type CreateReplayOptions

type CreateReplayOptions struct {
	ID            string `json:"id"`
	Recording     string `json:"recording"`
	Task          string `json:"task"`
	RecordingTime bool   `json:"recording-time"`
	Clock         Clock  `json:"clock"`
}

func (*CreateReplayOptions) Default

func (o *CreateReplayOptions) Default()

type CreateTaskOptions

type CreateTaskOptions struct {
	ID         string     `json:"id,omitempty"`
	TemplateID string     `json:"template-id,omitempty"`
	Type       TaskType   `json:"type,omitempty"`
	DBRPs      []DBRP     `json:"dbrps,omitempty"`
	TICKscript string     `json:"script,omitempty"`
	Status     TaskStatus `json:"status,omitempty"`
	Vars       Vars       `json:"vars,omitempty"`
}

type CreateTemplateOptions added in v1.0.0

type CreateTemplateOptions struct {
	ID         string   `json:"id,omitempty"`
	Type       TaskType `json:"type,omitempty"`
	TICKscript string   `json:"script,omitempty"`
}

type Credentials added in v1.0.0

type Credentials struct {
	Method AuthenticationMethod

	Username string
	Password string

	Token string
}

Set of credentials depending on the authentication method

func (Credentials) Validate added in v1.0.0

func (c Credentials) Validate() error

type DBRP

type DBRP struct {
	Database        string `json:"db"`
	RetentionPolicy string `json:"rp"`
}

func (DBRP) String

func (d DBRP) String() string

type DebugVars added in v1.0.0

type DebugVars struct {
	ClusterID        string                 `json:"cluster_id"`
	ServerID         string                 `json:"server_id"`
	Host             string                 `json:"host"`
	Stats            map[string]Stat        `json:"kapacitor"`
	Cmdline          []string               `json:"cmdline"`
	NumEnabledTasks  int                    `json:"num_enabled_tasks"`
	NumSubscriptions int                    `json:"num_subscriptions"`
	NumTasks         int                    `json:"num_tasks"`
	Memstats         map[string]interface{} `json:"memstats"`
	Version          string                 `json:"version"`
}

type Duration added in v1.2.0

type Duration time.Duration

func (Duration) MarshalText added in v1.2.0

func (d Duration) MarshalText() ([]byte, error)

func (*Duration) UnmarshalText added in v1.2.0

func (d *Duration) UnmarshalText(data []byte) error

type EventState added in v1.2.0

type EventState struct {
	Message  string    `json:"message"`
	Details  string    `json:"details"`
	Time     time.Time `json:"time"`
	Duration Duration  `json:"duration"`
	Level    string    `json:"level"`
}

type ExecutionStats

type ExecutionStats struct {
	// Summary stats about the entire task
	TaskStats map[string]interface{} `json:"task-stats"`
	// Stats for each node in the task
	NodeStats map[string]map[string]interface{} `json:"node-stats"`
}

Statistics about the execution of a task.

type JSONOperation added in v1.2.0

type JSONOperation struct {
	Path      string      `json:"path"`
	Operation string      `json:"op"`
	Value     interface{} `json:"value"`
	From      string      `json:"from,omitempty"`
}

type JSONPatch added in v1.2.0

type JSONPatch []JSONOperation
type Link struct {
	Relation Relation `json:"rel"`
	Href     string   `json:"href"`
}

type ListRecordingsOptions

type ListRecordingsOptions struct {
	Pattern string
	Fields  []string
	Offset  int
	Limit   int
}

func (*ListRecordingsOptions) Default

func (o *ListRecordingsOptions) Default()

func (*ListRecordingsOptions) Values

func (o *ListRecordingsOptions) Values() *url.Values

type ListReplaysOptions

type ListReplaysOptions struct {
	Pattern string
	Fields  []string
	Offset  int
	Limit   int
}

func (*ListReplaysOptions) Default

func (o *ListReplaysOptions) Default()

func (*ListReplaysOptions) Values

func (o *ListReplaysOptions) Values() *url.Values

type ListServiceTestsOptions added in v1.1.0

type ListServiceTestsOptions struct {
	Pattern string
}

func (*ListServiceTestsOptions) Default added in v1.1.0

func (o *ListServiceTestsOptions) Default()

func (*ListServiceTestsOptions) Values added in v1.1.0

func (o *ListServiceTestsOptions) Values() *url.Values

type ListTasksOptions

type ListTasksOptions struct {
	TaskOptions
	Pattern string
	Fields  []string
	Offset  int
	Limit   int
}

func (*ListTasksOptions) Default

func (o *ListTasksOptions) Default()

func (*ListTasksOptions) Values

func (o *ListTasksOptions) Values() *url.Values

type ListTemplatesOptions added in v1.0.0

type ListTemplatesOptions struct {
	TemplateOptions
	Pattern string
	Fields  []string
	Offset  int
	Limit   int
}

func (*ListTemplatesOptions) Default added in v1.0.0

func (o *ListTemplatesOptions) Default()

func (*ListTemplatesOptions) Values added in v1.0.0

func (o *ListTemplatesOptions) Values() *url.Values

type ListTopicEventsOptions added in v1.2.0

type ListTopicEventsOptions struct {
	MinLevel string
}

func (*ListTopicEventsOptions) Default added in v1.2.0

func (o *ListTopicEventsOptions) Default()

func (*ListTopicEventsOptions) Values added in v1.2.0

func (o *ListTopicEventsOptions) Values() *url.Values

type ListTopicHandlersOptions added in v1.3.0

type ListTopicHandlersOptions struct {
	Pattern string
}

func (*ListTopicHandlersOptions) Default added in v1.3.0

func (o *ListTopicHandlersOptions) Default()

func (*ListTopicHandlersOptions) Values added in v1.3.0

func (o *ListTopicHandlersOptions) Values() *url.Values

type ListTopicsOptions added in v1.2.0

type ListTopicsOptions struct {
	Pattern  string
	MinLevel string
}

func (*ListTopicsOptions) Default added in v1.2.0

func (o *ListTopicsOptions) Default()

func (*ListTopicsOptions) Values added in v1.2.0

func (o *ListTopicsOptions) Values() *url.Values

type LogLevelOptions

type LogLevelOptions struct {
	Level string `json:"level"`
}

type RecordBatchOptions

type RecordBatchOptions struct {
	ID    string    `json:"id,omitempty"`
	Task  string    `json:"task"`
	Start time.Time `json:"start"`
	Stop  time.Time `json:"stop"`
}

type RecordQueryOptions

type RecordQueryOptions struct {
	ID      string   `json:"id,omitempty"`
	Query   string   `json:"query"`
	Type    TaskType `json:"type"`
	Cluster string   `json:"cluster,omitempty"`
}

type RecordStreamOptions

type RecordStreamOptions struct {
	ID   string    `json:"id,omitempty"`
	Task string    `json:"task"`
	Stop time.Time `json:"stop"`
}

type Recording

type Recording struct {
	Link     Link      `json:"link"`
	ID       string    `json:"id"`
	Type     TaskType  `json:"type"`
	Size     int64     `json:"size"`
	Date     time.Time `json:"date"`
	Error    string    `json:"error"`
	Status   Status    `json:"status"`
	Progress float64   `json:"progress"`
}

Information about a recording.

type Relation

type Relation string
const (
	Self Relation = "self"
)

func (Relation) String

func (r Relation) String() string

type Replay

type Replay struct {
	Link          Link      `json:"link"`
	ID            string    `json:"id"`
	Task          string    `json:"task"`
	Recording     string    `json:"recording"`
	RecordingTime bool      `json:"recording-time"`
	Clock         Clock     `json:"clock"`
	Date          time.Time `json:"date"`
	Error         string    `json:"error"`
	Status        Status    `json:"status"`
	Progress      float64   `json:"progress"`
}

Information about a replay.

type ReplayBatchOptions added in v1.0.0

type ReplayBatchOptions struct {
	ID            string    `json:"id,omitempty"`
	Task          string    `json:"task"`
	Start         time.Time `json:"start"`
	Stop          time.Time `json:"stop"`
	RecordingTime bool      `json:"recording-time"`
	Clock         Clock     `json:"clock"`
}

type ReplayQueryOptions added in v1.0.0

type ReplayQueryOptions struct {
	ID            string `json:"id,omitempty"`
	Task          string `json:"task"`
	Query         string `json:"query"`
	Cluster       string `json:"cluster,omitempty"`
	RecordingTime bool   `json:"recording-time"`
	Clock         Clock  `json:"clock"`
}

type ServiceTest added in v1.1.0

type ServiceTest struct {
	Link    Link               `json:"link"`
	Name    string             `json:"name"`
	Options ServiceTestOptions `json:"options"`
}

type ServiceTestOptions added in v1.1.0

type ServiceTestOptions map[string]interface{}

type ServiceTestResult added in v1.1.0

type ServiceTestResult struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

type ServiceTests added in v1.1.0

type ServiceTests struct {
	Link     Link          `json:"link"`
	Services []ServiceTest `json:"services"`
}

type Stat added in v1.0.0

type Stat struct {
	Name   string                 `json:"name"`
	Tags   map[string]string      `json:"tags"`
	Values map[string]interface{} `json:"values"`
}

type Status

type Status int
const (
	Failed Status = iota
	Running
	Finished
)

func (Status) MarshalText

func (s Status) MarshalText() ([]byte, error)

func (Status) String

func (s Status) String() string

func (*Status) UnmarshalText

func (s *Status) UnmarshalText(text []byte) error

type Storage added in v1.3.0

type Storage struct {
	Link Link   `json:"link"`
	Name string `json:"name"`
}

type StorageAction added in v1.3.0

type StorageAction int
const (
	StorageRebuild StorageAction
)

func (StorageAction) MarshalText added in v1.3.0

func (sa StorageAction) MarshalText() ([]byte, error)

func (StorageAction) String added in v1.3.0

func (sa StorageAction) String() string

func (*StorageAction) UnmarshalText added in v1.3.0

func (sa *StorageAction) UnmarshalText(text []byte) error

type StorageActionOptions added in v1.3.0

type StorageActionOptions struct {
	Action StorageAction `json:"action"`
}

type StorageList added in v1.3.0

type StorageList struct {
	Link    Link      `json:"link"`
	Storage []Storage `json:"storage"`
}

type Task

type Task struct {
	Link           Link           `json:"link"`
	ID             string         `json:"id"`
	TemplateID     string         `json:"template-id"`
	Type           TaskType       `json:"type"`
	DBRPs          []DBRP         `json:"dbrps"`
	TICKscript     string         `json:"script"`
	Vars           Vars           `json:"vars"`
	Dot            string         `json:"dot"`
	Status         TaskStatus     `json:"status"`
	Executing      bool           `json:"executing"`
	Error          string         `json:"error"`
	ExecutionStats ExecutionStats `json:"stats"`
	Created        time.Time      `json:"created"`
	Modified       time.Time      `json:"modified"`
	LastEnabled    time.Time      `json:"last-enabled,omitempty"`
}

A Task plus its read-only attributes.

type TaskOptions

type TaskOptions struct {
	DotView      string
	ScriptFormat string
	ReplayID     string
}

func (*TaskOptions) Default

func (o *TaskOptions) Default()

func (*TaskOptions) Values

func (o *TaskOptions) Values() *url.Values

type TaskStatus

type TaskStatus int
const (
	Disabled TaskStatus = 1
	Enabled  TaskStatus = 2
)

func (TaskStatus) MarshalText

func (ts TaskStatus) MarshalText() ([]byte, error)

func (TaskStatus) String

func (ts TaskStatus) String() string

func (*TaskStatus) UnmarshalText

func (ts *TaskStatus) UnmarshalText(text []byte) error

type TaskType

type TaskType int
const (
	StreamTask TaskType = 1
	BatchTask  TaskType = 2
)

func (TaskType) MarshalText

func (tt TaskType) MarshalText() ([]byte, error)

func (TaskType) String

func (tt TaskType) String() string

func (*TaskType) UnmarshalText

func (tt *TaskType) UnmarshalText(text []byte) error

type Template added in v1.0.0

type Template struct {
	Link       Link      `json:"link"`
	ID         string    `json:"id"`
	Type       TaskType  `json:"type"`
	TICKscript string    `json:"script"`
	Vars       Vars      `json:"vars"`
	Dot        string    `json:"dot"`
	Error      string    `json:"error"`
	Created    time.Time `json:"created"`
	Modified   time.Time `json:"modified"`
}

A Template plus its read-only attributes.

type TemplateOptions added in v1.0.0

type TemplateOptions struct {
	ScriptFormat string
}

func (*TemplateOptions) Default added in v1.0.0

func (o *TemplateOptions) Default()

func (*TemplateOptions) Values added in v1.0.0

func (o *TemplateOptions) Values() *url.Values

type Topic added in v1.2.0

type Topic struct {
	Link         Link   `json:"link"`
	ID           string `json:"id"`
	Level        string `json:"level"`
	Collected    int64  `json:"collected"`
	EventsLink   Link   `json:"events-link"`
	HandlersLink Link   `json:"handlers-link"`
}

type TopicEvent added in v1.2.0

type TopicEvent struct {
	Link  Link       `json:"link"`
	ID    string     `json:"id"`
	State EventState `json:"state"`
}

type TopicEvents added in v1.2.0

type TopicEvents struct {
	Link   Link         `json:"link"`
	Topic  string       `json:"topic"`
	Events []TopicEvent `json:"events"`
}

type TopicHandler added in v1.3.0

type TopicHandler struct {
	Link    Link                   `json:"link"`
	ID      string                 `json:"id"`
	Kind    string                 `json:"kind"`
	Options map[string]interface{} `json:"options"`
	Match   string                 `json:"match"`
}

type TopicHandlerOptions added in v1.3.0

type TopicHandlerOptions struct {
	ID      string                 `json:"id" yaml:"id"`
	Kind    string                 `json:"kind" yaml:"kind"`
	Options map[string]interface{} `json:"options" yaml:"options"`
	Match   string                 `json:"match" yaml:"match"`
}

type TopicHandlers added in v1.2.0

type TopicHandlers struct {
	Link     Link           `json:"link"`
	Topic    string         `json:"topic"`
	Handlers []TopicHandler `json:"handlers"`
}

type Topics added in v1.2.0

type Topics struct {
	Link   Link    `json:"link"`
	Topics []Topic `json:"topics"`
}

type UpdateTaskOptions

type UpdateTaskOptions struct {
	ID         string     `json:"id,omitempty"`
	TemplateID string     `json:"template-id,omitempty"`
	Type       TaskType   `json:"type,omitempty"`
	DBRPs      []DBRP     `json:"dbrps,omitempty"`
	TICKscript string     `json:"script,omitempty"`
	Status     TaskStatus `json:"status,omitempty"`
	Vars       Vars       `json:"vars,omitempty"`
}

type UpdateTemplateOptions added in v1.0.0

type UpdateTemplateOptions struct {
	ID         string   `json:"id,omitempty"`
	Type       TaskType `json:"type,omitempty"`
	TICKscript string   `json:"script,omitempty"`
}

type Var added in v1.0.0

type Var struct {
	Type        VarType     `json:"type"`
	Value       interface{} `json:"value"`
	Description string      `json:"description"`
}

type VarType added in v1.0.0

type VarType int
const (
	VarUnknown VarType = iota
	VarBool
	VarInt
	VarFloat
	VarString
	VarRegex
	VarDuration
	VarLambda
	VarList
	VarStar
)

func (VarType) MarshalText added in v1.0.0

func (vt VarType) MarshalText() ([]byte, error)

func (VarType) String added in v1.0.0

func (vt VarType) String() string

func (*VarType) UnmarshalText added in v1.0.0

func (vt *VarType) UnmarshalText(text []byte) error

type Vars added in v1.0.0

type Vars map[string]Var

func (*Vars) UnmarshalJSON added in v1.0.0

func (vs *Vars) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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