1 // Copyright 2020 The Kubernetes Authors. 2 // SPDX-License-Identifier: Apache-2.0 3 4 package printer 5 6 import ( 7 "sigs.k8s.io/cli-utils/pkg/kstatus/polling/collector" 8 "sigs.k8s.io/cli-utils/pkg/kstatus/polling/event" 9 "sigs.k8s.io/cli-utils/pkg/object" 10 ) 11 12 // PrintData records data required for printing 13 type PrintData struct { 14 Identifiers object.ObjMetadataSet 15 InvNameMap map[object.ObjMetadata]string 16 StatusSet map[string]bool 17 } 18 19 // Printer defines an interface for outputting information about status of 20 // resources. Different implementations allow output formats tailored to 21 // different use cases. 22 type Printer interface { 23 24 // Print tells the printer to start outputting data. The stop parameter 25 // is a channel that the caller will use to signal to the printer that it 26 // needs to stop and shut down. The channel returned can be used by the 27 // printer implementation to signal that it has outputted all the data it 28 // needs to, and that it has completed shutting down. The latter is important 29 // to make sure the printer has a chance to output all data before the 30 // program terminates. 31 Print(ch <-chan event.Event, identifiers object.ObjMetadataSet, cancelFunc collector.ObserverFunc) error 32 } 33