Documentation ¶
Index ¶
- Constants
- func FilesToMounts(c *container.Container) []*models.Mount
- func FromCreatedToVolume(created *volumes.VolumeCreateLibpodCreated) *container.Volume
- func FromInspectContainer(c containers.ContainerInspectLibpodOKBody) *container.Container
- func FromInspectToVolume(vi *volumes.VolumeInspectLibpodOK) *container.Volume
- func FromListContainer(c models.ListContainer) *container.Container
- func FromListToVolume(vi *volumes.VolumeListLibpodOK) []*container.Volume
- func GetDefaultPodmanEndpoint() string
- func ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error)
- func ToNetworkInfo(network *models.Network) *container.Network
- func ToNetworkInfoList(networks []*models.Network) []*container.Network
- func ToPortmappings(c *container.Container) []*models.PortMapping
- func ToSpecGenerator(c *container.Container) *models.SpecGenerator
- func ToVolumeCreateOptions(v *container.Volume) *models.VolumeCreateOptions
- func VolumesToNamedVolumes(c *container.Container) []*models.NamedVolume
- type ContainerInformer
- type Error
- type PodmanRestClient
- func (p *PodmanRestClient) ContainerCreate(container *container.Container) error
- func (p *PodmanRestClient) ContainerExec(id string, command []string) (string, error)
- func (p *PodmanRestClient) ContainerInspect(id string) (*container.Container, error)
- func (p *PodmanRestClient) ContainerList() ([]*container.Container, error)
- func (p *PodmanRestClient) ContainerLogs(id string) (string, error)
- func (p *PodmanRestClient) ContainerRemove(name string) error
- func (p *PodmanRestClient) ContainerRename(currentName, newName string) error
- func (p *PodmanRestClient) ContainerRestart(name string) error
- func (p *PodmanRestClient) ContainerStart(name string) error
- func (p *PodmanRestClient) ContainerStop(name string) error
- func (p *PodmanRestClient) ContainerUpdate(name string, fn func(newContainer *container.Container)) (*container.Container, error)
- func (p *PodmanRestClient) ContainerUpdateImage(ctx context.Context, name string, newImage string) (*container.Container, error)
- func (p *PodmanRestClient) GetEndpoint() string
- func (p *PodmanRestClient) ImageInspect(id string) (*container.Image, error)
- func (p *PodmanRestClient) ImageList() ([]*container.Image, error)
- func (p *PodmanRestClient) ImagePull(ctx context.Context, id string) error
- func (p *PodmanRestClient) IsRunningInContainer() bool
- func (p *PodmanRestClient) IsSockEndpoint() bool
- func (p *PodmanRestClient) NetworkConnect(id, container string, aliases ...string) error
- func (p *PodmanRestClient) NetworkCreate(network *container.Network) (*container.Network, error)
- func (p *PodmanRestClient) NetworkDisconnect(id, container string) error
- func (p *PodmanRestClient) NetworkInspect(id string) (*container.Network, error)
- func (p *PodmanRestClient) NetworkList() ([]*container.Network, error)
- func (p *PodmanRestClient) NetworkRemove(id string) error
- func (p *PodmanRestClient) ResponseIDReader(httpClient *runtime.ClientOperation)
- func (p *PodmanRestClient) Validate() error
- func (p *PodmanRestClient) Version() (*container.Version, error)
- func (p *PodmanRestClient) VolumeCreate(volume *container.Volume) (*container.Volume, error)
- func (p *PodmanRestClient) VolumeInspect(id string) (*container.Volume, error)
- func (p *PodmanRestClient) VolumeList() ([]*container.Volume, error)
- func (p *PodmanRestClient) VolumeRemove(id string) error
- type RestClientFactory
- type RestClientMock
- func (r *RestClientMock) CleanupMockVolumeDir() error
- func (r *RestClientMock) HandleContainerCreate(operation *runtime.ClientOperation, ...) (*containers.ContainerCreateLibpodCreated, error)
- func (r *RestClientMock) HandleContainerDelete(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) HandleContainerInspect(operation *runtime.ClientOperation, ...) (*containers.ContainerInspectLibpodOK, error)
- func (r *RestClientMock) HandleContainerList(operation *runtime.ClientOperation, ...) (*containers.ContainerListLibpodOK, error)
- func (r *RestClientMock) HandleContainerRename(operation *runtime.ClientOperation, ...) (*containers.ContainerRenameLibpodNoContent, error)
- func (r *RestClientMock) HandleContainerStart(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) HandleContainerStop(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) HandleNetworkCreate(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) HandleNetworkDelete(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) HandleNetworkInspect(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) HandleSystemInfo(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) HandleVolumeCreate(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) HandleVolumeDelete(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) HandleVolumeInspect(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) HandleVolumeList(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) MockVolumeFiles(volumes map[string]*container.Volume, ...) error
- func (r *RestClientMock) Submit(operation *runtime.ClientOperation) (interface{}, error)
Constants ¶
const ( ENV_PODMAN_ENDPOINT = "PODMAN_ENDPOINT" DEFAULT_BASE_PATH = "/v4.0.0" DefaultNetworkDriver = "bridge" )
Variables ¶
This section is empty.
Functions ¶
func FromCreatedToVolume ¶
func FromCreatedToVolume(created *volumes.VolumeCreateLibpodCreated) *container.Volume
func FromInspectContainer ¶
func FromInspectContainer(c containers.ContainerInspectLibpodOKBody) *container.Container
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 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 (c *ContainerInformer) AddInformer(i container.Informer[*container.Container])
func (*ContainerInformer) SetResyncPeriod ¶
func (*ContainerInformer) Start ¶
func (c *ContainerInformer) Start(stopCh <-chan struct{})
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 (*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) VolumeCreate ¶
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 (*RestClientMock) Submit ¶
func (r *RestClientMock) Submit(operation *runtime.ClientOperation) (interface{}, error)