Documentation
¶
Index ¶
- Constants
- func FromCreatedVolume(created *volumes_compat.VolumeCreateCreated) *container.Volume
- func FromInspectContainer(c *containers_compat.ContainerInspectOKBody) *container.Container
- func FromInspectVolume(volumeInspect *volumes_compat.VolumeInspectOK) *container.Volume
- func FromVolumeList(volumesList *models.VolumeListOKBody) []*container.Volume
- func GetDefaultContainerEndpoint() string
- func ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error)
- func ToNetworkInfo(network *models.NetworkResource) *container.Network
- func ToNetworkInfoList(networks []*models.NetworkResource) []*container.Network
- func ToVolumeCreate(volume *container.Volume) *models.DockerVolumeCreate
- type APIError
- type CompatClient
- func (c *CompatClient) ContainerCreate(container *container.Container) error
- func (c *CompatClient) ContainerExec(id string, command []string) (string, error)
- func (c *CompatClient) ContainerInspect(id string) (*container.Container, error)
- func (c *CompatClient) ContainerList() ([]*container.Container, error)
- func (c *CompatClient) ContainerLogs(id string) (string, error)
- func (c *CompatClient) ContainerRemove(name string) error
- func (c *CompatClient) ContainerRename(currentName, newName string) error
- func (c *CompatClient) ContainerRestart(name string) error
- func (c *CompatClient) ContainerStart(name string) error
- func (c *CompatClient) ContainerStop(name string) error
- func (c *CompatClient) ContainerUpdate(name string, fn func(newContainer *container.Container)) (*container.Container, error)
- func (c *CompatClient) ContainerUpdateImage(ctx context.Context, name string, newImage string) (*container.Container, error)
- func (c *CompatClient) GetEndpoint() string
- func (c *CompatClient) ImageInspect(id string) (*container.Image, error)
- func (c *CompatClient) ImageList() ([]*container.Image, error)
- func (c *CompatClient) ImagePull(ctx context.Context, id string) error
- func (c *CompatClient) IsSockEndpoint() bool
- func (c *CompatClient) NetworkConnect(id, container string, aliases ...string) error
- func (c *CompatClient) NetworkCreate(network *container.Network) (*container.Network, error)
- func (c *CompatClient) NetworkDisconnect(id, container string) error
- func (c *CompatClient) NetworkInspect(id string) (*container.Network, error)
- func (c *CompatClient) NetworkList() ([]*container.Network, error)
- func (c *CompatClient) NetworkRemove(id string) error
- func (c *CompatClient) ResponseIDReader(httpClient *runtime.ClientOperation)
- func (c *CompatClient) ToSpecGenerator(newContainer *container.Container) *models.CreateContainerConfig
- func (c *CompatClient) Validate() (*container.Version, error)
- func (c *CompatClient) Version() (*container.Version, error)
- func (c *CompatClient) VolumeCreate(volume *container.Volume) (*container.Volume, error)
- func (c *CompatClient) VolumeInspect(id string) (*container.Volume, error)
- func (c *CompatClient) VolumeList() ([]*container.Volume, error)
- func (c *CompatClient) VolumeRemove(id string) error
- type ContainerEngine
- type Error
- type IdGetter
- type NetworkConnectReader
- type RestClientMock
- func (r *RestClientMock) CleanupMockVolumeDir() error
- func (r *RestClientMock) HandleContainerCreate(operation *runtime.ClientOperation, ...) (*containers_compat.ContainerCreateCreated, error)
- func (r *RestClientMock) HandleContainerDelete(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) HandleContainerInspect(operation *runtime.ClientOperation, ...) (*containers_compat.ContainerInspectOK, error)
- func (r *RestClientMock) HandleContainerList(operation *runtime.ClientOperation, ...) (*containers_compat.ContainerListOK, error)
- func (r *RestClientMock) HandleContainerRename(operation *runtime.ClientOperation, ...) (*containers_compat.ContainerRenameNoContent, error)
- func (r *RestClientMock) HandleContainerStart(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) HandleContainerStop(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) HandleImageCreate(operation *runtime.ClientOperation, ...) (interface{}, error)
- func (r *RestClientMock) HandleImageList(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)
- type VolumeListReader
Constants ¶
const ( EnvContainerEndpoint = "CONTAINER_ENDPOINT" DefaultBasePath = "" DefaultNetworkDriver = "bridge" )
Variables ¶
This section is empty.
Functions ¶
func FromCreatedVolume ¶
func FromCreatedVolume(created *volumes_compat.VolumeCreateCreated) *container.Volume
func FromInspectContainer ¶
func FromInspectContainer(c *containers_compat.ContainerInspectOKBody) *container.Container
func FromInspectVolume ¶
func FromInspectVolume(volumeInspect *volumes_compat.VolumeInspectOK) *container.Volume
func FromVolumeList ¶
func FromVolumeList(volumesList *models.VolumeListOKBody) []*container.Volume
func GetDefaultContainerEndpoint ¶
func GetDefaultContainerEndpoint() string
func ReadResponse ¶
func ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error)
func ToNetworkInfo ¶
func ToNetworkInfo(network *models.NetworkResource) *container.Network
func ToNetworkInfoList ¶
func ToNetworkInfoList(networks []*models.NetworkResource) []*container.Network
func ToVolumeCreate ¶
func ToVolumeCreate(volume *container.Volume) *models.DockerVolumeCreate
Types ¶
type APIError ¶
type APIError struct { // API root cause formatted for automated parsing // Example: API root cause Because string `json:"cause,omitempty"` // human error message, formatted for a human to read // Example: human error message Message string `json:"message,omitempty"` // http response code ResponseCode int64 `json:"response,omitempty"` }
func ToAPIError ¶
func ToAPIError(err interface{}) *APIError
type CompatClient ¶
type CompatClient struct { RestClient runtime.ClientTransport // contains filtered or unexported fields }
func NewCompatClient ¶
func NewCompatClient(endpoint, basePath string) (*CompatClient, error)
func NewCompatClientMock ¶
func NewCompatClientMock(containers []*container.Container) *CompatClient
func (*CompatClient) ContainerCreate ¶
func (c *CompatClient) ContainerCreate(container *container.Container) error
func (*CompatClient) ContainerExec ¶
func (c *CompatClient) ContainerExec(id string, command []string) (string, error)
func (*CompatClient) ContainerInspect ¶
func (c *CompatClient) ContainerInspect(id string) (*container.Container, error)
func (*CompatClient) ContainerList ¶
func (c *CompatClient) ContainerList() ([]*container.Container, error)
func (*CompatClient) ContainerLogs ¶
func (c *CompatClient) ContainerLogs(id string) (string, error)
func (*CompatClient) ContainerRemove ¶
func (c *CompatClient) ContainerRemove(name string) error
func (*CompatClient) ContainerRename ¶
func (c *CompatClient) ContainerRename(currentName, newName string) error
func (*CompatClient) ContainerRestart ¶
func (c *CompatClient) ContainerRestart(name string) error
func (*CompatClient) ContainerStart ¶
func (c *CompatClient) ContainerStart(name string) error
func (*CompatClient) ContainerStop ¶
func (c *CompatClient) ContainerStop(name string) error
func (*CompatClient) ContainerUpdate ¶
func (c *CompatClient) 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 (*CompatClient) ContainerUpdateImage ¶
func (c *CompatClient) ContainerUpdateImage(ctx context.Context, name string, newImage string) (*container.Container, error)
ContainerUpdateImage updates the image used by the given container (name).
func (*CompatClient) GetEndpoint ¶
func (c *CompatClient) GetEndpoint() string
func (*CompatClient) ImageInspect ¶
func (c *CompatClient) ImageInspect(id string) (*container.Image, error)
func (*CompatClient) ImagePull ¶
func (c *CompatClient) ImagePull(ctx context.Context, id string) error
func (*CompatClient) IsSockEndpoint ¶
func (c *CompatClient) IsSockEndpoint() bool
func (*CompatClient) NetworkConnect ¶
func (c *CompatClient) NetworkConnect(id, container string, aliases ...string) error
func (*CompatClient) NetworkCreate ¶
func (*CompatClient) NetworkDisconnect ¶
func (c *CompatClient) NetworkDisconnect(id, container string) error
func (*CompatClient) NetworkInspect ¶
func (c *CompatClient) NetworkInspect(id string) (*container.Network, error)
func (*CompatClient) NetworkList ¶
func (c *CompatClient) NetworkList() ([]*container.Network, error)
func (*CompatClient) NetworkRemove ¶
func (c *CompatClient) NetworkRemove(id string) error
func (*CompatClient) ResponseIDReader ¶
func (c *CompatClient) ResponseIDReader(httpClient *runtime.ClientOperation)
func (*CompatClient) ToSpecGenerator ¶
func (c *CompatClient) ToSpecGenerator(newContainer *container.Container) *models.CreateContainerConfig
func (*CompatClient) VolumeCreate ¶
func (*CompatClient) VolumeInspect ¶
func (c *CompatClient) VolumeInspect(id string) (*container.Volume, error)
func (*CompatClient) VolumeList ¶
func (c *CompatClient) VolumeList() ([]*container.Volume, error)
func (*CompatClient) VolumeRemove ¶
func (c *CompatClient) VolumeRemove(id string) error
type ContainerEngine ¶
type ContainerEngine string
var ( ContainerEnginePodman ContainerEngine = "podman" ContainerEngineDocker ContainerEngine = "docker" )
type NetworkConnectReader ¶
type NetworkConnectReader struct {
// contains filtered or unexported fields
}
func (*NetworkConnectReader) ReadResponse ¶
func (o *NetworkConnectReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error)
ReadResponse reads a server response into the received o.
type RestClientMock ¶
type RestClientMock struct { Containers []*container.Container Images []*container.Image 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 compat 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_compat.ContainerCreateCreated, 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_compat.ContainerInspectOK, error)
func (*RestClientMock) HandleContainerList ¶
func (r *RestClientMock) HandleContainerList(operation *runtime.ClientOperation, errorHook func(operation *runtime.ClientOperation) error) (*containers_compat.ContainerListOK, error)
func (*RestClientMock) HandleContainerRename ¶
func (r *RestClientMock) HandleContainerRename(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (*containers_compat.ContainerRenameNoContent, 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) HandleImageCreate ¶
func (r *RestClientMock) HandleImageCreate(operation *runtime.ClientOperation, hook func(operation *runtime.ClientOperation) error) (interface{}, error)
func (*RestClientMock) HandleImageList ¶
func (r *RestClientMock) HandleImageList(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)
type VolumeListReader ¶
type VolumeListReader struct {
// contains filtered or unexported fields
}
func (*VolumeListReader) ReadResponse ¶
func (o *VolumeListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error)
ReadResponse reads a server response into the received o.