rpc

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServerRoute

func ServerRoute(rpcFunction RPCFunction, args any) (any, error)

Types

type AgentPingArgs

type AgentPingArgs struct {
	Ping string
}

type AgentPingResult

type AgentPingResult struct {
	Ping string
	Pong string
	Pid  int
}

func AgentPing

func AgentPing(args AgentPingArgs) (AgentPingResult, error)

type AnsibleExecuteArgs added in v0.0.6

type AnsibleExecuteArgs struct {
	Name               string
	Args               map[string]any
	Environment        map[string]string
	Check              bool
	DebugKeepTempFiles bool
}

type AnsibleExecuteResult added in v0.0.6

type AnsibleExecuteResult struct {
	Stderr       []byte
	Stdout       []byte
	ExitCode     int
	Success      bool
	Result       map[string]any
	DebugTempDir string
}

func AnsibleExecute added in v0.0.6

func AnsibleExecute(args AnsibleExecuteArgs) (AnsibleExecuteResult, error)

type ExecArgs

type ExecArgs struct {
	Command            []string
	Dir                string
	Environment        map[string]string
	Stdin              []byte
	ExpandArgumentVars bool
}

type ExecResult

type ExecResult struct {
	Stdout   []byte
	Stderr   []byte
	ExitCode int
	Pid      int
}

func Exec

func Exec(args ExecArgs) (ExecResult, error)

type FileStatArgs

type FileStatArgs struct {
	Path              string
	FollowSymlinks    bool
	CalculateChecksum bool
}

type FileStatResult

type FileStatResult struct {
	// always returned
	Path   string
	Exists bool

	// usually returned
	BaseName     *string      `json:",omitempty"`
	Size         *int64       `json:",omitempty"`
	FileMode     *fs.FileMode `json:",omitempty"`
	ModifiedTime *time.Time   `json:",omitempty"`

	// depends on FileInfo.Sys()
	AccessTime *time.Time `json:",omitempty"`
	CreateTime *time.Time `json:",omitempty"`
	Dev        *uint64    `json:",omitempty"`
	Gid        *uint64    `json:",omitempty"`
	GroupName  *string    `json:",omitempty"`
	Inode      *uint64    `json:",omitempty"`
	Nlink      *uint64    `json:",omitempty"`
	Uid        *uint64    `json:",omitempty"`
	UserName   *string    `json:",omitempty"`

	// conditional on CalculateChecksum
	SHA256Checksum *string `json:",omitempty"`
}

func FileStat

func FileStat(args FileStatArgs) (FileStatResult, error)

type RPCCall

type RPCCall[T any] struct {
	UUID        string
	RPCFunction RPCFunction
	Args        T
}

type RPCFunction

type RPCFunction string
const (
	RPCAgentPing              RPCFunction = "AgentPing"
	RPCAnsibleExecute         RPCFunction = "AnsibleExecute"
	RPCClose                  RPCFunction = "Close"
	RPCExec                   RPCFunction = "Exec"
	RPCFileStat               RPCFunction = "FileStat"
	RPCSystemdUnitShortStatus RPCFunction = "SystemdUnitShortStatus"
	RPCUntar                  RPCFunction = "Untar"
)

type RPCResult

type RPCResult[T any] struct {
	UUID        string
	RPCFunction RPCFunction
	Result      T
	Error       string
}

type SystemdUnitShortStatusArgs added in v0.0.8

type SystemdUnitShortStatusArgs struct {
	Name string
}

type SystemdUnitShortStatusResult added in v0.0.8

type SystemdUnitShortStatusResult struct {
	Name        string
	Exists      bool
	LoadState   string
	ActiveState string
	SubState    string
}

func SystemdUnitShortStatus added in v0.0.8

func SystemdUnitShortStatus(args SystemdUnitShortStatusArgs) (SystemdUnitShortStatusResult, error)

type UntarArgs added in v0.0.8

type UntarArgs struct {
	SourceFilePath  string
	TargetDirectory string
}

type UntarResult added in v0.0.8

type UntarResult struct{}

func Untar added in v0.0.8

func Untar(args UntarArgs) (UntarResult, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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