Skip to content
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
83 changes: 41 additions & 42 deletions apiv2/internal/server/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,23 @@ 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(),
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(),
FixedCvesUrl: osResource.GetFixedCvesUrl(),
}

err := validator.ValidateMessage(invOSResource)
Expand All @@ -72,29 +70,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