Skip to content

Commit 317491d

Browse files
committed
fix: add platform_artifact_sbom table
1 parent 7f9da01 commit 317491d

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

pkg/cloudql/client/artifact_sbom.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ const (
1616
)
1717

1818
type ArtifactSbom struct {
19-
ImageURL string `json:"imageUrl"`
20-
ArtifactID string `json:"artifactId"`
21-
SbomFormat string `json:"sbomFormat"`
19+
ImageURL string `json:"image_url"`
20+
ArtifactID string `json:"artifact_id"`
21+
SbomFormat string `json:"sbom_format"`
2222
Sbom interface{} `json:"sbom"`
2323
}
2424

pkg/cloudql/tables/table_platform_artifact_sbom.go

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package opengovernance
22

33
import (
44
"context"
5+
"encoding/json"
56
"github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform"
67

78
og_client "github.com/opengovern/opensecurity/pkg/cloudql/client"
@@ -22,24 +23,37 @@ func tablePlatformArtifactSboms(_ context.Context) *plugin.Table {
2223
Columns: []*plugin.Column{
2324
{
2425
Name: "image_url",
25-
Transform: transform.FromField("Description.imageUrl"),
26+
Transform: transform.FromField("Description.ImageURL"),
2627
Type: proto.ColumnType_STRING,
2728
},
2829
{
2930
Name: "artifact_id",
30-
Transform: transform.FromField("Description.artifactId"),
31+
Transform: transform.FromField("Description.ArtifactID"),
3132
Type: proto.ColumnType_STRING,
3233
},
3334
{
3435
Name: "sbom_format",
35-
Transform: transform.FromField("Description.sbomFormat"),
36+
Transform: transform.FromField("Description.SbomFormat"),
3637
Type: proto.ColumnType_STRING,
3738
},
3839
{
3940
Name: "sbom",
40-
Transform: transform.FromField("Description.sbom"),
41+
Transform: transform.FromField("Description.Sbom"),
4142
Type: proto.ColumnType_JSON,
4243
},
44+
{
45+
Name: "platform_description",
46+
Type: proto.ColumnType_JSON,
47+
Description: "The full model description of the resource",
48+
Transform: transform.FromField("Description").Transform(marshalJSON),
49+
},
4350
},
4451
}
4552
}
53+
func marshalJSON(_ context.Context, d *transform.TransformData) (interface{}, error) {
54+
b, err := json.Marshal(d.Value)
55+
if err != nil {
56+
return nil, err
57+
}
58+
return string(b), nil
59+
}

0 commit comments

Comments
 (0)