Documentation
¶
Index ¶
- Constants
- func InstallScript(user, nodeIP, scriptPath string, skipWait bool) (int, error)
- func InstallScriptInLXC(user, nodeIP string, vmid int, scriptPath string, skipWait bool) (int, error)
- func ValidateConnection(user, nodeIP string) error
- type GitHubContent
- type Plugin
- func (p *Plugin) Description() string
- func (p *Plugin) ID() string
- func (p *Plugin) Initialize(ctx context.Context, app *components.App, registrar components.PluginRegistrar) error
- func (p *Plugin) ModalPageNames() []string
- func (p *Plugin) Name() string
- func (p *Plugin) Shutdown(ctx context.Context) error
- type Script
- type ScriptCategory
- type ScriptSelector
Constants ¶
const ( GitHubRepo = "https://github.com/community-scripts/ProxmoxVE" GitHubAPIRepo = "https://api.github.com/repos/community-scripts/ProxmoxVE" RawGitHubRepo = "https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" )
GitHubRepo is the URL to the Proxmox Community Scripts repository.
const ( ScriptMetadataTTL = 24 * time.Hour // Cache script metadata for 24 hours ScriptListTTL = 12 * time.Hour // Cache script list for 12 hours )
Cache TTLs.
const ( ScriptListCacheKey = "github_script_list" ScriptCacheKeyPrefix = "github_script_" )
Cache keys.
const PluginID = "community-scripts"
PluginID identifies the community scripts plugin when referencing it from configuration.
Variables ¶
This section is empty.
Functions ¶
func InstallScript ¶
InstallScript installs a script on a Proxmox node. Returns the remote exit code (0 on success) and any error encountered. When skipWait is true, it will not prompt/await Enter after completion.
func InstallScriptInLXC ¶ added in v1.0.14
func InstallScriptInLXC(user, nodeIP string, vmid int, scriptPath string, skipWait bool) (int, error)
InstallScriptInLXC installs a script inside an existing LXC container via pct exec. It SSHes to the node, then runs pct exec <vmid> -- bash -c "curl ... | bash".
func ValidateConnection ¶
ValidateConnection checks if SSH connection to the node is possible.
Types ¶
type GitHubContent ¶
type GitHubContent struct {
Name string `json:"name"`
Path string `json:"path"`
Type string `json:"type"` // "file" or "dir"
DownloadURL string `json:"download_url"`
}
GitHubContent represents a file or directory in the GitHub API.
func GetScriptMetadataFiles ¶
func GetScriptMetadataFiles() ([]GitHubContent, error)
GetScriptMetadataFiles fetches the list of script metadata JSON files from the repository.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements the components.Plugin interface to provide community script functionality.
func (*Plugin) Description ¶
Description describes the plugin's purpose.
func (*Plugin) Initialize ¶
func (p *Plugin) Initialize(ctx context.Context, app *components.App, registrar components.PluginRegistrar) error
Initialize wires the plugin into the host application.
func (*Plugin) ModalPageNames ¶ added in v1.0.9
ModalPageNames returns the list of modal page names this plugin registers.
type Script ¶
type Script struct {
Name string `json:"name"`
Slug string `json:"slug"`
Description string `json:"description"`
Categories []int `json:"categories"`
Type string `json:"type"` // "ct" for containers, "vm" for VMs
Updateable bool `json:"updateable"`
Privileged bool `json:"privileged"`
InterfacePort int `json:"interface_port"`
Documentation string `json:"documentation"`
Website string `json:"website"`
ConfigPath string `json:"config_path"`
Logo string `json:"logo"`
ScriptPath string // Added for our use, not in the JSON
DateCreated string `json:"date_created"`
}
Script represents a single script from the repository.
func FetchScripts ¶
FetchScripts fetches all available scripts from the repository.
func GetScriptMetadata ¶
GetScriptMetadata fetches and parses the metadata for a specific script.
func GetScriptsByCategory ¶
GetScriptsByCategory returns scripts for a specific category.
type ScriptCategory ¶
ScriptCategory represents a category of Proxmox scripts.
func GetScriptCategories ¶
func GetScriptCategories() []ScriptCategory
GetScriptCategories returns the available script categories.
type ScriptSelector ¶
ScriptSelector represents a page-based script selector for installing community scripts.
func NewScriptSelector ¶
func NewScriptSelector(app *components.App, node *api.Node, vm *api.VM, user string) *ScriptSelector
NewScriptSelector creates a new script selector.