models

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 9 Imported by: 40

Documentation

Index

Constants

View Source
const (
	StatusRunning  = "RUNNING"
	StatusFinished = "FINISHED"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigAnalysis added in v1.0.5

type ConfigAnalysis struct {
	ExternalID    string              `gorm:"-"`
	ExternalType  string              `gorm:"-"`
	ID            string              `gorm:"primaryKey;unique_index;not null;column:id" json:"id"`
	ConfigID      string              `gorm:"column:config_id;default:''" json:"config_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      string              `gorm:"column:severity" json:"severity" faker:"oneof: critical, high, medium, low, info"`
	AnalysisType  string              `gorm:"column:analysis_type" json:"change_type" faker:"oneof: availability, compliance, cost, security, performance"`
	Analysis      types.JSONStringMap `gorm:"column:analysis" json:"analysis,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:"-"`
	ExternalType     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         string     `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"`
	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) 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 ConfigItem added in v1.0.5

type ConfigItem struct {
	ID            string               `gorm:"primaryKey;unique_index;not null;column:id" json:"id" faker:"uuid_hyphenated"  `
	ScraperID     *string              `gorm:"column:scraper_id;default:null" json:"scraper_id,omitempty"  `
	ConfigType    string               `gorm:"column:config_type;default:''" json:"config_type" faker:"oneof:  File, EC2Instance, KubernetesPod" `
	ExternalID    pq.StringArray       `gorm:"column:external_id;type:[]text" json:"external_id,omitempty" faker:"external_id"  `
	ExternalType  *string              `gorm:"column:external_type;default:null" json:"external_type,omitempty" faker:"oneof:  File, EC2Instance, KubernetesPod"  `
	Name          *string              `gorm:"column:name;default:null" json:"name,omitempty" faker:"name"  `
	Namespace     *string              `gorm:"column:namespace;default:null" json:"namespace,omitempty"  faker:"oneof: default, demo, prod, staging" `
	Description   *string              `gorm:"column:description;default:null" json:"description,omitempty"  `
	Config        *string              `gorm:"column:config;default:null" json:"config,omitempty"  `
	Source        *string              `gorm:"column:source;default:null" json:"source,omitempty"  `
	ParentID      *string              `gorm:"column:parent_id;default:null" json:"parent_id,omitempty" faker:"-"`
	Path          string               `gorm:"column:path;default:null" 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 `gorm:"column:tags;default:null" json:"tags,omitempty"   faker:"tags"`
	CreatedAt     time.Time            `gorm:"column:created_at" json:"created_at"   `
	UpdatedAt     time.Time            `gorm:"column:updated_at" json:"updated_at"   `
}

ConfigItem represents the config item database table

func (ConfigItem) ConfigJSONStringMap added in v1.0.5

func (ci ConfigItem) ConfigJSONStringMap() (map[string]interface{}, error)

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 (c 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"`
}

func (ConfigRelationship) TableName added in v1.0.5

func (cr ConfigRelationship) TableName() string

type ExternalID added in v1.0.5

type ExternalID struct {
	ExternalType 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 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

Jump to

Keyboard shortcuts

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