Documentation ¶
Overview ¶
Package runner provides the logic for running the load test
Index ¶
- Constants
- func Run(ctr *container.Container, filename string, data map[string]any) error
- func RunAsyncProcessing(ctx context.Context, reqTermChan <-chan struct{}, log logger.Logger, id int, ...)
- type AttachRequestInfo
- type AuthenticatorFactor
- type BaseExecutor
- type ConnectionContainer
- type ConnectionMapData
- type CredentialEncryptConfig
- type DefaultEventCaster
- func (ec *DefaultEventCaster) CastEvent(_ context.Context, event Event) error
- func (ec *DefaultEventCaster) CastEventWithWait(ctx context.Context, event Event) error
- func (ec *DefaultEventCaster) Close(_ context.Context) error
- func (ec *DefaultEventCaster) Subscribe(_ context.Context) error
- func (ec *DefaultEventCaster) Unsubscribe(_ context.Context, ch chan Event) error
- type Event
- type EventCaster
- type ExecRequestData
- type ExecRequestStoreData
- type Flow
- type FlowStep
- type FlowStepFlow
- type FlowStepFlowDependsOn
- type FlowStepFlowExecutor
- type FlowStepFlowExecutorOutput
- type FlowStepFlowType
- type FlowStepFlowValue
- type HTTPRequest
- type HTTPRequestBodyType
- type ImportCallback
- type Kind
- type LocalAuthenticatorFactor
- type LocalOutputFactor
- type LocalStore
- func (l LocalStore) Import(ctx context.Context, data []ValidStoreImportData, cb ImportCallback) error
- func (l LocalStore) Store(ctx context.Context, data []ValidStoreValueData, cb StoreCallback) error
- func (l LocalStore) StoreWithExtractor(ctx context.Context, res any, data []ValidExecRequestStoreData, ...) error
- type LocalTargetFactor
- type LocalTmplFactor
- type MassExec
- type MassExecAuth
- type MassExecOutput
- type MassExecRequest
- type MassExecRequestBreak
- type MassExecRequestRecordExcludeFilter
- type MassExecType
- type MassiveExecThreadExecutor
- type MemoryValue
- type MemoryValueData
- type OneExec
- type OneExecAuth
- type OneExecOutput
- type OneExecRequest
- type OneExecType
- type OutputFactor
- type ReceiveTermType
- type ResponseDataConsumer
- type RunStoreImport
- type Runner
- type SlaveConnect
- type SlaveConnectCertificate
- type SlaveConnectData
- type SlaveRequestHandler
- type Sleep
- type SleepValue
- type SleepValueAfter
- type Store
- type StoreCallback
- type StoreImport
- type StoreImportData
- type StoreValue
- type StoreValueData
- type StoreWithExtractorCallback
- type TargetFactor
- type TermChanType
- type TmplFactor
- type ValidCredentialEncryptConfig
- type ValidExecRequestData
- type ValidExecRequestDataSlice
- type ValidExecRequestStoreData
- type ValidFlow
- type ValidFlowStep
- type ValidFlowStepFlow
- type ValidFlowStepFlowDependsOn
- type ValidFlowStepFlowExecutor
- type ValidFlowStepFlowExecutorOutput
- type ValidFlowStepFlowValue
- type ValidMassExec
- type ValidMassExecRequest
- type ValidMassExecRequestBreak
- type ValidMassExecRequestRecordExcludeFilter
- type ValidMemoryValue
- type ValidMemoryValueData
- type ValidOneExec
- type ValidOneExecRequest
- type ValidRunner
- type ValidRunnerSleep
- type ValidRunnerSleepValue
- type ValidRunnerStoreImport
- type ValidSlaveConnect
- type ValidSlaveConnectCertificate
- type ValidSlaveConnectData
- type ValidStoreImport
- type ValidStoreImportData
- type ValidStoreValue
- type ValidStoreValueData
- type WriteData
Constants ¶
const DefaultChunkSize = 1024
DefaultChunkSize is an integer.
Variables ¶
This section is empty.
Functions ¶
func RunAsyncProcessing ¶
func RunAsyncProcessing( ctx context.Context, reqTermChan <-chan struct{}, log logger.Logger, id int, request ValidMassExecRequest, termChan chan<- TermChanType, resChan <-chan httpexec.ResponseContent, consumer ResponseDataConsumer, )
RunAsyncProcessing runs the async processing
Types ¶
type AttachRequestInfo ¶
AttachRequestInfo represents the request info
type AuthenticatorFactor ¶
type AuthenticatorFactor interface { // Factorize returns the factorized authenticator Factorize(ctx context.Context, authID string, isDefault bool) (auth.SetAuthor, error) // IsDefault returns if the authenticator is the default authenticator IsDefault(authID string) bool }
AuthenticatorFactor represents the authenticator factor
type BaseExecutor ¶
type BaseExecutor struct { Env string EncryptCtr encrypt.Container Logger logger.Logger SlaveConnectContainer *ConnectionContainer TmplFactor TmplFactor Store Store AuthFactor AuthenticatorFactor OutputFactor OutputFactor TargetFactor TargetFactor }
BaseExecutor represents the base executor
type ConnectionContainer ¶
type ConnectionContainer struct {
// contains filtered or unexported fields
}
ConnectionContainer is a struct that holds the connection information.
func NewConnectionContainer ¶
func NewConnectionContainer() *ConnectionContainer
NewConnectionContainer creates a new ConnectMap.
func (*ConnectionContainer) AllDisconnect ¶
func (c *ConnectionContainer) AllDisconnect(_ context.Context) error
AllDisconnect removes all connections from the map.
func (*ConnectionContainer) Connect ¶
func (c *ConnectionContainer) Connect( ctx context.Context, log logger.Logger, env string, encryptCtr encrypt.Container, conInfo ValidSlaveConnect, eventCaster EventCaster, ) error
Connect adds a connection to the map.
func (*ConnectionContainer) Find ¶
func (c *ConnectionContainer) Find(slaveID string) (*ConnectionMapData, bool)
Find returns the connection information.
type ConnectionMapData ¶
type ConnectionMapData struct { ConnectionID string Cli rpc.BloaderSlaveServiceClient ReqChan <-chan *pb.ReceiveChanelConnectResponse ReceiveTermChan <-chan ReceiveTermType // contains filtered or unexported fields }
ConnectionMapData is a struct that holds the connection information.
type CredentialEncryptConfig ¶
type CredentialEncryptConfig struct { Enabled bool `yaml:"enabled"` EncryptID *string `yaml:"encrypt_id"` }
CredentialEncryptConfig is the configuration for the credential encrypt.
func (CredentialEncryptConfig) Validate ¶
func (c CredentialEncryptConfig) Validate() (ValidCredentialEncryptConfig, error)
Validate validates the credential encrypt configuration
type DefaultEventCaster ¶
type DefaultEventCaster struct { // Caster is an event caster Caster *utils.Broadcaster[Event] }
DefaultEventCaster is a struct that holds the event caster information
func NewDefaultEventCaster ¶
func NewDefaultEventCaster() *DefaultEventCaster
NewDefaultEventCaster creates a new DefaultEventCaster
func NewDefaultEventCasterWithBroadcaster ¶
func NewDefaultEventCasterWithBroadcaster(broadcaster *utils.Broadcaster[Event]) *DefaultEventCaster
NewDefaultEventCasterWithBroadcaster creates a new DefaultEventCaster with broadcaster
func (*DefaultEventCaster) CastEvent ¶
func (ec *DefaultEventCaster) CastEvent(_ context.Context, event Event) error
CastEvent casts the event
func (*DefaultEventCaster) CastEventWithWait ¶
func (ec *DefaultEventCaster) CastEventWithWait(ctx context.Context, event Event) error
CastEventWithWait casts the event with wait
func (*DefaultEventCaster) Close ¶
func (ec *DefaultEventCaster) Close(_ context.Context) error
Close closes the event caster
func (*DefaultEventCaster) Subscribe ¶
func (ec *DefaultEventCaster) Subscribe(_ context.Context) error
Subscribe subscribes to the event
func (*DefaultEventCaster) Unsubscribe ¶
func (ec *DefaultEventCaster) Unsubscribe(_ context.Context, ch chan Event) error
Unsubscribe unsubscribes to the event
type Event ¶
type Event string
Event represents the flow step flow depends on event
const ( // RunnerEventStart represents the event start RunnerEventStart Event = "sys:start" // RunnerEventStoreImporting represents the event store importing RunnerEventStoreImporting Event = "sys:store:importing" // RunnerEventStoreImported represents the event store imported RunnerEventStoreImported Event = "sys:store:imported" // RunnerEventValidating represents the event validating RunnerEventValidating Event = "sys:validating" // RunnerEventValidated represents the event validated RunnerEventValidated Event = "sys:validated" // RunnerEventTerminated represents the event terminated RunnerEventTerminated Event = "sys:terminated" )
type EventCaster ¶
type EventCaster interface { // CastEvent casts the event CastEvent(ctx context.Context, event Event) error // CastEventWithWait casts the event with wait CastEventWithWait(ctx context.Context, event Event) error // Subscribe subscribes to the event Subscribe(ctx context.Context) error // Unsubscribe unsubscribes to the event Unsubscribe(ctx context.Context, ch chan Event) error // Close closes the event caster Close(ctx context.Context) error }
EventCaster is an interface for casting event
type ExecRequestData ¶
type ExecRequestData struct { Key *string `yaml:"key"` Extractor *matcher.DataExtractor `yaml:"extractor"` }
ExecRequestData represents the data configuration for the OneExec runner
func (ExecRequestData) Validate ¶
func (d ExecRequestData) Validate() (ValidExecRequestData, error)
Validate validates the OneExecRequestData
type ExecRequestStoreData ¶
type ExecRequestStoreData struct { BucketID *string `yaml:"bucket_id"` StoreKey *string `yaml:"store_key"` Encrypt CredentialEncryptConfig `yaml:"encrypt"` Extractor *matcher.DataExtractor `yaml:"extractor"` }
ExecRequestStoreData represents the store data configuration for the OneExec runner
func (ExecRequestStoreData) Validate ¶
func (d ExecRequestStoreData) Validate() (ValidExecRequestStoreData, error)
Validate validates the OneExecRequestStoreData
type FlowStep ¶
type FlowStep struct { Concurrency *int `yaml:"concurrency"` Flows []FlowStepFlow `yaml:"flows"` }
FlowStep represents a flow step
func (FlowStep) Validate ¶
func (r FlowStep) Validate() (ValidFlowStep, error)
Validate validates a flow step
type FlowStepFlow ¶
type FlowStepFlow struct { ID *string `yaml:"id"` DependsOn []FlowStepFlowDependsOn `yaml:"depends_on"` Type *string `yaml:"type"` File *string `yaml:"file"` Mkdir bool `yaml:"mkdir"` Count *int `yaml:"count"` Values []FlowStepFlowValue `yaml:"values"` ThreadOnlyValues []FlowStepFlowValue `yaml:"thread_only_values"` Flows []FlowStepFlow `yaml:"flows"` Concurrency *int `yaml:"concurrency"` Executors []FlowStepFlowExecutor `yaml:"executors"` }
FlowStepFlow represents a flow step flow
func (FlowStepFlow) Validate ¶
func (f FlowStepFlow) Validate(valid *ValidFlowStepFlow, idSet map[string]struct{}) error
Validate validates a flow step flow
type FlowStepFlowDependsOn ¶
FlowStepFlowDependsOn represents the flow step flow depends on
func (FlowStepFlowDependsOn) Validate ¶
func (r FlowStepFlowDependsOn) Validate() (ValidFlowStepFlowDependsOn, error)
Validate validates a flow step flow depends on
type FlowStepFlowExecutor ¶
type FlowStepFlowExecutor struct { SlaveID *string `yaml:"slave_id"` Output FlowStepFlowExecutorOutput `yaml:"output"` InheritValues bool `yaml:"inherit_values"` AdditionalValues []FlowStepFlowValue `yaml:"additional_values"` AdditionalThreadOnlyValues []FlowStepFlowValue `yaml:"additional_thread_only_values"` }
FlowStepFlowExecutor represents a flow step flow executor
func (FlowStepFlowExecutor) Validate ¶
func (r FlowStepFlowExecutor) Validate() (ValidFlowStepFlowExecutor, error)
Validate validates a flow step flow executor
type FlowStepFlowExecutorOutput ¶
type FlowStepFlowExecutorOutput struct { Enabled bool `yaml:"enabled"` RootPath *string `yaml:"root_path"` }
FlowStepFlowExecutorOutput represents a flow step flow executor output
func (FlowStepFlowExecutorOutput) Validate ¶
func (r FlowStepFlowExecutorOutput) Validate() (ValidFlowStepFlowExecutorOutput, error)
Validate validates a flow step flow executor output
type FlowStepFlowType ¶
type FlowStepFlowType string
FlowStepFlowType represents the flow step flow type
const ( // FlowStepFlowTypeFile represents the file flow step flow type FlowStepFlowTypeFile FlowStepFlowType = "file" // FlowStepFlowTypeFlow represents the flow flow step flow type FlowStepFlowTypeFlow FlowStepFlowType = "flow" // FlowStepFlowTypeSlaveCmd represents the slave command flow step flow type FlowStepFlowTypeSlaveCmd FlowStepFlowType = "slaveCmd" )
type FlowStepFlowValue ¶
FlowStepFlowValue represents a flow step flow value
func (FlowStepFlowValue) Validate ¶
func (r FlowStepFlowValue) Validate() (ValidFlowStepFlowValue, error)
Validate validates a flow step flow value
type HTTPRequest ¶
type HTTPRequest struct { Method string URL string Headers map[string]any // map[string]any or map[string][]any QueryParams map[string]any // map[string]any or map[string][]any PathVariables map[string]string // /path/{variable} -> /path/value BodyType HTTPRequestBodyType Body any AttachRequestInfo AttachRequestInfo TmplStr string ReplaceData *sync.Map OutputFactor OutputFactor AuthFactor AuthenticatorFactor TargetFactor TargetFactor IsMass bool ReqIndex int }
HTTPRequest represents the HTTP request
type HTTPRequestBodyType ¶
type HTTPRequestBodyType string
HTTPRequestBodyType represents the HTTP request body type
const ( // HTTPRequestBodyTypeJSON represents the JSON body type HTTPRequestBodyTypeJSON HTTPRequestBodyType = "json" // HTTPRequestBodyTypeForm represents the form body type HTTPRequestBodyTypeForm HTTPRequestBodyType = "form" // HTTPRequestBodyTypeMultipart represents the multipart body type HTTPRequestBodyTypeMultipart HTTPRequestBodyType = "multipart" // DefaultHTTPRequestBodyType represents the default HTTP request body type DefaultHTTPRequestBodyType = HTTPRequestBodyTypeJSON )
type ImportCallback ¶
type ImportCallback func(ctx context.Context, data ValidStoreImportData, val any, valBytes []byte) error
ImportCallback represents the import callback there are the case valBytes is nil
type Kind ¶
type Kind string
Kind represents the kind of runner
const ( // RunnerKindStoreValue represents the store value runner RunnerKindStoreValue Kind = "StoreValue" // RunnerKindMemoryValue represents the memory store value runner RunnerKindMemoryValue Kind = "MemoryValue" // RunnerKindStoreImport represents the store import runner RunnerKindStoreImport Kind = "StoreImport" // RunnerKindOneExecute represents execute one request runner RunnerKindOneExecute Kind = "OneExecute" // RunnerKindMassExecute represents execute multiple requests runner RunnerKindMassExecute Kind = "MassExecute" // RunnerKindFlow represents the flow runner RunnerKindFlow Kind = "Flow" // RunnerKindSlaveConnect represents the slave connect runner RunnerKindSlaveConnect Kind = "SlaveConnect" )
type LocalAuthenticatorFactor ¶
type LocalAuthenticatorFactor struct {
// contains filtered or unexported fields
}
LocalAuthenticatorFactor represents the local authenticator factor
func NewLocalAuthenticatorFactor ¶
func NewLocalAuthenticatorFactor(authCtr auth.AuthenticatorContainer) *LocalAuthenticatorFactor
NewLocalAuthenticatorFactor creates a new local authenticator factor
func (LocalAuthenticatorFactor) Factorize ¶
func (l LocalAuthenticatorFactor) Factorize( _ context.Context, authID string, isDefault bool, ) (auth.SetAuthor, error)
Factorize returns the factorized authenticator
func (LocalAuthenticatorFactor) IsDefault ¶
func (l LocalAuthenticatorFactor) IsDefault(authID string) bool
IsDefault returns if the authenticator is the default authenticator
type LocalOutputFactor ¶
type LocalOutputFactor struct {
// contains filtered or unexported fields
}
LocalOutputFactor represents the local output factor
func NewLocalOutputFactor ¶
func NewLocalOutputFactor(outputCtr output.Container) LocalOutputFactor
NewLocalOutputFactor creates a new LocalOutputFactor
type LocalStore ¶
type LocalStore struct {
// contains filtered or unexported fields
}
LocalStore represents the local store
func NewLocalStore ¶
func NewLocalStore(encCtr encrypt.Container, str store.Store) *LocalStore
NewLocalStore creates a new local store
func (LocalStore) Import ¶
func (l LocalStore) Import(ctx context.Context, data []ValidStoreImportData, cb ImportCallback) error
Import loads the data
func (LocalStore) Store ¶
func (l LocalStore) Store(ctx context.Context, data []ValidStoreValueData, cb StoreCallback) error
Store stores the data
func (LocalStore) StoreWithExtractor ¶
func (l LocalStore) StoreWithExtractor( ctx context.Context, res any, data []ValidExecRequestStoreData, cb StoreWithExtractorCallback, ) error
StoreWithExtractor stores the data with extractor
type LocalTargetFactor ¶
type LocalTargetFactor struct {
// contains filtered or unexported fields
}
LocalTargetFactor represents the local target factor
func NewLocalTargetFactor ¶
func NewLocalTargetFactor(targets target.Container) *LocalTargetFactor
NewLocalTargetFactor creates a new local target factor
type LocalTmplFactor ¶
type LocalTmplFactor struct {
// contains filtered or unexported fields
}
LocalTmplFactor represents the local template factor
func NewLocalTmplFactor ¶
func NewLocalTmplFactor(basePath string) *LocalTmplFactor
NewLocalTmplFactor creates a new local template factor
func (LocalTmplFactor) TmplFactorize ¶
TmplFactorize returns the factorized template
type MassExec ¶
type MassExec struct { Type *string `yaml:"type"` Output MassExecOutput `yaml:"output"` Auth MassExecAuth `yaml:"auth"` Requests []MassExecRequest `yaml:"requests"` }
MassExec represents the MassExec runner
func (MassExec) Validate ¶
func (r MassExec) Validate( ctx context.Context, log logger.Logger, authFactor AuthenticatorFactor, outFactor OutputFactor, targetFactor TargetFactor, tmplStr string, replaceData map[string]any, ) (ValidMassExec, error)
Validate validates the MassExec
type MassExecAuth ¶
MassExecAuth represents the auth configuration for the MassExec runner
func (MassExecAuth) Validate ¶
func (a MassExecAuth) Validate(ctx context.Context, authFactor AuthenticatorFactor) (auth.SetAuthor, error)
Validate validates the MassExecAuth
type MassExecOutput ¶
MassExecOutput represents the output configuration for the MassExec runner
func (MassExecOutput) Validate ¶
func (o MassExecOutput) Validate(ctx context.Context, outFactor OutputFactor) ([]output.Output, error)
Validate validates the MassExecOutput
type MassExecRequest ¶
type MassExecRequest struct { TargetID *string `yaml:"target_id"` Endpoint *string `yaml:"endpoint"` Method *string `yaml:"method"` QueryParam map[string]any `yaml:"query_param"` PathVariables map[string]string `yaml:"path_variables"` Headers map[string]any `yaml:"headers"` BodyType *string `yaml:"body_type"` Body any `yaml:"body"` ResponseType *string `yaml:"response_type"` Data []ExecRequestData `yaml:"data"` Interval *string `yaml:"interval"` AwaitPrevResp bool `yaml:"await_prev_response"` SuccessBreak []string `yaml:"success_break"` Break MassExecRequestBreak `yaml:"break"` RecordExcludeFilter MassExecRequestRecordExcludeFilter `yaml:"record_exclude_filter"` }
MassExecRequest represents the request configuration for the MassExec runner
func (MassExecRequest) Validate ¶
func (r MassExecRequest) Validate( ctx context.Context, log logger.Logger, targetFactor TargetFactor, tmplStr string, replaceData map[string]any, ) (ValidMassExecRequest, error)
Validate validates the MassExecRequest
type MassExecRequestBreak ¶
type MassExecRequestBreak struct { Time *string `yaml:"time"` Count *int `yaml:"count"` SysError bool `yaml:"sys_error"` ParseError bool `yaml:"parse_error"` WriteError bool `yaml:"write_error"` StatusCode matcher.StatusCodeConditions `yaml:"status_code"` ResponseBody matcher.BodyConditions `yaml:"response_body"` }
MassExecRequestBreak represents the break configuration for the MassExec runner
func (MassExecRequestBreak) Validate ¶
func (b MassExecRequestBreak) Validate(ctx context.Context, log logger.Logger) (ValidMassExecRequestBreak, error)
Validate validates the MassExecRequestBreak
type MassExecRequestRecordExcludeFilter ¶
type MassExecRequestRecordExcludeFilter struct { Count matcher.CountConditions `yaml:"count"` StatusCode matcher.StatusCodeConditions `yaml:"status_code"` ResponseBody matcher.BodyConditions `yaml:"response_body"` }
MassExecRequestRecordExcludeFilter represents the record exclude filter configuration for the MassExec runner
func (MassExecRequestRecordExcludeFilter) Validate ¶
func (f MassExecRequestRecordExcludeFilter) Validate( ctx context.Context, log logger.Logger, ) (ValidMassExecRequestRecordExcludeFilter, error)
Validate validates the MassExecRequestRecordExcludeFilter
type MassExecType ¶
type MassExecType string
MassExecType represents the type of MassExec
const ( // MassExecTypeHTTP represents the HTTP type MassExecTypeHTTP MassExecType = "http" )
type MassiveExecThreadExecutor ¶
type MassiveExecThreadExecutor struct { ID int RequestExecutor httpexec.MassRequestExecutor TermChan chan TermChanType ReqTermChan chan<- struct{} // contains filtered or unexported fields }
MassiveExecThreadExecutor represents the thread executor for the MassExec runner
type MemoryValue ¶
type MemoryValue struct {
Data []MemoryValueData `yaml:"data"`
}
MemoryValue represents the MemoryValue runner
func (MemoryValue) Validate ¶
func (r MemoryValue) Validate() (ValidMemoryValue, error)
Validate validates the MemoryValue
type MemoryValueData ¶
MemoryValueData represents the data for the MemoryValue runner
func (MemoryValueData) Validate ¶
func (d MemoryValueData) Validate() (ValidMemoryValueData, error)
Validate validates the MemoryValueData
type OneExec ¶
type OneExec struct { Type *string `yaml:"type"` Output OneExecOutput `yaml:"output"` Auth OneExecAuth `yaml:"auth"` Request *OneExecRequest `yaml:"request"` }
OneExec represents the OneExec runner
func (OneExec) Validate ¶
func (r OneExec) Validate( ctx context.Context, authFactor AuthenticatorFactor, outFactor OutputFactor, targetFactor TargetFactor, ) (ValidOneExec, error)
Validate validates the OneExec
type OneExecAuth ¶
OneExecAuth represents the auth configuration for the OneExec runner
func (OneExecAuth) Validate ¶
func (a OneExecAuth) Validate(ctx context.Context, authFactor AuthenticatorFactor) (auth.SetAuthor, error)
Validate validates the OneExecAuth
type OneExecOutput ¶
OneExecOutput represents the output configuration for the OneExec runner
func (OneExecOutput) Validate ¶
func (o OneExecOutput) Validate(ctx context.Context, outFactor OutputFactor) ([]output.Output, error)
Validate validates the OneExecOutput
type OneExecRequest ¶
type OneExecRequest struct { TargetID *string `yaml:"target_id"` Endpoint *string `yaml:"endpoint"` Method *string `yaml:"method"` QueryParam map[string]any `yaml:"query_param"` PathVariables map[string]string `yaml:"path_variables"` Headers map[string]any `yaml:"headers"` BodyType *string `yaml:"body_type"` Body any `yaml:"body"` ResponseType *string `yaml:"response_type"` Data []ExecRequestData `yaml:"data"` MemoryData []ExecRequestData `yaml:"memory_data"` StoreData []ExecRequestStoreData `yaml:"store_data"` }
OneExecRequest represents the request configuration for the OneExec runner
func (OneExecRequest) Validate ¶
func (r OneExecRequest) Validate(ctx context.Context, targetFactor TargetFactor) (ValidOneExecRequest, error)
Validate validates the OneExecRequest
type OneExecType ¶
type OneExecType string
OneExecType represents the type of OneExec
const ( // OneExecTypeHTTP represents the HTTP type OneExecTypeHTTP OneExecType = "http" )
type OutputFactor ¶
type OutputFactor interface { // Factorize returns the factorized output Factorize(ctx context.Context, outputID string) (output.Output, error) }
OutputFactor represents the output factor
type ReceiveTermType ¶
type ReceiveTermType string
ReceiveTermType represents the valid ReceiveTermType runner
const ( // ReceiveTermTypeEOF represents the EOF ReceiveTermTypeReceiveTermTypeEOF ReceiveTermType = "EOF" // ReceiveTermTypeResponseReceiveError represents the ResponseReceiveError ReceiveTermTypeReceiveTermTypeResponseReceiveError ReceiveTermType = "ResponseReceiveError" // ReceiveTermTypeStreamContextDone represents the StreamContextDone ReceiveTermTypeReceiveTermTypeStreamContextDone ReceiveTermType = "StreamContextDone" // ReceiveTermTypeDisconnected represents the Disconnected ReceiveTermTypeReceiveTermTypeDisconnected ReceiveTermType = "Disconnected" )
ReceiveTermType constants
type ResponseDataConsumer ¶
type ResponseDataConsumer func( ctx context.Context, log logger.Logger, id int, data WriteData, ) error
ResponseDataConsumer represents the response data consumer
type RunStoreImport ¶
type RunStoreImport struct { Enabled bool `yaml:"enabled"` Data []StoreImportData `yaml:"data"` }
RunStoreImport represents the StoreImport runner
func (RunStoreImport) Validate ¶
func (r RunStoreImport) Validate() (ValidRunnerStoreImport, error)
Validate validates the RunnerStoreImport
type Runner ¶
type Runner struct { Kind *string `yaml:"kind"` Sleep Sleep `yaml:"sleep"` StoreImport RunStoreImport `yaml:"store_import"` }
Runner represents a runner
func (Runner) Validate ¶
func (r Runner) Validate() (ValidRunner, error)
Validate validates a runner
type SlaveConnect ¶
type SlaveConnect struct {
Slaves []SlaveConnectData `yaml:"slaves"`
}
SlaveConnect represents the SlaveConnect runner
func (SlaveConnect) Validate ¶
func (r SlaveConnect) Validate() (ValidSlaveConnect, error)
Validate validates the SlaveConnect
type SlaveConnectCertificate ¶
type SlaveConnectCertificate struct { Enabled bool `yaml:"enabled"` CACert *string `yaml:"ca_cert"` ServerNameOverride string `yaml:"server_name_override"` InsecureSkipVerify bool `yaml:"insecure_skip_verify"` }
SlaveConnectCertificate represents the certificate for the Slave
func (SlaveConnectCertificate) Validate ¶
func (c SlaveConnectCertificate) Validate() (ValidSlaveConnectCertificate, error)
Validate validates the SlaveConnectCertificate
type SlaveConnectData ¶
type SlaveConnectData struct { ID *string `yaml:"id"` URI *string `yaml:"uri"` Certificate SlaveConnectCertificate `yaml:"certificate"` Encrypt CredentialEncryptConfig `yaml:"encrypt"` }
SlaveConnectData represents the data for the SlaveConnect
func (SlaveConnectData) Validate ¶
func (d SlaveConnectData) Validate() (ValidSlaveConnectData, error)
Validate validates the SlaveConnectData
type SlaveRequestHandler ¶
type SlaveRequestHandler struct {
// contains filtered or unexported fields
}
SlaveRequestHandler is a struct that holds the response handler information.
func NewSlaveRequestHandler ¶
func NewSlaveRequestHandler( resChan <-chan *pb.ReceiveChanelConnectResponse, cli rpc.BloaderSlaveServiceClient, termChan <-chan ReceiveTermType, ) *SlaveRequestHandler
NewSlaveRequestHandler creates a new ResponseHandler.
func (*SlaveRequestHandler) HandleResponse ¶
func (rh *SlaveRequestHandler) HandleResponse( ctx context.Context, log logger.Logger, tmplFactor TmplFactor, authFactor AuthenticatorFactor, targetFactor TargetFactor, store Store, ) error
HandleResponse handles the response.
type Sleep ¶
type Sleep struct { Enabled bool `yaml:"enabled"` Values []SleepValue `yaml:"values"` }
Sleep represents the sleep configuration for a runner
func (Sleep) Validate ¶
func (r Sleep) Validate() (ValidRunnerSleep, error)
Validate validates a runnerSleep
type SleepValue ¶
SleepValue represents the sleep value for a runner
func (SleepValue) Validate ¶
func (r SleepValue) Validate() (ValidRunnerSleepValue, error)
Validate validates a runner
type SleepValueAfter ¶
type SleepValueAfter string
SleepValueAfter represents the after value for a runner sleep value
const ( // RunnerSleepValueAfterInit represents the init after value for a runner sleep value RunnerSleepValueAfterInit SleepValueAfter = "init" // RunnerSleepValueAfterExec represents the success after value for a runner sleep value RunnerSleepValueAfterExec SleepValueAfter = "exec" // RunnerSleepValueAfterFailedExec represents the failed after value for a runner sleep value RunnerSleepValueAfterFailedExec SleepValueAfter = "failedExec" )
type Store ¶
type Store interface { // Store stores the data Store(ctx context.Context, data []ValidStoreValueData, cb StoreCallback) error // StoreWithExtractor stores the data with extractor StoreWithExtractor(ctx context.Context, res any, data []ValidExecRequestStoreData, cb StoreWithExtractorCallback) error // Import loads the data Import(ctx context.Context, data []ValidStoreImportData, cb ImportCallback) error }
Store represents the store
type StoreCallback ¶
type StoreCallback func(ctx context.Context, data ValidStoreValueData, valBytes []byte) error
StoreCallback represents the store callback
type StoreImport ¶
type StoreImport struct {
Data []StoreImportData `yaml:"data"`
}
StoreImport represents the StoreImport runner
func (StoreImport) Validate ¶
func (r StoreImport) Validate() (ValidStoreImport, error)
Validate validates the StoreImport
type StoreImportData ¶
type StoreImportData struct { BucketID *string `yaml:"bucket_id"` Key *string `yaml:"key"` StoreKey *string `yaml:"store_key"` ThreadOnly bool `yaml:"thread_only"` Encrypt CredentialEncryptConfig `yaml:"encrypt"` }
StoreImportData represents the data for the StoreImport runner
func (StoreImportData) Validate ¶
func (d StoreImportData) Validate() (ValidStoreImportData, error)
Validate validates the StoreImportData
type StoreValue ¶
type StoreValue struct {
Data []StoreValueData `yaml:"data"`
}
StoreValue represents the StoreValue runner
func (StoreValue) Validate ¶
func (r StoreValue) Validate() (ValidStoreValue, error)
Validate validates the StoreValue
type StoreValueData ¶
type StoreValueData struct { BucketID *string `yaml:"bucket_id"` Key *string `yaml:"key"` Value *any `yaml:"value"` Encrypt CredentialEncryptConfig `yaml:"encrypt"` }
StoreValueData represents the data for the StoreValue runner
func (StoreValueData) Validate ¶
func (d StoreValueData) Validate() (ValidStoreValueData, error)
Validate validates the StoreValueData
type StoreWithExtractorCallback ¶
type StoreWithExtractorCallback func(ctx context.Context, data ValidExecRequestStoreData, valBytes []byte) error
StoreWithExtractorCallback represents the store with extractor callback
type TargetFactor ¶
type TargetFactor interface { // Factorize returns the factorized target Factorize(ctx context.Context, targetID string) (target.Target, error) }
TargetFactor represents the target factor
type TermChanType ¶
type TermChanType struct {
// contains filtered or unexported fields
}
TermChanType represents the type of termChan
func NewTermChanType ¶
func NewTermChanType(termType matcher.TerminateType, param string) TermChanType
NewTermChanType creates a new termChanType
type TmplFactor ¶
type TmplFactor interface { // TmplFactorize returns the factorized template TmplFactorize(ctx context.Context, path string) (string, error) }
TmplFactor represents the template factor
type ValidCredentialEncryptConfig ¶
ValidCredentialEncryptConfig represents the valid auth credential encrypt configuration
type ValidExecRequestData ¶
type ValidExecRequestData struct { Key string Extractor matcher.ValidDataExtractor }
ValidExecRequestData represents the valid data configuration for the OneExec runner
type ValidExecRequestDataSlice ¶
type ValidExecRequestDataSlice []ValidExecRequestData
ValidExecRequestDataSlice represents a slice of ValidExecRequestData
func (ValidExecRequestDataSlice) ExtractHeader ¶
func (s ValidExecRequestDataSlice) ExtractHeader() []string
ExtractHeader extracts the header from the data
type ValidExecRequestStoreData ¶
type ValidExecRequestStoreData struct { BucketID string StoreKey string Encrypt ValidCredentialEncryptConfig Extractor matcher.ValidDataExtractor }
ValidExecRequestStoreData represents the valid store data configuration for the OneExec runner
type ValidFlow ¶
type ValidFlow struct {
Step ValidFlowStep
}
ValidFlow represents a valid flow runner
func (*ValidFlow) Run ¶
func (f *ValidFlow) Run( ctx context.Context, env string, log logger.Logger, slaveConCtr *ConnectionContainer, encryptCtr encrypt.Container, tmplFactor TmplFactor, store Store, authFactor AuthenticatorFactor, outFactor OutputFactor, targetFactor TargetFactor, str *sync.Map, outputRoot string, callCount int, slaveValues map[string]any, ) error
Run runs a flow step flow
type ValidFlowStep ¶
type ValidFlowStep struct { Concurrency int Flows []ValidFlowStepFlow }
ValidFlowStep represents a valid flow step
type ValidFlowStepFlow ¶
type ValidFlowStepFlow struct { ID string DependsOn []ValidFlowStepFlowDependsOn Type FlowStepFlowType File string Mkdir bool Count int Values []ValidFlowStepFlowValue ThreadOnlyValues []ValidFlowStepFlowValue Flows []ValidFlowStepFlow Concurrency int Executors []ValidFlowStepFlowExecutor // contains filtered or unexported fields }
ValidFlowStepFlow represents a valid flow step flow
type ValidFlowStepFlowDependsOn ¶
ValidFlowStepFlowDependsOn represents a valid flow step flow depends on
type ValidFlowStepFlowExecutor ¶
type ValidFlowStepFlowExecutor struct { SlaveID string Output ValidFlowStepFlowExecutorOutput InheritValues bool AdditionalValues []ValidFlowStepFlowValue AdditionalThreadOnlyValues []ValidFlowStepFlowValue }
ValidFlowStepFlowExecutor represents a valid flow step flow executor
type ValidFlowStepFlowExecutorOutput ¶
ValidFlowStepFlowExecutorOutput represents a valid flow step flow executor output
type ValidFlowStepFlowValue ¶
ValidFlowStepFlowValue represents a valid flow step flow value
type ValidMassExec ¶
type ValidMassExec struct { Type MassExecType Output []output.Output Auth auth.SetAuthor Requests []ValidMassExecRequest }
ValidMassExec represents the valid MassExec runner
func (ValidMassExec) Run ¶
func (r ValidMassExec) Run( ctx context.Context, log logger.Logger, outputRoot string, authFactor AuthenticatorFactor, outFactor OutputFactor, targetFactor TargetFactor, ) error
Run runs the MassExec runner
type ValidMassExecRequest ¶
type ValidMassExecRequest struct { URL string Method string QueryParams map[string]any PathVariables map[string]string Headers map[string]any BodyType HTTPRequestBodyType Body any ResponseType string Data ValidExecRequestDataSlice Interval time.Duration AwaitPrevResp bool SuccessBreak matcher.TerminateTypeAndParamsSlice Break ValidMassExecRequestBreak RecordExcludeFilter ValidMassExecRequestRecordExcludeFilter TmplStr string ReplaceData *sync.Map }
ValidMassExecRequest represents the valid request configuration for the MassExec runner
type ValidMassExecRequestBreak ¶
type ValidMassExecRequestBreak struct { Time struct { Enabled bool Time time.Duration } Count httpexec.RequestCountLimit SysError bool ParseError bool WriteError bool StatusCodeMatcher matcher.StatusCodeConditionsMatcher ResponseBodyMatcher matcher.BodyConditionsMatcher }
ValidMassExecRequestBreak represents the valid break configuration for the MassExec runner
type ValidMassExecRequestRecordExcludeFilter ¶
type ValidMassExecRequestRecordExcludeFilter struct { CountFilter matcher.CountConditionsMatcher StatusCodeFilter matcher.StatusCodeConditionsMatcher ResponseBodyFilter matcher.BodyConditionsMatcher }
ValidMassExecRequestRecordExcludeFilter represents the valid record exclude filter configuration for the MassExec runner
type ValidMemoryValue ¶
type ValidMemoryValue struct {
Data []ValidMemoryValueData
}
ValidMemoryValue represents the valid MemoryValue runner
type ValidMemoryValueData ¶
ValidMemoryValueData represents the valid data for the MemoryValue runner
type ValidOneExec ¶
type ValidOneExec struct { Type OneExecType Output []output.Output Auth auth.SetAuthor Request ValidOneExecRequest }
ValidOneExec represents the valid OneExec runner
type ValidOneExecRequest ¶
type ValidOneExecRequest struct { URL string Method string QueryParam map[string]any PathVariables map[string]string Headers map[string]any BodyType HTTPRequestBodyType Body any ResponseType string Data ValidExecRequestDataSlice MemoryData ValidExecRequestDataSlice StoreData []ValidExecRequestStoreData }
ValidOneExecRequest represents the valid request configuration for the OneExec runner
type ValidRunner ¶
type ValidRunner struct { Kind Kind Sleep ValidRunnerSleep StoreImport ValidRunnerStoreImport }
ValidRunner represents a valid runner
func (ValidRunner) RetrieveSleepValue ¶
func (r ValidRunner) RetrieveSleepValue(after SleepValueAfter) (time.Duration, bool)
RetrieveSleepValue retrieves the sleep value for a runner
type ValidRunnerSleep ¶
type ValidRunnerSleep struct { Enabled bool Values []ValidRunnerSleepValue }
ValidRunnerSleep represents a valid runner sleep configuration
type ValidRunnerSleepValue ¶
type ValidRunnerSleepValue struct { Duration time.Duration After SleepValueAfter }
ValidRunnerSleepValue represents a valid runner sleep value
type ValidRunnerStoreImport ¶
type ValidRunnerStoreImport struct { Enabled bool Data []ValidStoreImportData }
ValidRunnerStoreImport represents the valid RunnerStoreImport runner
type ValidSlaveConnect ¶
type ValidSlaveConnect struct {
Slaves []ValidSlaveConnectData
}
ValidSlaveConnect represents the valid ValidSlaveConnect runner
type ValidSlaveConnectCertificate ¶
type ValidSlaveConnectCertificate struct { Enabled bool CACert string ServerNameOverride string InsecureSkipVerify bool }
ValidSlaveConnectCertificate represents the valid certificate for the Slave
type ValidSlaveConnectData ¶
type ValidSlaveConnectData struct { ID string URI string Certificate ValidSlaveConnectCertificate Encrypt ValidCredentialEncryptConfig }
ValidSlaveConnectData represents the valid data for the ValidSlaveConnect
type ValidStoreImport ¶
type ValidStoreImport struct {
Data []ValidStoreImportData
}
ValidStoreImport represents the valid StoreImport runner
type ValidStoreImportData ¶
type ValidStoreImportData struct { BucketID string Key string StoreKey string ThreadOnly bool Encrypt ValidCredentialEncryptConfig }
ValidStoreImportData represents the valid data for the StoreImport runner
type ValidStoreValue ¶
type ValidStoreValue struct {
Data []ValidStoreValueData
}
ValidStoreValue represents the valid StoreValue runner
type ValidStoreValueData ¶
type ValidStoreValueData struct { BucketID string Key string Value any Encrypt ValidCredentialEncryptConfig }
ValidStoreValueData represents the valid data for the StoreValue runner