APIVersion is the current API version used in the machine readable output
const APIVersion = "odo.dev/v1alpha1"
ListKind is the kind used for all lists in the machine readable output
const ListKind = "List"
func FormatTime(time time.Time) string
FormatTime returns time in UTC Unix Epoch Seconds and then the microsecond portion of that time.
func OutputError(machineOutput interface{})
OutputError outputs a "successful" machine-readable output format in json
func OutputSuccess(stdout, stderr io.Writer, machineOutput interface{})
OutputSuccess outputs a "successful" machine-readable output format in json
func OutputSuccessUnindented(machineOutput interface{})
OutputSuccessUnindented outputs a "successful" machine-readable output format in unindented json
func TimestampNow() string
TimestampNow returns timestamp in format of (seconds since UTC Unix epoch).(microseconds time component)
AbstractLogEvent is the base struct for all events; all events must at a minimum contain a timestamp.
type AbstractLogEvent struct { Timestamp string `json:"timestamp"` }
func (c AbstractLogEvent) GetTimestamp() string
GetTimestamp returns the timestamp element for this event.
ConsoleMachineEventLoggingClient will output all events to the console as JSON
type ConsoleMachineEventLoggingClient struct {
// contains filtered or unexported fields
}
func NewConsoleMachineEventLoggingClient() *ConsoleMachineEventLoggingClient
NewConsoleMachineEventLoggingClient creates a new instance of ConsoleMachineEventLoggingClient, which will output events as JSON to the console.
func (c *ConsoleMachineEventLoggingClient) ContainerStatus(statuses []ContainerStatusEntry, timestamp string)
ContainerStatus outputs the provided event as JSON to the console.
func (c *ConsoleMachineEventLoggingClient) CreateContainerOutputWriter() (*io.PipeWriter, chan interface{}, *io.PipeWriter, chan interface{})
CreateContainerOutputWriter returns an io.PipeWriter for which the devfile command/action process output should be written (for example by passing the io.PipeWriter to exec.ExecuteCommand), and a channel for communicating when the last data has been received on the reader.
All text written to the returned object will be output as a log text event. Returned channels will each contain a single nil entry once the underlying reader has closed.
func (c *ConsoleMachineEventLoggingClient) DevFileCommandExecutionBegin(commandID string, componentName string, commandLine string, groupKind string, timestamp string)
DevFileCommandExecutionBegin outputs the provided event as JSON to the console.
func (c *ConsoleMachineEventLoggingClient) DevFileCommandExecutionComplete(commandID string, componentName string, commandLine string, groupKind string, timestamp string, errorVal error)
DevFileCommandExecutionComplete outputs the provided event as JSON to the console.
func (c *ConsoleMachineEventLoggingClient) KubernetesPodStatus(pods []KubernetesPodStatusEntry, timestamp string)
KubernetesPodStatus outputs the provided event as JSON to the console.
func (c *ConsoleMachineEventLoggingClient) ReportError(errorVal error, timestamp string)
ReportError outputs the provided event as JSON to the console.
func (c *ConsoleMachineEventLoggingClient) URLReachable(name string, url string, port int, secure bool, kind string, reachable bool, timestamp string)
URLReachable outputs the provided event as JSON to the console.
ContainerStatus is the JSON event that is emitted to indicate odo-managed Docker container status
type ContainerStatus struct { Status []ContainerStatusEntry `json:"status"` AbstractLogEvent }
func (c ContainerStatus) GetType() MachineEventLogEntryType
GetType returns the event type for this event.
ContainerStatusEntry is an individual container's status
type ContainerStatusEntry struct { ID string `json:"id"` Status string `json:"status"` }
DevFileCommandExecutionBegin is the JSON event that is emitted when a dev file command begins execution.
type DevFileCommandExecutionBegin struct { CommandID string `json:"commandId"` ComponentName string `json:"componentName"` CommandLine string `json:"commandLine"` GroupKind string `json:"groupKind"` AbstractLogEvent }
func (c DevFileCommandExecutionBegin) GetType() MachineEventLogEntryType
GetType returns the event type for this event.
DevFileCommandExecutionComplete is the JSON event that is emitted when a dev file command completes execution.
type DevFileCommandExecutionComplete struct { DevFileCommandExecutionBegin Error string `json:"error,omitempty"` }
func (c DevFileCommandExecutionComplete) GetType() MachineEventLogEntryType
GetType returns the event type for this event.
KubernetesPodStatus is the JSON event that emitted to indicate the status of pods in an odo-managed deployment
type KubernetesPodStatus struct { Pods []KubernetesPodStatusEntry `json:"pods"` AbstractLogEvent }
func (c KubernetesPodStatus) GetType() MachineEventLogEntryType
GetType returns the event type for this event.
KubernetesPodStatusEntry is an individual pod's information
type KubernetesPodStatusEntry struct { Name string `json:"name"` UID string `json:"uid"` Phase string `json:"phase"` Labels map[string]string `json:"labels,omitempty"` StartTime string `json:"startTime,omitempty"` Containers []corev1.ContainerStatus `json:"containers"` InitContainers []corev1.ContainerStatus `json:"initContainers"` }
LogText is the JSON event that is emitted when a dev file action outputs text to the console.
type LogText struct { Text string `json:"text"` Stream string `json:"stream"` AbstractLogEvent }
func (c LogText) GetType() MachineEventLogEntryType
GetType returns the event type for this event.
MachineEventLogEntry contains the expected methods for every event that is emitted. (This is mainly used for test purposes.)
type MachineEventLogEntry interface { GetTimestamp() string }
MachineEventLogEntryType indicates the machine-readable event type from an ODO operation
type MachineEventLogEntryType int
const ( // TypeDevFileCommandExecutionBegin is the entry type for that event. TypeDevFileCommandExecutionBegin MachineEventLogEntryType = 0 // TypeDevFileCommandExecutionComplete is the entry type for that event. TypeDevFileCommandExecutionComplete MachineEventLogEntryType = 1 // TypeLogText is the entry type for that event. TypeLogText MachineEventLogEntryType = 2 // TypeReportError is the entry type for that event. TypeReportError MachineEventLogEntryType = 3 // TypeContainerStatus is the entry type for that event. TypeContainerStatus MachineEventLogEntryType = 5 // TypeURLReachable is the entry type for that event. TypeURLReachable MachineEventLogEntryType = 6 // TypeKubernetesPodStatus is the entry type for that event. TypeKubernetesPodStatus MachineEventLogEntryType = 7 )
MachineEventLoggingClient is an interface which is used by consuming code to output machine-readable event JSON to the console. Both no-op and non-no-op implementations of this interface exist.
type MachineEventLoggingClient interface { DevFileCommandExecutionBegin(commandID string, componentName string, commandLine string, groupKind string, timestamp string) DevFileCommandExecutionComplete(commandID string, componentName string, commandLine string, groupKind string, timestamp string, errorVal error) ReportError(errorVal error, timestamp string) ContainerStatus(statuses []ContainerStatusEntry, timestamp string) URLReachable(name string, url string, port int, secure bool, kind string, reachable bool, timestamp string) KubernetesPodStatus(pods []KubernetesPodStatusEntry, timestamp string) // CreateContainerOutputWriter is used to capture output from container processes, and synchronously write it to the screen as LogText. See implementation comments for details. CreateContainerOutputWriter() (*io.PipeWriter, chan interface{}, *io.PipeWriter, chan interface{}) }
func NewMachineEventLoggingClient() MachineEventLoggingClient
NewMachineEventLoggingClient creates the appropriate client based on whether we are in machine logging mode or not
MachineEventWrapper - a single line of machine-readable event console output must contain only one of these commands; the MachineEventWrapper is used to create (and parse, for tests) these lines.
type MachineEventWrapper struct { DevFileCommandExecutionBegin *DevFileCommandExecutionBegin `json:"devFileCommandExecutionBegin,omitempty"` DevFileCommandExecutionComplete *DevFileCommandExecutionComplete `json:"devFileCommandExecutionComplete,omitempty"` LogText *LogText `json:"logText,omitempty"` ReportError *ReportError `json:"reportError,omitempty"` ContainerStatus *ContainerStatus `json:"containerStatus,omitempty"` URLReachable *URLReachable `json:"urlReachable,omitempty"` KubernetesPodStatus *KubernetesPodStatus `json:"kubernetesPodStatus,omitempty"` }
func (w MachineEventWrapper) GetEntry() (MachineEventLogEntry, error)
GetEntry will return the JSON event parsed from a single line of '-o json' machine readable console output. Currently used for test purposes only.
NoOpMachineEventLoggingClient will ignore (eg not output) all events passed to it
type NoOpMachineEventLoggingClient struct { }
func NewNoOpMachineEventLoggingClient() *NoOpMachineEventLoggingClient
NewNoOpMachineEventLoggingClient creates a new instance of NoOpMachineEventLoggingClient, which will ignore any provided events.
func (c *NoOpMachineEventLoggingClient) ContainerStatus(statuses []ContainerStatusEntry, timestamp string)
ContainerStatus ignores the provided event.
func (c *NoOpMachineEventLoggingClient) CreateContainerOutputWriter() (*io.PipeWriter, chan interface{}, *io.PipeWriter, chan interface{})
CreateContainerOutputWriter ignores the provided event.
func (c *NoOpMachineEventLoggingClient) DevFileCommandExecutionBegin(commandID string, componentName string, commandLine string, groupKind string, timestamp string)
DevFileCommandExecutionBegin ignores the provided event.
func (c *NoOpMachineEventLoggingClient) DevFileCommandExecutionComplete(commandID string, componentName string, commandLine string, groupKind string, timestamp string, errorVal error)
DevFileCommandExecutionComplete ignores the provided event.
func (c *NoOpMachineEventLoggingClient) KubernetesPodStatus(pods []KubernetesPodStatusEntry, timestamp string)
KubernetesPodStatus ignores the provided event.
func (c *NoOpMachineEventLoggingClient) ReportError(errorVal error, timestamp string)
ReportError ignores the provided event.
func (c *NoOpMachineEventLoggingClient) URLReachable(name string, url string, port int, secure bool, kind string, reachable bool, timestamp string)
URLReachable ignores the provided event.
type RegistryListOutput struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` RegistryList *[]preference.Registry `json:"registries,omitempty"` }
func NewRegistryListOutput(registryList *[]preference.Registry) RegistryListOutput
ReportError is the JSON event that is emitted when an error occurs during push command
type ReportError struct { Error string `json:"error"` AbstractLogEvent }
func (c ReportError) GetType() MachineEventLogEntryType
GetType returns the event type for this event.
URLReachable is the JSON event that is emitted to indicate whether one of the component's URL's could be reached.
type URLReachable struct { Name string `json:"name"` URL string `json:"url"` Port int `json:"port"` Secure bool `json:"secure"` Kind string `json:"kind"` Reachable bool `json:"reachable"` AbstractLogEvent }
func (c URLReachable) GetType() MachineEventLogEntryType
GetType returns the event type for this event.