-
Notifications
You must be signed in to change notification settings - Fork 1
/
agents.go
38 lines (31 loc) · 1.55 KB
/
agents.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
package models
import (
"time"
"github.com/flanksource/duty/types"
"github.com/google/uuid"
)
type Agent struct {
ID uuid.UUID `json:"id,omitempty" gorm:"default:generate_ulid()"`
Name string `json:"name"`
Hostname string `json:"hostname,omitempty"`
Description string `json:"description,omitempty"`
IP string `json:"ip,omitempty"`
Version string `json:"version,omitempty"`
Username string `json:"username,omitempty"`
PersonID *uuid.UUID `json:"person_id,omitempty"`
Properties types.JSONStringMap `json:"properties,omitempty"`
TLS string `json:"tls,omitempty"`
CreatedBy *uuid.UUID `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at" time_format:"postgres_timestamp"`
DeletedAt *time.Time `json:"deleted_at" time_format:"postgres_timestamp"`
UpdatedAt time.Time `json:"updated_at" time_format:"postgres_timestamp"`
// Cleanup when set to true will delete all the agent resources when the agent is deleted
Cleanup bool `json:"cleanup"`
// LastSeen is the timestamp the agent last sent a heartbeat
LastSeen *time.Time `json:"last_seen,omitempty" time_format:"postgres_timestamp"`
// LastReceived is the timestamp the agent last sent a push data
LastReceived *time.Time `json:"last_received,omitempty" time_format:"postgres_timestamp"`
}
func (t Agent) AsMap(removeFields ...string) map[string]any {
return asMap(t, removeFields...)
}