Documentation ¶
Index ¶
- Constants
- func AllScriptingHarnesses() map[string]func() ScriptingHarness
- func NewSafeSender(baseSender send.Sender, opts BaseOptions) (send.Sender, error)
- func PlatformSupportsDocker(platform string) bool
- type BaseOptions
- type BufferOptions
- type CachedLogger
- type CertificateCredentials
- type Command
- type CommandPostHook
- type CommandPreHook
- type Create
- func (opts *Create) AddEnvVar(k, v string)
- func (opts *Create) Close() error
- func (opts *Create) Copy() *Create
- func (opts *Create) Hash() hash.Hash
- func (opts *Create) RegisterCloser(fn func() error)
- func (opts *Create) Resolve(ctx context.Context) (exe executor.Executor, t time.Time, resolveErr error)
- func (opts *Create) ResolveEnvironment() []string
- func (opts *Create) Validate() error
- type DefaultLoggerOptions
- type Docker
- type FileLoggerOptions
- type Filter
- type InMemoryLoggerOptions
- type InheritedLoggerOptions
- type LogFormat
- type LoggerConfig
- func (lc *LoggerConfig) MarshalJSON() ([]byte, error)
- func (lc *LoggerConfig) Producer() LoggerProducer
- func (lc *LoggerConfig) Resolve() (send.Sender, error)
- func (lc *LoggerConfig) Set(producer LoggerProducer) error
- func (lc *LoggerConfig) Type() string
- func (lc *LoggerConfig) UnmarshalJSON(b []byte) error
- type LoggerProducer
- type LoggerProducerFactory
- type LoggerRegistry
- type LoggingPayload
- type LoggingPayloadFormat
- type Marshaler
- type MockSender
- type Output
- type Proxy
- type RawLoggerConfig
- type RawLoggerConfigFormat
- type Remote
- type RemoteConfig
- type ResolveExecutor
- type SafeSender
- type ScriptingGolang
- type ScriptingHarness
- func NewGolangScriptingEnvironment(gopath, goroot string, packages ...string) ScriptingHarness
- func NewPythonScriptingEnvironment(path, reqtxt string, packages ...string) ScriptingHarness
- func NewRoswellScriptingEnvironment(path string, systems ...string) ScriptingHarness
- func NewScriptingHarness(se string) (ScriptingHarness, error)
- type ScriptingPython
- type ScriptingRoswell
- type Unmarshaler
- type WriteFile
Constants ¶
const ( // ProcessImplementationBlocking suggests that the process // constructor use a blocking implementation. Some managers // may override this option. Blocking implementations // typically assert.the manager to maintain multiple // go routines. ProcessImplementationBlocking = "blocking" // ProcessImplementationBasic suggests that the process // constructor use a basic implementation. Some managers // may override this option. Basic implementations are more // simple than blocking implementations. ProcessImplementationBasic = "basic" )
const ( LoggingPayloadFormatJSON = "json" LoggingPayloadFormatSTRING = "string" )
const ( GolangScriptingType = "golang" Python2ScriptingType = "python2" Python3ScriptingType = "python3" RoswellScriptingType = "roswell" )
const (
// DefaultLogName is the default name for logs emitted by Jasper.
DefaultLogName = "jasper"
)
const LogDefault = "default"
LogDefault is the type name for the default logger.
const LogFile = "file"
LogFile is the type name for the file logger.
const LogInMemory = "in-memory"
LogInMemory is the type name for the in memory logger.
const LogInherited = "inherited"
LogInherited is the type name for the inherited logger.
Variables ¶
This section is empty.
Functions ¶
func AllScriptingHarnesses ¶
func AllScriptingHarnesses() map[string]func() ScriptingHarness
AllScriptingHarnesses returns all supported scripting harnesses.
func NewSafeSender ¶
NewSafeSender returns a grip send.Sender with the given base options. It overwrites the underlying Close method in order to ensure that both the base sender and buffered sender are closed correctly.
func PlatformSupportsDocker ¶
DockerPlatforms returns whether or not the platform has support for Docker.
Types ¶
type BaseOptions ¶
type BaseOptions struct { Level level.Priority `json:"level" bson:"level"` Buffer BufferOptions `json:"buffer" bson:"buffer"` Format LogFormat `json:"format" bson:"format"` }
BaseOptions are the base options necessary for setting up most loggers.
func (*BaseOptions) Validate ¶
func (opts *BaseOptions) Validate() error
Validate ensures that BaseOptions is valid.
type BufferOptions ¶
type BufferOptions struct { Buffered bool `bson:"buffered" json:"buffered" yaml:"buffered"` Duration time.Duration `bson:"duration" json:"duration" yaml:"duration"` MaxSize int `bson:"max_size" json:"max_size" yaml:"max_size"` }
BufferOptions packages options for whether or not a Logger should be buffered and the duration and size of the respective buffer in the case that it should be.
func (*BufferOptions) Validate ¶
func (opts *BufferOptions) Validate() error
Validate ensures that BufferOptions is valid.
type CachedLogger ¶
type CachedLogger struct { ID string `bson:"id" json:"id" yaml:"id"` Manager string `bson:"manager_id" json:"manager_id" yaml:"manager_id"` Accessed time.Time `bson:"accessed" json:"accessed" yaml:"accessed"` Error send.Sender `bson:"-" json:"-" yaml:"-"` Output send.Sender `bson:"-" json:"-" yaml:"-"` }
CachedLogger is the cached item representing a processes normal output. It captures information about the cached item, as well as go interfaces for sending log messages.
func (*CachedLogger) Close ¶
func (cl *CachedLogger) Close() error
Close closes the underlying output for the cached logger.
func (*CachedLogger) Send ¶
func (cl *CachedLogger) Send(lp *LoggingPayload) error
Send resolves a sender from the cached logger (either the error or output endpoint), and then sends the message from the data payload. This method ultimately is responsible for converting the payload to a message format.
type CertificateCredentials ¶
type CertificateCredentials struct { // CACert is the PEM-encoded client CA certificate. If the credentials are // used by a client, this should be the certificate of the root CA to verify // the server certificate. If the credentials are used by a server, this // should be the certificate of the root CA to verify the client // certificate. CACert []byte `bson:"ca_cert" json:"ca_cert" yaml:"ca_cert"` // Cert is the PEM-encoded certificate. Cert []byte `bson:"cert" json:"cert" yaml:"cert"` // Key is the PEM-encoded private key. Key []byte `bson:"key" json:"key" yaml:"key"` // ServerName is the name of the service being contacted. ServerName string `bson:"server_name" json:"server_name" yaml:"server_name"` }
CertificateCredentials represent a bundle of assets for doing TLS authentication.
func NewCredentials ¶
func NewCredentials(caCert, cert, key []byte) (*CertificateCredentials, error)
NewCredentials initializes a new Credential struct.
func NewCredentialsFromFile ¶
func NewCredentialsFromFile(path string) (*CertificateCredentials, error)
NewCredentialsFromFile parses the PEM-encoded credentials in JSON format in the file at path into a Credentials struct.
func (*CertificateCredentials) Export ¶
func (c *CertificateCredentials) Export() ([]byte, error)
Export exports the Credentials struct into JSON-encoded bytes.
func (*CertificateCredentials) Resolve ¶
func (c *CertificateCredentials) Resolve() (*tls.Config, error)
Resolve converts the Credentials struct into a tls.Config.
func (*CertificateCredentials) Validate ¶
func (c *CertificateCredentials) Validate() error
Validate checks that the Credentials are all set to non-empty values.
type Command ¶
type Command struct { ID string `json:"id,omitempty"` Commands [][]string `json:"commands"` Process Create `json:"proc_opts,omitempty"` Remote *Remote `json:"remote_options,omitempty"` ContinueOnError bool `json:"continue_on_error,omitempty"` IgnoreError bool `json:"ignore_error,omitempty"` Priority level.Priority `json:"priority,omitempty"` RunBackground bool `json:"run_background,omitempty"` Sudo bool `json:"sudo,omitempty"` SudoUser string `json:"sudo_user,omitempty"` Prerequisite func() bool `json:"-"` PostHook CommandPostHook `json:"-"` PreHook CommandPreHook `json:"-"` }
Command represents jasper.Command options that are configurable by the user.
type CommandPostHook ¶
CommandPostHook describes a common function type to run after the command completes and processes its error, potentially overriding the output of the command.
func MergeAbortingPassthroughPostHooks ¶
func MergeAbortingPassthroughPostHooks(fns ...CommandPostHook) CommandPostHook
MergeAbortingPassthroughPostHooks produces a post hook that returns the error of the first post hook passed that does not return nil. If none of the passed functions return an error, the hook returns the original error.
func MergeAbortingPostHooks ¶
func MergeAbortingPostHooks(fns ...CommandPostHook) CommandPostHook
MergeAbortingPostHook produces a post hook that returns the first error returned by one of it's argument functions, and returns nil if no function returns an error.
func MergePostHooks ¶
func MergePostHooks(fns ...CommandPostHook) CommandPostHook
MergePostHooks runs all post hooks, collecting the errors and merging them.
type CommandPreHook ¶
CommandPreHook describes a common function type to run before sub-commands in a command object and can modify the state of the command.
func MergePreHooks ¶
func MergePreHooks(fns ...CommandPreHook) CommandPreHook
MergePreHooks produces a single PreHook function that runs all defined prehooks.
func NewDefaultLoggingPreHook ¶
func NewDefaultLoggingPreHook(lp level.Priority) CommandPreHook
NewDefaultLoggingPreHook uses the global grip logger to log a debug message at the specified priority level.
func NewLoggingPreHook ¶
func NewLoggingPreHook(logger grip.Logger, lp level.Priority) CommandPreHook
NewLoggingPreHook provides a logging message for debugging purposes that prints information from the creation options.
func NewLoggingPreHookFromSender ¶
func NewLoggingPreHookFromSender(sender send.Sender, lp level.Priority) CommandPreHook
NewLoggingPreHookFromSender produces a logging prehook that wraps a sender.
type Create ¶
type Create struct { Args []string `bson:"args" json:"args" yaml:"args"` Environment map[string]string `bson:"env,omitempty" json:"env,omitempty" yaml:"env,omitempty"` // OverrideEnviron sets the process environment to match the currently // executing process's environment. This is ignored if Remote or Docker // options are specified. OverrideEnviron bool `bson:"override_env,omitempty" json:"override_env,omitempty" yaml:"override_env,omitempty"` // Synchronized specifies whether the process should be thread-safe or not. // This is not guaranteed to be respected for managed processes. Synchronized bool `bson:"synchronized" json:"synchronized" yaml:"synchronized"` // Implementation specifies the local process implementation to use. This // is not guaranteed to be respected for managed processes. Implementation string `bson:"implementation,omitempty" json:"implementation,omitempty" yaml:"implementation,omitempty"` WorkingDirectory string `bson:"working_directory,omitempty" json:"working_directory,omitempty" yaml:"working_directory,omitempty"` Output Output `bson:"output" json:"output" yaml:"output"` // Remote specifies options for creating processes over SSH. Remote *Remote `bson:"remote,omitempty" json:"remote,omitempty" yaml:"remote,omitempty"` // Docker specifies options for creating processes in Docker containers. Docker *Docker `bson:"docker,omitempty" json:"docker,omitempty" yaml:"docker,omitempty"` // TimeoutSecs takes precedence over Timeout. On remote interfaces, // TimeoutSecs should be set instead of Timeout. TimeoutSecs int `bson:"timeout_secs,omitempty" json:"timeout_secs,omitempty" yaml:"timeout_secs,omitempty"` Timeout time.Duration `bson:"timeout,omitempty" json:"-" yaml:"-"` Tags []string `bson:"tags,omitempty" json:"tags,omitempty" yaml:"tags,omitempty"` OnSuccess []*Create `bson:"on_success,omitempty" json:"on_success,omitempty" yaml:"on_success"` OnFailure []*Create `bson:"on_failure,omitempty" json:"on_failure,omitempty" yaml:"on_failure"` OnTimeout []*Create `bson:"on_timeout,omitempty" json:"on_timeout,omitempty" yaml:"on_timeout"` // StandardInputBytes takes precedence over StandardInput. On remote // interfaces, StandardInputBytes should be set instead of StandardInput. StandardInput io.Reader `bson:"-" json:"-" yaml:"-"` StandardInputBytes []byte `bson:"stdin_bytes" json:"stdin_bytes" yaml:"stdin_bytes"` ResolveExecutor ResolveExecutor `bson:"-" json:"-" yaml:"-"` // contains filtered or unexported fields }
Create contains options related to starting a process. This includes execution configuration, post-execution triggers, and output configuration. It is not safe for concurrent access.
func MakeCreation ¶
MakeCreation takes a command string and returns an equivalent Create struct that would spawn a process corresponding to the given command string.
func (*Create) AddEnvVar ¶
AddEnvVar adds an environment variable to the Create struct on which this method is called. If the Environment map is nil, this method will instantiate one.
func (*Create) Close ¶
Close will execute the closer functions assigned to the Create. This function is often called as a trigger at the end of a process' lifetime in Jasper.
func (*Create) Copy ¶
Copy returns a copy of the options for only the exported fields. Unexported fields are cleared.
func (*Create) Hash ¶
Hash returns the canonical hash implementation for the create options (and thus the process it will create.)
func (*Create) RegisterCloser ¶
RegisterCloser adds the closer function to the processes closer functions, which are called when the process is closed.
func (*Create) Resolve ¶
func (opts *Create) Resolve(ctx context.Context) (exe executor.Executor, t time.Time, resolveErr error)
Resolve creates the command object according to the create options. It returns the resolved command and the deadline when the command will be terminated by timeout. If there is no deadline, it returns the zero time.
func (*Create) ResolveEnvironment ¶
ResolveEnvironment returns the (Create).Environment as a slice of environment variables in the form "key=value".
type DefaultLoggerOptions ¶
type DefaultLoggerOptions struct { Prefix string `json:"prefix" bson:"prefix"` Base BaseOptions `json:"base" bson:"base"` }
DefaultLoggerOptions packages the options for creating a default logger.
func (*DefaultLoggerOptions) Configure ¶
func (opts *DefaultLoggerOptions) Configure() (send.Sender, error)
func (*DefaultLoggerOptions) Type ¶
func (*DefaultLoggerOptions) Type() string
func (*DefaultLoggerOptions) Validate ¶
func (opts *DefaultLoggerOptions) Validate() error
Validate ensures DefaultLoggerOptions is valid.
type Docker ¶
type Docker struct { Host string `bson:"host" json:"host" yaml:"host"` Port int `bson:"port" json:"port" yaml:"port"` APIVersion string `bson:"api_version" json:"api_version" yaml:"api_version"` Image string `bson:"image" json:"image" yaml:"image"` // Platform refers to the major operating system on which the Docker // container runs. Platform string `bson:"platform" json:"platform" yaml:"platform"` }
Docker encapsulates options related to connecting to a Docker daemon.
type FileLoggerOptions ¶
type FileLoggerOptions struct { Filename string `json:"filename " bson:"filename"` Base BaseOptions `json:"base" bson:"base"` }
FileLoggerOptions packages the options for creating a file logger.
func (*FileLoggerOptions) Configure ¶
func (opts *FileLoggerOptions) Configure() (send.Sender, error)
func (*FileLoggerOptions) Type ¶
func (*FileLoggerOptions) Type() string
func (*FileLoggerOptions) Validate ¶
func (opts *FileLoggerOptions) Validate() error
Validate ensures FileLoggerOptions is valid.
type Filter ¶
type Filter string
Filter is type for classifying and grouping types of processes in filter operations, such as that found in List() on Managers.
const ( // Running is a filter for processes that have not yet completed and are // still running. Running Filter = "running" // Terminated is the opposite of the Running filter. Terminated Filter = "terminated" // All is a filter that is satisfied by any process. All Filter = "all" // Failed refers to processes that have terminated unsuccessfully. Failed Filter = "failed" // Successful refers to processes that have terminated successfully. Successful Filter = "successful" )
type InMemoryLoggerOptions ¶
type InMemoryLoggerOptions struct { InMemoryCap int `json:"in_memory_cap" bson:"in_memory_cap"` Base BaseOptions `json:"base" bson:"base"` }
InMemoryLoggerOptions packages the options for creating an in memory logger.
func (*InMemoryLoggerOptions) Configure ¶
func (opts *InMemoryLoggerOptions) Configure() (send.Sender, error)
func (*InMemoryLoggerOptions) Type ¶
func (*InMemoryLoggerOptions) Type() string
func (*InMemoryLoggerOptions) Validate ¶
func (opts *InMemoryLoggerOptions) Validate() error
type InheritedLoggerOptions ¶
type InheritedLoggerOptions struct {
Base BaseOptions `json:"base" bson:"base"`
}
InheritLoggerOptions packages the options for creating an inherited logger.
func (*InheritedLoggerOptions) Configure ¶
func (opts *InheritedLoggerOptions) Configure() (send.Sender, error)
func (*InheritedLoggerOptions) Type ¶
func (*InheritedLoggerOptions) Type() string
type LogFormat ¶
type LogFormat string
LogFormat specifies a certain format for logging by Jasper. See the documentation for grip/send for more information on the various LogFormats.
func (LogFormat) MakeFormatter ¶
func (f LogFormat) MakeFormatter() (send.MessageFormatter, error)
MakeFormatter creates a grip/send.MessageFormatter for the specified LogFormat on which it is called.
type LoggerConfig ¶
type LoggerConfig struct { Registry LoggerRegistry // contains filtered or unexported fields }
LoggerConfig represents the necessary information to construct a new grip send.Sender. LoggerConfig implements the json and bson Marshaler and Unmarshaler interfaces.
func NewLoggerConfig ¶
func NewLoggerConfig(producerType string, format RawLoggerConfigFormat, config []byte) *LoggerConfig
NewLoggerConfig returns a LoggerConfig with the given info, this function expects a raw logger config as a byte slice. When using a LoggerProducer directly, use LoggerConfig's Set function.
func (*LoggerConfig) MarshalJSON ¶
func (lc *LoggerConfig) MarshalJSON() ([]byte, error)
func (*LoggerConfig) Producer ¶
func (lc *LoggerConfig) Producer() LoggerProducer
Producer returns the underlying logger producer for this logger config, which may be nil.
func (*LoggerConfig) Resolve ¶
func (lc *LoggerConfig) Resolve() (send.Sender, error)
Resolve resolves the LoggerConfig and returns the resulting grip send.Sender.
func (*LoggerConfig) Set ¶
func (lc *LoggerConfig) Set(producer LoggerProducer) error
Set sets the logger producer and type for the logger config.
func (*LoggerConfig) UnmarshalJSON ¶
func (lc *LoggerConfig) UnmarshalJSON(b []byte) error
type LoggerProducer ¶
LoggerProducer produces a Logger interface backed by a grip logger.
func NewDefaultLoggerProducer ¶
func NewDefaultLoggerProducer() LoggerProducer
NewDefaultLoggerProducer returns a LoggerProducer backed by DefaultLoggerOptions.
func NewFileLoggerProducer ¶
func NewFileLoggerProducer() LoggerProducer
NewFileLoggerProducer returns a LoggerProducer backed by FileLoggerOptions.
func NewInMemoryLoggerProducer ¶
func NewInMemoryLoggerProducer() LoggerProducer
NewInMemoryLoggerProducer returns a LoggerProducer backed by InMemoryLoggerOptions.
func NewInheritedLoggerProducer ¶
func NewInheritedLoggerProducer() LoggerProducer
NewInheritedLoggerProducer returns a LoggerProducer backed by InheritedLoggerOptions.
type LoggerProducerFactory ¶
type LoggerProducerFactory func() LoggerProducer
LoggerProducerFactory creates a new instance of a LoggerProducer implementation.
type LoggerRegistry ¶
type LoggerRegistry interface { Register(LoggerProducerFactory) Check(string) bool Names() []string Resolve(string) (LoggerProducerFactory, bool) RegisterUnmarshaler(RawLoggerConfigFormat, Unmarshaler) RegisterMarshaler(RawLoggerConfigFormat, Marshaler) Unmarshaler(RawLoggerConfigFormat) Unmarshaler Marshaler(RawLoggerConfigFormat) Marshaler }
LoggerRegistry is an interface that stores reusable logger factories.
func GetGlobalLoggerRegistry ¶
func GetGlobalLoggerRegistry() LoggerRegistry
GetGlobalLoggerRegistry returns the global logger registry.
func NewBasicLoggerRegistry ¶
func NewBasicLoggerRegistry() LoggerRegistry
NewBasicLoggerRegsitry returns a new LoggerRegistry backed by the basicLoggerRegistry implementation.
type LoggingPayload ¶
type LoggingPayload struct { LoggerID string `bson:"logger_id" json:"logger_id" yaml:"logger_id"` Data interface{} `bson:"data" json:"data" yaml:"data"` Priority level.Priority `bson:"priority" json:"priority" yaml:"priority"` IsMulti bool `bson:"multi,omitempty" json:"multi,omitempty" yaml:"multi,omitempty"` PreferSendToError bool `bson:"prefer_send_to_error,omitempty" json:"prefer_send_to_error,omitempty" yaml:"prefer_send_to_error,omitempty"` AddMetadata bool `bson:"add_metadata,omitempty" json:"add_metadata,omitempty" yaml:"add_metadata,omitempty"` Format LoggingPayloadFormat `bson:"payload_format,omitempty" json:"payload_format,omitempty" yaml:"payload_format,omitempty"` }
LoggingPayload captures the arguments to the SendMessages operation.
func (*LoggingPayload) Validate ¶
func (lp *LoggingPayload) Validate() error
Validate checks that the assert. fields are populated for the payload and the format is valid.
type LoggingPayloadFormat ¶
type LoggingPayloadFormat string
LoggingPayloadFormat is an set enumerated values describing the formating or encoding of the payload data.
type MockSender ¶
MockSender is a simple mock implementation of the grip/send.Sender interface. TODO: Remove this mock sender with EVG-13443.
func NewMockSender ¶
func NewMockSender(name string) *MockSender
NewMockSender returns a MockSender with the given name.
func (*MockSender) Close ¶
func (s *MockSender) Close() error
Close will fail if Closed is already set to false.
type Output ¶
type Output struct { Output io.Writer `bson:"-" json:"-" yaml:"-"` Error io.Writer `bson:"-" json:"-" yaml:"-"` SuppressOutput bool `bson:"suppress_output" json:"suppress_output" yaml:"suppress_output"` SuppressError bool `bson:"suppress_error" json:"suppress_error" yaml:"suppress_error"` SendOutputToError bool `bson:"redirect_output_to_error" json:"redirect_output_to_error" yaml:"redirect_output_to_error"` SendErrorToOutput bool `bson:"redirect_error_to_output" json:"redirect_error_to_output" yaml:"redirect_error_to_output"` // Loggers are self-contained and specific to the process they are attached // to. They are closed and cleaned up when the process exits. If this // behavior is not desired, use Output instead of Loggers. Loggers []*LoggerConfig `bson:"loggers" json:"loggers,omitempty" yaml:"loggers"` // contains filtered or unexported fields }
Output provides a common way to define and represent the output behavior of a Command operation.
func (*Output) CachedLogger ¶
func (o *Output) CachedLogger(id string) *CachedLogger
func (*Output) Copy ¶
Copy returns a copy of the options for only the exported fields. Unexported fields are cleared.
func (*Output) GetError ¶
GetError returns an io.Writer that can be used for standard error, depending on the output configuration.
type Proxy ¶
type Proxy struct {
RemoteConfig `bson:"remote_config,inline" json:"remote_config" yaml:"remote_config"`
}
Proxy represents the remote configuration to access a remote proxy machine.
type RawLoggerConfig ¶
type RawLoggerConfig []byte
RawLoggerConfig wraps []byte and implements the json and bson Marshaler and Unmarshaler interfaces.
func (*RawLoggerConfig) MarshalJSON ¶
func (lc *RawLoggerConfig) MarshalJSON() ([]byte, error)
func (*RawLoggerConfig) UnmarshalJSON ¶
func (lc *RawLoggerConfig) UnmarshalJSON(b []byte) error
type RawLoggerConfigFormat ¶
type RawLoggerConfigFormat string
RawLoggerConfigFormat describes the format of the raw logger configuration.
const ( RawLoggerConfigFormatJSON RawLoggerConfigFormat = "JSON" RawLoggerConfigFormatInvalid RawLoggerConfigFormat = "invalid" )
func (RawLoggerConfigFormat) Unmarshal ¶
func (f RawLoggerConfigFormat) Unmarshal(data []byte, out interface{}) error
Unmarshal unmarshals the given data using the corresponding unmarshaler for the RawLoggerConfigFormat type.
func (RawLoggerConfigFormat) Validate ¶
func (f RawLoggerConfigFormat) Validate() error
Validate ensures that RawLoggerConfigFormat is valid.
type Remote ¶
type Remote struct { RemoteConfig `bson:"remote_config" json:"remote_config" yaml:"remote_config"` Proxy *Proxy `bson:"proxy" json:"proxy" yaml:"proxy,omitempty"` }
Remote represents options to SSH into a remote machine.
type RemoteConfig ¶
type RemoteConfig struct { Host string `bson:"host" json:"host"` User string `bson:"user" json:"user"` // Args to the SSH binary. Only used by if UseSSHLibrary is false. Args []string `bson:"args,omitempty" json:"args,omitempty"` // Determines whether to use the SSH binary or the SSH library. UseSSHLibrary bool `bson:"use_ssh_library,omitempty" json:"use_ssh_library,omitempty"` // The following apply only if UseSSHLibrary is true. Port int `bson:"port,omitempty" json:"port,omitempty"` Key string `bson:"key,omitempty" json:"key,omitempty"` KeyFile string `bson:"key_file,omitempty" json:"key_file,omitempty"` KeyPassphrase string `bson:"key_passphrase,omitempty" json:"key_passphrase,omitempty"` Password string `bson:"password,omitempty" json:"password,omitempty"` // Connection timeout Timeout time.Duration `bson:"timeout,omitempty" json:"timeout,omitempty"` }
RemoteConfig represents the arguments to connect to a remote host.
type ResolveExecutor ¶
type SafeSender ¶
SafeSender wraps a grip send.Sender and its base sender, ensuring that the base sender is closed correctly.
func (*SafeSender) Close ¶
func (s *SafeSender) Close() error
func (*SafeSender) GetSender ¶
func (s *SafeSender) GetSender() send.Sender
GetSender returns the underlying base grip send.Sender.
type ScriptingGolang ¶
type ScriptingGolang struct { Gopath string `bson:"gopath" json:"gopath" yaml:"gopath"` Goroot string `bson:"goroot" json:"goroot" yaml:"goroot"` // Packages describes the assert. packages for running scripts. // TODO: better support for go modules for getting specific versions? Packages []string `bson:"packages" json:"packages" yaml:"packages"` // Directory is the base working directory in which scripting is performed. Directory string `bson:"directory" json:"directory" yaml:"directory"` // UpdatePackages will update any assert. packages that already exist. UpdatePackages bool `bson:"update_packages" json:"update_packages" yaml:"update_packages"` CachedDuration time.Duration `bson:"cached_duration" json:"cached_duration" yaml:"cached_duration"` Environment map[string]string `bson:"environment" json:"environment" yaml:"environment"` Output Output `bson:"output" json:"output" yaml:"output"` // contains filtered or unexported fields }
ScriptingGolang describes a Go environment for building and running arbitrary code.
func (*ScriptingGolang) ID ¶
func (opts *ScriptingGolang) ID() string
ID returns a hash value that uniquely summarizes the environment.
func (*ScriptingGolang) Interpreter ¶
func (opts *ScriptingGolang) Interpreter() string
Interpreter is part of the options.ScriptingEnvironment interface and returns the path to the interpreter or binary that runs scripts.
func (*ScriptingGolang) Type ¶
func (opts *ScriptingGolang) Type() string
Type is part of the options.ScriptingEnvironment interface and returns the type of the interface.
func (*ScriptingGolang) Validate ¶
func (opts *ScriptingGolang) Validate() error
Validate is part of the options.ScriptingEnvironment interface and both ensures that the values are permissible and sets, where possible, good defaults.
type ScriptingHarness ¶
type ScriptingHarness interface { // ID should return a unique hash of the implementation of // ScrptingEnvironment. This can be cached, and should change // if any of the dependencies change. ID() string // Type returns the name of the environment, and is useful to // identify the environment for users. Type() string // Interpreter should return a path to the binary that will be // used for running code. Interpreter() string // Validate checks the internal consistency of an // implementation and may set defaults. Validate() error }
ScriptingHarness defines the interface for all types that define a scripting environment.
func NewGolangScriptingEnvironment ¶
func NewGolangScriptingEnvironment(gopath, goroot string, packages ...string) ScriptingHarness
NewGolangScriptingEnvironment generates a ScriptingEnvironment based on the arguments provided. Use this function for simple cases when you do not need or want to set as many aspects of the environment configuration.
func NewPythonScriptingEnvironment ¶
func NewPythonScriptingEnvironment(path, reqtxt string, packages ...string) ScriptingHarness
NewPythonScriptingEnvironment generates a ScriptingEnvironment for python 3 based on the arguments provided. Use this function for simple cases when you do not need or want to set as many aspects of the environment configuration.
func NewRoswellScriptingEnvironment ¶
func NewRoswellScriptingEnvironment(path string, systems ...string) ScriptingHarness
NewRoswellScriptingEnvironment generates a ScriptingEnvironment based on the arguments provided. Use this function for simple cases when you do not need or want to set as many aspects of the environment configuration.
func NewScriptingHarness ¶
func NewScriptingHarness(se string) (ScriptingHarness, error)
NewScriptingHarness provides a factory to generate concrete implementations of the ScriptingEnvironment interface for use in marshaling arbitrary values for a known environment.
type ScriptingPython ¶
type ScriptingPython struct { VirtualEnvPath string `bson:"virtual_env_path" json:"virtual_env_path" yaml:"virtual_env_path"` // InterpreterBinary is the global python binary interpreter. InterpreterBinary string `bson:"interpreter_binary" json:"interpreter_binary" yaml:"interpreter_binary"` // RequirementsPath specifies a path to the assert.ents.txt containing the // assert. packages. RequirementsPath string `bson:"assert.ents_path" json:"requirements_path" yaml:"requirements_path"` // Packages specifies all assert. packages for running scripts. Packages []string `bson:"packages" json:"packages" yaml:"packages"` // AddTestRequirements determines whether or not to install the dependencies // necessary for executing scripts if they are not already installed. AddTestRequirements bool `bson:"add_test_reqs" json:"add_test_reqs" yaml:"add_test_reqs"` UpdatePackages bool `bson:"update_packages" json:"update_packges" yaml:"update_packages"` // TODO: should this be an enum to handle when it's not just python 2 vs 3? LegacyPython bool `bson:"legacy_python" json:"legacy_python" yaml:"legacy_python"` CachedDuration time.Duration `bson:"cache_duration" json:"cache_duration" yaml:"cache_duration"` Environment map[string]string `bson:"env" json:"env" yaml:"env"` Output Output `bson:"output" json:"output" yaml:"output"` // contains filtered or unexported fields }
ScriptingPython defines the configuration of a python environment.
func (*ScriptingPython) ID ¶
func (opts *ScriptingPython) ID() string
ID returns a hash value that uniquely summarizes the environment.
func (*ScriptingPython) Interpreter ¶
func (opts *ScriptingPython) Interpreter() string
Interpreter is part of the options.ScriptingEnvironment interface and returns the path to the binary that will run scripts.
func (*ScriptingPython) Type ¶
func (opts *ScriptingPython) Type() string
Type is part of the options.ScriptingEnvironment interface and returns the type of the interface.
func (*ScriptingPython) Validate ¶
func (opts *ScriptingPython) Validate() error
Validate is part of the options.ScriptingEnvironment interface and both ensures that the values are permissible and sets, where possible, good defaults.
type ScriptingRoswell ¶
type ScriptingRoswell struct { Path string `bson:"path" json:"path" yaml:"path"` Systems []string `bson:"systems" json:"systems" yaml:"systems"` Lisp string `bson:"lisp" json:"lisp" yaml:"lisp"` CachedDuration time.Duration `bson:"cached_duration" json:"cached_duration" yaml:"cached_duration"` Environment map[string]string `bson:"environment" json:"environment" yaml:"environment"` Output Output `bson:"output" json:"output" yaml:"output"` // contains filtered or unexported fields }
ScriptingRoswell describes the options needed to configure Roswell, a Common Lisp-based scripting and environment management tool, as a jasper.ScriptingEnvironment. Roswell uses Quicklip and must be installed on your systems to use with jasper.
func (*ScriptingRoswell) ID ¶
func (opts *ScriptingRoswell) ID() string
ID returns a hash value that uniquely summarizes the environment.
func (*ScriptingRoswell) Interpreter ¶
func (opts *ScriptingRoswell) Interpreter() string
Interpreter is part of the options.ScriptingEnvironment interface and returns the path to the interpreter or binary that runs scripts.
func (*ScriptingRoswell) Type ¶
func (opts *ScriptingRoswell) Type() string
Type is part of the options.ScriptingEnvironment interface and returns the type of the interface.
func (*ScriptingRoswell) Validate ¶
func (opts *ScriptingRoswell) Validate() error
Validate is part of the options.ScriptingEnvironment interface and both ensures that the values are permissible and sets, where possible, good defaults.
type Unmarshaler ¶
type WriteFile ¶
type WriteFile struct { Path string `json:"path" bson:"path"` // File content can come from either Content or Reader, but not both. // Content should only be used if the entire file's contents can be held in // memory. Content []byte `json:"content" bson:"content"` Reader io.Reader `json:"-" bson:"-"` Append bool `json:"append" bson:"append"` Perm os.FileMode `json:"perm" bson:"perm"` }
WriteFile represents the options necessary to write to a file.
func (*WriteFile) ContentReader ¶
ContentReader returns the contents to be written to the file as an io.Reader.
func (*WriteFile) DoWrite ¶
DoWrite writes the data to the given path, creating the directory hierarchy as needed and the file if it does not exist yet.
func (*WriteFile) SetPerm ¶
SetPerm sets the file permissions on the file. This should be called after DoWrite. If no file exists at (WriteFile).Path, it will error.
func (*WriteFile) Validate ¶
Validate ensures that all the parameters to write to a file are valid and sets default permissions if necessary.
func (*WriteFile) WriteBufferedContent ¶
WriteBufferedContent writes the content to a file by repeatedly calling doWrite with a buffered portion of the content. doWrite processes the WriteFile containing the next content to write to the file.