containers

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MPL-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	api.Client
	VMID int
}

Client is an interface for accessing the Proxmox container API.

func (*Client) CloneContainer

func (c *Client) CloneContainer(ctx context.Context, d *CloneRequestBody) error

CloneContainer clones a container.

func (*Client) CreateContainer

func (c *Client) CreateContainer(ctx context.Context, d *CreateRequestBody, timeout int) error

CreateContainer creates a container.

func (*Client) CreateContainerAsync added in v0.25.0

func (c *Client) CreateContainerAsync(ctx context.Context, d *CreateRequestBody) (*string, error)

CreateContainerAsync creates a container asynchronously.

func (*Client) DeleteContainer

func (c *Client) DeleteContainer(ctx context.Context) error

DeleteContainer deletes a container.

func (*Client) ExpandPath

func (c *Client) ExpandPath(path string) string

ExpandPath expands a relative path to a full container API path.

func (*Client) Firewall

func (c *Client) Firewall() firewall.API

Firewall returns a client for managing the container firewall.

func (*Client) GetContainer

func (c *Client) GetContainer(ctx context.Context) (*GetResponseData, error)

GetContainer retrieves a container.

func (*Client) GetContainerStatus

func (c *Client) GetContainerStatus(ctx context.Context) (*GetStatusResponseData, error)

GetContainerStatus retrieves the status for a container.

func (*Client) RebootContainer

func (c *Client) RebootContainer(ctx context.Context, d *RebootRequestBody) error

RebootContainer reboots a container.

func (*Client) ShutdownContainer

func (c *Client) ShutdownContainer(ctx context.Context, d *ShutdownRequestBody) error

ShutdownContainer shuts down a container.

func (*Client) StartContainer

func (c *Client) StartContainer(ctx context.Context, timeout int) error

StartContainer starts a container if is not already running.

func (*Client) StartContainerAsync added in v0.25.0

func (c *Client) StartContainerAsync(ctx context.Context) (*string, error)

StartContainerAsync starts a container asynchronously.

func (*Client) StopContainer

func (c *Client) StopContainer(ctx context.Context) error

StopContainer stops a container immediately.

func (*Client) Tasks added in v0.25.0

func (c *Client) Tasks() *tasks.Client

Tasks returns a client for managing container tasks.

func (*Client) UpdateContainer

func (c *Client) UpdateContainer(ctx context.Context, d *UpdateRequestBody) error

UpdateContainer updates a container.

func (*Client) WaitForContainerLock

func (c *Client) WaitForContainerLock(ctx context.Context, timeout int, delay int, ignoreErrorResponse bool) error

WaitForContainerLock waits for a container lock to be released.

func (*Client) WaitForContainerStatus added in v0.34.0

func (c *Client) WaitForContainerStatus(ctx context.Context, status string, timeout int, delay int) error

WaitForContainerStatus waits for a container to reach a specific state.

type CloneRequestBody

type CloneRequestBody struct {
	BandwidthLimit *int              `json:"bwlimit,omitempty"     url:"bwlimit,omitempty"`
	Description    *string           `json:"description,omitempty" url:"description,omitempty"`
	FullCopy       *types.CustomBool `json:"full,omitempty"        url:"full,omitempty,int"`
	Hostname       *string           `json:"hostname,omitempty"    url:"hostname,omitempty"`
	PoolID         *string           `json:"pool,omitempty"        url:"pool,omitempty"`
	SnapshotName   *string           `json:"snapname,omitempty"    url:"snapname,omitempty"`
	TargetNodeName *string           `json:"target,omitempty"      url:"target,omitempty"`
	TargetStorage  *string           `json:"storage,omitempty"     url:"storage,omitempty"`
	VMIDNew        int               `json:"newid"                 url:"newid"`
}

CloneRequestBody contains the data for an container clone request.

type CreateRequestBody

type CreateRequestBody struct {
	BandwidthLimit       *float64                    `json:"bwlimit,omitempty"              url:"bwlimit,omitempty"`
	ConsoleEnabled       *types.CustomBool           `json:"console,omitempty"              url:"console,omitempty,int"`
	ConsoleMode          *string                     `json:"cmode,omitempty"                url:"cmode,omitempty"`
	CPUArchitecture      *string                     `json:"arch,omitempty"                 url:"arch,omitempty"`
	CPUCores             *int                        `json:"cores,omitempty"                url:"cores,omitempty"`
	CPULimit             *int                        `json:"cpulimit,omitempty"             url:"cpulimit,omitempty"`
	CPUUnits             *int                        `json:"cpuunits,omitempty"             url:"cpuunits,omitempty"`
	DatastoreID          *string                     `json:"storage,omitempty"              url:"storage,omitempty"`
	DedicatedMemory      *int                        `json:"memory,omitempty"               url:"memory,omitempty"`
	Delete               []string                    `json:"delete,omitempty"               url:"delete,omitempty"`
	Description          *string                     `json:"description,omitempty"          url:"description,omitempty"`
	DNSDomain            *string                     `json:"searchdomain,omitempty"         url:"searchdomain,omitempty"`
	DNSServer            *string                     `json:"nameserver,omitempty"           url:"nameserver,omitempty"`
	Features             *CustomFeatures             `json:"features,omitempty"             url:"features,omitempty"`
	Force                *types.CustomBool           `json:"force,omitempty"                url:"force,omitempty,int"`
	HookScript           *string                     `json:"hookscript,omitempty"           url:"hookscript,omitempty"`
	Hostname             *string                     `json:"hostname,omitempty"             url:"hostname,omitempty"`
	IgnoreUnpackErrors   *types.CustomBool           `json:"ignore-unpack-errors,omitempty" url:"force,omitempty,int"`
	Lock                 *string                     `json:"lock,omitempty"                 url:"lock,omitempty,int"`
	MountPoints          CustomMountPointArray       `json:"mp,omitempty"                   url:"mp,omitempty,numbered"`
	NetworkInterfaces    CustomNetworkInterfaceArray `json:"net,omitempty"                  url:"net,omitempty,numbered"`
	OSTemplateFileVolume *string                     `json:"ostemplate,omitempty"           url:"ostemplate,omitempty"`
	OSType               *string                     `json:"ostype,omitempty"               url:"ostype,omitempty"`
	Password             *string                     `json:"password,omitempty"             url:"password,omitempty"`
	PoolID               *string                     `json:"pool,omitempty"                 url:"pool,omitempty"`
	Protection           *types.CustomBool           `json:"protection,omitempty"           url:"protection,omitempty,int"`
	Restore              *types.CustomBool           `json:"restore,omitempty"              url:"restore,omitempty,int"`
	RootFS               *CustomRootFS               `json:"rootfs,omitempty"               url:"rootfs,omitempty"`
	SSHKeys              *CustomSSHKeys              `json:"ssh-public-keys,omitempty"      url:"ssh-public-keys,omitempty"`
	Start                *types.CustomBool           `json:"start,omitempty"                url:"start,omitempty,int"`
	StartOnBoot          *types.CustomBool           `json:"onboot,omitempty"               url:"onboot,omitempty,int"`
	StartupBehavior      *CustomStartupBehavior      `json:"startup,omitempty"              url:"startup,omitempty"`
	Swap                 *int                        `json:"swap,omitempty"                 url:"swap,omitempty"`
	Tags                 *string                     `json:"tags,omitempty"                 url:"tags,omitempty"`
	Template             *types.CustomBool           `json:"template,omitempty"             url:"template,omitempty,int"`
	TTY                  *int                        `json:"tty,omitempty"                  url:"tty,omitempty"`
	Unique               *types.CustomBool           `json:"unique,omitempty"               url:"unique,omitempty,int"`
	Unprivileged         *types.CustomBool           `json:"unprivileged,omitempty"         url:"unprivileged,omitempty,int"`
	VMID                 *int                        `json:"vmid,omitempty"                 url:"vmid,omitempty"`
}

CreateRequestBody contains the data for a user create request.

type CreateResponseBody added in v0.25.0

type CreateResponseBody struct {
	Data *string `json:"data,omitempty"`
}

CreateResponseBody contains the body from a container create response.

type CustomFeatures

type CustomFeatures struct {
	FUSE       *types.CustomBool `json:"fuse,omitempty"    url:"fuse,omitempty,int"`
	KeyControl *types.CustomBool `json:"keyctl,omitempty"  url:"keyctl,omitempty,int"`
	MountTypes *[]string         `json:"mount,omitempty"   url:"mount,omitempty"`
	Nesting    *types.CustomBool `json:"nesting,omitempty" url:"nesting,omitempty,int"`
}

CustomFeatures contains the values for the "features" property.

func (*CustomFeatures) EncodeValues

func (r *CustomFeatures) EncodeValues(key string, v *url.Values) error

EncodeValues converts a ContainerCustomFeatures struct to a URL value.

func (*CustomFeatures) UnmarshalJSON

func (r *CustomFeatures) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a ContainerCustomFeatures string to an object.

type CustomMountPoint

type CustomMountPoint struct {
	ACL          *types.CustomBool `json:"acl,omitempty"          url:"acl,omitempty,int"`
	Backup       *types.CustomBool `json:"backup,omitempty"       url:"backup,omitempty,int"`
	DiskSize     *string           `json:"size,omitempty"         url:"size,omitempty"` // read-only
	Enabled      bool              `json:"-"                      url:"-"`
	MountOptions *[]string         `json:"mountoptions,omitempty" url:"mountoptions,omitempty"`
	MountPoint   string            `json:"mp"                     url:"mp"`
	Quota        *types.CustomBool `json:"quota,omitempty"        url:"quota,omitempty,int"`
	ReadOnly     *types.CustomBool `json:"ro,omitempty"           url:"ro,omitempty,int"`
	Replicate    *types.CustomBool `json:"replicate,omitempty"    url:"replicate,omitempty,int"`
	Shared       *types.CustomBool `json:"shared,omitempty"       url:"shared,omitempty,int"`
	Volume       string            `json:"volume"                 url:"volume"`
}

CustomMountPoint contains the values for the "mp[n]" properties.

func (*CustomMountPoint) EncodeValues

func (r *CustomMountPoint) EncodeValues(key string, v *url.Values) error

EncodeValues converts a CustomMountPoint struct to a URL value.

func (*CustomMountPoint) UnmarshalJSON

func (r *CustomMountPoint) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a CustomMountPoint string to an object.

type CustomMountPointArray

type CustomMountPointArray []CustomMountPoint

CustomMountPointArray is an array of CustomMountPoint.

func (CustomMountPointArray) EncodeValues

func (r CustomMountPointArray) EncodeValues(
	key string,
	v *url.Values,
) error

EncodeValues converts a CustomMountPointArray array to multiple URL values.

type CustomNetworkInterface

type CustomNetworkInterface struct {
	Bridge      *string           `json:"bridge,omitempty"   url:"bridge,omitempty"`
	Enabled     bool              `json:"-"                  url:"-"`
	Firewall    *types.CustomBool `json:"firewall,omitempty" url:"firewall,omitempty,int"`
	IPv4Address *string           `json:"ip,omitempty"       url:"ip,omitempty"`
	IPv4Gateway *string           `json:"gw,omitempty"       url:"gw,omitempty"`
	IPv6Address *string           `json:"ip6,omitempty"      url:"ip6,omitempty"`
	IPv6Gateway *string           `json:"gw6,omitempty"      url:"gw6,omitempty"`
	MACAddress  *string           `json:"hwaddr,omitempty"   url:"hwaddr,omitempty"`
	MTU         *int              `json:"mtu,omitempty"      url:"mtu,omitempty"`
	Name        string            `json:"name"               url:"name"`
	RateLimit   *float64          `json:"rate,omitempty"     url:"rate,omitempty"`
	Tag         *int              `json:"tag,omitempty"      url:"tag,omitempty"`
	Trunks      *[]int            `json:"trunks,omitempty"   url:"trunks,omitempty"`
	Type        *string           `json:"type,omitempty"     url:"type,omitempty"`
}

CustomNetworkInterface contains the values for the "net[n]" properties.

func (*CustomNetworkInterface) EncodeValues

func (r *CustomNetworkInterface) EncodeValues(
	key string,
	v *url.Values,
) error

EncodeValues converts a CustomNetworkInterface struct to a URL value.

func (*CustomNetworkInterface) UnmarshalJSON

func (r *CustomNetworkInterface) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a CustomNetworkInterface string to an object.

type CustomNetworkInterfaceArray

type CustomNetworkInterfaceArray []CustomNetworkInterface

CustomNetworkInterfaceArray is an array of CustomNetworkInterface.

func (CustomNetworkInterfaceArray) EncodeValues

func (r CustomNetworkInterfaceArray) EncodeValues(
	key string,
	v *url.Values,
) error

EncodeValues converts a CustomNetworkInterfaceArray array to multiple URL values.

type CustomRootFS

type CustomRootFS struct {
	ACL          *types.CustomBool `json:"acl,omitempty"          url:"acl,omitempty,int"`
	Size         *types.DiskSize   `json:"size,omitempty"         url:"size,omitempty"`
	MountOptions *[]string         `json:"mountoptions,omitempty" url:"mountoptions,omitempty"`
	Quota        *types.CustomBool `json:"quota,omitempty"        url:"quota,omitempty,int"`
	ReadOnly     *types.CustomBool `json:"ro,omitempty"           url:"ro,omitempty,int"`
	Replicate    *types.CustomBool `json:"replicate,omitempty"    url:"replicate,omitempty,int"`
	Shared       *types.CustomBool `json:"shared,omitempty"       url:"shared,omitempty,int"`
	Volume       string            `json:"volume"                 url:"volume"`
}

CustomRootFS contains the values for the "rootfs" property.

func (*CustomRootFS) EncodeValues

func (r *CustomRootFS) EncodeValues(key string, v *url.Values) error

EncodeValues converts a CustomRootFS struct to a URL value.

func (*CustomRootFS) UnmarshalJSON

func (r *CustomRootFS) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a CustomRootFS string to an object.

type CustomSSHKeys

type CustomSSHKeys []string

CustomSSHKeys contains the values for the "ssh-public-keys" property.

func (CustomSSHKeys) EncodeValues

func (r CustomSSHKeys) EncodeValues(key string, v *url.Values) error

EncodeValues converts a CustomSSHKeys array to a URL value.

type CustomStartupBehavior

type CustomStartupBehavior struct {
	Down  *int `json:"down,omitempty"  url:"down,omitempty"`
	Order *int `json:"order,omitempty" url:"order,omitempty"`
	Up    *int `json:"up,omitempty"    url:"up,omitempty"`
}

CustomStartupBehavior contains the values for the "startup" property.

func (*CustomStartupBehavior) EncodeValues

func (r *CustomStartupBehavior) EncodeValues(
	key string,
	v *url.Values,
) error

EncodeValues converts a CustomStartupBehavior struct to a URL value.

func (*CustomStartupBehavior) UnmarshalJSON

func (r *CustomStartupBehavior) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a CustomStartupBehavior string to an object.

type GetResponseBody

type GetResponseBody struct {
	Data *GetResponseData `json:"data,omitempty"`
}

GetResponseBody contains the body from a user get response.

type GetResponseData

type GetResponseData struct {
	ConsoleEnabled    *types.CustomBool       `json:"console,omitempty"`
	ConsoleMode       *string                 `json:"cmode,omitempty"`
	CPUArchitecture   *string                 `json:"arch,omitempty"`
	CPUCores          *int                    `json:"cores,omitempty"`
	CPULimit          *types.CustomInt        `json:"cpulimit,omitempty"`
	CPUUnits          *int                    `json:"cpuunits,omitempty"`
	DedicatedMemory   *int                    `json:"memory,omitempty"`
	Description       *string                 `json:"description,omitempty"`
	Digest            string                  `json:"digest"`
	DNSDomain         *string                 `json:"searchdomain,omitempty"`
	DNSServer         *string                 `json:"nameserver,omitempty"`
	Features          *CustomFeatures         `json:"features,omitempty"`
	HookScript        *string                 `json:"hookscript,omitempty"`
	Hostname          *string                 `json:"hostname,omitempty"`
	Lock              *types.CustomBool       `json:"lock,omitempty"`
	LXCConfiguration  *[][2]string            `json:"lxc,omitempty"`
	MountPoint0       *CustomMountPoint       `json:"mp0,omitempty"`
	MountPoint1       *CustomMountPoint       `json:"mp1,omitempty"`
	MountPoint2       *CustomMountPoint       `json:"mp2,omitempty"`
	MountPoint3       *CustomMountPoint       `json:"mp3,omitempty"`
	MountPoint4       *CustomMountPoint       `json:"mp4,omitempty"`
	MountPoint5       *CustomMountPoint       `json:"mp5,omitempty"`
	MountPoint6       *CustomMountPoint       `json:"mp6,omitempty"`
	MountPoint7       *CustomMountPoint       `json:"mp7,omitempty"`
	NetworkInterface0 *CustomNetworkInterface `json:"net0,omitempty"`
	NetworkInterface1 *CustomNetworkInterface `json:"net1,omitempty"`
	NetworkInterface2 *CustomNetworkInterface `json:"net2,omitempty"`
	NetworkInterface3 *CustomNetworkInterface `json:"net3,omitempty"`
	NetworkInterface4 *CustomNetworkInterface `json:"net4,omitempty"`
	NetworkInterface5 *CustomNetworkInterface `json:"net5,omitempty"`
	NetworkInterface6 *CustomNetworkInterface `json:"net6,omitempty"`
	NetworkInterface7 *CustomNetworkInterface `json:"net7,omitempty"`
	OSType            *string                 `json:"ostype,omitempty"`
	Protection        *types.CustomBool       `json:"protection,omitempty"`
	RootFS            *CustomRootFS           `json:"rootfs,omitempty"`
	StartOnBoot       *types.CustomBool       `json:"onboot,omitempty"`
	StartupBehavior   *CustomStartupBehavior  `json:"startup,omitempty"`
	Swap              *int                    `json:"swap,omitempty"`
	Tags              *string                 `json:"tags,omitempty"`
	Template          *types.CustomBool       `json:"template,omitempty"`
	TTY               *int                    `json:"tty,omitempty"`
	Unprivileged      *types.CustomBool       `json:"unprivileged,omitempty"`
}

GetResponseData contains the data from a user get response.

type GetStatusResponseBody

type GetStatusResponseBody struct {
	Data *GetStatusResponseData `json:"data,omitempty"`
}

GetStatusResponseBody contains the body from a container get status response.

type GetStatusResponseData

type GetStatusResponseData struct {
	CPUCount         *float64         `json:"cpus,omitempty"`
	Lock             *string          `json:"lock,omitempty"`
	MemoryAllocation *int             `json:"maxmem,omitempty"`
	Name             *string          `json:"name,omitempty"`
	RootDiskSize     *interface{}     `json:"maxdisk,omitempty"`
	Status           string           `json:"status,omitempty"`
	SwapAllocation   *int             `json:"maxswap,omitempty"`
	Tags             *string          `json:"tags,omitempty"`
	Uptime           *int             `json:"uptime,omitempty"`
	VMID             *types.CustomInt `json:"vmid,omitempty"`
}

GetStatusResponseData contains the data from a container get status response.

type RebootRequestBody

type RebootRequestBody struct {
	Timeout *int `json:"timeout,omitempty" url:"timeout,omitempty"`
}

RebootRequestBody contains the body for a container reboot request.

type ShutdownRequestBody

type ShutdownRequestBody struct {
	ForceStop *types.CustomBool `json:"forceStop,omitempty" url:"forceStop,omitempty,int"`
	Timeout   *int              `json:"timeout,omitempty"   url:"timeout,omitempty"`
}

ShutdownRequestBody contains the body for a container shutdown request.

type StartResponseBody added in v0.25.0

type StartResponseBody struct {
	Data *string `json:"data,omitempty"`
}

StartResponseBody contains the body from a container start response.

type UpdateRequestBody

type UpdateRequestBody CreateRequestBody

UpdateRequestBody contains the data for an user update request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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