podutil

package
v5.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImagePullPolicyAlways  = `always`
	ImagePullPolicyMissing = `missing`
	ImagePullPolicyNewer   = `newer`
	ImagePullPolicyNever   = `never`
)

Variables

This section is empty.

Functions

func UserSocketPath

func UserSocketPath() string

Types

type Connection

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

func New

func New(socketPath string) (*Connection, error)

func (*Connection) CreateContainer

func (*Connection) InspectContainer

func (c *Connection) InspectContainer(name string) (*InspectContainerResult, error)

func (*Connection) Ping

func (c *Connection) Ping() error

func (*Connection) PullImage

func (c *Connection) PullImage(in PullImageInput) error

func (*Connection) RemoveContainer

func (c *Connection) RemoveContainer(name string) error

func (*Connection) StartContainer

func (c *Connection) StartContainer(name string) error

func (*Connection) StopContainer

func (c *Connection) StopContainer(name string) error

type CreateContainerInput

type CreateContainerInput struct {
	Name              string            `json:"name,omitempty"`
	Image             string            `json:"image,omitempty"`
	PublishImagePorts bool              `json:"publish_image_ports,omitempty"`
	Remove            bool              `json:"remove,omitempty"`
	TimeoutSeconds    uint              `json:"timeout,omitempty"`
	Env               map[string]string `json:"env,omitempty"`
}

type CreateContainerOption

type CreateContainerOption func(*CreateContainerInput)

func WithEnv

func WithEnv(name, value string) CreateContainerOption

type CreateContainerResult

type CreateContainerResult struct {
	ID       string   `json:"Id"`
	Warnings []string `json:"Warnings"`
}

type Error

type Error struct {
	Cause    string `json:"cause"`
	Message  string `json:"message"`
	Response int    `json:"response"`
}

func (Error) Error

func (err Error) Error() string

type HTTPDialContext

type HTTPDialContext func(ctx context.Context, network, addr string) (net.Conn, error)

type InspectContainerResult

type InspectContainerResult struct {
	ID string `json:"Id"`

	NetworkSettings struct {
		Ports map[string][]struct {
			HostIP   string `json:"hostIp"`
			HostPort string `json:"hostPort"`
		} `json:"Ports"`
	} `json:"NetworkSettings"`
}

func StartDevcontainer

func StartDevcontainer(ctx context.Context, conn *Connection, name string, image string, opts ...CreateContainerOption) (*InspectContainerResult, error)

func (InspectContainerResult) TCPHostPort

func (r InspectContainerResult) TCPHostPort(port int) string

type PullImageInput

type PullImageInput struct {
	Reference string `json:"-" url:"reference"`
	Policy    string `json:"-" url:"policy"`
}

type RequestOption

type RequestOption func(*http.Request) error

func RequestJSONBody

func RequestJSONBody(data any) RequestOption

func RequestMethod

func RequestMethod(m string) RequestOption

func RequestPath

func RequestPath(path string, a ...any) RequestOption

func RequestQueryStruct

func RequestQueryStruct(data any) RequestOption

Jump to

Keyboard shortcuts

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