proxmox

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Clients = pool.New[*Client]("proxmox_clients")
View Source
var Nodes = pool.New[*Node]("proxmox_nodes")

Functions

func AvailableNodeNames

func AvailableNodeNames() string

Types

type Client

type Client struct {
	*proxmox.Client
	proxmox.Cluster
	Version *proxmox.Version
}

func NewClient

func NewClient(baseUrl string, opts ...proxmox.Option) *Client

func (*Client) Key

func (c *Client) Key() string

Key implements pool.Object

func (*Client) MarshalJSON added in v0.11.1

func (c *Client) MarshalJSON() ([]byte, error)

func (*Client) Name

func (c *Client) Name() string

Name implements pool.Object

func (*Client) NumNodes

func (c *Client) NumNodes() int

func (*Client) String

func (c *Client) String() string

func (*Client) UpdateClusterInfo

func (c *Client) UpdateClusterInfo(ctx context.Context) (err error)

type Config

type Config struct {
	URL string `json:"url" validate:"required,url"`

	TokenID string `json:"token_id" validate:"required"`
	Secret  string `json:"secret" validate:"required"`

	NoTLSVerify bool `json:"no_tls_verify" yaml:"no_tls_verify,omitempty"`
	// contains filtered or unexported fields
}

func (*Config) Client

func (c *Config) Client() *Client

func (*Config) Init

func (c *Config) Init() gperr.Error

type LXCAction

type LXCAction string
const (
	LXCStart    LXCAction = "start"
	LXCShutdown LXCAction = "shutdown"
	LXCSuspend  LXCAction = "suspend"
	LXCResume   LXCAction = "resume"
	LXCReboot   LXCAction = "reboot"
)

type LXCStatus

type LXCStatus string
const (
	LXCStatusRunning   LXCStatus = "running"
	LXCStatusStopped   LXCStatus = "stopped"
	LXCStatusSuspended LXCStatus = "suspended" // placeholder, suspending lxc is experimental and the enum is undocumented
)

type Node

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

func (*Node) Get

func (n *Node) Get(ctx context.Context, path string, v any) error

func (*Node) Key

func (n *Node) Key() string

func (*Node) LXCAction

func (n *Node) LXCAction(ctx context.Context, vmid int, action LXCAction) error

func (*Node) LXCGetIPs

func (n *Node) LXCGetIPs(ctx context.Context, vmid int) (res []net.IP, err error)

LXCGetIPs returns the ip addresses of the container it first tries to get the ip addresses from the config if that fails, it gets the ip addresses from the interfaces

func (*Node) LXCGetIPsFromConfig

func (n *Node) LXCGetIPsFromConfig(ctx context.Context, vmid int) (res []net.IP, err error)

LXCGetIPsFromConfig returns the ip addresses of the container from the config

func (*Node) LXCGetIPsFromInterfaces

func (n *Node) LXCGetIPsFromInterfaces(ctx context.Context, vmid int) ([]net.IP, error)

LXCGetIPsFromInterfaces returns the ip addresses of the container from the interfaces it will return nothing if the container is stopped

func (*Node) LXCIsRunning

func (n *Node) LXCIsRunning(ctx context.Context, vmid int) (bool, error)

func (*Node) LXCIsStopped

func (n *Node) LXCIsStopped(ctx context.Context, vmid int) (bool, error)

func (*Node) LXCName

func (n *Node) LXCName(ctx context.Context, vmid int) (string, error)

func (*Node) LXCSetShutdownTimeout

func (n *Node) LXCSetShutdownTimeout(ctx context.Context, vmid int, timeout time.Duration) error

func (*Node) LXCStatus

func (n *Node) LXCStatus(ctx context.Context, vmid int) (LXCStatus, error)

func (*Node) MarshalJSON added in v0.11.1

func (n *Node) MarshalJSON() ([]byte, error)

func (*Node) Name

func (n *Node) Name() string

func (*Node) String

func (n *Node) String() string

Jump to

Keyboard shortcuts

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