client

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientHTTPTimeout = time.Minute
)
View Source
const TestkubeInstallationNamespace = "testkube"
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(executionID string) (execution testkube.Execution, err error)
	ListExecutions(scriptID string, limit int, tags []string) (executions testkube.ExecutionsResult, err error)
	AbortExecution(script string, id string) error

	GetScript(id, namespace string) (script testkube.Script, err error)
	CreateScript(options UpsertScriptOptions) (script testkube.Script, err error)
	UpdateScript(options UpsertScriptOptions) (script testkube.Script, err error)
	DeleteScript(name string, namespace string) error
	DeleteScripts(namespace string) error
	ListScripts(namespace string, tags []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)

	CreateTest(options UpsertTestOptions) (test testkube.Test, err error)
	UpdateTest(options UpsertTestOptions) (script testkube.Test, err error)
	GetTest(id string, namespace string) (script testkube.Test, err error)
	ListTests(namespace string, tags []string) (scripts testkube.Tests, err error)
	DeleteTest(name string, namespace string) error
	DeleteTests(namespace string) error
	ExecuteTest(id, namespace, executionName string, executionParams map[string]string) (execution testkube.TestExecution, err error)

	GetTestExecution(executionID string) (execution testkube.TestExecution, err error)
	ListTestExecutions(test string, limit int, tags []string) (executions testkube.TestExecutionsResult, err error)
	WatchTestExecution(executionID string) (execution chan testkube.TestExecution, 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 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 UpsertScriptOptions) (script testkube.Script, err error)

CreateScript creates new Script Custom Resource

func (DirectScriptsAPI) CreateTest added in v0.7.6

func (c DirectScriptsAPI) CreateTest(options UpsertTestOptions) (script testkube.Test, err error)

CreateTest creates new Test 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) DeleteTest added in v0.7.6

func (c DirectScriptsAPI) DeleteTest(name, namespace string) (err error)

func (DirectScriptsAPI) DeleteTests added in v0.7.27

func (c DirectScriptsAPI) DeleteTests(namespace string) (err 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) ExecuteTest added in v0.7.6

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

ExecuteTest starts new external test execution, reads data and returns ID

func (DirectScriptsAPI) GetExecution

func (c DirectScriptsAPI) GetExecution(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)

GetExecutionArtifacts list all artifacts of the execution

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, namespace 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) GetTest added in v0.7.6

func (c DirectScriptsAPI) GetTest(id, namespace string) (script testkube.Test, err error)

func (DirectScriptsAPI) GetTestExecution added in v0.7.6

func (c DirectScriptsAPI) GetTestExecution(executionID string) (execution testkube.TestExecution, err error)

func (DirectScriptsAPI) ListExecutions

func (c DirectScriptsAPI) ListExecutions(scriptID string, limit int, tags []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, tags []string) (scripts testkube.Scripts, err error)

ListScripts list all scripts in given namespace

func (DirectScriptsAPI) ListTestExecutions added in v0.7.6

func (c DirectScriptsAPI) ListTestExecutions(testName string, limit int, tags []string) (executions testkube.TestExecutionsResult, err error)

ListExecutions list all executions for given script name

func (DirectScriptsAPI) ListTests added in v0.7.6

func (c DirectScriptsAPI) ListTests(namespace string, tags []string) (tests testkube.Tests, err error)

ListTests 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

func (DirectScriptsAPI) UpdateScript added in v0.7.3

func (c DirectScriptsAPI) UpdateScript(options UpsertScriptOptions) (script testkube.Script, err error)

UpdateScript creates new Script Custom Resource

func (DirectScriptsAPI) UpdateTest added in v0.7.6

func (c DirectScriptsAPI) UpdateTest(options UpsertTestOptions) (test testkube.Test, err error)

UpdateTest creates new Test Custom Resource

func (DirectScriptsAPI) WatchTestExecution added in v0.7.16

func (c DirectScriptsAPI) WatchTestExecution(executionID string) (executionCh chan testkube.TestExecution, err error)

WatchTestExecution watches for changes in test executions

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 UpsertScriptOptions) (script testkube.Script, err error)

CreateScript creates new Script Custom Resource

func (ProxyScriptsAPI) CreateTest added in v0.7.6

func (c ProxyScriptsAPI) CreateTest(options UpsertTestOptions) (script testkube.Test, err error)

CreateTest creates new Test 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) DeleteTest added in v0.7.6

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

func (ProxyScriptsAPI) DeleteTests added in v0.7.27

func (c ProxyScriptsAPI) DeleteTests(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) ExecuteTest added in v0.7.6

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

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

func (ProxyScriptsAPI) GetExecution

func (c ProxyScriptsAPI) GetExecution(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, namespace 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) GetTest added in v0.7.6

func (c ProxyScriptsAPI) GetTest(id, namespace string) (script testkube.Test, err error)

func (ProxyScriptsAPI) GetTestExecution added in v0.7.6

func (c ProxyScriptsAPI) GetTestExecution(executionID string) (execution testkube.TestExecution, err error)

func (ProxyScriptsAPI) ListExecutions

func (c ProxyScriptsAPI) ListExecutions(scriptID string, limit int, tags []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, tags []string) (scripts testkube.Scripts, err error)

GetExecutions list all executions in given script

func (ProxyScriptsAPI) ListTestExecutions added in v0.7.6

func (c ProxyScriptsAPI) ListTestExecutions(testID string, limit int, tags []string) (executions testkube.TestExecutionsResult, err error)

ListExecutions list all executions for given test name

func (ProxyScriptsAPI) ListTests added in v0.7.6

func (c ProxyScriptsAPI) ListTests(namespace string, tags []string) (scripts testkube.Tests, err error)

func (ProxyScriptsAPI) Logs added in v0.6.5

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

func (ProxyScriptsAPI) UpdateScript added in v0.7.3

func (c ProxyScriptsAPI) UpdateScript(options UpsertScriptOptions) (script testkube.Script, err error)

UpdateScript creates new Script Custom Resource

func (ProxyScriptsAPI) UpdateTest added in v0.7.6

func (c ProxyScriptsAPI) UpdateTest(options UpsertTestOptions) (script testkube.Test, err error)

UpdateTest creates new Test Custom Resource

func (ProxyScriptsAPI) WatchTestExecution added in v0.7.16

func (c ProxyScriptsAPI) WatchTestExecution(executionID string) (executionCh chan testkube.TestExecution, err error)

WatchTestExecution watches for changes in test executions

type UpsertScriptOptions added in v0.7.3

type UpsertScriptOptions testkube.ScriptUpsertRequest

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

type UpsertTestOptions added in v0.7.6

type UpsertTestOptions testkube.TestUpsertRequest

Jump to

Keyboard shortcuts

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