From bd9d3a8fa5843dca49a4903d66f603f678ed0fa5 Mon Sep 17 00:00:00 2001 From: baude Date: Thu, 2 Aug 2018 08:58:59 -0500 Subject: Rename varlink socket and interface io.projectatomic.podman -> io.podman Signed-off-by: baude Closes: #1204 Approved by: mheon --- API.md | 20 +- Makefile | 14 +- cmd/podman/varlink.go | 4 +- cmd/podman/varlink/generate.go | 4 +- cmd/podman/varlink/io.podman.varlink | 624 +++++++++++++++++++++ cmd/podman/varlink/io.projectatomic.podman.varlink | 624 --------------------- contrib/python/podman/examples/run_example.sh | 4 +- contrib/python/podman/podman/client.py | 10 +- contrib/python/podman/podman/libs/errors.py | 8 +- contrib/python/podman/test/test_client.py | 4 +- contrib/python/podman/test/test_runner.sh | 2 +- contrib/python/podman/test/test_tunnel.py | 2 +- contrib/python/pypodman/docs/man1/pypodman.1 | 4 +- contrib/python/pypodman/pypodman/lib/config.py | 4 +- contrib/varlink/io.podman.service | 13 + contrib/varlink/io.podman.socket | 10 + contrib/varlink/io.projectatomic.podman.service | 13 - contrib/varlink/io.projectatomic.podman.socket | 10 - docs/generate.go | 2 +- docs/podman-varlink.1.md | 8 +- pkg/varlinkapi/config.go | 8 +- pkg/varlinkapi/containers.go | 52 +- pkg/varlinkapi/containers_create.go | 4 +- pkg/varlinkapi/images.go | 48 +- pkg/varlinkapi/system.go | 20 +- pkg/varlinkapi/util.go | 14 +- 26 files changed, 765 insertions(+), 765 deletions(-) create mode 100644 cmd/podman/varlink/io.podman.varlink delete mode 100644 cmd/podman/varlink/io.projectatomic.podman.varlink create mode 100644 contrib/varlink/io.podman.service create mode 100644 contrib/varlink/io.podman.socket delete mode 100644 contrib/varlink/io.projectatomic.podman.service delete mode 100644 contrib/varlink/io.projectatomic.podman.socket diff --git a/API.md b/API.md index 81ed23e52..6bc3455de 100755 --- a/API.md +++ b/API.md @@ -1,4 +1,4 @@ -# io.projectatomic.podman +# io.podman Podman Service Interface and API description. The master version of this document can be found in the [API.md](https://github.com/projectatomic/libpod/blob/master/API.md) file in the upstream libpod repository. ## Index @@ -174,7 +174,7 @@ input required for CreateContainer is an image name. If the image name is not f error will be returned. Otherwise, the ID of the newly created container will be returned. #### Example ~~~ -$ varlink call unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.CreateContainer '{"create": {"image": "alpine"}}' +$ varlink call unix:/run/podman/io.podman/io.podman.CreateContainer '{"create": {"image": "alpine"}}' { "container": "8759dafbc0a4dc3bcfb57eeb72e4331eb73c5cc09ab968e65ce45b9ad5c4b6bb" } @@ -223,7 +223,7 @@ second is a "control" socket where things like resizing the TTY events are sent. found, a [ContainerNotFound](#ContainerNotFound) error will be returned. #### Example ~~~ -$ varlink call -m unix:/run/io.projectatomic.podman/io.projectatomic.podman.GetAttachSockets '{"name": "b7624e775431219161"}' +$ varlink call -m unix:/run/io.podman/io.podman.GetAttachSockets '{"name": "b7624e775431219161"}' { "sockets": { "container_id": "b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca", @@ -256,7 +256,7 @@ contains attributes like memory and cpu usage. If the container cannot be found [ContainerNotFound](#ContainerNotFound) error will be returned. #### Example ~~~ -$ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.GetContainerStats '{"name": "c33e4164f384"}' +$ varlink call -m unix:/run/podman/io.podman/io.podman.GetContainerStats '{"name": "c33e4164f384"}' { "container": { "block_input": 0, @@ -344,7 +344,7 @@ arguments that represent ps options. If the container cannot be found, a [Conta error will be returned. #### Example ~~~ -$ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.ListContainerProcesses '{"name": "135d71b9495f", "opts": []}' +$ varlink call -m unix:/run/podman/io.podman/io.podman.ListContainerProcesses '{"name": "135d71b9495f", "opts": []}' { "container": [ " UID PID PPID C STIME TTY TIME CMD", @@ -380,7 +380,7 @@ method Ping() [StringResponse](#StringResponse) Ping provides a response for developers to ensure their varlink setup is working. #### Example ~~~ -$ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.Ping +$ varlink call -m unix:/run/podman/io.podman/io.podman.Ping { "ping": { "message": "OK" @@ -395,7 +395,7 @@ PullImage pulls an image from a repository to local storage. After the pull is is returned. #### Example ~~~ -$ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.PullImage '{"name": "registry.fedoraproject.org/fedora"}' +$ varlink call -m unix:/run/podman/io.podman/io.podman.PullImage '{"name": "registry.fedoraproject.org/fedora"}' { "id": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e" } @@ -416,7 +416,7 @@ container can be stopped and removed. Upon successful removal of the container, container cannot be found by name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned. #### Example ~~~ -$ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.RemoveContainer '{"name": "62f4fd98cb57"}' +$ varlink call -m unix:/run/podman/io.podman/io.podman.RemoveContainer '{"name": "62f4fd98cb57"}' { "container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" } @@ -430,7 +430,7 @@ should be deleted. If the image cannot be found, an [ImageNotFound](#ImageNotFo ID of the removed image is returned when complete. See also [DeleteUnusedImages](DeleteUnusedImages). #### Example ~~~ -varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.RemoveImage '{"name": "registry.fedoraproject.org/fedora", "force": true}' +varlink call -m unix:/run/podman/io.podman/io.podman.RemoveImage '{"name": "registry.fedoraproject.org/fedora", "force": true}' { "image": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e" } @@ -477,7 +477,7 @@ returns the container ID once stopped. If the container cannot be found, a [Cont error will be returned instead. See also [KillContainer](KillContainer). #### Error ~~~ -$ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.StopContainer '{"name": "135d71b9495f", "timeout": 5}' +$ varlink call -m unix:/run/podman/io.podman/io.podman.StopContainer '{"name": "135d71b9495f", "timeout": 5}' { "container": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" } diff --git a/Makefile b/Makefile index b5725d1fc..f02a36715 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ SYSTEMDDIR ?= ${PREFIX}/lib/systemd/system BUILDTAGS ?= seccomp $(shell hack/btrfs_tag.sh) $(shell hack/libdm_tag.sh) $(shell hack/btrfs_installed_tag.sh) $(shell hack/ostree_tag.sh) $(shell hack/selinux_tag.sh) $(shell hack/apparmor_tag.sh) varlink BUILDTAGS_CROSS ?= containers_image_openpgp containers_image_ostree_stub exclude_graphdriver_btrfs exclude_graphdriver_devicemapper exclude_graphdriver_overlay ifneq (,$(findstring varlink,$(BUILDTAGS))) - PODMAN_VARLINK_DEPENDENCIES = cmd/podman/varlink/ioprojectatomicpodman.go + PODMAN_VARLINK_DEPENDENCIES = cmd/podman/varlink/iopodman.go endif PYTHON ?= /usr/bin/python3 @@ -131,7 +131,7 @@ clean: test/checkseccomp/checkseccomp \ test/copyimg/copyimg \ test/testdata/redis-image \ - cmd/podman/varlink/ioprojectatomicpodman.go \ + cmd/podman/varlink/iopodman.go \ $(MANPAGES) ||: ifdef HAS_PYTHON3 $(MAKE) -C contrib/python/podman clean @@ -235,8 +235,8 @@ install.docker: docker-docs install ${SELINUXOPT} -m 644 docs/docker*.1 -t $(MANDIR)/man1 install.systemd: - install ${SELINUXOPT} -m 644 -D contrib/varlink/io.projectatomic.podman.socket ${SYSTEMDDIR}/io.projectatomic.podman.socket - install ${SELINUXOPT} -m 644 -D contrib/varlink/io.projectatomic.podman.service ${SYSTEMDDIR}/io.projectatomic.podman.service + install ${SELINUXOPT} -m 644 -D contrib/varlink/io.podman.socket ${SYSTEMDDIR}/io.podman.socket + install ${SELINUXOPT} -m 644 -D contrib/varlink/io.podman.service ${SYSTEMDDIR}/io.podman.service install ${SELINUXOPT} -m 644 -D contrib/varlink/podman.conf ${TMPFILESDIR}/podman.conf install.python: @@ -288,7 +288,7 @@ install.tools: .install.gitvalidation .install.gometalinter .install.md2man make all install; \ fi -varlink_generate: .gopathok cmd/podman/varlink/ioprojectatomicpodman.go +varlink_generate: .gopathok cmd/podman/varlink/iopodman.go varlink_api_generate: .gopathok API.md .PHONY: install.libseccomp.sudo @@ -298,10 +298,10 @@ install.libseccomp.sudo: cd ../../seccomp/libseccomp && git checkout $(LIBSECCOMP_COMMIT) && ./autogen.sh && ./configure --prefix=/usr && make all && make install -cmd/podman/varlink/ioprojectatomicpodman.go: cmd/podman/varlink/io.projectatomic.podman.varlink +cmd/podman/varlink/iopodman.go: cmd/podman/varlink/io.podman.varlink $(GO) generate ./cmd/podman/varlink/... -API.md: cmd/podman/varlink/io.projectatomic.podman.varlink +API.md: cmd/podman/varlink/io.podman.varlink $(GO) generate ./docs/... validate: gofmt .gitvalidation diff --git a/cmd/podman/varlink.go b/cmd/podman/varlink.go index ae36ba1e7..71cf86c74 100644 --- a/cmd/podman/varlink.go +++ b/cmd/podman/varlink.go @@ -7,7 +7,7 @@ import ( "github.com/pkg/errors" "github.com/projectatomic/libpod/cmd/podman/libpodruntime" - ioprojectatomicpodman "github.com/projectatomic/libpod/cmd/podman/varlink" + iopodman "github.com/projectatomic/libpod/cmd/podman/varlink" "github.com/projectatomic/libpod/pkg/varlinkapi" "github.com/projectatomic/libpod/version" "github.com/sirupsen/logrus" @@ -52,7 +52,7 @@ func varlinkCmd(c *cli.Context) error { } defer runtime.Shutdown(false) - var varlinkInterfaces = []*ioprojectatomicpodman.VarlinkInterface{varlinkapi.New(c, runtime)} + var varlinkInterfaces = []*iopodman.VarlinkInterface{varlinkapi.New(c, runtime)} // Register varlink service. The metadata can be retrieved with: // $ varlink info [varlink address URI] service, err := varlink.NewService( diff --git a/cmd/podman/varlink/generate.go b/cmd/podman/varlink/generate.go index b07f8b06b..2fa2d8e23 100644 --- a/cmd/podman/varlink/generate.go +++ b/cmd/podman/varlink/generate.go @@ -1,3 +1,3 @@ -package ioprojectatomicpodman +package iopodman -//go:generate go run ../../../vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/main.go io.projectatomic.podman.varlink +//go:generate go run ../../../vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/main.go io.podman.varlink diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink new file mode 100644 index 000000000..da6739d69 --- /dev/null +++ b/cmd/podman/varlink/io.podman.varlink @@ -0,0 +1,624 @@ +# Podman Service Interface and API description. The master version of this document can be found +# in the [API.md](https://github.com/projectatomic/libpod/blob/master/API.md) file in the upstream libpod repository. +interface io.podman + + +# Version is the structure returned by GetVersion +type Version ( + version: string, + go_version: string, + git_commit: string, + built: int, + os_arch: string +) + +type NotImplemented ( + comment: string +) + +type StringResponse ( + message: string +) +# ContainerChanges describes the return struct for ListContainerChanges +type ContainerChanges ( + changed: []string, + added: []string, + deleted: []string +) + +# ImageInList describes the structure that is returned in +# ListImages. +type ImageInList ( + id: string, + parentId: string, + repoTags: []string, + repoDigests: []string, + created: string, + size: int, + virtualSize: int, + containers: int, + labels: [string]string +) + +# ImageHistory describes the returned structure from ImageHistory. +type ImageHistory ( + id: string, + created: string, + createdBy: string, + tags: []string, + size: int, + comment: string +) + +# ImageSearch is the returned structure for SearchImage. It is returned +# in array form. +type ImageSearch ( + description: string, + is_official: bool, + is_automated: bool, + name: string, + star_count: int +) + +# ListContainer is the returned struct for an individual container +type ListContainerData ( + id: string, + image: string, + imageid: string, + command: []string, + createdat: string, + runningfor: string, + status: string, + ports: []ContainerPortMappings, + rootfssize: int, + rwsize: int, + names: string, + labels: [string]string, + mounts: []ContainerMount, + containerrunning: bool, + namespaces: ContainerNameSpace +) + +# ContainerStats is the return struct for the stats of a container +type ContainerStats ( + 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 +) + +# ContainerMount describes the struct for mounts in a container +type ContainerMount ( + destination: string, + type: string, + source: string, + options: []string +) + +# ContainerPortMappings describes the struct for portmappings in an existing container +type ContainerPortMappings ( + host_port: string, + host_ip: string, + protocol: string, + container_port: string +) + +# ContainerNamespace describes the namespace structure for an existing container +type ContainerNameSpace ( + user: string, + uts: string, + pidns: string, + pid: string, + cgroup: string, + net: string, + mnt: string, + ipc: string +) + +# InfoHost describes the host stats portion of PodmanInfo +type InfoHost ( + mem_free: int, + mem_total: int, + swap_free: int, + swap_total: int, + arch: string, + cpus: int, + hostname: string, + kernel: string, + os: string, + uptime: string +) + +# InfoGraphStatus describes the detailed status of the storage driver +type InfoGraphStatus ( + backing_filesystem: string, + native_overlay_diff: string, + supports_d_type: string +) + +# InfoStore describes the host's storage informatoin +type InfoStore ( + containers: int, + images: int, + graph_driver_name: string, + graph_driver_options: string, + graph_root: string, + graph_status: InfoGraphStatus, + run_root: string +) + +# InfoPodman provides details on the podman binary +type InfoPodmanBinary ( + compiler: string, + go_version: string, + podman_version: string, + git_commit: string +) + +# PodmanInfo describes the Podman host and build +type PodmanInfo ( + host: InfoHost, + registries: []string, + insecure_registries: []string, + store: InfoStore, + podman: InfoPodmanBinary +) + +# Sockets describes sockets location for a container +type Sockets( + container_id: string, + io_socket: string, + control_socket: string +) + +# Create is an input structure for creating containers. It closely resembles the +# CreateConfig structure in libpod/pkg/spec. +type Create ( + args: []string, + cap_add: []string, + cap_drop: []string, + conmon_pidfile: string, + cgroup_parent: string, + command: []string, + detach: bool, + devices: []string, + dns_opt: []string, + dns_search: []string, + dns_servers: []string, + entrypoint: []string, + env: [string]string, + exposed_ports: []string, + gidmap: []string, + group_add: []string, + host_add: []string, + hostname: string, + image: string, + image_id: string, + builtin_imgvolumes: []string, + id_mappings: IDMappingOptions, + image_volume_type: string, + interactive: bool, + ipc_mode: string, + labels: [string]string, + log_driver: string, + log_driver_opt: []string, + name: string, + net_mode: string, + network: string, + pid_mode: string, + pod: string, + privileged: bool, + publish: []string, + publish_all: bool, + quiet: bool, + readonly_rootfs: bool, + resources: CreateResourceConfig, + rm: bool, + shm_dir: string, + stop_signal: int, + stop_timeout: int, + subuidmap: string, + subgidmap: string, + subuidname: string, + subgidname: string, + sys_ctl: [string]string, + tmpfs: []string, + tty: bool, + uidmap: []string, + userns_mode: string, + user: string, + uts_mode: string, + volumes: []string, + work_dir: string, + mount_label: string, + process_label: string, + no_new_privs: bool, + apparmor_profile: string, + seccomp_profile_path: string, + security_opts: []string +) + +# CreateResourceConfig is an input structure used to describe host attributes during +# container creation. It is only valid inside a [Create](#Create) type. +type CreateResourceConfig ( + blkio_weight: int, + blkio_weight_device: []string, + cpu_period: int, + cpu_quota: int, + cpu_rt_period: int, + cpu_rt_runtime: int, + cpu_shares: int, + cpus: float, + cpuset_cpus: string, + cpuset_mems: string, + device_read_bps: []string, + device_read_iops: []string, + device_write_bps: []string, + device_write_iops: []string, + disable_oomkiller: bool, + kernel_memory: int, + memory: int, + memory_reservation: int, + memory_swap: int, + memory_swappiness: int, + oom_score_adj: int, + pids_limit: int, + shm_size: int, + ulimit: []string +) + +# IDMappingOptions is an input structure used to described ids during container creation. +type IDMappingOptions ( + host_uid_mapping: bool, + host_gid_mapping: bool, + uid_map: IDMap, + gid_map: IDMap +) + +# IDMap is used to describe user name spaces during container creation +type IDMap ( + container_id: int, + host_id: int, + size: int +) + +# BuildInfo is used to describe user input for building images +type BuildInfo ( + # paths to one or more dockerfiles + dockerfile: []string, + tags: []string, + add_hosts: []string, + cgroup_parent: string, + cpu_period: int, + cpu_quota: int, + cpu_shares: int, + cpuset_cpus: string, + cpuset_mems: string, + memory: string, + memory_swap: string, + security_opts: []string, + shm_size: string, + ulimit: []string, + volume: []string, + squash: bool, + pull: bool, + pull_always: bool, + force_rm: bool, + rm: bool, + label: []string, + annotations: []string, + build_args: [string]string, + image_format: string +) + +# BuildResponse is used to describe the responses for building images +type BuildResponse ( + logs: []string, + id: string +) + +# Ping provides a response for developers to ensure their varlink setup is working. +# #### Example +# ~~~ +# $ varlink call -m unix:/run/podman/io.podman/io.podman.Ping +# { +# "ping": { +# "message": "OK" +# } +# } +# ~~~ +method Ping() -> (ping: StringResponse) + +# GetVersion returns a Version structure describing the libpod setup on their +# system. +method GetVersion() -> (version: Version) + +# GetInfo returns a [PodmanInfo](#PodmanInfo) struct that describes podman and its host such as storage stats, +# build information of Podman, and system-wide registries. +method GetInfo() -> (info: PodmanInfo) + +# ListContainers returns a list of containers in no particular order. There are +# returned as an array of ListContainerData structs. See also [GetContainer](#GetContainer). +method ListContainers() -> (containers: []ListContainerData) + +# GetContainer takes a name or ID of a container and returns single ListContainerData +# structure. A [ContainerNotFound](#ContainerNotFound) error will be returned if the container cannot be found. +# See also [ListContainers](ListContainers) and [InspectContainer](#InspectContainer). +method GetContainer(name: string) -> (container: ListContainerData) + +# CreateContainer creates a new container from an image. It uses a [Create](#Create) type for input. The minimum +# input required for CreateContainer is an image name. If the image name is not found, an [ImageNotFound](#ImageNotFound) +# error will be returned. Otherwise, the ID of the newly created container will be returned. +# #### Example +# ~~~ +# $ varlink call unix:/run/podman/io.podman/io.podman.CreateContainer '{"create": {"image": "alpine"}}' +# { +# "container": "8759dafbc0a4dc3bcfb57eeb72e4331eb73c5cc09ab968e65ce45b9ad5c4b6bb" +# } +# ~~~ +method CreateContainer(create: Create) -> (container: 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](#ContainerNotFound) +# error will be returned if the container cannot be found. See also [InspectImage](#InspectImage). +method InspectContainer(name: string) -> (container: 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 +# arguments that represent ps options. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) +# error will be returned. +# #### Example +# ~~~ +# $ varlink call -m unix:/run/podman/io.podman/io.podman.ListContainerProcesses '{"name": "135d71b9495f", "opts": []}' +# { +# "container": [ +# " UID PID PPID C STIME TTY TIME CMD", +# " 0 21220 21210 0 09:05 pts/0 00:00:00 /bin/sh", +# " 0 21232 21220 0 09:05 pts/0 00:00:00 top", +# " 0 21284 21220 0 09:05 pts/0 00:00:00 vi /etc/hosts" +# ] +# } +# ~~~ +method ListContainerProcesses(name: string, opts: []string) -> (container: []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](#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. +method GetContainerLogs(name: string) -> (container: []string) + +# ListContainerChanges takes a name or ID of a container and returns changes between the container and +# its base image. It returns a struct of changed, deleted, and added path names. If the +# container cannot be found, a [ContainerNotFound](#ContainerNotFound) error will be returned. +method ListContainerChanges(name: string) -> (container: ContainerChanges) + +# 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](#ContainerNotFound) +# error will be returned. +# The return value is the written tarfile. +method ExportContainer(name: string, path: string) -> (tarfile: string) + +# 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](#ContainerNotFound) error will be returned. +# #### Example +# ~~~ +# $ varlink call -m unix:/run/podman/io.podman/io.podman.GetContainerStats '{"name": "c33e4164f384"}' +# { +# "container": { +# "block_input": 0, +# "block_output": 0, +# "cpu": 2.571123918839990154678e-08, +# "cpu_nano": 49037378, +# "id": "c33e4164f384aa9d979072a63319d66b74fd7a128be71fa68ede24f33ec6cfee", +# "mem_limit": 33080606720, +# "mem_perc": 2.166828456524753747370e-03, +# "mem_usage": 716800, +# "name": "competent_wozniak", +# "net_input": 768, +# "net_output": 5910, +# "pids": 1, +# "system_nano": 10000000 +# } +# } +# ~~~ +method GetContainerStats(name: string) -> (container: ContainerStats) + +# This method has not be implemented yet. +method ResizeContainerTty() -> (notimplemented: NotImplemented) + +# StartContainer starts a created or stopped container. It takes the name or ID of container. It returns +# the container ID once started. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) +# error will be returned. See also [CreateContainer](#CreateContainer). +method StartContainer(name: string) -> (container: 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 forcible stop to the container is applied. It +# returns the container ID once stopped. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) +# error will be returned instead. See also [KillContainer](KillContainer). +# #### Error +# ~~~ +# $ varlink call -m unix:/run/podman/io.podman/io.podman.StopContainer '{"name": "135d71b9495f", "timeout": 5}' +# { +# "container": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" +# } +# ~~~ +method StopContainer(name: string, timeout: int) -> (container: string) + +# RestartContainer will restart a running container given a container name or ID and timeout value. The timeout +# value is the time before a forcible stop is used to stop the container. If the container cannot be found by +# name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise, the ID of the +# container will be returned. +method RestartContainer(name: string, timeout: int) -> (container: 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](#ContainerNotFound) error is returned. See also [StopContainer](StopContainer). +method KillContainer(name: string, signal: int) -> (container: string) + +# This method has not be implemented yet. +method UpdateContainer() -> (notimplemented: NotImplemented) + +# This method has not be implemented yet. +method RenameContainer() -> (notimplemented: NotImplemented) + +# PauseContainer takes the name or ID of container and pauses it. If the container cannot be found, +# a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise the ID of the container is returned. +# See also [UnpauseContainer](#UnpauseContainer). +method PauseContainer(name: string) -> (container: string) + +# UnpauseContainer takes the name or ID of container and unpauses a paused container. If the container cannot be +# found, a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise the ID of the container is returned. +# See also [PauseContainer](#PauseContainer). +method UnpauseContainer(name: string) -> (container: string) + +# This method has not be implemented yet. +method AttachToContainer() -> (notimplemented: NotImplemented) + +# GetAttachSockets takes the name or ID of an existing container. It returns file paths for two sockets needed +# to properly communicate with a container. The first is the actual I/O socket that the container uses. The +# second is a "control" socket where things like resizing the TTY events are sent. If the container cannot be +# found, a [ContainerNotFound](#ContainerNotFound) error will be returned. +# #### Example +# ~~~ +# $ varlink call -m unix:/run/io.podman/io.podman.GetAttachSockets '{"name": "b7624e775431219161"}' +# { +# "sockets": { +# "container_id": "b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca", +# "control_socket": "/var/lib/containers/storage/overlay-containers/b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca/userdata/ctl", +# "io_socket": "/var/run/libpod/socket/b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca/attach" +# } +# } +# ~~~ +method GetAttachSockets(name: string) -> (sockets: Sockets) + +# WaitContainer takes the name or 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](#ContainerNotFound) error is returned. +method WaitContainer(name: string) -> (exitcode: int) + +# RemoveContainer takes requires the name or ID of container as well a boolean representing whether a running +# container can be stopped and removed. Upon successful removal of the container, its ID is returned. If the +# container cannot be found by name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned. +# #### Example +# ~~~ +# $ varlink call -m unix:/run/podman/io.podman/io.podman.RemoveContainer '{"name": "62f4fd98cb57"}' +# { +# "container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" +# } +# ~~~ +method RemoveContainer(name: string, force: bool) -> (container: string) + +# DeleteStoppedContainers will delete all containers that are not running. It will return a list the deleted +# container IDs. See also [RemoveContainer](RemoveContainer). +method DeleteStoppedContainers() -> (containers: []string) + +# ListImages returns an array of ImageInList structures which provide basic information about +# an image currently in storage. See also [InspectImage](InspectImage). +method ListImages() -> (images: []ImageInList) + +# GetImage returns a single image in an [ImageInList](#ImageInList) struct. You must supply an image name as a string. +# If the image cannot be found, an [ImageNotFound](#ImageNotFound) error will be returned. +method GetImage(name: string) -> (image: ImageInList) + +# BuildImage takes a [BuildInfo](#BuildInfo) structure and builds an image. At a minimum, you must provide the +# 'dockerfile' and 'tags' options in the BuildInfo structure. It will return a [BuildResponse](#BuildResponse) structure +# that contains the build logs and resulting image ID. +method BuildImage(build: BuildInfo) -> (image: BuildResponse) + +# This function is not implemented yet. +method CreateImage() -> (notimplemented: NotImplemented) + +# InspectImage takes the name or ID of an image and returns a string respresentation of data associated with the +#image. You must serialize the string into JSON to use it further. An [ImageNotFound](#ImageNotFound) error will +# be returned if the image cannot be found. +method InspectImage(name: string) -> (image: string) + +# 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](#ImageNotFound) error is returned. +method HistoryImage(name: string) -> (history: []ImageHistory) + +# 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](#ImageNotFound) error if +# the image cannot be found in local storage; otherwise the ID of the image will be returned on success. +method PushImage(name: string, tag: string, tlsverify: bool) -> (image: 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](#ImageNotFound) error will be returned; otherwise, the ID of the image is returned on success. +method TagImage(name: string, tagged: string) -> (image: string) + +# RemoveImage takes the name or ID of an image as well as a boolean that determines if containers using that image +# should be deleted. If the image cannot be found, an [ImageNotFound](#ImageNotFound) error will be returned. The +# ID of the removed image is returned when complete. See also [DeleteUnusedImages](DeleteUnusedImages). +# #### Example +# ~~~ +# varlink call -m unix:/run/podman/io.podman/io.podman.RemoveImage '{"name": "registry.fedoraproject.org/fedora", "force": true}' +# { +# "image": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e" +# } +# ~~~ +method RemoveImage(name: string, force: bool) -> (image: string) + +# 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. +method SearchImage(name: string, limit: int) -> (images: []ImageSearch) + +# DeleteUnusedImages deletes any images not associated with a container. The IDs of the deleted images are returned +# in a string array. +method DeleteUnusedImages() -> (images: []string) + +# Commit, creates an image from an existing container. It requires the name or +# ID of the container as well as the resulting image name. Optionally, you can define an author and message +# to be added to the resulting image. You can also define changes to the resulting image for the following +# attributes: _CMD, ENTRYPOINT, ENV, EXPOSE, LABEL, ONBUILD, STOPSIGNAL, USER, VOLUME, and WORKDIR_. To pause the +# container while it is being committed, pass a _true_ bool for the pause argument. If the container cannot +# be found by the ID or name provided, a (ContainerNotFound)[#ContainerNotFound] error will be returned; otherwise, +# the resulting image's ID will be returned as a string. +method Commit(name: string, image_name: string, changes: []string, author: string, message: string, pause: bool) -> (image: 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. See also [ExportImage](ExportImage). +method ImportImage(source: string, reference: string, message: string, changes: []string) -> (image: 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. It also takes in a string array of tags to be able to save multiple +# tags of the same image to a tarball (each tag should be of the form :). Upon completion, the ID +# of the image is returned. If the image cannot be found in local storage, an [ImageNotFound](#ImageNotFound) +# error will be returned. See also [ImportImage](ImportImage). +method ExportImage(name: string, destination: string, compress: bool, tags: []string) -> (image: string) + +# PullImage pulls an image from a repository to local storage. After the pull is successful, the ID of the image +# is returned. +# #### Example +# ~~~ +# $ varlink call -m unix:/run/podman/io.podman/io.podman.PullImage '{"name": "registry.fedoraproject.org/fedora"}' +# { +# "id": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e" +# } +# ~~~ +method PullImage(name: string) -> (id: string) + + +# ImageNotFound means the image could not be found by the provided name or ID in local storage. +error ImageNotFound (name: string) + +# ContainerNotFound means the container could not be found by the provided name or ID in local storage. +error ContainerNotFound (name: string) + +# ErrorOccurred is a generic error for an error that occurs during the execution. The actual error message +# is includes as part of the error's text. +error ErrorOccurred (reason: string) + +# RuntimeErrors generally means a runtime could not be found or gotten. +error RuntimeError (reason: string) diff --git a/cmd/podman/varlink/io.projectatomic.podman.varlink b/cmd/podman/varlink/io.projectatomic.podman.varlink deleted file mode 100644 index fdc941e1a..000000000 --- a/cmd/podman/varlink/io.projectatomic.podman.varlink +++ /dev/null @@ -1,624 +0,0 @@ -# Podman Service Interface and API description. The master version of this document can be found -# in the [API.md](https://github.com/projectatomic/libpod/blob/master/API.md) file in the upstream libpod repository. -interface io.projectatomic.podman - - -# Version is the structure returned by GetVersion -type Version ( - version: string, - go_version: string, - git_commit: string, - built: int, - os_arch: string -) - -type NotImplemented ( - comment: string -) - -type StringResponse ( - message: string -) -# ContainerChanges describes the return struct for ListContainerChanges -type ContainerChanges ( - changed: []string, - added: []string, - deleted: []string -) - -# ImageInList describes the structure that is returned in -# ListImages. -type ImageInList ( - id: string, - parentId: string, - repoTags: []string, - repoDigests: []string, - created: string, - size: int, - virtualSize: int, - containers: int, - labels: [string]string -) - -# ImageHistory describes the returned structure from ImageHistory. -type ImageHistory ( - id: string, - created: string, - createdBy: string, - tags: []string, - size: int, - comment: string -) - -# ImageSearch is the returned structure for SearchImage. It is returned -# in array form. -type ImageSearch ( - description: string, - is_official: bool, - is_automated: bool, - name: string, - star_count: int -) - -# ListContainer is the returned struct for an individual container -type ListContainerData ( - id: string, - image: string, - imageid: string, - command: []string, - createdat: string, - runningfor: string, - status: string, - ports: []ContainerPortMappings, - rootfssize: int, - rwsize: int, - names: string, - labels: [string]string, - mounts: []ContainerMount, - containerrunning: bool, - namespaces: ContainerNameSpace -) - -# ContainerStats is the return struct for the stats of a container -type ContainerStats ( - 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 -) - -# ContainerMount describes the struct for mounts in a container -type ContainerMount ( - destination: string, - type: string, - source: string, - options: []string -) - -# ContainerPortMappings describes the struct for portmappings in an existing container -type ContainerPortMappings ( - host_port: string, - host_ip: string, - protocol: string, - container_port: string -) - -# ContainerNamespace describes the namespace structure for an existing container -type ContainerNameSpace ( - user: string, - uts: string, - pidns: string, - pid: string, - cgroup: string, - net: string, - mnt: string, - ipc: string -) - -# InfoHost describes the host stats portion of PodmanInfo -type InfoHost ( - mem_free: int, - mem_total: int, - swap_free: int, - swap_total: int, - arch: string, - cpus: int, - hostname: string, - kernel: string, - os: string, - uptime: string -) - -# InfoGraphStatus describes the detailed status of the storage driver -type InfoGraphStatus ( - backing_filesystem: string, - native_overlay_diff: string, - supports_d_type: string -) - -# InfoStore describes the host's storage informatoin -type InfoStore ( - containers: int, - images: int, - graph_driver_name: string, - graph_driver_options: string, - graph_root: string, - graph_status: InfoGraphStatus, - run_root: string -) - -# InfoPodman provides details on the podman binary -type InfoPodmanBinary ( - compiler: string, - go_version: string, - podman_version: string, - git_commit: string -) - -# PodmanInfo describes the Podman host and build -type PodmanInfo ( - host: InfoHost, - registries: []string, - insecure_registries: []string, - store: InfoStore, - podman: InfoPodmanBinary -) - -# Sockets describes sockets location for a container -type Sockets( - container_id: string, - io_socket: string, - control_socket: string -) - -# Create is an input structure for creating containers. It closely resembles the -# CreateConfig structure in libpod/pkg/spec. -type Create ( - args: []string, - cap_add: []string, - cap_drop: []string, - conmon_pidfile: string, - cgroup_parent: string, - command: []string, - detach: bool, - devices: []string, - dns_opt: []string, - dns_search: []string, - dns_servers: []string, - entrypoint: []string, - env: [string]string, - exposed_ports: []string, - gidmap: []string, - group_add: []string, - host_add: []string, - hostname: string, - image: string, - image_id: string, - builtin_imgvolumes: []string, - id_mappings: IDMappingOptions, - image_volume_type: string, - interactive: bool, - ipc_mode: string, - labels: [string]string, - log_driver: string, - log_driver_opt: []string, - name: string, - net_mode: string, - network: string, - pid_mode: string, - pod: string, - privileged: bool, - publish: []string, - publish_all: bool, - quiet: bool, - readonly_rootfs: bool, - resources: CreateResourceConfig, - rm: bool, - shm_dir: string, - stop_signal: int, - stop_timeout: int, - subuidmap: string, - subgidmap: string, - subuidname: string, - subgidname: string, - sys_ctl: [string]string, - tmpfs: []string, - tty: bool, - uidmap: []string, - userns_mode: string, - user: string, - uts_mode: string, - volumes: []string, - work_dir: string, - mount_label: string, - process_label: string, - no_new_privs: bool, - apparmor_profile: string, - seccomp_profile_path: string, - security_opts: []string -) - -# CreateResourceConfig is an input structure used to describe host attributes during -# container creation. It is only valid inside a [Create](#Create) type. -type CreateResourceConfig ( - blkio_weight: int, - blkio_weight_device: []string, - cpu_period: int, - cpu_quota: int, - cpu_rt_period: int, - cpu_rt_runtime: int, - cpu_shares: int, - cpus: float, - cpuset_cpus: string, - cpuset_mems: string, - device_read_bps: []string, - device_read_iops: []string, - device_write_bps: []string, - device_write_iops: []string, - disable_oomkiller: bool, - kernel_memory: int, - memory: int, - memory_reservation: int, - memory_swap: int, - memory_swappiness: int, - oom_score_adj: int, - pids_limit: int, - shm_size: int, - ulimit: []string -) - -# IDMappingOptions is an input structure used to described ids during container creation. -type IDMappingOptions ( - host_uid_mapping: bool, - host_gid_mapping: bool, - uid_map: IDMap, - gid_map: IDMap -) - -# IDMap is used to describe user name spaces during container creation -type IDMap ( - container_id: int, - host_id: int, - size: int -) - -# BuildInfo is used to describe user input for building images -type BuildInfo ( - # paths to one or more dockerfiles - dockerfile: []string, - tags: []string, - add_hosts: []string, - cgroup_parent: string, - cpu_period: int, - cpu_quota: int, - cpu_shares: int, - cpuset_cpus: string, - cpuset_mems: string, - memory: string, - memory_swap: string, - security_opts: []string, - shm_size: string, - ulimit: []string, - volume: []string, - squash: bool, - pull: bool, - pull_always: bool, - force_rm: bool, - rm: bool, - label: []string, - annotations: []string, - build_args: [string]string, - image_format: string -) - -# BuildResponse is used to describe the responses for building images -type BuildResponse ( - logs: []string, - id: string -) - -# Ping provides a response for developers to ensure their varlink setup is working. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.Ping -# { -# "ping": { -# "message": "OK" -# } -# } -# ~~~ -method Ping() -> (ping: StringResponse) - -# GetVersion returns a Version structure describing the libpod setup on their -# system. -method GetVersion() -> (version: Version) - -# GetInfo returns a [PodmanInfo](#PodmanInfo) struct that describes podman and its host such as storage stats, -# build information of Podman, and system-wide registries. -method GetInfo() -> (info: PodmanInfo) - -# ListContainers returns a list of containers in no particular order. There are -# returned as an array of ListContainerData structs. See also [GetContainer](#GetContainer). -method ListContainers() -> (containers: []ListContainerData) - -# GetContainer takes a name or ID of a container and returns single ListContainerData -# structure. A [ContainerNotFound](#ContainerNotFound) error will be returned if the container cannot be found. -# See also [ListContainers](ListContainers) and [InspectContainer](#InspectContainer). -method GetContainer(name: string) -> (container: ListContainerData) - -# CreateContainer creates a new container from an image. It uses a [Create](#Create) type for input. The minimum -# input required for CreateContainer is an image name. If the image name is not found, an [ImageNotFound](#ImageNotFound) -# error will be returned. Otherwise, the ID of the newly created container will be returned. -# #### Example -# ~~~ -# $ varlink call unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.CreateContainer '{"create": {"image": "alpine"}}' -# { -# "container": "8759dafbc0a4dc3bcfb57eeb72e4331eb73c5cc09ab968e65ce45b9ad5c4b6bb" -# } -# ~~~ -method CreateContainer(create: Create) -> (container: 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](#ContainerNotFound) -# error will be returned if the container cannot be found. See also [InspectImage](#InspectImage). -method InspectContainer(name: string) -> (container: 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 -# arguments that represent ps options. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -# error will be returned. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.ListContainerProcesses '{"name": "135d71b9495f", "opts": []}' -# { -# "container": [ -# " UID PID PPID C STIME TTY TIME CMD", -# " 0 21220 21210 0 09:05 pts/0 00:00:00 /bin/sh", -# " 0 21232 21220 0 09:05 pts/0 00:00:00 top", -# " 0 21284 21220 0 09:05 pts/0 00:00:00 vi /etc/hosts" -# ] -# } -# ~~~ -method ListContainerProcesses(name: string, opts: []string) -> (container: []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](#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. -method GetContainerLogs(name: string) -> (container: []string) - -# ListContainerChanges takes a name or ID of a container and returns changes between the container and -# its base image. It returns a struct of changed, deleted, and added path names. If the -# container cannot be found, a [ContainerNotFound](#ContainerNotFound) error will be returned. -method ListContainerChanges(name: string) -> (container: ContainerChanges) - -# 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](#ContainerNotFound) -# error will be returned. -# The return value is the written tarfile. -method ExportContainer(name: string, path: string) -> (tarfile: string) - -# 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](#ContainerNotFound) error will be returned. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.GetContainerStats '{"name": "c33e4164f384"}' -# { -# "container": { -# "block_input": 0, -# "block_output": 0, -# "cpu": 2.571123918839990154678e-08, -# "cpu_nano": 49037378, -# "id": "c33e4164f384aa9d979072a63319d66b74fd7a128be71fa68ede24f33ec6cfee", -# "mem_limit": 33080606720, -# "mem_perc": 2.166828456524753747370e-03, -# "mem_usage": 716800, -# "name": "competent_wozniak", -# "net_input": 768, -# "net_output": 5910, -# "pids": 1, -# "system_nano": 10000000 -# } -# } -# ~~~ -method GetContainerStats(name: string) -> (container: ContainerStats) - -# This method has not be implemented yet. -method ResizeContainerTty() -> (notimplemented: NotImplemented) - -# StartContainer starts a created or stopped container. It takes the name or ID of container. It returns -# the container ID once started. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -# error will be returned. See also [CreateContainer](#CreateContainer). -method StartContainer(name: string) -> (container: 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 forcible stop to the container is applied. It -# returns the container ID once stopped. If the container cannot be found, a [ContainerNotFound](#ContainerNotFound) -# error will be returned instead. See also [KillContainer](KillContainer). -# #### Error -# ~~~ -# $ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.StopContainer '{"name": "135d71b9495f", "timeout": 5}' -# { -# "container": "135d71b9495f7c3967f536edad57750bfdb569336cd107d8aabab45565ffcfb6" -# } -# ~~~ -method StopContainer(name: string, timeout: int) -> (container: string) - -# RestartContainer will restart a running container given a container name or ID and timeout value. The timeout -# value is the time before a forcible stop is used to stop the container. If the container cannot be found by -# name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise, the ID of the -# container will be returned. -method RestartContainer(name: string, timeout: int) -> (container: 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](#ContainerNotFound) error is returned. See also [StopContainer](StopContainer). -method KillContainer(name: string, signal: int) -> (container: string) - -# This method has not be implemented yet. -method UpdateContainer() -> (notimplemented: NotImplemented) - -# This method has not be implemented yet. -method RenameContainer() -> (notimplemented: NotImplemented) - -# PauseContainer takes the name or ID of container and pauses it. If the container cannot be found, -# a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise the ID of the container is returned. -# See also [UnpauseContainer](#UnpauseContainer). -method PauseContainer(name: string) -> (container: string) - -# UnpauseContainer takes the name or ID of container and unpauses a paused container. If the container cannot be -# found, a [ContainerNotFound](#ContainerNotFound) error will be returned; otherwise the ID of the container is returned. -# See also [PauseContainer](#PauseContainer). -method UnpauseContainer(name: string) -> (container: string) - -# This method has not be implemented yet. -method AttachToContainer() -> (notimplemented: NotImplemented) - -# GetAttachSockets takes the name or ID of an existing container. It returns file paths for two sockets needed -# to properly communicate with a container. The first is the actual I/O socket that the container uses. The -# second is a "control" socket where things like resizing the TTY events are sent. If the container cannot be -# found, a [ContainerNotFound](#ContainerNotFound) error will be returned. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/io.projectatomic.podman/io.projectatomic.podman.GetAttachSockets '{"name": "b7624e775431219161"}' -# { -# "sockets": { -# "container_id": "b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca", -# "control_socket": "/var/lib/containers/storage/overlay-containers/b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca/userdata/ctl", -# "io_socket": "/var/run/libpod/socket/b7624e7754312191613245ce1a46844abee60025818fe3c3f3203435623a1eca/attach" -# } -# } -# ~~~ -method GetAttachSockets(name: string) -> (sockets: Sockets) - -# WaitContainer takes the name or 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](#ContainerNotFound) error is returned. -method WaitContainer(name: string) -> (exitcode: int) - -# RemoveContainer takes requires the name or ID of container as well a boolean representing whether a running -# container can be stopped and removed. Upon successful removal of the container, its ID is returned. If the -# container cannot be found by name or ID, a [ContainerNotFound](#ContainerNotFound) error will be returned. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.RemoveContainer '{"name": "62f4fd98cb57"}' -# { -# "container": "62f4fd98cb57f529831e8f90610e54bba74bd6f02920ffb485e15376ed365c20" -# } -# ~~~ -method RemoveContainer(name: string, force: bool) -> (container: string) - -# DeleteStoppedContainers will delete all containers that are not running. It will return a list the deleted -# container IDs. See also [RemoveContainer](RemoveContainer). -method DeleteStoppedContainers() -> (containers: []string) - -# ListImages returns an array of ImageInList structures which provide basic information about -# an image currently in storage. See also [InspectImage](InspectImage). -method ListImages() -> (images: []ImageInList) - -# GetImage returns a single image in an [ImageInList](#ImageInList) struct. You must supply an image name as a string. -# If the image cannot be found, an [ImageNotFound](#ImageNotFound) error will be returned. -method GetImage(name: string) -> (image: ImageInList) - -# BuildImage takes a [BuildInfo](#BuildInfo) structure and builds an image. At a minimum, you must provide the -# 'dockerfile' and 'tags' options in the BuildInfo structure. It will return a [BuildResponse](#BuildResponse) structure -# that contains the build logs and resulting image ID. -method BuildImage(build: BuildInfo) -> (image: BuildResponse) - -# This function is not implemented yet. -method CreateImage() -> (notimplemented: NotImplemented) - -# InspectImage takes the name or ID of an image and returns a string respresentation of data associated with the -#image. You must serialize the string into JSON to use it further. An [ImageNotFound](#ImageNotFound) error will -# be returned if the image cannot be found. -method InspectImage(name: string) -> (image: string) - -# 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](#ImageNotFound) error is returned. -method HistoryImage(name: string) -> (history: []ImageHistory) - -# 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](#ImageNotFound) error if -# the image cannot be found in local storage; otherwise the ID of the image will be returned on success. -method PushImage(name: string, tag: string, tlsverify: bool) -> (image: 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](#ImageNotFound) error will be returned; otherwise, the ID of the image is returned on success. -method TagImage(name: string, tagged: string) -> (image: string) - -# RemoveImage takes the name or ID of an image as well as a boolean that determines if containers using that image -# should be deleted. If the image cannot be found, an [ImageNotFound](#ImageNotFound) error will be returned. The -# ID of the removed image is returned when complete. See also [DeleteUnusedImages](DeleteUnusedImages). -# #### Example -# ~~~ -# varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.RemoveImage '{"name": "registry.fedoraproject.org/fedora", "force": true}' -# { -# "image": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e" -# } -# ~~~ -method RemoveImage(name: string, force: bool) -> (image: string) - -# 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. -method SearchImage(name: string, limit: int) -> (images: []ImageSearch) - -# DeleteUnusedImages deletes any images not associated with a container. The IDs of the deleted images are returned -# in a string array. -method DeleteUnusedImages() -> (images: []string) - -# Commit, creates an image from an existing container. It requires the name or -# ID of the container as well as the resulting image name. Optionally, you can define an author and message -# to be added to the resulting image. You can also define changes to the resulting image for the following -# attributes: _CMD, ENTRYPOINT, ENV, EXPOSE, LABEL, ONBUILD, STOPSIGNAL, USER, VOLUME, and WORKDIR_. To pause the -# container while it is being committed, pass a _true_ bool for the pause argument. If the container cannot -# be found by the ID or name provided, a (ContainerNotFound)[#ContainerNotFound] error will be returned; otherwise, -# the resulting image's ID will be returned as a string. -method Commit(name: string, image_name: string, changes: []string, author: string, message: string, pause: bool) -> (image: 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. See also [ExportImage](ExportImage). -method ImportImage(source: string, reference: string, message: string, changes: []string) -> (image: 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. It also takes in a string array of tags to be able to save multiple -# tags of the same image to a tarball (each tag should be of the form :). Upon completion, the ID -# of the image is returned. If the image cannot be found in local storage, an [ImageNotFound](#ImageNotFound) -# error will be returned. See also [ImportImage](ImportImage). -method ExportImage(name: string, destination: string, compress: bool, tags: []string) -> (image: string) - -# PullImage pulls an image from a repository to local storage. After the pull is successful, the ID of the image -# is returned. -# #### Example -# ~~~ -# $ varlink call -m unix:/run/podman/io.projectatomic.podman/io.projectatomic.podman.PullImage '{"name": "registry.fedoraproject.org/fedora"}' -# { -# "id": "426866d6fa419873f97e5cbd320eeb22778244c1dfffa01c944db3114f55772e" -# } -# ~~~ -method PullImage(name: string) -> (id: string) - - -# ImageNotFound means the image could not be found by the provided name or ID in local storage. -error ImageNotFound (name: string) - -# ContainerNotFound means the container could not be found by the provided name or ID in local storage. -error ContainerNotFound (name: string) - -# ErrorOccurred is a generic error for an error that occurs during the execution. The actual error message -# is includes as part of the error's text. -error ErrorOccurred (reason: string) - -# RuntimeErrors generally means a runtime could not be found or gotten. -error RuntimeError (reason: string) diff --git a/contrib/python/podman/examples/run_example.sh b/contrib/python/podman/examples/run_example.sh index 0f6575073..d81ddf456 100755 --- a/contrib/python/podman/examples/run_example.sh +++ b/contrib/python/podman/examples/run_example.sh @@ -22,8 +22,8 @@ if [[ $(id -u) != 0 ]]; then exit 2 fi -if ! systemctl --quiet is-active io.projectatomic.podman.socket; then - echo 1>&2 'podman is not running. systemctl enable --now io.projectatomic.podman.socket' +if ! systemctl --quiet is-active io.podman.socket; then + echo 1>&2 'podman is not running. systemctl enable --now io.podman.socket' exit 1 fi diff --git a/contrib/python/podman/podman/client.py b/contrib/python/podman/podman/client.py index fedd9310e..327bfdee2 100644 --- a/contrib/python/podman/podman/client.py +++ b/contrib/python/podman/podman/client.py @@ -31,7 +31,7 @@ class BaseClient(): @classmethod def factory(cls, uri=None, - interface='io.projectatomic.podman', + interface='io.podman', *args, **kwargs): """Construct a Client based on input.""" @@ -153,18 +153,18 @@ class Client(): >>> import podman >>> c = podman.Client(uri='unix:/tmp/podman.sock', - remote_uri='ssh://user@host/run/podman/io.projectatomic.podman', + remote_uri='ssh://user@host/run/podman/io.podman', identity_file='~/.ssh/id_rsa') """ def __init__(self, - uri='unix:/run/podman/io.projectatomic.podman', - interface='io.projectatomic.podman', + uri='unix:/run/podman/io.podman', + interface='io.podman', **kwargs): """Construct a podman varlink Client. uri from default systemd unit file. - interface from io.projectatomic.podman.varlink, do not change unless + interface from io.podman.varlink, do not change unless you are a varlink guru. """ self._client = BaseClient.factory(uri, interface, **kwargs) diff --git a/contrib/python/podman/podman/libs/errors.py b/contrib/python/podman/podman/libs/errors.py index d34577a57..9d7559c84 100644 --- a/contrib/python/podman/podman/libs/errors.py +++ b/contrib/python/podman/podman/libs/errors.py @@ -50,10 +50,10 @@ class PodmanError(VarlinkErrorProxy): ERROR_MAP = { - 'io.projectatomic.podman.ContainerNotFound': ContainerNotFound, - 'io.projectatomic.podman.ErrorOccurred': ErrorOccurred, - 'io.projectatomic.podman.ImageNotFound': ImageNotFound, - 'io.projectatomic.podman.RuntimeError': PodmanError, + 'io.podman.ContainerNotFound': ContainerNotFound, + 'io.podman.ErrorOccurred': ErrorOccurred, + 'io.podman.ImageNotFound': ImageNotFound, + 'io.podman.RuntimeError': PodmanError, } diff --git a/contrib/python/podman/test/test_client.py b/contrib/python/podman/test/test_client.py index d36cb1a43..3fc6d39dc 100644 --- a/contrib/python/podman/test/test_client.py +++ b/contrib/python/podman/test/test_client.py @@ -15,7 +15,7 @@ class TestClient(unittest.TestCase): def test_local(self, mock_ping): p = Client( uri='unix:/run/podman', - interface='io.projectatomic.podman', + interface='io.podman', ) self.assertIsInstance(p._client, LocalClient) @@ -27,7 +27,7 @@ class TestClient(unittest.TestCase): def test_remote(self, mock_ping): p = Client( uri='unix:/run/podman', - interface='io.projectatomic.podman', + interface='io.podman', remote_uri='ssh://user@hostname/run/podman/podman', identity_file='~/.ssh/id_rsa') diff --git a/contrib/python/podman/test/test_runner.sh b/contrib/python/podman/test/test_runner.sh index 17dd2a30c..a9142d36d 100755 --- a/contrib/python/podman/test/test_runner.sh +++ b/contrib/python/podman/test/test_runner.sh @@ -106,7 +106,7 @@ RUN chmod 755 /tmp/hello.sh ENTRYPOINT ["/tmp/hello.sh"] EOT -export PODMAN_HOST="unix:${TMPDIR}/podman/io.projectatomic.podman" +export PODMAN_HOST="unix:${TMPDIR}/podman/io.podman" PODMAN_ARGS="--storage-driver=vfs \ --root=${TMPDIR}/crio \ --runroot=${TMPDIR}/crio-run \ diff --git a/contrib/python/podman/test/test_tunnel.py b/contrib/python/podman/test/test_tunnel.py index cdcc8466a..8ee4b1052 100644 --- a/contrib/python/podman/test/test_tunnel.py +++ b/contrib/python/podman/test/test_tunnel.py @@ -56,7 +56,7 @@ class TestTunnel(unittest.TestCase): context = Context( 'unix:/01', - 'io.projectatomic.podman', + 'io.podman', '/tmp/user/socket', '/run/podman/socket', 'user', diff --git a/contrib/python/pypodman/docs/man1/pypodman.1 b/contrib/python/pypodman/docs/man1/pypodman.1 index 7c4816062..09acb205b 100644 --- a/contrib/python/pypodman/docs/man1/pypodman.1 +++ b/contrib/python/pypodman/docs/man1/pypodman.1 @@ -54,7 +54,7 @@ Default is None and will allow \f[C]ssh\f[] to follow it's default configuration \f[B]\[en]remote\-socket\-path\f[] .PP Path on remote host for podman service's \f[C]AF_UNIX\f[] socket. The default is -\f[C]/run/podman/io.projectatomic.podman\f[]. +\f[C]/run/podman/io.podman\f[]. .PP \f[B]\[en]identity\-file\f[] .PP @@ -92,7 +92,7 @@ From command line option, for example: \[en]run\-dir This should provide Operators the ability to setup basic configurations and allow users to customize them. .PP -\f[B]XDG_RUNTIME_DIR\f[] (\f[C]XDG_RUNTIME_DIR/io.projectatomic.podman\f[]) +\f[B]XDG_RUNTIME_DIR\f[] (\f[C]XDG_RUNTIME_DIR/io.podman\f[]) .PP Directory where pypodman stores non\-essential runtime files and other file objects (such as sockets, named pipes, \&...). diff --git a/contrib/python/pypodman/pypodman/lib/config.py b/contrib/python/pypodman/pypodman/lib/config.py index 137ffdb34..0d5004b9d 100644 --- a/contrib/python/pypodman/pypodman/lib/config.py +++ b/contrib/python/pypodman/pypodman/lib/config.py @@ -101,7 +101,7 @@ class PodmanArgumentParser(argparse.ArgumentParser): '--remote-socket-path', metavar='PATH', help=('path of podman socket on remote host' - ' (default: /run/podman/io.projectatomic.podman)')) + ' (default: /run/podman/io.podman)')) self.add_argument( '--identity-file', '-i', @@ -198,7 +198,7 @@ class PodmanArgumentParser(argparse.ArgumentParser): getattr(args, 'remote_socket_path') or os.environ.get('REMOTE_SOCKET_PATH') or config['default'].get('remote_socket_path') - or '/run/podman/io.projectatomic.podman' + or '/run/podman/io.podman' ) # yapf:disable reqattr( diff --git a/contrib/varlink/io.podman.service b/contrib/varlink/io.podman.service new file mode 100644 index 000000000..c524ce815 --- /dev/null +++ b/contrib/varlink/io.podman.service @@ -0,0 +1,13 @@ +[Unit] +Description=Podman Remote API Service +Requires=io.podman.socket +After=io.podman.socket +Documentation=man:podman-varlink(1) + +[Service] +Type=simple +ExecStart=/usr/bin/podman varlink unix:/run/podman/io.podman + +[Install] +WantedBy=multi-user.target +Also=io.podman.socket diff --git a/contrib/varlink/io.podman.socket b/contrib/varlink/io.podman.socket new file mode 100644 index 000000000..0f09fe3ef --- /dev/null +++ b/contrib/varlink/io.podman.socket @@ -0,0 +1,10 @@ +[Unit] +Description=Podman Remote API Socket +Documentation=man:podman-varlink(1) + +[Socket] +ListenStream=/run/podman/io.podman +SocketMode=0600 + +[Install] +WantedBy=sockets.target diff --git a/contrib/varlink/io.projectatomic.podman.service b/contrib/varlink/io.projectatomic.podman.service deleted file mode 100644 index 1c4c1435f..000000000 --- a/contrib/varlink/io.projectatomic.podman.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Podman Remote API Service -Requires=io.projectatomic.podman.socket -After=io.projectatomic.podman.socket -Documentation=man:podman-varlink(1) - -[Service] -Type=simple -ExecStart=/usr/bin/podman varlink unix:/run/podman/io.projectatomic.podman - -[Install] -WantedBy=multi-user.target -Also=io.projectatomic.podman.socket diff --git a/contrib/varlink/io.projectatomic.podman.socket b/contrib/varlink/io.projectatomic.podman.socket deleted file mode 100644 index bd82c4240..000000000 --- a/contrib/varlink/io.projectatomic.podman.socket +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Podman Remote API Socket -Documentation=man:podman-varlink(1) - -[Socket] -ListenStream=/run/podman/io.projectatomic.podman -SocketMode=0600 - -[Install] -WantedBy=sockets.target diff --git a/docs/generate.go b/docs/generate.go index 405d8c83f..9ab370e2c 100644 --- a/docs/generate.go +++ b/docs/generate.go @@ -1,3 +1,3 @@ package docs -//go:generate go run varlink/apidoc.go ../cmd/podman/varlink/io.projectatomic.podman.varlink ../API.md +//go:generate go run varlink/apidoc.go ../cmd/podman/varlink/io.podman.varlink ../API.md diff --git a/docs/podman-varlink.1.md b/docs/podman-varlink.1.md index d53457e22..cd57e8b45 100644 --- a/docs/podman-varlink.1.md +++ b/docs/podman-varlink.1.md @@ -26,24 +26,24 @@ second. A value of `0` means no timeout and the session will not expire. Run the podman varlink service manually and accept the default timeout. ``` -# podman varlink unix:/run/podman/io.projectatomic.podman +$ podman varlink unix:/run/podman/io.podman ``` Run the podman varlink service manually with a 5 second timeout. ``` -# podman varlink --timeout 5000 unix:/run/podman/io.projectatomic.podman +$ podman varlink --timeout 5000 unix:/run/podman/io.podman ``` ## CONFIGURATION -Users of the podman varlink service should enable the _io.projectatomic.podman.socket_ and _io.projectatomic.podman.service_. +Users of the podman varlink service should enable the _io.podman.socket_ and _io.podman.service_. This is the preferred method for running the varlink service. You can do this via systemctl. ``` -# systemctl enable --now io.projectatomic.podman.socket +systemctl enable --now io.podman.socket ``` ## SEE ALSO diff --git a/pkg/varlinkapi/config.go b/pkg/varlinkapi/config.go index 2da3787be..fa1983463 100644 --- a/pkg/varlinkapi/config.go +++ b/pkg/varlinkapi/config.go @@ -1,7 +1,7 @@ package varlinkapi import ( - ioprojectatomicpodman "github.com/projectatomic/libpod/cmd/podman/varlink" + iopodman "github.com/projectatomic/libpod/cmd/podman/varlink" "github.com/projectatomic/libpod/libpod" "github.com/urfave/cli" ) @@ -9,12 +9,12 @@ import ( // LibpodAPI is the basic varlink struct for libpod type LibpodAPI struct { Cli *cli.Context - ioprojectatomicpodman.VarlinkInterface + iopodman.VarlinkInterface Runtime *libpod.Runtime } // New creates a new varlink client -func New(cli *cli.Context, runtime *libpod.Runtime) *ioprojectatomicpodman.VarlinkInterface { +func New(cli *cli.Context, runtime *libpod.Runtime) *iopodman.VarlinkInterface { lp := LibpodAPI{Cli: cli, Runtime: runtime} - return ioprojectatomicpodman.VarlinkNew(&lp) + return iopodman.VarlinkNew(&lp) } diff --git a/pkg/varlinkapi/containers.go b/pkg/varlinkapi/containers.go index 82cd135c3..f42386194 100644 --- a/pkg/varlinkapi/containers.go +++ b/pkg/varlinkapi/containers.go @@ -17,9 +17,9 @@ import ( ) // ListContainers ... -func (i *LibpodAPI) ListContainers(call ioprojectatomicpodman.VarlinkCall) error { +func (i *LibpodAPI) ListContainers(call iopodman.VarlinkCall) error { var ( - listContainers []ioprojectatomicpodman.ListContainerData + listContainers []iopodman.ListContainerData ) containers, err := i.Runtime.GetAllContainers() @@ -42,7 +42,7 @@ func (i *LibpodAPI) ListContainers(call ioprojectatomicpodman.VarlinkCall) error } // GetContainer ... -func (i *LibpodAPI) GetContainer(call ioprojectatomicpodman.VarlinkCall, name string) error { +func (i *LibpodAPI) GetContainer(call iopodman.VarlinkCall, name string) error { ctr, err := i.Runtime.LookupContainer(name) if err != nil { return call.ReplyContainerNotFound(name) @@ -59,7 +59,7 @@ func (i *LibpodAPI) GetContainer(call ioprojectatomicpodman.VarlinkCall, name st } // InspectContainer ... -func (i *LibpodAPI) InspectContainer(call ioprojectatomicpodman.VarlinkCall, name string) error { +func (i *LibpodAPI) InspectContainer(call iopodman.VarlinkCall, name string) error { ctr, err := i.Runtime.LookupContainer(name) if err != nil { return call.ReplyContainerNotFound(name) @@ -80,7 +80,7 @@ func (i *LibpodAPI) InspectContainer(call ioprojectatomicpodman.VarlinkCall, nam } // ListContainerProcesses ... -func (i *LibpodAPI) ListContainerProcesses(call ioprojectatomicpodman.VarlinkCall, name string, opts []string) error { +func (i *LibpodAPI) ListContainerProcesses(call iopodman.VarlinkCall, name string, opts []string) error { ctr, err := i.Runtime.LookupContainer(name) if err != nil { return call.ReplyContainerNotFound(name) @@ -107,7 +107,7 @@ func (i *LibpodAPI) ListContainerProcesses(call ioprojectatomicpodman.VarlinkCal } // GetContainerLogs ... -func (i *LibpodAPI) GetContainerLogs(call ioprojectatomicpodman.VarlinkCall, name string) error { +func (i *LibpodAPI) GetContainerLogs(call iopodman.VarlinkCall, name string) error { var logs []string ctr, err := i.Runtime.LookupContainer(name) if err != nil { @@ -168,12 +168,12 @@ func (i *LibpodAPI) GetContainerLogs(call ioprojectatomicpodman.VarlinkCall, nam } // ListContainerChanges ... -func (i *LibpodAPI) ListContainerChanges(call ioprojectatomicpodman.VarlinkCall, name string) error { +func (i *LibpodAPI) ListContainerChanges(call iopodman.VarlinkCall, name string) error { changes, err := i.Runtime.GetDiff("", name) if err != nil { return call.ReplyErrorOccurred(err.Error()) } - result := ioprojectatomicpodman.ContainerChanges{} + result := iopodman.ContainerChanges{} for _, change := range changes { switch change.Kind { case archive.ChangeModify: @@ -188,7 +188,7 @@ func (i *LibpodAPI) ListContainerChanges(call ioprojectatomicpodman.VarlinkCall, } // ExportContainer ... -func (i *LibpodAPI) ExportContainer(call ioprojectatomicpodman.VarlinkCall, name, path string) error { +func (i *LibpodAPI) ExportContainer(call iopodman.VarlinkCall, name, path string) error { ctr, err := i.Runtime.LookupContainer(name) if err != nil { return call.ReplyContainerNotFound(name) @@ -200,7 +200,7 @@ func (i *LibpodAPI) ExportContainer(call ioprojectatomicpodman.VarlinkCall, name } // GetContainerStats ... -func (i *LibpodAPI) GetContainerStats(call ioprojectatomicpodman.VarlinkCall, name string) error { +func (i *LibpodAPI) GetContainerStats(call iopodman.VarlinkCall, name string) error { ctr, err := i.Runtime.LookupContainer(name) if err != nil { return call.ReplyContainerNotFound(name) @@ -209,7 +209,7 @@ func (i *LibpodAPI) GetContainerStats(call ioprojectatomicpodman.VarlinkCall, na if err != nil { return call.ReplyErrorOccurred(err.Error()) } - cs := ioprojectatomicpodman.ContainerStats{ + cs := iopodman.ContainerStats{ Id: ctr.ID(), Name: ctr.Name(), Cpu: containerStats.CPU, @@ -228,12 +228,12 @@ func (i *LibpodAPI) GetContainerStats(call ioprojectatomicpodman.VarlinkCall, na } // ResizeContainerTty ... -func (i *LibpodAPI) ResizeContainerTty(call ioprojectatomicpodman.VarlinkCall) error { +func (i *LibpodAPI) ResizeContainerTty(call iopodman.VarlinkCall) error { return call.ReplyMethodNotImplemented("ResizeContainerTty") } // StartContainer ... -func (i *LibpodAPI) StartContainer(call ioprojectatomicpodman.VarlinkCall, name string) error { +func (i *LibpodAPI) StartContainer(call iopodman.VarlinkCall, name string) error { ctr, err := i.Runtime.LookupContainer(name) if err != nil { return call.ReplyContainerNotFound(name) @@ -252,7 +252,7 @@ func (i *LibpodAPI) StartContainer(call ioprojectatomicpodman.VarlinkCall, name } // StopContainer ... -func (i *LibpodAPI) StopContainer(call ioprojectatomicpodman.VarlinkCall, name string, timeout int64) error { +func (i *LibpodAPI) StopContainer(call iopodman.VarlinkCall, name string, timeout int64) error { ctr, err := i.Runtime.LookupContainer(name) if err != nil { return call.ReplyContainerNotFound(name) @@ -264,7 +264,7 @@ func (i *LibpodAPI) StopContainer(call ioprojectatomicpodman.VarlinkCall, name s } // RestartContainer ... -func (i *LibpodAPI) RestartContainer(call ioprojectatomicpodman.VarlinkCall, name string, timeout int64) error { +func (i *LibpodAPI) RestartContainer(call iopodman.VarlinkCall, name string, timeout int64) error { ctr, err := i.Runtime.LookupContainer(name) if err != nil { return call.ReplyContainerNotFound(name) @@ -277,7 +277,7 @@ func (i *LibpodAPI) RestartContainer(call ioprojectatomicpodman.VarlinkCall, nam // KillContainer kills a running container. If you want to use the default SIGTERM signal, just send a -1 // for the signal arg. -func (i *LibpodAPI) KillContainer(call ioprojectatomicpodman.VarlinkCall, name string, signal int64) error { +func (i *LibpodAPI) KillContainer(call iopodman.VarlinkCall, name string, signal int64) error { killSignal := uint(syscall.SIGTERM) if signal != -1 { killSignal = uint(signal) @@ -293,17 +293,17 @@ func (i *LibpodAPI) KillContainer(call ioprojectatomicpodman.VarlinkCall, name s } // UpdateContainer ... -func (i *LibpodAPI) UpdateContainer(call ioprojectatomicpodman.VarlinkCall) error { +func (i *LibpodAPI) UpdateContainer(call iopodman.VarlinkCall) error { return call.ReplyMethodNotImplemented("UpdateContainer") } // RenameContainer ... -func (i *LibpodAPI) RenameContainer(call ioprojectatomicpodman.VarlinkCall) error { +func (i *LibpodAPI) RenameContainer(call iopodman.VarlinkCall) error { return call.ReplyMethodNotImplemented("RenameContainer") } // PauseContainer ... -func (i *LibpodAPI) PauseContainer(call ioprojectatomicpodman.VarlinkCall, name string) error { +func (i *LibpodAPI) PauseContainer(call iopodman.VarlinkCall, name string) error { ctr, err := i.Runtime.LookupContainer(name) if err != nil { return call.ReplyContainerNotFound(name) @@ -315,7 +315,7 @@ func (i *LibpodAPI) PauseContainer(call ioprojectatomicpodman.VarlinkCall, name } // UnpauseContainer ... -func (i *LibpodAPI) UnpauseContainer(call ioprojectatomicpodman.VarlinkCall, name string) error { +func (i *LibpodAPI) UnpauseContainer(call iopodman.VarlinkCall, name string) error { ctr, err := i.Runtime.LookupContainer(name) if err != nil { return call.ReplyContainerNotFound(name) @@ -328,12 +328,12 @@ func (i *LibpodAPI) UnpauseContainer(call ioprojectatomicpodman.VarlinkCall, nam // AttachToContainer ... // TODO: DO we also want a different one for websocket? -func (i *LibpodAPI) AttachToContainer(call ioprojectatomicpodman.VarlinkCall) error { +func (i *LibpodAPI) AttachToContainer(call iopodman.VarlinkCall) error { return call.ReplyMethodNotImplemented("AttachToContainer") } // WaitContainer ... -func (i *LibpodAPI) WaitContainer(call ioprojectatomicpodman.VarlinkCall, name string) error { +func (i *LibpodAPI) WaitContainer(call iopodman.VarlinkCall, name string) error { ctr, err := i.Runtime.LookupContainer(name) if err != nil { return call.ReplyContainerNotFound(name) @@ -347,7 +347,7 @@ func (i *LibpodAPI) WaitContainer(call ioprojectatomicpodman.VarlinkCall, name s } // RemoveContainer ... -func (i *LibpodAPI) RemoveContainer(call ioprojectatomicpodman.VarlinkCall, name string, force bool) error { +func (i *LibpodAPI) RemoveContainer(call iopodman.VarlinkCall, name string, force bool) error { ctx := getContext() ctr, err := i.Runtime.LookupContainer(name) if err != nil { @@ -361,7 +361,7 @@ func (i *LibpodAPI) RemoveContainer(call ioprojectatomicpodman.VarlinkCall, name } // DeleteStoppedContainers ... -func (i *LibpodAPI) DeleteStoppedContainers(call ioprojectatomicpodman.VarlinkCall) error { +func (i *LibpodAPI) DeleteStoppedContainers(call iopodman.VarlinkCall) error { ctx := getContext() var deletedContainers []string containers, err := i.Runtime.GetAllContainers() @@ -384,7 +384,7 @@ func (i *LibpodAPI) DeleteStoppedContainers(call ioprojectatomicpodman.VarlinkCa } // GetAttachSockets ... -func (i *LibpodAPI) GetAttachSockets(call ioprojectatomicpodman.VarlinkCall, name string) error { +func (i *LibpodAPI) GetAttachSockets(call iopodman.VarlinkCall, name string) error { ctr, err := i.Runtime.LookupContainer(name) if err != nil { return call.ReplyContainerNotFound(name) @@ -403,7 +403,7 @@ func (i *LibpodAPI) GetAttachSockets(call ioprojectatomicpodman.VarlinkCall, nam } } - s := ioprojectatomicpodman.Sockets{ + s := iopodman.Sockets{ Container_id: ctr.ID(), Io_socket: ctr.AttachSocketPath(), Control_socket: ctr.ControlSocketPath(), diff --git a/pkg/varlinkapi/containers_create.go b/pkg/varlinkapi/containers_create.go index 6a601dae8..5f69a8205 100644 --- a/pkg/varlinkapi/containers_create.go +++ b/pkg/varlinkapi/containers_create.go @@ -20,7 +20,7 @@ import ( ) // CreateContainer ... -func (i *LibpodAPI) CreateContainer(call ioprojectatomicpodman.VarlinkCall, config ioprojectatomicpodman.Create) error { +func (i *LibpodAPI) CreateContainer(call iopodman.VarlinkCall, config iopodman.Create) error { rtc := i.Runtime.GetConfig() ctx := getContext() @@ -64,7 +64,7 @@ func (i *LibpodAPI) CreateContainer(call ioprojectatomicpodman.VarlinkCall, conf // varlinkCreateToCreateConfig takes the varlink input struct and maps it to a pointer // of a CreateConfig, which eventually can be used to create the OCI spec. -func varlinkCreateToCreateConfig(ctx context.Context, create ioprojectatomicpodman.Create, runtime *libpod.Runtime, imageName string, data *inspect.ImageData) (*cc.CreateConfig, error) { +func varlinkCreateToCreateConfig(ctx context.Context, create iopodman.Create, runtime *libpod.Runtime, imageName string, data *inspect.ImageData) (*cc.CreateConfig, error) { var ( inputCommand, command []string memoryLimit, memoryReservation, memorySwap, memoryKernel int64 diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go index f4ba8cbf3..f1167c6e2 100644 --- a/pkg/varlinkapi/images.go +++ b/pkg/varlinkapi/images.go @@ -26,18 +26,18 @@ import ( // ListImages lists all the images in the store // It requires no inputs. -func (i *LibpodAPI) ListImages(call ioprojectatomicpodman.VarlinkCall) error { +func (i *LibpodAPI) ListImages(call iopodman.VarlinkCall) error { images, err := i.Runtime.ImageRuntime().GetImages() if err != nil { return call.ReplyErrorOccurred(fmt.Sprintf("unable to get list of images %q", err)) } - var imageList []ioprojectatomicpodman.ImageInList + var imageList []iopodman.ImageInList for _, image := range images { labels, _ := image.Labels(getContext()) containers, _ := image.Containers() size, _ := image.Size(getContext()) - i := ioprojectatomicpodman.ImageInList{ + i := iopodman.ImageInList{ Id: image.ID(), ParentId: image.Parent, RepoTags: image.Names(), @@ -54,7 +54,7 @@ func (i *LibpodAPI) ListImages(call ioprojectatomicpodman.VarlinkCall) error { } // GetImage returns a single image in the form of a ImageInList -func (i *LibpodAPI) GetImage(call ioprojectatomicpodman.VarlinkCall, name string) error { +func (i *LibpodAPI) GetImage(call iopodman.VarlinkCall, name string) error { newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name) if err != nil { return call.ReplyErrorOccurred(err.Error()) @@ -72,7 +72,7 @@ func (i *LibpodAPI) GetImage(call ioprojectatomicpodman.VarlinkCall, name string return err } - il := ioprojectatomicpodman.ImageInList{ + il := iopodman.ImageInList{ Id: newImage.ID(), ParentId: newImage.Parent, RepoTags: newImage.Names(), @@ -87,7 +87,7 @@ func (i *LibpodAPI) GetImage(call ioprojectatomicpodman.VarlinkCall, name string } // BuildImage ... -func (i *LibpodAPI) BuildImage(call ioprojectatomicpodman.VarlinkCall, config ioprojectatomicpodman.BuildInfo) error { +func (i *LibpodAPI) BuildImage(call iopodman.VarlinkCall, config iopodman.BuildInfo) error { var ( memoryLimit int64 memorySwap int64 @@ -221,7 +221,7 @@ func (i *LibpodAPI) BuildImage(call ioprojectatomicpodman.VarlinkCall, config io time.Sleep(1 * time.Second) break } - br := ioprojectatomicpodman.BuildResponse{ + br := iopodman.BuildResponse{ Logs: log, } call.ReplyBuildImage(br) @@ -239,7 +239,7 @@ func (i *LibpodAPI) BuildImage(call ioprojectatomicpodman.VarlinkCall, config io if err != nil { return call.ReplyErrorOccurred(err.Error()) } - br := ioprojectatomicpodman.BuildResponse{ + br := iopodman.BuildResponse{ Logs: log, Id: newImage.ID(), } @@ -259,13 +259,13 @@ func build(runtime *libpod.Runtime, options imagebuildah.BuildOptions, dockerfil // CreateImage ... // TODO With Pull being added, should we skip Create? -func (i *LibpodAPI) CreateImage(call ioprojectatomicpodman.VarlinkCall) error { +func (i *LibpodAPI) CreateImage(call iopodman.VarlinkCall) error { return call.ReplyMethodNotImplemented("CreateImage") } // InspectImage returns an image's inspect information as a string that can be serialized. // Requires an image ID or name -func (i *LibpodAPI) InspectImage(call ioprojectatomicpodman.VarlinkCall, name string) error { +func (i *LibpodAPI) InspectImage(call iopodman.VarlinkCall, name string) error { newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name) if err != nil { return call.ReplyImageNotFound(name) @@ -280,7 +280,7 @@ func (i *LibpodAPI) InspectImage(call ioprojectatomicpodman.VarlinkCall, name st // HistoryImage returns the history of the image's layers // Requires an image or name -func (i *LibpodAPI) HistoryImage(call ioprojectatomicpodman.VarlinkCall, name string) error { +func (i *LibpodAPI) HistoryImage(call iopodman.VarlinkCall, name string) error { newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name) if err != nil { return call.ReplyImageNotFound(name) @@ -289,9 +289,9 @@ func (i *LibpodAPI) HistoryImage(call ioprojectatomicpodman.VarlinkCall, name st if err != nil { return call.ReplyErrorOccurred(err.Error()) } - var histories []ioprojectatomicpodman.ImageHistory + var histories []iopodman.ImageHistory for _, hist := range history { - imageHistory := ioprojectatomicpodman.ImageHistory{ + imageHistory := iopodman.ImageHistory{ Id: hist.ID, Created: hist.Created.String(), CreatedBy: hist.CreatedBy, @@ -306,7 +306,7 @@ func (i *LibpodAPI) HistoryImage(call ioprojectatomicpodman.VarlinkCall, name st // PushImage pushes an local image to registry // TODO We need to add options for signing, credentials, tls, and multi-tag -func (i *LibpodAPI) PushImage(call ioprojectatomicpodman.VarlinkCall, name, tag string, tlsVerify bool) error { +func (i *LibpodAPI) PushImage(call iopodman.VarlinkCall, name, tag string, tlsVerify bool) error { newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name) if err != nil { return call.ReplyImageNotFound(err.Error()) @@ -329,7 +329,7 @@ func (i *LibpodAPI) PushImage(call ioprojectatomicpodman.VarlinkCall, name, tag } // TagImage accepts an image name and tag as strings and tags an image in the local store. -func (i *LibpodAPI) TagImage(call ioprojectatomicpodman.VarlinkCall, name, tag string) error { +func (i *LibpodAPI) TagImage(call iopodman.VarlinkCall, name, tag string) error { newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name) if err != nil { return call.ReplyImageNotFound(name) @@ -342,7 +342,7 @@ func (i *LibpodAPI) TagImage(call ioprojectatomicpodman.VarlinkCall, name, tag s // RemoveImage accepts a image name or ID as a string and force bool to determine if it should // remove the image even if being used by stopped containers -func (i *LibpodAPI) RemoveImage(call ioprojectatomicpodman.VarlinkCall, name string, force bool) error { +func (i *LibpodAPI) RemoveImage(call iopodman.VarlinkCall, name string, force bool) error { ctx := getContext() newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name) if err != nil { @@ -357,20 +357,20 @@ func (i *LibpodAPI) RemoveImage(call ioprojectatomicpodman.VarlinkCall, name str // SearchImage searches all registries configured in /etc/containers/registries.conf for an image // Requires an image name and a search limit as int -func (i *LibpodAPI) SearchImage(call ioprojectatomicpodman.VarlinkCall, name string, limit int64) error { +func (i *LibpodAPI) SearchImage(call iopodman.VarlinkCall, name string, limit int64) error { sc := image.GetSystemContext("", "", false) registries, err := sysreg.GetRegistries() if err != nil { return call.ReplyErrorOccurred(fmt.Sprintf("unable to get system registries: %q", err)) } - var imageResults []ioprojectatomicpodman.ImageSearch + var imageResults []iopodman.ImageSearch for _, reg := range registries { results, err := docker.SearchRegistry(getContext(), sc, reg, name, int(limit)) if err != nil { return call.ReplyErrorOccurred(err.Error()) } for _, result := range results { - i := ioprojectatomicpodman.ImageSearch{ + i := iopodman.ImageSearch{ Description: result.Description, Is_official: result.IsOfficial, Is_automated: result.IsAutomated, @@ -385,7 +385,7 @@ func (i *LibpodAPI) SearchImage(call ioprojectatomicpodman.VarlinkCall, name str // DeleteUnusedImages deletes any images that do not have containers associated with it. // TODO Filters are not implemented -func (i *LibpodAPI) DeleteUnusedImages(call ioprojectatomicpodman.VarlinkCall) error { +func (i *LibpodAPI) DeleteUnusedImages(call iopodman.VarlinkCall) error { images, err := i.Runtime.ImageRuntime().GetImages() if err != nil { return call.ReplyErrorOccurred(err.Error()) @@ -407,7 +407,7 @@ func (i *LibpodAPI) DeleteUnusedImages(call ioprojectatomicpodman.VarlinkCall) e } // Commit ... -func (i *LibpodAPI) Commit(call ioprojectatomicpodman.VarlinkCall, name, imageName string, changes []string, author, message string, pause bool) error { +func (i *LibpodAPI) Commit(call iopodman.VarlinkCall, name, imageName string, changes []string, author, message string, pause bool) error { ctr, err := i.Runtime.LookupContainer(name) if err != nil { return call.ReplyContainerNotFound(name) @@ -435,7 +435,7 @@ func (i *LibpodAPI) Commit(call ioprojectatomicpodman.VarlinkCall, name, imageNa } // ImportImage imports an image from a tarball to the image store -func (i *LibpodAPI) ImportImage(call ioprojectatomicpodman.VarlinkCall, source, reference, message string, changes []string) error { +func (i *LibpodAPI) ImportImage(call iopodman.VarlinkCall, source, reference, message string, changes []string) error { configChanges, err := util.GetImageConfig(changes) if err != nil { return call.ReplyErrorOccurred(err.Error()) @@ -456,7 +456,7 @@ func (i *LibpodAPI) ImportImage(call ioprojectatomicpodman.VarlinkCall, source, // ExportImage exports an image to the provided destination // destination must have the transport type!! -func (i *LibpodAPI) ExportImage(call ioprojectatomicpodman.VarlinkCall, name, destination string, compress bool, tags []string) error { +func (i *LibpodAPI) ExportImage(call iopodman.VarlinkCall, name, destination string, compress bool, tags []string) error { newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name) if err != nil { return call.ReplyImageNotFound(name) @@ -475,7 +475,7 @@ func (i *LibpodAPI) ExportImage(call ioprojectatomicpodman.VarlinkCall, name, de // PullImage pulls an image from a registry to the image store. // TODO This implementation is incomplete -func (i *LibpodAPI) PullImage(call ioprojectatomicpodman.VarlinkCall, name string) error { +func (i *LibpodAPI) PullImage(call iopodman.VarlinkCall, name string) error { newImage, err := i.Runtime.ImageRuntime().New(getContext(), name, "", "", nil, &image.DockerRegistryOptions{}, image.SigningOptions{}, true, false) if err != nil { return call.ReplyErrorOccurred(fmt.Sprintf("unable to pull %s: %s", name, err.Error())) diff --git a/pkg/varlinkapi/system.go b/pkg/varlinkapi/system.go index 747a25966..042aef942 100644 --- a/pkg/varlinkapi/system.go +++ b/pkg/varlinkapi/system.go @@ -9,13 +9,13 @@ import ( ) // GetVersion ... -func (i *LibpodAPI) GetVersion(call ioprojectatomicpodman.VarlinkCall) error { +func (i *LibpodAPI) GetVersion(call iopodman.VarlinkCall) error { versionInfo, err := libpod.GetVersion() if err != nil { return err } - return call.ReplyGetVersion(ioprojectatomicpodman.Version{ + return call.ReplyGetVersion(iopodman.Version{ Version: versionInfo.Version, Go_version: versionInfo.GoVersion, Git_commit: versionInfo.GitCommit, @@ -26,21 +26,21 @@ func (i *LibpodAPI) GetVersion(call ioprojectatomicpodman.VarlinkCall) error { // Ping returns a simple string "OK" response for clients to make sure // the service is working. -func (i *LibpodAPI) Ping(call ioprojectatomicpodman.VarlinkCall) error { - return call.ReplyPing(ioprojectatomicpodman.StringResponse{ +func (i *LibpodAPI) Ping(call iopodman.VarlinkCall) error { + return call.ReplyPing(iopodman.StringResponse{ Message: "OK", }) } // GetInfo returns details about the podman host and its stores -func (i *LibpodAPI) GetInfo(call ioprojectatomicpodman.VarlinkCall) error { - podmanInfo := ioprojectatomicpodman.PodmanInfo{} +func (i *LibpodAPI) GetInfo(call iopodman.VarlinkCall) error { + podmanInfo := iopodman.PodmanInfo{} info, err := i.Runtime.Info() if err != nil { return call.ReplyErrorOccurred(err.Error()) } host := info[0].Data - infoHost := ioprojectatomicpodman.InfoHost{ + infoHost := iopodman.InfoHost{ Mem_free: host["MemFree"].(int64), Mem_total: host["MemTotal"].(int64), Swap_free: host["SwapFree"].(int64), @@ -53,7 +53,7 @@ func (i *LibpodAPI) GetInfo(call ioprojectatomicpodman.VarlinkCall) error { } podmanInfo.Host = infoHost store := info[1].Data - pmaninfo := ioprojectatomicpodman.InfoPodmanBinary{ + pmaninfo := iopodman.InfoPodmanBinary{ Compiler: goruntime.Compiler, Go_version: goruntime.Version(), // TODO : How are we going to get this here? @@ -61,12 +61,12 @@ func (i *LibpodAPI) GetInfo(call ioprojectatomicpodman.VarlinkCall) error { Git_commit: libpod.GitCommit, } - graphStatus := ioprojectatomicpodman.InfoGraphStatus{ + graphStatus := iopodman.InfoGraphStatus{ Backing_filesystem: store["GraphStatus"].(map[string]string)["Backing Filesystem"], Native_overlay_diff: store["GraphStatus"].(map[string]string)["Native Overlay Diff"], Supports_d_type: store["GraphStatus"].(map[string]string)["Supports d_type"], } - infoStore := ioprojectatomicpodman.InfoStore{ + infoStore := iopodman.InfoStore{ Graph_driver_name: store["GraphDriverName"].(string), Containers: int64(store["ContainerStore"].(map[string]interface{})["number"].(int)), Images: int64(store["ImageStore"].(map[string]interface{})["number"].(int)), diff --git a/pkg/varlinkapi/util.go b/pkg/varlinkapi/util.go index ad5c8c19d..667c09562 100644 --- a/pkg/varlinkapi/util.go +++ b/pkg/varlinkapi/util.go @@ -15,15 +15,15 @@ func getContext() context.Context { return context.TODO() } -func makeListContainer(containerID string, batchInfo batchcontainer.BatchContainerStruct) ioprojectatomicpodman.ListContainerData { +func makeListContainer(containerID string, batchInfo batchcontainer.BatchContainerStruct) iopodman.ListContainerData { var ( - mounts []ioprojectatomicpodman.ContainerMount - ports []ioprojectatomicpodman.ContainerPortMappings + mounts []iopodman.ContainerMount + ports []iopodman.ContainerPortMappings ) ns := batchcontainer.GetNamespaces(batchInfo.Pid) for _, mount := range batchInfo.ConConfig.Spec.Mounts { - m := ioprojectatomicpodman.ContainerMount{ + m := iopodman.ContainerMount{ Destination: mount.Destination, Type: mount.Type, Source: mount.Source, @@ -33,7 +33,7 @@ func makeListContainer(containerID string, batchInfo batchcontainer.BatchContain } for _, pm := range batchInfo.ConConfig.PortMappings { - p := ioprojectatomicpodman.ContainerPortMappings{ + p := iopodman.ContainerPortMappings{ Host_port: strconv.Itoa(int(pm.HostPort)), Host_ip: pm.HostIP, Protocol: pm.Protocol, @@ -45,7 +45,7 @@ func makeListContainer(containerID string, batchInfo batchcontainer.BatchContain // If we find this needs to be done for other container endpoints, we should // convert this to a separate function or a generic map from struct function. - namespace := ioprojectatomicpodman.ContainerNameSpace{ + namespace := iopodman.ContainerNameSpace{ User: ns.User, Uts: ns.UTS, Pidns: ns.PIDNS, @@ -56,7 +56,7 @@ func makeListContainer(containerID string, batchInfo batchcontainer.BatchContain Ipc: ns.IPC, } - lc := ioprojectatomicpodman.ListContainerData{ + lc := iopodman.ListContainerData{ Id: containerID, Image: batchInfo.ConConfig.RootfsImageName, Imageid: batchInfo.ConConfig.RootfsImageID, -- cgit v1.2.3-54-g00ecf