containerapi

package
v0.0.0-...-21f38eb Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Docker = iota
	Podman
	DockerSwarm
	Unknown
)

Variables

This section is empty.

Functions

func MustJsonMarshall

func MustJsonMarshall(value interface{}) []byte

Types

type ApiClient

type ApiClient interface {
	GetStream() (<-chan *ContainerEvent, error)
	GetContainerFromID(ID string) (*Container, error)
}

type Container

type Container struct {
	ID    string
	Name  string
	Image string
	Label map[string]string
	Ports []Port
}

type ContainerAPI

type ContainerAPI struct {
	HttpClient *http.Client

	Url       *url.URL
	APIClient ApiClient
	// contains filtered or unexported fields
}

func NewClient

func NewClient() (*ContainerAPI, error)

func (*ContainerAPI) GetEngineType

func (c *ContainerAPI) GetEngineType() (EngineType, error)

type ContainerEvent

type ContainerEvent struct {
	Type      string
	Action    string
	Container *Container
	Service   *Service
}

type DockerClient

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

func NewDockerClient

func NewDockerClient(apiClient *ContainerAPI) *DockerClient

func (*DockerClient) GetContainerFromID

func (d *DockerClient) GetContainerFromID(ID string) (*Container, error)

func (*DockerClient) GetStream

func (d *DockerClient) GetStream() (<-chan *ContainerEvent, error)

type DockerContainer

type DockerContainer struct {
	ID     string            `json:"Id"`
	Names  []string          `json:"Names"`
	Image  string            `json:"Image"`
	Ports  []Port            `json:"Ports"`
	Labels map[string]string `json:"Labels"`
}

type DockerContainerEvent

type DockerContainerEvent struct {
	Event     string
	Container *DockerContainer
}

type DockerEvent

type DockerEvent struct {
	Type   string           `json:"Type"`
	Action string           `json:"Action"`
	Actor  DockerEventActor `json:"Actor"`
	Time   int64            `json:"time"`
}

type DockerEventActor

type DockerEventActor struct {
	ID         string            `json:"ID"`
	Attributes map[string]string `json:"Attributes"`
}

type EngineType

type EngineType int

func (EngineType) String

func (s EngineType) String() string

type InfoResponse

type InfoResponse struct {
	Swarm struct {
		LocalNodeState string `json:"LocalNodeState"`
	} `json:"Swarm"`
}

type PodmanClient

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

func NewPodmanClient

func NewPodmanClient(apiClient *ContainerAPI) *PodmanClient

func (PodmanClient) GetContainerFromID

func (p PodmanClient) GetContainerFromID(ID string) (*Container, error)

func (PodmanClient) GetStream

func (p PodmanClient) GetStream() (<-chan *ContainerEvent, error)

type Port

type Port struct {
	PrivatePort int
	PublicPort  int
	Type        string
}

type Service

type Service struct {
	ID    string
	Name  string
	Label map[string]string
	Ports []Port
}

type VersionResponse

type VersionResponse struct {
	Components []struct {
		Name string `json:"Name"`
	} `json:"Components"`
}

Jump to

Keyboard shortcuts

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