dockerapi

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: Apache-2.0 Imports: 20 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 New

func New(endpoint string, tlsMaterial TLSMaterial) (*Client, error)

func NewWithDialer

func NewWithDialer(endpoint string, dialer func(context.Context, string, string) (net.Conn, error)) (*Client, error)

func NewWithProxy

func NewWithProxy(endpoint string, tlsMaterial TLSMaterial, proxyURL string) (*Client, error)

func (*Client) DeleteContainer added in v0.1.2

func (c *Client) DeleteContainer(ctx context.Context, id string, force bool) error

func (*Client) Endpoint

func (c *Client) Endpoint() string

func (*Client) Inspect

func (c *Client) Inspect(ctx context.Context, id string) (ContainerInspect, error)

func (*Client) ListContainers

func (c *Client) ListContainers(ctx context.Context) ([]ContainerSummary, error)

func (*Client) ListMetrics

func (c *Client) ListMetrics(ctx context.Context, connectionID, connectionName string) ([]model.WorkloadMetric, error)

func (*Client) ListWorkloads

func (c *Client) ListWorkloads(ctx context.Context, connectionID, connectionName string) ([]model.Workload, error)

func (*Client) Negotiate

func (c *Client) Negotiate(ctx context.Context) (Version, error)

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

func (*Client) RestartComposeProject added in v0.1.2

func (c *Client) RestartComposeProject(ctx context.Context, project string, timeoutSeconds int) (int, error)

func (*Client) RestartContainer added in v0.1.2

func (c *Client) RestartContainer(ctx context.Context, id string, timeoutSeconds int) error

func (*Client) Stats

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

func (*Client) StreamContainer

func (c *Client) StreamContainer(ctx context.Context, request model.StreamRequest, out chan<- model.ActivityRecord) error

func (*Client) StreamMetrics

func (c *Client) StreamMetrics(ctx context.Context, request model.MetricRequest, connectionName string, out chan<- model.WorkloadMetric) error

func (*Client) StreamWorkloads

func (c *Client) StreamWorkloads(ctx context.Context, connectionID, connectionName string, out chan<- model.Workload) error

func (*Client) Version

func (c *Client) Version(ctx context.Context) (Version, error)

type ContainerInspect

type ContainerInspect struct {
	ID           string `json:"Id"`
	Name         string `json:"Name"`
	RestartCount int    `json:"RestartCount"`
	Created      string `json:"Created"`
	Config       struct {
		Image        string              `json:"Image"`
		Hostname     string              `json:"Hostname"`
		Tty          bool                `json:"Tty"`
		Labels       map[string]string   `json:"Labels"`
		ExposedPorts map[string]struct{} `json:"ExposedPorts"`
	} `json:"Config"`
	HostConfig struct {
		NetworkMode string `json:"NetworkMode"`
	} `json:"HostConfig"`
	NetworkSettings struct {
		Ports map[string][]struct {
			HostIP   string `json:"HostIp"`
			HostPort string `json:"HostPort"`
		} `json:"Ports"`
		Networks map[string]struct {
			NetworkID         string   `json:"NetworkID"`
			EndpointID        string   `json:"EndpointID"`
			Gateway           string   `json:"Gateway"`
			IPAddress         string   `json:"IPAddress"`
			GlobalIPv6Address string   `json:"GlobalIPv6Address"`
			Aliases           []string `json:"Aliases"`
			DNSNames          []string `json:"DNSNames"`
		} `json:"Networks"`
	} `json:"NetworkSettings"`
	Mounts []struct {
		Type        string `json:"Type"`
		Name        string `json:"Name"`
		Source      string `json:"Source"`
		Destination string `json:"Destination"`
		Driver      string `json:"Driver"`
		Mode        string `json:"Mode"`
		RW          bool   `json:"RW"`
		Propagation string `json:"Propagation"`
	} `json:"Mounts"`
	State struct {
		Status     string `json:"Status"`
		Running    bool   `json:"Running"`
		Paused     bool   `json:"Paused"`
		Restarting bool   `json:"Restarting"`
		OOMKilled  bool   `json:"OOMKilled"`
		Dead       bool   `json:"Dead"`
		Pid        int    `json:"Pid"`
		ExitCode   int    `json:"ExitCode"`
		Error      string `json:"Error"`
		StartedAt  string `json:"StartedAt"`
		FinishedAt string `json:"FinishedAt"`
		Health     *struct {
			Status        string `json:"Status"`
			FailingStreak int    `json:"FailingStreak"`
		} `json:"Health"`
	} `json:"State"`
}

type ContainerStats

type ContainerStats struct {
	Read      time.Time `json:"read"`
	PreRead   time.Time `json:"preread"`
	PidsStats struct {
		Current int64 `json:"current"`
	} `json:"pids_stats"`
	Networks map[string]struct {
		RxBytes int64 `json:"rx_bytes"`
		TxBytes int64 `json:"tx_bytes"`
	} `json:"networks"`
	MemoryStats struct {
		Usage int64            `json:"usage"`
		Limit int64            `json:"limit"`
		Stats map[string]int64 `json:"stats"`
	} `json:"memory_stats"`
	CPUStats struct {
		CPUUsage struct {
			TotalUsage  uint64   `json:"total_usage"`
			PercpuUsage []uint64 `json:"percpu_usage"`
		} `json:"cpu_usage"`
		SystemCPUUsage uint64 `json:"system_cpu_usage"`
		OnlineCPUs     uint32 `json:"online_cpus"`
	} `json:"cpu_stats"`
	PreCPUStats struct {
		CPUUsage struct {
			TotalUsage uint64 `json:"total_usage"`
		} `json:"cpu_usage"`
		SystemCPUUsage uint64 `json:"system_cpu_usage"`
	} `json:"precpu_stats"`
	BlkioStats struct {
		IOServiceBytesRecursive []struct {
			Op    string `json:"op"`
			Value int64  `json:"value"`
		} `json:"io_service_bytes_recursive"`
	} `json:"blkio_stats"`
}

type ContainerSummary

type ContainerSummary struct {
	ID      string            `json:"Id"`
	Names   []string          `json:"Names"`
	Image   string            `json:"Image"`
	ImageID string            `json:"ImageID"`
	Command string            `json:"Command"`
	Created int64             `json:"Created"`
	State   string            `json:"State"`
	Status  string            `json:"Status"`
	Labels  map[string]string `json:"Labels"`
}

type Event

type Event struct {
	Type   string `json:"Type"`
	Action string `json:"Action"`
	Actor  struct {
		ID         string            `json:"ID"`
		Attributes map[string]string `json:"Attributes"`
	} `json:"Actor"`
	Scope    string `json:"scope"`
	Time     int64  `json:"time"`
	TimeNano int64  `json:"timeNano"`
}

type TLSMaterial

type TLSMaterial struct {
	CA         []byte
	Cert       []byte
	Key        []byte
	ServerName string
}

type Version

type Version struct {
	Version       string `json:"Version"`
	APIVersion    string `json:"ApiVersion"`
	MinAPIVersion string `json:"MinAPIVersion"`
	GitCommit     string `json:"GitCommit"`
	OS            string `json:"Os"`
	Arch          string `json:"Arch"`
	KernelVersion string `json:"KernelVersion"`
}

Jump to

Keyboard shortcuts

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