...

Package import1

import "github.com/coreos/go-systemd/v22/import1"
Overview
Index

Overview ▾

Package import1 provides integration with the systemd-importd API. See https://www.freedesktop.org/wiki/Software/systemd/importd/ Note: Requires systemd v231 or higher

type Conn

Conn is a connection to systemds dbus endpoint.

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

func New

func New() (*Conn, error)

New establishes a connection to the system bus and authenticates. Note: systemd-importd will be activated via D-Bus, we don't need to check service status.

func (*Conn) CancelTransfer

func (c *Conn) CancelTransfer(transfer_id uint32) error

CancelTransfer will cancel an ongoing import, export or download operations.

func (*Conn) Connected

func (c *Conn) Connected() bool

Connected returns whether conn is connected

func (*Conn) ExportRaw

func (c *Conn) ExportRaw(
    local_name string, f *os.File, format string,
) (*Transfer, error)

ExportRaw exports a raw image from systemd-importd.

func (*Conn) ExportTar

func (c *Conn) ExportTar(
    local_name string, f *os.File, format string,
) (*Transfer, error)

ExportTar exports a tar from systemd-importd.

func (*Conn) ImportRaw

func (c *Conn) ImportRaw(
    f *os.File, local_name string, force, read_only bool,
) (*Transfer, error)

ImportRaw imports a raw image into systemd-importd.

func (*Conn) ImportTar

func (c *Conn) ImportTar(
    f *os.File, local_name string, force, read_only bool,
) (*Transfer, error)

ImportTar imports a tar into systemd-importd.

func (*Conn) ListTransfers

func (c *Conn) ListTransfers() ([]TransferStatus, error)

ListTransfers will list ongoing import, export or download operations.

func (*Conn) PullRaw

func (c *Conn) PullRaw(
    url, local_name, verify_mode string, force bool,
) (*Transfer, error)

PullRaw pulls a raw image into systemd-importd.

func (*Conn) PullTar

func (c *Conn) PullTar(
    url, local_name, verify_mode string, force bool,
) (*Transfer, error)

PullTar pulls a tar into systemd-importd.

type Transfer

Transfer is an object in dbus for an import, export or download operation.

type Transfer struct {
    Id   uint32          // The numeric transfer ID of the transfer object
    Path dbus.ObjectPath // The dbus objectPath for the transfer
}

type TransferStatus

TransferStatus is the status for an import, export or download operation.

type TransferStatus struct {
    Id       uint32  // The numeric transfer ID of the transfer object
    Local    string  // The local container name of this transfer
    Remote   string  // The remote source (in case of download: the URL, in case of import/export a string describing the file descriptor passed in)
    Type     string  // The type of operation
    Verify   string  // The selected verification setting, and is only defined for download operations
    Progress float64 // The current progress of the transfer, as a value between 0.0 and 1.0
}