eventapi

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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"
	// EventRunnerItemOnOk - item finished with ok status.
	EventRunnerItemOnOk = "runner_item_on_ok"

	// 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

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

func (je JobEvent) GetFailedPlaybookMessage() string

GetFailedPlaybookMessage - get the failure message from res.msg

func (JobEvent) IgnoreError

func (je JobEvent) IgnoreError() bool

IgnoreError - Does the job event contain the ignore_error ansible flag

func (JobEvent) Rescued added in v1.0.1

func (je JobEvent) Rescued() bool

Rescued - Detects whether or not a task was rescued

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