Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
86 changes: 44 additions & 42 deletions apiv2/internal/server/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,26 @@ func toInvOSResource(osResource *osv1.OperatingSystemResource) (*inv_osv1.Operat
return &inv_osv1.OperatingSystemResource{}, nil
}
invOSResource := &inv_osv1.OperatingSystemResource{
Name: osResource.GetName(),
Architecture: osResource.GetArchitecture(),
KernelCommand: osResource.GetKernelCommand(),
UpdateSources: osResource.GetUpdateSources(),
ImageUrl: osResource.GetImageUrl(),
ImageId: osResource.GetImageId(),
Sha256: osResource.GetSha256(),
ProfileName: osResource.GetProfileName(),
ProfileVersion: osResource.GetProfileVersion(),
InstalledPackages: osResource.GetInstalledPackages(),
SecurityFeature: inv_osv1.SecurityFeature(osResource.GetSecurityFeature()),
OsType: inv_osv1.OsType(osResource.GetOsType()),
OsProvider: inv_osv1.OsProviderKind(osResource.GetOsProvider()),
Description: osResource.GetDescription(),
Metadata: osResource.GetMetadata(),
ExistingCvesUrl: osResource.GetExistingCvesUrl(),
ExistingCves: osResource.GetExistingCves(),
FixedCvesUrl: osResource.GetFixedCvesUrl(),
FixedCves: osResource.GetFixedCves(),
Name: osResource.GetName(),
Architecture: osResource.GetArchitecture(),
KernelCommand: osResource.GetKernelCommand(),
UpdateSources: osResource.GetUpdateSources(),
ImageUrl: osResource.GetImageUrl(),
ImageId: osResource.GetImageId(),
Sha256: osResource.GetSha256(),
ProfileName: osResource.GetProfileName(),
ProfileVersion: osResource.GetProfileVersion(),
InstalledPackages: osResource.GetInstalledPackages(),
Comment thread
daniele-moro marked this conversation as resolved.
Outdated
InstalledPackagesUrl: osResource.GetInstalledPackagesUrl(),
SecurityFeature: inv_osv1.SecurityFeature(osResource.GetSecurityFeature()),
OsType: inv_osv1.OsType(osResource.GetOsType()),
OsProvider: inv_osv1.OsProviderKind(osResource.GetOsProvider()),
Description: osResource.GetDescription(),
Metadata: osResource.GetMetadata(),
ExistingCvesUrl: osResource.GetExistingCvesUrl(),
ExistingCves: osResource.GetExistingCves(),
FixedCvesUrl: osResource.GetFixedCvesUrl(),
FixedCves: osResource.GetFixedCves(),
Comment thread
daniele-moro marked this conversation as resolved.
Outdated
}

err := validator.ValidateMessage(invOSResource)
Expand All @@ -72,29 +73,30 @@ func fromInvOSResource(invOSResource *inv_osv1.OperatingSystemResource) *osv1.Op
return &osv1.OperatingSystemResource{}
}
osResource := &osv1.OperatingSystemResource{
ResourceId: invOSResource.GetResourceId(),
Name: invOSResource.GetName(),
Architecture: invOSResource.GetArchitecture(),
KernelCommand: invOSResource.GetKernelCommand(),
UpdateSources: invOSResource.GetUpdateSources(),
ImageUrl: invOSResource.GetImageUrl(),
ImageId: invOSResource.GetImageId(),
Sha256: invOSResource.GetSha256(),
ProfileName: invOSResource.GetProfileName(),
ProfileVersion: invOSResource.GetProfileVersion(),
InstalledPackages: invOSResource.GetInstalledPackages(),
SecurityFeature: osv1.SecurityFeature(invOSResource.GetSecurityFeature()),
OsType: osv1.OsType(invOSResource.GetOsType()),
OsProvider: osv1.OsProviderKind(invOSResource.GetOsProvider()),
OsResourceID: invOSResource.GetResourceId(),
Timestamps: GrpcToOpenAPITimestamps(invOSResource),
PlatformBundle: invOSResource.GetPlatformBundle(),
Description: invOSResource.GetDescription(),
Metadata: invOSResource.GetMetadata(),
ExistingCvesUrl: invOSResource.GetExistingCvesUrl(),
ExistingCves: invOSResource.GetExistingCves(),
FixedCvesUrl: invOSResource.GetFixedCvesUrl(),
FixedCves: invOSResource.GetFixedCves(),
ResourceId: invOSResource.GetResourceId(),
Name: invOSResource.GetName(),
Architecture: invOSResource.GetArchitecture(),
KernelCommand: invOSResource.GetKernelCommand(),
UpdateSources: invOSResource.GetUpdateSources(),
ImageUrl: invOSResource.GetImageUrl(),
ImageId: invOSResource.GetImageId(),
Sha256: invOSResource.GetSha256(),
ProfileName: invOSResource.GetProfileName(),
ProfileVersion: invOSResource.GetProfileVersion(),
InstalledPackages: invOSResource.GetInstalledPackages(),
InstalledPackagesUrl: invOSResource.GetInstalledPackagesUrl(),
SecurityFeature: osv1.SecurityFeature(invOSResource.GetSecurityFeature()),
OsType: osv1.OsType(invOSResource.GetOsType()),
OsProvider: osv1.OsProviderKind(invOSResource.GetOsProvider()),
OsResourceID: invOSResource.GetResourceId(),
Timestamps: GrpcToOpenAPITimestamps(invOSResource),
PlatformBundle: invOSResource.GetPlatformBundle(),
Description: invOSResource.GetDescription(),
Metadata: invOSResource.GetMetadata(),
ExistingCvesUrl: invOSResource.GetExistingCvesUrl(),
ExistingCves: invOSResource.GetExistingCves(),
FixedCvesUrl: invOSResource.GetFixedCvesUrl(),
FixedCves: invOSResource.GetFixedCves(),
}
return osResource
}
Expand Down
20 changes: 19 additions & 1 deletion inventory/api/os/v1/os.proto
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,25 @@ message OperatingSystemResource {
optional: true
immutable: true
}]; // Version of an OS profile that the OS resource belongs to. Along with profile_name uniquely identifies OS resource.
string installed_packages = 9 [(ent.field) = {optional: true}]; // Freeform text, OS-dependent. A list of package names, one per line (newline separated). Should not contain version info. Deprecated in EMF-v3.1, use OSUpdatePolicy.

string installed_packages = 9 [
(ent.field) = {
optional: true
immutable: false
}]; // Freeform text, OS-dependent. A list of package names, one per line (newline separated). Should not contain version info. Deprecated in EMF-v3.1, use OSUpdatePolicy.

// The URL of the OS manifest which contains install packages details. This will be used to fill the installed_packages field
// for the advance use case to allow manual creation of OSProfiles when supported from backend.
string installed_packages_url = 17 [
(ent.field) = {
optional: true
immutable: true
},
(buf.validate.field).string = {
pattern: "^$|^[a-zA-Z-_0-9./:;=@?!#,<>*()\"\\ ]+$"
max_len: 200
}];

SecurityFeature security_feature = 10 [(ent.field) = {
optional: true
immutable: true
Expand Down
1 change: 1 addition & 0 deletions inventory/docs/api/inventory.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@
| profile_name | [string](#string) | | Name of an OS profile that the OS resource belongs to. Uniquely identifies family of OSResources. |
| profile_version | [string](#string) | | Version of an OS profile that the OS resource belongs to. Along with profile_name uniquely identifies OS resource. |
| installed_packages | [string](#string) | | Freeform text, OS-dependent. A list of package names, one per line (newline separated). Should not contain version info. Deprecated in EMF-v3.1, use OSUpdatePolicy. |
| installed_packages_url | [string](#string) | | The URL of the OS manifest which contains install packages details. This will be used to fill the installed_packages field for the advance use case to allow manual creation of OSProfiles when supported from backend. |
| security_feature | [SecurityFeature](#os-v1-SecurityFeature) | | Indicating if this OS is capable of supporting features like Secure Boot (SB) and Full Disk Encryption (FDE). |
| os_type | [OsType](#os-v1-OsType) | | Indicating the type of OS (for example, mutable or immutable). |
| os_provider | [OsProviderKind](#os-v1-OsProviderKind) | | Indicating the provider of OS (e.g., Infra or Lenovo). |
Expand Down
Loading
Loading