filter

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DockerState

func DockerState(containerState string) string

DockerState will attempt to transform the passed state to a valid docker state valid states are listed in the func IsValidContainerState

func IsValidDockerState

func IsValidDockerState(s string) bool

IsValidDockerState will verify the provided state is a valid docker container state

func ValidateFilters

func ValidateFilters(cmdFilters filters.Args, acceptedFilters map[string]bool, unSupportedFilters map[string]bool) error

* ValidateFilters will evalute the provided filters against the docker acceptedFilters and * the filters vic currently doesn't support (unSupportedFilters)

Types

type ContainerListContext

type ContainerListContext struct {
	FilterContext

	// Counter is the container iteration index for this context
	Counter int
	// ExitCode for the passed container
	ExitCode int

	// ContainerListOptions is the filters set by the user
	*types.ContainerListOptions
	// contains filtered or unexported fields
}

reused from docker/docker/daemon/list.go

func ValidateContainerFilters

func ValidateContainerFilters(options *types.ContainerListOptions, acceptedFilters map[string]bool, unSupportedFilters map[string]bool) (*ContainerListContext, error)

ValidateContainerFilters validates that the container filters are valid docker filters / values and supported by VIC. The function reuses Docker's filter validation.

type FilterAction

type FilterAction int

FilterAction represents possible results during filtering

const (
	IncludeAction FilterAction = iota
	ExcludeAction
	StopAction
)

func IncludeContainer

func IncludeContainer(listContext *ContainerListContext, container *models.ContainerInfo) FilterAction

IncludeContainer will evaluate the filter criteria in listContext against the provided container and determine what action to take. There are three options:

  • IncludeAction
  • ExcludeAction
  • StopAction

func IncludeImage

func IncludeImage(imgFilters filters.Args, listContext *ImageListContext) FilterAction

* IncludeImage will evaluate the filter criteria in filterContext against the provided * image and determine what action to take. There are three options: * * IncludeAction * * ExcludeAction * * StopAction *

func IncludeVolume

func IncludeVolume(volumeFilters filters.Args, volFilterContext *VolumeFilterContext) FilterAction

IncludeVolume evaluates volume filters and the filter context and returns an action to indicate whether to include the volume in the output or not.

type FilterContext

type FilterContext struct {
	// ID of object to filter
	ID string
	// Name of object to filter
	Name string
	// BeforeID is the filter to ignore objects that appear before the one given
	BeforeID *string
	// SinceID is the filter to stop iterating
	SinceID *string
	// Labels of object to filter
	Labels map[string]string
}

FilterContext will hold the common filter requirements

type ImageListContext

type ImageListContext struct {
	FilterContext

	// Tags for an image filtered by reference
	Tags []string
	// Digests for an image filtered by reference
	Digests []string
}

func ValidateImageFilters

func ValidateImageFilters(cmdFilters filters.Args, acceptedFilters map[string]bool, unSupportedFilters map[string]bool) (*ImageListContext, error)

* ValidateImageFilters will validate the image filters are * valid docker filters / values and supported by vic. * * The function will reuse dockers filter validation *

type VolumeFilterContext

type VolumeFilterContext struct {
	FilterContext

	// Dangling is the value of the dangling filter if supplied
	Dangling bool

	// Joined tells whether the volume is joined to a container or not
	Joined bool

	// Driver is the volume's driver
	Driver string
}

VolumeFilterContext stores volume information used while filtering

func ValidateVolumeFilters

func ValidateVolumeFilters(volFilters filters.Args, acceptedFilters, unSupportedFilters map[string]bool) (*VolumeFilterContext, error)

ValidateVolumeFilters checks that the supplied filters are valid and supported and returns a context used in the IncludeVolume func.

Jump to

Keyboard shortcuts

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