Files
crowdsec-dashy/internal/crowdsec/types.go
T

154 lines
4.6 KiB
Go

package crowdsec
// -----------------------------------------------------------------------
// LAPI types
// -----------------------------------------------------------------------
type LoginRequest struct {
MachineID string `json:"machine_id"`
Password string `json:"password"`
Scenarios []string `json:"scenarios,omitempty"`
}
type LoginResponse struct {
Token string `json:"token"`
Expire string `json:"expire"`
}
type Decision struct {
ID int64 `json:"id"`
Origin string `json:"origin"`
Type string `json:"type"`
Scope string `json:"scope"`
Value string `json:"value"`
Duration string `json:"duration"`
Scenario string `json:"scenario"`
Simulated bool `json:"simulated"`
Until string `json:"until,omitempty"`
}
type DecisionInput struct {
Duration string `json:"duration"`
Origin string `json:"origin"`
Scenario string `json:"scenario"`
Scope string `json:"scope"`
Simulated bool `json:"simulated"`
Type string `json:"type"`
Value string `json:"value"`
}
type AlertSource struct {
AsName string `json:"as_name,omitempty"`
AsNumber string `json:"as_number,omitempty"`
CN string `json:"cn,omitempty"`
IP string `json:"ip,omitempty"`
Latitude float64 `json:"latitude,omitempty"`
Longitude float64 `json:"longitude,omitempty"`
Range string `json:"range,omitempty"`
Scope string `json:"scope"`
Value string `json:"value"`
}
type AlertEvent struct {
Meta []MetaItem `json:"meta"`
Timestamp string `json:"timestamp"`
}
type MetaItem struct {
Key string `json:"key"`
Value string `json:"value"`
}
type Alert struct {
ID int64 `json:"id"`
UUID string `json:"uuid,omitempty"`
Capacity int32 `json:"capacity"`
CreatedAt string `json:"created_at"`
Decisions []Decision `json:"decisions"`
Events []AlertEvent `json:"events"`
EventsCount int32 `json:"events_count"`
Leakspeed string `json:"leakspeed"`
MachineID string `json:"machine_id,omitempty"`
Message string `json:"message"`
Remediation bool `json:"remediation"`
Scenario string `json:"scenario"`
ScenarioHash string `json:"scenario_hash"`
ScenarioVersion string `json:"scenario_version"`
Simulated bool `json:"simulated"`
Source AlertSource `json:"source"`
StartAt string `json:"start_at"`
StopAt string `json:"stop_at"`
}
// -----------------------------------------------------------------------
// CLI types (cscli output)
// -----------------------------------------------------------------------
type Bouncer struct {
APIKey string `json:"api_key"`
AuthType string `json:"auth_type"`
AutoCreated bool `json:"auto_created"`
CreatedAt string `json:"created_at"`
IPAddress string `json:"ip_address"`
LastPull string `json:"last_pull"`
Name string `json:"name"`
Revoked bool `json:"revoked"`
Type string `json:"type"`
Version string `json:"version"`
}
type AddBouncerResult struct {
Name string
APIKey string
}
type Machine struct {
AuthType string `json:"auth_type"`
CreatedAt string `json:"createdAt"`
IPAddress string `json:"ipAddress"`
IsValidated bool `json:"isValidated"`
LastHeartbeat string `json:"last_heartbeat"`
LastPush string `json:"lastPush"`
MachineID string `json:"machineId"`
Scenarios string `json:"scenarios"`
Status string `json:"status"`
Version string `json:"version"`
}
type HubItem struct {
Author string `json:"author"`
Description string `json:"description"`
Downloaded bool `json:"downloaded"`
Installed bool `json:"installed"`
Local bool `json:"local"`
Name string `json:"name"`
Path string `json:"path"`
Stage string `json:"stage"`
Status string `json:"status"`
Tainted bool `json:"tainted"`
UpToDate bool `json:"up_to_date"`
Version string `json:"version"`
}
type MetricsSection struct {
Title string
Headers []string
Rows [][]string
}
// -----------------------------------------------------------------------
// Allowlist types (cscli allowlists)
// -----------------------------------------------------------------------
type AllowlistItem struct {
Comment string `json:"comment"`
Expiry string `json:"expiry"`
Value string `json:"value"`
}
type Allowlist struct {
Description string `json:"description"`
Items []AllowlistItem `json:"items"`
Name string `json:"name"`
}