remote

package
v0.0.0-...-a9532b6 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DownloadFileCommand = "download_file"
	GetLogStreamCommand = "get_log_stream"
	SignalEventCommand  = "signal_event"
)

Constants representing remote client commands.

View Source
const (
	LoggingSendMessagesCommand        = "send_messages"
	LoggingCacheSizeCommand           = "logging_cache_size"
	LoggingCacheCreateCommand         = "logging_cache_create"
	LoggingCacheDeleteCommand         = "logging_cache_remove"
	LoggingCacheCloseAndRemoveCommand = "logging_cache_close_and_remove"
	LoggingCacheClearCommand          = "logging_cache_clear"
	LoggingCacheGetCommand            = "logging_cache_get"
	LoggingCachePruneCommand          = "logging_cache_prune"
)
View Source
const (
	ManagerIDCommand     = "id"
	CreateProcessCommand = "create_process"
	GetProcessCommand    = "get_process"
	ListCommand          = "list"
	GroupCommand         = "group"
	ClearCommand         = "clear"
	CloseCommand         = "close"
	WriteFileCommand     = "write_file"
)

Constants representing manager commands.

View Source
const (
	ProcessIDCommand               = "process_id"
	InfoCommand                    = "info"
	RunningCommand                 = "running"
	CompleteCommand                = "complete"
	WaitCommand                    = "wait"
	RespawnCommand                 = "respawn"
	SignalCommand                  = "signal"
	RegisterSignalTriggerIDCommand = "register_signal_trigger_id"
	GetTagsCommand                 = "get_tags"
	TagCommand                     = "add_tag"
	ResetTagsCommand               = "reset_tags"
)

Constants representing process commands.

View Source
const (
	ScriptingCreateCommand    = "create_scripting"
	ScriptingGetCommand       = "get_scripting"
	ScriptingSetupCommand     = "setup_scripting"
	ScriptingCleanupCommand   = "cleanup_scripting"
	ScriptingRunCommand       = "run_scripting"
	ScriptingRunScriptCommand = "run_script_scripting"
	ScriptingBuildCommand     = "build_scripting"
	ScriptingTestCommand      = "test_scripting"
)

Variables

This section is empty.

Functions

func AttachService

func AttachService(ctx context.Context, manager jasper.Manager, s *grpc.Server) error

AttachService attaches the jasper GRPC server to the given manager. After this function successfully returns, calls to Manager functions will be sent over GRPC to the Jasper GRPC server.

func StartMDBService

func StartMDBService(ctx context.Context, m jasper.Manager, addr net.Addr) (util.CloseFunc, error)

StartMDBService wraps an existing Jasper manager in a MongoDB wire protocol service and starts it. The caller is responsible for closing the connection using the returned jasper.CloseFunc.

func StartRPCService

func StartRPCService(ctx context.Context, manager jasper.Manager, addr net.Addr, creds *options.CertificateCredentials, opts ...grpc.ServerOption) (util.CloseFunc, error)

StartRPCService starts an RPC server with the specified address addr around the given manager. If creds is non-nil, the credentials will be used to establish a secure TLS connection with clients; otherwise, it will start an insecure service. The caller is responsible for closing the connection using the returned jasper.CloseFunc.

This service does not have any kind of interceptors (middleware) or logging configured, and panics are not handled. Passing interceptors from the aviation package or grpc-middleware as gprc.ServerOptions to this function can handle that.

func StartRPCServiceWithFile

func StartRPCServiceWithFile(ctx context.Context, manager jasper.Manager, addr net.Addr, filePath string, opts ...grpc.ServerOption) (util.CloseFunc, error)

StartRPCServiceWithFile is the same as StartService, but the credentials will be read from the file given by filePath if the filePath is non-empty. The credentials file should contain the JSON-encoded bytes from (*Credentials).Export().

Types

type Manager

type Manager interface {
	jasper.Manager

	CloseConnection() error
	DownloadFile(ctx context.Context, opts options.Download) error
	GetLogStream(ctx context.Context, id string, count int) (jasper.LogStream, error)
	SignalEvent(ctx context.Context, name string) error

	CreateScripting(context.Context, options.ScriptingHarness) (scripting.Harness, error)
	GetScripting(context.Context, string) (scripting.Harness, error)

	SendMessages(context.Context, options.LoggingPayload) error
}

Manager provides an interface to access all functionality from a Jasper service. It includes an interface to interact with Jasper Managers and Processes remotely as well as access to remote-specific functionality.

func MakeRestClient

func MakeRestClient(addr net.Addr, client *http.Client) Manager

MakeRestClient constructs a REST client that connects to the given address running the Jasper REST service and the specified HTTP client.

func NewMDBClient

func NewMDBClient(ctx context.Context, addr net.Addr, reqTimeout time.Duration) (Manager, error)

NewMDBClient returns a remote client for connection to a MongoDB wire protocol service. reqTimeout specifies the timeout for a request, or uses a default timeout if zero.

func NewRPCClient

func NewRPCClient(ctx context.Context, addr net.Addr, creds *options.CertificateCredentials) (Manager, error)

NewClient creates a connection to the RPC service with the specified address addr. If creds is non-nil, the credentials will be used to establish a secure TLS connection with the service; otherwise, it will establish an insecure connection. The caller is responsible for closing the connection using the returned jasper.CloseFunc.

func NewRPCClientWithFile

func NewRPCClientWithFile(ctx context.Context, addr net.Addr, filePath string) (Manager, error)

NewClientWithFile is the same as NewClient but the credentials will be read from the file given by filePath if the filePath is non-empty. The credentials file should contain the JSON-encoded bytes from (*certdepot.Credentials).Export().

func NewRestClient

func NewRestClient(addr net.Addr) Manager

NewRestClient creates a REST client that connects to the given address running the Jasper REST service. This function uses the http package's default client.

type Service

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

Service defines a REST service that provides a remote manager, using gimlet to publish routes.

func NewRestService

func NewRestService(m jasper.Manager) *Service

NewManagerService creates a service object around an existing manager. You must access the application and routes via the App() method separately. The constructor wraps basic managers with a manager implementation that does locking.

func (*Service) App

func (s *Service) App(ctx context.Context) *gimlet.APIApp

App constructs and returns a gimlet application for this service. It attaches no middleware and does not start the service.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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