client

package
v0.6.29 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientHTTPTimeout = time.Minute
)
View Source
const Version = "v1"

Variables

This section is empty.

Functions

func GetClientSet

func GetClientSet() (clientset kubernetes.Interface, err error)

func StreamToLogsChannel added in v0.6.5

func StreamToLogsChannel(resp io.Reader, logs chan output.Output)

Converts io.Reader with SSE data like `data: {"type": "event", "message":"something"}` to channel of output.Output objects, helps with logs streaming from SSE endpoint (passed from job executor)

Types

type Client

type Client interface {
	GetExecution(scriptID, executionID string) (execution testkube.Execution, err error)
	ListExecutions(scriptID string) (executions testkube.ExecutionsResult, err error)
	AbortExecution(script string, id string) error

	GetScript(id string) (script testkube.Script, err error)
	CreateScript(options CreateScriptOptions) (script testkube.Script, err error)
	DeleteScript(name string, namespace string) error
	DeleteScripts(namespace string) error
	ListScripts(namespace string) (scripts testkube.Scripts, err error)
	ExecuteScript(id, namespace, executionName string, executionParams map[string]string) (execution testkube.Execution, err error)
	Logs(id string) (logs chan output.Output, err error)

	CreateExecutor(options CreateExecutorOptions) (executor testkube.ExecutorDetails, err error)
	GetExecutor(name string) (executor testkube.ExecutorDetails, err error)
	ListExecutors() (executors testkube.ExecutorsDetails, err error)
	DeleteExecutor(name string) (err error)

	GetExecutionArtifacts(executionID string) (artifacts testkube.Artifacts, err error)
	DownloadFile(executionID, fileName, destination string) (artifact string, err error)

	GetServerInfo() (scripts testkube.ServerInfo, err error)
}

func GetClient

func GetClient(clientType ClientType, namespace string) (client Client, err error)

type ClientType

type ClientType string
const (
	ClientDirect ClientType = "direct"
	ClientProxy  ClientType = "proxy"
)

type Config

type Config struct {
	URI string `default:"http://localhost:8088"`
}

type CreateExecutorOptions added in v0.6.4

type CreateExecutorOptions testkube.ExecutorCreateRequest

CreateExectorOptions - is mapping for now to OpenAPI schema for creating request

type CreateScriptOptions

type CreateScriptOptions testkube.ScriptCreateRequest

CreateScriptOptions - is mapping for now to OpenAPI schema for creating request if needed can beextended to custom struct

type DirectScriptsAPI

type DirectScriptsAPI struct {
	URI string
	// contains filtered or unexported fields
}

func NewDefaultDirectScriptsAPI

func NewDefaultDirectScriptsAPI() DirectScriptsAPI

func NewDirectScriptsAPI

func NewDirectScriptsAPI(uri string) DirectScriptsAPI

func (DirectScriptsAPI) AbortExecution

func (c DirectScriptsAPI) AbortExecution(scriptID, id string) error

func (DirectScriptsAPI) CreateExecutor added in v0.6.4

func (c DirectScriptsAPI) CreateExecutor(options CreateExecutorOptions) (executor testkube.ExecutorDetails, err error)

func (DirectScriptsAPI) CreateScript

func (c DirectScriptsAPI) CreateScript(options CreateScriptOptions) (script testkube.Script, err error)

CreateScript creates new Script Custom Resource

func (DirectScriptsAPI) DeleteExecutor added in v0.6.4

func (c DirectScriptsAPI) DeleteExecutor(name string) (err error)

func (DirectScriptsAPI) DeleteScript added in v0.6.4

func (c DirectScriptsAPI) DeleteScript(name string, namespace string) error

func (DirectScriptsAPI) DeleteScripts added in v0.6.4

func (c DirectScriptsAPI) DeleteScripts(namespace string) error

func (DirectScriptsAPI) DownloadFile added in v0.6.9

func (c DirectScriptsAPI) DownloadFile(executionID, fileName, destination string) (artifact string, err error)

func (DirectScriptsAPI) ExecuteScript

func (c DirectScriptsAPI) ExecuteScript(id, namespace, executionName string, executionParams map[string]string) (execution testkube.Execution, err error)

ExecuteScript starts new external script execution, reads data and returns ID Execution is started asynchronously client can check later for results

func (DirectScriptsAPI) GetExecution

func (c DirectScriptsAPI) GetExecution(scriptID, executionID string) (execution testkube.Execution, err error)

func (DirectScriptsAPI) GetExecutionArtifacts added in v0.6.9

func (c DirectScriptsAPI) GetExecutionArtifacts(executionID string) (artifacts testkube.Artifacts, err error)

ListExecutions list all executions for given script name

func (DirectScriptsAPI) GetExecutor added in v0.6.4

func (c DirectScriptsAPI) GetExecutor(name string) (executor testkube.ExecutorDetails, err error)

func (DirectScriptsAPI) GetScript

func (c DirectScriptsAPI) GetScript(id string) (script testkube.Script, err error)

func (DirectScriptsAPI) GetServerInfo added in v0.6.2

func (c DirectScriptsAPI) GetServerInfo() (info testkube.ServerInfo, err error)

func (DirectScriptsAPI) ListExecutions

func (c DirectScriptsAPI) ListExecutions(scriptID string) (executions testkube.ExecutionsResult, err error)

ListExecutions list all executions for given script name

func (DirectScriptsAPI) ListExecutors added in v0.6.4

func (c DirectScriptsAPI) ListExecutors() (executors testkube.ExecutorsDetails, err error)

func (DirectScriptsAPI) ListScripts

func (c DirectScriptsAPI) ListScripts(namespace string) (scripts testkube.Scripts, err error)

ListScripts list all scripts in given namespace

func (DirectScriptsAPI) Logs added in v0.6.5

func (c DirectScriptsAPI) Logs(id string) (logs chan output.Output, err error)

Logs reads logs from API SSE endpoint asynchronously

type HTTPClient

type HTTPClient interface {
	Post(url, contentType string, body io.Reader) (resp *http.Response, err error)
	Get(url string) (resp *http.Response, err error)
	Do(req *http.Request) (resp *http.Response, err error)
}

type ProxyConfig

type ProxyConfig struct {
	// Namespace where testkube is installed
	Namespace string
	// API Server service name
	ServiceName string
	// API Server service port
	ServicePort int
}

func NewProxyConfig

func NewProxyConfig(namespace string) ProxyConfig

type ProxyScriptsAPI

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

func NewProxyScriptsAPI

func NewProxyScriptsAPI(client kubernetes.Interface, config ProxyConfig) ProxyScriptsAPI

func (ProxyScriptsAPI) AbortExecution

func (c ProxyScriptsAPI) AbortExecution(scriptID, id string) error

GetExecutions list all executions in given script

func (ProxyScriptsAPI) CreateExecutor added in v0.6.4

func (c ProxyScriptsAPI) CreateExecutor(options CreateExecutorOptions) (executor testkube.ExecutorDetails, err error)

func (ProxyScriptsAPI) CreateScript

func (c ProxyScriptsAPI) CreateScript(options CreateScriptOptions) (script testkube.Script, err error)

CreateScript creates new Script Custom Resource

func (ProxyScriptsAPI) DeleteExecutor added in v0.6.4

func (c ProxyScriptsAPI) DeleteExecutor(name string) (err error)

func (ProxyScriptsAPI) DeleteScript added in v0.6.4

func (c ProxyScriptsAPI) DeleteScript(name string, namespace string) error

func (ProxyScriptsAPI) DeleteScripts added in v0.6.4

func (c ProxyScriptsAPI) DeleteScripts(namespace string) error

func (ProxyScriptsAPI) DownloadFile added in v0.6.9

func (c ProxyScriptsAPI) DownloadFile(executionID, fileName, destination string) (artifact string, err error)

func (ProxyScriptsAPI) ExecuteScript

func (c ProxyScriptsAPI) ExecuteScript(id, namespace, executionName string, executionParams map[string]string) (execution testkube.Execution, err error)

ExecuteScript starts new external script execution, reads data and returns ID Execution is started asynchronously client can check later for results

func (ProxyScriptsAPI) GetExecution

func (c ProxyScriptsAPI) GetExecution(scriptID, executionID string) (execution testkube.Execution, err error)

func (ProxyScriptsAPI) GetExecutionArtifacts added in v0.6.9

func (c ProxyScriptsAPI) GetExecutionArtifacts(executionID string) (artifacts testkube.Artifacts, err error)

func (ProxyScriptsAPI) GetExecutor added in v0.6.4

func (c ProxyScriptsAPI) GetExecutor(name string) (executor testkube.ExecutorDetails, err error)

func (ProxyScriptsAPI) GetProxy

func (c ProxyScriptsAPI) GetProxy(requestType string) *rest.Request

func (ProxyScriptsAPI) GetScript

func (c ProxyScriptsAPI) GetScript(id string) (script testkube.Script, err error)

func (ProxyScriptsAPI) GetServerInfo added in v0.6.2

func (c ProxyScriptsAPI) GetServerInfo() (info testkube.ServerInfo, err error)

func (ProxyScriptsAPI) ListExecutions

func (c ProxyScriptsAPI) ListExecutions(scriptID string) (executions testkube.ExecutionsResult, err error)

ListExecutions list all executions for given script name

func (ProxyScriptsAPI) ListExecutors added in v0.6.4

func (c ProxyScriptsAPI) ListExecutors() (executors testkube.ExecutorsDetails, err error)

func (ProxyScriptsAPI) ListScripts

func (c ProxyScriptsAPI) ListScripts(namespace string) (scripts testkube.Scripts, err error)

GetExecutions list all executions in given script

func (ProxyScriptsAPI) Logs added in v0.6.5

func (c ProxyScriptsAPI) Logs(id string) (logs chan output.Output, err error)

Jump to

Keyboard shortcuts

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