Skip to content

Commit 386228c

Browse files
feat: Add description field to the OSResource in Inventory, REST API and OSProfile (#3)
Co-authored-by: PalashGoelIntel <palash.goel@intel.com>
1 parent b5d9bd1 commit 386228c

File tree

56 files changed

+1346
-1964
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1346
-1964
lines changed

api/api/openapi/edge-infrastructure-manager-openapi-all.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5996,6 +5996,11 @@ components:
59965996
type: string
59975997
maxLength: 128
59985998
pattern: '^[a-zA-Z-_0-9. ()]+$'
5999+
description:
6000+
description: The OS resource's description.
6001+
type: string
6002+
maxLength: 1000
6003+
pattern: '^$|^[a-zA-Z-_0-9.:;=@?!#,<>*(){}&%$`^+- ]+$'
59996004
architecture:
60006005
description: The OS resource's architecture.
60016006
title: architecture

api/api/openapi/schemas/os.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ OperatingSystemResource:
4444
type: string
4545
maxLength: 128
4646
pattern: '^[a-zA-Z-_0-9. ()]+$'
47+
description:
48+
description: "The OS resource's description."
49+
type: string
50+
maxLength: 1000
51+
pattern: '^$|^[a-zA-Z-_0-9.:;=@?!#,<>*(){}&%$`^+- ]+$'
4752
architecture:
4853
description: "The OS resource's architecture."
4954
title: "architecture"

api/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ module github.com/open-edge-platform/infra-core/api
55

66
go 1.24.1
77

8+
replace github.com/open-edge-platform/infra-core/inventory/v2 => ../inventory
9+
810
require (
911
github.com/getkin/kin-openapi v0.132.0
1012
github.com/go-openapi/strfmt v0.23.0

api/go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,8 +1025,6 @@ github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 h1:bQx3WeLcUWy+RletI
10251025
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90/go.mod h1:y5+oSEHCPT/DGrS++Wc/479ERge0zTFxaF8PbGKcg2o=
10261026
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
10271027
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
1028-
github.com/open-edge-platform/infra-core/inventory/v2 v2.24.0 h1:ZYt0WXCpLxpxa75UW/DkE5box9Wze8BoIfqZhcE9e0A=
1029-
github.com/open-edge-platform/infra-core/inventory/v2 v2.24.0/go.mod h1:j7n+k3Iy7oG2m79YtCaNKL+Br2IKMHVLVICs8MorCY8=
10301028
github.com/open-edge-platform/orch-library/go v0.6.1 h1:IGR2ic73f3obnhlxTRfHcyYMbPbYu7BSqa9UYyEZ78Q=
10311029
github.com/open-edge-platform/orch-library/go v0.6.1/go.mod h1:3Tes/GJfwYbnQa/1scbKiLbjZrL4fJEouFk28oo5/c8=
10321030
github.com/open-edge-platform/orch-library/go/dazl v0.5.4 h1:Rx/bSAZiLjEEBjUiJEzBvT0fQv5huT5FQ2Ke3IMUhiE=

api/internal/worker/handlers/invhandlers/os.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var OpenAPIOSResourceToProto = map[string]string{
2626
"kernelCommand": osv1.OperatingSystemResourceFieldKernelCommand,
2727
"updateSources": osv1.OperatingSystemResourceFieldUpdateSources,
2828
"installedPackages": osv1.OperatingSystemResourceFieldInstalledPackages,
29+
"description": osv1.OperatingSystemResourceFieldDescription,
2930
}
3031

3132
// OpenAPIOSToProtoExcluded defines exclusion rules as there are some fields
@@ -409,6 +410,10 @@ func openapiToGrpcOSResource(body *api.OperatingSystemResource) (*osv1.Operating
409410
os.Name = *body.Name
410411
}
411412

413+
if body.Description != nil {
414+
os.Description = *body.Description
415+
}
416+
412417
if body.Architecture != nil {
413418
os.Architecture = *body.Architecture
414419
}
@@ -465,6 +470,7 @@ func grpcToOpenAPIOSResource(
465470
) *api.OperatingSystemResource {
466471
resID := os.GetResourceId()
467472
resName := os.GetName()
473+
description := os.GetDescription()
468474
kernel := os.GetKernelCommand()
469475
arch := os.GetArchitecture()
470476
sources := os.GetUpdateSources()
@@ -482,6 +488,7 @@ func grpcToOpenAPIOSResource(
482488
obj := api.OperatingSystemResource{
483489
OsResourceID: &resID,
484490
Name: &resName,
491+
Description: &description,
485492
KernelCommand: &kernel,
486493
Architecture: &arch,
487494
UpdateSources: sources,

api/pkg/api/v0/edge-infrastructure-manager-openapi-server.gen.go

Lines changed: 255 additions & 255 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/pkg/api/v0/edge-infrastructure-manager-openapi-types.gen.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apiv2/.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ run:
7575
go: ""
7676

7777
linters-settings:
78+
gomoddirectives:
79+
replace-local: true
80+
replace-allow-list:
81+
- github.com/open-edge-platform/infra-core/inventory
7882
depguard:
7983
rules:
8084
main:

apiv2/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.3
1+
0.0.4-dev

apiv2/api/openapi/openapi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4146,6 +4146,10 @@ components:
41464146
pattern: ^$|^[a-zA-Z-_0-9./:;=@?!#,<>*()"\ ]+$
41474147
type: string
41484148
description: A unique identifier of the OS image that can be retrieved from the running OS.
4149+
description:
4150+
maxLength: 1000
4151+
pattern: ^$|^[a-zA-Z-_0-9.:;=@?!#,<>*(){}&%$`^\+\- ]+$
4152+
type: string
41494153
sha256:
41504154
maxLength: 64
41514155
minLength: 64

0 commit comments

Comments
 (0)