devspace

package
v1.0.0-rc.12 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package devspace contains the logic for matching devspace hooks across CLI runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name  string   `json:"name"`
	Line  string   `json:"line"`
	Flags []string `json:"flags,omitempty"`
	Args  []string `json:"args,omitempty"`
}

Command contains the details about devspace command that triggered the event.

type Devenv

type Devenv struct {
	Bin                    string `json:"bin,omitempty"`
	Version                string `json:"version,omitempty"`
	KindBin                string `json:"kind_bin,omitempty"`
	DevspaceBin            string `json:"devspace_bin,omitempty"`
	Type                   string `json:"type,omitempty"`
	DevDeploymentProfile   string `json:"dev_deployment_profile,omitempty"`
	DeployVersion          string `json:"deploy_version,omitempty"`
	DeployImageSource      string `json:"deploy_image_source,omitempty"`
	DeployImageRegistry    string `json:"deploy_image_registry,omitempty"`
	DeployDevImageRegistry string `json:"deploy_dev_image_registry,omitempty"`
	DeployBoxImageRegistry string `json:"deploy_box_image_registry,omitempty"`
	DeployAppname          string `json:"deploy_appname,omitempty"`

	DeployUseDevspace     bool `json:"deploy_use_devspace,omitempty"`
	DevSkipPortforwarding bool `json:"dev_skip_portforwarding,omitempty"`
	DevTerminal           bool `json:"dev_terminal,omitempty"`
}

Devenv contains the details about devenv environment variables provided with the event.

type Event

type Event struct {
	Name string `json:"event,omitempty"`

	Hook string `json:"hook,omitempty"`

	ExecutionID string `json:"execution_id,omitempty"`

	Error  string `json:"error,omitempty"`
	Status string `json:"status,omitempty"`

	Command *Command `json:"command,omitempty"`
	Devenv  *Devenv  `json:"devenv,omitempty"`

	Timestamp    int64     `json:"timestamp"`
	TimestampTag time.Time `json:"@timestamp,omitempty"`
	Duration     int64     `json:"duration_ms,omitempty"`
}

Event contains the details about the devspace hook event.

func EventFromEnv

func EventFromEnv() *Event

EventFromEnv scrapes the event data from the environment variables.

func (*Event) Key

func (e *Event) Key() string

Key returns the key for the event index.

func (*Event) MarshalRecord

func (e *Event) MarshalRecord(addField func(name string, value interface{}))

MarshalRecord adds the event data to the target data structure (map most likely).

func (*Event) UnmarshalRecord

func (e *Event) UnmarshalRecord(data map[string]interface{}) error

UnmarshalRecord unmarshals the event data from the map into Event.

type EventTracker

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

EventTracker is responsible for matching events, calculating durations and storing the data in a store. It also handles the processing of the events on Flush.

func NewTracker

func NewTracker(p Processor, s store.Store) *EventTracker

NewTracker creates a new DevspaceTracker.

func (*EventTracker) Flush

func (t *EventTracker) Flush(ctx context.Context) error

Flush processes the events in the store.

func (*EventTracker) Track

func (t *EventTracker) Track(ctx context.Context, event *Event)

Track stores and matches an event.

type Processor

type Processor interface {
	ProcessRecords(context.Context, []interface{}) error
}

Processor is the interface for processing stored events.

type Tracker

type Tracker interface {
	Track(context.Context, *Event)
	Flush(context.Context) error
}

Tracker is the entry interface into event tracking, matching and processing.

Jump to

Keyboard shortcuts

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