client

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: MIT Imports: 15 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)

Types

type Client

type Client interface {
	GetScript(id string) (script testkube.Script, err error)
	GetExecution(scriptID, executionID string) (execution testkube.Execution, err error)
	ListExecutions(scriptID string) (executions testkube.ExecutionsResult, err error)
	AbortExecution(script string, id string) error
	CreateScript(options CreateScriptOptions) (script testkube.Script, err error)
	ExecuteScript(id, namespace, executionName string, executionParams map[string]string) (execution testkube.Execution, err error)
	ListScripts(namespace string) (scripts testkube.Scripts, 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 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) CreateScript

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

CreateScript creates new Script Custom Resource

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) GetScript

func (c DirectScriptsAPI) GetScript(id string) (script testkube.Script, 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) ListScripts

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

GetExecutions list all executions in given script

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)
}

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) CreateScript

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

CreateScript creates new Script Custom Resource

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) 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) ListExecutions

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

ListExecutions list all executions for given script name

func (ProxyScriptsAPI) ListScripts

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

GetExecutions list all executions in given script

Jump to

Keyboard shortcuts

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