Skip to content

Instantly share code, notes, and snippets.

@baude
Created May 8, 2018 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baude/2e7c67cb9a9c92e64ff9adc0ae8daeef to your computer and use it in GitHub Desktop.
Save baude/2e7c67cb9a9c92e64ff9adc0ae8daeef to your computer and use it in GitHub Desktop.

Index

func GetContainerStats(name: string) ContainerStats

func UpdateContainer() NotImplemented

func SearchImage(name: string, limit: int) ImageSearch

func CreateFromContainer() NotImplemented

func Ping() StringResponse

func GetContainer(name: string) ListContainerData

func ListContainerChanges(name: string) map[string]

func RenameContainer() NotImplemented

func WaitContainer(name: string) int

func TagImage(name: string, tagged: string) string

func ListContainers() ListContainerData

func InspectContainer(name: string) string

func StartContainer() NotImplemented

func StopContainer(name: string, timeout: int) string

func BuildImage() NotImplemented

func PushImage(name: string, tag: string, tlsverify: bool) string

func GetContainerLogs(name: string) []string

func ExportContainer(name: string, path: string) string

func RestartContainer(name: string, timeout: int) string

func PauseContainer(name: string) string

func HistoryImage(name: string) ImageHistory

func PullImage(name: string) string

func GetVersion() Version

func ListContainerProcesses(name: string, opts: []string) []string

func ListImages() ImageInList

func DeleteUnusedImages() []string

func KillContainer(name: string, signal: int) string

func DeleteStoppedContainers() []string

func ResizeContainerTty() NotImplemented

func ImportImage(source: string, reference: string, message: string, changes: []string) string

func CreateImage() NotImplemented

func ExportImage(name: string, destination: string, compress: bool) string

func CreateContainer() NotImplemented

func RemoveContainer(name: string, force: bool) string

func InspectImage(name: string) string

func RemoveImage(name: string, force: bool) string

func UnpauseContainer(name: string) string

func AttachToContainer() NotImplemented type ContainerMount

type ContainerPortMappings

type ContainerNameSpace

type Version

type NotImplemented

type ImageInList

type ImageHistory

type ImageSearch

type StringResponse

type ListContainerData

type ContainerStats

error ImageNotFound

error ContainerNotFound

error ErrorOccurred

error RuntimeError

Functions

func GetContainerStats

func GetContainerStats(name: string) ContainerStats

GetContainerStats takes the name or ID of a container and returns a single ContainerStats structure which contains attributes like memory and cpu usage. If the container cannot be found, a ContainerNotFound error will be returned

func UpdateContainer

func UpdateContainer() NotImplemented

This method has not be implemented yet.

func SearchImage

func SearchImage(name: string, limit: int) ImageSearch

SearchImage takes the string of an image name and a limit of searches from each registries to be returned. SearchImage will then use a glob-like match to find the image you are searching for. The images are returned in an array of ImageSearch structures which contain information about the image as well as its fully-qualified name.

func CreateFromContainer

func CreateFromContainer() NotImplemented

This method is not implemented.

func Ping

func Ping() StringResponse

Ping provides a response for developers to ensure their varlink setup is working.

func GetContainer

func GetContainer(name: string) ListContainerData

GetContainer takes a name or ID of a container and returns single ListContainerData structure. A ContainerNotFound error will be returned if the container cannot be found.

func ListContainerChanges

func ListContainerChanges(name: string) map[string]

ListContainerChanges takes a name or ID of a container and returns changes between the container and its base image. The return values are expressed as string maps where a path -> the change. If the container cannot be found, a ContainerNotFound error will be returned.

func RenameContainer

func RenameContainer() NotImplemented

This method has not be implemented yet.

func WaitContainer

func WaitContainer(name: string) int

WaitContainer takes the name of ID of a container and waits until the container stops. Upon stopping, the return code of the container is returned. If the container container cannot be found by ID or name, a ContainerNotFound error is returned.

func TagImage

func TagImage(name: string, tagged: string) string

TagImage takes the name or ID of an image in local storage as well as the desired tag name. If the image cannot be found, an ImageNotFound error will be returned; otherwise, the ID of the image is returned on success.

func ListContainers

func ListContainers() ListContainerData

ListContainers returns a list of containers in no particular order. There are returned as an array of ListContainerData structs

func InspectContainer

func InspectContainer(name: string) string

InspectContainer data takes a name or ID of a container returns the inspection data in string format. You can then serialize the string into JSON. A ContainerNotFound error will be returned if the container cannot be found.

func StartContainer

func StartContainer() NotImplemented

This method has not be implemented yet.

func StopContainer

func StopContainer(name: string, timeout: int) string

StopContainer stops a container given a timeout. It takes the name or ID of a container as well as a timeout value. The timeout value the time before a forceable stop to the container is applied. It returns the container ID once stopped. If the container cannot be found, a ContainerNotFound error will be returned instead.

func BuildImage

func BuildImage() NotImplemented

This function is not implemented yet.

func PushImage

func PushImage(name: string, tag: string, tlsverify: bool) string

PushImage takes three input arguments: the name or ID of an image, the fully-qualified destination name of the image, and a boolean as to whether tls-verify should be used. It will return an ImageNotFound error if the image cannot be found in local storage; otherwise the ID of the image will be returned on success.

func GetContainerLogs

func GetContainerLogs(name: string) []string

GetContainerLogs takes a name or ID of a container and returns the logs of that container. If the container cannot be found, a ContainerNotFound error will be returned. The container logs are returned as an array of strings. GetContainerLogs will honor the streaming capability of varlink if the client invokes it.

func ExportContainer

func ExportContainer(name: string, path: string) string

ExportContainer creates an image from a container. It takes the name or ID of a container and a path representing the target tarfile. If the container cannot be found, a ContainerNotFound error will be returned. The return value is the written tarfile.

func RestartContainer

func RestartContainer(name: string, timeout: int) string

RestartContainer will restart a running container given a container name or ID and timeout value. The timeout value is the time before a forceable stop is used to stop the container. If the container cannot be found by name or ID, a ContainerNotFound error will be returned; otherwise, the ID of the container will be returned.

func PauseContainer

func PauseContainer(name: string) string

PauseContainer takes the name or ID of container and pauses it. If the container cannot be found, a ContainerNotFound error will be returned; otherwise the ID of the container is returned.

func HistoryImage

func HistoryImage(name: string) ImageHistory

HistoryImage takes the name or ID of an image and returns information about its history and layers. The returned history is in the form of an array of ImageHistory structures. If the image cannot be found, an ImageNotFound error is returned.

func PullImage

func PullImage(name: string) string

PullImage pulls an image from a repository to local storage. After the pull is successful, the ID of the image is returned.

func GetVersion

func GetVersion() Version

GetVersion returns a Version structure describing the libpod setup on their system.

func ListContainerProcesses

func ListContainerProcesses(name: string, opts: []string) []string

ListContainerProcesses takes a name or ID of a container and returns the processes running inside the container as array of strings. It will accept an array of string arguements that represent ps options. If the container cannot be found, a ContainerNotFound error will be returned.

func ListImages

func ListImages() ImageInList

ListImages returns an array of ImageInList structures which provide basic information about an image currenly in storage.

func DeleteUnusedImages

func DeleteUnusedImages() []string

DeleteUnusedImages deletes any images not associated with a container. The IDs of the deleted images are returned in a string array.

func KillContainer

func KillContainer(name: string, signal: int) string

KillContainer takes the name or ID of a container as well as a signal to be applied to the container. Once the container has been killed, the container's ID is returned. If the container cannot be found, a ContainerNotFound error is returned.

func DeleteStoppedContainers

func DeleteStoppedContainers() []string

DeleteStoppedContainers will delete all containers that are not running. It will return a list the deleted container IDs.

func ResizeContainerTty

func ResizeContainerTty() NotImplemented

This method has not be implemented yet.

func ImportImage

func ImportImage(source: string, reference: string, message: string, changes: []string) string

ImportImage imports an image from a source (like tarball) into local storage. The image can have additional descriptions added to it using the message and changes options.

func CreateImage

func CreateImage() NotImplemented

This function is not implemented yet.

func ExportImage

func ExportImage(name: string, destination: string, compress: bool) string

ExportImage takes the name or ID of an image and exports it to a destination like a tarball. There is also a booleon option to force compression. Upon completion, the ID of the image is returned. If the image cannot be found in local storage, an ImageNotFound error will be returned.

func CreateContainer

func CreateContainer() NotImplemented

This method has not been implemented yet.

func RemoveContainer

func RemoveContainer(name: string, force: bool) string

RemoveContainer takes requires the name or ID of container as well a boolean representing whether a running container can be stopped and removed. Upon sucessful removal of the container, its ID is returned. If the container cannot be found by name or ID, an ContainerNotFound error will be returned.

func InspectImage

func InspectImage(name: string) string

InspectImage takes the name or ID of an image and returns a string respresentation of data associated with the mage. You must serialize the string into JSON to use it further. An ImageNotFound error will be returned if the image cannot be found.

func RemoveImage

func RemoveImage(name: string, force: bool) string

RemoveImage takes the name or ID of an image as well as a booleon that determines if containers using that image should be deleted. If the image cannot be found, an [ImageNotFound](#ImageNotFound error will be returned. The D of the removed image is returned when complete.

func UnpauseContainer

func UnpauseContainer(name: string) string

UnpauseContainer takes the name or ID of container and unpauses a paused container. If the container cannot be found, a ContainerNotFound error will be returned; otherwise the ID of the container is returned.

func AttachToContainer

func AttachToContainer() NotImplemented

This method has not be implemented yet.

Types

type ContainerMount

ContainerMount describes the struct for mounts in a container

destination string

type string

source string

options []string

type ContainerPortMappings

ContainerPortMappings describes the struct for portmappings in an existing container

host_port string

host_ip string

protocol string

container_port string

type ContainerNameSpace

ContainerNamespace describes the namespace structure for an existing container

user string

uts string

pidns string

pid string

cgroup string

net string

mnt string

ipc string

type Version

Version is the structure returned by GetVersion

version string

go_version string

git_commit string

built int

os_arch string

type NotImplemented

comment string

type ImageInList

ImageInList describes the structure that is returned in ListImages.

id string

parentId string

repoTags []string

repoDigests []string

created string

size int

virtualSize int

containers int

labels map[string]

type ImageHistory

ImageHistory describes the returned structure from ImageHistory.

id string

created string

createdBy string

tags []string

size int

comment string

type ImageSearch

ImageSearch is the returned structure for SearchImage. It is returned in arrary form.

description string

is_official bool

is_automated bool

name string

star_count int

type StringResponse

message string

type ListContainerData

ListContainer is the returned struct for an individual container

id string

image string

imageid string

command []string

createdat string

runningfor string

status string

ports ContainerPortMappings

rootfssize int

rwsize int

names string

labels map[string]

mounts ContainerMount

containerrunning bool

namespaces ContainerNameSpace

type ContainerStats

ContainerStats is the return struct for the stats of a container

id string

name string

cpu float

cpu_nano int

system_nano int

mem_usage int

mem_limit int

mem_perc float

net_input int

net_output int

block_output int

block_input int

pids int

Errors

type ImageNotFound

type ContainerNotFound

type ErrorOccurred

type RuntimeError

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment