Skip to content

Commit a7dd2a4

Browse files
authored
Changes for API handler implementation update for OS Resource in apiv2 as per the day2 upgrade (#257)
1 parent 0dc90a4 commit a7dd2a4

1 file changed

Lines changed: 41 additions & 42 deletions

File tree

  • apiv2/internal/server

apiv2/internal/server/os.go

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,23 @@ func toInvOSResource(osResource *osv1.OperatingSystemResource) (*inv_osv1.Operat
3737
return &inv_osv1.OperatingSystemResource{}, nil
3838
}
3939
invOSResource := &inv_osv1.OperatingSystemResource{
40-
Name: osResource.GetName(),
41-
Architecture: osResource.GetArchitecture(),
42-
KernelCommand: osResource.GetKernelCommand(),
43-
UpdateSources: osResource.GetUpdateSources(),
44-
ImageUrl: osResource.GetImageUrl(),
45-
ImageId: osResource.GetImageId(),
46-
Sha256: osResource.GetSha256(),
47-
ProfileName: osResource.GetProfileName(),
48-
ProfileVersion: osResource.GetProfileVersion(),
49-
InstalledPackages: osResource.GetInstalledPackages(),
50-
SecurityFeature: inv_osv1.SecurityFeature(osResource.GetSecurityFeature()),
51-
OsType: inv_osv1.OsType(osResource.GetOsType()),
52-
OsProvider: inv_osv1.OsProviderKind(osResource.GetOsProvider()),
53-
Description: osResource.GetDescription(),
54-
Metadata: osResource.GetMetadata(),
55-
ExistingCvesUrl: osResource.GetExistingCvesUrl(),
56-
ExistingCves: osResource.GetExistingCves(),
57-
FixedCvesUrl: osResource.GetFixedCvesUrl(),
58-
FixedCves: osResource.GetFixedCves(),
40+
Name: osResource.GetName(),
41+
Architecture: osResource.GetArchitecture(),
42+
KernelCommand: osResource.GetKernelCommand(),
43+
UpdateSources: osResource.GetUpdateSources(),
44+
ImageUrl: osResource.GetImageUrl(),
45+
ImageId: osResource.GetImageId(),
46+
Sha256: osResource.GetSha256(),
47+
ProfileName: osResource.GetProfileName(),
48+
ProfileVersion: osResource.GetProfileVersion(),
49+
InstalledPackagesUrl: osResource.GetInstalledPackagesUrl(),
50+
SecurityFeature: inv_osv1.SecurityFeature(osResource.GetSecurityFeature()),
51+
OsType: inv_osv1.OsType(osResource.GetOsType()),
52+
OsProvider: inv_osv1.OsProviderKind(osResource.GetOsProvider()),
53+
Description: osResource.GetDescription(),
54+
Metadata: osResource.GetMetadata(),
55+
ExistingCvesUrl: osResource.GetExistingCvesUrl(),
56+
FixedCvesUrl: osResource.GetFixedCvesUrl(),
5957
}
6058

6159
err := validator.ValidateMessage(invOSResource)
@@ -72,29 +70,30 @@ func fromInvOSResource(invOSResource *inv_osv1.OperatingSystemResource) *osv1.Op
7270
return &osv1.OperatingSystemResource{}
7371
}
7472
osResource := &osv1.OperatingSystemResource{
75-
ResourceId: invOSResource.GetResourceId(),
76-
Name: invOSResource.GetName(),
77-
Architecture: invOSResource.GetArchitecture(),
78-
KernelCommand: invOSResource.GetKernelCommand(),
79-
UpdateSources: invOSResource.GetUpdateSources(),
80-
ImageUrl: invOSResource.GetImageUrl(),
81-
ImageId: invOSResource.GetImageId(),
82-
Sha256: invOSResource.GetSha256(),
83-
ProfileName: invOSResource.GetProfileName(),
84-
ProfileVersion: invOSResource.GetProfileVersion(),
85-
InstalledPackages: invOSResource.GetInstalledPackages(),
86-
SecurityFeature: osv1.SecurityFeature(invOSResource.GetSecurityFeature()),
87-
OsType: osv1.OsType(invOSResource.GetOsType()),
88-
OsProvider: osv1.OsProviderKind(invOSResource.GetOsProvider()),
89-
OsResourceID: invOSResource.GetResourceId(),
90-
Timestamps: GrpcToOpenAPITimestamps(invOSResource),
91-
PlatformBundle: invOSResource.GetPlatformBundle(),
92-
Description: invOSResource.GetDescription(),
93-
Metadata: invOSResource.GetMetadata(),
94-
ExistingCvesUrl: invOSResource.GetExistingCvesUrl(),
95-
ExistingCves: invOSResource.GetExistingCves(),
96-
FixedCvesUrl: invOSResource.GetFixedCvesUrl(),
97-
FixedCves: invOSResource.GetFixedCves(),
73+
ResourceId: invOSResource.GetResourceId(),
74+
Name: invOSResource.GetName(),
75+
Architecture: invOSResource.GetArchitecture(),
76+
KernelCommand: invOSResource.GetKernelCommand(),
77+
UpdateSources: invOSResource.GetUpdateSources(),
78+
ImageUrl: invOSResource.GetImageUrl(),
79+
ImageId: invOSResource.GetImageId(),
80+
Sha256: invOSResource.GetSha256(),
81+
ProfileName: invOSResource.GetProfileName(),
82+
ProfileVersion: invOSResource.GetProfileVersion(),
83+
InstalledPackages: invOSResource.GetInstalledPackages(),
84+
InstalledPackagesUrl: invOSResource.GetInstalledPackagesUrl(),
85+
SecurityFeature: osv1.SecurityFeature(invOSResource.GetSecurityFeature()),
86+
OsType: osv1.OsType(invOSResource.GetOsType()),
87+
OsProvider: osv1.OsProviderKind(invOSResource.GetOsProvider()),
88+
OsResourceID: invOSResource.GetResourceId(),
89+
Timestamps: GrpcToOpenAPITimestamps(invOSResource),
90+
PlatformBundle: invOSResource.GetPlatformBundle(),
91+
Description: invOSResource.GetDescription(),
92+
Metadata: invOSResource.GetMetadata(),
93+
ExistingCvesUrl: invOSResource.GetExistingCvesUrl(),
94+
ExistingCves: invOSResource.GetExistingCves(),
95+
FixedCvesUrl: invOSResource.GetFixedCvesUrl(),
96+
FixedCves: invOSResource.GetFixedCves(),
9897
}
9998
return osResource
10099
}

0 commit comments

Comments
 (0)