tes

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package tes provides a context-aware TES REST client using the shared github.com/calypr/funnel/api/tes wire models. Configure credentials explicitly; this package does not read process environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelTaskResult

type CancelTaskResult struct {
	Response *tes.CancelTaskResponse
	Message  string // Informational message from server
}

CancelTaskResult wraps the response with optional metadata

type Client

type Client struct {
	User     string
	Password string
	Token    string
	// contains filtered or unexported fields
}

Client represents the HTTP Task client.

func NewClient

func NewClient(address string, options ...ClientOption) (*Client, error)

NewClient returns a new HTTP client for accessing Create/List/Get/Cancel Task endpoints. "address" is the address of the TES server. Credentials and plaintext opt-in default to the FUNNEL_SERVER_* and FUNNEL_ALLOW_INSECURE_CREDENTIALS environment variables. Options apply afterward.

func (*Client) CancelTask

func (c *Client) CancelTask(ctx context.Context, req *tes.CancelTaskRequest) (*tes.CancelTaskResponse, error)

CancelTask POSTs to /v1/tasks/{id}:cancel

func (*Client) CancelTaskWithMessage

func (c *Client) CancelTaskWithMessage(ctx context.Context, req *tes.CancelTaskRequest) (*CancelTaskResult, error)

CancelTaskWithMessage POSTs to /v1/tasks/{id}:cancel and returns any informational message

func (*Client) CreateTask

func (c *Client) CreateTask(ctx context.Context, task *tes.Task) (*tes.CreateTaskResponse, error)

CreateTask POSTs a Task message to /v1/tasks

func (*Client) GetServiceInfo

func (c *Client) GetServiceInfo(ctx context.Context, req *tes.GetServiceInfoRequest) (*tes.ServiceInfo, error)

GetServiceInfo returns result of GET /v1/service-info

func (*Client) GetTask

func (c *Client) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error)

GetTask returns the raw bytes from GET /v1/tasks/{id}

func (*Client) ListTasks

func (c *Client) ListTasks(ctx context.Context, req *tes.ListTasksRequest) (*tes.ListTasksResponse, error)

ListTasks returns the result of GET /v1/tasks

func (*Client) WaitForTask

func (c *Client) WaitForTask(ctx context.Context, taskIDs ...string) error

WaitForTask polls /v1/tasks/{id} for each Id provided and returns once all tasks are in a terminal state.

type ClientOption

type ClientOption func(*Client)

ClientOption configures a REST client.

func WithHTTPClient

func WithHTTPClient(client *http.Client) ClientOption

WithHTTPClient uses the caller's HTTP client, including its transport and timeout.

func WithInsecureCredentials

func WithInsecureCredentials() ClientOption

WithInsecureCredentials explicitly permits credentials over plaintext HTTP. HTTPS-to-HTTP credential redirects are permitted only with this option.

Jump to

Keyboard shortcuts

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