models

package
v0.0.0-...-c33b5b2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

FIXME: golangci-lint nolint:govet,revive

FIXME: golangci-lint nolint:govet,revive

FIXME: golangci-lint nolint:govet,revive

FIXME: golangci-lint nolint:govet,revive

Package models contains structs, related struct methods, and constants This file defines models for events FIXME: golangci-lint nolint:govet,revive

FIXME: golangci-lint nolint:gosimple,govet,revive,unused

FIXME: golangci-lint nolint:revive

FIXME: golangci-lint nolint:revive

FIXME: golangci-lint nolint:govet,revive,staticcheck

Index

Constants

View Source
const (
	// RepoStatusBuilding is for when a image is on a error state
	RepoStatusBuilding = "BUILDING"
	// RepoStatusError is for when a Repo is on a error state
	RepoStatusError = "ERROR"
	// RepoStatusPending is for when the repo process is starting
	RepoStatusPending = "PENDING"
	// RepoStatusSkipped is for when a Repo is available to the user
	RepoStatusSkipped = "SKIPPED"
	// RepoStatusSuccess is for when a Repo is available to the user
	RepoStatusSuccess = "SUCCESS"
)
View Source
const (
	// DeviceGroupNameInvalidErrorMessage is the error message returned when device group name is invalid.
	DeviceGroupNameInvalidErrorMessage = "group name must start with alphanumeric characters and can contain underscore and hyphen characters"
	// DeviceGroupNameEmptyErrorMessage is the error message returned when device group Name is empty.
	DeviceGroupNameEmptyErrorMessage = "group name cannot be empty"
	// DeviceGroupOrgIDEmptyErrorMessage is the error message returned when device group orgID is empty.
	DeviceGroupOrgIDEmptyErrorMessage = "group orgID can't be empty"
	// DeviceGroupTypeStatic correspond to the device group type value "static".
	DeviceGroupTypeStatic = "static"
	// DeviceGroupTypeDynamic correspond to the device group type value "dynamic".
	DeviceGroupTypeDynamic = "dynamic"
	// DeviceGroupTypeDefault correspond to the default device group type value.
	DeviceGroupTypeDefault = DeviceGroupTypeStatic
	// DeviceGroupTypeInvalidErrorMessage is the error message returned when device group type is invalid
	DeviceGroupTypeInvalidErrorMessage = "group type must be \"static\" or \"dynamic\""
)
View Source
const (
	// DeviceViewStatusRunning is for when a device is in a normal state
	DeviceViewStatusRunning = "RUNNING"
	// DeviceViewStatusUpdating is for when a update is sent to a device
	DeviceViewStatusUpdating = "UPDATING"
	// DeviceViewStatusUpdateAvail is for when a update available for a device
	DeviceViewStatusUpdateAvail = "UPDATE AVAILABLE"
)
View Source
const (

	// SourceEdgeEventAPI indicates the API service is the source
	SourceEdgeEventAPI string = "urn:redhat:source:edgemanagement:api"

	// EventTypeEdgeImageRequested indicates an image has been requested
	EventTypeEdgeImageRequested string = "com.redhat.console.edge.api.image.requested"
	// EventTypeEdgeImageUpdateRequested indicates an image update has been requested
	EventTypeEdgeImageUpdateRequested string = "com.redhat.console.edge.api.image.update.requested"
	// EventTypeEdgeImageISORequested indicates an image update has been requested
	EventTypeEdgeImageISORequested string = "com.redhat.console.edge.api.image.iso.requested"

	// EventTypeEdgeCommitCompleted indicates a commit has completed
	EventTypeEdgeCommitCompleted string = "com.redhat.console.edge.api.image.commit.completed"
	// EventTypeEdgeOstreeRepoCompleted indicates an ostree repo has completed
	EventTypeEdgeOstreeRepoCompleted string = "com.redhat.console.edge.api.image.repo.completed"
	// EventTypeEdgeInstallerCompleted indicates an installer has completed
	EventTypeEdgeInstallerCompleted string = "com.redhat.console.edge.api.image.installer.completed"
	// EventTypeEdgeUpdateRepoRequested indicates an update transaction repository has been requested
	EventTypeEdgeUpdateRepoRequested string = "com.redhat.console.edge.api.update.repository.requested"
	// EventTypeEdgeWriteTemplateRequested indicates an update transaction write template repository has been requested
	EventTypeEdgeWriteTemplateRequested string = "com.redhat.console.edge.api.write.update.template.requested"
)
View Source
const (
	// DistributionCantBeNilMessage is the error message when a distribution is nil
	DistributionCantBeNilMessage = "distribution can't be empty"
	// ArchitectureCantBeEmptyMessage is the error message when the architecture is empty
	ArchitectureCantBeEmptyMessage = "architecture can't be empty"
	// NameCantBeInvalidMessage is the error message when the name is invalid
	NameCantBeInvalidMessage = "name must start with alphanumeric characters and can contain underscore and hyphen characters"
	// ImageTypeNotAccepted is the error message when an image type is not accepted
	ImageTypeNotAccepted = "this image type is not accepted"
	// ImageNameAlreadyExists is the error message when an image name already exists
	ImageNameAlreadyExists = "this image name is already in use"
	// NoOutputTypes is the error message when the output types list is empty
	NoOutputTypes = "an output type is required"

	// ImageTypeInstaller is the installer image type on Image Builder
	ImageTypeInstaller = "rhel-edge-installer"
	// ImageTypeCommit is the installer image type on Image Builder
	ImageTypeCommit = "rhel-edge-commit"

	// ImageStatusCreated is for when an image is created
	ImageStatusCreated = "CREATED"
	// ImageStatusBuilding is for when an image is building
	ImageStatusBuilding = "BUILDING"
	// ImageStatusError is for when an image is on a error state
	ImageStatusError = "ERROR"
	// ImageStatusSuccess is for when an image is available to the user
	ImageStatusSuccess = "SUCCESS"
	// ImageStatusInterrupted is for when an image build is interrupted
	ImageStatusInterrupted = "INTERRUPTED"
	// ImageStatusPending is for when an image or installer is waiting to be built
	ImageStatusPending = "PENDING"

	// ImageStatusStorageCleaned is for when an image commit or image commit repo or image installer content has storage cleaned
	// this status is set only for Commit, Repo and Installer models
	// this happen when an image is going to be deleted forever or when image status is ERROR
	ImageStatusStorageCleaned = "STORAGE_CLEANED"

	// MissingInstaller is the error message for not passing an installer in the request
	MissingInstaller = "installer info must be provided"
	// MissingOrganizationId is the error message for not providing an org id in the request
	MissingOrganizationId = "org_id must be provided"
	// MissingUsernameError is the error message for not passing username in the request
	MissingUsernameError = "username must be provided"
	// ReservedUsernameError is the error message for passing a reserved username in the request
	ReservedUsernameError = "username is reserved"
	// MissingSSHKeyError is the error message when SSH Key is not given
	MissingSSHKeyError = "SSH key must be provided"
	// InvalidSSHKeyError is the error message for not supported or invalid ssh key format
	InvalidSSHKeyError = "SSH Key supports RSA or DSS or ED25519 or ECDSA-SHA2 algorithms"
)
View Source
const (
	// StaticDeltaStatusDownloading represents the to and from commits are being downloaded
	StaticDeltaStatusDownloading = "DOWNLOADING"

	// StaticDeltaStatusError represents there has been an error in the process
	StaticDeltaStatusError = "ERROR"

	// StaticDeltaStatusFailedPrereq skips the static delta and uses existing to_commit URL
	StaticDeltaStatusFailedPrereq = "FAILEDPREREQ"

	// StaticDeltaStatusForceGenerate is a feature flag override to force static delta generation
	StaticDeltaStatusForceGenerate = "FORCE"

	// StaticDeltaStatusGenerating represents static delta generation is in process
	StaticDeltaStatusGenerating = "GENERATING"

	// StaticDeltaStatusNotFound represents when a static delta is not found (not an error)
	StaticDeltaStatusNotFound = "NOTFOUND"

	// StaticDeltaStatusNotFound represents static delta under development (not an error)
	StaticDeltaStatusNotImplemented = "NOTIMPLEMENTED"

	// StaticDeltaStatusReady represents the static delta is ready to be used for an update
	StaticDeltaStatusReady = "READY"

	// StaticDeltaStatusUploading represents the delta is being uploaded to repo storage
	StaticDeltaStatusUploading = "UPLOADING"
)

values for the StaticDeltaState Status field

View Source
const (
	// RepoNameCantBeInvalidMessage is the error message when the name is invalid
	RepoNameCantBeInvalidMessage = "name must start with alphanumeric characters and can contain underscore and hyphen characters"
	// RepoURLCantBeNilMessage is the error message when Repository url is nil
	RepoURLCantBeNilMessage = "repository URL can't be empty"
	// RepoNameCantBeNilMessage is the error when Repository name is nil
	RepoNameCantBeNilMessage = "repository name can't be empty"
	// InvalidURL is the error when type invalid URL
	InvalidURL = "invalid URL"
)
View Source
const (
	// DevicesCantBeEmptyMessage is the error message when the hosts are empty
	DevicesCantBeEmptyMessage = "devices can not be empty"
	// UpdateStatusCreated is for when a update is created
	UpdateStatusCreated = "CREATED"
	// UpdateStatusBuilding is for when a update is building
	UpdateStatusBuilding = "BUILDING"
	// UpdateStatusError is for when a update is on a error state
	UpdateStatusError = "ERROR"
	// UpdateStatusSuccess is for when a update is available to the user
	UpdateStatusSuccess = "SUCCESS"
	// UpdateStatusDeviceDisconnected is for when a update is UpdateStatusDeviceDisconnected
	UpdateStatusDeviceDisconnected = "DISCONNECTED"
	// UpdateStatusDeviceUnresponsive is for when an update is UpdateStatusDeviceUnresponsive
	UpdateStatusDeviceUnresponsive = "UNRESPONSIVE"
	// UpdateStatusStorageCleaned is for when an update-transaction repo content has storage cleaned
	// this happen when an update-transaction is going to be deleted forever
	UpdateStatusStorageCleaned = "STORAGE_CLEANED"
)
View Source
const (
	// DispatchRecordStatusCreated is for when a the DispatchRecord is created
	DispatchRecordStatusCreated = "CREATED"
	// DispatchRecordStatusPending is for when a UpdateTransaction has started
	//		scheduling PlaybookDispatcher jobs but this one hasn't started yet
	DispatchRecordStatusPending = "PENDING"
	// DispatchRecordStatusRunning is for when a the DispatchRecord is running
	DispatchRecordStatusRunning = "RUNNING"
	// DispatchRecordStatusError is for when a playbook dispatcher job is in a error state
	DispatchRecordStatusError = "ERROR"
	// DispatchRecordStatusComplete is for when a playbook dispatcher job is complete
	DispatchRecordStatusComplete = "COMPLETE"
)
View Source
const (
	// UpdateReasonFailure is for when the update failed
	UpdateReasonFailure = "The playbook failed to run."
	// UpdateReasonTimeout is for when the device took more time than expected to update
	UpdateReasonTimeout = "The service timed out during the last update."
)

Variables

View Source
var (
	// ErrOrgIDIsMandatory is for when orgID is not set
	ErrOrgIDIsMandatory = errors.New("org_id is mandatory")
	// ErrDeviceExists is for UUID already registered on our DB
	ErrDeviceExists = errors.New("This UUID already exists")
)
View Source
var RepoURLCleanUp = AddSlashToURL

RepoURLCleanUp define the cleanup function, by default equal to AddSlashToURL, now it's used only to allow unit-testing of the migration preparation scripts

Functions

func AddSlashToURL

func AddSlashToURL(url string) string

AddSlashToURL cleanup url from leading and trailing white spaces and add slash "/" at the end if missing e.g. transform " http://repo.url.com/repo " to "http://repo.url.com/repo/"

func GetStaticDeltaName

func GetStaticDeltaName(fromCommitHash string, toCommitHash string) string

func ValidateRepoURL

func ValidateRepoURL(url string) bool

ValidateRepoURL validates the repo URL Request

Types

type CRCCloudEvent

type CRCCloudEvent struct {

	// the data (or body) unique to the specific event
	Data interface{} `json:"data,omitempty"`

	// Identifies the schema that data adheres to.
	DataSchema string `json:"data_schema"`

	// Identifies the event with a unique ID
	//     id := uuid.New()
	ID string `json:"id"`

	// Red Hat Organization ID
	RedHatOrgID string `json:"redhat_orgid"`

	// Describes the console.redhat.com app that generated the event.
	// e.g., "urn:redhat:source:edgemanagement:api"
	Source string `json:"source"`

	// Specifies the version of the CloudEvents spec targeted.
	// e.g., "v1"
	SpecVersion string `json:"spec_version"`

	// Describes the subject of the event. URN in format urn:redhat:console:$instance_type:$id. The urn may be longer to accommodate hierarchies
	Subject string `json:"subject"`

	// Timestamp of when the occurrence happened. Must adhere to RFC 3339.
	Time string `json:"time"`

	// The type of the event.
	// e.g., "com.redhat.console.edge.api.image.requested"
	//		"com.redhat.console.edge.api.image.update.requested"
	Type string `json:"type"`
}

CRCCloudEvent is a standard event schema that wraps the Edge-specific "Data" payload

type CheckGroupNameParamAPI

type CheckGroupNameParamAPI struct {
	Name string `json:"Name" example:"my-device-group"` // device group name
}

CheckGroupNameParamAPI is the /checkName parameter to check uniqueness

type CheckThirdPartyRepoNameAPI

type CheckThirdPartyRepoNameAPI struct {
	Data CheckThirdPartyRepoNameDataAPI `json:"data"` // The data of third party repository check name result

} // @name CheckThirdPartyRepoName

CheckThirdPartyRepoNameAPI is the third party repository check name result data

type CheckThirdPartyRepoNameDataAPI

type CheckThirdPartyRepoNameDataAPI struct {
	IsValid bool `json:"isValid" example:"false"` // The indicator of third party repository name validity

} // @name CheckThirdPartyRepoNameData

CheckThirdPartyRepoNameDataAPI is the third party repository check name data

type Commit

type Commit struct {
	Model
	Name                 string
	Account              string             `json:"Account"`
	OrgID                string             `json:"org_id" gorm:"index;<-:create"`
	ImageBuildHash       string             `json:"ImageBuildHash"`
	ImageBuildParentHash string             `json:"ImageBuildParentHash"`
	ImageBuildTarURL     string             `json:"ImageBuildTarURL"`
	OSTreeCommit         string             `json:"OSTreeCommit"`
	OSTreeParentCommit   string             `json:"OSTreeParentCommit"`
	OSTreeRef            string             `json:"OSTreeRef"`
	OSTreeParentRef      string             `json:"OSTreeParentRef"`
	BuildDate            string             `json:"BuildDate"`
	BuildNumber          uint               `json:"BuildNumber"`
	BlueprintToml        string             `json:"BlueprintToml"`
	Arch                 string             `json:"Arch"`
	InstalledPackages    []InstalledPackage `json:"InstalledPackages,omitempty" gorm:"constraint:OnDelete:CASCADE;many2many:commit_installed_packages;"`
	ComposeJobID         string             `json:"ComposeJobID"`
	Status               string             `json:"Status"`
	RepoID               *uint              `json:"RepoID"`
	Repo                 *Repo              `json:"Repo"`
	ChangesRefs          bool               `gorm:"default:false" json:"ChangesRefs"`
	ExternalURL          bool               `json:"external"`
}

Commit represents an OSTree commit from image builder

func (*Commit) BeforeCreate

func (c *Commit) BeforeCreate(tx *gorm.DB) error

BeforeCreate method is called before creating Commits, it make sure org_id is not empty

type CommitAPI

type CommitAPI struct {
	Arch string `json:"arch" example:"x86_64"` // The commit architecture

} // @name Commit

CommitAPI is a struct ...

type CommitInstalledPackages

type CommitInstalledPackages struct {
	InstalledPackageId uint
	CommitId           uint
}

type CreateDeviceGroupAPI

type CreateDeviceGroupAPI struct {
	Name    string                    `json:"name" example:"my-device-group"` // the device group name
	Type    string                    `json:"type" example:"static"`          // the device group type
	Devices []DeviceForDeviceGroupAPI `json:"DevicesAPI,omitempty"`           // Devices of group


} // CreateDeviceGroup

CreateDeviceGroupAPI is the /device-group POST endpoint struct for openapi.json auto-gen

type CreateImageAPI

type CreateImageAPI struct {
	Commit         CommitAPI           `json:"commit"`                                           // commit of image
	CustomPackages []CustomPackagesAPI `json:"customPackages" example:"[Name:'customPackage1']"` // An optional list of custom packages
	Description    string              `json:"description" example:"This is an example image"`   // A short description of the image
	Distribution   string              `json:"distribution" example:"rhel-92"`                   // The RHEL for Edge OS version
	// Available image types:
	// * rhel-edge-installer - Installer ISO
	// * rhel-edge-commit - Commit only
	ImageType              string               `json:"imageType" example:"rhel-edge-installer"` // The image builder assigned image type
	Installer              InstallerAPI         `json:"installer"`
	Name                   string               `json:"name"  example:"my-edge-image"`                                // Name of created image
	Packages               []PackagesAPI        `json:"packages"`                                                     // Packages list
	OutputTypes            []string             `json:"outputTypes" example:"[rhel-edge-installer,rhel-edge-commit]"` // Output type of image
	ThirdPartyRepositories []ThirdPartyReposAPI `json:"thirdPartyRepositories"`
	Version                int                  `json:"version" example:"0"` // Version of image

} // @name CreateImage

CreateImageAPI is the /images POST endpoint struct for openapi.json auto-gen

type CustomPackagesAPI

type CustomPackagesAPI struct {
	Name string `json:"name" example:"cat"` // Name of custom packages

} // @name CustomPackages

CustomPackagesAPI is a struct for auto-generation of openapi.json

type Device

type Device struct {
	Model
	UUID              string               `gorm:"index" json:"UUID"`
	AvailableHash     string               `json:"AvailableHash,omitempty"`
	RHCClientID       string               `json:"RHCClientID"`
	Connected         bool                 `gorm:"default:true" json:"Connected"`
	Name              string               `json:"Name"`
	LastSeen          EdgeAPITime          `json:"LastSeen"`
	CurrentHash       string               `json:"CurrentHash,omitempty"`
	Account           string               `gorm:"index" json:"Account"`
	OrgID             string               `json:"org_id" gorm:"index;<-:create"`
	ImageID           uint                 `json:"ImageID" gorm:"index"`
	UpdateAvailable   bool                 `json:"UpdateAvailable"`
	DevicesGroups     []DeviceGroup        `faker:"-" gorm:"many2many:device_groups_devices;save_association:false" json:"DevicesGroups"`
	UpdateTransaction *[]UpdateTransaction `faker:"-" gorm:"many2many:updatetransaction_devices;" json:"UpdateTransaction"`
	GroupName         string               `json:"group_name"` // the inventory group name
	GroupUUID         string               `json:"group_uuid"` // the inventory group id
}

Device is a record of Edge Devices referenced by their UUID as per the cloud.redhat.com Inventory.

Connected refers to the devices Cloud Connector state, 0 is unavailable
and 1 is reachable.

THEEDGE-1921 created 2 temporary indexes to address production issue

func (*Device) BeforeCreate

func (d *Device) BeforeCreate(tx *gorm.DB) error

BeforeCreate method is called before creating devices, it make sure org_id is not empty

type DeviceAPI

type DeviceAPI struct {
	UUID              string               `json:"UUID"                     example:"ba-93ba-49a3-b4ae-a6c8acdc4736"` // UUID of edge device
	AvailableHash     string               `json:"AvailableHash,omitempty"  example:"true"`                           // Hash that available
	RHCClientID       string               `json:"RHCClientID"`                                                       // RHC Client ID
	Connected         bool                 `json:"Connected"                example:"true"`                           // If Device connect of not
	Name              string               `json:"Name"                     example:"device_name"`                    // Name of device
	LastSeen          string               // Last datetime that device updated
	CurrentHash       string               `json:"CurrentHash,omitempty"`
	ImageID           uint                 `json:"ImageID"                  example:"12834"` // image id of device`
	UpdateAvailable   bool                 `json:"UpdateAvailable"          example:"true"`  // If there is Update available
	DevicesGroups     []DeviceGroupAPI     // device groups
	UpdateTransaction *[]UpdateTransaction `json:"UpdateTransaction"`
	DeviceName        string
	Booted            bool `example:"true"` // Booted status is referring to the LastDeployment of this device
}

DeviceAPI is entity for device

type DeviceDetails

type DeviceDetails struct {
	Device             EdgeDevice           `json:"Device,omitempty"`
	Image              *ImageInfo           `json:"ImageInfo"`
	UpdateTransactions *[]UpdateTransaction `json:"UpdateTransactions,omitempty"`
	DevicesGroups      *[]DeviceGroup       `json:"DevicesGroups,omitempty"`
	Updating           *bool                `json:"DeviceUpdating,omitempty"`
}

DeviceDetails is a Device with Image and Update transactions It contains data from multiple tables on the database

type DeviceDetailsAPI

type DeviceDetailsAPI struct {
	Device             EdgeDeviceAPI           `json:"Device,omitempty"` // Details of device like name, LastSeen and more
	Image              *ImageInfo              `json:"ImageInfo"`        // Information of device's image
	UpdateTransactions *[]UpdateTransactionAPI `json:"UpdateTransactions,omitempty"`
	DevicesGroups      *[]DeviceGroupAPI       `json:"DevicesGroups,omitempty"`                 // Device's groups
	Updating           *bool                   `json:"DeviceUpdating,omitempty" example:"true"` // If there is update to device
}

DeviceDetailsAPI is a Device with Image and Update transactions It contains data from multiple tables on the database

type DeviceDetailsList

type DeviceDetailsList struct {
	Total   int             `json:"total"`
	Count   int             `json:"count"`
	Devices []DeviceDetails `json:"data"`
}

DeviceDetailsList is the list of devices with details from Inventory and Edge API

type DeviceDetailsListAPI

type DeviceDetailsListAPI struct {
	Total   int                `json:"total"  example:"40"` // total number of device
	Count   int                `json:"count"  example:"40"` // total number of device
	Devices []DeviceDetailsAPI `json:"data"`                // List of Devices
}

DeviceDetailsListAPI is the list of devices with details from Inventory and Edge API

type DeviceDeviceGroup

type DeviceDeviceGroup struct {
	ID   uint
	Name string
}

DeviceDeviceGroup is a struct of device group name and id needed for DeviceView

type DeviceForDeviceGroupAPI

type DeviceForDeviceGroupAPI struct {
	UUID string `json:"UUID" example:"68485bb8-6427-40ad-8711-93b6a5b4deac"` // device uuid

} // Device

DeviceForDeviceGroupAPI is a device array expected to create groups with devices

type DeviceGroup

type DeviceGroup struct {
	Model
	Account     string   `json:"Account" gorm:"index"`
	OrgID       string   `json:"org_id" gorm:"index;<-:create"`
	Name        string   `json:"Name"`
	Type        string   `json:"Type" gorm:"default:static;<-:create"`
	Devices     []Device `faker:"-" json:"Devices" gorm:"many2many:device_groups_devices;"`
	ValidUpdate bool     `json:"ValidUpdate" gorm:"-:all"`
	UUID        string   `json:"uuid,omitempty" gorm:"index"`
}

DeviceGroup is a record of Edge Devices Groups Account is the account associated with the device group Type is the device group type and must be "static" or "dynamic"

func (*DeviceGroup) BeforeCreate

func (group *DeviceGroup) BeforeCreate(tx *gorm.DB) error

BeforeCreate method is called before creating device group, it make sure org_id is not empty

func (*DeviceGroup) BeforeDelete

func (group *DeviceGroup) BeforeDelete(tx *gorm.DB) error

BeforeDelete is called before deleting a device group, delete the device group devices first

func (*DeviceGroup) ValidateRequest

func (group *DeviceGroup) ValidateRequest() error

ValidateRequest validates the DeviceGroup request

type DeviceGroupAPI

type DeviceGroupAPI struct {
	Name        string      `json:"Name"        example:"device_group name"` // The device group name`
	Type        string      `json:"Type"        example:"static"`            // The device group type“
	Devices     []DeviceAPI `json:"Devices"`                                 // Devices that belong to the group
	ValidUpdate bool        `json:"ValidUpdate" example:"true"`              // indicate if the update is valid
}

DeviceGroupAPI is a record of Edge Devices Groups Account is the account associated with the device group Type is the device group type and must be "static" or "dynamic"

type DeviceGroupDetails

type DeviceGroupDetails struct {
	DeviceGroup   *DeviceGroup       `json:"DeviceGroup"`
	DeviceDetails *DeviceDetailsList `json:"Devices"`
}

DeviceGroupDetails is a record of Device Groups and DeviceDetails

type DeviceGroupDetailsView

type DeviceGroupDetailsView struct {
	DeviceGroup   *DeviceGroup   `json:"DeviceGroup"`
	DeviceDetails DeviceViewList `json:"DevicesView"`
}

DeviceGroupDetailsView is a record of Device Groups and DeviceView

type DeviceGroupDevicesAPI

type DeviceGroupDevicesAPI struct {
	Account     string `json:"Account" example:"1000"`         // account that the device group belongs to
	OrgID       string `json:"org_id" example:"2000"`          // orgId that the device group belongs to
	Name        string `json:"Name" example:"my-device-group"` // device group name
	Type        string `json:"Type" example:"static"`          // device group type
	ValidUpdate bool   `json:"ValidUpdate" example:"false"`    // device group validation to update devices

} // DeviceGroup

DeviceGroupDevicesAPI is the /device-group return endpoint struct for openapi.json auto-gen

type DeviceGroupListDetail

type DeviceGroupListDetail struct {
	DeviceGroup     DeviceGroup        `json:"DeviceGroup"`
	DeviceImageInfo *[]DeviceImageInfo `json:"DevicesImageInfo"`
}

DeviceGroupListDetail is a record of Edge Devices Groups with images and status information

type DeviceGroupViewAPI

type DeviceGroupViewAPI struct {
	DeviceGroup DeviceGroup                `json:"DeviceGroup"` // device group data
	DevicesView DeviceGroupViewResponseAPI `json:"DevicesView"` // device group detail
}

DeviceGroupViewAPI is the return of /view endpoint

type DeviceGroupViewResponseAPI

type DeviceGroupViewResponseAPI struct {
	Total   int                      `json:"Total" example:"10"` // count of devices
	Devices ImageSetImagePackagesAPI `json:"Devices"`            // all devices in a group
}

DeviceGroupViewResponseAPI is the detail return of /view endpoint

type DeviceImageInfo

type DeviceImageInfo struct {
	Name            string
	Version         int
	Distribution    string
	CreatedAt       EdgeAPITime
	UpdateAvailable bool
	CommitID        uint
}

DeviceImageInfo is a record of group with the current images running on the device

type DeviceImageInfoAPI

type DeviceImageInfoAPI struct {
	Name            string `json:"name" example:"my-image-name"`    // image name
	Version         int    `json:"version" example:"1"`             // image version
	Distribution    string `json:"distribution" example:"RHEL-92"`  // image distribution
	UpdateAvailable bool   `json:"update Available" example:"true"` // image update availability
	CommitID        uint   `json:"commitID" example:"2"`            // image commit id

} // DeviceImage

DeviceImageInfoAPI is a record of group with the current images running on the device

type DeviceNotificationAPI

type DeviceNotificationAPI struct {
	Version     string                     `json:"version" example:"v1.1.0"`                                          // notification version
	Bundle      string                     `json:"bundle" example:"rhel"`                                             // bundle name
	Application string                     `json:"application" example:"edge-management"`                             // application name
	EventType   string                     `json:"event_type" example:"update-devices"`                               // event type
	Timestamp   string                     `json:"timestamp" example:"2023-07-06T11:15:04Z"`                          // notification timestamp
	OrgID       string                     `json:"org_id" example:"11111111"`                                         // notification organization id
	Context     string                     `json:"context" example:"{\"CommitID\":\"31581\",\"UpdateID\":\"34916\"}"` // notification context payload data
	Events      []EventNotificationAPI     `json:"events"`                                                            // notification events
	Recipients  []RecipientNotificationAPI `json:"recipients"`                                                        // notification recipients

} // @name DeviceNotification

DeviceNotificationAPI is the implementation of expected notification payload

type DeviceUpdateImagesFilters

type DeviceUpdateImagesFilters struct {
	Limit              int
	Offset             int
	Version            int
	Release            string
	Created            string
	AdditionalPackages *int
	AllPackages        *int
	SystemsRunning     *int
}

DeviceUpdateImagesFilters is the device image

type DeviceView

type DeviceView struct {
	DeviceID         uint                `json:"DeviceID"`
	DeviceName       string              `json:"DeviceName"`
	DeviceUUID       string              `json:"DeviceUUID"`
	ImageID          uint                `json:"ImageID"`
	ImageName        string              `json:"ImageName"`
	LastSeen         EdgeAPITime         `json:"LastSeen"`
	UpdateAvailable  bool                `json:"UpdateAvailable"`
	Status           string              `json:"Status"`
	ImageSetID       uint                `json:"ImageSetID"`
	DeviceGroups     []DeviceDeviceGroup `json:"DeviceGroups"`
	DispatcherStatus string              `json:"DispatcherStatus"`
	DispatcherReason string              `json:"DispatcherReason"`
	GroupName        string              `json:"GroupName"` // the inventory group name
	GroupUUID        string              `json:"GroupUUID"` // the inventory group id
}

DeviceView is the device information needed for the UI

type DeviceViewAPI

type DeviceViewAPI struct {
	DeviceID         uint             `json:"DeviceID"        example:"1913277"`             // ID of device
	DeviceName       string           `json:"DeviceName"      example:"device_name"`         // Name of device
	DeviceUUID       string           `json:"DeviceUUID"      example:"a-8bdf-a21accb24925"` // UUID of Device
	ImageID          uint             `json:"ImageID"         example:"323241"`              // ID of image
	ImageName        string           `json:"ImageName"       example:"image_name"`          // Name of image
	LastSeen         EdgeAPITime      `json:"LastSeen"`                                      // Last datetime that device updated
	UpdateAvailable  bool             `json:"UpdateAvailable" example:"true"`                // indicate if there is update to device
	Status           string           `json:"Status"          example:"SUCCESS"`             // Status of device
	ImageSetID       uint             `json:"ImageSetID"      example:"33341"`               // ID of image set
	DeviceGroups     []DeviceGroupAPI `json:"DeviceGroups"`                                  // Device's groups
	DispatcherStatus string           `json:"DispatcherStatus"`                              // Status of Dispatch
	DispatcherReason string           `json:"DispatcherReason"`                              // Reason of Dispatch
	GroupName        string           `json:"GroupName"`                                     // the inventory group name
	GroupUUID        string           `json:"GroupUUID"`                                     // the inventory group id
}

DeviceViewAPI is the device information needed for the UI

type DeviceViewList

type DeviceViewList struct {
	Total             int64        `json:"total"`
	Devices           []DeviceView `json:"devices"`
	EnforceEdgeGroups bool         `json:"enforce_edge_groups"` // Whether to enforce the edge groups usage
}

DeviceViewList is the list of devices for a given account, formatted for the UI

type DeviceViewListAPI

type DeviceViewListAPI struct {
	Total             int64           `json:"total" example:"40"`  // Total number of device
	Devices           []DeviceViewAPI `json:"devices"`             // List of Devices
	EnforceEdgeGroups bool            `json:"enforce_edge_groups"` // Whether to enforce the edge groups usage
}

DeviceViewListAPI is the list of devices for a given account, formatted for the UI

type DeviceViewListResponseAPI

type DeviceViewListResponseAPI struct {
	Data  DeviceViewListAPI `json:"data"`               // The devices view data
	Count int64             `json:"count" example:"40"` // The overall number of devices
}

DeviceViewListResponseAPI is the struct returned by the devices view endpoint

type DevicesUpdate

type DevicesUpdate struct {
	CommitID    uint     `json:"CommitID,omitempty"`
	DevicesUUID []string `json:"DevicesUUID"`
}

DevicesUpdate contains the update structure for the device

type DevicesUpdateAPI

type DevicesUpdateAPI struct {
	CommitID    uint     `json:"CommitID,omitempty" example:"1026"`                                                               // Optional: The unique ID of the target commit
	DevicesUUID []string `json:"DevicesUUID" example:"b579a578-1a6f-48d5-8a45-21f2a656a5d4,1abb288d-6d88-4e2d-bdeb-fcc536be58ec"` // List of devices uuids to update

} // @name DevicesUpdate

DevicesUpdateAPI the structure for creating device updates

type DispatchRecord

type DispatchRecord struct {
	Model
	PlaybookURL          string  `json:"PlaybookURL"`
	DeviceID             uint    `json:"DeviceID"`
	Device               *Device `json:"Device"`
	Status               string  `json:"Status"`
	Reason               string  `json:"Reason"`
	PlaybookDispatcherID string  `json:"PlaybookDispatcherID"`
}

DispatchRecord represents the combination of a Playbook Dispatcher (https://github.com/RedHatInsights/playbook-dispatcher), of a PlaybookURL, a pointer to a Device, and the status. This is used within UpdateTransaction for accounting purposes.

type DispatchRecordAPI

type DispatchRecordAPI struct {
	PlaybookURL          string     `json:"PlaybookURL"`
	DeviceID             uint       `json:"DeviceID"        example:"1913277"` // ID of device
	Device               *DeviceAPI `json:"Device"`
	Status               string     `json:"Status"          example:"SUCCESS"` // Status of device
	Reason               string     `json:"Reason"`
	PlaybookDispatcherID string     `json:"PlaybookDispatcherID"`
}

DispatchRecordAPI represents the combination of a Playbook Dispatcher (https://github.com/RedHatInsights/playbook-dispatcher), of a PlaybookURL, a pointer to a Device, and the status. This is used within UpdateTransaction for accounting purposes.

type EdgeAPITime

type EdgeAPITime sql.NullTime

EdgeAPITime is a time.Time with a valid flag.

func (EdgeAPITime) MarshalJSON

func (t EdgeAPITime) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for EdgeAPITime.

func (*EdgeAPITime) Scan

func (t *EdgeAPITime) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*EdgeAPITime) UnmarshalJSON

func (t *EdgeAPITime) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for EdgeAPITime.

func (EdgeAPITime) Value

func (t EdgeAPITime) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type EdgeBasePayload

type EdgeBasePayload struct {
	// The users identity
	Identity identity.XRHID `json:"identity"`

	// Timestamp of when a service interacted with this event. Must adhere to RFC 3339.
	LastHandleTime string `json:"last_handle_time"`

	// Request ID from REST API
	RequestID string `json:"requestid"`
}

EdgeBasePayload describes the edge standard fields for payloads

func (EdgeBasePayload) GetIdentity

func (epl EdgeBasePayload) GetIdentity() identity.XRHID

GetIdentity returns the identity from an Edge event

func (EdgeBasePayload) GetRequestID

func (epl EdgeBasePayload) GetRequestID() string

GetRequestID returns the ID of the original REST API request

type EdgeCommitCompletedEventPayload

type EdgeCommitCompletedEventPayload struct {
	EdgeBasePayload
	NewImage Image `json:"new_image"`
}

EdgeCommitCompletedEventPayload provides image data when a commit is complete

type EdgeDevice

type EdgeDevice struct {
	*Device
	DeviceName string // TODO: Can be deleted when we start saving the name field on the Device object
	LastSeen   string // TODO: Can be deleted when we start saving lastseen field on the Device object
	// Booted status is referring to the LastDeployment of this device
	// TODO: Needs to be rethinked when we get to the greenbot epic
	Booted  bool
	Account string
	OrgID   string
}

EdgeDevice is the entity that represents and Edge Device It is a combination of the data of a Device owned by Inventory API and the Device data saved on Edge API

type EdgeDeviceAPI

type EdgeDeviceAPI struct {
	UUID              string               `json:"UUID"                     example:"ba-93ba-49a3-b4ae-a6c8acdc4736"` // UUID of edge device
	AvailableHash     string               `json:"AvailableHash,omitempty"  example:"true"`                           // Hash that available
	RHCClientID       string               `json:"RHCClientID"`                                                       // RHC Client ID
	Connected         bool                 `json:"Connected"                example:"true"`                           // If Device connect of not
	Name              string               `json:"Name"`                                                              // Name of Edge Device
	LastSeen          EdgeAPITime          `json:"LastSeen"`                                                          // Last datetime that device updated
	CurrentHash       string               `json:"CurrentHash,omitempty"`
	ImageID           uint                 `json:"ImageID"                  example:"12834"` // image id of device
	UpdateAvailable   bool                 `json:"UpdateAvailable"          example:"true"`  // If there is update available
	DevicesGroups     []DeviceGroupAPI     `json:"DevicesGroups"`                            // device groups
	UpdateTransaction *[]UpdateTransaction `json:"UpdateTransaction"`
	DeviceName        string               `example:"test_device_api_static"` // The device name
	Booted            bool                 `example:"true"`                   // Booted status is referring to the LastDeployment of this device
}

EdgeDeviceAPI is the entity that represents and Edge Device It is a combination of the data of a Device owned by Inventory API and the Device data saved on Edge API

type EdgeImageISORequestedEventPayload

type EdgeImageISORequestedEventPayload struct {
	EdgeBasePayload
	NewImage Image `json:"new_image"`
}

EdgeImageISORequestedEventPayload provides edge-specific data when an image iso is requested

type EdgeImageRequestedEventPayload

type EdgeImageRequestedEventPayload struct {
	EdgeBasePayload
	NewImage Image `json:"new_image"`
}

EdgeImageRequestedEventPayload provides edge-specific data when an image is requested

type EdgeImageUpdateRequestedEventPayload

type EdgeImageUpdateRequestedEventPayload struct {
	EdgeBasePayload
	NewImage Image `json:"new_image"`
}

EdgeImageUpdateRequestedEventPayload provides edge-specific data when an image update is requested

type EdgeInstallerCompletedEventPayload

type EdgeInstallerCompletedEventPayload struct {
	EdgeBasePayload
	NewImage Image `json:"new_image"`
}

EdgeInstallerCompletedEventPayload provides image data when an installer is complete

type EdgeOstreeRepoCompletedEventPayload

type EdgeOstreeRepoCompletedEventPayload struct {
	EdgeBasePayload
	NewImage Image `json:"new_image"`
}

EdgeOstreeRepoCompletedEventPayload provides image data when an ostree repo is complete

type EdgeUpdateRepoRequestedEventPayload

type EdgeUpdateRepoRequestedEventPayload struct {
	EdgeBasePayload
	Update UpdateTransaction `json:"update"`
}

EdgeUpdateRepoRequestedEventPayload provides update transaction data when requested to build a repository installer for devices update

type EnforceEdgeGroupsAPI

type EnforceEdgeGroupsAPI struct {
	EnforceEdgeGroups bool `json:"enforce_edge_groups" example:"false"` // whether to enforce edge groups usage
}

EnforceEdgeGroupsAPI is the result of /device-groups/enforce-edge-groups end point

type Error

type Error struct {

	// Machine-readable error code that identifies the error.
	Code string `json:"code"`

	// Human readable description of the error.
	Message string `json:"message"`

	// The severity of the error.
	Severity string `json:"severity"`

	// The stack trace/traceback (optional)
	StackTrace string `json:"stack_trace,omitempty"`
}

Error An error reported by an application.

type EventNotificationAPI

type EventNotificationAPI struct {
	Payload string `json:"payload" example:"{\"ID\":\"\"}"` // notification event payload

} // @name EventNotification

EventNotificationAPI is used to track events to notification

type FilterByDevicesAPI

type FilterByDevicesAPI struct {
	DevicesUUID []string `json:"devices_uuid"` // Devices UUID
}

FilterByDevicesAPI is the deviceUUID list

type Image

type Image struct {
	Model
	Name                   string           `json:"Name"`
	Account                string           `json:"Account"`
	OrgID                  string           `json:"org_id" gorm:"index;<-:create"`
	Distribution           string           `json:"Distribution"`
	Description            string           `json:"Description"`
	Status                 string           `json:"Status"`
	Version                int              `json:"Version" gorm:"default:1"`
	ImageType              string           `json:"ImageType"` // TODO: Remove as soon as the frontend stops using
	OutputTypes            pq.StringArray   `gorm:"type:text[]" json:"OutputTypes"`
	CommitID               uint             `json:"CommitID"`
	Commit                 *Commit          `json:"Commit"`
	InstallerID            *uint            `json:"InstallerID"`
	Installer              *Installer       `json:"Installer"`
	ImageSetID             *uint            `json:"ImageSetID" gorm:"index"` // TODO: Wipe staging database and set to not nullable
	Packages               []Package        `json:"Packages,omitempty" gorm:"many2many:images_packages;"`
	ThirdPartyRepositories []ThirdPartyRepo `json:"ThirdPartyRepositories,omitempty" gorm:"many2many:images_repos;"`
	CustomPackages         []Package        `json:"CustomPackages,omitempty" gorm:"many2many:images_custom_packages"`
	RequestID              string           `json:"request_id"` // storing for logging reference on resume
	ActivationKey          string           `json:"activationKey,omitempty"`

	TotalDevicesWithImage int64 `json:"SystemsRunning" gorm:"-"` // only for forms
	TotalPackages         int   `json:"TotalPackages" gorm:"-"`  // only for forms
}

Image is what generates a OSTree Commit.

func (*Image) BeforeCreate

func (i *Image) BeforeCreate(tx *gorm.DB) error

BeforeCreate method is called before creating Images, it make sure org_id is not empty

func (*Image) GetALLPackagesList

func (i *Image) GetALLPackagesList() *[]string

GetALLPackagesList returns all the packages including custom packages containing their names

func (*Image) GetPackagesList

func (i *Image) GetPackagesList() *[]string

GetPackagesList returns the packages in a user-friendly list containing their names

func (*Image) HasOutputType

func (i *Image) HasOutputType(imageType string) bool

HasOutputType checks if an image has an specific output type

func (*Image) ValidateRequest

func (i *Image) ValidateRequest() error

ValidateRequest validates an Image Request

type ImageDetailAPI

type ImageDetailAPI struct {
	Image              *Image `json:"image"`
	AdditionalPackages int    `json:"additional_packages" example:"3"` // Number of additional packages
	Packages           int    `json:"packages" example:"3"`            // Number of packages
	UpdateAdded        int    `json:"update_added" example:"3"`        // Number of added update
	UpdateRemoved      int    `json:"update_removed" example:"2"`      // Number of removed update
	UpdateUpdated      int    `json:"update_updated" example:"3"`      // Number of updated update
}

ImageDetailAPI return the structure to inform package info to images

type ImageInfo

type ImageInfo struct {
	Image            Image                   `json:"Image"`
	UpdatesAvailable *[]ImageUpdateAvailable `json:"UpdatesAvailable,omitempty"`
	Count            int64                   `json:"Count"`
	Rollback         *Image                  `json:"RollbackImage,omitempty"`
}

ImageInfo contains Image with updates available and rollback image

type ImageResponseAPI

type ImageResponseAPI struct {
	// Currently returns all of the available image data
	Image

} // @name ImageResponse

ImageResponseAPI is a struct for auto-generation of openapi.json

type ImageSet

type ImageSet struct {
	Model
	Name    string  `json:"Name"`
	Version int     `json:"Version" gorm:"default:1"`
	Account string  `json:"Account"`
	OrgID   string  `json:"org_id" gorm:"index;<-:create"`
	Images  []Image `json:"Images"`
}

ImageSet represents a collection of images

func (*ImageSet) BeforeCreate

func (imgset *ImageSet) BeforeCreate(tx *gorm.DB) error

BeforeCreate method is called before creating ImageSet, it make sure org_id is not empty

type ImageSetAPI

type ImageSetAPI struct {
	Model
	Name    string  `json:"name" example:"my-edge-image"` // the image set name
	Version int     `json:"version" example:"1"`          // the image set version
	Images  []Image `json:"Images"`                       // images of image set

}

type ImageSetDetailsResponseAPI

type ImageSetDetailsResponseAPI struct {
	Count int                      `json:"Count" example:"10"` // count of image-sets
	Data  ImageSetImagePackagesAPI `json:"Data"`               // all data of image-sets

}

ImageSetDetailsResponseAPI is a struct for auto-generation of openapi.json

type ImageSetDevicesAPI

type ImageSetDevicesAPI struct {
	Count int      `json:"Count" example:"10"` // count of image-set's devices
	Data  []string `json:"Data"`               // Data of image set's devices
}

ImageSetDevicesAPI contains the count and data for a list of Imagesets

type ImageSetIDViewAPI

type ImageSetIDViewAPI struct {
	ImageBuildIsoURL string         `json:"ImageBuildIsoURL" example:"/api/edge/v1/storage/isos/432"` // The image-set latest available image ISO
	ImageSet         ImageSetAPI    `json:"ImageSet"`                                                 // image set data
	LastImageDetails ImageDetailAPI `json:"LastImageDetails"`                                         // The image-set latest image details
}

ImageSetIDViewAPI is the image set details view returned for ui image-set display

type ImageSetImageIDViewAPI

type ImageSetImageIDViewAPI struct {
	ImageBuildIsoURL string         `json:"ImageBuildIsoURL" example:"/api/edge/v1/storage/isos/432"` // The image-set latest available image ISO
	ImageSet         ImageSetAPI    `json:"ImageSet"`                                                 // image set data
	ImageDetails     ImageDetailAPI `json:"ImageDetails"`                                             // the requested image details
}

ImageSetImageIDViewAPI is the image set image view returned for ui image-set / version display

type ImageSetImagePackagesAPI

type ImageSetImagePackagesAPI struct {
	ImageSetData     ImageSetAPI      `json:"image_set"`                                                   // image set data
	Images           []ImageDetailAPI `json:"images"`                                                      // image detail
	ImageBuildISOURL string           `json:"image_build_iso_url" example:"/api/edge/v1/storage/isos/432"` // The image-set latest available image ISO
}

ImageSetImagePackagesAPI return info related to details on images from imageset

type ImageSetInstallerURLAPI

type ImageSetInstallerURLAPI struct {
	ImageSetData     ImageSetAPI `json:"image_set"`                                                   // image set data
	ImageBuildISOURL *string     `json:"image_build_iso_url" example:"/api/edge/v1/storage/isos/432"` // The image-set latest available image ISO
}

ImageSetInstallerURLAPI returns ImagesetAPI structure with last installer available

type ImageSetView

type ImageSetView struct {
	ID               uint        `json:"ID"`
	Name             string      `json:"Name"`
	Version          int         `json:"Version"`
	UpdatedAt        EdgeAPITime `json:"UpdatedAt"`
	Distribution     string      `json:"Distribution"`
	OutputTypes      []string    `json:"OutputTypes"`
	Status           string      `json:"Status"`
	ImageBuildIsoURL string      `json:"ImageBuildIsoURL"`
	ImageID          uint        `json:"ImageID"`
}

ImageSetView is the image-set row returned for ui image-sets display

type ImageSetsResponseAPI

type ImageSetsResponseAPI struct {
	Count int                       `json:"Count" example:"10"` // count of image-sets
	Data  []ImageSetInstallerURLAPI `json:"Data"`               // all data of image-sets
}

ImageSetsResponseAPI is a struct for auto-generation of openapi.json

type ImageSetsViewResponseAPI

type ImageSetsViewResponseAPI struct {
	Count int            `json:"count" example:"10"` // count of image-sets
	Data  []ImageSetView `json:"data"`               // data of image set view
}

ImageSetsViewResponseAPI is the image-set row returned for ui image-sets display

type ImageUpdateAvailable

type ImageUpdateAvailable struct {
	Image       Image       `json:"Image"`
	CanUpdate   bool        `json:"CanUpdate"`
	PackageDiff PackageDiff `json:"PackageDiff"`
}

ImageUpdateAvailable contains image and differences between current and available commits

type ImageValidationRequestAPI

type ImageValidationRequestAPI struct {
	ID uint `json:"ID" example:"1029"` // the unique ID of the image

} // @name ImageValidationRequest

ImageValidationRequestAPI is the structure for validating images for device updates

type ImageValidationResponseAPI

type ImageValidationResponseAPI struct {
	UpdateValid bool `json:"UpdateValid" example:"true"`

} // @name ImageValidationResponse

ImageValidationResponseAPI is the validation response of images for device updates

type ImageView

type ImageView struct {
	ID               uint        `json:"ID"`
	Name             string      `json:"Name"`
	Version          int         `json:"Version"`
	ImageType        string      `json:"ImageType"`
	CommitCheckSum   string      `json:"CommitCheckSum"`
	OutputTypes      []string    `json:"OutputTypes"`
	CreatedAt        EdgeAPITime `json:"CreatedAt"`
	Status           string      `json:"Status"`
	ImageBuildIsoURL string      `json:"ImageBuildIsoURL"`
}

ImageView is the image row returned for ui images-set display

type ImagesViewDataAPI

type ImagesViewDataAPI struct {
	Count int64       `json:"count" example:"100"` // total number of image view data
	Data  []ImageView `json:"data"`
}

ImagesViewDataAPI is the images view data return for images view with filters , limit, offSet

type InstalledPackage

type InstalledPackage struct {
	ModelWithoutTimestamps
	Name      string   `json:"name"`
	Arch      string   `json:"arch"`
	Release   string   `json:"release"`
	Sigmd5    string   `json:"sigmd5"`
	Signature string   `json:"signature"`
	Type      string   `json:"type"`
	Version   string   `json:"version"`
	Epoch     string   `json:"epoch,omitempty"`
	Commits   []Commit `gorm:"constraint:OnDelete:CASCADE;many2many:commit_installed_packages;save_association:false"`
}

InstalledPackage represents installed packages a image has

type Installer

type Installer struct {
	Model
	Account          string `json:"Account"`
	OrgID            string `json:"org_id" gorm:"index;<-:create"`
	ImageBuildISOURL string `json:"ImageBuildISOURL"`
	ComposeJobID     string `json:"ComposeJobID"`
	Status           string `json:"Status"`
	Username         string `json:"Username"`
	SSHKey           string `json:"SshKey"`
	Checksum         string `json:"Checksum"`
}

Installer defines the model for a ISO installer

func (*Installer) BeforeCreate

func (i *Installer) BeforeCreate(tx *gorm.DB) error

BeforeCreate method is called before create a record on installer, it make sure org_id is not empty

type InstallerAPI

type InstallerAPI struct {
	SSHKey   string `json:"sshkey" example:"ssh-rsa lksjdkjkjsdlkjjds"` // SSH key of installer
	Username string `json:"username" example:"myuser"`                  // Username of administrative user

} // @name Installer

InstallerAPI ...

type InventoryGroupDevicesUpdateInfo

type InventoryGroupDevicesUpdateInfo struct {
	GroupUUID        string          `json:"group_uuid"`
	UpdateValid      bool            `json:"update_valid"`
	ImageSetID       uint            `json:"image_set_id"`
	ImageSetsCount   int             `json:"image_sets_count"`
	DevicesCount     int             `json:"devices_count"`
	DevicesUUIDS     []string        `json:"update_devices_uuids"`
	DevicesImageSets map[string]uint `json:"device_image_set_info"`
}

InventoryGroupDevicesUpdateInfo is the inventory group update info

type InventoryGroupDevicesUpdateInfoResponseAPI

type InventoryGroupDevicesUpdateInfoResponseAPI struct {
	GroupUUID      string   `json:"group_uuid" example:"b579a578-1a6f-48d5-8a45-21f2a656a5d4"`                                                // the inventory group id
	UpdateValid    bool     `json:"update_valid" example:"true"`                                                                              // whether the inventory group devices update is valid
	ImageSetID     uint     `json:"image_set_id" example:"1024" `                                                                             // the image set id common to all inventory group devices
	ImageSetsCount int      `json:"image_sets_count" example:"1"`                                                                             // how much image set ids the inventory group devices belongs to
	DevicesCount   int      `json:"devices_count" example:"25"`                                                                               // the overall count of all devices that belongs to inventory group
	DevicesUUID    []string `json:"update_devices_uuids" example:"b579a578-1a6f-48d5-8a45-21f2a656a5d4,1abb288d-6d88-4e2d-bdeb-fcc536be58ec"` // the list of devices uuids that belongs to inventory group that are available to update
}

InventoryGroupDevicesUpdateInfoResponseAPI is the inventory group update info

type MetaCount

type MetaCount struct {
	Count int `json:"count"`
}

MetaCount contains Count of a SearchPackageResult

type Model

type Model struct {
	ID        uint           `gorm:"primarykey" json:"ID,omitempty"`
	CreatedAt EdgeAPITime    `gorm:"index" json:"CreatedAt,omitempty"`
	UpdatedAt EdgeAPITime    `gorm:"index" json:"UpdatedAt,omitempty"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"DeletedAt,omitempty"`
}

Model is a basic GoLang struct based on gorm.Model with the JSON tags for openapi3gen

type ModelWithoutTimestamps

type ModelWithoutTimestamps struct {
	ID uint `gorm:"primarykey" json:"ID,omitempty"`
}

ModelWithoutTimestamps is a basic GoLang struct based on gorm.Model without timestamps

type Package

type Package struct {
	Model
	Name string `json:"Name"`
}

Package represents the packages a Commit can have

type PackageDiff

type PackageDiff struct {
	Added    []InstalledPackage `json:"Added"`
	Removed  []InstalledPackage `json:"Removed"`
	Upgraded []InstalledPackage `json:"Upgraded"`
}

PackageDiff provides package difference details between current and available commits

type PackagesAPI

type PackagesAPI struct {
	Name string `json:"name" example:"php"` // Name of packages

} // @name Packages

PackagesAPI ...

type PostDeviceForDeviceGroupAPI

type PostDeviceForDeviceGroupAPI struct {
	Name string `json:"Name" example:"localhost"`                            // device name
	UUID string `json:"UUID" example:"68485bb8-6427-40ad-8711-93b6a5b4deac"` // device uuid
}

PostDeviceForDeviceGroupAPI is the expected values to add device to a group

type PutGroupNameParamAPI

type PutGroupNameParamAPI struct {
	Name string `json:"Name" example:"my-device-group"` // device group name
	Type string `json:"Type" example:"static"`          // device group type
}

PutGroupNameParamAPI is the parameter to check update device group

type RecipientNotificationAPI

type RecipientNotificationAPI struct {
	OnlyAdmins            bool     `json:"only_admins" example:"false"`             // notification recipient for only admins
	IgnoreUserPreferences bool     `json:"ignore_user_preferences" example:"false"` // notification recipient to ignore user preferences
	Users                 []string `json:"users" example:"user-id"`                 // notification recipient users

} // @name RecipientNotification

RecipientNotificationAPI is used to track recipients to notification

type Repo

type Repo struct {
	Model
	URL        string `json:"RepoURL"`          // AWS repo URL
	Status     string `json:"RepoStatus"`       // AWS repo upload status
	PulpURL    string `json:"pulp_repo_url"`    // Distribution URL returned from Pulp
	PulpStatus string `json:"pulp_repo_status"` // Status of Pulp repo import
}

Repo is the delivery mechanism of a Commit over HTTP

func (Repo) ContentURL

func (r Repo) ContentURL() string

ContentURL is the URL for internal and Image Builder access to the content in a Pulp repo

func (Repo) DistributionURL

func (r Repo) DistributionURL() string

DistributionURL is the URL for external access to the content in a Pulp repo

type SearchPackage

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

SearchPackage contains Name of package

type SearchPackageResult

type SearchPackageResult struct {
	Meta MetaCount       `json:"meta"`
	Data []SearchPackage `json:"data"`
}

SearchPackageResult contains Meta of a MetaCount

type StaticDelta

type StaticDelta struct {
	FromCommit StaticDeltaCommit
	ImagesetID uint64           `json:"imageset_id"` // the ID of the imageset with commits (versions)
	Name       string           `json:"name"`        // the combined commitfrom-committo static delta name
	State      StaticDeltaState `json:"state"`
	ToCommit   StaticDeltaCommit
	Type       string `json:"type"` // delta is stored with "repo" (default) or in external "file"
}

StaticDelta models the basic data needed to generate a static delta

type StaticDeltaCommit

type StaticDeltaCommit struct {
	Path   string `json:"path"` // the local path for the from commit repo
	Ref    string `json:"ref"`  // the ref for from commit (e.g., x86_64/edge)
	Rev    string `json:"rev"`  // the commit Rev
	TarURL string `json:"tar_url"`
	URL    string `json:"url"`
}

StaticDeltaCommit models a commit specific to generation of static deltas

type StaticDeltaState

type StaticDeltaState struct {
	Model
	Name   string `json:"name" gorm:"index;<-:create"` // the fromcommit-tocommit static delta name
	OrgID  string `json:"org_id"`                      // the owner of the static delta
	Status string `json:"status"`                      // the status of the generation process
	URL    string `json:"url"`                         // url for the repo where the static delta is stored
}

StaticDeltaState models the state of a static delta database record

func (*StaticDeltaState) Delete

func (sds *StaticDeltaState) Delete(edgelog log.FieldLogger) error

Delete removes the static delta state record from the database

func (*StaticDeltaState) Exists

func (sds *StaticDeltaState) Exists(edgelog log.FieldLogger) (bool, error)

Exists returns a comma ok true if the static delta state record exists in the database

func (*StaticDeltaState) IsReady

func (sds *StaticDeltaState) IsReady(edgelog log.FieldLogger) (bool, error)

IsReady returns a comma ok true if the static delta state is set to ready in the database

func (*StaticDeltaState) Query

func (sds *StaticDeltaState) Query(edgelog log.FieldLogger) (*StaticDeltaState, error)

Query retrieves the state of a static delta commit pair from the database

func (*StaticDeltaState) Save

func (sds *StaticDeltaState) Save(edgelog log.FieldLogger) error

Save writes a static delta state to the database

type SuccessPlaceholderResponse

type SuccessPlaceholderResponse struct {
}

SuccessPlaceholderResponse is a placeholder

type ThirdPartyRepo

type ThirdPartyRepo struct {
	Model
	Name                string    `json:"Name" gorm:"index"`
	URL                 string    `json:"URL"`
	Description         string    `json:"Description,omitempty"`
	UUID                string    `json:"uuid,omitempty" gorm:"index"`
	DistributionArch    string    `json:"distribution_arch,omitempty"`
	DistributionVersion *[]string `json:"distribution_version,omitempty" gorm:"-"`
	GpgKey              string    `json:"gpg_key,omitempty"`
	PackageCount        int       `json:"package_count,omitempty"`
	Account             string    `json:"account"`
	OrgID               string    `json:"org_id" gorm:"index;<-:create"`
	Images              []Image   `faker:"-" json:"Images,omitempty" gorm:"many2many:images_repos;"`
}

ThirdPartyRepo is a record of Third Party Repository or we can call it as Custom Repository provided by customers per OrgID.

Here, URL refers to the url of the third party repository, OrgID refers to the OrgID attached to the third party
repository.

func (*ThirdPartyRepo) BeforeCreate

func (t *ThirdPartyRepo) BeforeCreate(tx *gorm.DB) error

BeforeCreate method is called before creating Third Party Repository, it make sure org_id is not empty

func (*ThirdPartyRepo) BeforeUpdate

func (t *ThirdPartyRepo) BeforeUpdate(tx *gorm.DB) error

BeforeUpdate is called before updating third party repository

func (*ThirdPartyRepo) ValidateRequest

func (t *ThirdPartyRepo) ValidateRequest() error

ValidateRequest validates the Repository Request

type ThirdPartyRepoAPI

type ThirdPartyRepoAPI struct {
	ID          uint   `json:"ID,omitempty" example:"1028"`                               // The unique ID of the third party repository
	Name        string `json:"Name" example:"my_custom_repo"`                             // The name of the third party repository
	URL         string `json:"URL" example:"https://public.example.com/my_custom_repo"`   // The URL of the third party repository
	Description string `json:"Description,omitempty" example:"a repo for some utilities"` // The description of the third party repository

} // @name ThirdPartyRepo

ThirdPartyRepoAPI is the third party repository entity main data

type ThirdPartyRepoListAPI

type ThirdPartyRepoListAPI struct {
	Count int                 `json:"count" example:"25"` // The overall count of the stored third party repositories
	Data  []ThirdPartyRepoAPI `json:"data"`               // The data list of the third party repositories

} // @name ThirdPartyRepoList

ThirdPartyRepoListAPI is the third party repositories list result data

type ThirdPartyReposAPI

type ThirdPartyReposAPI struct {
	ID   int    `json:"ID" example:"1234"`                              // The unique ID of the repository
	Name string `json:"Name" example:"my_custom_repo"`                  // The name of the repository
	URL  string `json:"URL" example:"https://example.com/repos/myrepo"` // The base URL of the repository

} // @name ThirdPartyRepos

ThirdPartyReposAPI ...

type UpdateAPI

type UpdateAPI struct {
	ID              uint                      `json:"ID" example:"1026"`           // The unique ID of device update
	Commit          UpdateCommitAPI           `json:"Commit"`                      // The device Update target commit
	OldCommits      []UpdateCommitAPI         `json:"OldCommits"`                  // The device alternate commits from current device commit to target commit
	Devices         []UpdateDeviceAPI         `json:"Devices"`                     // The current devices to update
	Status          string                    `json:"Status" example:"BUILDING"`   // the current devices update status
	Repo            *UpdateRepoAPI            `json:"Repo"`                        // The current repository built from this update
	ChangesRefs     bool                      `json:"ChangesRefs" example:"false"` // Whether this update is changing device ostree ref
	DispatchRecords []UpdateDispatchRecordAPI `json:"DispatchRecords"`             // The current update dispatcher records

} // @name Update

UpdateAPI The structure of a device update

type UpdateCommitAPI

type UpdateCommitAPI struct {
	ID               uint   `json:"ID" example:"1056"`                                                                                          // The unique ID of the commit
	ImageBuildTarURL string `json:"ImageBuildTarURL" example:"https://storage-host.example.com/v2/99999999/tar/59794/tmp/repos/59794/repo.tar"` // The commit tar url
	OSTreeCommit     string `json:"OSTreeCommit" example:"9bd8dfe9856aa5bb1683e85f123bfe7785d45fbdb6f10372ff2c80e703400999"`                    // The ostree commit hash
	OSTreeRef        string `json:"OSTreeRef" example:"rhel/9/x86_64/edge"`                                                                     // The commit ostree ref

} // UpdateCommit

type UpdateDeviceAPI

type UpdateDeviceAPI struct {
	ID              uint   `json:"ID" example:"1096"`                                                                                // The unique ID of the device
	UUID            string `json:"UUID" example:"54880418-b7c2-402e-93e5-287e168de7a6"`                                              // The device inventory uuid
	RHCClientID     string `json:"RHCClientID" example:"5f9ac7d3-2264-4dad-a5a0-39c91c071c8a"`                                       // The device RHC client ID
	Connected       bool   `json:"Connected" example:"true"`                                                                         // Is the device connected
	Name            string `json:"Name" example:"teat-host.example.com"`                                                             // the device inventory name
	CurrentHash     string `json:"CurrentHash,omitempty" example:"0bd8dfe9856aa5bb1683e85f123bfe7785d45fbdb6f10372ff2c80e703400446"` // the current device loaded commit hash
	ImageID         uint   `json:"ImageID" gorm:"index" example:"10778"`                                                             // The current related image ID
	UpdateAvailable bool   `json:"UpdateAvailable" example:"true"`                                                                   // Whether an update is available

} // @name UpdateDevice

type UpdateDispatchRecordAPI

type UpdateDispatchRecordAPI struct {
	ID                   uint   `json:"ID" example:"1089"`                                                                             // The unique ID of the DispatcherRecord
	PlaybookURL          string `json:"PlaybookURL" example:"https://console.redhat.com/api/edge/v1/updates/1026/update-playbook.yml"` // The generated playbook url
	DeviceID             uint   `json:"DeviceID" example:"12789"`                                                                      // The unique ID of the device being updated
	Status               string `json:"Status" example:"BUILDING"`                                                                     // The status of device update
	Reason               string `json:"Reason" example:""`                                                                             // In case of failure the error reason returned by the playbook-dispatcher service
	PlaybookDispatcherID string `json:"PlaybookDispatcherID" example:"c84cfd11-745c-4ee3-b87d-057a96732415"`                           // The playbook dispatcher job id

} // @name UpdateDispatchRecord

type UpdateRepoAPI

type UpdateRepoAPI struct {
	ID         uint   `json:"ID" example:"53218"`                                                      // The unique ID of the update repository
	RepoURL    string `json:"RepoURL" example:"https://storage-host.example.com/53218/upd/53218/repo"` // The url of the update ostree repository
	RepoStatus string `json:"RepoStatus" example:"SUCCESS"`                                            // The status of the device update repository building

} // @name UpdateRepo

type UpdateTransaction

type UpdateTransaction struct {
	Model
	Commit          *Commit          `json:"Commit"`
	CommitID        uint             `json:"CommitID"`
	Account         string           `json:"Account"`
	OrgID           string           `json:"org_id" gorm:"index;<-:create"`
	OldCommits      []Commit         `gorm:"many2many:updatetransaction_commits;" json:"OldCommits"`
	Devices         []Device         `gorm:"many2many:updatetransaction_devices;save_association:false" json:"Devices"`
	Tag             string           `json:"Tag"`
	Status          string           `json:"Status"`
	RepoID          *uint            `json:"RepoID"`
	Repo            *Repo            `json:"Repo"`
	ChangesRefs     bool             `gorm:"default:false" json:"ChangesRefs"`
	DispatchRecords []DispatchRecord `gorm:"many2many:updatetransaction_dispatchrecords;save_association:false" json:"DispatchRecords"`
}

UpdateTransaction represents the combination of an OSTree commit and a set of Inventory hosts that need to have the commit deployed to them This will ultimately kick off a transaction where the old version(s) of OSTree commit that are currently deployed onto those devices are combined with the new commit into a new OSTree repo, static deltas are computed, and then the result is stored in a way that can be served(proxied) by a Server (pkg/repo/server.go).

func (*UpdateTransaction) BeforeCreate

func (ur *UpdateTransaction) BeforeCreate(tx *gorm.DB) error

BeforeCreate method is called before creating any record with update, it make sure org_id is not empty

func (*UpdateTransaction) ValidateRequest

func (ur *UpdateTransaction) ValidateRequest() error

ValidateRequest validates a Update Record Request

type UpdateTransactionAPI

type UpdateTransactionAPI struct {
	Commit          *Commit             `json:"Commit"`
	CommitID        uint                `json:"CommitID"    example:"1754"`       // Commit ID of device
	OldCommits      []Commit            `json:"OldCommits"`                       // Old Commit ID if the device has one
	Devices         []DeviceAPI         `json:"Devices"`                          // List of Devices
	Tag             string              `json:"Tag"         example:"device_tag"` // Tag og Device if device has one
	Status          string              `json:"Status"      example:"SUCCESS"`    // Status of device
	RepoID          *uint               `json:"RepoID"      example:"2256"`       // Repo ID
	Repo            *Repo               `json:"Repo"`
	ChangesRefs     bool                `json:"ChangesRefs" example:"false"`
	DispatchRecords []DispatchRecordAPI `json:"DispatchRecords"`
}

UpdateTransactionAPI represents the combination of an OSTree commit and a set of Inventory

Jump to

Keyboard shortcuts

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