Add backend types for software installers feature (#18517)

This commit is contained in:
Sarah Gillespie
2024-04-25 09:28:53 -05:00
committed by GitHub
parent 28b2593570
commit 00d262f5e2
+60 -1
View File
@@ -37,10 +37,69 @@ func (FailingSoftwareInstallerStore) Exists(ctx context.Context, installerID str
type SoftwareInstaller struct {
// TeamID is the ID of the team. A value of nil means it is scoped to hosts that are assigned to
// no team.
TeamID *uint `json:"team_id"`
TeamID *uint `json:"team_id" db:"team_id"`
// Name is the name of the software package.
Name string `json:"name" db:"name"`
// Version is the version of the software package.
Version string `json:"version" db:"version"`
// UploadedAt is the time the software package was uploaded.
UploadedAt string `json:"uploaded_at" db:"uploaded_at"`
// InstallerID is the unique identifier for the software package metadata in Fleet.
InstallerID uint `json:"-" db:"installer_id"`
// InstallScript is the script to run to install the software package.
InstallScript string `json:"install_script" db:"install_script"`
// PreInstallQuery is the query to run as a condition to installing the software package.
PreInstallQuery string `json:"pre_install_query" db:"pre_install_condition"`
// PostInstallScript is the script to run after installing the software package.
PostInstallScript string `json:"post_install_script"`
}
// AuthzType implements authz.AuthzTyper.
func (s *SoftwareInstaller) AuthzType() string {
return "software_installer"
}
// SoftwareInstallerStatusSummary represents aggregated status metrics for a software installer package.
type SoftwareInstallerStatusSummary struct {
// Installed is the number of hosts that have the software package installed.
Installed uint `json:"installed" db:"installed"`
// Pending is the number of hosts that have the software package pending installation.
Pending uint `json:"pending" db:"pending"`
// Failed is the number of hosts that have the software package installation failed.
Failed uint `json:"failed" db:"failed"`
}
// SoftwareInstallerStatus represents the status of a software installer package on a host.
type SoftwareInstallerStatus string
var (
SoftwareInstallerPending SoftwareInstallerStatus = "pending"
SoftwareInstallerFailed SoftwareInstallerStatus = "failed"
SoftwareInstallerInstalled SoftwareInstallerStatus = "installed"
)
// HostSoftwareInstaller represents a software installer package that has been installed on a host.
type HostSoftwareInstallerResult struct {
// InstallUUID is the unique identifier for the software install operation associated with the host.
InstallUUID string `json:"install_uuid" db:"execution_id"`
// SoftwareTitle is the title of the software.
SoftwareTitle string `json:"software_title" db:"software_title"`
// SoftwareVersion is the version of the software.
SoftwareTitleID uint `json:"software_title_id" db:"software_title_id"`
// SoftwarePackage is the name of the software installer package.
SoftwarePackage string `json:"software_package" db:"software_package"`
// HostID is the ID of the host.
HostID uint `json:"host_id" db:"host_id"`
// HostDisplayName is the display name of the host.
HostDisplayName string `json:"host_display_name" db:"host_display_name"`
// Status is the status of the software installer package on the host.
Status SoftwareInstallerStatus `json:"status" db:"status"`
// Detail is the detail of the software installer package on the host.
Detail string `json:"detail" db:"detail"`
// Output is the output of the software installer package on the host.
Output string `json:"output" db:"install_script_output"`
// PreInstallQueryOutput is the output of the pre-install query on the host.
PreInstallQueryOutput string `json:"pre_install_query_output" db:"pre_install_query_output"`
// PostInstallScriptOutput is the output of the post-install script on the host.
PostInstallScriptOutput string `json:"post_install_script_output" db:"post_install_script_output"`
}