tableconverters

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootMachineName      = "downward-api.machinepoollet.ironcore.dev/root-machine-name"
	RootMachineNamespace = "downward-api.machinepoollet.ironcore.dev/root-machine-namespace"
)

Variables

View Source
var (
	Events = tableconverter.Funcs[*iri.Event]{
		Headers: tableconverter.Headers(eventHeaders),
		Rows: tableconverter.SingleRowFrom(func(event *iri.Event) (api.Row, error) {
			return api.Row{
				event.Spec.GetInvolvedObjectMeta().Id,
				event.Spec.Type,
				event.Spec.Reason,
				event.Spec.Message,
				getRootMachineName(event.Spec.GetInvolvedObjectMeta().Labels),
				getRootMachineNamespace(event.Spec.GetInvolvedObjectMeta().Labels),
			}, nil
		}),
	}

	EventsSlice = tableconverter.SliceFuncs[*iri.Event](Events)
)
View Source
var (
	Machine = tableconverter.Funcs[*iri.Machine]{
		Headers: tableconverter.Headers(machineHeaders),
		Rows: tableconverter.SingleRowFrom(func(machine *iri.Machine) (api.Row, error) {
			return api.Row{
				machine.Metadata.Id,
				machine.Spec.Class,
				machine.Spec.GetImage().GetImage(),
				machine.Status.State.String(),
				duration.HumanDuration(time.Since(time.Unix(0, machine.Metadata.CreatedAt))),
			}, nil
		}),
	}
	MachineSlice = tableconverter.SliceFuncs[*iri.Machine](Machine)
)
View Source
var (
	RegistryBuilder tableconverter.RegistryBuilder
	AddToRegistry   = RegistryBuilder.AddToRegistry
)
View Source
var (
	MachineClassStatus = tableconverter.Funcs[*iri.MachineClassStatus]{
		Headers: tableconverter.Headers(machineClassHeaders),
		Rows: tableconverter.SingleRowFrom(func(status *iri.MachineClassStatus) (api.Row, error) {
			return api.Row{
				status.MachineClass.Name,
				resource.NewMilliQuantity(status.MachineClass.Capabilities.CpuMillis, resource.DecimalSI).String(),
				resource.NewQuantity(int64(status.MachineClass.Capabilities.MemoryBytes), resource.DecimalSI).String(),
				resource.NewQuantity(status.Quantity, resource.DecimalSI).String(),
			}, nil
		}),
	}

	MachineClassStatusSlice = tableconverter.SliceFuncs[*iri.MachineClassStatus](MachineClassStatus)
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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