Documentation ¶
Index ¶
- type Deleter
- func (d *Deleter) Delete(streams *cli.Stream, resourceNames []string) []string
- func (d *Deleter) DeleteRelated(streams *cli.Stream, resourceNames []string)
- func (d *Deleter) Errors() error
- func (d *Deleter) PrintSuccesses(streams *cli.Stream)
- func (d *Deleter) WithRelated(kind string, listFunc func(string) ([]string, error), ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deleter ¶
type Deleter struct {
// contains filtered or unexported fields
}
Deleter encapsulates behaviour around deleting resources and their relations. While actually performing a deletion is left to calling code, this helper type standardizes the sequencing, messaging and error handling related to deletions.
func New ¶
New returns a Deleter that will delete resources of kind with the given delete func when Execute is called.
func (*Deleter) Delete ¶
Delete performs the deletion of resources. Errors are printed to stderr of the passed in streams struct and are also aggregated for later access with d.Errors(). The names of successfully deleted resources are returned.
func (*Deleter) DeleteRelated ¶
DeleteRelated performs the deletion of resources related to d's kind. Errors are aggregated and can be accessed with d.Errors().
func (*Deleter) PrintSuccesses ¶
PrintSuccesses writes success messages to the provided stdout stream.
func (*Deleter) WithRelated ¶
func (d *Deleter) WithRelated(kind string, listFunc func(string) ([]string, error), deleteFunc func(string) error)
WithRelated tells this Deleter that it should also delete related resources when Execute is called. Related resources will be of given kind, the names of those resources must be provided by listFunc and each related resource will be passed to deleteFunc for deletion.