eventapi

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// EventPlaybookOnTaskStart - playbook is starting to run a task.
	EventPlaybookOnTaskStart = "playbook_on_task_start"
	// EventRunnerOnOk - task finished with ok status.
	EventRunnerOnOk = "runner_on_ok"
	// EventRunnerOnFailed - task finished with failed status.
	EventRunnerOnFailed = "runner_on_failed"
	// EventPlaybookOnStats - playbook has finished running.
	EventPlaybookOnStats = "playbook_on_stats"

	// TaskActionSetFact - task action of setting a fact.
	TaskActionSetFact = "set_fact"
	// TaskActionDebug - task action of printing a debug message.
	TaskActionDebug = "debug"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EventReceiver

type EventReceiver struct {
	// Events is the channel used by the event API handler to send JobEvents
	// back to the runner, or whatever code is using this receiver.
	Events chan JobEvent

	// SocketPath is the path on the filesystem to a unix streaming socket
	SocketPath string

	// URLPath is the path portion of the url at which events should be
	// received. For example, "/events/"
	URLPath string
	// contains filtered or unexported fields
}

EventReceiver serves the event API

func New

func New(ident string, errChan chan<- error) (*EventReceiver, error)

func (*EventReceiver) Close

func (e *EventReceiver) Close()

Close ensures that appropriate resources are cleaned up, such as any unix streaming socket that may be in use. Close must be called.

type EventTime

type EventTime struct {
	time.Time
}

EventTime - time to unmarshal nano time.

func (EventTime) MarshalJSON

func (e EventTime) MarshalJSON() ([]byte, error)

MarshalJSON - override the marshal json.

func (*EventTime) UnmarshalJSON

func (e *EventTime) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON - override unmarshal json.

type FailureMessages added in v0.2.0

type FailureMessages []string

FailureMessages - failure messages from the event api

type JobEvent

type JobEvent struct {
	UUID      string                 `json:"uuid"`
	Counter   int                    `json:"counter"`
	StdOut    string                 `json:"stdout"`
	StartLine int                    `json:"start_line"`
	EndLine   int                    `json:"EndLine"`
	Event     string                 `json:"event"`
	EventData map[string]interface{} `json:"event_data"`
	PID       int                    `json:"pid"`
	Created   EventTime              `json:"created"`
}

JobEvent - event of an ansible run.

func (JobEvent) GetFailedPlaybookMessage added in v0.2.0

func (je JobEvent) GetFailedPlaybookMessage() string

GetFailedPlaybookMessage - get the failure message from res.msg

func (JobEvent) IgnoreError added in v0.6.0

func (je JobEvent) IgnoreError() bool

IgnoreError - Does the job event contain the ignore_error ansible flag

type StatsEventData

type StatsEventData struct {
	Playbook     string         `json:"playbook"`
	PlaybookUUID string         `json:"playbook_uuid"`
	Changed      map[string]int `json:"changed"`
	Ok           map[string]int `json:"ok"`
	Failures     map[string]int `json:"failures"`
	Skipped      map[string]int `json:"skipped"`
}

StatsEventData - data for a the status event.

type StatusJobEvent

type StatusJobEvent struct {
	UUID      string         `json:"uuid"`
	Counter   int            `json:"counter"`
	StdOut    string         `json:"stdout"`
	StartLine int            `json:"start_line"`
	EndLine   int            `json:"EndLine"`
	Event     string         `json:"event"`
	EventData StatsEventData `json:"event_data"`
	PID       int            `json:"pid"`
	Created   EventTime      `json:"created"`
}

StatusJobEvent - event of an ansible run.

Jump to

Keyboard shortcuts

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