-
Notifications
You must be signed in to change notification settings - Fork 3
/
evidence.go
52 lines (40 loc) · 1.2 KB
/
evidence.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package swid
import "time"
// Evidence models a evidence-entry
type Evidence struct {
EvidenceExtension
GlobalAttributes
ResourceCollection
// The date and time the information was collected pertaining to the
// evidence item.
Date time.Time `cbor:"35,keyasint,omitempty" json:"date,omitempty" xml:"date,attr,omitempty"`
// The endpoint's string identifier from which the evidence was
// collected.
DeviceID string `cbor:"36,keyasint,omitempty" json:"device-id,omitempty" xml:"deviceId,attr,omitempty"`
}
// NewEvidence instantiates a new Evidence object initialized with the given
// deviceID
func NewEvidence(deviceID string) *Evidence {
return &Evidence{
DeviceID: deviceID,
Date: time.Now(),
}
}
// AddFile adds the supplied File to the embedded ResourceCollection of the
// Evidence receiver
func (e *Evidence) AddFile(f File) error {
if e.Files == nil {
e.Files = new(Files)
}
*e.Files = append(*e.Files, f)
return nil
}
// AddProcess adds the supplied Process to the embedded ResourceCollection of the
// Evidence receiver
func (e *Evidence) AddProcess(p Process) error {
if e.Processes == nil {
e.Processes = new(Processes)
}
*e.Processes = append(*e.Processes, p)
return nil
}