rc

package
v0.0.0-...-8eed94c Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(containerPort ContainerPort, containerConfig *container.Config) *Client

NewContainerManager create the container manager with the given container configurations

func (*Client) Create

func (c *Client) Create(ctx context.Context, hostConfig *container.HostConfig) (string, error)

Create creates a container then returns the container id

func (*Client) CreateImageIfNotExists

func (c *Client) CreateImageIfNotExists(ctx context.Context, image string) error

func (*Client) Exec

func (c *Client) Exec(ctx context.Context, containerID, workingDir string, cmd []string) (*ExecRes, error)

Exec executes the given command to the container with the given id returns outBuffer, errBuffer, error

func (*Client) ForceRemove

func (c *Client) ForceRemove(ctx context.Context, id string)

func (*Client) IsImageExists

func (c *Client) IsImageExists(ctx context.Context, image string) bool

IsImageExists get the image list and compare the images with the given image if the image is in the list return true otherwise return false

func (*Client) List

func (c *Client) List(ctx context.Context) ([]string, error)

List the running containers which are created by the image

func (*Client) PullImage

func (c *Client) PullImage(ctx context.Context, image string) error

func (*Client) Stats

func (c *Client) Stats(ctx context.Context, id string) (types.ContainerStats, error)

type ContainerPort

type ContainerPort interface {
	ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error)
	ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig,
		networkingConfig *network.NetworkingConfig, platform *v1.Platform,
		containerName string) (container.ContainerCreateCreatedBody, error)
	ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
	ContainerExecCreate(ctx context.Context, id string, options types.ExecConfig) (types.IDResponse, error)
	ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
	ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
	ContainerRemove(ctx context.Context, id string, opt types.ContainerRemoveOptions) error
	ContainerStop(ctx context.Context, containerID string, duration *time.Duration) error
	ContainerStatsOneShot(ctx context.Context, id string) (types.ContainerStats, error)
}

type ExecRes

type ExecRes struct {
	ExecutionTime time.Duration
	// contains filtered or unexported fields
}

func NewExecRes

func NewExecRes(outBuffer, errBuffer string, executionTime time.Duration) *ExecRes

func (*ExecRes) Buffer

func (e *ExecRes) Buffer() string

Jump to

Keyboard shortcuts

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