-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add entities.metadata #2769
base: main
Are you sure you want to change the base?
Add entities.metadata #2769
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -329,9 +329,32 @@ type AssetResourcePolicy struct { | |
Condition map[string]any `json:"condition,omitempty"` | ||
} | ||
|
||
// EntityMetadata maps metadata required to use Entity Store | ||
type entityMetadata struct { | ||
Category string `json:"category"` | ||
Type string `json:"type"` | ||
} | ||
|
||
// AssetEnricher functional builder function | ||
type AssetEnricher func(asset *AssetEvent) | ||
|
||
func (a *AssetEvent) getEntityMetadata() map[string]entityMetadata { | ||
ids := a.Asset.Id | ||
|
||
if len(ids) == 0 { | ||
return nil | ||
} | ||
|
||
// Picking up only first id, we need to make a decision on if we | ||
// have a "primary" id or if we duplicate data | ||
Comment on lines
+348
to
+349
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's super important. We also have to pay attention to always put "the" asset ID in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a product question I want to clear it up. I believe it was a bad decision in the end to have multiple ids. We need to have a standardized id per resource. We need to make the decision for example is aws iam user arn or username? And one for each one of those. The initial attempt of having a "correlation best chance" approach isn't going to help us in the asset inventory, unfortunately. |
||
return map[string]entityMetadata{ | ||
ids[0]: { | ||
Category: string(a.Asset.Category), | ||
Type: string(a.Asset.Type), | ||
}, | ||
} | ||
} | ||
|
||
func NewAssetEvent(c AssetClassification, ids []string, name string, enrichers ...AssetEnricher) AssetEvent { | ||
a := AssetEvent{ | ||
Asset: Asset{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any other fields planned? What will happen if we change the taxonomy we have now (Category, Sub-Category, Type, Sub-type) to a less granular one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might have other fields.
Once we change the taxonomy, we should follow the taxonomy.