Documentation ¶
Index ¶
Constants ¶
View Source
const (
// TrySudo is a shell function that tries to execute a command with sudo if the user has sudo permissions.
TrySudo = `try_sudo(){ if [ $(sudo -n pvesm apiinfo 2>&1 | grep "APIVER" | wc -l) -gt 0 ]; then sudo $1; else $1; fi }`
)
Variables ¶
This section is empty.
Functions ¶
func NewErrUserHasNoPermission ¶
NewErrUserHasNoPermission creates a new error indicating that the SSH user does not have required permissions.
Types ¶
type Client ¶
type Client interface { // Username returns the SSH username. Username() string // ExecuteNodeCommands executes a command on a node. ExecuteNodeCommands(ctx context.Context, nodeName string, commands []string) ([]byte, error) // NodeUpload uploads a file to a node. NodeUpload(ctx context.Context, nodeName string, remoteFileDir string, fileUploadRequest *api.FileUploadRequest) error // NodeStreamUpload uploads a file to a node by streaming its content over SSH. NodeStreamUpload(ctx context.Context, nodeName string, remoteFileDir string, fileUploadRequest *api.FileUploadRequest) error }
Client is an interface for performing SSH requests against the Proxmox Nodes.
type NodeResolver ¶
type NodeResolver interface {
Resolve(ctx context.Context, nodeName string) (ProxmoxNode, error)
}
NodeResolver is an interface for resolving node names to IP addresses to use for SSH connection.
type ProxmoxNode ¶
ProxmoxNode represents node address and port for SSH connection.
Click to show internal directories.
Click to hide internal directories.