cluster

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Console_APPLET  Console = "applet"
	Console_VV      Console = "vv"
	Console_HTML5   Console = "html5"
	Console_XTERMJS Console = "xtermjs"

	CrsHa_BASIC  CrsHa = "basic"
	CrsHa_STATIC CrsHa = "static"

	Fencing_WATCHDOG Fencing = "watchdog"
	Fencing_HARDWARE Fencing = "hardware"
	Fencing_BOTH     Fencing = "both"

	HaShutdownPolicy_FREEZE      HaShutdownPolicy = "freeze"
	HaShutdownPolicy_FAILOVER    HaShutdownPolicy = "failover"
	HaShutdownPolicy_CONDITIONAL HaShutdownPolicy = "conditional"
	HaShutdownPolicy_MIGRATE     HaShutdownPolicy = "migrate"

	Keyboard_DE    Keyboard = "de"
	Keyboard_DE_CH Keyboard = "de-ch"
	Keyboard_DA    Keyboard = "da"
	Keyboard_EN_GB Keyboard = "en-gb"
	Keyboard_EN_US Keyboard = "en-us"
	Keyboard_ES    Keyboard = "es"
	Keyboard_FI    Keyboard = "fi"
	Keyboard_FR    Keyboard = "fr"
	Keyboard_FR_BE Keyboard = "fr-be"
	Keyboard_FR_CA Keyboard = "fr-ca"
	Keyboard_FR_CH Keyboard = "fr-ch"
	Keyboard_HU    Keyboard = "hu"
	Keyboard_IS    Keyboard = "is"
	Keyboard_IT    Keyboard = "it"
	Keyboard_JA    Keyboard = "ja"
	Keyboard_LT    Keyboard = "lt"
	Keyboard_MK    Keyboard = "mk"
	Keyboard_NL    Keyboard = "nl"
	Keyboard_NO    Keyboard = "no"
	Keyboard_PL    Keyboard = "pl"
	Keyboard_PT    Keyboard = "pt"
	Keyboard_PT_BR Keyboard = "pt-br"
	Keyboard_SV    Keyboard = "sv"
	Keyboard_SL    Keyboard = "sl"
	Keyboard_TR    Keyboard = "tr"

	Language_CA    Language = "ca"
	Language_DA    Language = "da"
	Language_DE    Language = "de"
	Language_EN    Language = "en"
	Language_ES    Language = "es"
	Language_EU    Language = "eu"
	Language_FA    Language = "fa"
	Language_FR    Language = "fr"
	Language_HE    Language = "he"
	Language_IT    Language = "it"
	Language_JA    Language = "ja"
	Language_NB    Language = "nb"
	Language_NN    Language = "nn"
	Language_PL    Language = "pl"
	Language_PT_BR Language = "pt_BR"
	Language_RU    Language = "ru"
	Language_SL    Language = "sl"
	Language_SV    Language = "sv"
	Language_TR    Language = "tr"
	Language_ZH_CN Language = "zh_CN"
	Language_ZH_TW Language = "zh_TW"

	MigrationType_SECURE   MigrationType = "secure"
	MigrationType_INSECURE MigrationType = "insecure"

	NotifyPackageUpdates_AUTO   NotifyPackageUpdates = "auto"
	NotifyPackageUpdates_ALWAYS NotifyPackageUpdates = "always"
	NotifyPackageUpdates_NEVER  NotifyPackageUpdates = "never"

	TagStyleOrdering_CONFIG       TagStyleOrdering = "config"
	TagStyleOrdering_ALPHABETICAL TagStyleOrdering = "alphabetical"

	TagStyleShape_FULL   TagStyleShape = "full"
	TagStyleShape_CIRCLE TagStyleShape = "circle"
	TagStyleShape_DENSE  TagStyleShape = "dense"
	TagStyleShape_NONE   TagStyleShape = "none"

	Type_VM      Type = "vm"
	Type_STORAGE Type = "storage"
	Type_NODE    Type = "node"
	Type_SDN     Type = "sdn"
	Type_POOL    Type = "pool"
	Type_QEMU    Type = "qemu"
	Type_LXC     Type = "lxc"
	Type_OPENVZ  Type = "openvz"
	Type_CLUSTER Type = "cluster"

	UserTagAccessUserAllow_NONE     UserTagAccessUserAllow = "none"
	UserTagAccessUserAllow_LIST     UserTagAccessUserAllow = "list"
	UserTagAccessUserAllow_EXISTING UserTagAccessUserAllow = "existing"
	UserTagAccessUserAllow_FREE     UserTagAccessUserAllow = "free"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bwlimit added in v0.0.10

type Bwlimit struct {

	// The following parameters are optional
	Clone     *float64 `url:"clone,omitempty" json:"clone,omitempty"`         // bandwidth limit in KiB/s for cloning disks
	Default   *float64 `url:"default,omitempty" json:"default,omitempty"`     // default bandwidth limit in KiB/s
	Migration *float64 `url:"migration,omitempty" json:"migration,omitempty"` // bandwidth limit in KiB/s for migrating guests (including moving local disks)
	Move      *float64 `url:"move,omitempty" json:"move,omitempty"`           // bandwidth limit in KiB/s for moving disks
	Restore   *float64 `url:"restore,omitempty" json:"restore,omitempty"`     // bandwidth limit in KiB/s for restoring guests from backups
}

Set bandwidth/io limits various operations.

func (Bwlimit) EncodeValues added in v0.0.10

func (t Bwlimit) EncodeValues(key string, v *url.Values) error

func (*Bwlimit) UnmarshalJSON added in v0.0.19

func (t *Bwlimit) UnmarshalJSON(d []byte) error

type Client

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

func New

func New(c HTTPClient) *Client

func (*Client) GetOptions

func (c *Client) GetOptions(ctx context.Context) (map[string]interface{}, error)

GetOptions Get datacenter options. Without 'Sys.Audit' on '/' not all options are returned.

func (*Client) GetStatus

func (c *Client) GetStatus(ctx context.Context) ([]GetStatusResponse, error)

GetStatus Get cluster status information.

func (*Client) Index

func (c *Client) Index(ctx context.Context) ([]map[string]interface{}, error)

Index Cluster index.

func (*Client) Log

func (c *Client) Log(ctx context.Context, req LogRequest) ([]map[string]interface{}, error)

Log Read cluster log

func (*Client) Nextid

func (c *Client) Nextid(ctx context.Context, req NextidRequest) (int, error)

Nextid Get next free VMID. Pass a VMID to assert that its free (at time of check).

func (*Client) Resources

func (c *Client) Resources(ctx context.Context, req ResourcesRequest) ([]ResourcesResponse, error)

Resources Resources index (cluster wide).

func (*Client) SetOptions

func (c *Client) SetOptions(ctx context.Context, req SetOptionsRequest) error

SetOptions Set datacenter options.

func (*Client) Tasks

func (c *Client) Tasks(ctx context.Context) ([]TasksResponse, error)

Tasks List recent tasks (cluster wide).

type Console added in v0.0.15

type Console string

func PtrConsole added in v0.0.15

func PtrConsole(i Console) *Console

type Crs added in v0.0.10

type Crs struct {

	// The following parameters are optional
	Ha                 *CrsHa        `url:"ha,omitempty" json:"ha,omitempty"`                                       // Use this resource scheduler mode for HA.
	HaRebalanceOnStart *util.PVEBool `url:"ha-rebalance-on-start,omitempty" json:"ha-rebalance-on-start,omitempty"` // Set to use CRS for selecting a suited node when a HA services request-state changes from stop to start.
}

Cluster resource scheduling settings.

func (Crs) EncodeValues added in v0.0.10

func (t Crs) EncodeValues(key string, v *url.Values) error

func (*Crs) UnmarshalJSON added in v0.0.19

func (t *Crs) UnmarshalJSON(d []byte) error

type CrsHa added in v0.0.15

type CrsHa string

func PtrCrsHa added in v0.0.15

func PtrCrsHa(i CrsHa) *CrsHa

type Fencing added in v0.0.15

type Fencing string

func PtrFencing added in v0.0.15

func PtrFencing(i Fencing) *Fencing

type GetStatusResponse

type GetStatusResponse struct {
	Id   string `url:"id" json:"id"`
	Name string `url:"name" json:"name"`
	Type Type   `url:"type" json:"type"` // Indicates the type, either cluster or node. The type defines the object properties e.g. quorate available for type cluster.

	// The following parameters are optional
	Ip      *string       `url:"ip,omitempty" json:"ip,omitempty"`           // [node] IP of the resolved nodename.
	Level   *string       `url:"level,omitempty" json:"level,omitempty"`     // [node] Proxmox VE Subscription level, indicates if eligible for enterprise support as well as access to the stable Proxmox VE Enterprise Repository.
	Local   *util.PVEBool `url:"local,omitempty" json:"local,omitempty"`     // [node] Indicates if this is the responding node.
	Nodeid  *int          `url:"nodeid,omitempty" json:"nodeid,omitempty"`   // [node] ID of the node from the corosync configuration.
	Nodes   *int          `url:"nodes,omitempty" json:"nodes,omitempty"`     // [cluster] Nodes count, including offline nodes.
	Online  *util.PVEBool `url:"online,omitempty" json:"online,omitempty"`   // [node] Indicates if the node is online or offline.
	Quorate *util.PVEBool `url:"quorate,omitempty" json:"quorate,omitempty"` // [cluster] Indicates if there is a majority of nodes online to make decisions
	Version *int          `url:"version,omitempty" json:"version,omitempty"` // [cluster] Current version of the corosync configuration file.
}

type HTTPClient

type HTTPClient interface {
	Do(context.Context, string, string, interface{}, interface{}) error
}

type Ha added in v0.0.10

type Ha struct {
	ShutdownPolicy HaShutdownPolicy `url:"shutdown_policy" json:"shutdown_policy"` // The policy for HA services on node shutdown. 'freeze' disables auto-recovery, 'failover' ensures recovery, 'conditional' recovers on poweroff and freezes on reboot. 'migrate' will migrate running services to other nodes, if possible. With 'freeze' or 'failover', HA Services will always get stopped first on shutdown.

}

Cluster wide HA settings.

func (Ha) EncodeValues added in v0.0.10

func (t Ha) EncodeValues(key string, v *url.Values) error

func (*Ha) UnmarshalJSON added in v0.0.19

func (t *Ha) UnmarshalJSON(d []byte) error

type HaShutdownPolicy added in v0.0.15

type HaShutdownPolicy string

func PtrHaShutdownPolicy added in v0.0.15

func PtrHaShutdownPolicy(i HaShutdownPolicy) *HaShutdownPolicy

type Keyboard added in v0.0.15

type Keyboard string

func PtrKeyboard added in v0.0.15

func PtrKeyboard(i Keyboard) *Keyboard

type Language added in v0.0.15

type Language string

func PtrLanguage added in v0.0.15

func PtrLanguage(i Language) *Language

type LogRequest

type LogRequest struct {

	// The following parameters are optional
	Max *int `url:"max,omitempty" json:"max,omitempty"` // Maximum number of entries.
}

type Migration added in v0.0.10

type Migration struct {
	Type MigrationType `url:"type" json:"type"` // Migration traffic is encrypted using an SSH tunnel by default. On secure, completely private networks this can be disabled to increase performance.

	// The following parameters are optional
	Network *string `url:"network,omitempty" json:"network,omitempty"` // CIDR of the (sub) network that is used for migration.
}

For cluster wide migration settings.

func (Migration) EncodeValues added in v0.0.10

func (t Migration) EncodeValues(key string, v *url.Values) error

func (*Migration) UnmarshalJSON added in v0.0.19

func (t *Migration) UnmarshalJSON(d []byte) error

type MigrationType added in v0.0.15

type MigrationType string

func PtrMigrationType added in v0.0.15

func PtrMigrationType(i MigrationType) *MigrationType

type NextId added in v0.0.10

type NextId struct {

	// The following parameters are optional
	Lower *int `url:"lower,omitempty" json:"lower,omitempty"` // Lower, inclusive boundary for free next-id API range.
	Upper *int `url:"upper,omitempty" json:"upper,omitempty"` // Upper, exclusive boundary for free next-id API range.
}

Control the range for the free VMID auto-selection pool.

func (NextId) EncodeValues added in v0.0.10

func (t NextId) EncodeValues(key string, v *url.Values) error

func (*NextId) UnmarshalJSON added in v0.0.19

func (t *NextId) UnmarshalJSON(d []byte) error

type NextidRequest

type NextidRequest struct {

	// The following parameters are optional
	Vmid *int `url:"vmid,omitempty" json:"vmid,omitempty"` // The (unique) ID of the VM.
}

type Notify added in v0.2.0

type Notify struct {
	PackageUpdates NotifyPackageUpdates `url:"package-updates" json:"package-updates"` // Control when the daily update job should send out notification mails.

}

Cluster-wide notification settings.

func (Notify) EncodeValues added in v0.2.0

func (t Notify) EncodeValues(key string, v *url.Values) error

func (*Notify) UnmarshalJSON added in v0.2.0

func (t *Notify) UnmarshalJSON(d []byte) error

type NotifyPackageUpdates added in v0.2.0

type NotifyPackageUpdates string

func PtrNotifyPackageUpdates added in v0.2.0

func PtrNotifyPackageUpdates(i NotifyPackageUpdates) *NotifyPackageUpdates

type ResourcesRequest

type ResourcesRequest struct {

	// The following parameters are optional
	Type *Type `url:"type,omitempty" json:"type,omitempty"`
}

type ResourcesResponse

type ResourcesResponse struct {
	Id   string `url:"id" json:"id"`
	Type Type   `url:"type" json:"type"` // Resource type.

	// The following parameters are optional
	CgroupMode *int     `url:"cgroup-mode,omitempty" json:"cgroup-mode,omitempty"` // The cgroup mode the node operates under (when type == node).
	Content    *string  `url:"content,omitempty" json:"content,omitempty"`         // Allowed storage content types (when type == storage).
	Cpu        *float64 `url:"cpu,omitempty" json:"cpu,omitempty"`                 // CPU utilization (when type in node,qemu,lxc).
	Disk       *int     `url:"disk,omitempty" json:"disk,omitempty"`               // Used disk space in bytes (when type in storage), used root image spave for VMs (type in qemu,lxc).
	Hastate    *string  `url:"hastate,omitempty" json:"hastate,omitempty"`         // HA service status (for HA managed VMs).
	Level      *string  `url:"level,omitempty" json:"level,omitempty"`             // Support level (when type == node).
	Maxcpu     *float64 `url:"maxcpu,omitempty" json:"maxcpu,omitempty"`           // Number of available CPUs (when type in node,qemu,lxc).
	Maxdisk    *int     `url:"maxdisk,omitempty" json:"maxdisk,omitempty"`         // Storage size in bytes (when type in storage), root image size for VMs (type in qemu,lxc).
	Maxmem     *int     `url:"maxmem,omitempty" json:"maxmem,omitempty"`           // Number of available memory in bytes (when type in node,qemu,lxc).
	Mem        *int     `url:"mem,omitempty" json:"mem,omitempty"`                 // Used memory in bytes (when type in node,qemu,lxc).
	Name       *string  `url:"name,omitempty" json:"name,omitempty"`               // Name of the resource.
	Node       *string  `url:"node,omitempty" json:"node,omitempty"`               // The cluster node name (when type in node,storage,qemu,lxc).
	Plugintype *string  `url:"plugintype,omitempty" json:"plugintype,omitempty"`   // More specific type, if available.
	Pool       *string  `url:"pool,omitempty" json:"pool,omitempty"`               // The pool name (when type in pool,qemu,lxc).
	Status     *string  `url:"status,omitempty" json:"status,omitempty"`           // Resource type dependent status.
	Storage    *string  `url:"storage,omitempty" json:"storage,omitempty"`         // The storage identifier (when type == storage).
	Uptime     *int     `url:"uptime,omitempty" json:"uptime,omitempty"`           // Node uptime in seconds (when type in node,qemu,lxc).
	Vmid       *int     `url:"vmid,omitempty" json:"vmid,omitempty"`               // The numerical vmid (when type in qemu,lxc).
}

type SetOptionsRequest

type SetOptionsRequest struct {

	// The following parameters are optional
	Bwlimit           *Bwlimit       `url:"bwlimit,omitempty" json:"bwlimit,omitempty"`                       // Set bandwidth/io limits various operations.
	Console           *Console       `url:"console,omitempty" json:"console,omitempty"`                       // Select the default Console viewer. You can either use the builtin java applet (VNC; deprecated and maps to html5), an external virt-viewer comtatible application (SPICE), an HTML5 based vnc viewer (noVNC), or an HTML5 based console client (xtermjs). If the selected viewer is not available (e.g. SPICE not activated for the VM), the fallback is noVNC.
	Crs               *Crs           `url:"crs,omitempty" json:"crs,omitempty"`                               // Cluster resource scheduling settings.
	Delete            *string        `url:"delete,omitempty" json:"delete,omitempty"`                         // A list of settings you want to delete.
	Description       *string        `url:"description,omitempty" json:"description,omitempty"`               // Datacenter description. Shown in the web-interface datacenter notes panel. This is saved as comment inside the configuration file.
	EmailFrom         *string        `url:"email_from,omitempty" json:"email_from,omitempty"`                 // Specify email address to send notification from (default is root@$hostname)
	Fencing           *Fencing       `url:"fencing,omitempty" json:"fencing,omitempty"`                       // Set the fencing mode of the HA cluster. Hardware mode needs a valid configuration of fence devices in /etc/pve/ha/fence.cfg. With both all two modes are used. WARNING: 'hardware' and 'both' are EXPERIMENTAL & WIP
	Ha                *Ha            `url:"ha,omitempty" json:"ha,omitempty"`                                 // Cluster wide HA settings.
	HttpProxy         *string        `url:"http_proxy,omitempty" json:"http_proxy,omitempty"`                 // Specify external http proxy which is used for downloads (example: 'http://username:password@host:port/')
	Keyboard          *Keyboard      `url:"keyboard,omitempty" json:"keyboard,omitempty"`                     // Default keybord layout for vnc server.
	Language          *Language      `url:"language,omitempty" json:"language,omitempty"`                     // Default GUI language.
	MacPrefix         *string        `url:"mac_prefix,omitempty" json:"mac_prefix,omitempty"`                 // Prefix for autogenerated MAC addresses.
	MaxWorkers        *int           `url:"max_workers,omitempty" json:"max_workers,omitempty"`               // Defines how many workers (per node) are maximal started on actions like 'stopall VMs' or task from the ha-manager.
	Migration         *Migration     `url:"migration,omitempty" json:"migration,omitempty"`                   // For cluster wide migration settings.
	MigrationUnsecure *util.PVEBool  `url:"migration_unsecure,omitempty" json:"migration_unsecure,omitempty"` // Migration is secure using SSH tunnel by default. For secure private networks you can disable it to speed up migration. Deprecated, use the 'migration' property instead!
	NextId            *NextId        `url:"next-id,omitempty" json:"next-id,omitempty"`                       // Control the range for the free VMID auto-selection pool.
	Notify            *Notify        `url:"notify,omitempty" json:"notify,omitempty"`                         // Cluster-wide notification settings.
	RegisteredTags    *string        `url:"registered-tags,omitempty" json:"registered-tags,omitempty"`       // A list of tags that require a `Sys.Modify` on '/' to set and delete. Tags set here that are also in 'user-tag-access' also require `Sys.Modify`.
	TagStyle          *TagStyle      `url:"tag-style,omitempty" json:"tag-style,omitempty"`                   // Tag style options.
	U2f               *U2f           `url:"u2f,omitempty" json:"u2f,omitempty"`                               // u2f
	UserTagAccess     *UserTagAccess `url:"user-tag-access,omitempty" json:"user-tag-access,omitempty"`       // Privilege options for user-settable tags
	Webauthn          *Webauthn      `url:"webauthn,omitempty" json:"webauthn,omitempty"`                     // webauthn configuration
}

type TagStyle added in v0.0.10

type TagStyle struct {

	// The following parameters are optional
	CaseSensitive *util.PVEBool     `url:"case-sensitive,omitempty" json:"case-sensitive,omitempty"` // Controls if filtering for unique tags on update should check case-sensitive.
	ColorMap      *string           `url:"color-map,omitempty" json:"color-map,omitempty"`           // Manual color mapping for tags (semicolon separated).
	Ordering      *TagStyleOrdering `url:"ordering,omitempty" json:"ordering,omitempty"`             // Controls the sorting of the tags in the web-interface and the API update.
	Shape         *TagStyleShape    `url:"shape,omitempty" json:"shape,omitempty"`                   // Tag shape for the web ui tree. 'full' draws the full tag. 'circle' draws only a circle with the background color. 'dense' only draws a small rectancle (useful when many tags are assigned to each guest).'none' disables showing the tags.
}

Tag style options.

func (TagStyle) EncodeValues added in v0.0.10

func (t TagStyle) EncodeValues(key string, v *url.Values) error

func (*TagStyle) UnmarshalJSON added in v0.0.19

func (t *TagStyle) UnmarshalJSON(d []byte) error

type TagStyleOrdering added in v0.0.15

type TagStyleOrdering string

func PtrTagStyleOrdering added in v0.0.15

func PtrTagStyleOrdering(i TagStyleOrdering) *TagStyleOrdering

type TagStyleShape added in v0.0.15

type TagStyleShape string

func PtrTagStyleShape added in v0.0.15

func PtrTagStyleShape(i TagStyleShape) *TagStyleShape

type TasksResponse

type TasksResponse struct {
	Upid string `url:"upid" json:"upid"`
}

type Type added in v0.0.15

type Type string

func PtrType added in v0.0.15

func PtrType(i Type) *Type

type U2f added in v0.0.10

type U2f struct {

	// The following parameters are optional
	Appid  *string `url:"appid,omitempty" json:"appid,omitempty"`   // U2F AppId URL override. Defaults to the origin.
	Origin *string `url:"origin,omitempty" json:"origin,omitempty"` // U2F Origin override. Mostly useful for single nodes with a single URL.
}

u2f

func (U2f) EncodeValues added in v0.0.10

func (t U2f) EncodeValues(key string, v *url.Values) error

func (*U2f) UnmarshalJSON added in v0.0.19

func (t *U2f) UnmarshalJSON(d []byte) error

type UserTagAccess added in v0.0.10

type UserTagAccess struct {

	// The following parameters are optional
	UserAllow     *UserTagAccessUserAllow `url:"user-allow,omitempty" json:"user-allow,omitempty"`           // Controls tag usage for users without `Sys.Modify` on `/` by either allowing `none`, a `list`, already `existing` or anything (`free`).
	UserAllowList *string                 `url:"user-allow-list,omitempty" json:"user-allow-list,omitempty"` // List of tags users are allowed to set and delete (semicolon separated) for 'user-allow' values 'list' and 'existing'.
}

Privilege options for user-settable tags

func (UserTagAccess) EncodeValues added in v0.0.10

func (t UserTagAccess) EncodeValues(key string, v *url.Values) error

func (*UserTagAccess) UnmarshalJSON added in v0.0.19

func (t *UserTagAccess) UnmarshalJSON(d []byte) error

type UserTagAccessUserAllow added in v0.0.15

type UserTagAccessUserAllow string

func PtrUserTagAccessUserAllow added in v0.0.15

func PtrUserTagAccessUserAllow(i UserTagAccessUserAllow) *UserTagAccessUserAllow

type Webauthn added in v0.0.10

type Webauthn struct {

	// The following parameters are optional
	AllowSubdomains *util.PVEBool `url:"allow-subdomains,omitempty" json:"allow-subdomains,omitempty"` // Whether to allow the origin to be a subdomain, rather than the exact URL.
	Id              *string       `url:"id,omitempty" json:"id,omitempty"`                             // Relying party ID. Must be the domain name without protocol, port or location. Changing this *will* break existing credentials.
	Origin          *string       `url:"origin,omitempty" json:"origin,omitempty"`                     // Site origin. Must be a `https://` URL (or `http://localhost`). Should contain the address users type in their browsers to access the web interface. Changing this *may* break existing credentials.
	Rp              *string       `url:"rp,omitempty" json:"rp,omitempty"`                             // Relying party name. Any text identifier. Changing this *may* break existing credentials.
}

webauthn configuration

func (Webauthn) EncodeValues added in v0.0.10

func (t Webauthn) EncodeValues(key string, v *url.Values) error

func (*Webauthn) UnmarshalJSON added in v0.0.19

func (t *Webauthn) UnmarshalJSON(d []byte) error

Jump to

Keyboard shortcuts

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