Documentation
¶
Overview ¶
Package client provides a type-safe client for the Testground server.
Testground uses a client-server architecture. The Testground client talks to the Testground daemon, which builds, and runs your test plans.
The Testground client and daemon can run on the same system, or you can connect a Testground client to a remote Testground daemon.
Currently all commands to Testground, but the `daemon` command, are client-side commands.
Index ¶
- func ParseDescribeResponse(r io.ReadCloser) error
- func ParseListResponse(r io.ReadCloser) error
- func ParseTerminateRequest(r io.ReadCloser) error
- type BuildRequest
- type BuildResponse
- type Client
- func (c *Client) Build(ctx context.Context, r *BuildRequest) (io.ReadCloser, error)
- func (c *Client) Close() error
- func (c *Client) CollectOutputs(ctx context.Context, r *OutputsRequest) (io.ReadCloser, error)
- func (c *Client) Describe(ctx context.Context, r *DescribeRequest) (io.ReadCloser, error)
- func (c *Client) Healthcheck(ctx context.Context, r *HealthcheckRequest) (io.ReadCloser, error)
- func (c *Client) List(ctx context.Context) (io.ReadCloser, error)
- func (c *Client) Run(ctx context.Context, r *RunRequest) (io.ReadCloser, error)
- func (c *Client) Terminate(ctx context.Context, r *TerminateRequest) (io.ReadCloser, error)
- type CollectResponse
- type DescribeRequest
- type HealthcheckRequest
- type HealthcheckResponse
- type OutputsRequest
- type RunRequest
- type RunResponse
- type TerminateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseDescribeResponse ¶
func ParseDescribeResponse(r io.ReadCloser) error
ParseDescribeResponse parses a response from a `describe` call
func ParseListResponse ¶
func ParseListResponse(r io.ReadCloser) error
ParseListResponse parses a response from a `list` call
func ParseTerminateRequest ¶ added in v0.2.0
func ParseTerminateRequest(r io.ReadCloser) error
ParseTerminateRequest parses a response from a 'terminate' call
Types ¶
type BuildRequest ¶
type BuildRequest struct {
Composition api.Composition `json:"composition"`
}
BuildRequest is the request struct for the `build` function.
type BuildResponse ¶
type BuildResponse = []api.BuildOutput
BuildResponse is the response struct for the `build` function.
func ParseBuildResponse ¶
func ParseBuildResponse(r io.ReadCloser) (BuildResponse, error)
ParseBuildResponse parses a response from a `build` call
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the API client that performs all operations against a Testground server.
func (*Client) Build ¶
func (c *Client) Build(ctx context.Context, r *BuildRequest) (io.ReadCloser, error)
Build sends `build` request to the daemon. The Body in the response implement an io.ReadCloser and it's up to the caller to close it. The response is a stream of `Msg` protocol messages. See `ParseBuildResponse()` for specifics.
func (*Client) CollectOutputs ¶
func (c *Client) CollectOutputs(ctx context.Context, r *OutputsRequest) (io.ReadCloser, error)
CollectOutputs sends a `collectOutputs` request to the daemon.
The Body in the response implement an io.ReadCloser and it's up to the caller to close it.
func (*Client) Describe ¶
func (c *Client) Describe(ctx context.Context, r *DescribeRequest) (io.ReadCloser, error)
Describe sends `describe` request to the daemon. The Body in the response implement an io.ReadCloser and it's up to the caller to close it. The response is a stream of `Msg` protocol messages. See `ParseDescribeResponse()` for specifics.
func (*Client) Healthcheck ¶ added in v0.2.0
func (c *Client) Healthcheck(ctx context.Context, r *HealthcheckRequest) (io.ReadCloser, error)
Healthcheck sends a `healthcheck` request to the daemon.
func (*Client) List ¶
List sends `list` request to the daemon. The Body in the response implement an io.ReadCloser and it's up to the caller to close it.
func (*Client) Run ¶
func (c *Client) Run(ctx context.Context, r *RunRequest) (io.ReadCloser, error)
Run sends `run` request to the daemon. The Body in the response implement an io.ReadCloser and it's up to the caller to close it. The response is a stream of `Msg` protocol messages.
func (*Client) Terminate ¶ added in v0.2.0
func (c *Client) Terminate(ctx context.Context, r *TerminateRequest) (io.ReadCloser, error)
Terminate sends a `terminate` request to the daemon.
type CollectResponse ¶ added in v0.4.0
func ParseCollectResponse ¶ added in v0.4.0
func ParseCollectResponse(r io.ReadCloser, file io.Writer) (CollectResponse, error)
ParseCollectResponse parses a response from a `collect` call
type DescribeRequest ¶
type DescribeRequest struct {
Term string `json:"term"`
}
DescribeRequest is the request struct for the `describe` function.
type HealthcheckRequest ¶ added in v0.2.0
type HealthcheckResponse ¶ added in v0.2.0
type HealthcheckResponse = api.HealthcheckReport
func ParseHealthcheckResponse ¶ added in v0.2.0
func ParseHealthcheckResponse(r io.ReadCloser) (HealthcheckResponse, error)
ParseHealthcheckResponse parses a response from a 'healthcheck' call
type OutputsRequest ¶
type RunRequest ¶
type RunRequest struct {
Composition api.Composition `json:"composition"`
}
RunRequest is the request struct for the `run` function.
type RunResponse ¶
func ParseRunResponse ¶
func ParseRunResponse(r io.ReadCloser) (RunResponse, error)
ParseRunResponse parses a response from a `run` call
type TerminateRequest ¶ added in v0.2.0
type TerminateRequest struct {
Runner string `json:"runner"`
}