transformers

package
v0.0.0-...-b830f6f Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigMapTransformer

type ConfigMapTransformer struct{}

ConfigMapTransformer handles ConfigMap resource transformation

func NewConfigMapTransformer

func NewConfigMapTransformer() *ConfigMapTransformer

NewConfigMapTransformer creates a new ConfigMap transformer

func (*ConfigMapTransformer) AggregateResources

func (t *ConfigMapTransformer) AggregateResources(resources []interface{}, showNamespace bool, multiContext bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

AggregateResources combines multiple resources with the same unique key

func (*ConfigMapTransformer) CanGroup

func (t *ConfigMapTransformer) CanGroup() bool

CanGroup returns true if this resource type supports grouping

func (*ConfigMapTransformer) GetHeaders

func (t *ConfigMapTransformer) GetHeaders(showNamespace bool, multiContext bool) []string

GetHeaders returns column headers for ConfigMaps

func (*ConfigMapTransformer) GetResourceType

func (t *ConfigMapTransformer) GetResourceType() string

GetResourceType returns the resource type

func (*ConfigMapTransformer) GetSortValue

func (t *ConfigMapTransformer) GetSortValue(resource interface{}, column string) interface{}

GetSortValue returns the value for sorting on a given column

func (*ConfigMapTransformer) GetUniqKey

func (t *ConfigMapTransformer) GetUniqKey(resource interface{}, templateEngine *template.Engine) (string, error)

GetUniqKey generates a unique key for resource grouping

func (*ConfigMapTransformer) TransformToRow

func (t *ConfigMapTransformer) TransformToRow(resource interface{}, showNamespace bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

TransformToRow converts a ConfigMap to a table row

type DeploymentTransformer

type DeploymentTransformer struct{}

DeploymentTransformer handles Deployment resource transformation

func NewDeploymentTransformer

func NewDeploymentTransformer() *DeploymentTransformer

NewDeploymentTransformer creates a new deployment transformer

func (*DeploymentTransformer) AggregateResources

func (t *DeploymentTransformer) AggregateResources(resources []interface{}, showNamespace bool, multiContext bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

AggregateResources combines multiple deployments with the same unique key

func (*DeploymentTransformer) CanGroup

func (t *DeploymentTransformer) CanGroup() bool

CanGroup returns true if this resource type supports grouping

func (*DeploymentTransformer) GetHeaders

func (t *DeploymentTransformer) GetHeaders(showNamespace bool, multiContext bool) []string

GetHeaders returns the column headers for deployments

func (*DeploymentTransformer) GetResourceType

func (t *DeploymentTransformer) GetResourceType() string

GetResourceType returns the resource type

func (*DeploymentTransformer) GetSortValue

func (t *DeploymentTransformer) GetSortValue(resource interface{}, column string) interface{}

GetSortValue returns the value to use for sorting on the given column

func (*DeploymentTransformer) GetUniqKey

func (t *DeploymentTransformer) GetUniqKey(resource interface{}, templateEngine *template.Engine) (string, error)

GetUniqKey generates a unique key for resource grouping

func (*DeploymentTransformer) TransformToRow

func (t *DeploymentTransformer) TransformToRow(resource interface{}, showNamespace bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

TransformToRow converts a deployment to a table row

type IngressTransformer

type IngressTransformer struct{}

IngressTransformer handles Ingress resource transformation

func NewIngressTransformer

func NewIngressTransformer() *IngressTransformer

NewIngressTransformer creates a new Ingress transformer

func (*IngressTransformer) AggregateResources

func (t *IngressTransformer) AggregateResources(resources []interface{}, showNamespace bool, multiContext bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

AggregateResources combines multiple resources with the same unique key

func (*IngressTransformer) CanGroup

func (t *IngressTransformer) CanGroup() bool

CanGroup returns true if this resource type supports grouping

func (*IngressTransformer) GetHeaders

func (t *IngressTransformer) GetHeaders(showNamespace bool, multiContext bool) []string

GetHeaders returns column headers for Ingresses

func (*IngressTransformer) GetResourceType

func (t *IngressTransformer) GetResourceType() string

GetResourceType returns the resource type

func (*IngressTransformer) GetSortValue

func (t *IngressTransformer) GetSortValue(resource interface{}, column string) interface{}

GetSortValue returns the value for sorting on a given column

func (*IngressTransformer) GetUniqKey

func (t *IngressTransformer) GetUniqKey(resource interface{}, templateEngine *template.Engine) (string, error)

GetUniqKey generates a unique key for resource grouping

func (*IngressTransformer) TransformToRow

func (t *IngressTransformer) TransformToRow(resource interface{}, showNamespace bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

TransformToRow converts an Ingress to a table row

type MetricsProvider

type MetricsProvider interface {
	GetPodMetrics(namespace string) (map[string]*k8s.PodMetrics, error)
}

MetricsProvider interface for getting pod metrics

type PodTransformer

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

PodTransformer handles Pod resource transformation

func NewPodTransformer

func NewPodTransformer() *PodTransformer

NewPodTransformer creates a new pod transformer

func (*PodTransformer) AggregateResources

func (t *PodTransformer) AggregateResources(resources []interface{}, showNamespace bool, multiContext bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

AggregateResources combines multiple pods with the same unique key

func (*PodTransformer) CanGroup

func (t *PodTransformer) CanGroup() bool

CanGroup returns true if this resource type supports grouping

func (*PodTransformer) GetHeaders

func (t *PodTransformer) GetHeaders(showNamespace bool, multiContext bool) []string

GetHeaders returns the column headers for pods

func (*PodTransformer) GetResourceType

func (t *PodTransformer) GetResourceType() string

GetResourceType returns the resource type

func (*PodTransformer) GetSortValue

func (t *PodTransformer) GetSortValue(resource interface{}, column string) interface{}

GetSortValue returns the value to use for sorting on the given column

func (*PodTransformer) GetUniqKey

func (t *PodTransformer) GetUniqKey(resource interface{}, templateEngine *template.Engine) (string, error)

GetUniqKey generates a unique key for resource grouping

func (*PodTransformer) SetMetricsProvider

func (t *PodTransformer) SetMetricsProvider(provider MetricsProvider)

SetMetricsProvider sets the metrics provider

func (*PodTransformer) TransformToRow

func (t *PodTransformer) TransformToRow(resource interface{}, showNamespace bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

TransformToRow converts a pod to a table row

type Registry

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

Registry manages resource transformers

func GetDefaultRegistry

func GetDefaultRegistry() *Registry

GetDefaultRegistry returns a registry with all default transformers

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new transformer registry

func (*Registry) Get

func (r *Registry) Get(resourceType string) (ResourceTransformer, bool)

Get returns the transformer for a resource type

func (*Registry) GetAll

func (r *Registry) GetAll() map[string]ResourceTransformer

GetAll returns all registered transformers

func (*Registry) Register

func (r *Registry) Register(resourceType string, transformer ResourceTransformer)

Register registers a transformer for a resource type

type ResourceTransformer

type ResourceTransformer interface {
	// GetHeaders returns the column headers for this resource type
	GetHeaders(showNamespace bool, multiContext bool) []string

	// TransformToRow converts a resource to a table row
	TransformToRow(resource interface{}, showNamespace bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

	// GetSortValue returns the value to use for sorting on the given column
	GetSortValue(resource interface{}, column string) interface{}

	// GetResourceType returns the resource type this transformer handles
	GetResourceType() string

	// GetUniqKey generates a unique key for resource grouping
	GetUniqKey(resource interface{}, templateEngine *template.Engine) (string, error)

	// CanGroup returns true if this resource type supports grouping
	CanGroup() bool

	// AggregateResources combines multiple resources with the same unique key
	AggregateResources(resources []interface{}, showNamespace bool, multiContext bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)
}

ResourceTransformer defines the interface for transforming K8s resources to table data

type SecretTransformer

type SecretTransformer struct{}

SecretTransformer handles Secret resource transformation

func NewSecretTransformer

func NewSecretTransformer() *SecretTransformer

NewSecretTransformer creates a new Secret transformer

func (*SecretTransformer) AggregateResources

func (t *SecretTransformer) AggregateResources(resources []interface{}, showNamespace bool, multiContext bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

AggregateResources combines multiple resources with the same unique key

func (*SecretTransformer) CanGroup

func (t *SecretTransformer) CanGroup() bool

CanGroup returns true if this resource type supports grouping

func (*SecretTransformer) GetHeaders

func (t *SecretTransformer) GetHeaders(showNamespace bool, multiContext bool) []string

GetHeaders returns column headers for Secrets

func (*SecretTransformer) GetResourceType

func (t *SecretTransformer) GetResourceType() string

GetResourceType returns the resource type

func (*SecretTransformer) GetSortValue

func (t *SecretTransformer) GetSortValue(resource interface{}, column string) interface{}

GetSortValue returns the value for sorting on a given column

func (*SecretTransformer) GetUniqKey

func (t *SecretTransformer) GetUniqKey(resource interface{}, templateEngine *template.Engine) (string, error)

GetUniqKey generates a unique key for resource grouping

func (*SecretTransformer) TransformToRow

func (t *SecretTransformer) TransformToRow(resource interface{}, showNamespace bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

TransformToRow converts a Secret to a table row

type ServiceTransformer

type ServiceTransformer struct{}

ServiceTransformer handles Service resource transformation

func NewServiceTransformer

func NewServiceTransformer() *ServiceTransformer

NewServiceTransformer creates a new Service transformer

func (*ServiceTransformer) AggregateResources

func (t *ServiceTransformer) AggregateResources(resources []interface{}, showNamespace bool, multiContext bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

AggregateResources combines multiple resources with the same unique key

func (*ServiceTransformer) CanGroup

func (t *ServiceTransformer) CanGroup() bool

CanGroup returns true if this resource type supports grouping

func (*ServiceTransformer) GetHeaders

func (t *ServiceTransformer) GetHeaders(showNamespace bool, multiContext bool) []string

GetHeaders returns column headers for Services

func (*ServiceTransformer) GetResourceType

func (t *ServiceTransformer) GetResourceType() string

GetResourceType returns the resource type

func (*ServiceTransformer) GetSortValue

func (t *ServiceTransformer) GetSortValue(resource interface{}, column string) interface{}

GetSortValue returns the value for sorting on a given column

func (*ServiceTransformer) GetUniqKey

func (t *ServiceTransformer) GetUniqKey(resource interface{}, templateEngine *template.Engine) (string, error)

GetUniqKey generates a unique key for resource grouping

func (*ServiceTransformer) TransformToRow

func (t *ServiceTransformer) TransformToRow(resource interface{}, showNamespace bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

TransformToRow converts a Service to a table row

type StatefulSetTransformer

type StatefulSetTransformer struct{}

StatefulSetTransformer handles StatefulSet resource transformation

func NewStatefulSetTransformer

func NewStatefulSetTransformer() *StatefulSetTransformer

NewStatefulSetTransformer creates a new StatefulSet transformer

func (*StatefulSetTransformer) AggregateResources

func (t *StatefulSetTransformer) AggregateResources(resources []interface{}, showNamespace bool, multiContext bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

AggregateResources combines multiple statefulsets with the same unique key

func (*StatefulSetTransformer) CanGroup

func (t *StatefulSetTransformer) CanGroup() bool

CanGroup returns true if this resource type supports grouping

func (*StatefulSetTransformer) GetHeaders

func (t *StatefulSetTransformer) GetHeaders(showNamespace bool, multiContext bool) []string

GetHeaders returns column headers for StatefulSets

func (*StatefulSetTransformer) GetResourceType

func (t *StatefulSetTransformer) GetResourceType() string

GetResourceType returns the resource type

func (*StatefulSetTransformer) GetSortValue

func (t *StatefulSetTransformer) GetSortValue(resource interface{}, column string) interface{}

GetSortValue returns the value for sorting on a given column

func (*StatefulSetTransformer) GetUniqKey

func (t *StatefulSetTransformer) GetUniqKey(resource interface{}, templateEngine *template.Engine) (string, error)

GetUniqKey generates a unique key for resource grouping

func (*StatefulSetTransformer) TransformToRow

func (t *StatefulSetTransformer) TransformToRow(resource interface{}, showNamespace bool, templateEngine *template.Engine) ([]string, *selection.ResourceIdentity, error)

TransformToRow converts a StatefulSet to a table row

Jump to

Keyboard shortcuts

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