models

package
v1.0.213 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2023 License: Apache-2.0 Imports: 24 Imported by: 40

Documentation

Index

Constants

View Source
const (
	CheckStatusHealthy   = "healthy"
	CheckStatusUnhealthy = "unhealthy"
)
View Source
const (
	ConfigClassCluster        = "Cluster"
	ConfigClassDatabase       = "Database"
	ConfigClassDeployment     = "Deployment"
	ConfigClassNamespace      = "Namespace"
	ConfigClassNode           = "Node"
	ConfigClassPod            = "Pod"
	ConfigClassVirtualMachine = "VirtualMachine"
)

Config classes

View Source
const (
	ConfigStatusCordoned   = "Cordoned"
	ConfigStatusCordoning  = "Cordoning"
	ConfigStatusDeleted    = "Deleted"
	ConfigStatusDeleting   = "Deleting"
	ConfigStatusFailed     = "Failed"
	ConfigStatusPending    = "Pending"
	ConfigStatusRunning    = "Running"
	ConfigStatusStarting   = "Starting"
	ConfigStatusStopped    = "Stopped"
	ConfigStatusStopping   = "Stopping"
	ConfigStatusSucceeded  = "Succeeded"
	ConfigStatusUncordoned = "Uncordoned"
	ConfigStatusUnknown    = "Unknown"
)

Config Statuses

View Source
const (
	AnalysisStatusOpen     = "open"
	AnalysisStatusResolved = "resolved"
	AnalysisStatusSilenced = "silenced"
)

Config Analysis statuses

View Source
const (
	ConnectionTypeAWS            = "aws"
	ConnectionTypeAzure          = "azure"
	ConnectionTypeAzureDevops    = "azure_devops"
	ConnectionTypeDiscord        = "discord"
	ConnectionTypeDynatrace      = "dynatrace"
	ConnectionTypeElasticSearch  = "elasticsearch"
	ConnectionTypeEmail          = "email"
	ConnectionTypeGCP            = "google_cloud"
	ConnectionTypeGenericWebhook = "generic_webhook"
	ConnectionTypeGit            = "git"
	ConnectionTypeGithub         = "github"
	ConnectionTypeGoogleChat     = "google_chat"
	ConnectionTypeHTTP           = "http"
	ConnectionTypeIFTTT          = "ifttt"
	ConnectionTypeJMeter         = "jmeter"
	ConnectionTypeKubernetes     = "kubernetes"
	ConnectionTypeLDAP           = "ldap"
	ConnectionTypeMatrix         = "matrix"
	ConnectionTypeMattermost     = "mattermost"
	ConnectionTypeMongo          = "mongo"
	ConnectionTypeMySQL          = "mysql"
	ConnectionTypeNtfy           = "ntfy"
	ConnectionTypeOpsGenie       = "opsgenie"
	ConnectionTypePostgres       = "postgres"
	ConnectionTypePrometheus     = "prometheus"
	ConnectionTypePushbullet     = "pushbullet"
	ConnectionTypePushover       = "pushover"
	ConnectionTypeRedis          = "redis"
	ConnectionTypeRestic         = "restic"
	ConnectionTypeRocketchat     = "rocketchat"
	ConnectionTypeSFTP           = "sftp"
	ConnectionTypeSlack          = "slack"
	ConnectionTypeSlackWebhook   = "slackwebhook"
	ConnectionTypeSMB            = "smb"
	ConnectionTypeSQLServer      = "sql_server"
	ConnectionTypeTeams          = "teams"
	ConnectionTypeTelegram       = "telegram"
	ConnectionTypeWebhook        = "webhook"
	ConnectionTypeWindows        = "windows"
	ConnectionTypeZulipChat      = "zulip_chat"
)

List of all connection types

View Source
const (
	StatusRunning  = "RUNNING"
	StatusSuccess  = "SUCCESS"
	StatusWarning  = "WARNING"
	StatusFinished = "FINISHED"
	StatusFailed   = "FAILED"
)
View Source
const (
	SourceCRD        = "KubernetesCRD"
	SourceConfigFile = "ConfigFile"
	SourceUI         = "UI"
)
View Source
const TimeFormat = "2006-01-02T15:04:05"

Variables

Functions

func SetProperties added in v1.0.145

func SetProperties(db *gorm.DB, props []AppProperty) error

func SetPropertiesInDBFromFile added in v1.0.145

func SetPropertiesInDBFromFile(db *gorm.DB, filename string) error

Types

type AccessToken added in v1.0.143

type AccessToken struct {
	ID        uuid.UUID `gorm:"default:generate_ulid()"`
	Name      string    `gorm:"not null"`
	Value     string    `gorm:"not null"`
	PersonID  uuid.UUID
	ExpiresAt time.Time
	CreatedAt time.Time
}

func (AccessToken) TableName added in v1.0.143

func (AccessToken) TableName() string

type Agent added in v1.0.91

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"`
	UpdatedAt   time.Time           `json:"updated_at" time_format:"postgres_timestamp"`
}

func (Agent) AsMap added in v1.0.171

func (t Agent) AsMap(removeFields ...string) map[string]any

type AnalysisType added in v1.0.117

type AnalysisType string
const (
	AnalysisTypeAvailability   AnalysisType = "availability"
	AnalysisTypeCompliance     AnalysisType = "compliance"
	AnalysisTypeCost           AnalysisType = "cost"
	AnalysisTypeIntegration    AnalysisType = "integration"
	AnalysisTypeOther          AnalysisType = "other"
	AnalysisTypePerformance    AnalysisType = "performance"
	AnalysisTypeRecommendation AnalysisType = "recommendation"
	AnalysisTypeReliability    AnalysisType = "reliability"
	AnalysisTypeSecurity       AnalysisType = "security"
	AnalysisTypeTechDebt       AnalysisType = "technical_debt"
)

type AppProperty added in v1.0.144

type AppProperty struct {
	Name      string     `json:"name,omitempty"`
	Value     string     `json:"value,omitempty"`
	CreatedBy *uuid.UUID `json:"created_by,omitempty"`
	CreatedAt time.Time  `json:"created_at,omitempty" time_format:"postgres_timestamp" gorm:"default:CURRENT_TIMESTAMP()"`
	UpdatedAt time.Time  `json:"updated_at,omitempty" time_format:"postgres_timestamp" gorm:"default:CURRENT_TIMESTAMP()"`
	DeletedAt *time.Time `json:"deleted_at,omitempty" time_format:"postgres_timestamp" gorm:"default:CURRENT_TIMESTAMP()"`
}

type Canary added in v1.0.15

type Canary struct {
	ID        uuid.UUID           `json:"id" yaml:"id" gorm:"default:generate_ulid()"`
	Name      string              `json:"name" yaml:"name"`
	Namespace string              `json:"namespace" yaml:"namespace"`
	AgentID   uuid.UUID           `json:"agent_id" yaml:"agent_id"`
	Spec      types.JSON          `json:"spec" yaml:"spec"`
	Labels    types.JSONStringMap `json:"labels,omitempty" yaml:"labels,omitempty"`
	Source    string              `json:"source,omitempty" yaml:"source,omitempty"`
	Checks    types.JSONStringMap `gorm:"-" json:"checks,omitempty" yaml:"checks,omitempty"`
	CreatedAt time.Time           `json:"created_at" yaml:"created_at" time_format:"postgres_timestamp"`
	UpdatedAt time.Time           `json:"updated_at" yaml:"updated_at" time_format:"postgres_timestamp"`
	DeletedAt *time.Time          `json:"deleted_at,omitempty" yaml:"deleted_at,omitempty" time_format:"postgres_timestamp"`
}

func (Canary) AsMap added in v1.0.129

func (c Canary) AsMap(removeFields ...string) map[string]any

func (Canary) GetCheckID added in v1.0.15

func (c Canary) GetCheckID(checkName string) string

func (Canary) TableName added in v1.0.21

func (c Canary) TableName() string

type Check added in v1.0.15

type Check struct {
	ID                 uuid.UUID           `json:"id" gorm:"default:generate_ulid()"`
	CanaryID           uuid.UUID           `json:"canary_id"`
	AgentID            uuid.UUID           `json:"agent_id,omitempty"`
	Spec               types.JSON          `json:"-"`
	Type               string              `json:"type"`
	Name               string              `json:"name"`
	Labels             types.JSONStringMap `json:"labels" gorm:"type:jsonstringmap"`
	Description        string              `json:"description,omitempty"`
	Status             CheckHealthStatus   `json:"status,omitempty"`
	Owner              string              `json:"owner,omitempty"`
	Severity           Severity            `json:"severity,omitempty"`
	Icon               string              `json:"icon,omitempty"`
	Transformed        bool                `json:"transformed,omitempty"`
	LastRuntime        *time.Time          `json:"last_runtime,omitempty"`
	NextRuntime        *time.Time          `json:"next_runtime,omitempty"`
	LastTransitionTime *time.Time          `json:"last_transition_time,omitempty"`
	CreatedAt          *time.Time          `json:"created_at,omitempty"`
	UpdatedAt          *time.Time          `json:"updated_at,omitempty"`
	DeletedAt          *time.Time          `json:"deleted_at,omitempty"`
	SilencedAt         *time.Time          `json:"silenced_at,omitempty"`

	// Auxiliary fields
	CanaryName   string        `json:"canary_name,omitempty" gorm:"-"`
	Namespace    string        `json:"namespace,omitempty"  gorm:"-"`  // Namespace of the parent canary
	ComponentIDs []string      `json:"components,omitempty"  gorm:"-"` // Linked component ids
	Uptime       types.Uptime  `json:"uptime,omitempty"  gorm:"-"`
	Latency      types.Latency `json:"latency,omitempty"  gorm:"-"`
	Statuses     []CheckStatus `json:"checkStatuses,omitempty"  gorm:"-"`
	DisplayType  string        `json:"display_type,omitempty"  gorm:"-"`
}

func (Check) AsMap added in v1.0.129

func (c Check) AsMap(removeFields ...string) map[string]any

func (Check) GetDescription added in v1.0.15

func (c Check) GetDescription() string

func (Check) ToString added in v1.0.15

func (c Check) ToString() string

type CheckComponentRelationship added in v1.0.77

type CheckComponentRelationship struct {
	ComponentID uuid.UUID  `json:"component_id,omitempty"`
	CheckID     uuid.UUID  `json:"check_id,omitempty"`
	CanaryID    uuid.UUID  `json:"canary_id,omitempty"`
	SelectorID  string     `json:"selector_id,omitempty"`
	CreatedAt   time.Time  `json:"created_at,omitempty"`
	UpdatedAt   time.Time  `json:"updated_at,omitempty"`
	DeletedAt   *time.Time `json:"deleted_at,omitempty"`
}

func (CheckComponentRelationship) TableName added in v1.0.77

func (CheckComponentRelationship) TableName() string

type CheckHealthStatus added in v1.0.60

type CheckHealthStatus string

type CheckStatus added in v1.0.15

type CheckStatus struct {
	CheckID   uuid.UUID `json:"check_id" gorm:"primaryKey"`
	Status    bool      `json:"status"`
	Invalid   bool      `json:"invalid,omitempty"`
	Time      string    `json:"time" gorm:"primaryKey"`
	Duration  int       `json:"duration"`
	Message   string    `json:"message,omitempty"`
	Error     string    `json:"error,omitempty"`
	Detail    any       `json:"-" gorm:"-"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	// IsPushed when set to true indicates that the check status has been pushed to upstream.
	IsPushed bool `json:"is_pushed,omitempty"`
}

func (CheckStatus) AsMap added in v1.0.172

func (s CheckStatus) AsMap(removeFields ...string) map[string]any

func (CheckStatus) GetTime added in v1.0.15

func (s CheckStatus) GetTime() (time.Time, error)

func (CheckStatus) TableName added in v1.0.21

func (CheckStatus) TableName() string

type CheckStatusAggregate1d added in v1.0.44

type CheckStatusAggregate1d struct {
	CheckID   string    `gorm:"column:check_id"`
	CreatedAt time.Time `gorm:"column:created_at"`
	Duration  int       `gorm:"column:duration"`
	Total     int       `gorm:"column:total"`
	Passed    int       `gorm:"column:passed"`
	Failed    int       `gorm:"column:failed"`
}

CheckStatusAggregate1d represents the `check_statuses_1d` table

func (CheckStatusAggregate1d) TableName added in v1.0.44

func (CheckStatusAggregate1d) TableName() string

type CheckStatusAggregate1h added in v1.0.44

type CheckStatusAggregate1h struct {
	CheckID   string    `gorm:"column:check_id"`
	CreatedAt time.Time `gorm:"column:created_at"`
	Duration  int       `gorm:"column:duration"`
	Total     int       `gorm:"column:total"`
	Passed    int       `gorm:"column:passed"`
	Failed    int       `gorm:"column:failed"`
}

CheckStatusAggregate1h represents the `check_statuses_1h` table

func (CheckStatusAggregate1h) TableName added in v1.0.44

func (CheckStatusAggregate1h) TableName() string

type CheckSummary added in v1.0.164

type CheckSummary struct {
	ID                 uuid.UUID           `json:"id"`
	CanaryID           uuid.UUID           `json:"canary_id"`
	Uptime             types.Uptime        `json:"uptime"`
	Latency            types.Latency       `json:"latency"`
	LastTransitionTime *time.Time          `json:"last_transition_time,omitempty"`
	Type               string              `json:"type"`
	Icon               string              `json:"icon"`
	Name               string              `json:"name"`
	Status             string              `json:"status"`
	Description        string              `json:"description"`
	Namespace          string              `json:"namespace"`
	CanaryName         string              `json:"canary_name"`
	Labels             types.JSONStringMap `json:"labels"`
	Severity           string              `json:"severity"`
	Owner              string              `json:"owner"`
	LastRuntime        *time.Time          `json:"last_runtime,omitempty"`
	CreatedAt          time.Time           `json:"created_at"`
	UpdatedAt          time.Time           `json:"updated_at"`
	DeletedAt          *time.Time          `json:"deleted_at,omitempty"`
	SilencedAt         *time.Time          `json:"silenced_at,omitempty"`
}

CheckSummary represents the `check_summary` view

func (CheckSummary) AsMap added in v1.0.175

func (t CheckSummary) AsMap(removeFields ...string) map[string]any

func (*CheckSummary) TableName added in v1.0.164

func (t *CheckSummary) TableName() string

type Checks added in v1.0.15

type Checks []*Check

func (Checks) Find added in v1.0.15

func (c Checks) Find(key string) *Check

func (Checks) Len added in v1.0.15

func (c Checks) Len() int

func (Checks) Less added in v1.0.15

func (c Checks) Less(i, j int) bool

func (Checks) Swap added in v1.0.15

func (c Checks) Swap(i, j int)

type Comment added in v1.0.67

type Comment struct {
	ID                uuid.UUID  `json:"id" gorm:"primaryKey"`
	CreatedBy         uuid.UUID  `json:"created_by,omitempty"`
	Comment           string     `json:"comment,omitempty"`
	ExternalID        *string    `json:"external_id,omitempty"`
	ExternalCreatedBy *string    `json:"external_created_by,omitempty"`
	IncidentID        uuid.UUID  `json:"incident_id,omitempty"`
	ResponderID       *uuid.UUID `json:"responder_id,omitempty"`
	HypothesisID      *uuid.UUID `json:"hypothesis_id,omitempty"`
	Read              []int16    `json:"read,omitempty" gorm:"type:smallint[]"`
	CreatedAt         time.Time  `json:"created_at,omitempty" time_format:"postgres_timestamp" gorm:"default:CURRENT_TIMESTAMP()"`
	UpdatedAt         time.Time  `json:"updated_at,omitempty" time_format:"postgres_timestamp" gorm:"default:CURRENT_TIMESTAMP()"`
}

func (Comment) AsMap added in v1.0.129

func (c Comment) AsMap(removeFields ...string) map[string]any

type Component added in v1.0.15

type Component struct {
	ID              uuid.UUID               `json:"id,omitempty" gorm:"default:generate_ulid()"` //nolint
	TopologyID      *uuid.UUID              `json:"topology_id,omitempty"`
	AgentID         uuid.UUID               `json:"agent_id,omitempty"`
	ExternalId      string                  `json:"external_id,omitempty"` //nolint
	ParentId        *uuid.UUID              `json:"parent_id,omitempty"`   //nolint
	Name            string                  `json:"name,omitempty"`
	Text            string                  `json:"text,omitempty"`
	TopologyType    string                  `json:"topology_type,omitempty"`
	Namespace       string                  `json:"namespace,omitempty"`
	Labels          types.JSONStringMap     `json:"labels,omitempty" gorm:"default:null"`
	Hidden          bool                    `json:"hidden,omitempty"`
	Silenced        bool                    `json:"silenced,omitempty"`
	Status          types.ComponentStatus   `json:"status,omitempty"`
	Description     string                  `json:"description,omitempty"`
	Lifecycle       string                  `json:"lifecycle,omitempty"`
	LogSelectors    types.LogSelectors      `json:"logs,omitempty" gorm:"column:log_selectors;default:null"`
	Tooltip         string                  `json:"tooltip,omitempty"`
	StatusReason    string                  `json:"status_reason,omitempty"`
	Schedule        string                  `json:"schedule,omitempty"`
	Icon            string                  `json:"icon,omitempty"`
	Type            string                  `json:"type,omitempty"`
	Owner           string                  `json:"owner,omitempty"`
	Selectors       types.ResourceSelectors `json:"selectors,omitempty" gorm:"resourceSelectors;default:null" swaggerignore:"true"`
	Configs         types.ConfigQueries     `json:"configs,omitempty" gorm:"default:null"`
	ComponentChecks types.ComponentChecks   `json:"componentChecks,omitempty" gorm:"default:null"`
	Properties      Properties              `json:"properties,omitempty" gorm:"type:properties;default:null"`
	Path            string                  `json:"path,omitempty"`
	Summary         types.Summary           `json:"summary,omitempty" gorm:"type:summary;default:null"`
	IsLeaf          bool                    `json:"is_leaf"`
	CostPerMinute   float64                 `json:"cost_per_minute,omitempty" gorm:"column:cost_per_minute"`
	CostTotal1d     float64                 `json:"cost_total_1d,omitempty" gorm:"column:cost_total_1d"`
	CostTotal7d     float64                 `json:"cost_total_7d,omitempty" gorm:"column:cost_total_7d"`
	CostTotal30d    float64                 `json:"cost_total_30d,omitempty" gorm:"column:cost_total_30d"`
	CreatedBy       *uuid.UUID              `json:"created_by,omitempty"`
	CreatedAt       time.Time               `json:"created_at,omitempty" time_format:"postgres_timestamp" gorm:"default:CURRENT_TIMESTAMP()"`
	UpdatedAt       time.Time               `json:"updated_at,omitempty" time_format:"postgres_timestamp" gorm:"default:CURRENT_TIMESTAMP()"`
	DeletedAt       *time.Time              `json:"deleted_at,omitempty" time_format:"postgres_timestamp" swaggerignore:"true"`

	// Auxiliary fields
	Checks         map[string]int            `json:"checks,omitempty" gorm:"-"`
	Incidents      map[string]map[string]int `json:"incidents,omitempty" gorm:"-"`
	Analysis       map[string]map[string]int `json:"analysis,omitempty" gorm:"-"`
	Components     Components                `json:"components,omitempty" gorm:"-"`
	Order          int                       `json:"order,omitempty"  gorm:"-"`
	SelectorID     string                    `json:"-" gorm:"-"`
	RelationshipID *uuid.UUID                `json:"relationship_id,omitempty" gorm:"-"`
	Children       []string                  `json:"children,omitempty" gorm:"-"`
	Parents        []string                  `json:"parents,omitempty" gorm:"-"`
}

func (*Component) AsMap added in v1.0.175

func (c *Component) AsMap(removeFields ...string) map[string]any

func (Component) Clone added in v1.0.83

func (component Component) Clone() Component

func (Component) GetAsEnvironment added in v1.0.49

func (component Component) GetAsEnvironment() map[string]interface{}

func (*Component) GetStatus added in v1.0.24

func (c *Component) GetStatus() types.ComponentStatus

func (Component) IsHealthy added in v1.0.83

func (component Component) IsHealthy() bool

func (Component) String added in v1.0.83

func (component Component) String() string

func (*Component) Summarize added in v1.0.24

func (c *Component) Summarize() types.Summary

type ComponentRelationship added in v1.0.15

type ComponentRelationship struct {
	ComponentID      uuid.UUID  `gorm:"column:component_id" json:"component_id,omitempty"`
	RelationshipID   uuid.UUID  `gorm:"column:relationship_id" json:"relationship_id,omitempty"`
	SelectorID       string     `gorm:"column:selector_id" json:"selector_id,omitempty"`
	RelationshipPath string     `gorm:"column:relationship_path" json:"relationship_path,omitempty"`
	CreatedAt        time.Time  `gorm:"column:created_at" json:"created_at,omitempty"`
	UpdatedAt        time.Time  `gorm:"column:updated_at" json:"updated_at,omitempty"`
	DeletedAt        *time.Time `gorm:"column:deleted_at" json:"deleted_at,omitempty"`
}

func (ComponentRelationship) TableName added in v1.0.15

func (cr ComponentRelationship) TableName() string

type Components added in v1.0.15

type Components []*Component

func (Components) Debug added in v1.0.83

func (components Components) Debug(prefix string) string

func (Components) Find added in v1.0.83

func (components Components) Find(name string) *Component

func (Components) Map added in v1.0.25

func (components Components) Map(fn func(c *Component))

func (Components) Summarize added in v1.0.83

func (components Components) Summarize() types.Summary

func (Components) Walk added in v1.0.83

func (components Components) Walk() Components

type ConfigAnalysis added in v1.0.5

type ConfigAnalysis struct {
	ID            uuid.UUID     `gorm:"primaryKey;unique_index;not null;column:id" json:"id"`
	ExternalID    string        `gorm:"-"`
	ConfigType    string        `gorm:"-"`
	ConfigID      uuid.UUID     `gorm:"column:config_id;default:''" json:"config_id"`
	ScraperID     *uuid.UUID    `gorm:"column:scraper_id;default:null" json:"scraper_id"`
	Analyzer      string        `gorm:"column:analyzer" json:"analyzer" faker:"oneof: ec2-instance-no-public-ip, eks-endpoint-no-public-access"`
	Message       string        `gorm:"column:message" json:"message"`
	Summary       string        `gorm:"column:summary;default:null" json:"summary,omitempty"`
	Status        string        `gorm:"column:status;default:null" json:"status,omitempty" faker:"oneof: open, resolved, silenced"`
	Severity      Severity      `gorm:"column:severity" json:"severity" faker:"oneof: critical, high, medium, low, info"`
	AnalysisType  AnalysisType  `gorm:"column:analysis_type" json:"analysis_type" faker:"oneof: availability, compliance, cost, security, performance"`
	Analysis      types.JSONMap `gorm:"column:analysis" json:"analysis,omitempty"`
	Source        string        `gorm:"column:source" json:"source,omitempty"`
	FirstObserved *time.Time    `gorm:"column:first_observed;<-:false" json:"first_observed"`
	LastObserved  *time.Time    `gorm:"column:last_observed" json:"last_observed"`
}

func (ConfigAnalysis) String added in v1.0.5

func (a ConfigAnalysis) String() string

func (ConfigAnalysis) TableName added in v1.0.5

func (a ConfigAnalysis) TableName() string

type ConfigChange added in v1.0.5

type ConfigChange struct {
	ExternalID       string     `gorm:"-"`
	ConfigType       string     `gorm:"-"`
	ExternalChangeId string     `gorm:"column:external_change_id" json:"external_change_id"`
	ID               string     `gorm:"primaryKey;unique_index;not null;column:id" json:"id"`
	ConfigID         string     `gorm:"column:config_id;default:''" json:"config_id"`
	ChangeType       string     `gorm:"column:change_type" json:"change_type" faker:"oneof:  RunInstances, diff" `
	Severity         Severity   `gorm:"column:severity" json:"severity"  faker:"oneof: critical, high, medium, low, info"`
	Source           string     `gorm:"column:source" json:"source"`
	Summary          string     `gorm:"column:summary;default:null" json:"summary,omitempty"`
	Patches          string     `gorm:"column:patches;default:null" json:"patches,omitempty"`
	Diff             string     `gorm:"column:diff;default:null" json:"diff,omitempty"`
	Details          types.JSON `gorm:"column:details" json:"details,omitempty"`
	CreatedAt        *time.Time `gorm:"column:created_at" json:"created_at"`
}

ConfigChange represents the config change database table

func (*ConfigChange) BeforeCreate added in v1.0.64

func (c *ConfigChange) BeforeCreate(tx *gorm.DB) error

BeforeCreate is a user defined hook for Gorm. It will be called when creating a record.

func (ConfigChange) GetExternalID added in v1.0.5

func (c ConfigChange) GetExternalID() ExternalID

func (ConfigChange) String added in v1.0.5

func (c ConfigChange) String() string

func (ConfigChange) TableName added in v1.0.5

func (c ConfigChange) TableName() string

type ConfigComponentRelationship added in v1.0.15

type ConfigComponentRelationship struct {
	ComponentID uuid.UUID  `gorm:"column:component_id" json:"component_id,omitempty"`
	ConfigID    uuid.UUID  `gorm:"column:config_id" json:"config_id,omitempty"`
	SelectorID  string     `gorm:"column:selector_id" json:"selector_id,omitempty"`
	CreatedAt   time.Time  `gorm:"column:created_at" json:"created_at,omitempty"`
	UpdatedAt   time.Time  `gorm:"column:updated_at" json:"updated_at,omitempty"`
	DeletedAt   *time.Time `gorm:"column:deleted_at" json:"deleted_at,omitempty"`
}

func (ConfigComponentRelationship) TableName added in v1.0.15

func (cr ConfigComponentRelationship) TableName() string

type ConfigItem added in v1.0.5

type ConfigItem struct {
	ID            uuid.UUID            `json:"id" faker:"uuid_hyphenated"`
	ScraperID     *string              `json:"scraper_id,omitempty"`
	AgentID       uuid.UUID            `json:"agent_id,omitempty"`
	ConfigClass   string               `json:"config_class" faker:"oneof:File,EC2Instance,KubernetesPod" `
	ExternalID    pq.StringArray       `gorm:"type:[]text" json:"external_id,omitempty"`
	Type          *string              `json:"type,omitempty"`
	Status        *string              `json:"status,omitempty" gorm:"default:null"`
	Name          *string              `json:"name,omitempty" faker:"name"  `
	Namespace     *string              `json:"namespace,omitempty" faker:"oneof: default, demo, prod, staging" `
	Description   *string              `json:"description,omitempty"`
	Config        *string              `json:"config,omitempty"  `
	Source        *string              `json:"source,omitempty"  `
	ParentID      *uuid.UUID           `json:"parent_id,omitempty" faker:"-"`
	Path          string               `json:"path,omitempty" faker:"-"`
	CostPerMinute float64              `gorm:"column:cost_per_minute;default:null" json:"cost_per_minute,omitempty"`
	CostTotal1d   float64              `gorm:"column:cost_total_1d;default:null" json:"cost_total_1d,omitempty"`
	CostTotal7d   float64              `gorm:"column:cost_total_7d;default:null" json:"cost_total_7d,omitempty"`
	CostTotal30d  float64              `gorm:"column:cost_total_30d;default:null" json:"cost_total_30d,omitempty"`
	Tags          *types.JSONStringMap `json:"tags,omitempty" faker:"tags"`
	CreatedAt     time.Time            `json:"created_at"`
	UpdatedAt     time.Time            `json:"updated_at"`
}

ConfigItem represents the config item database table

func (ConfigItem) AsMap added in v1.0.175

func (ci ConfigItem) AsMap(removeFields ...string) map[string]any

func (ConfigItem) ConfigJSONStringMap added in v1.0.5

func (ci ConfigItem) ConfigJSONStringMap() (map[string]any, error)

func (ConfigItem) GetSelectorID added in v1.0.83

func (c ConfigItem) GetSelectorID() string

func (*ConfigItem) SetParent added in v1.0.5

func (ci *ConfigItem) SetParent(parent *ConfigItem)

func (ConfigItem) String added in v1.0.5

func (ci ConfigItem) String() string

func (ConfigItem) TableName added in v1.0.5

func (ConfigItem) TableName() string

type ConfigRelationship added in v1.0.5

type ConfigRelationship struct {
	ConfigID   string     `gorm:"column:config_id" json:"config_id"`
	RelatedID  string     `gorm:"column:related_id" json:"related_id"`
	Relation   string     `gorm:"column:relation" json:"relation"`
	SelectorID string     `gorm:"selector_id" json:"selector_id"`
	CreatedAt  time.Time  `gorm:"column:created_at" json:"created_at,omitempty"`
	UpdatedAt  time.Time  `gorm:"column:updated_at" json:"updated_at,omitempty"`
	DeletedAt  *time.Time `gorm:"column:deleted_at" json:"deleted_at,omitempty"`
}

func (ConfigRelationship) TableName added in v1.0.5

func (cr ConfigRelationship) TableName() string

type ConfigScraper added in v1.0.53

type ConfigScraper struct {
	ID          uuid.UUID  `json:"id"`
	AgentID     uuid.UUID  `json:"agent_id,omitempty"`
	Name        string     `json:"name"`
	Description string     `json:"description,omitempty"`
	Spec        string     `json:"spec,omitempty"`
	Source      string     `json:"source,omitempty"`
	CreatedBy   *uuid.UUID `json:"created_by,omitempty"`
	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`
	DeletedAt   *time.Time `json:"deleted_at,omitempty"`
}

ConfigScraper represents the config_scrapers database table

func (ConfigScraper) AsMap added in v1.0.175

func (c ConfigScraper) AsMap(removeFields ...string) map[string]any

func (*ConfigScraper) BeforeCreate added in v1.0.53

func (cs *ConfigScraper) BeforeCreate(tx *gorm.DB) error

BeforeCreate GORM hook

func (ConfigScraper) TableName added in v1.0.53

func (c ConfigScraper) TableName() string

type Connection added in v1.0.45

type Connection struct {
	ID          uuid.UUID           `gorm:"primaryKey;unique_index;not null;column:id" json:"id" faker:"uuid_hyphenated"  `
	Name        string              `gorm:"column:name" json:"name" faker:"name"  `
	Namespace   string              `gorm:"column:namespace" json:"namespace"`
	Type        string              `gorm:"column:type" json:"type" faker:"oneof:  postgres, mysql, aws, gcp, http" `
	URL         string              `gorm:"column:url" json:"url,omitempty" faker:"url" template:"true"`
	Username    string              `gorm:"column:username" json:"username,omitempty" faker:"username"  `
	Password    string              `gorm:"column:password" json:"password,omitempty" faker:"password"  `
	Properties  types.JSONStringMap `gorm:"column:properties" json:"properties,omitempty" faker:"-"  `
	Certificate string              `gorm:"column:certificate" json:"certificate,omitempty" faker:"-"  `
	InsecureTLS bool                `gorm:"column:insecure_tls;default:false" json:"insecure_tls,omitempty" faker:"-"  `
	CreatedAt   time.Time           `gorm:"column:created_at;default:now()" json:"created_at,omitempty" faker:"-"  `
	UpdatedAt   time.Time           `gorm:"column:updated_at;default:now()" json:"updated_at,omitempty" faker:"-"  `
	CreatedBy   *uuid.UUID          `gorm:"column:created_by" json:"created_by,omitempty" faker:"-"  `
}

func (Connection) AsEnv added in v1.0.200

func (c Connection) AsEnv(ctx context.Context) EnvPrep

AsEnv generates environment variables and a configuration file content based on the connection type.

func (Connection) AsGoGetterURL added in v1.0.200

func (c Connection) AsGoGetterURL() (string, error)

AsGoGetterURL returns the connection as a url that's supported by https://github.com/hashicorp/go-getter Connection details are added to the url as query params

func (Connection) AsMap added in v1.0.175

func (c Connection) AsMap(removeFields ...string) map[string]any

func (Connection) Merge added in v1.0.213

func (c Connection) Merge(ctx types.GetEnvVarFromCache, from any) (*Connection, error)

func (Connection) String added in v1.0.48

func (c Connection) String() string

type EnvPrep added in v1.0.200

type EnvPrep struct {
	// Env is the connection credentials in environment variables
	Env []string

	// CmdEnvs is a list of env vars that will be passed to the command
	CmdEnvs []string

	// List of commands that need to be run before the actual command.
	// These commands will setup the connection.
	PreRuns []*exec.Cmd

	// File contains the content of the configuration file based on the connection
	Files map[string]bytes.Buffer
}

func (*EnvPrep) Inject added in v1.0.200

func (c *EnvPrep) Inject(ctx context.Context, cmd *exec.Cmd) ([]*exec.Cmd, error)

Inject creates the config file & injects the necessary environment variable into the command

type Evidence added in v1.0.24

type Evidence struct {
	ID               uuid.UUID     `json:"id"`
	HypothesisID     uuid.UUID     `json:"hypothesis_id"`
	ConfigID         *uuid.UUID    `json:"config_id"`
	ConfigChangeID   *uuid.UUID    `json:"config_change_id"`
	ConfigAnalysisID *uuid.UUID    `json:"config_analysis_id"`
	ComponentID      *uuid.UUID    `json:"component_id"`
	CheckID          *uuid.UUID    `json:"check_id"`
	Description      string        `json:"description"`
	DefinitionOfDone bool          `json:"definition_of_done"`
	Done             bool          `json:"done"`
	Factor           bool          `json:"factor"`
	Mitigator        bool          `json:"mitigator"`
	CreatedBy        uuid.UUID     `json:"created_by"`
	Type             string        `json:"type"`
	Script           string        `json:"script"`
	ScriptResult     string        `json:"script_result"`
	Evidence         types.JSONMap `json:"evidence"`
	Properties       types.JSONMap `json:"properties"`
	CreatedAt        time.Time     `json:"created_at"`
	UpdatedAt        time.Time     `json:"updated_at"`
}

func (Evidence) AsMap added in v1.0.129

func (i Evidence) AsMap(removeFields ...string) map[string]any

type EvidenceCanaryCheck added in v1.0.24

type EvidenceCanaryCheck struct {
}

type EvidenceComponent added in v1.0.24

type EvidenceComponent struct {
}

type EvidenceConfig added in v1.0.24

type EvidenceConfig struct {
	ID            uuid.UUID           `json:"id"`
	Lines         []string            `json:"lines"`
	SelectedLines types.JSONStringMap `json:"selected_lines"`
}

type EvidenceConfigAnalysis added in v1.0.24

type EvidenceConfigAnalysis struct {
	ID uuid.UUID `json:"id"`
}

type EvidenceConfigChange added in v1.0.24

type EvidenceConfigChange struct {
	ID uuid.UUID `json:"id"`
}

type EvidenceLogs added in v1.0.24

type EvidenceLogs struct {
	Lines []LogLine `json:"lines"`
}

type ExternalID added in v1.0.5

type ExternalID struct {
	ConfigType string
	ExternalID []string
}

func (ExternalID) CacheKey added in v1.0.5

func (e ExternalID) CacheKey() string

func (ExternalID) IsEmpty added in v1.0.5

func (e ExternalID) IsEmpty() bool

func (ExternalID) String added in v1.0.5

func (e ExternalID) String() string

func (ExternalID) WhereClause added in v1.0.5

func (e ExternalID) WhereClause(db *gorm.DB) *gorm.DB

type Hypothesis added in v1.0.24

type Hypothesis struct {
	ID         uuid.UUID  `json:"id,omitempty" gorm:"default:generate_ulid()"`
	IncidentID uuid.UUID  `json:"incident_id,omitempty"`
	Type       string     `json:"type,omitempty"`
	Title      string     `json:"title,omitempty"`
	Status     string     `json:"status,omitempty"`
	ParentID   *uuid.UUID `json:"parent_id,omitempty"`
	TeamID     *uuid.UUID `json:"team_id,omitempty"`
	Owner      *uuid.UUID `json:"owner,omitempty"`
	CreatedAt  *time.Time `json:"created_at,omitempty"`
	UpdatedAt  *time.Time `json:"updated_at,omitempty"`
	CreatedBy  uuid.UUID  `json:"created_by,omitempty"`
}

func (Hypothesis) AsMap added in v1.0.129

func (h Hypothesis) AsMap(removeFields ...string) map[string]any

func (Hypothesis) TableName added in v1.0.24

func (Hypothesis) TableName() string

type Incident added in v1.0.24

type Incident struct {
	ID             uuid.UUID      `json:"id,omitempty" gorm:"default:generate_ulid()"`
	IncidentID     string         `json:"incident_id,omitempty" gorm:"default:format_incident_id(NEXTVAL('incident_id_sequence'))"`
	Title          string         `json:"title,omitempty"`
	Description    string         `json:"description,omitempty"`
	Type           IncidentType   `json:"type,omitempty"`
	Status         IncidentStatus `json:"status,omitempty"`
	Severity       Severity       `json:"severity,omitempty"`
	CreatedAt      *time.Time     `json:"created_at,omitempty"`
	UpdatedAt      *time.Time     `json:"updated_at,omitempty"`
	Acknowledged   *time.Time     `json:"acknowledged,omitempty"`
	Resolved       *time.Time     `json:"resolved,omitempty"`
	Closed         *time.Time     `json:"closed,omitempty"`
	CreatedBy      uuid.UUID      `json:"created_by,omitempty"`
	IncidentRuleID *uuid.UUID     `json:"incident_rule_id,omitempty"`
	CommanderID    *uuid.UUID     `json:"commander_id,omitempty"`
	CommunicatorID *uuid.UUID     `json:"communicator_id,omitempty"`
}

func (Incident) AsMap added in v1.0.129

func (i Incident) AsMap(removeFields ...string) map[string]any

type IncidentStatus added in v1.0.24

type IncidentStatus string
var (
	IncidentStatusOpen      IncidentStatus = "open"
	IncidentStatusClosed    IncidentStatus = "closed"
	IncidentStatusMitigated IncidentStatus = "mitigated"
	IncidentStatusResolved  IncidentStatus = "resolved"
	IncidentStatusCancelled IncidentStatus = "cancelled"
)

type IncidentType added in v1.0.24

type IncidentType string
var (
	IncidentTypeAvailability  IncidentType = "availability"
	IncidentTypeCost          IncidentType = "cost"
	IncidentTypePerformance   IncidentType = "performance"
	IncidentTypeSecurity      IncidentType = "security"
	IncidentTypeTechnicalDebt IncidentType = "technical_debt"
	IncidentTypeCompliance    IncidentType = "compliance"
	IncidentTypeIntegration   IncidentType = "integration"
)

type JobHistory

type JobHistory struct {
	ID             uuid.UUID `gorm:"default:generate_ulid()"`
	Name           string
	SuccessCount   int
	ErrorCount     int
	Hostname       string
	DurationMillis int64
	ResourceType   string
	ResourceID     string
	Details        types.JSONMap
	Status         string
	TimeStart      time.Time
	TimeEnd        *time.Time
	Errors         []string `gorm:"-"`
}

func NewJobHistory added in v1.0.4

func NewJobHistory(name, resourceType, resourceID string) *JobHistory

func (*JobHistory) AddError

func (h *JobHistory) AddError(err string) *JobHistory

func (*JobHistory) End

func (h *JobHistory) End() *JobHistory

func (*JobHistory) IncrSuccess

func (h *JobHistory) IncrSuccess() *JobHistory

func (*JobHistory) Start

func (h *JobHistory) Start() *JobHistory
type Link struct {
	// e.g. documentation, support, playbook
	Type string `json:"type,omitempty"`
	URL  string `json:"url,omitempty"`
	Text `json:",inline"`
}

type LocalTime added in v1.0.24

type LocalTime time.Time

func (LocalTime) MarshalJSON added in v1.0.24

func (t LocalTime) MarshalJSON() ([]byte, error)

func (*LocalTime) Scan added in v1.0.24

func (t *LocalTime) Scan(v interface{}) error

func (LocalTime) String added in v1.0.24

func (t LocalTime) String() string

func (*LocalTime) UnmarshalJSON added in v1.0.24

func (t *LocalTime) UnmarshalJSON(data []byte) (err error)

func (LocalTime) Value added in v1.0.24

func (t LocalTime) Value() (driver.Value, error)

type LogLine added in v1.0.24

type LogLine struct {
	Timestamp time.Time           `json:"timestamp"`
	Message   string              `json:"message"`
	Labels    types.JSONStringMap `json:"labels"`
}

type LoggingBackend added in v1.0.40

type LoggingBackend struct {
	ID        uuid.UUID           `json:"id" gorm:"default:generate_ulid()"`
	Name      string              `json:"name"`
	Labels    types.JSONStringMap `json:"labels" gorm:"type:jsonstringmap"`
	Spec      string              `json:"spec,omitempty"`
	Source    string              `json:"source,omitempty"`
	CreatedAt time.Time           `json:"created_at,omitempty"`
	UpdatedAt time.Time           `json:"updated_at,omitempty"`
	DeletedAt *time.Time          `json:"deleted_at,omitempty"`
}

type Notification added in v1.0.129

type Notification struct {
	ID             uuid.UUID           `json:"id"`
	Events         pq.StringArray      `json:"events" gorm:"type:[]text"`
	Title          string              `json:"title,omitempty"`
	Template       string              `json:"template,omitempty"`
	Filter         string              `json:"filter,omitempty"`
	PersonID       *uuid.UUID          `json:"person_id,omitempty"`
	TeamID         *uuid.UUID          `json:"team_id,omitempty"`
	Properties     types.JSONStringMap `json:"properties,omitempty"`
	CustomServices types.JSON          `json:"custom_services,omitempty" gorm:"column:custom_services"`
	CreatedBy      *uuid.UUID          `json:"created_by,omitempty"`
	UpdatedAt      time.Time           `json:"updated_at" time_format:"postgres_timestamp" gorm:"<-:false"`
	CreatedAt      time.Time           `json:"created_at" time_format:"postgres_timestamp" gorm:"<-:false"`
	DeletedAt      *time.Time          `json:"deleted_at,omitempty"`

	// Error stores errors in notification filters (if any)
	Error *string `json:"error,omitempty"`
}

Notification represents the notifications table

func (Notification) AsMap added in v1.0.175

func (n Notification) AsMap(removeFields ...string) map[string]any

func (*Notification) HasRecipients added in v1.0.129

func (n *Notification) HasRecipients() bool

type NotificationSendHistory added in v1.0.181

type NotificationSendHistory struct {
	ID             uuid.UUID `json:"id,omitempty" gorm:"default:generate_ulid()"`
	NotificationID uuid.UUID `json:"notification_id"`
	Body           string    `json:"body,omitempty"`
	Error          *string   `json:"error,omitempty"`
	DurationMillis int64     `json:"duration_millis,omitempty"`
	CreatedAt      time.Time `json:"created_at" time_format:"postgres_timestamp"`

	// Name of the original event that caused this notification
	SourceEvent string `json:"source_event"`

	// ID of the resource this notification is for
	ResourceID uuid.UUID `json:"resource_id"`

	// ID of the person this notification is for.
	PersonID *uuid.UUID `json:"person_id"`
	// contains filtered or unexported fields
}

func NewNotificationSendHistory added in v1.0.181

func NewNotificationSendHistory(notificationID uuid.UUID) *NotificationSendHistory

func (NotificationSendHistory) AsMap added in v1.0.181

func (n NotificationSendHistory) AsMap(removeFields ...string) map[string]any

func (*NotificationSendHistory) End added in v1.0.181

func (*NotificationSendHistory) TableName added in v1.0.181

func (t *NotificationSendHistory) TableName() string

type Person added in v1.0.24

type Person struct {
	ID         uuid.UUID        `json:"id" gorm:"default:generate_ulid()"`
	Name       string           `json:"name"`
	Email      string           `json:"email,omitempty" gorm:"default:null"`
	Type       string           `json:"type,omitempty" gorm:"default:null"`
	Avatar     string           `json:"avatar,omitempty" gorm:"default:null"`
	ExternalID string           `json:"external_id,omitempty" gorm:"default:null"`
	Properties PersonProperties `json:"properties,omitempty" gorm:"default:null"`
}

func (Person) AsMap added in v1.0.172

func (person Person) AsMap(removeFields ...string) map[string]any

func (Person) TableName added in v1.0.24

func (person Person) TableName() string

type PersonProperties added in v1.0.24

type PersonProperties struct {
	Role string `json:"role,omitempty"`
}

func (*PersonProperties) Scan added in v1.0.24

func (p *PersonProperties) Scan(val any) error

func (PersonProperties) Value added in v1.0.24

func (p PersonProperties) Value() (driver.Value, error)

type Playbook added in v1.0.155

type Playbook struct {
	ID          uuid.UUID  `gorm:"default:generate_ulid()" json:"id"`
	Name        string     `json:"name"`
	Icon        string     `json:"icon,omitempty"`
	Description string     `json:"description,omitempty"`
	Spec        types.JSON `json:"spec"`
	Source      string     `json:"source"`
	CreatedBy   *uuid.UUID `json:"created_by,omitempty"`
	CreatedAt   time.Time  `json:"created_at,omitempty" time_format:"postgres_timestamp" gorm:"<-:false"`
	UpdatedAt   time.Time  `json:"updated_at,omitempty" time_format:"postgres_timestamp" gorm:"<-:false"`
	DeletedAt   *time.Time `json:"deleted_at,omitempty" time_format:"postgres_timestamp"`
}

func (Playbook) AsMap added in v1.0.175

func (p Playbook) AsMap(removeFields ...string) map[string]any

type PlaybookApproval added in v1.0.158

type PlaybookApproval struct {
	ID        uuid.UUID  `gorm:"default:generate_ulid()"`
	RunID     uuid.UUID  `json:"run_id"`
	PersonID  *uuid.UUID `json:"person_id,omitempty"`
	TeamID    *uuid.UUID `json:"team_id,omitempty"`
	CreatedAt time.Time  `json:"created_at" gorm:"<-:false"`
}

func (PlaybookApproval) AsMap added in v1.0.175

func (p PlaybookApproval) AsMap(removeFields ...string) map[string]any

type PlaybookRun added in v1.0.155

type PlaybookRun struct {
	ID            uuid.UUID           `gorm:"default:generate_ulid()"`
	PlaybookID    uuid.UUID           `json:"playbook_id"`
	Status        PlaybookRunStatus   `json:"status,omitempty"`
	CreatedAt     time.Time           `json:"created_at,omitempty" time_format:"postgres_timestamp" gorm:"<-:false"`
	StartTime     time.Time           `json:"start_time,omitempty" time_format:"postgres_timestamp"`
	ScheduledTime time.Time           `json:"scheduled_time,omitempty" time_format:"postgres_timestamp" gorm:"default:NOW(), NOT NULL"`
	EndTime       *time.Time          `json:"end_time,omitempty" time_format:"postgres_timestamp"`
	CreatedBy     *uuid.UUID          `json:"created_by,omitempty"`
	ComponentID   *uuid.UUID          `json:"component_id,omitempty"`
	CheckID       *uuid.UUID          `json:"check_id,omitempty"`
	ConfigID      *uuid.UUID          `json:"config_id,omitempty"`
	Parameters    types.JSONStringMap `json:"parameters,omitempty" gorm:"default:null"`
	AgentID       *uuid.UUID          `json:"agent_id,omitempty"`
}

func (PlaybookRun) AsMap added in v1.0.175

func (p PlaybookRun) AsMap(removeFields ...string) map[string]any

type PlaybookRunAction added in v1.0.155

type PlaybookRunAction struct {
	ID            uuid.UUID         `gorm:"default:generate_ulid()"`
	Name          string            `json:"name" gorm:"not null"`
	PlaybookRunID uuid.UUID         `json:"playbook_run_id"`
	Status        PlaybookRunStatus `json:"status,omitempty"`
	ScheduledTime time.Time         `json:"scheduled_time,omitempty" time_format:"postgres_timestamp" gorm:"default:NOW(), NOT NULL"`
	StartTime     time.Time         `json:"start_time,omitempty" time_format:"postgres_timestamp"  gorm:"default:NOW(), NOT NULL"`
	EndTime       *time.Time        `json:"end_time,omitempty" time_format:"postgres_timestamp"`
	Result        types.JSON        `json:"result,omitempty" gorm:"default:null"`
	Error         string            `json:"error,omitempty" gorm:"default:null"`
}

func (PlaybookRunAction) AsMap added in v1.0.175

func (p PlaybookRunAction) AsMap(removeFields ...string) map[string]any

type PlaybookRunStatus added in v1.0.155

type PlaybookRunStatus string

PlaybookRunStatus are statuses for a playbook run and its actions.

const (
	PlaybookRunStatusPending   PlaybookRunStatus = "pending"
	PlaybookRunStatusScheduled PlaybookRunStatus = "scheduled"
	PlaybookRunStatusRunning   PlaybookRunStatus = "running"
	PlaybookRunStatusCancelled PlaybookRunStatus = "cancelled"
	PlaybookRunStatusFailed    PlaybookRunStatus = "failed"
	PlaybookRunStatusCompleted PlaybookRunStatus = "completed"
	PlaybookRunStatusSleeping  PlaybookRunStatus = "sleeping"
)

type Properties added in v1.0.15

type Properties []*Property

func (Properties) AsJSON added in v1.0.15

func (p Properties) AsJSON() []byte

func (Properties) AsMap added in v1.0.15

func (p Properties) AsMap() map[string]any

func (Properties) Find added in v1.0.15

func (p Properties) Find(name string) *Property

func (Properties) GormDBDataType added in v1.0.15

func (Properties) GormDBDataType(db *gorm.DB, field *schema.Field) string

func (Properties) GormDataType added in v1.0.15

func (Properties) GormDataType() string

GormDataType gorm common data type

func (Properties) GormValue added in v1.0.15

func (p Properties) GormValue(ctx context.Context, db *gorm.DB) clause.Expr

func (*Properties) Scan added in v1.0.15

func (p *Properties) Scan(val any) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (Properties) Value added in v1.0.15

func (p Properties) Value() (driver.Value, error)

Scan scan value into Jsonb, implements sql.Scanner interface

type Property added in v1.0.15

type Property struct {
	Label    string `json:"label,omitempty"`
	Name     string `json:"name,omitempty"`
	Tooltip  string `json:"tooltip,omitempty"`
	Icon     string `json:"icon,omitempty"`
	Type     string `json:"type,omitempty"`
	Color    string `json:"color,omitempty"`
	Order    int    `json:"order,omitempty"`
	Headline bool   `json:"headline,omitempty"`

	// Either text or value is required, but not both.
	Text  string `json:"text,omitempty"`
	Value int64  `json:"value,omitempty"`

	// e.g. milliseconds, bytes, millicores, epoch etc.
	Unit string `json:"unit,omitempty"`
	Max  *int64 `json:"max,omitempty"`
	Min  int64  `json:"min,omitempty"`

	Status         string `json:"status,omitempty"`
	LastTransition string `json:"lastTransition,omitempty"`
	Links          []Link `json:"links,omitempty"`
}

Property is a realized v1.Property without the lookup definition

func (Property) AsMap added in v1.0.175

func (p Property) AsMap(removeFields ...string) map[string]any

func (Property) GetValue added in v1.0.15

func (p Property) GetValue() any

func (*Property) Merge added in v1.0.15

func (p *Property) Merge(other *Property)

func (*Property) String added in v1.0.15

func (p *Property) String() string

type Responder added in v1.0.67

type Responder struct {
	ID           uuid.UUID  `gorm:"primaryKey" json:"id"`
	IncidentID   uuid.UUID  `json:"incident_id"`
	Type         string     `json:"type"`
	Index        *int16     `json:"index,omitempty"`
	PersonID     *uuid.UUID `json:"person_id,omitempty"`
	TeamID       *uuid.UUID `json:"team_id,omitempty"`
	ExternalID   *string    `json:"external_id,omitempty"`
	Properties   *string    `gorm:"type:jsonb;default:null" json:"properties,omitempty"`
	Acknowledged *time.Time `json:"acknowledged,omitempty" time_format:"postgres_timestamp"`
	Resolved     *time.Time `json:"resolved,omitempty" time_format:"postgres_timestamp"`
	Closed       *time.Time `json:"closed,omitempty" time_format:"postgres_timestamp"`
	CreatedBy    uuid.UUID  `json:"created_by"`
	CreatedAt    time.Time  `json:"created_at" time_format:"postgres_timestamp" gorm:"default:CURRENT_TIMESTAMP()"`
	UpdatedAt    time.Time  `json:"updated_at" time_format:"postgres_timestamp" gorm:"default:CURRENT_TIMESTAMP()"`
}

func (Responder) AsMap added in v1.0.129

func (r Responder) AsMap(removeFields ...string) map[string]any

type Severity added in v1.0.116

type Severity string
const (
	SeverityInfo     Severity = "info"
	SeverityLow      Severity = "low"
	SeverityMedium   Severity = "medium"
	SeverityHigh     Severity = "high"
	SeverityCritical Severity = "critical"
)

type Team added in v1.0.115

type Team struct {
	ID        uuid.UUID  `gorm:"default:generate_ulid()"`
	Name      string     `gorm:"not null" json:"name"`
	Icon      string     `json:"icon,omitempty"`
	Spec      types.JSON `json:"spec,omitempty"`
	Source    string     `json:"source,omitempty"`
	CreatedBy uuid.UUID  `gorm:"not null" json:"created_by"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
}

func (*Team) AsMap added in v1.0.175

func (t *Team) AsMap(removeFields ...string) map[string]any

type Text added in v1.0.15

type Text struct {
	Tooltip string `json:"tooltip,omitempty"`
	Icon    string `json:"icon,omitempty"`
	Text    string `json:"text,omitempty"`
	Label   string `json:"label,omitempty"`
}

type Topology added in v1.0.72

type Topology struct {
	ID        uuid.UUID `gorm:"default:generate_ulid()"`
	AgentID   uuid.UUID `json:"agent_id,omitempty"`
	Name      string
	Namespace string
	Labels    types.JSONStringMap `json:"labels,omitempty"  gorm:"default:null"`
	Spec      types.JSON          `gorm:"default:null"`
	Schedule  *string
	CreatedAt *time.Time `json:"created_at,omitempty" time_format:"postgres_timestamp"`
	UpdatedAt *time.Time `json:"updated_at,omitempty" time_format:"postgres_timestamp"`
	DeletedAt *time.Time `json:"deleted_at,omitempty" time_format:"postgres_timestamp"`
}

Topology represents the topologies database table

func (*Topology) AsMap added in v1.0.175

func (t *Topology) AsMap(removeFields ...string) map[string]any

func (Topology) TableName added in v1.0.72

func (Topology) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL