command

package
v0.0.0-...-b60b6a8 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResponseStatusOk    = "ok"
	ResponseStatusError = "error"
)

Variables

View Source
var (
	ErrUnknownMessage = errors.New("unknown command type")
)

Message errors

Functions

func Encode

func Encode(m Message) ([]byte, error)

Encode encodes the message instance to a JSON buffer object

Types

type Message

type Message interface {
	GetName() MessageName
}

Message represents the message interface

func Decode

func Decode(data []byte) (Message, error)

Decode decodes JSON data into a message instance

type MessageName

type MessageName string

MessageName is a message ID type

const (
	StartMonitorName   MessageName = "cmd.monitor.start"
	StopMonitorName    MessageName = "cmd.monitor.stop"
	ShutdownSensorName MessageName = "cmd.sensor.shutdown"
)

Supported messages

type Response

type Response struct {
	Status string `json:"status"`
}

Response contains the command response status information

type ShutdownSensor

type ShutdownSensor struct{}

ShutdownSensor contains the 'shutdown sensor' command fields

func (*ShutdownSensor) GetName

func (m *ShutdownSensor) GetName() MessageName

GetName returns the command message ID for the 'shutdown sensor' command

type StartMonitor

type StartMonitor struct {
	AppName            string                        `json:"app_name"`
	AppArgs            []string                      `json:"app_args,omitempty"`
	AppUser            string                        `json:"app_user,omitempty"`
	RunTargetAsUser    bool                          `json:"run_tas_user,omitempty"`
	KeepPerms          bool                          `json:"keep_perms,omitempty"`
	Perms              map[string]*fsutil.AccessInfo `json:"perms,omitempty"`
	Excludes           []string                      `json:"excludes,omitempty"`
	Preserves          map[string]*fsutil.AccessInfo `json:"preserves,omitempty"`
	Includes           map[string]*fsutil.AccessInfo `json:"includes,omitempty"`
	IncludeBins        []string                      `json:"include_bins,omitempty"`
	IncludeExes        []string                      `json:"include_exes,omitempty"`
	IncludeShell       bool                          `json:"include_shell,omitempty"`
	IncludeCertAll     bool                          `json:"include_cert_all,omitempty"`
	IncludeCertBundles bool                          `json:"include_cert_bundles,omitempty"`
	IncludeCertDirs    bool                          `json:"include_cert_dirs,omitempty"`
	IncludeCertPKAll   bool                          `json:"include_cert_pk_all,omitempty"`
	IncludeCertPKDirs  bool                          `json:"include_cert_pk_dirs,omitempty"`
	IncludeNew         bool                          `json:"include_new,omitempty"`
}

StartMonitor contains the start monitor command fields

func (*StartMonitor) GetName

func (m *StartMonitor) GetName() MessageName

GetName returns the command message ID for the start monitor command

type StopMonitor

type StopMonitor struct {
}

StopMonitor contains the stop monitor command fields

func (*StopMonitor) GetName

func (m *StopMonitor) GetName() MessageName

GetName returns the command message ID for the stop monitor command

Jump to

Keyboard shortcuts

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