volume

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package volume implements a volume lister that lists volumes that are provisioned by one of the MapR CSI provisioners. It implements functionality to filter volumes by the secret they use and to sort the volumes.

Index

Constants

This section is empty.

Variables

View Source
var (
	// SortOptionsList is the list of valid sort options
	SortOptionsList = []string{
		SortByName.String(),
		SortBySecretNamespace.String(),
		SortBySecretName.String(),
		SortByClaimNamespace.String(),
		SortByClaimName.String(),
		SortByVolumePath.String(),
		SortByVolumeHandle.String(),
		SortByExpiration.String(),
		SortByAge.String(),
	}

	// DefaultSortBy is the default sort order
	DefaultSortBy = []SortOption{
		SortByName,
	}
)

Functions

func Print

func Print(cmd *cobra.Command, volumes []types.MaprVolume) error

Print prints the volumes to the default output stream in a human readable table format.

Types

type Lister

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

Lister is a volume lister that lists volumes that are provisioned by one of the MapR CSI provisioners and that use the specified secret.

func NewLister

func NewLister(client kubernetes.Interface, secretName string, namespace string, opts ...ListerOption) *Lister

NewLister returns a new volume lister that lists volumes that are provisioned by one of the MapR CSI provisioners and that use the specified secret.

func (*Lister) List

func (l *Lister) List() ([]types.MaprVolume, error)

List returns a list of volumes using the MapR CSI provisioners and the specified secret.

type ListerOption

type ListerOption func(*Lister)

ListerOption is a function that can be used to configure the volume lister.

func WithSecretLister

func WithSecretLister(secretLister secretLister) ListerOption

WithSecretLister sets the secret lister used by the Lister to collect secrets and tickets referenced by the volumes

func WithSortBy

func WithSortBy(sortBy []SortOption) ListerOption

WithSortBy sets the sort order used by the Lister for output

type SortOption

type SortOption string

SortOption is the type of a sort option, basically a wrapper around a string to provide type safety.

const (
	SortByName            SortOption = "name"
	SortBySecretNamespace SortOption = "secret.namespace"
	SortBySecretName      SortOption = "secret.name"
	SortByClaimNamespace  SortOption = "claim.namespace"
	SortByClaimName       SortOption = "claim.name"
	SortByVolumePath      SortOption = "volume.path"
	SortByVolumeHandle    SortOption = "volume.handle"
	SortByExpiration      SortOption = "expiration"
	SortByAge             SortOption = "age"
)

All valid sort options are defined here

func (SortOption) String

func (s SortOption) String() string

String returns the string representation of the sort option.

Jump to

Keyboard shortcuts

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