agent

package
v0.0.0-...-0b10b3f Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandExecutor_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "CommandExecutor",
	HandlerType: (*CommandExecutorServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Execute",
			Handler:    _CommandExecutor_Execute_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "internal/commander/command.proto",
}

CommandExecutor_ServiceDesc is the grpc.ServiceDesc for CommandExecutor service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_internal_commander_command_proto protoreflect.FileDescriptor

Functions

func ListenAndServe

func ListenAndServe(port string) error

func RegisterCommandExecutorServer

func RegisterCommandExecutorServer(s grpc.ServiceRegistrar, srv CommandExecutorServer)

Types

type CPUExecutor

type CPUExecutor struct {
	// contains filtered or unexported fields
}

func (*CPUExecutor) Execute

func (e *CPUExecutor) Execute(ctx context.Context) (*Result, error)

type CPUResult

type CPUResult struct {
	CPUs map[string]float64
}

func (*CPUResult) Bytes

func (m *CPUResult) Bytes() []byte

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(addr string) (*Client, error)

func (*Client) CheckCPU

func (c *Client) CheckCPU(ctx context.Context) (*CPUResult, error)

func (*Client) CheckMemory

func (c *Client) CheckMemory(ctx context.Context) (*MemoryResult, error)

func (*Client) Close

func (c *Client) Close() error

type Command

type Command string
const (
	CommandCheckCPU        Command = "check_cpu"
	CommandCheckRAM        Command = "check_ram"
	CommandCheckDisk       Command = "check_disk"
	CommandCheckRessources Command = "check_ressources" // checks cpu, ram and disk in one call
	CommandCheckDocker     Command = "check_docker"
)

func (Command) String

func (c Command) String() string

type CommandExecutorClient

type CommandExecutorClient interface {
	Execute(ctx context.Context, in *ExecuteCommandRequest, opts ...grpc.CallOption) (*ExecuteCommandResponse, error)
}

CommandExecutorClient is the client API for CommandExecutor service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type CommandExecutorServer

type CommandExecutorServer interface {
	Execute(context.Context, *ExecuteCommandRequest) (*ExecuteCommandResponse, error)
	// contains filtered or unexported methods
}

CommandExecutorServer is the server API for CommandExecutor service. All implementations must embed UnimplementedCommandExecutorServer for forward compatibility

type DiskExecutor

type DiskExecutor struct{}

func (*DiskExecutor) Execute

func (e *DiskExecutor) Execute(ctx context.Context) (*Result, error)

type DiskResult

type DiskResult struct {
	Total       uint64
	Free        uint64
	Used        uint64
	UsedPercent float64
}

func (*DiskResult) Bytes

func (m *DiskResult) Bytes() []byte

type DockerExecutor

type DockerExecutor struct{}

func (*DockerExecutor) Execute

func (e *DockerExecutor) Execute(ctx context.Context) (*Result, error)

type DockerResult

type DockerResult struct {
	Total       uint64
	Free        uint64
	Used        uint64
	UsedPercent float64
}

func (*DockerResult) Bytes

func (m *DockerResult) Bytes() []byte

type ExecuteCommandRequest

type ExecuteCommandRequest struct {
	Command   string `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"`
	Payload   []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	Arguments string `protobuf:"bytes,3,opt,name=arguments,proto3" json:"arguments,omitempty"`
	// contains filtered or unexported fields
}

func (*ExecuteCommandRequest) Descriptor deprecated

func (*ExecuteCommandRequest) Descriptor() ([]byte, []int)

Deprecated: Use ExecuteCommandRequest.ProtoReflect.Descriptor instead.

func (*ExecuteCommandRequest) GetArguments

func (x *ExecuteCommandRequest) GetArguments() string

func (*ExecuteCommandRequest) GetCommand

func (x *ExecuteCommandRequest) GetCommand() string

func (*ExecuteCommandRequest) GetPayload

func (x *ExecuteCommandRequest) GetPayload() []byte

func (*ExecuteCommandRequest) ProtoMessage

func (*ExecuteCommandRequest) ProtoMessage()

func (*ExecuteCommandRequest) ProtoReflect

func (x *ExecuteCommandRequest) ProtoReflect() protoreflect.Message

func (*ExecuteCommandRequest) Reset

func (x *ExecuteCommandRequest) Reset()

func (*ExecuteCommandRequest) String

func (x *ExecuteCommandRequest) String() string

type ExecuteCommandResponse

type ExecuteCommandResponse struct {
	Result []byte `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
	// contains filtered or unexported fields
}

func (*ExecuteCommandResponse) Descriptor deprecated

func (*ExecuteCommandResponse) Descriptor() ([]byte, []int)

Deprecated: Use ExecuteCommandResponse.ProtoReflect.Descriptor instead.

func (*ExecuteCommandResponse) GetResult

func (x *ExecuteCommandResponse) GetResult() []byte

func (*ExecuteCommandResponse) ProtoMessage

func (*ExecuteCommandResponse) ProtoMessage()

func (*ExecuteCommandResponse) ProtoReflect

func (x *ExecuteCommandResponse) ProtoReflect() protoreflect.Message

func (*ExecuteCommandResponse) Reset

func (x *ExecuteCommandResponse) Reset()

func (*ExecuteCommandResponse) String

func (x *ExecuteCommandResponse) String() string

type Executor

type Executor interface {
	Execute(ctx context.Context) (*Result, error)
}

type MemoryExecutor

type MemoryExecutor struct{}

func (*MemoryExecutor) Execute

func (e *MemoryExecutor) Execute(ctx context.Context) (*Result, error)

type MemoryResult

type MemoryResult struct {
	Total       uint64
	Free        uint64
	Used        uint64
	UsedPercent float64
}

func (*MemoryResult) Bytes

func (m *MemoryResult) Bytes() []byte

type Result

type Result struct {
	Payload []byte `json:"payload"`
}

type UnimplementedCommandExecutorServer

type UnimplementedCommandExecutorServer struct {
}

UnimplementedCommandExecutorServer must be embedded to have forward compatible implementations.

func (UnimplementedCommandExecutorServer) Execute

type UnsafeCommandExecutorServer

type UnsafeCommandExecutorServer interface {
	// contains filtered or unexported methods
}

UnsafeCommandExecutorServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CommandExecutorServer will result in compilation errors.

Jump to

Keyboard shortcuts

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