Documentation
¶
Index ¶
Constants ¶
View Source
const ( PythonContainerName = "chapar-python-executor" PythonExecutorName = "Python" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DockerClient ¶
type DockerClient struct {
// contains filtered or unexported fields
}
DockerClient wraps the Docker SDK client
func NewDockerClient ¶
func NewDockerClient() (*DockerClient, error)
NewDockerClient creates a new Docker client
type ExecParams ¶
type ExecParams struct {
Req *RequestData
Res *ResponseData
Env *domain.Environment
}
type ExecResult ¶
type ExecResult struct {
Req *RequestData `json:"-"`
SetEnvironments map[string]interface{} `json:"set_environments"`
Prints []string `json:"prints"`
}
type Executor ¶
type Executor interface {
Init(cfg domain.ScriptingConfig) error
Execute(ctx context.Context, script string, params *ExecParams) (*ExecResult, error)
Name() string
Shutdown() error
}
func GetExecutor ¶
func GetExecutor(language string, cfg domain.ScriptingConfig) (Executor, error)
type PythonExecutor ¶
type PythonExecutor struct {
// contains filtered or unexported fields
}
func NewPythonExecutor ¶
func NewPythonExecutor(cfg domain.ScriptingConfig) *PythonExecutor
func (*PythonExecutor) Execute ¶
func (p *PythonExecutor) Execute(ctx context.Context, script string, params *ExecParams) (*ExecResult, error)
func (*PythonExecutor) Init ¶
func (p *PythonExecutor) Init(cfg domain.ScriptingConfig) error
func (*PythonExecutor) Name ¶
func (p *PythonExecutor) Name() string
func (*PythonExecutor) Shutdown ¶
func (p *PythonExecutor) Shutdown() error
type RequestData ¶
type RequestData struct {
// Body is the request body
Body string `json:"body"`
// when grpc is used, this field in the grpc method name otherwise it is the http method
Method string `json:"method"`
// URL is the request URL in case of grpc it is the server address
URL string `json:"url"`
// GRPC related fields
Metadata map[string]string `json:"metadata"`
// HTTP related fields
Headers map[string]string `json:"headers"`
QueryParams map[string]string `json:"QueryParams"`
PathParams map[string]string `json:"pathParams"`
}
RequestData represents the HTTP request data that can be modified by scripts
func RequestDataFromDomain ¶
func RequestDataFromDomain(req *domain.Request) *RequestData
Click to show internal directories.
Click to hide internal directories.