-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
33,396 additions
and
171,466 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 |
---|---|---|
|
@@ -29,4 +29,6 @@ ocsf-tool | |
schema | ||
|
||
# Ignore proto directory | ||
proto | ||
proto | ||
|
||
schema.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package enumValueMap | ||
|
||
import ( | ||
"embed" | ||
"encoding/json" | ||
) | ||
|
||
//go:embed enum-value-map.json | ||
var embedFs embed.FS | ||
|
||
// struct to hold the enum value | ||
type EnumValue struct { | ||
Name string `json:"name"` | ||
Value int64 `json:"value"` | ||
} | ||
|
||
type EnumValueMap = map[string]EnumValue | ||
|
||
var enumValueMap EnumValueMap | ||
|
||
func init() { | ||
data, _ := embedFs.ReadFile("enum-value-map.json") | ||
json.Unmarshal(data, &enumValueMap) | ||
} | ||
|
||
func GetEnumValue(name string) (EnumValue, bool) { | ||
enumValue, enumValueExits := enumValueMap[name] | ||
return enumValue, enumValueExits | ||
} |
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,31 @@ | ||
#!/bin/bash | ||
|
||
|
||
while IFS= read -r -d '' enumValueMapJson; do | ||
echo "Processing $enumValueMapJson" | ||
|
||
# replace proto from $file | ||
newEnumValueMapJson=${enumValueMapJson/proto\//} | ||
newEnumValueMapJson=${enumValueMapJson/enum-value-map.json/enum-value-map/enum-value-map.json/} | ||
|
||
# create directory if not exist | ||
mkdir -p $(dirname $newEnumValueMapJson) | ||
|
||
# copy file | ||
echo "Creating to $newEnumValueMapJson" | ||
cp $enumValueMapJson $newEnumValueMapJson | ||
|
||
# replace enum-value-map.json to enum-value-map.go.template from $newFile | ||
enumValueMapGoFile=${newEnumValueMapJson/enum-value-map.json/enum-value-map/map.go} | ||
|
||
# create directory if not exist | ||
mkdir -p $(dirname $enumValueMapGoFile) | ||
|
||
# copy file | ||
echo "Creating to $enumValueMapGoFile" | ||
cp "./enum-value/enum-value-map.go.template" $enumValueMapGoFile | ||
|
||
echo "" | ||
|
||
done < <(find ./proto -name "enum-value-map.json" -print0) | ||
|
2,616 changes: 1,324 additions & 1,292 deletions
2,616
ocsf/v1_0_0/events/application/application.pb.go
Large diffs are not rendered by default.
Oops, something went wrong.
20,848 changes: 1,297 additions & 19,551 deletions
20,848
ocsf/v1_0_0/events/application/enums/enums.pb.go
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.