Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Asset tests] Add installationInfo field to API response of get package #2233

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions internal/kibana/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,29 @@ type FleetPackage struct {
Version string `json:"version"`
Type string `json:"type"`
Status string `json:"status"`
SavedObject struct {
SavedObject *struct {
Attributes struct {
InstalledElasticsearchAssets []packages.Asset `json:"installed_es"`
InstalledKibanaAssets []packages.Asset `json:"installed_kibana"`
PackageAssets []packages.Asset `json:"package_assets"`
} `json:"attributes"`
} `json:"savedObject"`
InstallationInfo *struct {
InstalledElasticsearchAssets []packages.Asset `json:"installed_es"`
InstalledKibanaAssets []packages.Asset `json:"installed_kibana"`
} `json:"installationInfo"`
}

func (p *FleetPackage) Assets() []packages.Asset {
var assets []packages.Asset
assets = append(assets, p.SavedObject.Attributes.InstalledElasticsearchAssets...)
assets = append(assets, p.SavedObject.Attributes.InstalledKibanaAssets...)
if p.SavedObject != nil {
assets = append(assets, p.SavedObject.Attributes.InstalledElasticsearchAssets...)
assets = append(assets, p.SavedObject.Attributes.InstalledKibanaAssets...)
return assets
}
// starting in 9.0.0 "savedObject" fields does not exist in the API response
assets = append(assets, p.InstallationInfo.InstalledElasticsearchAssets...)
assets = append(assets, p.InstallationInfo.InstalledKibanaAssets...)
return assets
}

Expand Down