entities

package
v0.0.0-...-0bce360 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JobTypeReport JobType = "report"

	FileTypePDF FileType = "pdf"
	FileTypeCSV FileType = "csv"

	ReportTypeAssetPackage ReportType = "asset_packages"
	ReportTypeAsset        ReportType = "asset"
	ReportTypePackage      ReportType = "package"
)

Functions

This section is empty.

Types

type AlternativePackage

type AlternativePackage struct {
	Base
	Name        string     `json:"name"`
	URL         string     `json:"url"`
	PackageName string     `json:"package_name"`
	Packages    []*Package `json:"packages"`
}

type Arguments

type Arguments struct {
	IPRange  string `json:"ip_range"`
	Username string `json:"string"`
	Password string `json:"password"`
	RunID    string `json:"run_id"`
}

type Asset

type Asset struct {
	Base
	Hostname     string `json:"hostname"`
	Address      string `json:"address"`
	SerialNumber string `json:"serial_number"`
	BiosVersion  string `json:"bios_version"`
	Vendor       string `json:"vendor"`
	Model        string `json:"model"`

	DiscoveryID *uuid.UUID `json:"discovery_id"`
	Discovery   *Discovery `json:"discovery"`
	Packages    []*Package `json:"packages" gorm:"many2many:asset_packages"`
}

type Base

type Base struct {
	ID        *uuid.UUID     `json:"id" gorm:"primary_key,type:uuid"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
}

func (*Base) BeforeCreate

func (base *Base) BeforeCreate(tx *gorm.DB) (err error)

type Discovery

type Discovery struct {
	Base
	IPRange   string     `json:"ip_range" validate:"required"`
	ProfileID *uuid.UUID `json:"profile_id" validate:"required"`
	Profile   *Profile   `json:"profile"`

	Status  Status `json:"discovery_status" gorm:"default:pending"`
	Message string `json:"message"`
}

func (*Discovery) UpdateStatus

func (d *Discovery) UpdateStatus(status Status, message string)

type DiscoveryLogs

type DiscoveryLogs struct {
	Base
	DiscoveryID *uuid.UUID `json:"discovery_id"`
	Discovery   *Discovery `json:"discovery"`
	Filename    string     `json:"filename"`
}

type FileType

type FileType string

type Job

type Job struct {
	Base
	Status     Status     `json:"status"`
	JobType    JobType    `json:"job_type"`
	FileType   FileType   `json:"file_type"`
	ReportType ReportType `json:"report_type"`

	Message string `json:"message"`
	Path    string `json:"path"`
}

func (*Job) Update

func (j *Job) Update(status Status, message string)

func (*Job) UpdateAsDone

func (j *Job) UpdateAsDone(path string)

type JobType

type JobType string

type Package

type Package struct {
	Base
	Name                 string              `json:"name"`
	Version              string              `json:"version"`
	Vendor               string              `json:"vendor"`
	Assets               []*Asset            `json:"assets" gorm:"many2many:asset_packages"`
	AlternativePackageID *uuid.UUID          `json:"alternative_package_id"`
	AlternativePackage   *AlternativePackage `json:"alternative_package"`
}

type Profile

type Profile struct {
	Base
	Name        string       `json:"name" gorm:"unique" validate:"required"`
	Username    string       `json:"username" validate:"required"`
	Password    string       `json:"password" validate:"required"`
	Discoveries []*Discovery `json:"discoveries"`
}

type ReportType

type ReportType string

type Result

type Result struct {
	Error  string      `json:"error"`
	Output interface{} `json:"result"`
}

type Status

type Status string
var (
	StatusPending    Status = "pending"
	StatusInProgress Status = "in_progress"
	StatusDone       Status = "done"
	StatusError      Status = "error"
)

Jump to

Keyboard shortcuts

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