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 ¶
- type CancelTaskResult
- type Client
- func (c *Client) CancelTask(ctx context.Context, req *tes.CancelTaskRequest) (*tes.CancelTaskResponse, error)
- func (c *Client) CancelTaskWithMessage(ctx context.Context, req *tes.CancelTaskRequest) (*CancelTaskResult, error)
- func (c *Client) CreateTask(ctx context.Context, task *tes.Task) (*tes.CreateTaskResponse, error)
- func (c *Client) GetServiceInfo(ctx context.Context, req *tes.GetServiceInfoRequest) (*tes.ServiceInfo, error)
- func (c *Client) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error)
- func (c *Client) ListTasks(ctx context.Context, req *tes.ListTasksRequest) (*tes.ListTasksResponse, error)
- func (c *Client) WaitForTask(ctx context.Context, taskIDs ...string) error
- type ClientOption
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 ¶
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) ListTasks ¶
func (c *Client) ListTasks(ctx context.Context, req *tes.ListTasksRequest) (*tes.ListTasksResponse, error)
ListTasks returns the result of GET /v1/tasks
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.