/
activity_dump_proto_dec_v1.go
35 lines (27 loc) · 1.18 KB
/
activity_dump_proto_dec_v1.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.
//go:build linux
// Package dump holds dump related files
package dump
import (
adproto "github.com/DataDog/agent-payload/v5/cws/dumpsv1"
"github.com/DataDog/datadog-agent/pkg/security/config"
activity_tree "github.com/DataDog/datadog-agent/pkg/security/security_profile/activity_tree"
mtdt "github.com/DataDog/datadog-agent/pkg/security/security_profile/activity_tree/metadata"
)
func protoToActivityDump(dest *ActivityDump, pathsReducer *activity_tree.PathsReducer, ad *adproto.SecDump) {
if ad == nil {
return
}
dest.Host = ad.Host
dest.Service = ad.Service
dest.Source = ad.Source
dest.Metadata = mtdt.ProtoMetadataToMetadata(ad.Metadata)
dest.Tags = make([]string, len(ad.Tags))
copy(dest.Tags, ad.Tags)
dest.StorageRequests = make(map[config.StorageFormat][]config.StorageRequest)
dest.ActivityTree = activity_tree.NewActivityTree(dest, pathsReducer, "activity_dump")
activity_tree.ProtoDecodeActivityTree(dest.ActivityTree, ad.Tree)
}