podman

package
v0.0.0-...-9fd6cb6 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENV_PODMAN_ENDPOINT  = "PODMAN_ENDPOINT"
	DEFAULT_BASE_PATH    = "/v4.0.0"
	DefaultNetworkDriver = "bridge"
)

Variables

This section is empty.

Functions

func FilesToMounts

func FilesToMounts(c *container.Container) []*models.Mount

func FromCreatedToVolume

func FromCreatedToVolume(created *volumes.VolumeCreateLibpodCreated) *container.Volume

func FromInspectToVolume

func FromInspectToVolume(vi *volumes.VolumeInspectLibpodOK) *container.Volume

func FromListContainer

func FromListContainer(c models.ListContainer) *container.Container

func FromListToVolume

func FromListToVolume(vi *volumes.VolumeListLibpodOK) []*container.Volume

func GetDefaultPodmanEndpoint

func GetDefaultPodmanEndpoint() string

func ReadResponse

func ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error)

func ToNetworkInfo

func ToNetworkInfo(network *models.Network) *container.Network

func ToNetworkInfoList

func ToNetworkInfoList(networks []*models.Network) []*container.Network

func ToPortmappings

func ToPortmappings(c *container.Container) []*models.PortMapping

func ToSpecGenerator

func ToSpecGenerator(c *container.Container) *models.SpecGenerator

func ToVolumeCreateOptions

func ToVolumeCreateOptions(v *container.Volume) *models.VolumeCreateOptions

func VolumesToNamedVolumes

func VolumesToNamedVolumes(c *container.Container) []*models.NamedVolume

Types

type ContainerInformer

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

func NewContainerInformer

func NewContainerInformer(cli *PodmanRestClient) *ContainerInformer

func (*ContainerInformer) AddInformer

func (*ContainerInformer) SetResyncPeriod

func (i *ContainerInformer) SetResyncPeriod(t time.Duration)

func (*ContainerInformer) Start

func (c *ContainerInformer) Start(stopCh <-chan struct{})

type Error

type Error struct {
	Recommendation string
	Err            error
}

func (*Error) Error

func (e *Error) Error() string

type PodmanRestClient

type PodmanRestClient struct {
	RestClient runtime.ClientTransport
	// contains filtered or unexported fields
}

func NewPodmanClient

func NewPodmanClient(endpoint, basePath string) (*PodmanRestClient, error)

func NewPodmanClientMock

func NewPodmanClientMock(containers []*container.Container) *PodmanRestClient

func (*PodmanRestClient) ContainerCreate

func (p *PodmanRestClient) ContainerCreate(container *container.Container) error

func (*PodmanRestClient) ContainerExec

func (p *PodmanRestClient) ContainerExec(id string, command []string) (string, error)

func (*PodmanRestClient) ContainerInspect

func (p *PodmanRestClient) ContainerInspect(id string) (*container.Container, error)

func (*PodmanRestClient) ContainerList

func (p *PodmanRestClient) ContainerList() ([]*container.Container, error)

func (*PodmanRestClient) ContainerLogs

func (p *PodmanRestClient) ContainerLogs(id string) (string, error)

func (*PodmanRestClient) ContainerRemove

func (p *PodmanRestClient) ContainerRemove(name string) error

func (*PodmanRestClient) ContainerRename

func (p *PodmanRestClient) ContainerRename(currentName, newName string) error

func (*PodmanRestClient) ContainerRestart

func (p *PodmanRestClient) ContainerRestart(name string) error

func (*PodmanRestClient) ContainerStart

func (p *PodmanRestClient) ContainerStart(name string) error

func (*PodmanRestClient) ContainerStop

func (p *PodmanRestClient) ContainerStop(name string) error

func (*PodmanRestClient) ContainerUpdate

func (p *PodmanRestClient) ContainerUpdate(name string, fn func(newContainer *container.Container)) (*container.Container, error)

ContainerUpdate replaces the container (by name) with an identical copy with an applied Customization (required). To achieve that, it follows this procedure: - Create a new container - Stop current container - Rename current container - Rename the new container (replacing the original one) - Starts the new container - Removes the original container

In case of failures during this process, the original container is restored.

func (*PodmanRestClient) ContainerUpdateImage

func (p *PodmanRestClient) ContainerUpdateImage(ctx context.Context, name string, newImage string) (*container.Container, error)

ContainerUpdateImage updates the image used by the given container (name).

func (*PodmanRestClient) GetEndpoint

func (p *PodmanRestClient) GetEndpoint() string

func (*PodmanRestClient) ImageInspect

func (p *PodmanRestClient) ImageInspect(id string) (*container.Image, error)

func (*PodmanRestClient) ImageList

func (p *PodmanRestClient) ImageList() ([]*container.Image, error)

func (*PodmanRestClient) ImagePull

func (p *PodmanRestClient) ImagePull(ctx context.Context, id string) error

func (*PodmanRestClient) IsRunningInContainer

func (p *PodmanRestClient) IsRunningInContainer() bool

func (*PodmanRestClient) IsSockEndpoint

func (p *PodmanRestClient) IsSockEndpoint() bool

func (*PodmanRestClient) NetworkConnect

func (p *PodmanRestClient) NetworkConnect(id, container string, aliases ...string) error

func (*PodmanRestClient) NetworkCreate

func (p *PodmanRestClient) NetworkCreate(network *container.Network) (*container.Network, error)

func (*PodmanRestClient) NetworkDisconnect

func (p *PodmanRestClient) NetworkDisconnect(id, container string) error

func (*PodmanRestClient) NetworkInspect

func (p *PodmanRestClient) NetworkInspect(id string) (*container.Network, error)

func (*PodmanRestClient) NetworkList

func (p *PodmanRestClient) NetworkList() ([]*container.Network, error)

func (*PodmanRestClient) NetworkRemove

func (p *PodmanRestClient) NetworkRemove(id string) error

func (*PodmanRestClient) ResponseIDReader

func (p *PodmanRestClient) ResponseIDReader(httpClient *runtime.ClientOperation)

func (*PodmanRestClient) Validate

func (p *PodmanRestClient) Validate() error

func (*PodmanRestClient) Version

func (p *PodmanRestClient) Version() (*container.Version, error)

func (*PodmanRestClient) VolumeCreate

func (p *PodmanRestClient) VolumeCreate(volume *container.Volume) (*container.Volume, error)

func (*PodmanRestClient) VolumeInspect

func (p *PodmanRestClient) VolumeInspect(id string) (*container.Volume, error)

func (*PodmanRestClient) VolumeList

func (p *PodmanRestClient) VolumeList() ([]*container.Volume, error)

func (*PodmanRestClient) VolumeRemove

func (p *PodmanRestClient) VolumeRemove(id string) error

type RestClientFactory

type RestClientFactory func(endpoint, basePath string) (*PodmanRestClient, error)

type RestClientMock

type RestClientMock struct {
	Containers []*container.Container

	Volumes      map[string]*container.Volume
	VolumesFiles map[string]map[string]string

	ErrorHook func(operation *runtime.ClientOperation) error
	// contains filtered or unexported fields
}

RestClientMock maintains (in memory) a set of containers and volumes that are manipulated through libpod client. It also maintains a set of volume files (in disk) to mock podman volumes. The optional ErrorHook can be set by tests to modify the behavior of certain operations before they are actually performed by the mock implementation.

func (*RestClientMock) CleanupMockVolumeDir

func (r *RestClientMock) CleanupMockVolumeDir() error

func (*RestClientMock) HandleContainerCreate

func (r *RestClientMock) HandleContainerCreate(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (*containers.ContainerCreateLibpodCreated, error)

func (*RestClientMock) HandleContainerDelete

func (r *RestClientMock) HandleContainerDelete(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (interface{}, error)

func (*RestClientMock) HandleContainerInspect

func (r *RestClientMock) HandleContainerInspect(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (*containers.ContainerInspectLibpodOK, error)

func (*RestClientMock) HandleContainerList

func (r *RestClientMock) HandleContainerList(operation *runtime.ClientOperation, errorHook func(operation *runtime.ClientOperation) error) (*containers.ContainerListLibpodOK, error)

func (*RestClientMock) HandleContainerRename

func (r *RestClientMock) HandleContainerRename(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (*containers.ContainerRenameLibpodNoContent, error)

func (*RestClientMock) HandleContainerStart

func (r *RestClientMock) HandleContainerStart(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (interface{}, error)

func (*RestClientMock) HandleContainerStop

func (r *RestClientMock) HandleContainerStop(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (interface{}, error)

func (*RestClientMock) HandleNetworkCreate

func (r *RestClientMock) HandleNetworkCreate(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (interface{}, error)

func (*RestClientMock) HandleNetworkDelete

func (r *RestClientMock) HandleNetworkDelete(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (interface{}, error)

func (*RestClientMock) HandleNetworkInspect

func (r *RestClientMock) HandleNetworkInspect(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (interface{}, error)

func (*RestClientMock) HandleSystemInfo

func (r *RestClientMock) HandleSystemInfo(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (interface{}, error)

func (*RestClientMock) HandleVolumeCreate

func (r *RestClientMock) HandleVolumeCreate(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (interface{}, error)

func (*RestClientMock) HandleVolumeDelete

func (r *RestClientMock) HandleVolumeDelete(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (interface{}, error)

func (*RestClientMock) HandleVolumeInspect

func (r *RestClientMock) HandleVolumeInspect(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (interface{}, error)

func (*RestClientMock) HandleVolumeList

func (r *RestClientMock) HandleVolumeList(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (interface{}, error)

func (*RestClientMock) MockVolumeFiles

func (r *RestClientMock) MockVolumeFiles(volumes map[string]*container.Volume, volumesFiles map[string]map[string]string) error

func (*RestClientMock) Submit

func (r *RestClientMock) Submit(operation *runtime.ClientOperation) (interface{}, error)

Jump to

Keyboard shortcuts

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