Documentation
¶
Overview ¶
Package rpc is the backup module as another module sees it (docs/decisions/0071): the status of the backups, the list of what the archive holds, and a backup now, as methods of the `backup` module over internal/modcall. The restore function's methods are its own (U26).
Index ¶
- Constants
- func Register(s *modcall.Server, svc Service)
- func RegisterRestore(s *modcall.Server, svc RestoreService)
- type Client
- func (c *Client) List(ctx context.Context, limit int) ([]job.Info, error)
- func (c *Client) PreviewRestore(ctx context.Context, backupID string) (PreviewResponse, error)
- func (c *Client) RestoreStatus(ctx context.Context) (restorejob.Status, error)
- func (c *Client) StartRun(ctx context.Context, by string) error
- func (c *Client) Status(ctx context.Context) (job.Status, error)
- type ListRequest
- type ListResponse
- type PreviewRequest
- type PreviewResponse
- type RestoreService
- type RunRequest
- type Service
- type StatusRequest
Constants ¶
const ( RestoreModule = "restore" MethodRestoreStatus = "status" MethodRestorePreview = "preview" )
The restore function's module and methods. It is the same zip as the backup module's, deployed a second time (docs/decisions/0072), and answers two reads: how the restore stands, and what restoring a backup would do. Nothing here starts or resumes a restore: that is an invocation of the function itself, which only an administrator or the break-glass role may make (internal/lambdaapp), with their own credentials and never through the issuer, so that it works when the issuer is broken.
const ( Module = "backup" MethodStatus = "status" MethodList = "list" MethodRun = "run" )
Module is the name of the module and the methods it answers.
const ( CallerConsole = "console" CallerAdmin = "admin" CallerBreakglass = "breakglass" )
Caller classes (the alias a call arrives through, `live-<class>`): the console shows the status and the list, and starts a backup for a person its policy lets (`backup.runGroups`), naming that person in RunRequest.By; an administrator or the break-glass role start one with their own credentials. No caller class starts or resumes a restore through a module call.
const DefaultTokenFile = "/var/run/secrets/sluis/backup/token"
DefaultTokenFile is where the pod's projected token for the backup module is mounted when the document does not say.
const PreviewOutcome = "preview"
PreviewOutcome is the outcome of a preview that produced a report.
Variables ¶
This section is empty.
Functions ¶
func RegisterRestore ¶
func RegisterRestore(s *modcall.Server, svc RestoreService)
RegisterRestore makes svc answer `restore.status` and `restore.preview` on s: the console, an administrator and the break-glass role may call them, and no caller may do more.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the backup and restore modules as the console calls them: through a modcall.Caller whose transport says the caller class is `console`. It reads, previews a restore and starts a backup for a named person; it has no method that starts or resumes a restore, because the modules do not let that class.
func Dial ¶
Dial is the Client of the modules `console.backup` names, called as the caller class `console`: each module's Lambda function (its `live-console` alias) or Kubernetes Service. A restore target left out is a module the router cannot reach, which the page shows as a restore function it has none of.
func (*Client) PreviewRestore ¶ added in v1.77.0
PreviewRestore is `restore.preview`: what restoring the backup would do, as counts.
func (*Client) RestoreStatus ¶
RestoreStatus is `restore.status`.
func (*Client) StartRun ¶ added in v1.77.0
StartRun starts `backup.run` for the person by, whom the module records as the actor, and returns once the module has been handed the call: a backup runs for minutes, and its record is read back with Client.Status.
type ListRequest ¶
type ListRequest struct {
Limit int `json:"limit,omitempty"`
}
ListRequest asks for the newest Limit backups; 0 is all.
type ListResponse ¶
ListResponse is `backup.list`.
type PreviewRequest ¶ added in v1.77.0
type PreviewRequest struct {
Backup string `json:"backup"`
}
PreviewRequest names the backup to preview.
type PreviewResponse ¶ added in v1.77.0
type PreviewResponse struct {
Outcome string `json:"outcome"`
Backup string `json:"backup,omitempty"`
Error string `json:"error,omitempty"`
Report *restore.Report `json:"report,omitempty"`
}
PreviewResponse is `restore.preview`: a report of counts, or a refusal. The report never carries the records that differ (their names or their values): a caller that wants them runs the preview directly.
type RestoreService ¶
type RestoreService interface {
RestoreStatus(ctx context.Context) (restorejob.Status, error)
PreviewRestore(ctx context.Context, backupID string) (*restore.Report, error)
}
RestoreService is what the restore methods call. *App of internal/backup/app is one.
type RunRequest ¶
type RunRequest struct {
Resume bool `json:"resume,omitempty"`
// By is the person the console started the run for, by the address its
// policy knows them by. Only the console class is believed: it is the
// issuer's own, authenticated the person and checked the group before it
// called. From any other class the field is ignored, since an alias says
// nothing about the human behind it.
By string `json:"by,omitempty"`
}
RunRequest starts a backup. Resume, which continued a paused run of format 1, answers idle.