printer

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2019 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JobCols = component.NewTableCols("Name", "Labels", "Completions", "Successful", "Age")
)

Functions

func AddHandlers

func AddHandlers(p Handler) error

AddHandlers adds print handlers to a printer.

func BreakdownRule

func BreakdownRule(rule rbacv1.PolicyRule) []rbacv1.PolicyRule

BreakdownRule takes a rule and builds an equivalent list of rules that each have at most one verb, one resource, and one resource name

func ClusterRoleBindingHandler

func ClusterRoleBindingHandler(ctx context.Context, roleBinding *rbacv1.ClusterRoleBinding, options Options) (component.Component, error)

func ClusterRoleBindingListHandler

func ClusterRoleBindingListHandler(_ context.Context, clusterRoleBindingList *rbacv1.ClusterRoleBindingList, options Options) (component.Component, error)

func ClusterRoleHandler

func ClusterRoleHandler(ctx context.Context, clusterRole *rbacv1.ClusterRole, options Options) (component.Component, error)

ClusterRoleHandler is a printFunc that prints a cluster role

func ClusterRoleListHandler

func ClusterRoleListHandler(_ context.Context, list *rbacv1.ClusterRoleList, options Options) (component.Component, error)

ClusterRoleListHandler is a printFunc that prints cluster roles

func CombineResourceGroup

func CombineResourceGroup(resource, group []string) string

func ConfigMapHandler

func ConfigMapHandler(ctx context.Context, cm *corev1.ConfigMap, options Options) (component.Component, error)

ConfigMapHandler is a printFunc that prints a ConfigMap

func ConfigMapListHandler

func ConfigMapListHandler(_ context.Context, list *corev1.ConfigMapList, opts Options) (component.Component, error)

ConfigMapListHandler is a printFunc that prints ConfigMaps

func CronJobHandler

func CronJobHandler(ctx context.Context, c *batchv1beta1.CronJob, opts Options) (component.Component, error)

CronJobHandler is a printFunc that prints a CronJob

func CronJobListHandler

func CronJobListHandler(ctx context.Context, list *batchv1beta1.CronJobList, opts Options) (component.Component, error)

CronJobListHandler is a printFunc that lists cronjobs

func CustomResourceHandler

func CustomResourceHandler(
	ctx context.Context,
	crd *apiextv1beta1.CustomResourceDefinition,
	object *unstructured.Unstructured,
	options Options) (component.Component, error)

CustomResourceHandler prints custom resource objects. If the object has columns specified, it will print those columns as well.

func CustomResourceListHandler

func CustomResourceListHandler(
	crdName string,
	crd *apiextv1beta1.CustomResourceDefinition,
	list *unstructured.UnstructuredList,
	linkGenerator link.Interface) (component.Component, error)

CustomResourceListHandler prints a list of custom resources with optional custom columns.

func DaemonSetHandler

func DaemonSetHandler(ctx context.Context, daemonSet *appsv1.DaemonSet, options Options) (component.Component, error)

DaemonSetHandler is a printFunc that prints a daemon set

func DaemonSetListHandler

func DaemonSetListHandler(_ context.Context, list *appsv1.DaemonSetList, opts Options) (component.Component, error)

DaemonSetListHandler is a printFunc that lists daemon sets

func DefaultPrintFunc

func DefaultPrintFunc(_ context.Context, object runtime.Object, _ Options) (component.Component, error)

DefaultPrintFunc is a default object printer. It prints Kubernetes resource lists with three columns: name, labels, age. Returns nil if the object should not be printed.

func DeploymentHandler

func DeploymentHandler(ctx context.Context, deployment *appsv1.Deployment, options Options) (component.Component, error)

DeploymentHandler is a printFunc that prints a Deployments.

func DeploymentListHandler

func DeploymentListHandler(_ context.Context, list *appsv1.DeploymentList, opts Options) (component.Component, error)

DeploymentListHandler is a printFunc that lists deployments

func EventHandler

func EventHandler(ctx context.Context, event *corev1.Event, opts Options) (component.Component, error)

func EventListHandler

func EventListHandler(ctx context.Context, list *corev1.EventList, opts Options) (component.Component, error)

EventListHandler is a printFunc that lists events.

func IngressHandler

func IngressHandler(ctx context.Context, ingress *extv1beta1.Ingress, options Options) (component.Component, error)

func IngressListHandler

func IngressListHandler(_ context.Context, list *extv1beta1.IngressList, options Options) (component.Component, error)

func JobHandler

func JobHandler(ctx context.Context, job *batchv1.Job, opts Options) (component.Component, error)

JobHandler printers a job.

func JobListHandler

func JobListHandler(_ context.Context, list *batchv1.JobList, opts Options) (component.Component, error)

JobListHandler prints a job list.

func NodeHandler added in v0.5.0

func NodeHandler(ctx context.Context, node *corev1.Node, options Options) (component.Component, error)

func NodeListHandler added in v0.5.0

func NodeListHandler(ctx context.Context, list *corev1.NodeList, options Options) (component.Component, error)

func ObjectReferencePath

func ObjectReferencePath(or corev1.ObjectReference) (string, error)

ObjectReferencePath returns the overview path for an object reference. Currently, this does not support custom resources.

func PersistentVolumeClaimHandler

func PersistentVolumeClaimHandler(ctx context.Context, persistentVolumeClaim *corev1.PersistentVolumeClaim, options Options) (component.Component, error)

PersistentVolumeClaimHandler is a printFunc that prints a PersistentVolumeClaim

func PersistentVolumeClaimListHandler

func PersistentVolumeClaimListHandler(ctx context.Context, list *corev1.PersistentVolumeClaimList, options Options) (component.Component, error)

PersistentVolumeClaimListHandler is a printFunc that prints persistentvolumeclaims

func PodHandler

func PodHandler(ctx context.Context, pod *corev1.Pod, opts Options) (component.Component, error)

PodHandler is a printFunc that prints Pods

func PodListHandler

func PodListHandler(_ context.Context, list *corev1.PodList, opts Options) (component.Component, error)

PodListHandler is a printFunc that prints pods

func PrintEvents

func PrintEvents(list *corev1.EventList, opts Options) (component.Component, error)

PrintEvents collects events for a resource

func ReplicaSetHandler

func ReplicaSetHandler(ctx context.Context, rs *appsv1.ReplicaSet, options Options) (component.Component, error)

ReplicaSetHandler is a printFunc that prints a ReplicaSets.

func ReplicaSetListHandler

func ReplicaSetListHandler(ctx context.Context, list *appsv1.ReplicaSetList, opts Options) (component.Component, error)

ReplicaSetListHandler is a printFunc that lists deployments

func ReplicationControllerHandler

func ReplicationControllerHandler(ctx context.Context, rc *corev1.ReplicationController, options Options) (component.Component, error)

ReplicationControllerHandler is a printFunc that prints a ReplicationController

func ReplicationControllerListHandler

func ReplicationControllerListHandler(ctx context.Context, list *corev1.ReplicationControllerList, options Options) (component.Component, error)

ReplicationControllerListHandler is a printFunc that lists ReplicationControllers

func RoleBindingHandler

func RoleBindingHandler(ctx context.Context, roleBinding *rbacv1.RoleBinding, opts Options) (component.Component, error)

func RoleBindingListHandler

func RoleBindingListHandler(ctx context.Context, roleBindingList *rbacv1.RoleBindingList, opts Options) (component.Component, error)

func RoleHandler

func RoleHandler(ctx context.Context, role *rbacv1.Role, opts Options) (component.Component, error)

func RoleListHandler

func RoleListHandler(_ context.Context, roleList *rbacv1.RoleList, options Options) (component.Component, error)

func SecretHandler

func SecretHandler(ctx context.Context, secret *corev1.Secret, options Options) (component.Component, error)

SecretHandler is a printFunc for printing a secret summary.

func SecretListHandler

func SecretListHandler(ctx context.Context, list *corev1.SecretList, options Options) (component.Component, error)

SecretListHandler is a printFunc that lists secrets.

func ServiceAccountHandler

func ServiceAccountHandler(ctx context.Context, serviceAccount *corev1.ServiceAccount, options Options) (component.Component, error)

func ServiceAccountListHandler

func ServiceAccountListHandler(_ context.Context, list *corev1.ServiceAccountList, options Options) (component.Component, error)

func ServiceHandler

func ServiceHandler(ctx context.Context, service *corev1.Service, options Options) (component.Component, error)

ServiceHandler is a printFunc that prints a Services.

func ServiceListHandler

func ServiceListHandler(_ context.Context, list *corev1.ServiceList, options Options) (component.Component, error)

ServiceListHandler is a printFunc that lists services

func StatefulSetHandler

func StatefulSetHandler(ctx context.Context, statefulSet *appsv1.StatefulSet, options Options) (component.Component, error)

StatefulSetHandler is a printFunc that prints a StatefulSet

func StatefulSetListHandler

func StatefulSetListHandler(_ context.Context, list *appsv1.StatefulSetList, options Options) (component.Component, error)

StatefulSetListHandler is a printFunc that list stateful sets

func ValidatePrintHandlerFunc

func ValidatePrintHandlerFunc(printFunc reflect.Value) error

ValidatePrintHandlerFunc validates print handler signature. printFunc is the function that will be called to print an object. printFunc must be of the following type:

func printFunc(ctx context.Context, object ObjectType, options Options) (component.Component, error)

where:

ObjectType is the type of object that will be printed

Types

type ConfigMapConfiguration

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

ConfigMapConfiguration generates config map configuration

func NewConfigMapConfiguration

func NewConfigMapConfiguration(cm *corev1.ConfigMap) *ConfigMapConfiguration

NewConfigMapConfiguration creates an instance of ConfigMapConfiguration

type ContainerConfiguration

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

ContainerConfiguration generates container configuration.

func NewContainerConfiguration

func NewContainerConfiguration(parent runtime.Object, c *corev1.Container, pfs portforward.PortForwarder, isInit bool, options Options) *ContainerConfiguration

NewContainerConfiguration creates an instance of ContainerConfiguration.

func (*ContainerConfiguration) Create

func (cc *ContainerConfiguration) Create() (*component.Summary, error)

Create creates a deployment configuration summary.

type CronJobConfiguration

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

CronJobConfiguration generates cronjob configuration

func NewCronJobConfiguration

func NewCronJobConfiguration(c *batchv1beta1.CronJob) *CronJobConfiguration

NewCronJobConfiguration creates an instance of CronJobConfiguration

func (*CronJobConfiguration) Create

func (cc *CronJobConfiguration) Create() (*component.Summary, error)

Create creates a cronjob configuration summary

type DeploymentConfiguration

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

DeploymentConfiguration generates deployment configuration.

func NewDeploymentConfiguration

func NewDeploymentConfiguration(d *appsv1.Deployment) *DeploymentConfiguration

NewDeploymentConfiguration creates an instance of DeploymentConfiguration.

func (*DeploymentConfiguration) Create

Create creates a deployment configuration summary.

type Handler

type Handler interface {
	Handler(printFunc interface{}) error
}

Handler configures handlers for a printer.

type ItemDescriptor

type ItemDescriptor struct {
	Func  ObjectPrinterFunc
	Width int
}

ItemDescriptor describes a func to print a view and its width.

type JobTemplate

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

func NewJobTemplate

func NewJobTemplate(parent runtime.Object, jobTemplateSpec batchv1beta1.JobTemplateSpec) *JobTemplate

func (*JobTemplate) AddToFlexLayout

func (jt *JobTemplate) AddToFlexLayout(fl *flexlayout.FlexLayout, options Options) error

type JobTemplateHeader

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

JobTemplateHeader creates a job template header

func NewJobTemplateHeader

func NewJobTemplateHeader(labels map[string]string) *JobTemplateHeader

NewJobTemplateHeader creates an instance of JobTemplateHeader

func (*JobTemplateHeader) Create

func (jth *JobTemplateHeader) Create() (*component.Labels, error)

Create creates a label component

type Metadata

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

func NewMetadata

func NewMetadata(object runtime.Object, l link2.Interface) (*Metadata, error)

func (*Metadata) AddToFlexLayout

func (m *Metadata) AddToFlexLayout(fl *flexlayout.FlexLayout) error

type Object

type Object struct {
	MetadataGen    func(runtime.Object, *flexlayout.FlexLayout, Options) error
	PodTemplateGen func(runtime.Object, corev1.PodTemplateSpec, *flexlayout.FlexLayout, Options) error
	JobTemplateGen func(runtime.Object, batchv1beta1.JobTemplateSpec, *flexlayout.FlexLayout, Options) error
	EventsGen      func(ctx context.Context, object runtime.Object, fl *flexlayout.FlexLayout, options Options) error
	// contains filtered or unexported fields
}

Object prints an object.

func NewObject

func NewObject(object runtime.Object, options ...ObjectOpts) *Object

NewObject creates an instance of Object.

func (*Object) EnableEvents

func (o *Object) EnableEvents()

EnableEvents enables the event view for the object.

func (*Object) EnableJobTemplate

func (o *Object) EnableJobTemplate(templateSpec batchv1beta1.JobTemplateSpec)

EnableJobTemplate enables the job template view for the object.

func (*Object) EnablePodTemplate

func (o *Object) EnablePodTemplate(templateSpec corev1.PodTemplateSpec)

EnablePodTemplate enables the pod template view for the object.

func (*Object) RegisterConfig

func (o *Object) RegisterConfig(summary *component.Summary)

RegisterConfig registers the config view for an object.

func (*Object) RegisterItems

func (o *Object) RegisterItems(items ...ItemDescriptor)

RegisterItems registers one or more items to be printed in a section. Each call to RegisterItems will create a new section.

func (*Object) RegisterSummary

func (o *Object) RegisterSummary(summary *component.Summary)

RegisterSummary registers a summary view for an object.

func (*Object) ToComponent

func (o *Object) ToComponent(ctx context.Context, options Options) (component.Component, error)

ToComponent converts Object to a view.

type ObjectOpts

type ObjectOpts func(o *Object)

ObjectOpts are options for configuration Object.

type ObjectPrinterFunc

type ObjectPrinterFunc func() (component.Component, error)

ObjectPrinterFunc is a func that create a view.

type ObjectPrinterLayoutFunc

type ObjectPrinterLayoutFunc func(*flexlayout.FlexLayout) error

ObjectPrinterLayoutFunc is a func that render a view in a flex layout.

type Options

type Options struct {
	DisableLabels bool
	DashConfig    config.Dash
	Link          link.Interface
}

Options provides options to a print handler

type PodConfiguration

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

PodConfiguration generates pod configuration.

func NewPodConfiguration

func NewPodConfiguration(p *corev1.Pod) *PodConfiguration

NewPodConfiguration creates an instance of PodConfiguration.

func (*PodConfiguration) Create

func (p *PodConfiguration) Create(options Options) (*component.Summary, error)

Create creates a pod configuration summary.

type PodTemplate

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

func NewPodTemplate

func NewPodTemplate(parent runtime.Object, podTemplateSpec corev1.PodTemplateSpec) *PodTemplate

func (*PodTemplate) AddToFlexLayout

func (pt *PodTemplate) AddToFlexLayout(fl *flexlayout.FlexLayout, options Options) error

type PodTemplateHeader

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

PodTemplateHeader creates a pod template header. It consists of a selectors component with title `Pod Template` and the associated match selectors.

func NewPodTemplateHeader

func NewPodTemplateHeader(labels map[string]string) *PodTemplateHeader

NewPodTemplateHeader creates an instance of PodTemplateHeader.

func (*PodTemplateHeader) Create

func (pth *PodTemplateHeader) Create() *component.Labels

Create creates a labels component.

type Printer

type Printer interface {
	// Print prints a runtime object.
	Print(ctx context.Context, object runtime.Object, pluginPrinter plugin.ManagerInterface) (component.Component, error)
}

Printer is an interface for printing runtime objects.

type ReplicaSetConfiguration

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

ReplicaSetConfiguration generates a replicaset configuration

func NewReplicaSetConfiguration

func NewReplicaSetConfiguration(rs *appsv1.ReplicaSet) *ReplicaSetConfiguration

NewReplicaSetConfiguration creates an instance of ReplicaSetConfiguration

func (*ReplicaSetConfiguration) Create

func (rc *ReplicaSetConfiguration) Create(options Options) (*component.Summary, error)

Create generates a replicaset configuration summary

type ReplicaSetStatus

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

ReplicaSetStatus generates a replicaset status

func NewReplicaSetStatus

func NewReplicaSetStatus(rs *appsv1.ReplicaSet) *ReplicaSetStatus

NewReplicaSetStatus creates an instance of ReplicaSetStatus

func (*ReplicaSetStatus) Create

Create generates a replicaset status quadrant

type ReplicationControllerConfiguration

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

ReplicationControllerConfiguration generates a replicationcontroller configuration

func NewReplicationControllerConfiguration

func NewReplicationControllerConfiguration(rc *corev1.ReplicationController) *ReplicationControllerConfiguration

NewReplicationControllerConfiguration creates an instance of ReplicationControllerConfiguration

func (*ReplicationControllerConfiguration) Create

Create generates a replicationcontroller configuration summary

type ReplicationControllerStatus

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

ReplicationControllerStatus generates a replication controller status

func NewReplicationControllerStatus

func NewReplicationControllerStatus(replicationController *corev1.ReplicationController) *ReplicationControllerStatus

NewReplicationControllerStatus creates an instance of ReplicationControllerStatus

func (*ReplicationControllerStatus) Create

func (replicationController *ReplicationControllerStatus) Create(ctx context.Context, o store.Store) (*component.Quadrant, error)

Create generates a replicaset status quadrant

type Resource

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

Resource prints runtime objects.

func NewResource

func NewResource(dashConfig config.Dash) *Resource

NewResource creates an instance of ResourcePrinter.

func (*Resource) Handler

func (p *Resource) Handler(printFunc interface{}) error

Handler adds a printer handler. See ValidatePrintHandlerFunc for required method signature.

func (*Resource) Print

func (p *Resource) Print(ctx context.Context, object runtime.Object, pluginPrinter plugin.ManagerInterface) (component.Component, error)

Print prints a runtime object. If not handler can be found for the type, it will print using `DefaultPrintFunc`.

type StatefulSetConfiguration

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

StatefulSetConfiguration generates a statefulset configuration

func NewStatefulSetConfiguration

func NewStatefulSetConfiguration(statefulSet *appsv1.StatefulSet) *StatefulSetConfiguration

NewStatefulSetConfiguration creates an instance of StatefulSetConfiguration

func (*StatefulSetConfiguration) Create

Create generates a statefulset configuration summary

type StatefulSetStatus

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

StatefulSetStatus generates a statefulset status

func NewStatefulSetStatus

func NewStatefulSetStatus(statefulSet *appsv1.StatefulSet) *StatefulSetStatus

NewStatefulSetStatus creates an instance of StatefulSetStatus

func (*StatefulSetStatus) Create

func (statefulSet *StatefulSetStatus) Create(ctx context.Context, options Options) (*component.Quadrant, error)

Create generates a statefulset status quadrant

Jump to

Keyboard shortcuts

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