api

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAgentAPIPingRequest

func NewAgentAPIPingRequest(server string) (*http.Request, error)

NewAgentAPIPingRequest constructs an http.Request for the AgentAPIPing method

func NewAgentCheckinRequest added in v1.0.0

func NewAgentCheckinRequest(server string, body AgentCheckinJSONRequestBody) (*http.Request, error)

NewAgentCheckinRequest calls the generic AgentCheckin builder with application/json body

func NewAgentCheckinRequestWithBody added in v1.0.0

func NewAgentCheckinRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewAgentCheckinRequestWithBody constructs an http.Request for the AgentCheckin method, with any body, and a specified content type

func NewHealthRequest

func NewHealthRequest(server string) (*http.Request, error)

NewHealthRequest constructs an http.Request for the Health method

Types

type AgentAPIPingResponse

type AgentAPIPingResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseAgentAPIPingResponse

func ParseAgentAPIPingResponse(rsp *http.Response) (*AgentAPIPingResponse, error)

ParseAgentAPIPingResponse parses an HTTP response from a AgentAPIPingWithResponse call

func (AgentAPIPingResponse) ContentType added in v1.2.0

func (r AgentAPIPingResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (AgentAPIPingResponse) GetBody added in v1.2.0

func (r AgentAPIPingResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (AgentAPIPingResponse) Status

func (r AgentAPIPingResponse) Status() string

Status returns HTTPResponse.Status

func (AgentAPIPingResponse) StatusCode

func (r AgentAPIPingResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type AgentCheckinInput added in v1.0.0

type AgentCheckinInput struct {
	AgentID      *string `json:"agentID,omitempty"`
	AgentVersion *string `json:"agentVersion,omitempty"`

	// Paused Self-reported quiesced acknowledgement. A pause-aware agent sets
	// this to true only once it has observed the pause and its in-flight
	// worker has exited (it is in the paused sleep loop). It is
	// level-triggered — sent on every checkin while quiesced — and the
	// server records it only while the agent is actually paused, so a
	// stale ack racing an unpause is ignored. Optional: absent means the
	// agent has not acknowledged quiescing.
	Paused     *bool        `json:"paused,omitempty"`
	PoolLabels *[]PoolLabel `json:"poolLabels,omitempty"`
}

AgentCheckinInput defines model for agentCheckinInput.

type AgentCheckinJSONRequestBody added in v1.0.0

type AgentCheckinJSONRequestBody = AgentCheckinInput

AgentCheckinJSONRequestBody defines body for AgentCheckin for application/json ContentType.

type AgentCheckinOutput added in v1.0.0

type AgentCheckinOutput struct {
	AuthToken *string `json:"authToken,omitempty"`

	// PauseReason The reason recorded with the pause, for the host operator's logs. Present only when paused and a reason was given.
	PauseReason *string `json:"pauseReason,omitempty"`

	// Paused True when the agent is paused and must not launch workers: it
	// should log the pause, skip launching, and keep checking in on its
	// existing cadence until this clears. A paused checkin is still a
	// successful checkin and must not count toward the agent's max-error
	// process exit. Optional — absent or false means run normally, so an
	// older agent binary talking to this API (or a newer agent talking
	// to an older API) safely defaults to running.
	Paused *bool `json:"paused,omitempty"`

	// PausedAt When the pause was set. Present only when paused.
	PausedAt *time.Time `json:"pausedAt,omitempty"`

	// PausedBy Who set the pause (email, or client identity for machine tokens). Present only when paused.
	PausedBy                   *string                `json:"pausedBy,omitempty"`
	RequiredAgentVersion       *string                `json:"requiredAgentVersion,omitempty"`
	WorkerEnvironmentVariables *[]EnvironmentVariable `json:"workerEnvironmentVariables,omitempty"`
	WorkerImageURI             *string                `json:"workerImageURI,omitempty"`
}

AgentCheckinOutput defines model for agentCheckinOutput.

type AgentCheckinResponse added in v1.0.0

type AgentCheckinResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *AgentCheckinOutput
}

func ParseAgentCheckinResponse added in v1.0.0

func ParseAgentCheckinResponse(rsp *http.Response) (*AgentCheckinResponse, error)

ParseAgentCheckinResponse parses an HTTP response from a AgentCheckinWithResponse call

func (AgentCheckinResponse) ContentType added in v1.2.0

func (r AgentCheckinResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (AgentCheckinResponse) GetBody added in v1.2.0

func (r AgentCheckinResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (AgentCheckinResponse) GetJSON200 added in v1.2.0

func (r AgentCheckinResponse) GetJSON200() *AgentCheckinOutput

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (AgentCheckinResponse) Status added in v1.0.0

func (r AgentCheckinResponse) Status() string

Status returns HTTPResponse.Status

func (AgentCheckinResponse) StatusCode added in v1.0.0

func (r AgentCheckinResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) AgentAPIPing

func (c *Client) AgentAPIPing(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

AgentAPIPing performs a GET /agentapiping (the `AgentAPIPing` operationId) request.

Used for testing, to validate the specific existence of the Agent API

func (*Client) AgentCheckin added in v1.0.0

func (c *Client) AgentCheckin(ctx context.Context, body AgentCheckinJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

AgentCheckin performs a POST /agent/checkin (the `AgentCheckin` operationId) request. Takes a body of the `application/json` content type.

Startup endpoint for agents.

func (*Client) AgentCheckinWithBody added in v1.0.0

func (c *Client) AgentCheckinWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

AgentCheckinWithBody performs a POST /agent/checkin (the `AgentCheckin` operationId) request, with any type of body and a specified content type.

Startup endpoint for agents.

func (*Client) Health

func (c *Client) Health(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

Health performs a GET /health (the `Health` operationId) request.

Returns whether the service is healthy or not.

type ClientInterface

type ClientInterface interface {

	// AgentCheckinWithBody performs a POST /agent/checkin (the `AgentCheckin` operationId) request,
	// with any type of body and a specified content type.
	//
	// Startup endpoint for agents.
	AgentCheckinWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// AgentCheckin performs a POST /agent/checkin (the `AgentCheckin` operationId) request.
	// Takes a body of the `application/json` content type.
	//
	// Startup endpoint for agents.
	AgentCheckin(ctx context.Context, body AgentCheckinJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// AgentAPIPing performs a GET /agentapiping (the `AgentAPIPing` operationId) request.
	//
	// Used for testing, to validate the specific existence of the Agent API
	AgentAPIPing(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// Health performs a GET /health (the `Health` operationId) request.
	//
	// Returns whether the service is healthy or not.
	Health(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) AgentAPIPingWithResponse

func (c *ClientWithResponses) AgentAPIPingWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*AgentAPIPingResponse, error)

AgentAPIPingWithResponse performs a GET /agentapiping (the `AgentAPIPing` operationId) request.

Used for testing, to validate the specific existence of the Agent API

Returns a wrapper object for the known response body format(s).

func (*ClientWithResponses) AgentCheckinWithBodyWithResponse added in v1.0.0

func (c *ClientWithResponses) AgentCheckinWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AgentCheckinResponse, error)

AgentCheckinWithBodyWithResponse performs a POST /agent/checkin (the `AgentCheckin` operationId) request, with any type of body and a specified content type.

Startup endpoint for agents.

Returns a wrapper object for the known response body format(s).

func (*ClientWithResponses) AgentCheckinWithResponse added in v1.0.0

func (c *ClientWithResponses) AgentCheckinWithResponse(ctx context.Context, body AgentCheckinJSONRequestBody, reqEditors ...RequestEditorFn) (*AgentCheckinResponse, error)

AgentCheckinWithResponse performs a POST /agent/checkin (the `AgentCheckin` operationId) request. Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).

Startup endpoint for agents.

func (*ClientWithResponses) HealthWithResponse

func (c *ClientWithResponses) HealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthResponse, error)

HealthWithResponse performs a GET /health (the `Health` operationId) request.

Returns whether the service is healthy or not.

Returns a wrapper object for the known response body format(s).

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {

	// AgentCheckinWithBodyWithResponse performs a POST /agent/checkin (the `AgentCheckin` operationId) request,
	// with any type of body and a specified content type.
	//
	// Startup endpoint for agents.
	//
	// Returns a wrapper object for the known response body format(s).
	AgentCheckinWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AgentCheckinResponse, error)

	// AgentCheckinWithResponse performs a POST /agent/checkin (the `AgentCheckin` operationId) request.
	// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
	//
	// Startup endpoint for agents.
	AgentCheckinWithResponse(ctx context.Context, body AgentCheckinJSONRequestBody, reqEditors ...RequestEditorFn) (*AgentCheckinResponse, error)

	// AgentAPIPingWithResponse performs a GET /agentapiping (the `AgentAPIPing` operationId) request.
	//
	// Used for testing, to validate the specific existence of the Agent API
	//
	// Returns a wrapper object for the known response body format(s).
	AgentAPIPingWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*AgentAPIPingResponse, error)

	// HealthWithResponse performs a GET /health (the `Health` operationId) request.
	//
	// Returns whether the service is healthy or not.
	//
	// Returns a wrapper object for the known response body format(s).
	HealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type EnvironmentVariable

type EnvironmentVariable = []string

EnvironmentVariable defines model for environmentVariable.

type HealthResponse

type HealthResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseHealthResponse

func ParseHealthResponse(rsp *http.Response) (*HealthResponse, error)

ParseHealthResponse parses an HTTP response from a HealthWithResponse call

func (HealthResponse) ContentType added in v1.2.0

func (r HealthResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (HealthResponse) GetBody added in v1.2.0

func (r HealthResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (HealthResponse) Status

func (r HealthResponse) Status() string

Status returns HTTPResponse.Status

func (HealthResponse) StatusCode

func (r HealthResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type PoolLabel

type PoolLabel = string

PoolLabel defines model for poolLabel.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

Jump to

Keyboard shortcuts

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