api

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: BSD-3-Clause-Clear Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CtxWithApi

func CtxWithApi(ctx context.Context, api *Api) context.Context
func ParseLastLink(linkHeader string) (string, bool)
func ParseNextLink(linkHeader string) (string, bool)

Types

type Api

type Api struct {
	URL string

	Client *http.Client
}

func CtxGetApi

func CtxGetApi(ctx context.Context) *Api

func NewClient

func NewClient(appCtx config.Context) *Api

func (*Api) Configs

func (a *Api) Configs() ConfigsApi

func (Api) Delete

func (a Api) Delete(resource string, opts ...HttpOption) error

func (*Api) Devices

func (a *Api) Devices() DeviceApi

func (Api) Get

func (a Api) Get(resource string, result any, opts ...HttpOption) error

func (Api) GetStream

func (a Api) GetStream(resource string, opts ...HttpOption) (io.ReadCloser, error)

func (Api) GetWithHeaders

func (a Api) GetWithHeaders(resource string, result any, opts ...HttpOption) (http.Header, error)

func (Api) Post

func (a Api) Post(resource string, body any, opts ...HttpOption) ([]byte, error)

func (Api) Put

func (a Api) Put(resource string, body any, opts ...HttpOption) ([]byte, error)

func (*Api) Updates

func (a *Api) Updates() UpdatesApi

type AppliedConfigs

type AppliedConfigs = storage.AppliedConfigs

type ConfigFile

type ConfigFile = models.ConfigFile

type ConfigFileSet

type ConfigFileSet = models.ConfigFileSet

type ConfigsApi

type ConfigsApi struct {
	// contains filtered or unexported fields
}

func (ConfigsApi) Device

func (a ConfigsApi) Device(uuid string) DeviceConfigsApi

func (ConfigsApi) Factory

func (a ConfigsApi) Factory() SpecificConfigsApi

func (ConfigsApi) Group

func (a ConfigsApi) Group(name string) SpecificConfigsApi

func (ConfigsApi) ListGroups

func (a ConfigsApi) ListGroups() (names []string, err error)

func (ConfigsApi) Upload

func (a ConfigsApi) Upload(r io.Reader, opts ...HttpOption) (err error)

type CreateUpdateOptions

type CreateUpdateOptions struct {
	Version    int               // Override the target version (AppVersion)
	HardwareId string            // Override the hardware id
	Name       string            // Override the target name
	OstreeHash string            // Override the ostree hash
	Apps       map[string]string // Override docker compose apps (name -> sha256)
}

CreateUpdateOptions captures the optional TUF target overrides that can be supplied when creating an update.

type Device

type Device = models.Device

type DeviceApi

type DeviceApi struct {
	// contains filtered or unexported fields
}

func (DeviceApi) Delete

func (d DeviceApi) Delete(uuid string) error

func (DeviceApi) DeleteDenied

func (d DeviceApi) DeleteDenied(uuid string) error

DeleteDenied removes a device from the denied list so it can access the backend again.

func (DeviceApi) Get

func (d DeviceApi) Get(uuid string) (*Device, error)

func (DeviceApi) ListDenied

func (d DeviceApi) ListDenied() ([]string, error)

ListDenied returns all UUIDs on the denied list.

func (DeviceApi) ListPage

func (d DeviceApi) ListPage(page int, limit int, sortBy string) ([]DeviceListItem, bool, int, error)

ListPage fetches a single page of devices. It returns the devices, whether more pages are available, and the total number of pages.

func (*DeviceApi) Test

func (d *DeviceApi) Test(uuid, testId string) (*TargetTest, error)

func (*DeviceApi) TestArtifact

func (d *DeviceApi) TestArtifact(uuid, testId, artifact string) (io.ReadCloser, error)

func (*DeviceApi) Tests

func (d *DeviceApi) Tests(uuid string) ([]TargetTest, error)

func (DeviceApi) UpdateEvents

func (d DeviceApi) UpdateEvents(uuid, updateId string) ([]DeviceUpdateEvent, error)

func (DeviceApi) Updates

func (d DeviceApi) Updates(uuid string) ([]string, error)

type DeviceConfigsApi

type DeviceConfigsApi struct {
	// contains filtered or unexported fields
}

func (DeviceConfigsApi) Get added in v0.9.4

func (a DeviceConfigsApi) Get() (res ConfigFileSet, err error)

func (DeviceConfigsApi) GetApplied

func (a DeviceConfigsApi) GetApplied() (res AppliedConfigs, err error)

func (DeviceConfigsApi) GetHistory added in v0.9.4

func (a DeviceConfigsApi) GetHistory(limit int, showFiles bool) (res []ConfigFileSet, err error)

func (DeviceConfigsApi) GetPubkey added in v0.9.4

func (a DeviceConfigsApi) GetPubkey() (res string, err error)

func (DeviceConfigsApi) Put added in v0.9.4

func (a DeviceConfigsApi) Put(configs ConfigFileSet) (err error)

type DeviceListItem

type DeviceListItem = models.DeviceListItem

type DeviceUpdateEvent

type DeviceUpdateEvent = models.DeviceUpdateEvent

type HttpOption

type HttpOption func(opts *httpOptions)

func HttpHeader

func HttpHeader(name, value string) HttpOption

type Rollout

type Rollout = models.Rollout

type SpecificConfigsApi

type SpecificConfigsApi interface {
	Get() (res ConfigFileSet, err error)
	GetHistory(limit int, showFiles bool) (res []ConfigFileSet, err error)
	Put(configs ConfigFileSet) (err error)
}

type TargetTest

type TargetTest = storage.TargetTest

type Update

type Update = models.Update

type UpdateSummary added in v0.9.4

type UpdateSummary = models.UpdateSummary

type UpdateTuf added in v0.9.3

type UpdateTuf = map[string]map[string]any

UpdateTuf holds the TUF metadata for an update keyed by role file name (e.g. "root.json", "targets.json"). Each value is the parsed JSON of the corresponding metadata file.

type UpdatesApi

type UpdatesApi struct {
	// contains filtered or unexported fields
}

func (UpdatesApi) CreateRollout

func (u UpdatesApi) CreateRollout(tag, updateName, rollout string, data Rollout) error

func (UpdatesApi) CreateUpdate

func (u UpdatesApi) CreateUpdate(tag, updateName string, opts CreateUpdateOptions, body io.Reader) error

func (UpdatesApi) Delete added in v0.9.3

func (u UpdatesApi) Delete(tag, updateName string) error

func (UpdatesApi) Get

func (u UpdatesApi) Get(tag, updateName string) ([]string, error)

func (UpdatesApi) GetDevicesForRolloutStatus added in v0.9.4

func (u UpdatesApi) GetDevicesForRolloutStatus(tag, updateName, rollout, status string) ([]string, error)

func (UpdatesApi) GetDevicesForStatus added in v0.9.4

func (u UpdatesApi) GetDevicesForStatus(tag, updateName, status string) ([]string, error)

func (UpdatesApi) GetRollout

func (u UpdatesApi) GetRollout(tag, updateName, rollout string) (Rollout, error)

func (UpdatesApi) GetRolloutSummary added in v0.9.4

func (u UpdatesApi) GetRolloutSummary(tag, updateName, rollout string) (UpdateSummary, error)

func (UpdatesApi) GetSummary added in v0.9.4

func (u UpdatesApi) GetSummary(tag, updateName string) (UpdateSummary, error)

func (UpdatesApi) GetTuf added in v0.9.3

func (u UpdatesApi) GetTuf(tag, updateName string) (UpdateTuf, error)

func (UpdatesApi) List

func (u UpdatesApi) List() (map[string][]Update, error)

func (UpdatesApi) Tail

func (u UpdatesApi) Tail(tag, updateName string) (io.ReadCloser, error)

func (UpdatesApi) TailRollout

func (u UpdatesApi) TailRollout(tag, updateName, rollout string) (io.ReadCloser, error)

Jump to

Keyboard shortcuts

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