diff options
14 files changed, 1065 insertions, 1451 deletions
diff --git a/cmd/podman/ioprojectatomicpodman/ioprojectatomicpodman.go b/cmd/podman/ioprojectatomicpodman/ioprojectatomicpodman.go index efee14daf..687e5e77d 100644 --- a/cmd/podman/ioprojectatomicpodman/ioprojectatomicpodman.go +++ b/cmd/podman/ioprojectatomicpodman/ioprojectatomicpodman.go @@ -3,638 +3,1315 @@ package ioprojectatomicpodman import "github.com/varlink/go/varlink" -type Version struct{ - Version string `json:"version"` +// Type declarations +type Version struct { + Version string `json:"version"` Go_version string `json:"go_version"` Git_commit string `json:"git_commit"` - Built int64 `json:"built"` - Os_arch string `json:"os_arch"` + Built int64 `json:"built"` + Os_arch string `json:"os_arch"` } -type NotImplemented struct{ +type NotImplemented struct { Comment string `json:"comment"` } -type StringResponse struct{ +type StringResponse struct { Message string `json:"message"` } -type ioprojectatomicpodmanInterface interface { - ListContainerProcesses(c VarlinkCall) error - UpdateContainer(c VarlinkCall) error - HistoryImage(c VarlinkCall) error - ExportImage(c VarlinkCall) error - CreateContainer(c VarlinkCall) error - InspectContainer(c VarlinkCall) error - UnpauseContainer(c VarlinkCall) error - AttachToContainer(c VarlinkCall) error - SearchImage(c VarlinkCall) error - ListContainerChanges(c VarlinkCall) error - RenameContainer(c VarlinkCall) error - RemoveContainer(c VarlinkCall) error - PullImage(c VarlinkCall) error - Ping(c VarlinkCall) error - ListContainers(c VarlinkCall) error - PushImage(c VarlinkCall) error - TagImage(c VarlinkCall) error - RemoveImage(c VarlinkCall) error - KillContainer(c VarlinkCall) error - InspectImage(c VarlinkCall) error - CreateImage(c VarlinkCall) error - DeleteUnusedImages(c VarlinkCall) error - CreateFromContainer(c VarlinkCall) error - ImportImage(c VarlinkCall) error - PauseContainer(c VarlinkCall) error - ListImages(c VarlinkCall) error - DeleteStoppedContainers(c VarlinkCall) error - ExportContainer(c VarlinkCall) error - StartContainer(c VarlinkCall) error - ResizeContainerTty(c VarlinkCall) error - RestartContainer(c VarlinkCall) error - WaitContainer(c VarlinkCall) error - GetVersion(c VarlinkCall) error - GetContainerStats(c VarlinkCall) error - BuildImage(c VarlinkCall) error - GetContainerLogs(c VarlinkCall) error - StopContainer(c VarlinkCall) error +// Client method calls and reply readers +func UpdateContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.UpdateContainer", nil, more__, oneway__) } -type VarlinkCall struct{ varlink.Call } +func ReadUpdateContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} -func (c *VarlinkCall) ReplyActionFailed(reason string) error { - var out struct{ - Reason string `json:"reason"` +func RemoveContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.RemoveContainer", nil, more__, oneway__) +} + +func ReadRemoveContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func HistoryImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.HistoryImage", nil, more__, oneway__) +} + +func ReadHistoryImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func ListContainerChanges(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.ListContainerChanges", nil, more__, oneway__) +} + +func ReadListContainerChanges_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func ResizeContainerTty(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.ResizeContainerTty", nil, more__, oneway__) +} + +func ReadResizeContainerTty_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func RestartContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.RestartContainer", nil, more__, oneway__) +} + +func ReadRestartContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func BuildImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.BuildImage", nil, more__, oneway__) +} + +func ReadBuildImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func ListContainers(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.ListContainers", nil, more__, oneway__) +} + +func ReadListContainers_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func StartContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.StartContainer", nil, more__, oneway__) +} + +func ReadStartContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented } - out.Reason = reason - return c.ReplyError("io.projectatomic.podman.ActionFailed", &out) + return continues_, nil } -func (c *VarlinkCall) ReplyGetVersion(version Version) error { - var out struct{ +func ListImages(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.ListImages", nil, more__, oneway__) +} + +func ReadListImages_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func GetVersion(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.GetVersion", nil, more__, oneway__) +} + +func ReadGetVersion_(c__ *varlink.Connection, version_ *Version) (bool, error) { + var out struct { Version Version `json:"version"` } - out.Version = version - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if version_ != nil { + *version_ = out.Version + } + return continues_, nil } -func (c *VarlinkCall) ReplyGetContainerStats(notimplemented NotImplemented) error { - var out struct{ +func UnpauseContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.UnpauseContainer", nil, more__, oneway__) +} + +func ReadUnpauseContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func DeleteUnusedImages(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.DeleteUnusedImages", nil, more__, oneway__) } -func (c *VarlinkCall) ReplyResizeContainerTty(notimplemented NotImplemented) error { - var out struct{ +func ReadDeleteUnusedImages_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil } -func (c *VarlinkCall) ReplyRestartContainer(notimplemented NotImplemented) error { - var out struct{ +func KillContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.KillContainer", nil, more__, oneway__) +} + +func ReadKillContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func RemoveImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.RemoveImage", nil, more__, oneway__) } -func (c *VarlinkCall) ReplyWaitContainer(notimplemented NotImplemented) error { - var out struct{ +func ReadRemoveImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func CreateContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.CreateContainer", nil, more__, oneway__) } -func (c *VarlinkCall) ReplyGetContainerLogs(notimplemented NotImplemented) error { - var out struct{ +func ReadCreateContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil } -func (c *VarlinkCall) ReplyStopContainer(notimplemented NotImplemented) error { - var out struct{ +func InspectContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.InspectContainer", nil, more__, oneway__) +} + +func ReadInspectContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func ExportContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.ExportContainer", nil, more__, oneway__) } -func (c *VarlinkCall) ReplyBuildImage(notimplemented NotImplemented) error { - var out struct{ +func ReadExportContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil } -func (c *VarlinkCall) ReplyCreateContainer(notimplemented NotImplemented) error { - var out struct{ +func TagImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.TagImage", nil, more__, oneway__) +} + +func ReadTagImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func ImportImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.ImportImage", nil, more__, oneway__) } -func (c *VarlinkCall) ReplyInspectContainer(notimplemented NotImplemented) error { - var out struct{ +func ReadImportImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func Ping(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.Ping", nil, more__, oneway__) +} + +func ReadPing_(c__ *varlink.Connection, ping_ *StringResponse) (bool, error) { + var out struct { + Ping StringResponse `json:"ping"` + } + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if ping_ != nil { + *ping_ = out.Ping + } + return continues_, nil +} + +func GetContainerLogs(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.GetContainerLogs", nil, more__, oneway__) } -func (c *VarlinkCall) ReplyListContainerProcesses(notimplemented NotImplemented) error { - var out struct{ +func ReadGetContainerLogs_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func AttachToContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.AttachToContainer", nil, more__, oneway__) } -func (c *VarlinkCall) ReplyUpdateContainer(notimplemented NotImplemented) error { - var out struct{ +func ReadAttachToContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil } -func (c *VarlinkCall) ReplyHistoryImage(notimplemented NotImplemented) error { - var out struct{ +func DeleteStoppedContainers(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.DeleteStoppedContainers", nil, more__, oneway__) +} + +func ReadDeleteStoppedContainers_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func CreateFromContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.CreateFromContainer", nil, more__, oneway__) } -func (c *VarlinkCall) ReplyExportImage(notimplemented NotImplemented) error { - var out struct{ +func ReadCreateFromContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil } -func (c *VarlinkCall) ReplyListContainerChanges(notimplemented NotImplemented) error { - var out struct{ +func ExportImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.ExportImage", nil, more__, oneway__) +} + +func ReadExportImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func PullImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.PullImage", nil, more__, oneway__) } -func (c *VarlinkCall) ReplyRenameContainer(notimplemented NotImplemented) error { - var out struct{ +func ReadPullImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil } -func (c *VarlinkCall) ReplyUnpauseContainer(notimplemented NotImplemented) error { - var out struct{ +func GetContainerStats(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.GetContainerStats", nil, more__, oneway__) +} + +func ReadGetContainerStats_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil } -func (c *VarlinkCall) ReplyAttachToContainer(notimplemented NotImplemented) error { - var out struct{ +func StopContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.StopContainer", nil, more__, oneway__) +} + +func ReadStopContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func WaitContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.WaitContainer", nil, more__, oneway__) } -func (c *VarlinkCall) ReplySearchImage(notimplemented NotImplemented) error { - var out struct{ +func ReadWaitContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil } -func (c *VarlinkCall) ReplyPing(ping StringResponse) error { - var out struct{ - Ping StringResponse `json:"ping"` +func RenameContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.RenameContainer", nil, more__, oneway__) +} + +func ReadRenameContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented } - out.Ping = ping - return c.Reply(&out) + return continues_, nil } -func (c *VarlinkCall) ReplyListContainers(notimplemented NotImplemented) error { - var out struct{ +func PauseContainer(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.PauseContainer", nil, more__, oneway__) +} + +func ReadPauseContainer_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func PushImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.PushImage", nil, more__, oneway__) } -func (c *VarlinkCall) ReplyRemoveContainer(notimplemented NotImplemented) error { - var out struct{ +func ReadPushImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil +} + +func SearchImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.SearchImage", nil, more__, oneway__) } -func (c *VarlinkCall) ReplyPullImage(notimplemented NotImplemented) error { - var out struct{ +func ReadSearchImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil } -func (c *VarlinkCall) ReplyKillContainer(notimplemented NotImplemented) error { - var out struct{ +func ListContainerProcesses(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.ListContainerProcesses", nil, more__, oneway__) +} + +func ReadListContainerProcesses_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil } -func (c *VarlinkCall) ReplyInspectImage(notimplemented NotImplemented) error { - var out struct{ +func CreateImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.CreateImage", nil, more__, oneway__) +} + +func ReadCreateImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil } -func (c *VarlinkCall) ReplyPushImage(notimplemented NotImplemented) error { - var out struct{ +func InspectImage(c__ *varlink.Connection, more__ bool, oneway__ bool) error { + return c__.Send("io.projectatomic.podman.InspectImage", nil, more__, oneway__) +} + +func ReadInspectImage_(c__ *varlink.Connection, notimplemented_ *NotImplemented) (bool, error) { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + continues_, err := c__.Receive(&out) + if err != nil { + return false, err + } + if notimplemented_ != nil { + *notimplemented_ = out.Notimplemented + } + return continues_, nil } -func (c *VarlinkCall) ReplyTagImage(notimplemented NotImplemented) error { - var out struct{ +// Service interface with all methods +type ioprojectatomicpodmanInterface interface { + GetVersion(c__ VarlinkCall) error + UnpauseContainer(c__ VarlinkCall) error + DeleteUnusedImages(c__ VarlinkCall) error + CreateContainer(c__ VarlinkCall) error + InspectContainer(c__ VarlinkCall) error + ExportContainer(c__ VarlinkCall) error + KillContainer(c__ VarlinkCall) error + RemoveImage(c__ VarlinkCall) error + Ping(c__ VarlinkCall) error + GetContainerLogs(c__ VarlinkCall) error + AttachToContainer(c__ VarlinkCall) error + TagImage(c__ VarlinkCall) error + ImportImage(c__ VarlinkCall) error + PullImage(c__ VarlinkCall) error + GetContainerStats(c__ VarlinkCall) error + StopContainer(c__ VarlinkCall) error + WaitContainer(c__ VarlinkCall) error + DeleteStoppedContainers(c__ VarlinkCall) error + CreateFromContainer(c__ VarlinkCall) error + ExportImage(c__ VarlinkCall) error + RenameContainer(c__ VarlinkCall) error + PauseContainer(c__ VarlinkCall) error + ListContainerProcesses(c__ VarlinkCall) error + CreateImage(c__ VarlinkCall) error + InspectImage(c__ VarlinkCall) error + PushImage(c__ VarlinkCall) error + SearchImage(c__ VarlinkCall) error + ListContainerChanges(c__ VarlinkCall) error + ResizeContainerTty(c__ VarlinkCall) error + RestartContainer(c__ VarlinkCall) error + UpdateContainer(c__ VarlinkCall) error + RemoveContainer(c__ VarlinkCall) error + HistoryImage(c__ VarlinkCall) error + ListContainers(c__ VarlinkCall) error + StartContainer(c__ VarlinkCall) error + ListImages(c__ VarlinkCall) error + BuildImage(c__ VarlinkCall) error +} + +// Service object with all methods +type VarlinkCall struct{ varlink.Call } + +// Reply methods for all varlink errors +func (c__ *VarlinkCall) ReplyActionFailed(reason_ string) error { + var out struct { + Reason string `json:"reason"` + } + out.Reason = reason_ + return c__.ReplyError("io.projectatomic.podman.ActionFailed", &out) +} + +// Reply methods for all varlink methods +func (c__ *VarlinkCall) ReplyRenameContainer(notimplemented_ NotImplemented) error { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (c *VarlinkCall) ReplyRemoveImage(notimplemented NotImplemented) error { - var out struct{ +func (c__ *VarlinkCall) ReplyPauseContainer(notimplemented_ NotImplemented) error { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (c *VarlinkCall) ReplyPauseContainer(notimplemented NotImplemented) error { - var out struct{ +func (c__ *VarlinkCall) ReplyInspectImage(notimplemented_ NotImplemented) error { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (c *VarlinkCall) ReplyListImages(notimplemented NotImplemented) error { - var out struct{ +func (c__ *VarlinkCall) ReplyPushImage(notimplemented_ NotImplemented) error { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (c *VarlinkCall) ReplyCreateImage(notimplemented NotImplemented) error { - var out struct{ +func (c__ *VarlinkCall) ReplySearchImage(notimplemented_ NotImplemented) error { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (c *VarlinkCall) ReplyDeleteUnusedImages(notimplemented NotImplemented) error { - var out struct{ +func (c__ *VarlinkCall) ReplyListContainerProcesses(notimplemented_ NotImplemented) error { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (c *VarlinkCall) ReplyCreateFromContainer(notimplemented NotImplemented) error { - var out struct{ +func (c__ *VarlinkCall) ReplyCreateImage(notimplemented_ NotImplemented) error { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (c *VarlinkCall) ReplyImportImage(notimplemented NotImplemented) error { - var out struct{ +func (c__ *VarlinkCall) ReplyRestartContainer(notimplemented_ NotImplemented) error { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (c *VarlinkCall) ReplyExportContainer(notimplemented NotImplemented) error { - var out struct{ +func (c__ *VarlinkCall) ReplyUpdateContainer(notimplemented_ NotImplemented) error { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (c *VarlinkCall) ReplyStartContainer(notimplemented NotImplemented) error { - var out struct{ +func (c__ *VarlinkCall) ReplyRemoveContainer(notimplemented_ NotImplemented) error { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (c *VarlinkCall) ReplyDeleteStoppedContainers(notimplemented NotImplemented) error { - var out struct{ +func (c__ *VarlinkCall) ReplyHistoryImage(notimplemented_ NotImplemented) error { + var out struct { Notimplemented NotImplemented `json:"notimplemented"` } - out.Notimplemented = notimplemented - return c.Reply(&out) + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) DeleteUnusedImages(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("DeleteUnusedImages") +func (c__ *VarlinkCall) ReplyListContainerChanges(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) CreateFromContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("CreateFromContainer") +func (c__ *VarlinkCall) ReplyResizeContainerTty(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) ImportImage(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("ImportImage") +func (c__ *VarlinkCall) ReplyListImages(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) PauseContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("PauseContainer") +func (c__ *VarlinkCall) ReplyBuildImage(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) ListImages(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("ListImages") +func (c__ *VarlinkCall) ReplyListContainers(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) CreateImage(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("CreateImage") +func (c__ *VarlinkCall) ReplyStartContainer(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) ExportContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("ExportContainer") +func (c__ *VarlinkCall) ReplyDeleteUnusedImages(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) StartContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("StartContainer") +func (c__ *VarlinkCall) ReplyGetVersion(version_ Version) error { + var out struct { + Version Version `json:"version"` + } + out.Version = version_ + return c__.Reply(&out) } -func (s *VarlinkInterface) DeleteStoppedContainers(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("DeleteStoppedContainers") +func (c__ *VarlinkCall) ReplyUnpauseContainer(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) RestartContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("RestartContainer") +func (c__ *VarlinkCall) ReplyExportContainer(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) WaitContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("WaitContainer") +func (c__ *VarlinkCall) ReplyKillContainer(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) GetVersion(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("GetVersion") +func (c__ *VarlinkCall) ReplyRemoveImage(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) GetContainerStats(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("GetContainerStats") +func (c__ *VarlinkCall) ReplyCreateContainer(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) ResizeContainerTty(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("ResizeContainerTty") +func (c__ *VarlinkCall) ReplyInspectContainer(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) GetContainerLogs(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("GetContainerLogs") +func (c__ *VarlinkCall) ReplyAttachToContainer(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) StopContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("StopContainer") +func (c__ *VarlinkCall) ReplyTagImage(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) BuildImage(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("BuildImage") +func (c__ *VarlinkCall) ReplyImportImage(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) UpdateContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("UpdateContainer") +func (c__ *VarlinkCall) ReplyPing(ping_ StringResponse) error { + var out struct { + Ping StringResponse `json:"ping"` + } + out.Ping = ping_ + return c__.Reply(&out) } -func (s *VarlinkInterface) HistoryImage(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("HistoryImage") +func (c__ *VarlinkCall) ReplyGetContainerLogs(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) ExportImage(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("ExportImage") +func (c__ *VarlinkCall) ReplyWaitContainer(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) CreateContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("CreateContainer") +func (c__ *VarlinkCall) ReplyDeleteStoppedContainers(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) InspectContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("InspectContainer") +func (c__ *VarlinkCall) ReplyCreateFromContainer(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) ListContainerProcesses(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("ListContainerProcesses") +func (c__ *VarlinkCall) ReplyExportImage(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) AttachToContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("AttachToContainer") +func (c__ *VarlinkCall) ReplyPullImage(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) SearchImage(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("SearchImage") +func (c__ *VarlinkCall) ReplyGetContainerStats(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) ListContainerChanges(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("ListContainerChanges") +func (c__ *VarlinkCall) ReplyStopContainer(notimplemented_ NotImplemented) error { + var out struct { + Notimplemented NotImplemented `json:"notimplemented"` + } + out.Notimplemented = notimplemented_ + return c__.Reply(&out) } -func (s *VarlinkInterface) RenameContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("RenameContainer") +// Dummy methods for all varlink methods +func (s__ *VarlinkInterface) RenameContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("RenameContainer") } -func (s *VarlinkInterface) UnpauseContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("UnpauseContainer") +func (s__ *VarlinkInterface) PauseContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("PauseContainer") } -func (s *VarlinkInterface) PullImage(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("PullImage") +func (s__ *VarlinkInterface) ListContainerProcesses(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("ListContainerProcesses") } -func (s *VarlinkInterface) Ping(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("Ping") +func (s__ *VarlinkInterface) CreateImage(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("CreateImage") } -func (s *VarlinkInterface) ListContainers(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("ListContainers") +func (s__ *VarlinkInterface) InspectImage(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("InspectImage") } -func (s *VarlinkInterface) RemoveContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("RemoveContainer") +func (s__ *VarlinkInterface) PushImage(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("PushImage") } -func (s *VarlinkInterface) TagImage(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("TagImage") +func (s__ *VarlinkInterface) SearchImage(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("SearchImage") } -func (s *VarlinkInterface) RemoveImage(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("RemoveImage") +func (s__ *VarlinkInterface) ListContainerChanges(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("ListContainerChanges") } -func (s *VarlinkInterface) KillContainer(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("KillContainer") +func (s__ *VarlinkInterface) ResizeContainerTty(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("ResizeContainerTty") } -func (s *VarlinkInterface) InspectImage(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("InspectImage") +func (s__ *VarlinkInterface) RestartContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("RestartContainer") } -func (s *VarlinkInterface) PushImage(c VarlinkCall) error { - return c.ReplyMethodNotImplemented("PushImage") +func (s__ *VarlinkInterface) UpdateContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("UpdateContainer") } -func (s *VarlinkInterface) VarlinkDispatch(call varlink.Call, methodname string) error { - switch methodname { - case "ExportContainer": - return s.ioprojectatomicpodmanInterface.ExportContainer(VarlinkCall{call}) +func (s__ *VarlinkInterface) RemoveContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("RemoveContainer") +} - case "StartContainer": - return s.ioprojectatomicpodmanInterface.StartContainer(VarlinkCall{call}) +func (s__ *VarlinkInterface) HistoryImage(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("HistoryImage") +} - case "DeleteStoppedContainers": - return s.ioprojectatomicpodmanInterface.DeleteStoppedContainers(VarlinkCall{call}) +func (s__ *VarlinkInterface) ListContainers(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("ListContainers") +} - case "GetVersion": - return s.ioprojectatomicpodmanInterface.GetVersion(VarlinkCall{call}) +func (s__ *VarlinkInterface) StartContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("StartContainer") +} - case "GetContainerStats": - return s.ioprojectatomicpodmanInterface.GetContainerStats(VarlinkCall{call}) +func (s__ *VarlinkInterface) ListImages(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("ListImages") +} - case "ResizeContainerTty": - return s.ioprojectatomicpodmanInterface.ResizeContainerTty(VarlinkCall{call}) +func (s__ *VarlinkInterface) BuildImage(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("BuildImage") +} - case "RestartContainer": - return s.ioprojectatomicpodmanInterface.RestartContainer(VarlinkCall{call}) +func (s__ *VarlinkInterface) GetVersion(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("GetVersion") +} - case "WaitContainer": - return s.ioprojectatomicpodmanInterface.WaitContainer(VarlinkCall{call}) +func (s__ *VarlinkInterface) UnpauseContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("UnpauseContainer") +} - case "GetContainerLogs": - return s.ioprojectatomicpodmanInterface.GetContainerLogs(VarlinkCall{call}) +func (s__ *VarlinkInterface) DeleteUnusedImages(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("DeleteUnusedImages") +} - case "StopContainer": - return s.ioprojectatomicpodmanInterface.StopContainer(VarlinkCall{call}) +func (s__ *VarlinkInterface) CreateContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("CreateContainer") +} - case "BuildImage": - return s.ioprojectatomicpodmanInterface.BuildImage(VarlinkCall{call}) +func (s__ *VarlinkInterface) InspectContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("InspectContainer") +} - case "CreateContainer": - return s.ioprojectatomicpodmanInterface.CreateContainer(VarlinkCall{call}) +func (s__ *VarlinkInterface) ExportContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("ExportContainer") +} - case "InspectContainer": - return s.ioprojectatomicpodmanInterface.InspectContainer(VarlinkCall{call}) +func (s__ *VarlinkInterface) KillContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("KillContainer") +} - case "ListContainerProcesses": - return s.ioprojectatomicpodmanInterface.ListContainerProcesses(VarlinkCall{call}) +func (s__ *VarlinkInterface) RemoveImage(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("RemoveImage") +} - case "UpdateContainer": - return s.ioprojectatomicpodmanInterface.UpdateContainer(VarlinkCall{call}) +func (s__ *VarlinkInterface) Ping(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("Ping") +} - case "HistoryImage": - return s.ioprojectatomicpodmanInterface.HistoryImage(VarlinkCall{call}) +func (s__ *VarlinkInterface) GetContainerLogs(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("GetContainerLogs") +} - case "ExportImage": - return s.ioprojectatomicpodmanInterface.ExportImage(VarlinkCall{call}) +func (s__ *VarlinkInterface) AttachToContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("AttachToContainer") +} - case "ListContainerChanges": - return s.ioprojectatomicpodmanInterface.ListContainerChanges(VarlinkCall{call}) +func (s__ *VarlinkInterface) TagImage(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("TagImage") +} - case "RenameContainer": - return s.ioprojectatomicpodmanInterface.RenameContainer(VarlinkCall{call}) +func (s__ *VarlinkInterface) ImportImage(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("ImportImage") +} - case "UnpauseContainer": - return s.ioprojectatomicpodmanInterface.UnpauseContainer(VarlinkCall{call}) +func (s__ *VarlinkInterface) GetContainerStats(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("GetContainerStats") +} - case "AttachToContainer": - return s.ioprojectatomicpodmanInterface.AttachToContainer(VarlinkCall{call}) +func (s__ *VarlinkInterface) StopContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("StopContainer") +} - case "SearchImage": - return s.ioprojectatomicpodmanInterface.SearchImage(VarlinkCall{call}) +func (s__ *VarlinkInterface) WaitContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("WaitContainer") +} - case "Ping": - return s.ioprojectatomicpodmanInterface.Ping(VarlinkCall{call}) +func (s__ *VarlinkInterface) DeleteStoppedContainers(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("DeleteStoppedContainers") +} - case "ListContainers": - return s.ioprojectatomicpodmanInterface.ListContainers(VarlinkCall{call}) +func (s__ *VarlinkInterface) CreateFromContainer(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("CreateFromContainer") +} - case "RemoveContainer": - return s.ioprojectatomicpodmanInterface.RemoveContainer(VarlinkCall{call}) +func (s__ *VarlinkInterface) ExportImage(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("ExportImage") +} + +func (s__ *VarlinkInterface) PullImage(c__ VarlinkCall) error { + return c__.ReplyMethodNotImplemented("PullImage") +} + +// Method call dispatcher +func (s__ *VarlinkInterface) VarlinkDispatch(call varlink.Call, methodname string) error { + switch methodname { + case "ExportImage": + return s__.ioprojectatomicpodmanInterface.ExportImage(VarlinkCall{call}) case "PullImage": - return s.ioprojectatomicpodmanInterface.PullImage(VarlinkCall{call}) + return s__.ioprojectatomicpodmanInterface.PullImage(VarlinkCall{call}) - case "KillContainer": - return s.ioprojectatomicpodmanInterface.KillContainer(VarlinkCall{call}) + case "GetContainerStats": + return s__.ioprojectatomicpodmanInterface.GetContainerStats(VarlinkCall{call}) + + case "StopContainer": + return s__.ioprojectatomicpodmanInterface.StopContainer(VarlinkCall{call}) + + case "WaitContainer": + return s__.ioprojectatomicpodmanInterface.WaitContainer(VarlinkCall{call}) + + case "DeleteStoppedContainers": + return s__.ioprojectatomicpodmanInterface.DeleteStoppedContainers(VarlinkCall{call}) + + case "CreateFromContainer": + return s__.ioprojectatomicpodmanInterface.CreateFromContainer(VarlinkCall{call}) + + case "RenameContainer": + return s__.ioprojectatomicpodmanInterface.RenameContainer(VarlinkCall{call}) + + case "PauseContainer": + return s__.ioprojectatomicpodmanInterface.PauseContainer(VarlinkCall{call}) + + case "ListContainerProcesses": + return s__.ioprojectatomicpodmanInterface.ListContainerProcesses(VarlinkCall{call}) + + case "CreateImage": + return s__.ioprojectatomicpodmanInterface.CreateImage(VarlinkCall{call}) case "InspectImage": - return s.ioprojectatomicpodmanInterface.InspectImage(VarlinkCall{call}) + return s__.ioprojectatomicpodmanInterface.InspectImage(VarlinkCall{call}) case "PushImage": - return s.ioprojectatomicpodmanInterface.PushImage(VarlinkCall{call}) + return s__.ioprojectatomicpodmanInterface.PushImage(VarlinkCall{call}) - case "TagImage": - return s.ioprojectatomicpodmanInterface.TagImage(VarlinkCall{call}) + case "SearchImage": + return s__.ioprojectatomicpodmanInterface.SearchImage(VarlinkCall{call}) - case "RemoveImage": - return s.ioprojectatomicpodmanInterface.RemoveImage(VarlinkCall{call}) + case "HistoryImage": + return s__.ioprojectatomicpodmanInterface.HistoryImage(VarlinkCall{call}) - case "PauseContainer": - return s.ioprojectatomicpodmanInterface.PauseContainer(VarlinkCall{call}) + case "ListContainerChanges": + return s__.ioprojectatomicpodmanInterface.ListContainerChanges(VarlinkCall{call}) + + case "ResizeContainerTty": + return s__.ioprojectatomicpodmanInterface.ResizeContainerTty(VarlinkCall{call}) + + case "RestartContainer": + return s__.ioprojectatomicpodmanInterface.RestartContainer(VarlinkCall{call}) + + case "UpdateContainer": + return s__.ioprojectatomicpodmanInterface.UpdateContainer(VarlinkCall{call}) + + case "RemoveContainer": + return s__.ioprojectatomicpodmanInterface.RemoveContainer(VarlinkCall{call}) + + case "ListContainers": + return s__.ioprojectatomicpodmanInterface.ListContainers(VarlinkCall{call}) + + case "StartContainer": + return s__.ioprojectatomicpodmanInterface.StartContainer(VarlinkCall{call}) case "ListImages": - return s.ioprojectatomicpodmanInterface.ListImages(VarlinkCall{call}) + return s__.ioprojectatomicpodmanInterface.ListImages(VarlinkCall{call}) - case "CreateImage": - return s.ioprojectatomicpodmanInterface.CreateImage(VarlinkCall{call}) + case "BuildImage": + return s__.ioprojectatomicpodmanInterface.BuildImage(VarlinkCall{call}) + + case "GetVersion": + return s__.ioprojectatomicpodmanInterface.GetVersion(VarlinkCall{call}) + + case "UnpauseContainer": + return s__.ioprojectatomicpodmanInterface.UnpauseContainer(VarlinkCall{call}) case "DeleteUnusedImages": - return s.ioprojectatomicpodmanInterface.DeleteUnusedImages(VarlinkCall{call}) + return s__.ioprojectatomicpodmanInterface.DeleteUnusedImages(VarlinkCall{call}) - case "CreateFromContainer": - return s.ioprojectatomicpodmanInterface.CreateFromContainer(VarlinkCall{call}) + case "CreateContainer": + return s__.ioprojectatomicpodmanInterface.CreateContainer(VarlinkCall{call}) + + case "InspectContainer": + return s__.ioprojectatomicpodmanInterface.InspectContainer(VarlinkCall{call}) + + case "ExportContainer": + return s__.ioprojectatomicpodmanInterface.ExportContainer(VarlinkCall{call}) + + case "KillContainer": + return s__.ioprojectatomicpodmanInterface.KillContainer(VarlinkCall{call}) + + case "RemoveImage": + return s__.ioprojectatomicpodmanInterface.RemoveImage(VarlinkCall{call}) + + case "Ping": + return s__.ioprojectatomicpodmanInterface.Ping(VarlinkCall{call}) + + case "GetContainerLogs": + return s__.ioprojectatomicpodmanInterface.GetContainerLogs(VarlinkCall{call}) + + case "AttachToContainer": + return s__.ioprojectatomicpodmanInterface.AttachToContainer(VarlinkCall{call}) + + case "TagImage": + return s__.ioprojectatomicpodmanInterface.TagImage(VarlinkCall{call}) case "ImportImage": - return s.ioprojectatomicpodmanInterface.ImportImage(VarlinkCall{call}) + return s__.ioprojectatomicpodmanInterface.ImportImage(VarlinkCall{call}) default: return call.ReplyMethodNotFound(methodname) } } -func (s *VarlinkInterface) VarlinkGetName() string { + +// Varlink interface name +func (s__ *VarlinkInterface) VarlinkGetName() string { return `io.projectatomic.podman` } -func (s *VarlinkInterface) VarlinkGetDescription() string { +// Varlink interface description +func (s__ *VarlinkInterface) VarlinkGetDescription() string { return `# Podman Service Interface interface io.projectatomic.podman @@ -703,6 +1380,7 @@ error ActionFailed (reason: string) ` } +// Service interface type VarlinkInterface struct { ioprojectatomicpodmanInterface } diff --git a/vendor/github.com/varlink/go/.gitignore b/vendor/github.com/varlink/go/.gitignore deleted file mode 100644 index e69de29bb..000000000 --- a/vendor/github.com/varlink/go/.gitignore +++ /dev/null diff --git a/vendor/github.com/varlink/go/.travis.yml b/vendor/github.com/varlink/go/.travis.yml deleted file mode 100644 index 990f12e0a..000000000 --- a/vendor/github.com/varlink/go/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: go -sudo: false -go: -- '1.9' -- 1.10.x -install: -- go get golang.org/x/tools/cmd/cover -- go get github.com/mattn/goveralls -script: -- '"$HOME/gopath/bin/goveralls" -show -service=travis-ci -repotoken "$COVERALLS_TOKEN"' -env: - global: - - secure: bjxOSgBfB+YooxNTkIDHAD+/X6g56qBWoYpB1JinuS5kmt3vSjfRSuXui71sGuha7jO2FOJja8HcpjOv3UP+qmmej9276o5VWrjS1AwnI95hSQQ4JHm293Z1QeojjRaxmoKrgn7i82Hn4qNdVLQA142s+SIdqOxtN6LDs7i0Yb4IuXoiMQHbd6kAAL95o9IUFPpYAdsXoQ6xnx+TXNiSwPPeh4m5CNKuTtmGTuMGaj8tXxttFKJhZcRzvOpDuh7luc9PSVnQgYmKE/3S9ehzGV8Lk4T8eC7587DY1GdYQKt1egJSE72L+PVnmoalWROaAGHZvYWsSAeNi1UIvcFwGbXBRpq7kz3DVfIULM8V67UAaF3dGYDN3Ae825mDjN5JDfml17AoEjMjI0LlBImZLX2EWIEN225JIREHdpG9seJkaN1ClcpvEIeYuThF2MiivP1EE8/w8S80yoO5nW76Py/th16OuaEiP9LdLsbXimObUPsS9Sr8qquf/PiVqRMMpVW88oOEG5HVn4Ra5B/xVC6nPEF88tE6p9+7RSz4rOWih8QmW+6SX6eo0BI9di4L779f/WfUrddN0JLIvEnRFZZ+pVF/oo+N2INNeIMsZBvG3FVo+Zxzo6SExXnSSpuf1bp140ZdinUMACq6BqK+9gj1C9vNRmqQJaEefrqutws= diff --git a/vendor/github.com/varlink/go/Makefile b/vendor/github.com/varlink/go/Makefile deleted file mode 100644 index 3f1c0e6d6..000000000 --- a/vendor/github.com/varlink/go/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -all: - go test -v ./... -.PHONY: all diff --git a/vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/generator_test.go b/vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/generator_test.go deleted file mode 100644 index aa3a8565f..000000000 --- a/vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/generator_test.go +++ /dev/null @@ -1,85 +0,0 @@ -package main - -import ( - "strings" - "testing" -) - -func expect(t *testing.T, expected string, returned string) { - if strings.Compare(returned, expected) != 0 { - t.Fatalf("Expected(%d): `%s`\nGot(%d): `%s`\n", - len(expected), expected, - len(returned), returned) - } -} - -func TestIDLParser(t *testing.T) { - pkgname, b, err := generateTemplate(` -# Interface to jump a spacecraft to another point in space. The -# FTL Drive is the propulsion system to achieve faster-than-light -# travel through space. A ship making a properly calculated -# jump can arrive safely in planetary orbit, or alongside other -# ships or spaceborne objects. -interface org.example.ftl - -# The current state of the FTL drive and the amount of fuel -# available to jump. -type DriveCondition ( - state: (idle, spooling, busy), - booster: bool, - active_engines: [](id: int, state: bool), - tylium_level: int -) - -# Speed, trajectory and jump duration is calculated prior to -# activating the FTL drive. -type DriveConfiguration ( - speed: int, - trajectory: int, - duration: int -) - -# The galactic coordinates use the Sun as the origin. Galactic -# longitude is measured with primary direction from the Sun to -# the center of the galaxy in the galactic plane, while the -# galactic latitude measures the angle of the object above the -# galactic plane. -type Coordinate ( - longitude: float, - latitude: float, - distance: int -) - -# Monitor the drive. The method will reply with an update whenever -# the drive's state changes -method Monitor() -> (condition: DriveCondition) - -# Calculate the drive's jump parameters from the current -# position to the target position in the galaxy -method CalculateConfiguration( - current: Coordinate, - target: Coordinate -) -> (configuration: DriveConfiguration) - -# Jump to the calculated point in space -method Jump(configuration: DriveConfiguration) -> () - -# There is not enough tylium to jump with the given parameters -error NotEnoughEnergy () - -# The supplied parameters are outside the supported range -error ParameterOutOfRange (field: string) - -# some more coverage -method Foo(interface: string) -> (ret: (go: string, switch: bool, more: (t:bool, f:bool))) - `) - - if err != nil { - t.Fatalf("Error parsing %v", err) - } - expect(t, "orgexampleftl", pkgname) - if len(b) <= 0 { - t.Fatal("No generated go source") - } - // FIXME: compare b.String() against expected output -} diff --git a/vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/main.go b/vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/main.go deleted file mode 100644 index 1bcdb78de..000000000 --- a/vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/main.go +++ /dev/null @@ -1,294 +0,0 @@ -package main - -import ( - "bytes" - "fmt" - "io/ioutil" - "os" - "path" - "strings" - - "github.com/varlink/go/varlink/idl" -) - -var goKeywords = map[string]struct{}{ - "break": {}, - "case": {}, - "chan": {}, - "const": {}, - "continue": {}, - "default": {}, - "defer": {}, - "else": {}, - "fallthrough": {}, - "for": {}, - "func": {}, - "go": {}, - "goto": {}, - "if": {}, - "import": {}, - "interface": {}, - "map": {}, - "package": {}, - "range": {}, - "return": {}, - "select": {}, - "struct": {}, - "switch": {}, - "type": {}, - "var": {}, -} - -func sanitizeGoName(name string) string { - if _, ok := goKeywords[name]; !ok { - return name - } - return name + "_" -} - -func writeType(b *bytes.Buffer, t *idl.Type, json bool, ident int) { - switch t.Kind { - case idl.TypeBool: - b.WriteString("bool") - - case idl.TypeInt: - b.WriteString("int64") - - case idl.TypeFloat: - b.WriteString("float64") - - case idl.TypeString, idl.TypeEnum: - b.WriteString("string") - - case idl.TypeArray: - b.WriteString("[]") - writeType(b, t.ElementType, json, ident) - - case idl.TypeMaybe: - b.WriteString("*") - writeType(b, t.ElementType, json, ident) - - case idl.TypeAlias: - b.WriteString(t.Alias) - - case idl.TypeStruct: - b.WriteString("struct{\n") - for _, field := range t.Fields { - for i := 0; i < ident+1; i++ { - b.WriteString("\t") - } - - b.WriteString(strings.Title(field.Name) + " ") - writeType(b, field.Type, json, ident+1) - if json { - b.WriteString(" `json:\"" + field.Name + "\"`") - } - b.WriteString("\n") - } - for i := 0; i < ident; i++ { - b.WriteString("\t") - } - b.WriteString("}") - } -} - -func generateTemplate(description string) (string, []byte, error) { - description = strings.TrimRight(description, "\n") - - midl, err := idl.New(description) - if err != nil { - return "", nil, err - } - - pkgname := strings.Replace(midl.Name, ".", "", -1) - - var b bytes.Buffer - b.WriteString("// Generated with github.com/varlink/go/cmd/varlink-go-interface-generator\n") - b.WriteString("package " + pkgname + "\n\n") - b.WriteString(`import "github.com/varlink/go/varlink"` + "\n\n") - - // Type declarations - for _, a := range midl.Aliases { - b.WriteString("type " + a.Name + " ") - writeType(&b, a.Type, true, 0) - b.WriteString("\n\n") - } - - // Local interface with all methods - b.WriteString("type " + pkgname + "Interface interface {\n") - for _, m := range midl.Methods { - b.WriteString("\t" + m.Name + "(c VarlinkCall") - for _, field := range m.In.Fields { - b.WriteString(", " + strings.Title(field.Name) + " ") - writeType(&b, field.Type, false, 1) - } - b.WriteString(") error\n") - } - b.WriteString("}\n\n") - - // Local object with all methods - b.WriteString("type VarlinkCall struct{ varlink.Call }\n\n") - - // Reply methods for all varlink errors - for _, e := range midl.Errors { - b.WriteString("func (c *VarlinkCall) Reply" + e.Name + "(") - for i, field := range e.Type.Fields { - if i > 0 { - b.WriteString(", ") - } - b.WriteString(sanitizeGoName(field.Name) + " ") - writeType(&b, field.Type, false, 1) - } - b.WriteString(") error {\n") - if len(e.Type.Fields) > 0 { - b.WriteString("\tvar out ") - writeType(&b, e.Type, true, 1) - b.WriteString("\n") - for _, field := range e.Type.Fields { - switch field.Type.Kind { - case idl.TypeStruct, idl.TypeArray: - b.WriteString("\tout." + strings.Title(field.Name) + " = ") - writeType(&b, field.Type, true, 1) - b.WriteString("(" + sanitizeGoName(field.Name) + ")\n") - - default: - b.WriteString("\tout." + strings.Title(field.Name) + " = " + sanitizeGoName(field.Name) + "\n") - } - } - b.WriteString("\treturn c.ReplyError(\"" + midl.Name + "." + e.Name + "\", &out)\n") - } else { - b.WriteString("\treturn c.ReplyError(\"" + midl.Name + "." + e.Name + "\", nil)\n") - } - b.WriteString("}\n\n") - } - - // Reply methods for all varlink methods - for _, m := range midl.Methods { - b.WriteString("func (c *VarlinkCall) Reply" + m.Name + "(") - for i, field := range m.Out.Fields { - if i > 0 { - b.WriteString(", ") - } - b.WriteString(sanitizeGoName(field.Name) + " ") - writeType(&b, field.Type, false, 1) - } - b.WriteString(") error {\n") - if len(m.Out.Fields) > 0 { - b.WriteString("\tvar out ") - writeType(&b, m.Out, true, 1) - b.WriteString("\n") - for _, field := range m.Out.Fields { - switch field.Type.Kind { - case idl.TypeStruct, idl.TypeArray: - b.WriteString("\tout." + strings.Title(field.Name) + " = ") - writeType(&b, field.Type, true, 1) - b.WriteString("(" + sanitizeGoName(field.Name) + ")\n") - - default: - b.WriteString("\tout." + strings.Title(field.Name) + " = " + sanitizeGoName(field.Name) + "\n") - } - } - b.WriteString("\treturn c.Reply(&out)\n") - } else { - b.WriteString("\treturn c.Reply(nil)\n") - } - b.WriteString("}\n\n") - } - - // Dummy methods for all varlink methods - for _, m := range midl.Methods { - b.WriteString("func (s *VarlinkInterface) " + m.Name + "(c VarlinkCall") - for _, field := range m.In.Fields { - b.WriteString(", " + sanitizeGoName(field.Name) + " ") - writeType(&b, field.Type, false, 1) - } - b.WriteString(") error {\n" + - "\treturn c.ReplyMethodNotImplemented(\"" + m.Name + "\")\n" + - "}\n\n") - } - - // Method call dispatcher - b.WriteString("func (s *VarlinkInterface) VarlinkDispatch(call varlink.Call, methodname string) error {\n" + - "\tswitch methodname {\n") - for _, m := range midl.Methods { - b.WriteString("\tcase \"" + m.Name + "\":\n") - if len(m.In.Fields) > 0 { - b.WriteString("\t\tvar in ") - writeType(&b, m.In, true, 2) - b.WriteString("\n") - b.WriteString("\t\terr := call.GetParameters(&in)\n" + - "\t\tif err != nil {\n" + - "\t\t\treturn call.ReplyInvalidParameter(\"parameters\")\n" + - "\t\t}\n") - b.WriteString("\t\treturn s." + pkgname + "Interface." + m.Name + "(VarlinkCall{call}") - if len(m.In.Fields) > 0 { - for _, field := range m.In.Fields { - switch field.Type.Kind { - case idl.TypeStruct, idl.TypeArray: - b.WriteString(", ") - writeType(&b, field.Type, false, 2) - b.WriteString("(in." + strings.Title(field.Name) + ")") - - default: - b.WriteString(", in." + strings.Title(field.Name)) - } - } - } - b.WriteString(")\n") - } else { - b.WriteString("\t\treturn s." + pkgname + "Interface." + m.Name + "(VarlinkCall{call})\n") - } - b.WriteString("\n") - } - b.WriteString("\tdefault:\n" + - "\t\treturn call.ReplyMethodNotFound(methodname)\n" + - "\t}\n" + - "}\n") - - // Varlink interface name - b.WriteString("func (s *VarlinkInterface) VarlinkGetName() string {\n" + - "\treturn `" + midl.Name + "`\n" + "}\n\n") - - // Varlink interface description - b.WriteString("func (s *VarlinkInterface) VarlinkGetDescription() string {\n" + - "\treturn `" + midl.Description + "\n`\n}\n\n") - - b.WriteString("type VarlinkInterface struct {\n" + - "\t" + pkgname + "Interface\n" + - "}\n\n") - - b.WriteString("func VarlinkNew(m " + pkgname + "Interface) *VarlinkInterface {\n" + - "\treturn &VarlinkInterface{m}\n" + - "}\n") - - return pkgname, b.Bytes(), nil -} - -func generateFile(varlinkFile string) { - file, err := ioutil.ReadFile(varlinkFile) - if err != nil { - fmt.Fprintf(os.Stderr, "Error reading file '%s': %s\n", varlinkFile, err) - os.Exit(1) - } - - pkgname, b, err := generateTemplate(string(file)) - if err != nil { - fmt.Fprintf(os.Stderr, "Error parsing file '%s': %s\n", varlinkFile, err) - os.Exit(1) - } - - filename := path.Dir(varlinkFile) + "/" + pkgname + ".go" - err = ioutil.WriteFile(filename, b, 0660) - if err != nil { - fmt.Fprintf(os.Stderr, "Error writing file '%s': %s\n", filename, err) - os.Exit(1) - } -} - -func main() { - if len(os.Args) != 2 { - fmt.Printf("Usage: %s <file>\n", os.Args[0]) - os.Exit(1) - } - generateFile(os.Args[1]) -} diff --git a/vendor/github.com/varlink/go/cmd/varlink-go-type-generator/main.go b/vendor/github.com/varlink/go/cmd/varlink-go-type-generator/main.go deleted file mode 100644 index dfbec5fb2..000000000 --- a/vendor/github.com/varlink/go/cmd/varlink-go-type-generator/main.go +++ /dev/null @@ -1,142 +0,0 @@ -package main - -import ( - "fmt" - "go/ast" - "go/importer" - "go/parser" - "go/token" - "go/types" - "log" - "os" -) - -func GoToVarlinkType(t types.Type) string { - switch u := t.(type) { - case *types.Basic: - if u.Info()&types.IsBoolean != 0 { - return "bool" - } - if u.Info()&types.IsInteger != 0 { - return "int" - } - if u.Info()&types.IsFloat != 0 { - return "float" - } - if u.Info()&types.IsString != 0 { - return "string" - } - return fmt.Sprintf("<<<%s>>>", t.String()) - - case *types.Named: - return u.Obj().Name() - - case *types.Map: - return fmt.Sprintf("<<<%s>>>", u.String()) - - case *types.Interface: - return fmt.Sprintf("<<<%s>>>", u.String()) - - case *types.Pointer: - return fmt.Sprintf("?%s", GoToVarlinkType(u.Elem())) - - case *types.Array: - return fmt.Sprintf("[]%s", GoToVarlinkType(u.Elem())) - - case *types.Slice: - return fmt.Sprintf("[]%s", GoToVarlinkType(u.Elem())) - - default: - return fmt.Sprintf("<<<%T %s>>>", t, u) - } - - return t.String() -} - -func PrintDefsUses(name string, fset *token.FileSet, files []*ast.File) error { - conf := types.Config{ - Importer: importer.Default(), - FakeImportC: true, - } - - info := &types.Info{ - Defs: make(map[*ast.Ident]types.Object), - } - - _, err := conf.Check(name, fset, files, info) - if err != nil { - return err // type error - } - - seen := map[string]interface{}{} - - for id, obj := range info.Defs { - if obj == nil { - continue - } - - if _, ok := seen[id.Name]; ok { - continue - } - - /* - if !obj.Exported() || obj.Pkg().Name() != name { - continue - } - */ - switch f := obj.Type().Underlying().(type) { - case *types.Struct: - if f.NumFields() > 0 { - fmt.Printf("type %s (\n", id.Name) - fmt.Printf("\t%s: %s", - f.Field(0).Name(), GoToVarlinkType(f.Field(0).Type())) - for i := 1; i < f.NumFields(); i++ { - fmt.Printf(",\n\t%s: %s", - f.Field(i).Name(), GoToVarlinkType(f.Field(i).Type())) - } - fmt.Printf("\n)\n\n") - } - } - seen[id.Name] = nil - } - - return nil -} - -func main() { - - path := os.Args[1] - fs := token.NewFileSet() - - if stat, err := os.Stat(path); err == nil && stat.IsDir() { - pkgs, err := parser.ParseDir(fs, path, nil, 0) - if err != nil { - fmt.Printf("parsing dir '%s': %s", path, err) - } - for name, pkg := range pkgs { - log.Println("Found package:", name) - - fset := make([]*ast.File, len(pkg.Files), len(pkg.Files)) - idx := 0 - for _, value := range pkg.Files { - fset[idx] = value - idx++ - } - - if err := PrintDefsUses(name, fs, fset); err != nil { - log.Print(err) // type error - } - } - } else { - - fset, err := parser.ParseFile(fs, path, nil, 0) - - if err != nil { - fmt.Printf("parsing file '%s': %s", path, err) - } - name := fset.Name.String() - if err := PrintDefsUses(name, fs, []*ast.File{fset}); err != nil { - log.Print(err) // type error - } - } -} diff --git a/vendor/github.com/varlink/go/golang-github-varlink-go.spec b/vendor/github.com/varlink/go/golang-github-varlink-go.spec deleted file mode 100644 index 85f5d1788..000000000 --- a/vendor/github.com/varlink/go/golang-github-varlink-go.spec +++ /dev/null @@ -1,44 +0,0 @@ -%global goipath github.com/varlink/go -Version: 0 -%gometa - -Name: %{goname} -Release: 1%{?dist} -Summary: Go bindings for varlink -License: ASL 2.0 -URL: %{gourl} -Source0: %{gosource} - -%description -Native Go bindings for the varlink protocol. - -%package devel -Summary: %{summary} -BuildArch: noarch - -%description devel -%{summary} - -This package contains library source intended for -building other packages which use import path with -%{gobaseipath} prefix. - -%prep -%forgesetup - -%build -%gobuildroot - -%install -gofiles=$(find . %{gofindfilter} -print) -%goinstall $gofiles - -%check - -%files devel -f devel.file-list -%license LICENSE -%doc README.md - -%changelog -* Tue Mar 20 2018 <info@varlink.org> 0-1 -- Version 0 diff --git a/vendor/github.com/varlink/go/varlink/connection.go b/vendor/github.com/varlink/go/varlink/connection.go index 2445072b6..5a163b501 100644 --- a/vendor/github.com/varlink/go/varlink/connection.go +++ b/vendor/github.com/varlink/go/varlink/connection.go @@ -27,17 +27,26 @@ type Connection struct { } // Send sends a method call. -func (c *Connection) Send(method string, parameters interface{}, more bool) error { +func (c *Connection) Send(method string, parameters interface{}, more bool, oneway bool) error { type call struct { Method string `json:"method"` Parameters interface{} `json:"parameters,omitempty"` More bool `json:"more,omitempty"` - OneShot bool `json:"oneshot,omitempty"` + Oneway bool `json:"oneway,omitempty"` } + + if more && oneway { + return &Error{ + Name: "org.varlink.InvalidParameter", + Parameters: "oneway", + } + } + m := call{ Method: method, Parameters: parameters, More: more, + Oneway: oneway, } b, err := json.Marshal(m) if err != nil { @@ -54,53 +63,47 @@ func (c *Connection) Send(method string, parameters interface{}, more bool) erro } // Receive receives a method reply. -func (c *Connection) Receive(parameters interface{}, continues *bool, oneshot *bool) error { +func (c *Connection) Receive(parameters interface{}) (bool, error) { type reply struct { Parameters *json.RawMessage `json:"parameters"` Continues bool `json:"continues"` - Oneshot bool `json:"oneshot"` Error string `json:"error"` } out, err := c.reader.ReadBytes('\x00') if err != nil { - return err + return false, err } var m reply err = json.Unmarshal(out[:len(out)-1], &m) if err != nil { - return err + return false, err } if m.Error != "" { - return &Error{ + return false, &Error{ Name: m.Error, Parameters: m.Parameters, } } - if continues != nil { - *continues = m.Continues - } - if oneshot != nil { - *oneshot = m.Oneshot - } if parameters != nil && m.Parameters != nil { - return json.Unmarshal(*m.Parameters, parameters) + return m.Continues, json.Unmarshal(*m.Parameters, parameters) } - return nil + return m.Continues, nil } // Call sends a method call and returns the result of the call. func (c *Connection) Call(method string, parameters interface{}, result interface{}) error { - err := c.Send(method, ¶meters, false) + err := c.Send(method, ¶meters, false, false) if err != nil { return err } - return c.Receive(result, nil, nil) + _, err = c.Receive(result) + return err } // GetInterfaceDescription requests the interface description string from the service. diff --git a/vendor/github.com/varlink/go/varlink/external_test.go b/vendor/github.com/varlink/go/varlink/external_test.go deleted file mode 100644 index dbe4290e6..000000000 --- a/vendor/github.com/varlink/go/varlink/external_test.go +++ /dev/null @@ -1,144 +0,0 @@ -package varlink_test - -// test with no internal access - -import ( - "github.com/varlink/go/varlink" - "os" - "testing" - "time" -) - -type VarlinkInterface struct{} - -func (s *VarlinkInterface) VarlinkDispatch(call varlink.Call, methodname string) error { - return call.ReplyMethodNotImplemented(methodname) -} -func (s *VarlinkInterface) VarlinkGetName() string { - return `org.example.test` -} - -func (s *VarlinkInterface) VarlinkGetDescription() string { - return "#" -} - -type VarlinkInterface2 struct{} - -func (s *VarlinkInterface2) VarlinkDispatch(call varlink.Call, methodname string) error { - return call.ReplyMethodNotImplemented(methodname) -} -func (s *VarlinkInterface2) VarlinkGetName() string { - return `org.example.test2` -} - -func (s *VarlinkInterface2) VarlinkGetDescription() string { - return "#" -} - -func TestRegisterService(t *testing.T) { - newTestInterface := new(VarlinkInterface) - service, err := varlink.NewService( - "Varlink", - "Varlink Test", - "1", - "https://github.com/varlink/go/varlink", - ) - if err != nil { - t.Fatalf("NewService(): %v", err) - } - - if err := service.RegisterInterface(newTestInterface); err != nil { - t.Fatalf("Couldn't register service: %v", err) - } - - if err := service.RegisterInterface(newTestInterface); err == nil { - t.Fatal("Could register service twice") - } - - defer func() { service.Shutdown() }() - - servererror := make(chan error) - - go func() { - servererror <- service.Listen("unix:@varlinkexternal_TestRegisterService", 0) - }() - - time.Sleep(time.Second / 5) - - n := new(VarlinkInterface2) - - if err := service.RegisterInterface(n); err == nil { - t.Fatal("Could register service while running") - } - time.Sleep(time.Second / 5) - service.Shutdown() - - if err := <-servererror; err != nil { - t.Fatalf("service.Listen(): %v", err) - } -} - -func TestUnix(t *testing.T) { - newTestInterface := new(VarlinkInterface) - service, err := varlink.NewService( - "Varlink", - "Varlink Test", - "1", - "https://github.com/varlink/go/varlink", - ) - - if err != nil { - t.Fatalf("NewService(): %v", err) - } - - if err := service.RegisterInterface(newTestInterface); err != nil { - t.Fatalf("RegisterInterface(): %v", err) - } - - servererror := make(chan error) - - go func() { - servererror <- service.Listen("unix:varlinkexternal_TestUnix", 0) - }() - - time.Sleep(time.Second / 5) - service.Shutdown() - - if err := <-servererror; err != nil { - t.Fatalf("service.Listen(): %v", err) - } -} - -func TestListenFDSNotInt(t *testing.T) { - newTestInterface := new(VarlinkInterface) - service, err := varlink.NewService( - "Varlink", - "Varlink Test", - "1", - "https://github.com/varlink/go/varlink", - ) - - if err != nil { - t.Fatalf("NewService(): %v", err) - } - - if err := service.RegisterInterface(newTestInterface); err != nil { - t.Fatalf("Couldn't register service: %v", err) - } - os.Setenv("LISTEN_FDS", "foo") - - servererror := make(chan error) - - go func() { - servererror <- service.Listen("unix:varlinkexternal_TestListenFDSNotInt", 0) - }() - - time.Sleep(time.Second / 5) - service.Shutdown() - - err = <-servererror - - if err != nil { - t.Fatalf("service.Run(): %v", err) - } -} diff --git a/vendor/github.com/varlink/go/varlink/idl/idl.go b/vendor/github.com/varlink/go/varlink/idl/idl.go index 27f21a759..e4ba27b6b 100644 --- a/vendor/github.com/varlink/go/varlink/idl/idl.go +++ b/vendor/github.com/varlink/go/varlink/idl/idl.go @@ -13,8 +13,10 @@ const ( TypeInt TypeFloat TypeString + TypeObject TypeArray TypeMaybe + TypeMap TypeStruct TypeEnum TypeAlias @@ -277,9 +279,25 @@ func (p *parser) readType() *Type { if e == nil { return nil } + if e.Kind == TypeMaybe { + return nil + } t = &Type{Kind: TypeMaybe, ElementType: e} case '[': + var kind TypeKind + + switch p.readKeyword() { + case "string": + kind = TypeMap + + case "": + kind = TypeArray + + default: + return nil + } + if p.next() != ']' { return nil } @@ -287,7 +305,7 @@ func (p *parser) readType() *Type { if e == nil { return nil } - t = &Type{Kind: TypeArray, ElementType: e} + t = &Type{Kind: kind, ElementType: e} default: p.backup() @@ -304,6 +322,9 @@ func (p *parser) readType() *Type { case "string": t = &Type{Kind: TypeString} + + case "object": + t = &Type{Kind: TypeObject} } } else if name := p.readTypeName(); name != "" { diff --git a/vendor/github.com/varlink/go/varlink/idl/idl_test.go b/vendor/github.com/varlink/go/varlink/idl/idl_test.go deleted file mode 100644 index 5d83d5890..000000000 --- a/vendor/github.com/varlink/go/varlink/idl/idl_test.go +++ /dev/null @@ -1,127 +0,0 @@ -package idl - -import ( - "fmt" - "runtime" - "testing" -) - -/* -func expect(t *testing.T, expected string, returned string) { - if strings.Compare(returned, expected) != 0 { - t.Fatalf("Expected(%d): `%s`\nGot(%d): `%s`\n", - len(expected), expected, - len(returned), returned) - } -} -*/ - -func testParse(t *testing.T, pass bool, description string) { - _, _, line, _ := runtime.Caller(1) - - t.Run(fmt.Sprintf("Line-%d", line), func(t *testing.T) { - midl, err := New(description) - if pass { - if err != nil { - t.Fatalf("generateTemplate(`%s`): %v", description, err) - } - if len(midl.Name) <= 0 { - t.Fatalf("generateTemplate(`%s`): returned no pkgname", description) - } - } - if !pass && (err == nil) { - t.Fatalf("generateTemplate(`%s`): did not fail", description) - } - }) -} - -func TestOneMethod(t *testing.T) { - testParse(t, true, "interface foo.bar\nmethod Foo()->()") -} - -func TestOneMethodNoType(t *testing.T) { - testParse(t, false, "interface foo.bar\nmethod Foo()->(b:)") -} - -func TestDomainNames(t *testing.T) { - testParse(t, true, "interface org.varlink.service\nmethod F()->()") - testParse(t, true, "interface com.example.0example\nmethod F()->()") - testParse(t, true, "interface com.example.example-dash\nmethod F()->()") - testParse(t, true, "interface xn--lgbbat1ad8j.example.algeria\nmethod F()->()") - testParse(t, false, "interface com.-example.leadinghyphen\nmethod F()->()") - testParse(t, false, "interface com.example-.danglinghyphen-\nmethod F()->()") - testParse(t, false, "interface Com.example.uppercase-toplevel\nmethod F()->()") - testParse(t, false, "interface Co9.example.number-toplevel\nmethod F()->()") - testParse(t, false, "interface 1om.example.number-toplevel\nmethod F()->()") - testParse(t, false, "interface com.Example\nmethod F()->()") - var name string - for i := 0; i < 255; i++ { - name += "a" - } - testParse(t, false, "interface com.example.toolong"+name+"\nmethod F()->()") - testParse(t, false, "interface xn--example.toolong"+name+"\nmethod F()->()") -} - -func TestNoMethod(t *testing.T) { - testParse(t, false, ` -interface org.varlink.service - type Interface (name: string, types: []Type, methods: []Method) - type Property (key: string, value: string) -`) -} - -func TestTypeNoArgs(t *testing.T) { - testParse(t, true, "interface foo.bar\n type I ()\nmethod F()->()") -} - -func TestTypeOneArg(t *testing.T) { - testParse(t, true, "interface foo.bar\n type I (b:bool)\nmethod F()->()") -} - -func TestTypeOneArray(t *testing.T) { - testParse(t, true, "interface foo.bar\n type I (b:[]bool)\nmethod F()->()") - testParse(t, false, "interface foo.bar\n type I (b:bool[ ])\nmethod F()->()") - testParse(t, false, "interface foo.bar\n type I (b:bool[1])\nmethod F()->()") - testParse(t, false, "interface foo.bar\n type I (b:bool[ 1 ])\nmethod F()->()") - testParse(t, false, "interface foo.bar\n type I (b:bool[ 1 1 ])\nmethod F()->()") -} - -func TestFieldnames(t *testing.T) { - testParse(t, false, "interface foo.bar\n type I (Test:[]bool)\nmethod F()->()") - testParse(t, false, "interface foo.bar\n type I (_test:[]bool)\nmethod F()->()") - testParse(t, false, "interface foo.bar\n type I (Ă„est:[]bool)\nmethod F()->()") -} -func TestNestedStructs(t *testing.T) { - testParse(t, true, "interface foo.bar\n type I ( b: [](foo: bool, bar: bool, baz: int) )\nmethod F()->()") -} - -func TestEnum(t *testing.T) { - testParse(t, true, "interface foo.bar\n type I (b:(foo, bar, baz))\nmethod F()->()") - testParse(t, false, "interface foo.bar\n type I (foo, bar, baz : bool)\nmethod F()->()") -} - -func TestIncomplete(t *testing.T) { - testParse(t, false, "interfacef foo.bar\nmethod F()->()") - testParse(t, false, "interface foo.bar\nmethod F()->()\ntype I (b: bool") - testParse(t, false, "interface foo.bar\nmethod F()->(") - testParse(t, false, "interface foo.bar\nmethod F(") - testParse(t, false, "interface foo.bar\nmethod ()->()") - testParse(t, false, "interface foo.bar\nmethod F->()\n") - testParse(t, false, "interface foo.bar\nmethod F()->\n") - testParse(t, false, "interface foo.bar\nmethod F()>()\n") - testParse(t, false, "interface foo.bar\nmethod F()->()\ntype (b: bool)") - testParse(t, false, "interface foo.bar\nmethod F()->()\nerror (b: bool)") - testParse(t, false, "interface foo.bar\nmethod F()->()\n dfghdrg") -} - -func TestDuplicate(t *testing.T) { - testParse(t, false, ` -interface foo.example - type Device() - type Device() - type T() - type T() - method F() -> () - method F() -> () -`) -} diff --git a/vendor/github.com/varlink/go/varlink/service.go b/vendor/github.com/varlink/go/varlink/service.go index eb110e503..84a79d25b 100644 --- a/vendor/github.com/varlink/go/varlink/service.go +++ b/vendor/github.com/varlink/go/varlink/service.go @@ -152,10 +152,6 @@ func activationListener() net.Listener { return nil } - os.Unsetenv("LISTEN_PID") - os.Unsetenv("LISTEN_FDS") - os.Unsetenv("LISTEN_FDNAMES") - return listener } diff --git a/vendor/github.com/varlink/go/varlink/varlink_test.go b/vendor/github.com/varlink/go/varlink/varlink_test.go deleted file mode 100644 index e19e768a2..000000000 --- a/vendor/github.com/varlink/go/varlink/varlink_test.go +++ /dev/null @@ -1,232 +0,0 @@ -package varlink - -// tests with access to internals - -import ( - "bufio" - "bytes" - "fmt" - "strings" - "testing" -) - -func expect(t *testing.T, expected string, returned string) { - if strings.Compare(returned, expected) != 0 { - t.Fatalf("Expected(%d): `%s`\nGot(%d): `%s`\n", - len(expected), expected, - len(returned), strings.Replace(returned, "\000", "`+\"\\000\"+`", -1)) - } -} - -func TestService(t *testing.T) { - service, _ := NewService( - "Varlink", - "Varlink Test", - "1", - "https://github.com/varlink/go/varlink", - ) - - t.Run("ZeroMessage", func(t *testing.T) { - var b bytes.Buffer - w := bufio.NewWriter(&b) - if err := service.handleMessage(w, []byte{0}); err == nil { - t.Fatal("HandleMessage returned non-error") - } - }) - - t.Run("InvalidJson", func(t *testing.T) { - var b bytes.Buffer - w := bufio.NewWriter(&b) - msg := []byte(`{"method":"foo.GetInterfaceDescription" fdgdfg}`) - if err := service.handleMessage(w, msg); err == nil { - t.Fatal("HandleMessage returned no error on invalid json") - } - }) - - t.Run("WrongInterface", func(t *testing.T) { - var b bytes.Buffer - w := bufio.NewWriter(&b) - msg := []byte(`{"method":"foo.GetInterfaceDescription"}`) - if err := service.handleMessage(w, msg); err != nil { - t.Fatal("HandleMessage returned error on wrong interface") - } - expect(t, `{"parameters":{"interface":"foo"},"error":"org.varlink.service.InterfaceNotFound"}`+"\000", - b.String()) - }) - - t.Run("InvalidMethod", func(t *testing.T) { - var b bytes.Buffer - w := bufio.NewWriter(&b) - msg := []byte(`{"method":"InvalidMethod"}`) - if err := service.handleMessage(w, msg); err != nil { - t.Fatal("HandleMessage returned error on invalid method") - } - expect(t, `{"parameters":{"parameter":"method"},"error":"org.varlink.service.InvalidParameter"}`+"\000", - b.String()) - }) - - t.Run("WrongMethod", func(t *testing.T) { - var b bytes.Buffer - w := bufio.NewWriter(&b) - msg := []byte(`{"method":"org.varlink.service.WrongMethod"}`) - if err := service.handleMessage(w, msg); err != nil { - t.Fatal("HandleMessage returned error on wrong method") - } - expect(t, `{"parameters":{"method":"WrongMethod"},"error":"org.varlink.service.MethodNotFound"}`+"\000", - b.String()) - }) - - t.Run("GetInterfaceDescriptionNullParameters", func(t *testing.T) { - var b bytes.Buffer - w := bufio.NewWriter(&b) - msg := []byte(`{"method":"org.varlink.service.GetInterfaceDescription","parameters": null}`) - if err := service.handleMessage(w, msg); err != nil { - t.Fatalf("HandleMessage returned error: %v", err) - } - expect(t, `{"parameters":{"parameter":"parameters"},"error":"org.varlink.service.InvalidParameter"}`+"\000", - b.String()) - }) - - t.Run("GetInterfaceDescriptionNoInterface", func(t *testing.T) { - var b bytes.Buffer - w := bufio.NewWriter(&b) - msg := []byte(`{"method":"org.varlink.service.GetInterfaceDescription","parameters":{}}`) - if err := service.handleMessage(w, msg); err != nil { - t.Fatalf("HandleMessage returned error: %v", err) - } - expect(t, `{"parameters":{"parameter":"interface"},"error":"org.varlink.service.InvalidParameter"}`+"\000", - b.String()) - }) - - t.Run("GetInterfaceDescriptionWrongInterface", func(t *testing.T) { - var b bytes.Buffer - w := bufio.NewWriter(&b) - msg := []byte(`{"method":"org.varlink.service.GetInterfaceDescription","parameters":{"interface":"foo"}}`) - if err := service.handleMessage(w, msg); err != nil { - t.Fatalf("HandleMessage returned error: %v", err) - } - expect(t, `{"parameters":{"parameter":"interface"},"error":"org.varlink.service.InvalidParameter"}`+"\000", - b.String()) - }) - - t.Run("GetInterfaceDescription", func(t *testing.T) { - var b bytes.Buffer - w := bufio.NewWriter(&b) - msg := []byte(`{"method":"org.varlink.service.GetInterfaceDescription","parameters":{"interface":"org.varlink.service"}}`) - if err := service.handleMessage(w, msg); err != nil { - t.Fatalf("HandleMessage returned error: %v", err) - } - expect(t, `{"parameters":{"description":"# The Varlink Service Interface is provided by every varlink service. It\n# describes the service and the interfaces it implements.\ninterface org.varlink.service\n\n# Get a list of all the interfaces a service provides and information\n# about the implementation.\nmethod GetInfo() -\u003e (\n vendor: string,\n product: string,\n version: string,\n url: string,\n interfaces: []string\n)\n\n# Get the description of an interface that is implemented by this service.\nmethod GetInterfaceDescription(interface: string) -\u003e (description: string)\n\n# The requested interface was not found.\nerror InterfaceNotFound (interface: string)\n\n# The requested method was not found\nerror MethodNotFound (method: string)\n\n# The interface defines the requested method, but the service does not\n# implement it.\nerror MethodNotImplemented (method: string)\n\n# One of the passed parameters is invalid.\nerror InvalidParameter (parameter: string)"}}`+"\000", - b.String()) - }) - - t.Run("GetInfo", func(t *testing.T) { - var b bytes.Buffer - w := bufio.NewWriter(&b) - msg := []byte(`{"method":"org.varlink.service.GetInfo"}`) - if err := service.handleMessage(w, msg); err != nil { - t.Fatalf("HandleMessage returned error: %v", err) - } - expect(t, `{"parameters":{"vendor":"Varlink","product":"Varlink Test","version":"1","url":"https://github.com/varlink/go/varlink","interfaces":["org.varlink.service"]}}`+"\000", - b.String()) - }) -} - -type VarlinkInterface struct{} - -func (s *VarlinkInterface) VarlinkDispatch(call Call, methodname string) error { - switch methodname { - case "Ping": - if !call.WantsMore() { - return fmt.Errorf("More flag not passed") - } - if call.IsOneShot() { - return fmt.Errorf("OneShot flag set") - } - call.Continues = true - if err := call.Reply(nil); err != nil { - return err - } - if err := call.Reply(nil); err != nil { - return err - } - call.Continues = false - if err := call.Reply(nil); err != nil { - return err - } - return nil - - case "PingError": - return call.ReplyError("org.example.test.PingError", nil) - } - - call.Continues = true - if err := call.Reply(nil); err == nil { - return fmt.Errorf("call.Reply did not fail for Continues/More mismatch") - } - call.Continues = false - - if err := call.ReplyError("WrongName", nil); err == nil { - return fmt.Errorf("call.ReplyError accepted invalid error name") - } - - if err := call.ReplyError("org.varlink.service.MethodNotImplemented", nil); err == nil { - return fmt.Errorf("call.ReplyError accepted org.varlink.service error") - } - - return call.ReplyMethodNotImplemented(methodname) -} -func (s *VarlinkInterface) VarlinkGetName() string { - return `org.example.test` -} - -func (s *VarlinkInterface) VarlinkGetDescription() string { - return "#" -} - -func TestMoreService(t *testing.T) { - newTestInterface := new(VarlinkInterface) - - service, _ := NewService( - "Varlink", - "Varlink Test", - "1", - "https://github.com/varlink/go/varlink", - ) - - if err := service.RegisterInterface(newTestInterface); err != nil { - t.Fatalf("Couldn't register service: %v", err) - } - - t.Run("MethodNotImplemented", func(t *testing.T) { - var b bytes.Buffer - w := bufio.NewWriter(&b) - msg := []byte(`{"method":"org.example.test.Pingf"}`) - if err := service.handleMessage(w, msg); err != nil { - t.Fatalf("HandleMessage returned error: %v", err) - } - expect(t, `{"parameters":{"method":"Pingf"},"error":"org.varlink.service.MethodNotImplemented"}`+"\000", - b.String()) - }) - - t.Run("PingError", func(t *testing.T) { - var b bytes.Buffer - w := bufio.NewWriter(&b) - msg := []byte(`{"method":"org.example.test.PingError", "more" : true}`) - if err := service.handleMessage(w, msg); err != nil { - t.Fatalf("HandleMessage returned error: %v", err) - } - expect(t, `{"error":"org.example.test.PingError"}`+"\000", - b.String()) - }) - t.Run("MoreTest", func(t *testing.T) { - var b bytes.Buffer - w := bufio.NewWriter(&b) - msg := []byte(`{"method":"org.example.test.Ping", "more" : true}`) - if err := service.handleMessage(w, msg); err != nil { - t.Fatalf("HandleMessage returned error: %v", err) - } - expect(t, `{"continues":true}`+"\000"+`{"continues":true}`+"\000"+`{}`+"\000", - b.String()) - }) -} |