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.2 DO NOT EDIT.
Package api is the runner's client for the Backproof v1 API.
Index ¶
- Variables
- func NewGetRunnerStatusRequest(server string) (*http.Request, error)
- func NewHeartbeatJobRequest(server string, id JobId, body HeartbeatJobJSONRequestBody) (*http.Request, error)
- func NewHeartbeatJobRequestWithBody(server string, id JobId, contentType string, body io.Reader) (*http.Request, error)
- func NewPollRunnerRequest(server string, body PollRunnerJSONRequestBody) (*http.Request, error)
- func NewPollRunnerRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewRegisterRunnerRequest(server string, body RegisterRunnerJSONRequestBody) (*http.Request, error)
- func NewRegisterRunnerRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewSubmitJobResultRequest(server string, id JobId, body SubmitJobResultJSONRequestBody) (*http.Request, error)
- func NewSubmitJobResultRequestWithBody(server string, id JobId, contentType string, body io.Reader) (*http.Request, error)
- type BackupDetails
- type BackupDetailsCompression
- type BackupDetailsEncryption
- type BackupDetailsFormat
- type BackupDetailsVersionSource
- type BadRequest
- type Capabilities
- type CheckConfig
- type CheckConfigRowCountMode
- type CheckResult
- type CheckResultName
- type CheckResultStatus
- type Client
- func (c *Client) GetRunnerStatus(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) HeartbeatJob(ctx context.Context, id JobId, body HeartbeatJobJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) HeartbeatJobWithBody(ctx context.Context, id JobId, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) PollRunner(ctx context.Context, body PollRunnerJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) PollRunnerWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) RegisterRunner(ctx context.Context, body RegisterRunnerJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) RegisterRunnerWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) SubmitJobResult(ctx context.Context, id JobId, body SubmitJobResultJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) SubmitJobResultWithBody(ctx context.Context, id JobId, contentType string, body io.Reader, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) GetRunnerStatusWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetRunnerStatusResponse, error)
- func (c *ClientWithResponses) HeartbeatJobWithBodyWithResponse(ctx context.Context, id JobId, contentType string, body io.Reader, ...) (*HeartbeatJobResponse, error)
- func (c *ClientWithResponses) HeartbeatJobWithResponse(ctx context.Context, id JobId, body HeartbeatJobJSONRequestBody, ...) (*HeartbeatJobResponse, error)
- func (c *ClientWithResponses) PollRunnerWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*PollRunnerResponse, error)
- func (c *ClientWithResponses) PollRunnerWithResponse(ctx context.Context, body PollRunnerJSONRequestBody, ...) (*PollRunnerResponse, error)
- func (c *ClientWithResponses) RegisterRunnerWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*RegisterRunnerResponse, error)
- func (c *ClientWithResponses) RegisterRunnerWithResponse(ctx context.Context, body RegisterRunnerJSONRequestBody, ...) (*RegisterRunnerResponse, error)
- func (c *ClientWithResponses) SubmitJobResultWithBodyWithResponse(ctx context.Context, id JobId, contentType string, body io.Reader, ...) (*SubmitJobResultResponse, error)
- func (c *ClientWithResponses) SubmitJobResultWithResponse(ctx context.Context, id JobId, body SubmitJobResultJSONRequestBody, ...) (*SubmitJobResultResponse, error)
- type ClientWithResponsesInterface
- type Compression
- type Encryption
- type Error
- type GetRunnerStatusResponse
- func (r GetRunnerStatusResponse) ContentType() string
- func (r GetRunnerStatusResponse) GetBody() []byte
- func (r GetRunnerStatusResponse) GetJSON200() *RunnerStatus
- func (r GetRunnerStatusResponse) GetJSON401() *Unauthorized
- func (r GetRunnerStatusResponse) GetJSON429() *TooManyRequests
- func (r GetRunnerStatusResponse) Status() string
- func (r GetRunnerStatusResponse) StatusCode() int
- type GetRunnerStatusResponse200Headers
- type GetRunnerStatusResponse429Headers
- type HeartbeatJobJSONRequestBody
- type HeartbeatJobResponse
- func (r HeartbeatJobResponse) ContentType() string
- func (r HeartbeatJobResponse) GetBody() []byte
- func (r HeartbeatJobResponse) GetJSON200() *HeartbeatResponse
- func (r HeartbeatJobResponse) GetJSON400() *BadRequest
- func (r HeartbeatJobResponse) GetJSON401() *Unauthorized
- func (r HeartbeatJobResponse) GetJSON404() *NotFound
- func (r HeartbeatJobResponse) GetJSON409() *LeaseLost
- func (r HeartbeatJobResponse) GetJSON429() *TooManyRequests
- func (r HeartbeatJobResponse) Status() string
- func (r HeartbeatJobResponse) StatusCode() int
- type HeartbeatJobResponse429Headers
- type HeartbeatRequest
- type HeartbeatResponse
- type HttpRequestDoer
- type Job
- type JobId
- type JobResult
- type JobResultFailedStage
- type JobResultSchemaVersion
- type JobResultStatus
- type LatestTimestampCheck
- type LeaseLost
- type NotFound
- type PollRequest
- type PollRequestStatus
- type PollResult
- type PollRunnerJSONRequestBody
- type PollRunnerResponse
- func (r PollRunnerResponse) ContentType() string
- func (r PollRunnerResponse) GetBody() []byte
- func (r PollRunnerResponse) GetJSON200() *Job
- func (r PollRunnerResponse) GetJSON400() *BadRequest
- func (r PollRunnerResponse) GetJSON401() *Unauthorized
- func (r PollRunnerResponse) GetJSON426() *Error
- func (r PollRunnerResponse) GetJSON429() *TooManyRequests
- func (r PollRunnerResponse) Status() string
- func (r PollRunnerResponse) StatusCode() int
- type PollRunnerResponse200Headers
- type PollRunnerResponse204Headers
- type PollRunnerResponse426Headers
- type PollRunnerResponse429Headers
- type RegisterRequest
- type RegisterRequestArch
- type RegisterRequestOs
- type RegisterResponse
- type RegisterRunnerJSONRequestBody
- type RegisterRunnerResponse
- func (r RegisterRunnerResponse) ContentType() string
- func (r RegisterRunnerResponse) GetBody() []byte
- func (r RegisterRunnerResponse) GetJSON201() *RegisterResponse
- func (r RegisterRunnerResponse) GetJSON400() *BadRequest
- func (r RegisterRunnerResponse) GetJSON401() *Unauthorized
- func (r RegisterRunnerResponse) GetJSON429() *TooManyRequests
- func (r RegisterRunnerResponse) Status() string
- func (r RegisterRunnerResponse) StatusCode() int
- type RegisterRunnerResponse429Headers
- type RequestEditorFn
- type ResponseError
- type RunnerClient
- func (c *RunnerClient) Heartbeat(ctx context.Context, jobID JobId, stage Stage) (HeartbeatResponse, error)
- func (c *RunnerClient) Poll(ctx context.Context, request PollRequest) (PollResult, error)
- func (c *RunnerClient) Register(ctx context.Context, request RegisterRequest) (RegisterResponse, error)
- func (c *RunnerClient) Status(ctx context.Context) (StatusResult, error)
- func (c *RunnerClient) SubmitResult(ctx context.Context, jobID JobId, result JobResult) error
- type RunnerSource
- type RunnerStatus
- type SealedBundleContents
- type SealedBundleContentsVersion
- type Source
- type SourceEncryption
- type SourceExpectedFormat
- type Stage
- type StageTiming
- type StatusResult
- type SubmitJobResultJSONRequestBody
- type SubmitJobResultResponse
- func (r SubmitJobResultResponse) ContentType() string
- func (r SubmitJobResultResponse) GetBody() []byte
- func (r SubmitJobResultResponse) GetJSON400() *BadRequest
- func (r SubmitJobResultResponse) GetJSON401() *Unauthorized
- func (r SubmitJobResultResponse) GetJSON404() *NotFound
- func (r SubmitJobResultResponse) GetJSON409() *LeaseLost
- func (r SubmitJobResultResponse) GetJSON429() *TooManyRequests
- func (r SubmitJobResultResponse) Status() string
- func (r SubmitJobResultResponse) StatusCode() int
- type SubmitJobResultResponse429Headers
- type TableFinding
- type TableFindingProblem
- type TableKey
- type TableRowCount
- type TableTolerance
- type TooManyRequests
- type Unauthorized
Constants ¶
This section is empty.
Variables ¶
var ErrLeaseLost = errors.New("this runner no longer holds the job")
ErrLeaseLost means this runner no longer holds the job, so it must stop working on it.
Functions ¶
func NewGetRunnerStatusRequest ¶
NewGetRunnerStatusRequest constructs an http.Request for the GetRunnerStatus method
func NewHeartbeatJobRequest ¶
func NewHeartbeatJobRequest(server string, id JobId, body HeartbeatJobJSONRequestBody) (*http.Request, error)
NewHeartbeatJobRequest calls the generic HeartbeatJob builder with application/json body
func NewHeartbeatJobRequestWithBody ¶
func NewHeartbeatJobRequestWithBody(server string, id JobId, contentType string, body io.Reader) (*http.Request, error)
NewHeartbeatJobRequestWithBody constructs an http.Request for the HeartbeatJob method, with any body, and a specified content type
func NewPollRunnerRequest ¶
func NewPollRunnerRequest(server string, body PollRunnerJSONRequestBody) (*http.Request, error)
NewPollRunnerRequest calls the generic PollRunner builder with application/json body
func NewPollRunnerRequestWithBody ¶
func NewPollRunnerRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewPollRunnerRequestWithBody constructs an http.Request for the PollRunner method, with any body, and a specified content type
func NewRegisterRunnerRequest ¶
func NewRegisterRunnerRequest(server string, body RegisterRunnerJSONRequestBody) (*http.Request, error)
NewRegisterRunnerRequest calls the generic RegisterRunner builder with application/json body
func NewRegisterRunnerRequestWithBody ¶
func NewRegisterRunnerRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewRegisterRunnerRequestWithBody constructs an http.Request for the RegisterRunner method, with any body, and a specified content type
func NewSubmitJobResultRequest ¶
func NewSubmitJobResultRequest(server string, id JobId, body SubmitJobResultJSONRequestBody) (*http.Request, error)
NewSubmitJobResultRequest calls the generic SubmitJobResult builder with application/json body
func NewSubmitJobResultRequestWithBody ¶
func NewSubmitJobResultRequestWithBody(server string, id JobId, contentType string, body io.Reader) (*http.Request, error)
NewSubmitJobResultRequestWithBody constructs an http.Request for the SubmitJobResult method, with any body, and a specified content type
Types ¶
type BackupDetails ¶
type BackupDetails struct {
Compression *BackupDetailsCompression `json:"compression"`
Encryption *BackupDetailsEncryption `json:"encryption"`
Format *BackupDetailsFormat `json:"format"`
ObjectKey *string `json:"object_key"`
PostgresMajor *int `json:"postgres_major"`
// PostgresVersion Example: 17.4
PostgresVersion *string `json:"postgres_version"`
RestoredMajor *int `json:"restored_major"`
SizeBytes *int64 `json:"size_bytes"`
// Time When the backup was stored.
Time *time.Time `json:"time"`
VersionSource *BackupDetailsVersionSource `json:"version_source"`
}
BackupDetails What the runner learned about the backup. Values are null until they are known.
type BackupDetailsCompression ¶
type BackupDetailsCompression string
BackupDetailsCompression defines model for BackupDetails.Compression.
const ( BackupDetailsCompressionGzip BackupDetailsCompression = "gzip" BackupDetailsCompressionLessThannil BackupDetailsCompression = "<nil>" BackupDetailsCompressionZstd BackupDetailsCompression = "zstd" )
Defines values for BackupDetailsCompression.
func (BackupDetailsCompression) Valid ¶
func (e BackupDetailsCompression) Valid() bool
Valid indicates whether the value is a known member of the BackupDetailsCompression enum.
type BackupDetailsEncryption ¶
type BackupDetailsEncryption string
BackupDetailsEncryption defines model for BackupDetails.Encryption.
const ( BackupDetailsEncryptionAge BackupDetailsEncryption = "age" BackupDetailsEncryptionGpg BackupDetailsEncryption = "gpg" BackupDetailsEncryptionLessThannil BackupDetailsEncryption = "<nil>" )
Defines values for BackupDetailsEncryption.
func (BackupDetailsEncryption) Valid ¶
func (e BackupDetailsEncryption) Valid() bool
Valid indicates whether the value is a known member of the BackupDetailsEncryption enum.
type BackupDetailsFormat ¶
type BackupDetailsFormat string
BackupDetailsFormat defines model for BackupDetails.Format.
const ( BackupDetailsFormatCustom BackupDetailsFormat = "custom" BackupDetailsFormatLessThannil BackupDetailsFormat = "<nil>" BackupDetailsFormatPlain BackupDetailsFormat = "plain" BackupDetailsFormatUnknown BackupDetailsFormat = "unknown" )
Defines values for BackupDetailsFormat.
func (BackupDetailsFormat) Valid ¶
func (e BackupDetailsFormat) Valid() bool
Valid indicates whether the value is a known member of the BackupDetailsFormat enum.
type BackupDetailsVersionSource ¶
type BackupDetailsVersionSource string
BackupDetailsVersionSource defines model for BackupDetails.VersionSource.
const ( BackupDetailsVersionSourceDefault BackupDetailsVersionSource = "default" BackupDetailsVersionSourceDump BackupDetailsVersionSource = "dump" BackupDetailsVersionSourceHint BackupDetailsVersionSource = "hint" BackupDetailsVersionSourceLessThannil BackupDetailsVersionSource = "<nil>" )
Defines values for BackupDetailsVersionSource.
func (BackupDetailsVersionSource) Valid ¶
func (e BackupDetailsVersionSource) Valid() bool
Valid indicates whether the value is a known member of the BackupDetailsVersionSource enum.
type Capabilities ¶
type Capabilities struct {
Compression []Compression `json:"compression"`
Encryption []Encryption `json:"encryption"`
// PostgresMajors The Postgres major versions this runner can restore into.
//
// Example: [14,15,16,17,18]
PostgresMajors []int `json:"postgres_majors"`
}
Capabilities defines model for Capabilities.
type CheckConfig ¶
type CheckConfig struct {
// Baseline Row counts from the last passing run. Empty on a source's first run.
Baseline []TableRowCount `json:"baseline"`
// ExpectedTables Tables that must exist, as `schema.table`. Only used with `show_table_names` on.
ExpectedTables []string `json:"expected_tables"`
// LatestTimestamp The freshness check. It is null when the source doesn't use one.
LatestTimestamp *LatestTimestampCheck `json:"latest_timestamp"`
RowCountMode CheckConfigRowCountMode `json:"row_count_mode"`
// TableTolerances Overrides of `tolerance_percent` for single tables.
TableTolerances []TableTolerance `json:"table_tolerances"`
// TolerancePercent How far a table's row count may move from the baseline.
TolerancePercent float32 `json:"tolerance_percent"`
}
CheckConfig defines model for CheckConfig.
type CheckConfigRowCountMode ¶
type CheckConfigRowCountMode string
CheckConfigRowCountMode defines model for CheckConfig.RowCountMode.
const ( Estimate CheckConfigRowCountMode = "estimate" Exact CheckConfigRowCountMode = "exact" )
Defines values for CheckConfigRowCountMode.
func (CheckConfigRowCountMode) Valid ¶
func (e CheckConfigRowCountMode) Valid() bool
Valid indicates whether the value is a known member of the CheckConfigRowCountMode enum.
type CheckResult ¶
type CheckResult struct {
Code *string `json:"code"`
Expected *string `json:"expected"`
// Measured The measured value, such as the newest timestamp in the chosen column.
Measured *string `json:"measured"`
Name CheckResultName `json:"name"`
// Reason Never contains a table name.
Reason *string `json:"reason"`
Status CheckResultStatus `json:"status"`
// Tables The tables that made this check fail.
Tables []TableFinding `json:"tables"`
}
CheckResult defines model for CheckResult.
type CheckResultName ¶
type CheckResultName string
CheckResultName defines model for CheckResult.Name.
const ( LatestTimestamp CheckResultName = "latest_timestamp" RowCounts CheckResultName = "row_counts" TablesExist CheckResultName = "tables_exist" )
Defines values for CheckResultName.
func (CheckResultName) Valid ¶
func (e CheckResultName) Valid() bool
Valid indicates whether the value is a known member of the CheckResultName enum.
type CheckResultStatus ¶
type CheckResultStatus string
CheckResultStatus defines model for CheckResult.Status.
const ( CheckResultStatusFail CheckResultStatus = "fail" CheckResultStatusPass CheckResultStatus = "pass" CheckResultStatusSkipped CheckResultStatus = "skipped" )
Defines values for CheckResultStatus.
func (CheckResultStatus) Valid ¶
func (e CheckResultStatus) Valid() bool
Valid indicates whether the value is a known member of the CheckResultStatus enum.
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) GetRunnerStatus ¶
func (c *Client) GetRunnerStatus(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
GetRunnerStatus Show what Backproof knows about this runner
Lets `backproof doctor` confirm the token works and list the sources this runner has keys for. It is read-only: it never claims a job and doesn't count as a check-in. Keys and sealed bundles are never returned.
Corresponds with GET /v1/runners/me (the `GetRunnerStatus` operationId).
func (*Client) HeartbeatJob ¶
func (c *Client) HeartbeatJob(ctx context.Context, id JobId, body HeartbeatJobJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
HeartbeatJob Renew the job's lease and report the current stage
The runner sends a heartbeat every 60 seconds while it works on a job.
Takes a body of the `application/json` content type.
Corresponds with POST /v1/jobs/{id}/heartbeat (the `HeartbeatJob` operationId).
func (*Client) HeartbeatJobWithBody ¶
func (c *Client) HeartbeatJobWithBody(ctx context.Context, id JobId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
HeartbeatJobWithBody Renew the job's lease and report the current stage
The runner sends a heartbeat every 60 seconds while it works on a job.
Takes any type of body and a specified content type.
Corresponds with POST /v1/jobs/{id}/heartbeat (the `HeartbeatJob` operationId).
func (*Client) PollRunner ¶
func (c *Client) PollRunner(ctx context.Context, body PollRunnerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
PollRunner Check in and ask for work
Records the check-in and claims the oldest due job this runner may take. A claimed job has a 10-minute lease, which heartbeats renew. If the lease runs out, the job is marked interrupted and queued again, at most twice.
The version and polling details are response headers because a `204` response has no body.
Takes a body of the `application/json` content type.
Corresponds with POST /v1/runners/poll (the `PollRunner` operationId).
func (*Client) PollRunnerWithBody ¶
func (c *Client) PollRunnerWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PollRunnerWithBody Check in and ask for work
Records the check-in and claims the oldest due job this runner may take. A claimed job has a 10-minute lease, which heartbeats renew. If the lease runs out, the job is marked interrupted and queued again, at most twice.
The version and polling details are response headers because a `204` response has no body.
Takes any type of body and a specified content type.
Corresponds with POST /v1/runners/poll (the `PollRunner` operationId).
func (*Client) RegisterRunner ¶
func (c *Client) RegisterRunner(ctx context.Context, body RegisterRunnerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
RegisterRunner Trade an install token for a runner credential
An install token works once and expires one hour after it is created. Only the runner's public key is sent. Its private key never leaves the runner.
Takes a body of the `application/json` content type.
Corresponds with POST /v1/runners/register (the `RegisterRunner` operationId).
func (*Client) RegisterRunnerWithBody ¶
func (c *Client) RegisterRunnerWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
RegisterRunnerWithBody Trade an install token for a runner credential
An install token works once and expires one hour after it is created. Only the runner's public key is sent. Its private key never leaves the runner.
Takes any type of body and a specified content type.
Corresponds with POST /v1/runners/register (the `RegisterRunner` operationId).
func (*Client) SubmitJobResult ¶
func (c *Client) SubmitJobResult(ctx context.Context, id JobId, body SubmitJobResultJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
SubmitJobResult Report the outcome of a job
Sending the same result again is safe and returns `202`, so the runner can retry after a network failure.
Takes a body of the `application/json` content type.
Corresponds with POST /v1/jobs/{id}/result (the `SubmitJobResult` operationId).
func (*Client) SubmitJobResultWithBody ¶
func (c *Client) SubmitJobResultWithBody(ctx context.Context, id JobId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
SubmitJobResultWithBody Report the outcome of a job
Sending the same result again is safe and returns `202`, so the runner can retry after a network failure.
Takes any type of body and a specified content type.
Corresponds with POST /v1/jobs/{id}/result (the `SubmitJobResult` operationId).
type ClientInterface ¶
type ClientInterface interface {
// HeartbeatJobWithBody Renew the job's lease and report the current stage
//
// The runner sends a heartbeat every 60 seconds while it works on a job.
//
// Takes any type of body and a specified content type.
//
// Corresponds with POST /v1/jobs/{id}/heartbeat (the `HeartbeatJob` operationId).
HeartbeatJobWithBody(ctx context.Context, id JobId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// HeartbeatJob Renew the job's lease and report the current stage
//
// The runner sends a heartbeat every 60 seconds while it works on a job.
//
// Takes a body of the `application/json` content type.
//
// Corresponds with POST /v1/jobs/{id}/heartbeat (the `HeartbeatJob` operationId).
HeartbeatJob(ctx context.Context, id JobId, body HeartbeatJobJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// SubmitJobResultWithBody Report the outcome of a job
//
// Sending the same result again is safe and returns `202`, so the runner can retry after a
// network failure.
//
// Takes any type of body and a specified content type.
//
// Corresponds with POST /v1/jobs/{id}/result (the `SubmitJobResult` operationId).
SubmitJobResultWithBody(ctx context.Context, id JobId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// SubmitJobResult Report the outcome of a job
//
// Sending the same result again is safe and returns `202`, so the runner can retry after a
// network failure.
//
// Takes a body of the `application/json` content type.
//
// Corresponds with POST /v1/jobs/{id}/result (the `SubmitJobResult` operationId).
SubmitJobResult(ctx context.Context, id JobId, body SubmitJobResultJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetRunnerStatus Show what Backproof knows about this runner
//
// Lets `backproof doctor` confirm the token works and list the sources this runner has keys
// for. It is read-only: it never claims a job and doesn't count as a check-in. Keys and
// sealed bundles are never returned.
//
// Corresponds with GET /v1/runners/me (the `GetRunnerStatus` operationId).
GetRunnerStatus(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// PollRunnerWithBody Check in and ask for work
//
// Records the check-in and claims the oldest due job this runner may take. A claimed job has
// a 10-minute lease, which heartbeats renew. If the lease runs out, the job is marked
// interrupted and queued again, at most twice.
//
// The version and polling details are response headers because a `204` response has no body.
//
// Takes any type of body and a specified content type.
//
// Corresponds with POST /v1/runners/poll (the `PollRunner` operationId).
PollRunnerWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// PollRunner Check in and ask for work
//
// Records the check-in and claims the oldest due job this runner may take. A claimed job has
// a 10-minute lease, which heartbeats renew. If the lease runs out, the job is marked
// interrupted and queued again, at most twice.
//
// The version and polling details are response headers because a `204` response has no body.
//
// Takes a body of the `application/json` content type.
//
// Corresponds with POST /v1/runners/poll (the `PollRunner` operationId).
PollRunner(ctx context.Context, body PollRunnerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// RegisterRunnerWithBody Trade an install token for a runner credential
//
// An install token works once and expires one hour after it is created. Only the runner's
// public key is sent. Its private key never leaves the runner.
//
// Takes any type of body and a specified content type.
//
// Corresponds with POST /v1/runners/register (the `RegisterRunner` operationId).
RegisterRunnerWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// RegisterRunner Trade an install token for a runner credential
//
// An install token works once and expires one hour after it is created. Only the runner's
// public key is sent. Its private key never leaves the runner.
//
// Takes a body of the `application/json` content type.
//
// Corresponds with POST /v1/runners/register (the `RegisterRunner` operationId).
RegisterRunner(ctx context.Context, body RegisterRunnerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
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) GetRunnerStatusWithResponse ¶
func (c *ClientWithResponses) GetRunnerStatusWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetRunnerStatusResponse, error)
GetRunnerStatusWithResponse Show what Backproof knows about this runner
Lets `backproof doctor` confirm the token works and list the sources this runner has keys for. It is read-only: it never claims a job and doesn't count as a check-in. Keys and sealed bundles are never returned.
Returns a wrapper object for the known response body format(s).
Corresponds with GET /v1/runners/me (the `GetRunnerStatus` operationId).
func (*ClientWithResponses) HeartbeatJobWithBodyWithResponse ¶
func (c *ClientWithResponses) HeartbeatJobWithBodyWithResponse(ctx context.Context, id JobId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*HeartbeatJobResponse, error)
HeartbeatJobWithBodyWithResponse Renew the job's lease and report the current stage
The runner sends a heartbeat every 60 seconds while it works on a job.
Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /v1/jobs/{id}/heartbeat (the `HeartbeatJob` operationId).
func (*ClientWithResponses) HeartbeatJobWithResponse ¶
func (c *ClientWithResponses) HeartbeatJobWithResponse(ctx context.Context, id JobId, body HeartbeatJobJSONRequestBody, reqEditors ...RequestEditorFn) (*HeartbeatJobResponse, error)
HeartbeatJobWithResponse Renew the job's lease and report the current stage
The runner sends a heartbeat every 60 seconds while it works on a job.
Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /v1/jobs/{id}/heartbeat (the `HeartbeatJob` operationId).
func (*ClientWithResponses) PollRunnerWithBodyWithResponse ¶
func (c *ClientWithResponses) PollRunnerWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PollRunnerResponse, error)
PollRunnerWithBodyWithResponse Check in and ask for work
Records the check-in and claims the oldest due job this runner may take. A claimed job has a 10-minute lease, which heartbeats renew. If the lease runs out, the job is marked interrupted and queued again, at most twice.
The version and polling details are response headers because a `204` response has no body.
Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /v1/runners/poll (the `PollRunner` operationId).
func (*ClientWithResponses) PollRunnerWithResponse ¶
func (c *ClientWithResponses) PollRunnerWithResponse(ctx context.Context, body PollRunnerJSONRequestBody, reqEditors ...RequestEditorFn) (*PollRunnerResponse, error)
PollRunnerWithResponse Check in and ask for work
Records the check-in and claims the oldest due job this runner may take. A claimed job has a 10-minute lease, which heartbeats renew. If the lease runs out, the job is marked interrupted and queued again, at most twice.
The version and polling details are response headers because a `204` response has no body.
Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /v1/runners/poll (the `PollRunner` operationId).
func (*ClientWithResponses) RegisterRunnerWithBodyWithResponse ¶
func (c *ClientWithResponses) RegisterRunnerWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterRunnerResponse, error)
RegisterRunnerWithBodyWithResponse Trade an install token for a runner credential
An install token works once and expires one hour after it is created. Only the runner's public key is sent. Its private key never leaves the runner.
Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /v1/runners/register (the `RegisterRunner` operationId).
func (*ClientWithResponses) RegisterRunnerWithResponse ¶
func (c *ClientWithResponses) RegisterRunnerWithResponse(ctx context.Context, body RegisterRunnerJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterRunnerResponse, error)
RegisterRunnerWithResponse Trade an install token for a runner credential
An install token works once and expires one hour after it is created. Only the runner's public key is sent. Its private key never leaves the runner.
Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /v1/runners/register (the `RegisterRunner` operationId).
func (*ClientWithResponses) SubmitJobResultWithBodyWithResponse ¶
func (c *ClientWithResponses) SubmitJobResultWithBodyWithResponse(ctx context.Context, id JobId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SubmitJobResultResponse, error)
SubmitJobResultWithBodyWithResponse Report the outcome of a job
Sending the same result again is safe and returns `202`, so the runner can retry after a network failure.
Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /v1/jobs/{id}/result (the `SubmitJobResult` operationId).
func (*ClientWithResponses) SubmitJobResultWithResponse ¶
func (c *ClientWithResponses) SubmitJobResultWithResponse(ctx context.Context, id JobId, body SubmitJobResultJSONRequestBody, reqEditors ...RequestEditorFn) (*SubmitJobResultResponse, error)
SubmitJobResultWithResponse Report the outcome of a job
Sending the same result again is safe and returns `202`, so the runner can retry after a network failure.
Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /v1/jobs/{id}/result (the `SubmitJobResult` operationId).
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
// HeartbeatJobWithBodyWithResponse Renew the job's lease and report the current stage
//
// The runner sends a heartbeat every 60 seconds while it works on a job.
//
// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /v1/jobs/{id}/heartbeat (the `HeartbeatJob` operationId).
HeartbeatJobWithBodyWithResponse(ctx context.Context, id JobId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*HeartbeatJobResponse, error)
// HeartbeatJobWithResponse Renew the job's lease and report the current stage
//
// The runner sends a heartbeat every 60 seconds while it works on a job.
//
// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /v1/jobs/{id}/heartbeat (the `HeartbeatJob` operationId).
HeartbeatJobWithResponse(ctx context.Context, id JobId, body HeartbeatJobJSONRequestBody, reqEditors ...RequestEditorFn) (*HeartbeatJobResponse, error)
// SubmitJobResultWithBodyWithResponse Report the outcome of a job
//
// Sending the same result again is safe and returns `202`, so the runner can retry after a
// network failure.
//
// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /v1/jobs/{id}/result (the `SubmitJobResult` operationId).
SubmitJobResultWithBodyWithResponse(ctx context.Context, id JobId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SubmitJobResultResponse, error)
// SubmitJobResultWithResponse Report the outcome of a job
//
// Sending the same result again is safe and returns `202`, so the runner can retry after a
// network failure.
//
// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /v1/jobs/{id}/result (the `SubmitJobResult` operationId).
SubmitJobResultWithResponse(ctx context.Context, id JobId, body SubmitJobResultJSONRequestBody, reqEditors ...RequestEditorFn) (*SubmitJobResultResponse, error)
// GetRunnerStatusWithResponse Show what Backproof knows about this runner
//
// Lets `backproof doctor` confirm the token works and list the sources this runner has keys
// for. It is read-only: it never claims a job and doesn't count as a check-in. Keys and
// sealed bundles are never returned.
//
// Returns a wrapper object for the known response body format(s).
//
// Corresponds with GET /v1/runners/me (the `GetRunnerStatus` operationId).
GetRunnerStatusWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetRunnerStatusResponse, error)
// PollRunnerWithBodyWithResponse Check in and ask for work
//
// Records the check-in and claims the oldest due job this runner may take. A claimed job has
// a 10-minute lease, which heartbeats renew. If the lease runs out, the job is marked
// interrupted and queued again, at most twice.
//
// The version and polling details are response headers because a `204` response has no body.
//
// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /v1/runners/poll (the `PollRunner` operationId).
PollRunnerWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PollRunnerResponse, error)
// PollRunnerWithResponse Check in and ask for work
//
// Records the check-in and claims the oldest due job this runner may take. A claimed job has
// a 10-minute lease, which heartbeats renew. If the lease runs out, the job is marked
// interrupted and queued again, at most twice.
//
// The version and polling details are response headers because a `204` response has no body.
//
// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /v1/runners/poll (the `PollRunner` operationId).
PollRunnerWithResponse(ctx context.Context, body PollRunnerJSONRequestBody, reqEditors ...RequestEditorFn) (*PollRunnerResponse, error)
// RegisterRunnerWithBodyWithResponse Trade an install token for a runner credential
//
// An install token works once and expires one hour after it is created. Only the runner's
// public key is sent. Its private key never leaves the runner.
//
// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /v1/runners/register (the `RegisterRunner` operationId).
RegisterRunnerWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterRunnerResponse, error)
// RegisterRunnerWithResponse Trade an install token for a runner credential
//
// An install token works once and expires one hour after it is created. Only the runner's
// public key is sent. Its private key never leaves the runner.
//
// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /v1/runners/register (the `RegisterRunner` operationId).
RegisterRunnerWithResponse(ctx context.Context, body RegisterRunnerJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterRunnerResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type Compression ¶
type Compression string
Compression defines model for Compression.
const ( CompressionGzip Compression = "gzip" CompressionZstd Compression = "zstd" )
Defines values for Compression.
func (Compression) Valid ¶
func (e Compression) Valid() bool
Valid indicates whether the value is a known member of the Compression enum.
type Encryption ¶
type Encryption string
Encryption defines model for Encryption.
const ( EncryptionAge Encryption = "age" EncryptionGpg Encryption = "gpg" )
Defines values for Encryption.
func (Encryption) Valid ¶
func (e Encryption) Valid() bool
Valid indicates whether the value is a known member of the Encryption enum.
type Error ¶
type Error struct {
// Code A stable code for programs.
//
// Example: update_required
Code string `json:"code"`
// Message Says what happened and what to do next. Safe to show in the runner's log.
//
// Example: This runner is too old to receive jobs. Update it with the install script.
Message string `json:"message"`
}
Error defines model for Error.
type GetRunnerStatusResponse ¶
type GetRunnerStatusResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *RunnerStatus
// JSON401 the response for an HTTP 401 `application/json` response
JSON401 *Unauthorized
// JSON429 the response for an HTTP 429 `application/json` response
JSON429 *TooManyRequests
// Headers200 the parsed response headers for an HTTP 200 response
Headers200 *GetRunnerStatusResponse200Headers
// Headers429 the parsed response headers for an HTTP 429 response
Headers429 *GetRunnerStatusResponse429Headers
}
func ParseGetRunnerStatusResponse ¶
func ParseGetRunnerStatusResponse(rsp *http.Response) (*GetRunnerStatusResponse, error)
ParseGetRunnerStatusResponse parses an HTTP response from a GetRunnerStatusWithResponse call
func (GetRunnerStatusResponse) ContentType ¶
func (r GetRunnerStatusResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (GetRunnerStatusResponse) GetBody ¶
func (r GetRunnerStatusResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (GetRunnerStatusResponse) GetJSON200 ¶
func (r GetRunnerStatusResponse) GetJSON200() *RunnerStatus
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (GetRunnerStatusResponse) GetJSON401 ¶
func (r GetRunnerStatusResponse) GetJSON401() *Unauthorized
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (GetRunnerStatusResponse) GetJSON429 ¶
func (r GetRunnerStatusResponse) GetJSON429() *TooManyRequests
GetJSON429 returns the response for an HTTP 429 `application/json` response
func (GetRunnerStatusResponse) Status ¶
func (r GetRunnerStatusResponse) Status() string
Status returns HTTPResponse.Status
func (GetRunnerStatusResponse) StatusCode ¶
func (r GetRunnerStatusResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GetRunnerStatusResponse200Headers ¶
type GetRunnerStatusResponse200Headers struct {
BackproofLatestVersion string
BackproofMinVersion string
}
GetRunnerStatusResponse200Headers the declared response headers of an HTTP 200 response for GetRunnerStatus
type GetRunnerStatusResponse429Headers ¶
type GetRunnerStatusResponse429Headers struct {
RetryAfter int
}
GetRunnerStatusResponse429Headers the declared response headers of an HTTP 429 response for GetRunnerStatus
type HeartbeatJobJSONRequestBody ¶
type HeartbeatJobJSONRequestBody = HeartbeatRequest
HeartbeatJobJSONRequestBody defines body for HeartbeatJob for application/json ContentType.
type HeartbeatJobResponse ¶
type HeartbeatJobResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *HeartbeatResponse
// JSON400 the response for an HTTP 400 `application/json` response
JSON400 *BadRequest
// JSON401 the response for an HTTP 401 `application/json` response
JSON401 *Unauthorized
// JSON404 the response for an HTTP 404 `application/json` response
JSON404 *NotFound
// JSON409 the response for an HTTP 409 `application/json` response
JSON409 *LeaseLost
// JSON429 the response for an HTTP 429 `application/json` response
JSON429 *TooManyRequests
// Headers429 the parsed response headers for an HTTP 429 response
Headers429 *HeartbeatJobResponse429Headers
}
func ParseHeartbeatJobResponse ¶
func ParseHeartbeatJobResponse(rsp *http.Response) (*HeartbeatJobResponse, error)
ParseHeartbeatJobResponse parses an HTTP response from a HeartbeatJobWithResponse call
func (HeartbeatJobResponse) ContentType ¶
func (r HeartbeatJobResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (HeartbeatJobResponse) GetBody ¶
func (r HeartbeatJobResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (HeartbeatJobResponse) GetJSON200 ¶
func (r HeartbeatJobResponse) GetJSON200() *HeartbeatResponse
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (HeartbeatJobResponse) GetJSON400 ¶
func (r HeartbeatJobResponse) GetJSON400() *BadRequest
GetJSON400 returns the response for an HTTP 400 `application/json` response
func (HeartbeatJobResponse) GetJSON401 ¶
func (r HeartbeatJobResponse) GetJSON401() *Unauthorized
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (HeartbeatJobResponse) GetJSON404 ¶
func (r HeartbeatJobResponse) GetJSON404() *NotFound
GetJSON404 returns the response for an HTTP 404 `application/json` response
func (HeartbeatJobResponse) GetJSON409 ¶
func (r HeartbeatJobResponse) GetJSON409() *LeaseLost
GetJSON409 returns the response for an HTTP 409 `application/json` response
func (HeartbeatJobResponse) GetJSON429 ¶
func (r HeartbeatJobResponse) GetJSON429() *TooManyRequests
GetJSON429 returns the response for an HTTP 429 `application/json` response
func (HeartbeatJobResponse) Status ¶
func (r HeartbeatJobResponse) Status() string
Status returns HTTPResponse.Status
func (HeartbeatJobResponse) StatusCode ¶
func (r HeartbeatJobResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HeartbeatJobResponse429Headers ¶
type HeartbeatJobResponse429Headers struct {
RetryAfter int
}
HeartbeatJobResponse429Headers the declared response headers of an HTTP 429 response for HeartbeatJob
type HeartbeatRequest ¶
type HeartbeatRequest struct {
Stage Stage `json:"stage"`
}
HeartbeatRequest defines model for HeartbeatRequest.
type HeartbeatResponse ¶
type HeartbeatResponse struct {
// Cancel When true, the runner stops the job, cleans up and sends no result.
Cancel bool `json:"cancel"`
LeaseExpiresAt time.Time `json:"lease_expires_at"`
}
HeartbeatResponse defines model for HeartbeatResponse.
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type Job ¶
type Job struct {
Checks CheckConfig `json:"checks"`
Id openapi_types.UUID `json:"id"`
LeaseExpiresAt time.Time `json:"lease_expires_at"`
// SealedBundle An ASCII-armored age file sealed for this workspace's runners. It decrypts to
// `SealedBundleContents`. It is null when the source uses local secrets.
SealedBundle *string `json:"sealed_bundle"`
Source Source `json:"source"`
// TimeoutSeconds The longest this job may run before the runner stops it.
TimeoutSeconds int `json:"timeout_seconds"`
}
Job defines model for Job.
type JobResult ¶
type JobResult struct {
// Backup What the runner learned about the backup. Values are null until they are known.
Backup BackupDetails `json:"backup"`
Checks []CheckResult `json:"checks"`
FailedStage *JobResultFailedStage `json:"failed_stage"`
Notes []string `json:"notes"`
Reason *string `json:"reason"`
// ReasonCode Example: missing_extension
ReasonCode *string `json:"reason_code"`
SchemaVersion JobResultSchemaVersion `json:"schema_version"`
Stages []StageTiming `json:"stages"`
// Status `fail` means the backup is bad. `error` means the runner couldn't do its job.
Status JobResultStatus `json:"status"`
// Tables Rows per table in the restored backup.
Tables []TableRowCount `json:"tables"`
}
JobResult Metadata about one job. `docs/payload.md` documents every field. Reasons are short summaries and never contain SQL, row contents or raw tool output.
type JobResultFailedStage ¶
type JobResultFailedStage string
JobResultFailedStage defines model for JobResult.FailedStage.
const ( JobResultFailedStageCheck JobResultFailedStage = "check" JobResultFailedStageCleanup JobResultFailedStage = "cleanup" JobResultFailedStageDecompress JobResultFailedStage = "decompress" JobResultFailedStageDecrypt JobResultFailedStage = "decrypt" JobResultFailedStageDetectVersion JobResultFailedStage = "detect_version" JobResultFailedStageDownload JobResultFailedStage = "download" JobResultFailedStageLessThannil JobResultFailedStage = "<nil>" JobResultFailedStagePreflight JobResultFailedStage = "preflight" JobResultFailedStageResolve JobResultFailedStage = "resolve" JobResultFailedStageRestore JobResultFailedStage = "restore" )
Defines values for JobResultFailedStage.
func (JobResultFailedStage) Valid ¶
func (e JobResultFailedStage) Valid() bool
Valid indicates whether the value is a known member of the JobResultFailedStage enum.
type JobResultSchemaVersion ¶
type JobResultSchemaVersion int
JobResultSchemaVersion defines model for JobResult.SchemaVersion.
const (
JobResultSchemaVersionN1 JobResultSchemaVersion = 1
)
Defines values for JobResultSchemaVersion.
func (JobResultSchemaVersion) Valid ¶
func (e JobResultSchemaVersion) Valid() bool
Valid indicates whether the value is a known member of the JobResultSchemaVersion enum.
type JobResultStatus ¶
type JobResultStatus string
JobResultStatus `fail` means the backup is bad. `error` means the runner couldn't do its job.
const ( JobResultStatusError JobResultStatus = "error" JobResultStatusFail JobResultStatus = "fail" JobResultStatusPass JobResultStatus = "pass" )
Defines values for JobResultStatus.
func (JobResultStatus) Valid ¶
func (e JobResultStatus) Valid() bool
Valid indicates whether the value is a known member of the JobResultStatus enum.
type LatestTimestampCheck ¶
type LatestTimestampCheck struct {
Column string `json:"column"`
// MaxAgeSeconds How much older than the backup's time the newest row may be.
MaxAgeSeconds int64 `json:"max_age_seconds"`
Schema string `json:"schema"`
Table string `json:"table"`
}
LatestTimestampCheck The freshness check. It is null when the source doesn't use one.
type PollRequest ¶
type PollRequest struct {
Capabilities Capabilities `json:"capabilities"`
Status PollRequestStatus `json:"status"`
// Version The exact runner version.
//
// Example: 1.2.3
Version string `json:"version"`
}
PollRequest defines model for PollRequest.
type PollRequestStatus ¶
type PollRequestStatus string
PollRequestStatus defines model for PollRequest.Status.
const ( Busy PollRequestStatus = "busy" Idle PollRequestStatus = "idle" )
Defines values for PollRequestStatus.
func (PollRequestStatus) Valid ¶
func (e PollRequestStatus) Valid() bool
Valid indicates whether the value is a known member of the PollRequestStatus enum.
type PollResult ¶
type PollResult struct {
// Job is nil when no job is due.
Job *Job
LatestVersion string
MinVersion string
NextPollAfter time.Duration
// UpdateRequired explains why a runner below the minimum version gets no jobs.
UpdateRequired string
}
PollResult is the API's answer to a check-in.
type PollRunnerJSONRequestBody ¶
type PollRunnerJSONRequestBody = PollRequest
PollRunnerJSONRequestBody defines body for PollRunner for application/json ContentType.
type PollRunnerResponse ¶
type PollRunnerResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *Job
// JSON400 the response for an HTTP 400 `application/json` response
JSON400 *BadRequest
// JSON401 the response for an HTTP 401 `application/json` response
JSON401 *Unauthorized
// JSON426 the response for an HTTP 426 `application/json` response
JSON426 *Error
// JSON429 the response for an HTTP 429 `application/json` response
JSON429 *TooManyRequests
// Headers200 the parsed response headers for an HTTP 200 response
Headers200 *PollRunnerResponse200Headers
// Headers204 the parsed response headers for an HTTP 204 response
Headers204 *PollRunnerResponse204Headers
// Headers426 the parsed response headers for an HTTP 426 response
Headers426 *PollRunnerResponse426Headers
// Headers429 the parsed response headers for an HTTP 429 response
Headers429 *PollRunnerResponse429Headers
}
func ParsePollRunnerResponse ¶
func ParsePollRunnerResponse(rsp *http.Response) (*PollRunnerResponse, error)
ParsePollRunnerResponse parses an HTTP response from a PollRunnerWithResponse call
func (PollRunnerResponse) ContentType ¶
func (r PollRunnerResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (PollRunnerResponse) GetBody ¶
func (r PollRunnerResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (PollRunnerResponse) GetJSON200 ¶
func (r PollRunnerResponse) GetJSON200() *Job
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (PollRunnerResponse) GetJSON400 ¶
func (r PollRunnerResponse) GetJSON400() *BadRequest
GetJSON400 returns the response for an HTTP 400 `application/json` response
func (PollRunnerResponse) GetJSON401 ¶
func (r PollRunnerResponse) GetJSON401() *Unauthorized
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (PollRunnerResponse) GetJSON426 ¶
func (r PollRunnerResponse) GetJSON426() *Error
GetJSON426 returns the response for an HTTP 426 `application/json` response
func (PollRunnerResponse) GetJSON429 ¶
func (r PollRunnerResponse) GetJSON429() *TooManyRequests
GetJSON429 returns the response for an HTTP 429 `application/json` response
func (PollRunnerResponse) Status ¶
func (r PollRunnerResponse) Status() string
Status returns HTTPResponse.Status
func (PollRunnerResponse) StatusCode ¶
func (r PollRunnerResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type PollRunnerResponse200Headers ¶
type PollRunnerResponse200Headers struct {
BackproofLatestVersion string
BackproofMinVersion string
BackproofNextPollAfter int
}
PollRunnerResponse200Headers the declared response headers of an HTTP 200 response for PollRunner
type PollRunnerResponse204Headers ¶
type PollRunnerResponse204Headers struct {
BackproofLatestVersion string
BackproofMinVersion string
BackproofNextPollAfter int
}
PollRunnerResponse204Headers the declared response headers of an HTTP 204 response for PollRunner
type PollRunnerResponse426Headers ¶
type PollRunnerResponse426Headers struct {
BackproofLatestVersion string
BackproofMinVersion string
BackproofNextPollAfter int
}
PollRunnerResponse426Headers the declared response headers of an HTTP 426 response for PollRunner
type PollRunnerResponse429Headers ¶
type PollRunnerResponse429Headers struct {
RetryAfter int
}
PollRunnerResponse429Headers the declared response headers of an HTTP 429 response for PollRunner
type RegisterRequest ¶
type RegisterRequest struct {
Arch RegisterRequestArch `json:"arch"`
// InstallToken The one-time token from the dashboard's Add runner page.
InstallToken string `json:"install_token"`
// Name The name shown in the dashboard.
Name string `json:"name"`
Os RegisterRequestOs `json:"os"`
// PublicKey The runner's age X25519 public key.
PublicKey string `json:"public_key"`
}
RegisterRequest defines model for RegisterRequest.
type RegisterRequestArch ¶
type RegisterRequestArch string
RegisterRequestArch defines model for RegisterRequest.Arch.
const ( Amd64 RegisterRequestArch = "amd64" Arm64 RegisterRequestArch = "arm64" )
Defines values for RegisterRequestArch.
func (RegisterRequestArch) Valid ¶
func (e RegisterRequestArch) Valid() bool
Valid indicates whether the value is a known member of the RegisterRequestArch enum.
type RegisterRequestOs ¶
type RegisterRequestOs string
RegisterRequestOs defines model for RegisterRequest.Os.
const (
Linux RegisterRequestOs = "linux"
)
Defines values for RegisterRequestOs.
func (RegisterRequestOs) Valid ¶
func (e RegisterRequestOs) Valid() bool
Valid indicates whether the value is a known member of the RegisterRequestOs enum.
type RegisterResponse ¶
type RegisterResponse struct {
RunnerId openapi_types.UUID `json:"runner_id"`
// RunnerToken The long-lived, revocable token for all other calls.
RunnerToken string `json:"runner_token"`
}
RegisterResponse defines model for RegisterResponse.
type RegisterRunnerJSONRequestBody ¶
type RegisterRunnerJSONRequestBody = RegisterRequest
RegisterRunnerJSONRequestBody defines body for RegisterRunner for application/json ContentType.
type RegisterRunnerResponse ¶
type RegisterRunnerResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON201 the response for an HTTP 201 `application/json` response
JSON201 *RegisterResponse
// JSON400 the response for an HTTP 400 `application/json` response
JSON400 *BadRequest
// JSON401 the response for an HTTP 401 `application/json` response
JSON401 *Unauthorized
// JSON429 the response for an HTTP 429 `application/json` response
JSON429 *TooManyRequests
// Headers429 the parsed response headers for an HTTP 429 response
Headers429 *RegisterRunnerResponse429Headers
}
func ParseRegisterRunnerResponse ¶
func ParseRegisterRunnerResponse(rsp *http.Response) (*RegisterRunnerResponse, error)
ParseRegisterRunnerResponse parses an HTTP response from a RegisterRunnerWithResponse call
func (RegisterRunnerResponse) ContentType ¶
func (r RegisterRunnerResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (RegisterRunnerResponse) GetBody ¶
func (r RegisterRunnerResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (RegisterRunnerResponse) GetJSON201 ¶
func (r RegisterRunnerResponse) GetJSON201() *RegisterResponse
GetJSON201 returns the response for an HTTP 201 `application/json` response
func (RegisterRunnerResponse) GetJSON400 ¶
func (r RegisterRunnerResponse) GetJSON400() *BadRequest
GetJSON400 returns the response for an HTTP 400 `application/json` response
func (RegisterRunnerResponse) GetJSON401 ¶
func (r RegisterRunnerResponse) GetJSON401() *Unauthorized
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (RegisterRunnerResponse) GetJSON429 ¶
func (r RegisterRunnerResponse) GetJSON429() *TooManyRequests
GetJSON429 returns the response for an HTTP 429 `application/json` response
func (RegisterRunnerResponse) Status ¶
func (r RegisterRunnerResponse) Status() string
Status returns HTTPResponse.Status
func (RegisterRunnerResponse) StatusCode ¶
func (r RegisterRunnerResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type RegisterRunnerResponse429Headers ¶
type RegisterRunnerResponse429Headers struct {
RetryAfter int
}
RegisterRunnerResponse429Headers the declared response headers of an HTTP 429 response for RegisterRunner
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type ResponseError ¶
type ResponseError struct {
Status int
Code string
Message string
// RetryAfter is how long the API asks the runner to wait, when it says so.
RetryAfter time.Duration
}
ResponseError is an answer from the API that reports a problem.
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
Error returns the API's explanation, which says what to do next.
func (*ResponseError) Retryable ¶
func (e *ResponseError) Retryable() bool
Retryable reports whether the same request may succeed later.
type RunnerClient ¶
type RunnerClient struct {
// contains filtered or unexported fields
}
RunnerClient is the runner's connection to the Backproof v1 API.
func New ¶
func New(baseURL, runnerVersion string) (*RunnerClient, error)
New returns a client for the calls that need no runner token.
func NewAuthorized ¶
func NewAuthorized(baseURL, runnerVersion string, token config.Secret) (*RunnerClient, error)
NewAuthorized returns a client that identifies itself with the runner token.
func (*RunnerClient) Heartbeat ¶
func (c *RunnerClient) Heartbeat(ctx context.Context, jobID JobId, stage Stage) (HeartbeatResponse, error)
Heartbeat renews a job's lease and reports its current stage.
func (*RunnerClient) Poll ¶
func (c *RunnerClient) Poll(ctx context.Context, request PollRequest) (PollResult, error)
Poll checks in and claims a job if one is due.
func (*RunnerClient) Register ¶
func (c *RunnerClient) Register(ctx context.Context, request RegisterRequest) (RegisterResponse, error)
Register trades an install token for a runner credential.
func (*RunnerClient) Status ¶
func (c *RunnerClient) Status(ctx context.Context) (StatusResult, error)
Status reads the runner's registration without checking in or claiming a job.
func (*RunnerClient) SubmitResult ¶
SubmitResult reports the outcome of a job.
type RunnerSource ¶
type RunnerSource struct {
// HasSealedKeys Whether keys entered in the dashboard are sealed for this runner.
HasSealedKeys bool `json:"has_sealed_keys"`
// Id The source ID, also used in local secret names such as `BP_SRC_PROD_DB_S3_ACCESS_KEY`.
//
// Example: PROD_DB
Id string `json:"id"`
}
RunnerSource defines model for RunnerSource.
type RunnerStatus ¶
type RunnerStatus struct {
// KeyFingerprint The fingerprint of the public key Backproof holds for this runner, to compare with the runner's own key.
//
// Example: SHA256:4m4FJEkQ1+4bsddQHkzIqik856xUVFF2r27Q/fZPLno
KeyFingerprint string `json:"key_fingerprint"`
// Name The name shown in the dashboard.
Name string `json:"name"`
RunnerId openapi_types.UUID `json:"runner_id"`
// Sources Every source in this runner's workspace.
Sources []RunnerSource `json:"sources"`
}
RunnerStatus defines model for RunnerStatus.
type SealedBundleContents ¶
type SealedBundleContents struct {
// AgeIdentity The age private key, if the backups use age.
AgeIdentity *string `json:"age_identity,omitempty"`
// GpgKey The GPG private key, if the backups use GPG.
GpgKey *string `json:"gpg_key,omitempty"`
// GpgPassphrase The passphrase of the GPG key, if it has one.
GpgPassphrase *string `json:"gpg_passphrase,omitempty"`
// NameSalt The random key for hashing table names. Its UTF-8 bytes are the HMAC key.
NameSalt string `json:"name_salt"`
S3AccessKey string `json:"s3_access_key"`
S3SecretKey string `json:"s3_secret_key"`
Version SealedBundleContentsVersion `json:"version"`
}
SealedBundleContents What `sealed_bundle` decrypts to. The API never sees this object. It is defined here so the dashboard's sealing code and the runner agree on it.
type SealedBundleContentsVersion ¶
type SealedBundleContentsVersion int
SealedBundleContentsVersion defines model for SealedBundleContents.Version.
const (
SealedBundleContentsVersionN1 SealedBundleContentsVersion = 1
)
Defines values for SealedBundleContentsVersion.
func (SealedBundleContentsVersion) Valid ¶
func (e SealedBundleContentsVersion) Valid() bool
Valid indicates whether the value is a known member of the SealedBundleContentsVersion enum.
type Source ¶
type Source struct {
Bucket string `json:"bucket"`
// Encryption What the user expects. The runner still detects encryption from the file.
Encryption SourceEncryption `json:"encryption"`
// Endpoint Example: https://s3.eu-central-1.amazonaws.com
Endpoint string `json:"endpoint"`
// ExpectedFormat What the user expects. The runner still detects the real format from the file.
ExpectedFormat SourceExpectedFormat `json:"expected_format"`
// Id Unique within a workspace. Local secrets use it, as in `BP_SRC_PROD_DB_S3_ACCESS_KEY`.
//
// Example: PROD_DB
Id string `json:"id"`
// Pattern A glob matched against the file name. Empty matches every file.
//
// Example: *.dump.gz
Pattern string `json:"pattern"`
// PinnedObjectKey Test this exact backup instead of the newest one.
PinnedObjectKey *string `json:"pinned_object_key"`
// PostgresVersionHint The Postgres major to use when the backup doesn't say which version made it.
PostgresVersionHint *int `json:"postgres_version_hint"`
// Prefix Only objects under this prefix are considered. Empty means the whole bucket.
//
// Example: prod/
Prefix string `json:"prefix"`
// Region Example: eu-central-1
Region *string `json:"region"`
// ShowTableNames When false, table names only leave the runner as hashes.
ShowTableNames bool `json:"show_table_names"`
}
Source defines model for Source.
type SourceEncryption ¶
type SourceEncryption string
SourceEncryption What the user expects. The runner still detects encryption from the file.
const ( SourceEncryptionAge SourceEncryption = "age" SourceEncryptionGpg SourceEncryption = "gpg" SourceEncryptionNone SourceEncryption = "none" )
Defines values for SourceEncryption.
func (SourceEncryption) Valid ¶
func (e SourceEncryption) Valid() bool
Valid indicates whether the value is a known member of the SourceEncryption enum.
type SourceExpectedFormat ¶
type SourceExpectedFormat string
SourceExpectedFormat What the user expects. The runner still detects the real format from the file.
const ( SourceExpectedFormatAuto SourceExpectedFormat = "auto" SourceExpectedFormatCustom SourceExpectedFormat = "custom" SourceExpectedFormatPlain SourceExpectedFormat = "plain" )
Defines values for SourceExpectedFormat.
func (SourceExpectedFormat) Valid ¶
func (e SourceExpectedFormat) Valid() bool
Valid indicates whether the value is a known member of the SourceExpectedFormat enum.
type Stage ¶
type Stage string
Stage defines model for Stage.
const ( StageCheck Stage = "check" StageCleanup Stage = "cleanup" StageDecompress Stage = "decompress" StageDecrypt Stage = "decrypt" StageDetectVersion Stage = "detect_version" StageDownload Stage = "download" StagePreflight Stage = "preflight" StageResolve Stage = "resolve" StageRestore Stage = "restore" )
Defines values for Stage.
type StageTiming ¶
StageTiming defines model for StageTiming.
type StatusResult ¶
type StatusResult struct {
Runner RunnerStatus
LatestVersion string
MinVersion string
}
StatusResult is what Backproof knows about this runner.
type SubmitJobResultJSONRequestBody ¶
type SubmitJobResultJSONRequestBody = JobResult
SubmitJobResultJSONRequestBody defines body for SubmitJobResult for application/json ContentType.
type SubmitJobResultResponse ¶
type SubmitJobResultResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON400 the response for an HTTP 400 `application/json` response
JSON400 *BadRequest
// JSON401 the response for an HTTP 401 `application/json` response
JSON401 *Unauthorized
// JSON404 the response for an HTTP 404 `application/json` response
JSON404 *NotFound
// JSON409 the response for an HTTP 409 `application/json` response
JSON409 *LeaseLost
// JSON429 the response for an HTTP 429 `application/json` response
JSON429 *TooManyRequests
// Headers429 the parsed response headers for an HTTP 429 response
Headers429 *SubmitJobResultResponse429Headers
}
func ParseSubmitJobResultResponse ¶
func ParseSubmitJobResultResponse(rsp *http.Response) (*SubmitJobResultResponse, error)
ParseSubmitJobResultResponse parses an HTTP response from a SubmitJobResultWithResponse call
func (SubmitJobResultResponse) ContentType ¶
func (r SubmitJobResultResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (SubmitJobResultResponse) GetBody ¶
func (r SubmitJobResultResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (SubmitJobResultResponse) GetJSON400 ¶
func (r SubmitJobResultResponse) GetJSON400() *BadRequest
GetJSON400 returns the response for an HTTP 400 `application/json` response
func (SubmitJobResultResponse) GetJSON401 ¶
func (r SubmitJobResultResponse) GetJSON401() *Unauthorized
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (SubmitJobResultResponse) GetJSON404 ¶
func (r SubmitJobResultResponse) GetJSON404() *NotFound
GetJSON404 returns the response for an HTTP 404 `application/json` response
func (SubmitJobResultResponse) GetJSON409 ¶
func (r SubmitJobResultResponse) GetJSON409() *LeaseLost
GetJSON409 returns the response for an HTTP 409 `application/json` response
func (SubmitJobResultResponse) GetJSON429 ¶
func (r SubmitJobResultResponse) GetJSON429() *TooManyRequests
GetJSON429 returns the response for an HTTP 429 `application/json` response
func (SubmitJobResultResponse) Status ¶
func (r SubmitJobResultResponse) Status() string
Status returns HTTPResponse.Status
func (SubmitJobResultResponse) StatusCode ¶
func (r SubmitJobResultResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type SubmitJobResultResponse429Headers ¶
type SubmitJobResultResponse429Headers struct {
RetryAfter int
}
SubmitJobResultResponse429Headers the declared response headers of an HTTP 429 response for SubmitJobResult
type TableFinding ¶
type TableFinding struct {
ChangePercent *float32 `json:"change_percent"`
ExpectedRows *int64 `json:"expected_rows"`
MeasuredRows *int64 `json:"measured_rows"`
Problem TableFindingProblem `json:"problem"`
// TableKey Identifies a table. With `show_table_names` on, it is `schema.table`. Otherwise it is the
// lowercase hex HMAC-SHA256 of the schema, a NUL byte and the table name, keyed with the
// source's `name_salt`.
//
//
// Example: 3f9a2c7d0e1b4a6f8c2d5e7a9b0c1d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c
TableKey TableKey `json:"table_key"`
TolerancePercent *float32 `json:"tolerance_percent"`
}
TableFinding defines model for TableFinding.
type TableFindingProblem ¶
type TableFindingProblem string
TableFindingProblem defines model for TableFinding.Problem.
const ( Missing TableFindingProblem = "missing" RowCountChanged TableFindingProblem = "row_count_changed" )
Defines values for TableFindingProblem.
func (TableFindingProblem) Valid ¶
func (e TableFindingProblem) Valid() bool
Valid indicates whether the value is a known member of the TableFindingProblem enum.
type TableKey ¶
type TableKey = string
TableKey Identifies a table. With `show_table_names` on, it is `schema.table`. Otherwise it is the lowercase hex HMAC-SHA256 of the schema, a NUL byte and the table name, keyed with the source's `name_salt`.
Example: 3f9a2c7d0e1b4a6f8c2d5e7a9b0c1d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c
type TableRowCount ¶
type TableRowCount struct {
Rows int64 `json:"rows"`
// TableKey Identifies a table. With `show_table_names` on, it is `schema.table`. Otherwise it is the
// lowercase hex HMAC-SHA256 of the schema, a NUL byte and the table name, keyed with the
// source's `name_salt`.
//
//
// Example: 3f9a2c7d0e1b4a6f8c2d5e7a9b0c1d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c
TableKey TableKey `json:"table_key"`
}
TableRowCount defines model for TableRowCount.
type TableTolerance ¶
type TableTolerance struct {
// TableKey Identifies a table. With `show_table_names` on, it is `schema.table`. Otherwise it is the
// lowercase hex HMAC-SHA256 of the schema, a NUL byte and the table name, keyed with the
// source's `name_salt`.
//
//
// Example: 3f9a2c7d0e1b4a6f8c2d5e7a9b0c1d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c
TableKey TableKey `json:"table_key"`
TolerancePercent float32 `json:"tolerance_percent"`
}
TableTolerance defines model for TableTolerance.
type TooManyRequests ¶
type TooManyRequests = Error
TooManyRequests defines model for TooManyRequests.