diff --git a/pkg/models/devices_api.go b/pkg/models/devices_api.go index 80d6bbb48..c8d44c6ed 100644 --- a/pkg/models/devices_api.go +++ b/pkg/models/devices_api.go @@ -5,51 +5,51 @@ package models // and the Device data saved on Edge API type EdgeDeviceAPI struct { *Device - DeviceName string - LastSeen string - Booted bool // Booted status is referring to the LastDeployment of this device + DeviceName string `example:"device_name"` // The device name + LastSeen string `example:"2023-07-19T08:09:08.084004+00:00"` // Last datetime that device updated + Booted bool `example:"true"` // Booted status is referring to the LastDeployment of this device } // 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 DeviceGroupAPI struct { - Name string `json:"Name"` - Type string `json:"Type"` - Devices []Device `faker:"-" json:"Devices"` - ValidUpdate bool `json:"ValidUpdate"` + Name string `json:"Name" example:"device_group name"` // The device group name` + Type string `json:"Type" example:"static"` // The device group type`` + Devices []Device `faker:"-" json:"Devices"` // Devices that belong to the group + ValidUpdate bool `json:"ValidUpdate" example:"true"` // indicate if the update is valid } // UpdateTransactionAPI represents the combination of an OSTree commit and a set of Inventory type UpdateTransactionAPI struct { Model Commit *Commit `json:"Commit"` - CommitID uint `json:"CommitID"` - OldCommits []Commit `json:"OldCommits"` - Devices []Device `json:"Devices"` - Tag string `json:"Tag"` - Status string `json:"Status"` - RepoID *uint `json:"RepoID"` + CommitID uint `json:"CommitID" example:"1754"` // Commit ID of device + OldCommits []Commit `json:"OldCommits"` // Old Commit ID if the device has one + Devices []Device `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"` + ChangesRefs bool `json:"ChangesRefs" example:"false"` DispatchRecords []DispatchRecord `json:"DispatchRecords"` } // DeviceDetailsAPI is a Device with Image and Update transactions // It contains data from multiple tables on the database type DeviceDetailsAPI struct { - Device EdgeDeviceAPI `json:"Device,omitempty"` - Image *ImageInfo `json:"ImageInfo"` + 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"` - Updating *bool `json:"DeviceUpdating,omitempty"` + DevicesGroups *[]DeviceGroupAPI `json:"DevicesGroups,omitempty"` // Device's groups + Updating *bool `json:"DeviceUpdating,omitempty" example:"true"` // If there is update to device } // DeviceDetailsListAPI is the list of devices with details from Inventory and Edge API type DeviceDetailsListAPI struct { - Total int `json:"total"` - Count int `json:"count"` - Devices []DeviceDetailsAPI `json:"data"` + 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 } // DeviceDeviceGroupAPI is a struct of device group name and id needed for DeviceView @@ -60,22 +60,22 @@ type DeviceDeviceGroupAPI struct { // DeviceViewAPI is the device information needed for the UI type DeviceViewAPI struct { - DeviceID uint `json:"DeviceID"` - DeviceName string `json:"DeviceName"` + DeviceID uint `json:"DeviceID" example:"1913277"` // ID of device + DeviceName string `json:"DeviceName" example:"device_name"` // Name of device 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 []DeviceDeviceGroupAPI `json:"DeviceGroups"` + ImageID uint `json:"ImageID" example:"323241"` // ID of image + ImageName string `json:"ImageName" example:"image_name"` // Name of image + LastSeen EdgeAPITime `json:"LastSeen" example:"2023-07-19T08:09:08.084004+00:00"` // 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:"323234341"` // ID of image set + DeviceGroups []DeviceDeviceGroupAPI `json:"DeviceGroups"` // Device's groups DispatcherStatus string `json:"DispatcherStatus"` DispatcherReason string `json:"DispatcherReason"` } // DeviceViewListAPI is the list of devices for a given account, formatted for the UI type DeviceViewListAPI struct { - Total int64 `json:"total"` - Devices []DeviceViewAPI `json:"devices"` + Total int64 `json:"total" example:"40"` // total number of device` + Devices []DeviceViewAPI `json:"devices"` // List of Devices }