server

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ActionUpdateInformation = "update_information"
	ActionUpgradeAgent      = "upgrade_agent"
	ActionRestartAgent      = "restart_agent"
	ActionInstallPAM        = "install_pam"
)

Server action identifiers accepted by the actions endpoint.

Variables

View Source
var ErrRegistrationTokenNotFound = errors.New("no registration token found with the given name")

ErrRegistrationTokenNotFound is returned when no registration token matches the given name.

Functions

func DeleteRegistrationToken added in v1.4.4

func DeleteRegistrationToken(ac *client.AlpaconClient, tokenName string) error

DeleteRegistrationToken resolves a token name to its ID and sends a DELETE request.

func DeleteServer

func DeleteServer(ac *client.AlpaconClient, serverName string) error

func GetServerDetail

func GetServerDetail(ac *client.AlpaconClient, serverName string) ([]byte, error)

func GetServerIDByName

func GetServerIDByName(ac *client.AlpaconClient, serverName string) (string, error)

func GetServerNames added in v1.18.0

func GetServerNames(ac *client.AlpaconClient) (map[string]string, error)

GetServerNames maps every server's id to its name.

func RequestServerAction added in v1.9.2

func RequestServerAction(ac *client.AlpaconClient, serverName, action string, force bool) error

func ResolveServerNames added in v1.5.0

func ResolveServerNames(ac *client.AlpaconClient, names []string) ([]string, error)

ResolveServerNames converts server names to their UUIDs, one request per name.

func UpdateServer added in v1.2.0

func UpdateServer(ac *client.AlpaconClient, serverName string) ([]byte, error)

Types

type AnsibleGuideJsonResponse added in v1.5.0

type AnsibleGuideJsonResponse struct {
	RegistrationGuideMeta
	RegistrationToken string `json:"registration_token"`
	CollectionInstall string `json:"collection_install"`
	RunCommandQuick   string `json:"run_command_quick"`
	InventorySnippet  string `json:"inventory_snippet"`
	PlaybookSnippet   string `json:"playbook_snippet"`
	RunCommandCustom  string `json:"run_command_custom"`
}

AnsibleGuideJsonResponse is the structured JSON response from the Ansible registration method guide API.

func GetAnsibleRegistrationGuideJSON added in v1.5.0

func GetAnsibleRegistrationGuideJSON(ac *client.AlpaconClient, platform, serverName, tokenID string) (AnsibleGuideJsonResponse, error)

type RegistrationGuideMeta added in v1.5.0

type RegistrationGuideMeta struct {
	MethodID         string  `json:"method_id"`
	Platform         string  `json:"platform"`
	PlatformLabel    string  `json:"platform_label"`
	AlpaconURL       string  `json:"alpacon_url"`
	ServerName       string  `json:"server_name"`
	PackageProxy     *string `json:"package_proxy"`
	AllowSudoWithMFA bool    `json:"allow_sudo_with_mfa"`
}

RegistrationGuideMeta holds the fields shared by every registration method guide response. Embedded into method-specific response types so JSON output stays flat on the wire.

type RegistrationMethodGuideJsonResponse added in v1.4.2

type RegistrationMethodGuideJsonResponse struct {
	RegistrationGuideMeta
	TokenKey        string   `json:"token_key"`
	InstallCommands []string `json:"install_commands"`
	RegisterCommand string   `json:"register_command"`
}

RegistrationMethodGuideJsonResponse is the structured JSON response from the guide API.

func GetRegistrationGuideJSON added in v1.4.2

func GetRegistrationGuideJSON(ac *client.AlpaconClient, platform, serverName, tokenID string) (RegistrationMethodGuideJsonResponse, error)

type RegistrationMethodGuideRequest added in v1.4.2

type RegistrationMethodGuideRequest struct {
	Platform          string `json:"platform"`
	ServerName        string `json:"server_name,omitempty"`
	RegistrationToken string `json:"registration_token,omitempty"`
}

RegistrationMethodGuideRequest is the request body for the guide API.

type RegistrationTokenAttributes added in v1.4.4

type RegistrationTokenAttributes struct {
	Name          string          `json:"name"`
	AllowedGroups string          `json:"allowed_groups" table:"Allowed Groups"`
	ExpiresAt     utils.Timestamp `json:"expires_at" table:"Expires At"`
	Enabled       bool            `json:"enabled"`
}

RegistrationTokenAttributes is the 'server token ls' row. AllowedGroups joins group names, or the UUIDs left unresolved; a token without ExpiresAt shows "never" in a table and null in JSON.

func GetRegistrationTokenAttributes added in v1.4.4

func GetRegistrationTokenAttributes(ac *client.AlpaconClient) ([]RegistrationTokenAttributes, error)

GetRegistrationTokenAttributes returns every registration token projected for table/JSON display. Group UUIDs are resolved with one paginated lookup of the group list; if that fails, the UUIDs are shown as-is.

type RegistrationTokenCreatedResponse added in v1.4.2

type RegistrationTokenCreatedResponse struct {
	ID            string   `json:"id"`
	Name          string   `json:"name"`
	AllowedGroups []string `json:"allowed_groups"`
	Key           string   `json:"key"`
	ExpiresAt     *string  `json:"expires_at"`
	AddedAt       string   `json:"added_at"`
}

RegistrationTokenCreatedResponse holds the result after creating a server registration token. The Key field is only returned once at creation time.

func CreateRegistrationToken added in v1.4.2

type RegistrationTokenDetails added in v1.4.2

type RegistrationTokenDetails struct {
	ID            string   `json:"id"`
	Name          string   `json:"name"`
	AllowedGroups []string `json:"allowed_groups"`
	Enabled       bool     `json:"enabled"`
	ExpiresAt     *string  `json:"expires_at"`
	AddedAt       string   `json:"added_at"`
}

RegistrationTokenDetails is used when listing or looking up existing tokens. The Key field is not included—it is only available at creation time.

func GetRegistrationTokenByName added in v1.4.2

func GetRegistrationTokenByName(ac *client.AlpaconClient, name string) (RegistrationTokenDetails, error)

func ListRegistrationTokens added in v1.4.2

func ListRegistrationTokens(ac *client.AlpaconClient) ([]RegistrationTokenDetails, error)

type RegistrationTokenRequest added in v1.4.2

type RegistrationTokenRequest struct {
	Name          string   `json:"name"`
	AllowedGroups []string `json:"allowed_groups,omitempty"`
	ExpiresAt     *string  `json:"expires_at,omitempty"`
}

RegistrationTokenRequest is used to create a new server registration token. ExpiresAt is an RFC3339 timestamp; omitted, the server assigns the workspace maximum.

type ServerAttributes

type ServerAttributes struct {
	Name      string `json:"name"`
	IP        string `json:"ip" table:"IP"`
	OS        string `json:"os" table:"OS"`
	Connected bool   `json:"connected"`
}

func GetServerList

func GetServerList(ac *client.AlpaconClient) ([]ServerAttributes, error)

type ServerDetails

type ServerDetails struct {
	ID               string    `json:"id"`
	Name             string    `json:"name"`
	RemoteIP         string    `json:"remote_ip"`
	IsConnected      bool      `json:"is_connected"`
	Commissioned     bool      `json:"commissioned"`
	Starred          bool      `json:"starred"`
	CPUPhysicalCores int       `json:"cpu_physical_cores"`
	CPULogicalCores  int       `json:"cpu_logical_cores"`
	CPUType          string    `json:"cpu_type"`
	PhysicalMemory   int64     `json:"physical_memory"`
	OSName           string    `json:"os_name"`
	OSVersion        string    `json:"os_version"`
	Platform         string    `json:"platform"`
	Load             float64   `json:"load"`
	BootTime         time.Time `json:"boot_time"`
	Groups           []string  `json:"groups"`
}

type ServerRef added in v1.20.0

type ServerRef struct {
	ID       string
	Platform string
}

ServerRef is a resolved server: its ID and the platform its Alpamon registered with.

func GetServerByName added in v1.20.0

func GetServerByName(ac *client.AlpaconClient, serverName string) (ServerRef, error)

GetServerByName resolves a server's ID and platform in one request.

func (ServerRef) Windows added in v1.20.0

func (s ServerRef) Windows() bool

Windows reports whether the server's paths follow Windows rules.

Jump to

Keyboard shortcuts

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