forked from opengovern/og-describer-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: added common columns for render tables
- Loading branch information
Showing
13 changed files
with
69 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"es_id":"","es_index":"","platform_id":":::Render/EnvGroup:::evg-ctavhehopnds73ejl14g","resource_id":"evg-ctavhehopnds73ejl14g","resource_name":"harbor-prod","description":{"createdAt":"2024-12-08T19:51:22.426806Z","environmentId":"","id":"evg-ctavhehopnds73ejl14g","name":"harbor-prod","ownerId":"tea-csuhvt52ng1s739lbn5g","serviceLinks":[],"updatedAt":"2024-12-08T19:51:22.426806Z"},"integration_type":"RENDER_ACCOUNT","resource_type":"render/envgroup","integration_id":"","metadata":{},"canonical_tags":null,"described_by":"473050548","described_at":1733908008835}, | ||
{"es_id":"","es_index":"","platform_id":":::Render/Project:::prj-ctavcqqj1k6c738qbuf0","resource_id":"prj-ctavcqqj1k6c738qbuf0","resource_name":"opencomply-platform","description":{"createdAt":"2024-12-08T19:41:31.164334Z","environmentIds":["evm-ctavcqqj1k6c738qbufg"],"id":"prj-ctavcqqj1k6c738qbuf0","name":"opencomply-platform","owner":{"email":"[email protected]","id":"tea-csuhvt52ng1s739lbn5g","name":"My Workspace","twoFactorAuthEnabled":false,"type":"team"},"updatedAt":"2024-12-08T19:41:31.164334Z"},"integration_type":"RENDER_ACCOUNT","resource_type":"render/project","integration_id":"","metadata":{},"canonical_tags":null,"described_by":"3928438176","described_at":1734887045810}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package render | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" | ||
"github.com/turbot/steampipe-plugin-sdk/v5/plugin" | ||
"github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" | ||
) | ||
|
||
func commonColumns(c []*plugin.Column) []*plugin.Column { | ||
return append(c, []*plugin.Column{ | ||
{ | ||
Name: "platform_account_id", | ||
Type: proto.ColumnType_STRING, | ||
Description: "The Platform Account ID in which the resource is located.", | ||
Transform: transform.FromField("IntegrationID"), | ||
}, | ||
{ | ||
Name: "platform_resource_id", | ||
Type: proto.ColumnType_STRING, | ||
Description: "The unique ID of the resource in opengovernance.", | ||
Transform: transform.FromField("PlatformID"), | ||
}, | ||
{ | ||
Name: "platform_metadata", | ||
Type: proto.ColumnType_JSON, | ||
Description: "The metadata of the resource", | ||
Transform: transform.FromField("Metadata").Transform(marshalJSON), | ||
}, | ||
{ | ||
Name: "platform_resource_description", | ||
Type: proto.ColumnType_JSON, | ||
Description: "The full model description of the resource", | ||
Transform: transform.FromField("Description").Transform(marshalJSON), | ||
}, | ||
}...) | ||
} | ||
|
||
func marshalJSON(_ context.Context, d *transform.TransformData) (interface{}, error) { | ||
b, err := json.Marshal(d.Value) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return string(b), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters