target

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: BSD-3-Clause-Clear Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TargetsResourcePath = "/repo/targets.json"
)

Variables

View Source
var (
	UnknownTarget = Target{
		ID:      "unknown",
		Version: -1,
	}
)

Functions

This section is empty.

Types

type App

type App struct {
	Name string `json:"name"`
	URI  string `json:"uri"`
}

type Apps added in v1.0.0

type Apps []App

func (Apps) Names added in v1.0.0

func (a Apps) Names() (res []string)

func (Apps) URIs added in v1.1.0

func (a Apps) URIs() (res []string)

type Custom

type Custom struct {
	Version string `json:"version"`
	Apps    map[string]struct {
		URI string `json:"uri"`
	} `json:"docker_compose_apps"`
	Arch       string   `json:"arch"`
	HardwareID []string `json:"hardwareIds"`
}

type File

type File struct {
	Signatures *json.RawMessage `json:"signatures"`
	Signed     Signed           `json:"signed"`
}

type Metadata

type Metadata struct {
	Custom Custom `json:"custom"`
}

type Repo

type Repo interface {
	LoadTargets(update bool) (Targets, int, error)
}

func NewPlainRepo

func NewPlainRepo(dgClient *client.GatewayClient, targetsFilepath string, hardwareID string) (Repo, error)

func NewTufRepo

func NewTufRepo(cfg *config.Config, dgClient *client.GatewayClient, hardwareID string) (Repo, error)

type Signed

type Signed struct {
	Targets map[string]Metadata `json:"targets"`
	Version int                 `json:"version"`
}

type Target

type Target struct {
	ID      string `json:"id"`
	Version int    `json:"version"`
	Apps    []App  `json:"apps"`
}

func (*Target) AppNames

func (t *Target) AppNames() (res []string)

func (*Target) AppURIs

func (t *Target) AppURIs() (res []string)

func (*Target) Diff added in v1.0.0

func (t *Target) Diff(other *Target) (added, removed, same, from, to Apps)

func (*Target) Equals added in v1.0.0

func (t *Target) Equals(other *Target) bool

func (*Target) IsUnknown added in v0.9.0

func (t *Target) IsUnknown() bool

func (*Target) NoApps

func (t *Target) NoApps() bool

func (*Target) ShortlistApps

func (t *Target) ShortlistApps(shortlist []string)

ShortlistApps filters the target's apps to only include those whose name is in the provided shortlist. If the shortlist is nil then it does not filter the apps. If the shortlist is empty then it clears the target's apps. This should be used for shortlisting based on "compose_apps" value in the .toml config.

func (*Target) ShortlistAppsByURI

func (t *Target) ShortlistAppsByURI(shortlist []string)

ShortlistAppsByURI filters the target's apps to only include those whose URI is in the provided shortlist. If the shortlist is nil OR empty, it clears the target's apps. This should be used solely for shortlisting based on an update record's "uri" field, which interprets both nil and empty as update to the state with no apps.

type Targets

type Targets []Target

func (Targets) GetLatestTarget

func (t Targets) GetLatestTarget() Target

func (Targets) GetSortedList

func (t Targets) GetSortedList() Targets

func (Targets) GetTargetByID

func (t Targets) GetTargetByID(ID string) Target

func (Targets) GetTargetByVersion

func (t Targets) GetTargetByVersion(version int) Target

Jump to

Keyboard shortcuts

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