go_portainer

package
v0.0.0-...-054b70b Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host     string
	Port     int
	Schema   string
	User     string
	Password string
	URL      string
}

type Container

type Container struct {
	ID      string   `json:"Id"`
	Names   []string `json:"Names"`
	Image   string   `json:"Image"`
	ImageID string   `json:"ImageID"`
	Command string   `json:"Command"`
	Created int      `json:"Created"`
	State   string   `json:"State"`
	Status  string   `json:"Status"`
	Ports   []struct {
		PrivatePort int    `json:"PrivatePort"`
		PublicPort  int    `json:"PublicPort"`
		Type        string `json:"Type"`
	} `json:"Ports"`
	Labels     map[string]string `json:"Labels,omitempty"`
	SizeRw     int               `json:"SizeRw"`
	SizeRootFs int               `json:"SizeRootFs"`
	HostConfig struct {
		NetworkMode string `json:"NetworkMode"`
	} `json:"HostConfig"`
	NetworkSettings struct {
		Networks struct {
			Bridge struct {
				IPAMConfig          interface{} `json:"IPAMConfig"`
				Links               interface{} `json:"Links"`
				Aliases             interface{} `json:"Aliases"`
				NetworkID           string      `json:"NetworkID"`
				EndpointID          string      `json:"EndpointID"`
				Gateway             string      `json:"Gateway"`
				IPAddress           string      `json:"IPAddress"`
				IPPrefixLen         int         `json:"IPPrefixLen"`
				IPv6Gateway         string      `json:"IPv6Gateway"`
				GlobalIPv6Address   string      `json:"GlobalIPv6Address"`
				GlobalIPv6PrefixLen int         `json:"GlobalIPv6PrefixLen"`
				MacAddress          string      `json:"MacAddress"`
			} `json:"bridge"`
		} `json:"Networks"`
	} `json:"NetworkSettings"`
	Mounts []struct {
		Name        string `json:"Tag"`
		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"`
}

type Endpoint

type Endpoint struct {
	Id        uint     `json:"Id,omitempty"`
	Name      string   `json:"Tag,omitempty"`
	URL       string   `json:"URL,omitempty"`
	PublicURL string   `json:"PublicURL,omitempty"`
	GroupID   int32    `json:"GroupID,omitempty"`
	Tags      []string `json:"Tags"`
}

type Image

type Image struct {
	Containers  int         `json:"Containers"`
	Created     int         `json:"Created"`
	ID          string      `json:"Id"`
	Labels      interface{} `json:"Labels"`
	ParentID    string      `json:"ParentId"`
	RepoDigests []string    `json:"RepoDigests"`
	RepoTags    []string    `json:"RepoTags"`
	SharedSize  int         `json:"SharedSize"`
	Size        int         `json:"Size"`
	VirtualSize int         `json:"VirtualSize"`
}

type Portainer

type Portainer struct {
	Config *Config
	Token  string
	ApiURL string
}

func NewPortainer

func NewPortainer(c *Config) Portainer

func (*Portainer) Auth

func (p *Portainer) Auth() error

func (*Portainer) CreateContainer

func (p *Portainer) CreateContainer(e uint, body map[string]interface{}) (id string, err error)

noinspection GoNilness

func (*Portainer) ListContainers

func (p *Portainer) ListContainers(e uint) ([]Container, error)

func (*Portainer) ListEndpoints

func (p *Portainer) ListEndpoints() ([]Endpoint, error)

func (*Portainer) ListImages

func (p *Portainer) ListImages(e uint) (images []Image, err error)

func (*Portainer) RemoveContainer

func (p *Portainer) RemoveContainer(e uint, id string) (int, error)

noinspection GoNilness

func (*Portainer) StartContainer

func (p *Portainer) StartContainer(e uint, id string) (int, error)

noinspection GoNilness

func (*Portainer) StopContainer

func (p *Portainer) StopContainer(e uint, id string) (int, error)

noinspection GoNilness

Jump to

Keyboard shortcuts

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