rbody

package
v0.16.1-beta Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginConfigItemType       = "config_plugin_item_returned"
	SetPluginConfigItemType    = "config_plugin_item_created"
	DeletePluginConfigItemType = "config_plugin_item_deleted"
)
View Source
const (
	MetricsReturnedType = "metrics_returned"
	MetricReturnedType  = "metric_returned"
)
View Source
const (
	PluginsLoadedType  = "plugins_loaded"
	PluginUnloadedType = "plugin_unloaded"
	PluginListType     = "plugin_list_returned"
	PluginReturnedType = "plugin_returned"
)
View Source
const (
	ScheduledTaskListReturnedType  = "scheduled_task_list_returned"
	ScheduledTaskReturnedType      = "scheduled_task_returned"
	AddScheduledTaskType           = "scheduled_task_created"
	ScheduledTaskType              = "scheduled_task"
	ScheduledTaskStartedType       = "scheduled_task_started"
	ScheduledTaskStoppedType       = "scheduled_task_stopped"
	ScheduledTaskRemovedType       = "scheduled_task_removed"
	ScheduledTaskWatchingEndedType = "schedule_task_watch_ended"
	ScheduledTaskEnabledType       = "scheduled_task_enabled"

	// Event types for task watcher streaming
	TaskWatchStreamOpen   = "stream-open"
	TaskWatchMetricEvent  = "metric-event"
	TaskWatchTaskDisabled = "task-disabled"
	TaskWatchTaskStarted  = "task-started"
	TaskWatchTaskStopped  = "task-stopped"
)
View Source
const (
	TribeListAgreementType   = "tribe_agreement_list_returned"
	TribeGetAgreementType    = "tribe_agreement_returned"
	TribeAddAgreementType    = "tribe_agreement_created"
	TribeDeleteAgreementType = "tribe_agreement_deleted"
	TribeAddMemberType       = "tribe_member_added"
	TribeJoinAgreementType   = "tribe_agreement_joined"
	TribeLeaveAgreementType  = "tribe_agreement_left"
	TribeMemberListType      = "tribe_member_list_returned"
	TribeMemberShowType      = "tribe_member_details_returned"
)
View Source
const (
	ErrorType = "error"
)

Variables

View Source
var (
	ErrCannotUnmarshalBody = errors.New("Cannot unmarshal body: invalid type")
)

Functions

This section is empty.

Types

type APIResponse

type APIResponse struct {
	Meta         *APIResponseMeta `json:"meta"`
	Body         Body             `json:"body"`
	JSONResponse string           `json:"-"`
}

func (*APIResponse) UnmarshalJSON

func (a *APIResponse) UnmarshalJSON(b []byte) error

type APIResponseMeta

type APIResponseMeta struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Type    string `json:"type"`
	Version int    `json:"version"`
}

type AddScheduledTask

type AddScheduledTask ScheduledTask

func AddSchedulerTaskFromTask

func AddSchedulerTaskFromTask(t core.Task) *AddScheduledTask

func (*AddScheduledTask) ResponseBodyMessage

func (s *AddScheduledTask) ResponseBodyMessage() string

func (*AddScheduledTask) ResponseBodyType

func (s *AddScheduledTask) ResponseBodyType() string

type AvailablePlugin

type AvailablePlugin struct {
	Name             string `json:"name"`
	Version          int    `json:"version"`
	Type             string `json:"type"`
	HitCount         int    `json:"hitcount"`
	LastHitTimestamp int64  `json:"last_hit_timestamp"`
	ID               uint32 `json:"id"`
	Href             string `json:"href"`
}

type Body

type Body interface {
	// These function names are rather verbose to avoid field vs function namespace collisions
	// with varied object types that use them.
	ResponseBodyMessage() string
	ResponseBodyType() string
}

func UnmarshalBody

func UnmarshalBody(t string, b []byte) (Body, error)

type DeletePluginConfigItem

type DeletePluginConfigItem PluginConfigItem

func (*DeletePluginConfigItem) ResponseBodyMessage

func (t *DeletePluginConfigItem) ResponseBodyMessage() string

func (*DeletePluginConfigItem) ResponseBodyType

func (t *DeletePluginConfigItem) ResponseBodyType() string

type DynamicElement

type DynamicElement struct {
	Index       int    `json:"index,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

type Error

type Error struct {
	ErrorMessage string            `json:"message"`
	Fields       map[string]string `json:"fields"`
}

Unsuccessful generic response to a failed API call

func FromError

func FromError(err error) *Error

func FromSnapError

func FromSnapError(pe serror.SnapError) *Error

func FromSnapErrors

func FromSnapErrors(errs []serror.SnapError) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) ResponseBodyMessage

func (e *Error) ResponseBodyMessage() string

func (*Error) ResponseBodyType

func (e *Error) ResponseBodyType() string

type LoadedPlugin

type LoadedPlugin struct {
	Name            string        `json:"name"`
	Version         int           `json:"version"`
	Type            string        `json:"type"`
	Signed          bool          `json:"signed"`
	Status          string        `json:"status"`
	LoadedTimestamp int64         `json:"loaded_timestamp"`
	Href            string        `json:"href"`
	ConfigPolicy    []PolicyTable `json:"policy,omitempty"`
}

type Metric

type Metric struct {
	LastAdvertisedTimestamp int64            `json:"last_advertised_timestamp,omitempty"`
	Namespace               string           `json:"namespace,omitempty"`
	Version                 int              `json:"version,omitempty"`
	Dynamic                 bool             `json:"dynamic"`
	DynamicElements         []DynamicElement `json:"dynamic_elements,omitempty"`
	Description             string           `json:"description,omitempty"`
	Unit                    string           `json:"unit,omitempty"`
	Policy                  []PolicyTable    `json:"policy,omitempty"`
	Href                    string           `json:"href"`
}

type MetricReturned

type MetricReturned struct {
	Metric *Metric
}

func (*MetricReturned) ResponseBodyMessage

func (m *MetricReturned) ResponseBodyMessage() string

func (*MetricReturned) ResponseBodyType

func (m *MetricReturned) ResponseBodyType() string

type MetricsReturned

type MetricsReturned []Metric

func NewMetricsReturned

func NewMetricsReturned() MetricsReturned

func (MetricsReturned) Len

func (m MetricsReturned) Len() int

func (MetricsReturned) Less

func (m MetricsReturned) Less(i, j int) bool

func (MetricsReturned) ResponseBodyMessage

func (m MetricsReturned) ResponseBodyMessage() string

func (MetricsReturned) ResponseBodyType

func (m MetricsReturned) ResponseBodyType() string

func (MetricsReturned) Swap

func (m MetricsReturned) Swap(i, j int)

type PluginConfigItem

type PluginConfigItem struct {
	cdata.ConfigDataNode
}

func (*PluginConfigItem) ResponseBodyMessage

func (t *PluginConfigItem) ResponseBodyMessage() string

func (*PluginConfigItem) ResponseBodyType

func (t *PluginConfigItem) ResponseBodyType() string

type PluginList

type PluginList struct {
	LoadedPlugins    []LoadedPlugin    `json:"loaded_plugins,omitempty"`
	AvailablePlugins []AvailablePlugin `json:"available_plugins,omitempty"`
}

func (*PluginList) ResponseBodyMessage

func (p *PluginList) ResponseBodyMessage() string

func (*PluginList) ResponseBodyType

func (p *PluginList) ResponseBodyType() string

type PluginReturned

type PluginReturned LoadedPlugin

func (*PluginReturned) ResponseBodyMessage

func (p *PluginReturned) ResponseBodyMessage() string

func (*PluginReturned) ResponseBodyType

func (p *PluginReturned) ResponseBodyType() string

type PluginUnloaded

type PluginUnloaded struct {
	Name    string `json:"name"`
	Version int    `json:"version"`
	Type    string `json:"type"`
}

Successful response to the unloading of a plugin

func (*PluginUnloaded) ResponseBodyMessage

func (u *PluginUnloaded) ResponseBodyMessage() string

func (*PluginUnloaded) ResponseBodyType

func (u *PluginUnloaded) ResponseBodyType() string

type PluginsLoaded

type PluginsLoaded struct {
	LoadedPlugins []LoadedPlugin `json:"loaded_plugins"`
}

Successful response to the loading of a plugins

func (*PluginsLoaded) ResponseBodyMessage

func (p *PluginsLoaded) ResponseBodyMessage() string

func (*PluginsLoaded) ResponseBodyType

func (p *PluginsLoaded) ResponseBodyType() string

type PolicyTable

type PolicyTable struct {
	Name     string      `json:"name"`
	Type     string      `json:"type"`
	Default  interface{} `json:"default,omitempty"`
	Required bool        `json:"required"`
	Minimum  interface{} `json:"minimum,omitempty"`
	Maximum  interface{} `json:"maximum,omitempty"`
}

type ScheduledTask

type ScheduledTask struct {
	ID                 string            `json:"id"`
	Name               string            `json:"name"`
	Deadline           string            `json:"deadline"`
	Workflow           *wmap.WorkflowMap `json:"workflow,omitempty"`
	Schedule           *core.Schedule    `json:"schedule,omitempty"`
	CreationTimestamp  int64             `json:"creation_timestamp,omitempty"`
	LastRunTimestamp   int64             `json:"last_run_timestamp,omitempty"`
	HitCount           int               `json:"hit_count,omitempty"`
	MissCount          int               `json:"miss_count,omitempty"`
	FailedCount        int               `json:"failed_count,omitempty"`
	LastFailureMessage string            `json:"last_failure_message,omitempty"`
	State              string            `json:"task_state"`
	Href               string            `json:"href"`
}

func SchedulerTaskFromTask

func SchedulerTaskFromTask(t core.Task) *ScheduledTask

func (*ScheduledTask) CreationTime

func (s *ScheduledTask) CreationTime() time.Time

func (*ScheduledTask) ResponseBodyMessage

func (s *ScheduledTask) ResponseBodyMessage() string

func (*ScheduledTask) ResponseBodyType

func (s *ScheduledTask) ResponseBodyType() string

type ScheduledTaskEnabled

type ScheduledTaskEnabled struct {
	AddScheduledTask
}

func (*ScheduledTaskEnabled) ResponseBodyMessage

func (s *ScheduledTaskEnabled) ResponseBodyMessage() string

func (*ScheduledTaskEnabled) ResponseBodyType

func (s *ScheduledTaskEnabled) ResponseBodyType() string

type ScheduledTaskListReturned

type ScheduledTaskListReturned struct {
	ScheduledTasks []ScheduledTask
}

func (*ScheduledTaskListReturned) Len

func (s *ScheduledTaskListReturned) Len() int

func (*ScheduledTaskListReturned) Less

func (s *ScheduledTaskListReturned) Less(i, j int) bool

func (*ScheduledTaskListReturned) ResponseBodyMessage

func (s *ScheduledTaskListReturned) ResponseBodyMessage() string

func (*ScheduledTaskListReturned) ResponseBodyType

func (s *ScheduledTaskListReturned) ResponseBodyType() string

func (*ScheduledTaskListReturned) Swap

func (s *ScheduledTaskListReturned) Swap(i, j int)

type ScheduledTaskRemoved

type ScheduledTaskRemoved struct {
	// TODO return resource
	ID string `json:"id"`
}

func (*ScheduledTaskRemoved) ResponseBodyMessage

func (s *ScheduledTaskRemoved) ResponseBodyMessage() string

func (*ScheduledTaskRemoved) ResponseBodyType

func (s *ScheduledTaskRemoved) ResponseBodyType() string

type ScheduledTaskReturned

type ScheduledTaskReturned struct {
	AddScheduledTask
}

func (*ScheduledTaskReturned) ResponseBodyMessage

func (s *ScheduledTaskReturned) ResponseBodyMessage() string

func (*ScheduledTaskReturned) ResponseBodyType

func (s *ScheduledTaskReturned) ResponseBodyType() string

type ScheduledTaskStarted

type ScheduledTaskStarted struct {
	// TODO return resource
	ID string `json:"id"`
}

func (*ScheduledTaskStarted) ResponseBodyMessage

func (s *ScheduledTaskStarted) ResponseBodyMessage() string

func (*ScheduledTaskStarted) ResponseBodyType

func (s *ScheduledTaskStarted) ResponseBodyType() string

type ScheduledTaskStopped

type ScheduledTaskStopped struct {
	// TODO return resource
	ID string `json:"id"`
}

func (*ScheduledTaskStopped) ResponseBodyMessage

func (s *ScheduledTaskStopped) ResponseBodyMessage() string

func (*ScheduledTaskStopped) ResponseBodyType

func (s *ScheduledTaskStopped) ResponseBodyType() string

type ScheduledTaskWatchingEnded

type ScheduledTaskWatchingEnded struct {
}

func (*ScheduledTaskWatchingEnded) ResponseBodyMessage

func (s *ScheduledTaskWatchingEnded) ResponseBodyMessage() string

func (*ScheduledTaskWatchingEnded) ResponseBodyType

func (s *ScheduledTaskWatchingEnded) ResponseBodyType() string

type SetPluginConfigItem

type SetPluginConfigItem PluginConfigItem

func (*SetPluginConfigItem) ResponseBodyMessage

func (t *SetPluginConfigItem) ResponseBodyMessage() string

func (*SetPluginConfigItem) ResponseBodyType

func (t *SetPluginConfigItem) ResponseBodyType() string

type StreamedMetric

type StreamedMetric struct {
	Namespace string            `json:"namespace"`
	Data      interface{}       `json:"data"`
	Timestamp time.Time         `json:"timestamp"`
	Tags      map[string]string `json:"tags"`
}

type StreamedMetrics

type StreamedMetrics []StreamedMetric

func (StreamedMetrics) Len

func (s StreamedMetrics) Len() int

func (StreamedMetrics) Less

func (s StreamedMetrics) Less(i, j int) bool

func (StreamedMetrics) Swap

func (s StreamedMetrics) Swap(i, j int)

type StreamedTaskEvent

type StreamedTaskEvent struct {
	// Used to describe the event
	EventType string          `json:"type"`
	Message   string          `json:"message"`
	Event     StreamedMetrics `json:"event,omitempty"`
}

func (*StreamedTaskEvent) ToJSON

func (s *StreamedTaskEvent) ToJSON() string

type TribeAddAgreement

type TribeAddAgreement struct {
	Agreements map[string]*agreement.Agreement `json:"agreements"`
}

func (*TribeAddAgreement) ResponseBodyMessage

func (t *TribeAddAgreement) ResponseBodyMessage() string

func (*TribeAddAgreement) ResponseBodyType

func (t *TribeAddAgreement) ResponseBodyType() string

type TribeDeleteAgreement

type TribeDeleteAgreement struct {
	Agreements map[string]*agreement.Agreement `json:"agreements"`
}

func (*TribeDeleteAgreement) ResponseBodyMessage

func (t *TribeDeleteAgreement) ResponseBodyMessage() string

func (*TribeDeleteAgreement) ResponseBodyType

func (t *TribeDeleteAgreement) ResponseBodyType() string

type TribeGetAgreement

type TribeGetAgreement struct {
	Agreement *agreement.Agreement `json:"agreement"`
}

func (*TribeGetAgreement) ResponseBodyMessage

func (t *TribeGetAgreement) ResponseBodyMessage() string

func (*TribeGetAgreement) ResponseBodyType

func (t *TribeGetAgreement) ResponseBodyType() string

type TribeJoinAgreement

type TribeJoinAgreement struct {
	Agreement *agreement.Agreement `json:"agreement"`
}

func (*TribeJoinAgreement) ResponseBodyMessage

func (t *TribeJoinAgreement) ResponseBodyMessage() string

func (*TribeJoinAgreement) ResponseBodyType

func (t *TribeJoinAgreement) ResponseBodyType() string

type TribeLeaveAgreement

type TribeLeaveAgreement struct {
	Agreement *agreement.Agreement `json:"agreement"`
}

func (*TribeLeaveAgreement) ResponseBodyMessage

func (t *TribeLeaveAgreement) ResponseBodyMessage() string

func (*TribeLeaveAgreement) ResponseBodyType

func (t *TribeLeaveAgreement) ResponseBodyType() string

type TribeListAgreement

type TribeListAgreement struct {
	Agreements map[string]*agreement.Agreement `json:"agreements"`
}

func (*TribeListAgreement) ResponseBodyMessage

func (t *TribeListAgreement) ResponseBodyMessage() string

func (*TribeListAgreement) ResponseBodyType

func (t *TribeListAgreement) ResponseBodyType() string

type TribeMemberList

type TribeMemberList struct {
	Members []string `json:"members"`
}

func (*TribeMemberList) ResponseBodyMessage

func (t *TribeMemberList) ResponseBodyMessage() string

func (*TribeMemberList) ResponseBodyType

func (t *TribeMemberList) ResponseBodyType() string

type TribeMemberShow

type TribeMemberShow struct {
	Name            string            `json:"name"`
	PluginAgreement string            `json:"plugin_agreement"`
	Tags            map[string]string `json:"tags"`
	TaskAgreements  []string          `json:"task_agreements"`
}

func (*TribeMemberShow) ResponseBodyMessage

func (t *TribeMemberShow) ResponseBodyMessage() string

func (*TribeMemberShow) ResponseBodyType

func (t *TribeMemberShow) ResponseBodyType() string

Jump to

Keyboard shortcuts

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