client

package
v0.34.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TufRootUpdatesStatusNone     = "NONE"
	TufRootUpdatesStatusStarted  = "STARTED"
	TufRootUpdatesStatusApplying = "APPLYING"
)
View Source
const OauthURL string = "https://app.foundries.io/oauth"

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

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

func NewApiClient

func NewApiClient(serverUrl string, config Config, caCertPath string, version string) *Api

func (*Api) Delete

func (a *Api) Delete(url string, data []byte) (*[]byte, error)

func (*Api) DeviceChown added in v0.19.1

func (a *Api) DeviceChown(factory, name, owner string) error

func (*Api) DeviceCreateConfig

func (a *Api) DeviceCreateConfig(factory, device string, cfg ConfigCreateRequest) error

func (*Api) DeviceDelete

func (a *Api) DeviceDelete(factory, device string) error

func (*Api) DeviceDeleteConfig

func (a *Api) DeviceDeleteConfig(factory, device, filename string) error

func (*Api) DeviceDeleteDenied added in v0.30.0

func (a *Api) DeviceDeleteDenied(factory, uuid string) error

func (*Api) DeviceGet

func (a *Api) DeviceGet(factory, device string) (*Device, error)

func (*Api) DeviceGetAppsStates added in v0.30.0

func (a *Api) DeviceGetAppsStates(factory, device string) (*AppsStates, error)

func (*Api) DeviceList

func (a *Api) DeviceList(
	mine bool, matchTag, byFactory, byGroup, nameIlike, uuid, byTarget, sortBy string, page, limit int,
) (*DeviceList, error)

func (*Api) DeviceListConfig

func (a *Api) DeviceListConfig(factory, device string) (*DeviceConfigList, error)

func (*Api) DeviceListConfigCont

func (a *Api) DeviceListConfigCont(url string) (*DeviceConfigList, error)

func (*Api) DeviceListCont

func (a *Api) DeviceListCont(url string) (*DeviceList, error)

func (*Api) DeviceListDenied added in v0.30.0

func (a *Api) DeviceListDenied(factory string, page, limit int) (*DeviceList, error)

func (*Api) DeviceListUpdates

func (a *Api) DeviceListUpdates(factory, device string) (*UpdateList, error)

func (*Api) DeviceListUpdatesCont

func (a *Api) DeviceListUpdatesCont(url string) (*UpdateList, error)

func (*Api) DevicePatchConfig

func (a *Api) DevicePatchConfig(factory, device string, cfg ConfigCreateRequest, force bool) error

func (*Api) DeviceRename

func (a *Api) DeviceRename(factory, curName, newName string) error

func (*Api) DeviceSetGroup

func (a *Api) DeviceSetGroup(factory, device, group string) error

func (*Api) DeviceUpdateEvents

func (a *Api) DeviceUpdateEvents(factory, device, correlationId string) ([]UpdateEvent, error)

func (*Api) El2gAddDevice added in v0.30.0

func (a *Api) El2gAddDevice(factory, prodId, deviceUuid string, production bool) error

func (*Api) El2gConfigAws added in v0.30.0

func (a *Api) El2gConfigAws(factory string, awsRegistrationCode string) (El2gAWSCert, error)

func (*Api) El2gCreateDg added in v0.30.0

func (a *Api) El2gCreateDg(factory string) (El2gCsr, error)

func (*Api) El2gDeleteDevice added in v0.30.0

func (a *Api) El2gDeleteDevice(factory, prodId, deviceUuid string, production bool) error

func (*Api) El2gDevices added in v0.30.0

func (a *Api) El2gDevices(factory string) ([]El2gDevice, error)

func (*Api) El2gIntermediateCas added in v0.30.0

func (a *Api) El2gIntermediateCas(factory string) ([]El2gIntermediateCa, error)

func (*Api) El2gOverview added in v0.30.0

func (a *Api) El2gOverview(factory string) (El2gOverview, error)

func (*Api) El2gProductInfo added in v0.30.0

func (a *Api) El2gProductInfo(factory, deviceId string) (El2gProduct, error)

func (*Api) El2gProducts added in v0.30.0

func (a *Api) El2gProducts(factory string) ([]El2gProduct, error)

func (*Api) El2gSecureObjectProvisionings added in v0.30.0

func (a *Api) El2gSecureObjectProvisionings(factory, deviceId string) ([]El2gSecureObjectProvisioning, error)

func (*Api) El2gSecureObjects added in v0.30.0

func (a *Api) El2gSecureObjects(factory string) ([]El2gSecureObject, error)

func (*Api) El2gUploadDgCert added in v0.30.0

func (a *Api) El2gUploadDgCert(factory string, caId int, rootCa, cert string) error

func (*Api) EventQueuesCreate added in v0.30.0

func (a *Api) EventQueuesCreate(factory string, queue EventQueue) ([]byte, error)

func (*Api) EventQueuesDelete added in v0.30.0

func (a *Api) EventQueuesDelete(factory, label string) error

func (*Api) EventQueuesList added in v0.30.0

func (a *Api) EventQueuesList(factory string) ([]EventQueue, error)

func (*Api) FactoriesList added in v0.30.0

func (a *Api) FactoriesList(admin bool) ([]Factory, error)

func (*Api) FactoryCancelWave added in v0.19.1

func (a *Api) FactoryCancelWave(factory string, wave string) error

func (*Api) FactoryCompleteWave added in v0.19.1

func (a *Api) FactoryCompleteWave(factory string, wave string) error

func (*Api) FactoryCreateCA

func (a *Api) FactoryCreateCA(factory string) (CaCerts, error)

func (*Api) FactoryCreateConfig

func (a *Api) FactoryCreateConfig(factory string, cfg ConfigCreateRequest) error

func (*Api) FactoryCreateDeviceGroup

func (a *Api) FactoryCreateDeviceGroup(factory string, name string, description *string) (*DeviceGroup, error)

func (*Api) FactoryCreateEstCsr added in v0.30.0

func (a *Api) FactoryCreateEstCsr(factory string) (string, error)

func (*Api) FactoryCreateWave added in v0.19.1

func (a *Api) FactoryCreateWave(factory string, wave *WaveCreate) error

func (*Api) FactoryDeleteConfig

func (a *Api) FactoryDeleteConfig(factory, filename string) error

func (*Api) FactoryDeleteDeviceGroup

func (a *Api) FactoryDeleteDeviceGroup(factory string, name string) error

func (*Api) FactoryEstUrl added in v0.30.0

func (a *Api) FactoryEstUrl(factory string, port int, resource string) (string, error)

func (*Api) FactoryGetCA

func (a *Api) FactoryGetCA(factory string) (CaCerts, error)

func (*Api) FactoryGetWave added in v0.19.1

func (a *Api) FactoryGetWave(factory string, wave string, showTargets bool) (*Wave, error)

func (*Api) FactoryListConfig

func (a *Api) FactoryListConfig(factory string) (*DeviceConfigList, error)

func (*Api) FactoryListConfigCont

func (a *Api) FactoryListConfigCont(url string) (*DeviceConfigList, error)

func (*Api) FactoryListDeviceGroup

func (a *Api) FactoryListDeviceGroup(factory string) (*[]DeviceGroup, error)

func (*Api) FactoryListWaves added in v0.19.1

func (a *Api) FactoryListWaves(factory string, limit uint64, page int) (*WaveList, error)

func (*Api) FactoryPatchCA

func (a *Api) FactoryPatchCA(factory string, certs CaCerts) error

func (*Api) FactoryPatchConfig

func (a *Api) FactoryPatchConfig(factory string, cfg ConfigCreateRequest, force bool) error

func (*Api) FactoryPatchDeviceGroup

func (a *Api) FactoryPatchDeviceGroup(factory string, name string, new_name *string, new_desc *string) error

func (*Api) FactoryRolloutWave added in v0.19.1

func (a *Api) FactoryRolloutWave(
	factory string, wave string, options WaveRolloutOptions,
) (*WaveRolloutResult, error)

func (*Api) FactorySetEstCrt added in v0.30.0

func (a *Api) FactorySetEstCrt(factory string, cert string) error

func (*Api) FactorySignWave added in v0.34.1

func (a *Api) FactorySignWave(factory string, wave string, signatures []tuf.Signature) error

func (*Api) FactoryStatus

func (a *Api) FactoryStatus(factory string, inactiveThreshold int) (*FactoryStatus, error)

func (*Api) FactoryTriggers

func (a *Api) FactoryTriggers(factory string) ([]ProjectTrigger, error)

func (*Api) FactoryUpdateTrigger

func (a *Api) FactoryUpdateTrigger(factory string, t ProjectTrigger) error

func (*Api) FactoryWaveStatus added in v0.19.1

func (a *Api) FactoryWaveStatus(factory string, wave string, inactiveThreshold int) (*WaveStatus, error)

func (*Api) Get

func (a *Api) Get(url string) (*[]byte, error)

func (*Api) GetOauthConfig added in v0.19.1

func (a *Api) GetOauthConfig() OAuthConfig

func (*Api) GetWireGuardIps added in v0.19.1

func (a *Api) GetWireGuardIps(factory string) ([]WireGuardIp, error)

func (*Api) GroupCreateConfig

func (a *Api) GroupCreateConfig(factory, group string, cfg ConfigCreateRequest) error

func (*Api) GroupDeleteConfig

func (a *Api) GroupDeleteConfig(factory, group, filename string) error

func (*Api) GroupListConfig

func (a *Api) GroupListConfig(factory, group string) (*DeviceConfigList, error)

func (*Api) GroupListConfigCont

func (a *Api) GroupListConfigCont(url string) (*DeviceConfigList, error)

func (*Api) GroupPatchConfig

func (a *Api) GroupPatchConfig(factory, group string, cfg ConfigCreateRequest, force bool) error

func (*Api) JobservLatestBuild added in v0.32.0

func (a *Api) JobservLatestBuild(factory string, successful bool) (*JobservBuild, error)

func (*Api) JobservRun

func (a *Api) JobservRun(runUrl string) (*JobservRun, error)

func (*Api) JobservRunArtifact

func (a *Api) JobservRunArtifact(factory string, build int, run string, artifact string) (*http.Response, error)

func (*Api) JobservRuns

func (a *Api) JobservRuns(factory string, build int) ([]JobservRun, error)

func (*Api) JobservTail

func (a *Api) JobservTail(url string)

func (*Api) JobservTailRun added in v0.30.0

func (a *Api) JobservTailRun(factory string, build int, run string, artifact string)

func (*Api) NewTarget added in v0.30.0

func (a *Api) NewTarget(tufMeta tuf.FileMeta) (*Target, error)

func (*Api) Patch

func (a *Api) Patch(url string, data []byte) (*[]byte, error)

func (*Api) Post

func (a *Api) Post(url string, data []byte) (*[]byte, error)

func (*Api) ProdTargetsGet added in v0.19.1

func (a *Api) ProdTargetsGet(factory string, tag string, failNotExist bool) (*AtsTufTargets, error)

func (*Api) ProdTargetsList added in v0.19.1

func (a *Api) ProdTargetsList(factory string, failNotExist bool, tags ...string) (map[string]AtsTufTargets, error)

func (*Api) Put

func (a *Api) Put(url string, data []byte) (*[]byte, error)

func (*Api) RawGet

func (a *Api) RawGet(url string, headers *map[string]string) (*http.Response, error)

func (*Api) RawPost added in v0.30.0

func (a *Api) RawPost(url string, data []byte, headers *map[string]string) (*http.Response, error)

func (*Api) SbomDownload added in v0.30.0

func (a *Api) SbomDownload(factory, targetName, path, contentType string) ([]byte, error)

func (*Api) TargetComposeApp

func (a *Api) TargetComposeApp(factory string, targetName string, app string) (*ComposeAppBundle, error)

Return a Compose App for a given Target by a Target ID and an App name

func (*Api) TargetCustom

func (a *Api) TargetCustom(target tuf.FileMeta) (*TufCustom, error)

func (*Api) TargetDeleteTargets

func (a *Api) TargetDeleteTargets(factory string, target_names []string) (string, string, error)

func (*Api) TargetDeltasCreate added in v0.19.1

func (a *Api) TargetDeltasCreate(factory string, toVer int, fromVers []int, hwId string) (string, string, error)

func (*Api) TargetGet added in v0.19.1

func (a *Api) TargetGet(factory string, targetName string) (*tuf.FileMeta, error)

func (*Api) TargetImageCreate

func (a *Api) TargetImageCreate(factory, targetName, appShortlist, ciScriptsRepo, ciScriptsRef string) (string, string, error)

func (*Api) TargetSboms added in v0.30.0

func (a *Api) TargetSboms(factory string, targetName string) ([]Sbom, error)

func (*Api) TargetTestArtifact

func (a *Api) TargetTestArtifact(factory string, target int, testId string, artifact string) (*[]byte, error)

func (*Api) TargetTestResults

func (a *Api) TargetTestResults(factory string, target int, testId string) (*TargetTest, error)

func (*Api) TargetTesting

func (a *Api) TargetTesting(factory string) ([]int, error)

Return a list of Targets that have been tested

func (*Api) TargetTests

func (a *Api) TargetTests(factory string, target int) (*TargetTestList, error)

func (*Api) TargetTestsCont

func (a *Api) TargetTestsCont(url string) (*TargetTestList, error)

func (*Api) TargetUpdateTags

func (a *Api) TargetUpdateTags(factory string, updates UpdateTargets) (string, string, error)

func (*Api) TargetsList

func (a *Api) TargetsList(factory string, version ...string) (tuf.Files, error)

func (*Api) TargetsListRaw

func (a *Api) TargetsListRaw(factory string) (*[]byte, error)

func (*Api) TargetsPost added in v0.30.0

func (a *Api) TargetsPost(factory string, data []byte) error

func (*Api) TargetsPut

func (a *Api) TargetsPut(factory string, data []byte) (string, string, error)

func (*Api) TeamDetails added in v0.30.0

func (a *Api) TeamDetails(factory string, team_name string) (*FactoryTeamDetails, error)

func (*Api) TeamsList added in v0.30.0

func (a *Api) TeamsList(factory string) ([]FactoryTeam, error)

func (*Api) TufMetadataGet added in v0.30.0

func (a *Api) TufMetadataGet(factory string, metadata string, tag string, prod bool) (*[]byte, error)

func (*Api) TufProdRootGet added in v0.19.1

func (a *Api) TufProdRootGet(factory string) (*AtsTufRoot, error)

func (*Api) TufProdRootPost added in v0.19.1

func (a *Api) TufProdRootPost(factory string, root []byte) (string, error)

func (*Api) TufRootFirstKey added in v0.30.0

func (a *Api) TufRootFirstKey(factory string) (*AtsKey, error)

func (*Api) TufRootGet added in v0.19.1

func (a *Api) TufRootGet(factory string) (*AtsTufRoot, error)

func (*Api) TufRootGetVer added in v0.19.1

func (a *Api) TufRootGetVer(factory string, version int) (*AtsTufRoot, error)

func (*Api) TufRootPost added in v0.19.1

func (a *Api) TufRootPost(factory string, root []byte) (string, error)

func (*Api) TufRootUpdatesApply added in v0.30.0

func (a *Api) TufRootUpdatesApply(factory, txid string) (err error)

func (*Api) TufRootUpdatesCancel added in v0.30.0

func (a *Api) TufRootUpdatesCancel(factory string) (err error)

func (*Api) TufRootUpdatesGenerateOnlineKeys added in v0.32.0

func (a *Api) TufRootUpdatesGenerateOnlineKeys(
	factory, txid, keyType string, roleNames []string,
) (err error)

func (*Api) TufRootUpdatesGet added in v0.30.0

func (a *Api) TufRootUpdatesGet(factory string) (res TufRootUpdates, err error)

func (*Api) TufRootUpdatesInit added in v0.30.0

func (a *Api) TufRootUpdatesInit(
	factory, changelog string, firstTime, shortcut bool,
) (res TufRootUpdatesInit, err error)

func (*Api) TufRootUpdatesPut added in v0.30.0

func (a *Api) TufRootUpdatesPut(
	factory, txid string, ciRoot, prodRoot *AtsTufRoot, targetsSigs map[string][]tuf.Signature,
) (err error)

func (*Api) TufTargetMetadataRefresh added in v0.30.0

func (a *Api) TufTargetMetadataRefresh(factory string, target string, tag string, expiresIn int, prod bool) (map[string]tuf.Signed, error)

func (*Api) TufTargetsOnlineKey added in v0.30.0

func (a *Api) TufTargetsOnlineKey(factory string) (*AtsKey, error)

func (*Api) UserAccessDetails added in v0.30.0

func (a *Api) UserAccessDetails(factory string, user_id string) (*FactoryUserAccessDetails, error)

func (*Api) UsersList

func (a *Api) UsersList(factory string) ([]FactoryUser, error)

type AppServiceState added in v0.30.0

type AppServiceState struct {
	Name     string `json:"name"`
	Hash     string `json:"hash"`
	State    string `json:"state"`
	Status   string `json:"status"`
	Health   string `json:"health"`
	ImageUri string `json:"image"`
	Logs     string `json:"logs"`
}

type AppState added in v0.30.0

type AppState struct {
	Services []AppServiceState `json:"services"`
	State    string            `json:"state"`
	Uri      string            `json:"uri"`
}

type AppsState added in v0.30.0

type AppsState struct {
	Ostree     string              `json:"ostree"`
	DeviceTime string              `json:"deviceTime"`
	Apps       map[string]AppState `json:"apps,omitempty"`
}

type AppsStates added in v0.30.0

type AppsStates struct {
	States []AppsState `json:"apps-states"`
}

type AtsKey added in v0.19.1

type AtsKey struct {
	KeyType  string    `json:"keytype"`
	KeyValue AtsKeyVal `json:"keyval"`
}

type AtsKeyVal added in v0.19.1

type AtsKeyVal struct {
	Public  string `json:"public,omitempty"`
	Private string `json:"private,omitempty"`
}

ota-tuf serializes root.json differently from Notary. The key representation and signing algorithms differ slightly. These Ats* structs provide an an implementation compatible with ota-tuf and libaktualizr.

type AtsRootMeta added in v0.19.1

type AtsRootMeta struct {
	tuf.SignedCommon
	Consistent bool                           `json:"consistent_snapshot"`
	Keys       map[string]AtsKey              `json:"keys"`
	Roles      map[tuf.RoleName]*tuf.RootRole `json:"roles"`
	Reason     *RootChangeReason              `json:"x-changelog,omitempty"`
}

type AtsTargetsMeta added in v0.19.1

type AtsTargetsMeta struct {
	tuf.SignedCommon
	Targets tuf.Files `json:"targets"`
}

type AtsTufRoot added in v0.19.1

type AtsTufRoot struct {
	// A non-standard targets-signatures field allows to make an atomic key rotation
	TargetsSignatures map[string][]tuf.Signature `json:"targets-signatures,omitempty"`
	Signatures        []tuf.Signature            `json:"signatures"`
	Signed            AtsRootMeta                `json:"signed"`
}

type AtsTufTargets added in v0.19.1

type AtsTufTargets struct {
	Signatures []tuf.Signature `json:"signatures"`
	Signed     AtsTargetsMeta  `json:"signed"`
}

type CaCerts

type CaCerts struct {
	RootCrt string `json:"root-crt"`
	CaCrt   string `json:"ca-crt"`
	CaCsr   string `json:"ca-csr"`
	EstCrt  string `json:"est-tls-crt"`
	TlsCrt  string `json:"tls-crt"`
	TlsCsr  string `json:"tls-csr"`

	ChangeMeta ChangeMeta `json:"change-meta"`

	CreateCaScript       *string `json:"create_ca"`
	CreateDeviceCaScript *string `json:"create_device_ca"`
	SignCaScript         *string `json:"sign_ca_csr"`
	SignTlsScript        *string `json:"sign_tls_csr"`
}

type ChangeMeta added in v0.30.0

type ChangeMeta struct {
	CreatedBy string `json:"created-by"`
	CreatedAt string `json:"created-at"`
	UpdatedBy string `json:"updated-by"`
	UpdatedAt string `json:"updated-at"`
}

type ClientCredentials

type ClientCredentials struct {
	Config      OAuthConfig
	InsecureSSL bool
}

func NewClientCredentials

func NewClientCredentials(c OAuthConfig) ClientCredentials

func (*ClientCredentials) Get

func (c *ClientCredentials) Get() error

Get a new token.

func (*ClientCredentials) HasRefreshToken

func (c *ClientCredentials) HasRefreshToken() bool

HasRefreshToken checks if a refresh token is available.

func (*ClientCredentials) IsExpired

func (c *ClientCredentials) IsExpired() (bool, error)

IsExpired checks if the OAuth token is expired.

func (*ClientCredentials) Refresh

func (c *ClientCredentials) Refresh() error

Refresh performs a refresh of the token.

type ComposeApp

type ComposeApp struct {
	Uri string `json:"uri"`
}

func (ComposeApp) Hash added in v0.19.1

func (a ComposeApp) Hash() string

func (ComposeApp) Name added in v0.30.0

func (a ComposeApp) Name() string

type ComposeAppBundle

type ComposeAppBundle struct {
	Uri      string                 `json:"uri"`
	Error    string                 `json:"error"`
	Warnings []string               `json:"warnings"`
	Manifest map[string]interface{} `json:"manifest"`
	Content  ComposeAppContent      `json:"content"`
}

type ComposeAppContent

type ComposeAppContent struct {
	Files       []string               `json:"files"`
	ComposeSpec map[string]interface{} `json:"compose_spec"`
}

type Config

type Config struct {
	Factory            string
	Token              string
	ClientCredentials  OAuthConfig
	ExtraHeaders       map[string]string
	InsecureSkipVerify bool
}

type ConfigCreateRequest

type ConfigCreateRequest struct {
	Reason string       `json:"reason"`
	Files  []ConfigFile `json:"files"`
}

type ConfigFile

type ConfigFile struct {
	Name        string   `json:"name"`
	Value       string   `json:"value"`
	Unencrypted bool     `json:"unencrypted"`
	OnChanged   []string `json:"on-changed,omitempty"`
}

type Device

type Device struct {
	Uuid          string           `json:"uuid"`
	Name          string           `json:"name"`
	Owner         string           `json:"owner"`
	Factory       string           `json:"factory"`
	GroupName     string           `json:"device-group"` // Returned in List API
	Group         *DeviceGroup     `json:"group"`        // Returned in Get API
	LastSeen      string           `json:"last-seen"`
	OstreeHash    string           `json:"ostree-hash"`
	LmpVer        string           `json:"lmp-ver,omitempty"`
	DockerApps    []string         `json:"docker-apps,omitempty"`
	Tag           string           `json:"tag,omitempty"`
	Network       *NetInfo         `json:"network-info,omitempty"`
	Hardware      *json.RawMessage `json:"hardware-info,omitempty"`
	TargetName    string           `json:"target-name"`
	Status        string           `json:"status"`
	CurrentUpdate string           `json:"current-update"`
	UpToDate      bool             `json:"up-to-date"`
	PublicKey     string           `json:"public-key"`
	ActiveConfig  *DeviceConfig    `json:"active-config,omitempty"`
	AktualizrToml string           `json:"aktualizr-toml,omitempty"`
	IsProd        bool             `json:"is-prod"`
	IsWave        bool             `json:"is-wave"`
	ChangeMeta    ChangeMeta       `json:"change-meta"`
	Secondaries   []struct {
		Serial     string `json:"serial"`
		TargetName string `json:"target-name"`
		HardwareId string `json:"hardware-id"`
	} `json:"secondary-ecus"`
	AppsState *AppsState `json:"apps-state,omitempty"`
}

func (Device) Online

func (d Device) Online(inactiveHoursThreshold int) bool

type DeviceConfig

type DeviceConfig struct {
	CreatedAt string       `json:"created-at"`
	AppliedAt string       `json:"applied-at"` // This is not present in factory config
	CreatedBy string       `json:"created-by"`
	Reason    string       `json:"reason"`
	Files     []ConfigFile `json:"files"`
}

type DeviceConfigList

type DeviceConfigList struct {
	Configs []DeviceConfig `json:"config"`
	Total   int            `json:"total"`
	Next    *string        `json:"next"`
}

type DeviceGroup

type DeviceGroup struct {
	Id          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`

	ChangeMeta ChangeMeta `json:"change-meta"`
}

type DeviceGroupStatus added in v0.19.1

type DeviceGroupStatus struct {
	Name            string `json:"name"`
	DevicesTotal    int    `json:"devices-total"`
	DevicesOnline   int    `json:"devices-online"`
	DevicesOnLatest int    `json:"devices-on-latest"`
	DevicesOnOrphan int    `json:"devices-on-orphan"`
	Reinstalling    int    `json:"(re-)installing"`
}

type DeviceList

type DeviceList struct {
	Devices []Device `json:"devices"`
	Total   int      `json:"total"`
	Next    *string  `json:"next"`
}

type DockerApp

type DockerApp struct {
	FileName string `json:"filename"`
	Uri      string `json:"uri"`
}

type El2gAWSCert added in v0.30.0

type El2gAWSCert struct {
	CA   string `json:"ca"`
	Cert string `json:"cert"`
}

type El2gCsr added in v0.30.0

type El2gCsr struct {
	Id    int    `json:"id"`
	Value string `json:"value"`
}

type El2gDevice added in v0.30.0

type El2gDevice struct {
	DeviceGroup    string      `json:"device-group"`
	Id             json.Number `json:"id"`
	LastConnection string      `json:"last-connection"`
}

type El2gIntermediateCa added in v0.30.0

type El2gIntermediateCa struct {
	Id        json.Number `json:"id"`
	Name      string      `json:"name"`
	Algorithm string      `json:"algorithm"`
	Value     string      `json:"value"`
}

type El2gOverview added in v0.30.0

type El2gOverview struct {
	Subdomain  string `json:"subdomain"`
	ProductIds []int  `json:"product-ids"`
}

type El2gProduct added in v0.30.0

type El2gProduct struct {
	Type string `json:"commercialName"`
	Nc12 string `json:"nc12"`
}

type El2gSecureObject added in v0.30.0

type El2gSecureObject struct {
	Id       json.Number `json:"id"`
	Type     string      `json:"type"`
	Name     string      `json:"name"`
	ObjectId string      `json:"object-id"`
}

type El2gSecureObjectProvisioning added in v0.30.0

type El2gSecureObjectProvisioning struct {
	Name  string `json:"secureObjectName"`
	Type  string `json:"secureObjectType"`
	State string `json:"provisioningState"`
	Cert  string `json:"certificate"`
}

type EventDetail

type EventDetail struct {
	Version    string `json:"version"`
	TargetName string `json:"targetName"`
	Success    *bool  `json:"success,omitempty"`
	Details    string `json:"details"`
}

type EventQueue added in v0.30.0

type EventQueue struct {
	Label   string `json:"label"`
	Type    string `json:"type"`
	PushUrl string `json:"push-url,omitempty"`
}

type EventType

type EventType struct {
	Id string `json:"id"`
}

type Factory added in v0.30.0

type Factory struct {
	Name string `json:"name"`
	Id   string `json:"reposerver-id"`
}

type FactoryStatus

type FactoryStatus struct {
	TotalDevices int         `json:"total-devices"`
	Tags         []TagStatus `json:"tags"`
	ProdTags     []TagStatus `json:"prod-tags"`
	ProdWaveTags []TagStatus `json:"wave-tags"`
}

type FactoryTeam added in v0.30.0

type FactoryTeam struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type FactoryTeamDetails added in v0.30.0

type FactoryTeamDetails struct {
	Name        string        `json:"name"`
	Description string        `json:"description"`
	Scopes      []string      `json:"scopes"`
	Groups      []string      `json:"groups"`
	Members     []FactoryUser `json:"members"`
}

type FactoryUser

type FactoryUser struct {
	PolisId string `json:"polis-id"`
	Name    string `json:"name"`
	Role    string `json:"role"`
}

type FactoryUserAccessDetails added in v0.30.0

type FactoryUserAccessDetails struct {
	PolisId         string               `json:"polis-id"`
	Name            string               `json:"name"`
	Role            string               `json:"role"`
	Teams           []FactoryTeamDetails `json:"teams-ext"`
	EffectiveScopes []string             `json:"effective-scopes"`
}

type HttpError

type HttpError struct {
	Message  string
	Response *http.Response
}

This is an error returned in case if we've successfully received an HTTP response which contains an unexpected HTTP status code

func AsHttpError

func AsHttpError(err error) *HttpError

This is much better than err.(HttpError) as it also accounts for wrapped errors.

func (*HttpError) Error

func (err *HttpError) Error() string

type JobservBuild added in v0.32.0

type JobservBuild struct {
	ID int `json:"build_id"`
}

type JobservRun

type JobservRun struct {
	Name      string   `json:"name"`
	Url       string   `json:"url"`
	Artifacts []string `json:"artifacts"`
}

type NetInfo

type NetInfo struct {
	Hostname string `json:"hostname"`
	Ipv4     string `json:"local_ipv4"`
	MAC      string `json:"mac"`
}

type OAuthConfig

type OAuthConfig struct {
	ClientId     string  `mapstructure:"client_id"`
	ClientSecret string  `mapstructure:"client_secret"`
	TokenType    string  `mapstructure:"token_type"`
	AccessToken  string  `mapstructure:"access_token"`
	RefreshToken string  `mapstructure:"refresh_token"`
	ExpiresIn    float64 `mapstructure:"expires_in"`
	Created      string
	DefaultOrg   string
	URL          string
}

type OAuthResponse

type OAuthResponse struct {
	TokenType    string  `json:"token_type"`
	AccessToken  string  `json:"access_token"`
	RefreshToken string  `json:"refresh_token"`
	ExpiresIn    float64 `json:"expires_in"`
	Scope        string  `json:"scope"`
	Orgs         []Org   `json:"orgs"`
}

type Org

type Org struct {
	Name string `json:"name"`
}

type ProjectSecret

type ProjectSecret struct {
	Name  string  `json:"name"`
	Value *string `json:"value"`
}

type ProjectTrigger

type ProjectTrigger struct {
	Type    string          `json:"type"`
	Id      int             `json:"id,omitempty"`
	Secrets []ProjectSecret `json:"secrets"`
}

type RolloutGroupStatus added in v0.19.1

type RolloutGroupStatus struct {
	Name             string         `json:"name"`
	RolloutAt        string         `json:"rollout-at"`
	DevicesTotal     int            `json:"devices-total"`
	DevicesOnline    int            `json:"devices-online"`
	DevicesOnWave    int            `json:"devices-on-wave-version"`
	DevicesOnNewer   int            `json:"devices-on-newer-version"`
	DevicesOnOlder   int            `json:"devices-on-older-version"`
	DevicesScheduled int            `json:"devices-scheduled-for-update"`
	Targets          []TargetStatus `json:"targets"`
}

type RolloutHistory added in v0.34.1

type RolloutHistory struct {
	GroupName     string `json:"group-name"`
	RolloutBy     string `json:"rollout-by"`
	RolloutAt     string `json:"rollout-at"`
	IsFullGroup   bool   `json:"is-full-group"`
	IsFactoryWide bool   `json:"is-factory-wide"`
	DeviceNumber  int    `json:"num-devices"`
}

type RootChangeReason added in v0.30.0

type RootChangeReason struct {
	PolisId   string    `json:"polis-id"`
	Message   string    `json:"message"`
	Timestamp time.Time `json:"timestamp"`
}

type Sbom added in v0.30.0

type Sbom struct {
	CiBuild  string `json:"ci-build"`
	CiRun    string `json:"ci-run"`
	Artifact string `json:"artifact"`
	Uri      string `json:"uri"`
}

type SpdxDocument added in v0.30.0

type SpdxDocument struct {
	Packages []SpdxPackage `json:"packages"`
}

type SpdxPackage added in v0.30.0

type SpdxPackage struct {
	Name             string
	LicenseConcluded string `json:"licenseConcluded"`
	LicenseDeclared  string `json:"licenseDeclared"`
	VersionInfo      string `json:"versionInfo"`
}

func (SpdxPackage) License added in v0.30.0

func (p SpdxPackage) License() string

type TagStatus

type TagStatus struct {
	Name            string              `json:"name"`
	DevicesTotal    int                 `json:"devices-total"`
	DevicesOnline   int                 `json:"devices-online"`
	DevicesOnLatest int                 `json:"devices-on-latest"`
	DevicesOnOrphan int                 `json:"devices-on-orphan"`
	LatestTarget    int                 `json:"latest-target"`
	Targets         []TargetStatus      `json:"targets"`
	DeviceGroups    []DeviceGroupStatus `json:"device-groups"`
}

type Target added in v0.30.0

type Target struct {
	Length int64      `json:"length"`
	Hashes tuf.Hashes `json:"hashes"`
	Custom *TufCustom `json:"custom,omitempty"`
}

func (*Target) DeriveTarget added in v0.30.0

func (t *Target) DeriveTarget(newVer int) *Target

func (*Target) HardwareId added in v0.30.0

func (t *Target) HardwareId() string

func (*Target) HasTag added in v0.30.0

func (t *Target) HasTag(tag string) bool

func (*Target) Name added in v0.30.0

func (t *Target) Name() string

func (*Target) SetHash added in v0.30.0

func (t *Target) SetHash(hash string) error

func (*Target) Tags added in v0.30.0

func (t *Target) Tags() []string

func (*Target) Version added in v0.30.0

func (t *Target) Version() int

type TargetStatus

type TargetStatus struct {
	Version      int  `json:"version"`
	Devices      int  `json:"devices"`
	Reinstalling int  `json:"(re-)installing"`
	IsOrphan     bool `json:"is-orphan"`
}

type TargetTest

type TargetTest struct {
	Name        string              `json:"name"`
	Id          string              `json:"test-id"`
	DeviceUUID  string              `json:"device-uuid"`
	DeviceName  string              `json:"device-name"`
	Status      string              `json:"status"`
	Details     string              `json:"details"`
	CreatedOn   float32             `json:"created-on"`
	CompletedOn float32             `json:"completed-on"`
	Results     []TargetTestResults `json:"results"`
	Artifacts   []string            `json:"artifacts"`
}

type TargetTestList

type TargetTestList struct {
	Tests []TargetTest `json:"tests"`
	Total int          `json:"total"`
	Next  *string      `json:"next"`
}

type TargetTestResults

type TargetTestResults struct {
	Name    string `json:"name"`
	Status  string `json:"status"`
	Details string `json:"details"`
}

type TufCustom

type TufCustom struct {
	HardwareIds    []string              `json:"hardwareIds,omitempty"`
	Tags           []string              `json:"tags,omitempty"`
	TargetFormat   string                `json:"targetFormat,omitempty"`
	Version        string                `json:"version,omitempty"`
	ComposeApps    map[string]ComposeApp `json:"docker_compose_apps,omitempty"`
	Name           string                `json:"name,omitempty"`
	ContainersSha  string                `json:"containers-sha,omitempty"`
	LmpManifestSha string                `json:"lmp-manifest-sha,omitempty"`
	OverridesSha   string                `json:"meta-subscriber-overrides-sha,omitempty"`
	Uri            string                `json:"uri,omitempty"`
	OrigUri        string                `json:"origUri,omitempty"`
	CreatedAt      string                `json:"createdAt,omitempty"`
	UpdatedAt      string                `json:"updatedAt,omitempty"`
	LmpVer         string                `json:"lmp-ver,omitempty"`
}

type TufRootAmendment added in v0.32.0

type TufRootAmendment struct {
	Kind    string            `json:"kind"`
	Message string            `json:"message"`
	Args    map[string]string `json:"args"`
}

type TufRootIssues added in v0.32.0

type TufRootIssues struct {
	Errors   []TufRootAmendment `json:"errors"`
	Warnings []TufRootAmendment `json:"warnings"`
}

type TufRootPair added in v0.30.0

type TufRootPair struct {
	CiRoot     string            `json:"ci-root"`
	ProdRoot   string            `json:"prod-root"`
	OnlineKeys map[string]string `json:"online-keys"`
}

type TufRootUpdates added in v0.30.0

type TufRootUpdates struct {
	Status     string             `json:"status"`
	Current    *TufRootPair       `json:"current"`
	Updated    *TufRootPair       `json:"updated"`
	ChangeMeta *ChangeMeta        `json:"change-meta"`
	FirstTime  bool               `json:"first-time"`
	Amendments []TufRootAmendment `json:"amendments"`
	Issues     TufRootIssues      `json:"issues"`
}

type TufRootUpdatesInit added in v0.30.0

type TufRootUpdatesInit struct {
	TransactionId    string          `json:"txid"`
	FirstRootKeyPriv json.RawMessage `json:"first_root.sec"`
	FirstRootKeyPub  json.RawMessage `json:"first_root.pub"`
}

type Update

type Update struct {
	CorrelationId string `json:"correlation-id"`
	Target        string `json:"target"`
	Version       string `json:"version"`
	Time          string `json:"time"`
}

type UpdateEvent

type UpdateEvent struct {
	Time   string      `json:"deviceTime"`
	Type   EventType   `json:"eventType"`
	Detail EventDetail `json:"event"`
}

type UpdateList

type UpdateList struct {
	Updates []Update `json:"updates"`
	Total   int      `json:"total"`
	Next    *string  `json:"next"`
}

type UpdateTarget added in v0.30.0

type UpdateTarget struct {
	Custom TufCustom `json:"custom"`
}

type UpdateTargets added in v0.30.0

type UpdateTargets map[string]UpdateTarget

type Wave added in v0.19.1

type Wave struct {
	Name          string                         `json:"name"`
	Version       string                         `json:"version"`
	Tag           string                         `json:"tag"`
	Targets       *json.RawMessage               `json:"targets"`
	Status        string                         `json:"status"`
	RolloutGroups map[string]WaveRolloutGroupRef `json:"rollout-groups"`
	History       []RolloutHistory               `json:"rollout-history"`
	ChangeMeta    ChangeMeta                     `json:"change-meta"`
}

type WaveCreate added in v0.19.1

type WaveCreate struct {
	Name    string     `json:"name"`
	Version string     `json:"version"`
	Tag     string     `json:"tag"`
	Targets tuf.Signed `json:"targets"`
}

type WaveList added in v0.34.1

type WaveList struct {
	Waves []Wave  `json:"waves"`
	Total int     `json:"total"`
	Next  *string `json:"next"`
}

type WaveRolloutGroupRef added in v0.19.1

type WaveRolloutGroupRef struct {
	GroupId   int    `json:"group-id"`
	GroupName string `json:"group-name"`
	CreatedAt string `json:"created-at"`
	CreatedBy string `json:"created-by"`
}

type WaveRolloutOptions added in v0.19.1

type WaveRolloutOptions struct {
	Group      string   `json:"group,omitempty"`
	Limit      int      `json:"limit,omitempty"`
	Percentage int      `json:"percentage,omitempty"`
	Uuids      []string `json:"uuids,omitempty"`
	DryRun     bool     `json:"dry-run"`
	PrintUuids bool     `json:"return-uuids"`
	PrintNames bool     `json:"return-names"`
}

type WaveRolloutResult added in v0.34.1

type WaveRolloutResult struct {
	Wave
	DeviceNum   int      `json:"device-num"`
	DeviceUuids []string `json:"device-uuids"`
	DeviceNames []string `json:"device-names"`
}

type WaveStatus added in v0.19.1

type WaveStatus struct {
	Name               string               `json:"name"`
	Version            int                  `json:"version"`
	Tag                string               `json:"tag"`
	Status             string               `json:"status"`
	CreatedAt          string               `json:"created-at"`
	FinishedAt         string               `json:"finished-at"`
	TotalDevices       int                  `json:"total-devices"`
	UpdatedDevices     int                  `json:"updated-devices"`
	ScheduledDevices   int                  `json:"scheduled-devices"`
	UnscheduledDevices int                  `json:"unscheduled-devices"`
	RolloutGroups      []RolloutGroupStatus `json:"rollout-groups"`
	OtherGroups        []RolloutGroupStatus `json:"other-groups"`
}

type WireGuardIp added in v0.19.1

type WireGuardIp struct {
	Name    string `json:"name"`
	Ip      string `json:"ip"`
	Enabled bool   `json:"enabled"`
}

Jump to

Keyboard shortcuts

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