Documentation
¶
Index ¶
- Constants
- func ConvertRowToNativeTypes(row map[string]any, columnDef map[string]ColumnType) (map[string]any, map[string]string)
- func ErrorContext(items ...Contextable) []any
- func GetIDs[T DBTable](items ...T) []string
- type ABACAttribute
- type AppProperty
- type ColumnType
- type Connection
- func (c Connection) AsEnv(ctx context.Context) EnvPrep
- func (c Connection) AsGoGetterURL() (string, error)
- func (c Connection) AsMap(removeFields ...string) map[string]any
- func (c *Connection) GetFieldsMatcher() fields.Fields
- func (c *Connection) GetHealth() (string, error)
- func (c *Connection) GetID() string
- func (c *Connection) GetLabelsMatcher() labels.Labels
- func (c *Connection) GetName() string
- func (c *Connection) GetNamespace() string
- func (c *Connection) GetStatus() (string, error)
- func (c *Connection) GetType() string
- func (c Connection) Merge(ctx types.GetEnvVarFromCache, from any) (*Connection, error)
- func (c Connection) PK() string
- func (c *Connection) SetProperty(key, value string)
- func (c Connection) String() string
- func (c Connection) TableName() string
- type Contextable
- type DBTable
- type Deleteable
- type EnvPrep
- type ExtendedDBTable
- type Health
- type LabelableModel
- type LogNameAccessor
- type LoggingBackend
- type NamespaceScopeAccessor
- type Severity
- type TaggableModel
Constants ¶
View Source
const ( ConnectionTypeAnthropic = "anthropic" ConnectionTypeAWS = "aws" ConnectionTypeAWSKMS = "aws_kms" ConnectionTypeAzure = "azure" ConnectionTypeAzureDevops = "azure_devops" ConnectionTypeAzureKeyVault = "azure_key_vault" ConnectionTypeDiscord = "discord" ConnectionTypeDynatrace = "dynatrace" ConnectionTypeElasticSearch = "elasticsearch" ConnectionTypeEmail = "email" ConnectionTypeFolder = "folder" ConnectionTypeGCP = "google_cloud" ConnectionTypeGCPKMS = "gcp_kms" ConnectionTypeGCS = "gcs" ConnectionTypeGemini = "gemini" ConnectionTypeGenericWebhook = "generic_webhook" ConnectionTypeGit = "git" ConnectionTypeGithub = "github" ConnectionTypeGitlab = "gitlab" ConnectionTypeGoogleChat = "google_chat" ConnectionTypeHTTP = "http" ConnectionTypeIFTTT = "ifttt" ConnectionTypeJMeter = "jmeter" ConnectionTypeKubernetes = "kubernetes" ConnectionTypeLDAP = "ldap" ConnectionTypeLoki = "loki" ConnectionTypeMatrix = "matrix" ConnectionTypeMattermost = "mattermost" ConnectionTypeMongo = "mongo" ConnectionTypeMySQL = "mysql" ConnectionTypeNtfy = "ntfy" ConnectionTypeOllama = "ollama" ConnectionTypeOpenAI = "openai" ConnectionTypeOpsGenie = "opsgenie" ConnectionTypePostgres = "postgres" ConnectionTypePrometheus = "prometheus" ConnectionTypePushbullet = "pushbullet" ConnectionTypePushover = "pushover" ConnectionTypeRedis = "redis" ConnectionTypeRestic = "restic" ConnectionTypeRocketchat = "rocketchat" ConnectionTypeS3 = "s3" 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
Variables ¶
This section is empty.
Functions ¶
func ConvertRowToNativeTypes ¶
func ConvertRowToNativeTypes(row map[string]any, columnDef map[string]ColumnType) (map[string]any, map[string]string)
ConvertRowToNativeTypes converts a database row to native go types
func ErrorContext ¶
func ErrorContext(items ...Contextable) []any
Types ¶
type ABACAttribute ¶
type ABACAttribute struct {
Connection Connection
}
ABACAttribute is the object passed to authorization checks. Consumers can extend this with their own types.
type AppProperty ¶
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()"`
}
func (AppProperty) TableName ¶
func (p AppProperty) TableName() string
type ColumnType ¶
type ColumnType string
const ( ColumnTypeBoolean ColumnType = "boolean" ColumnTypeDateTime ColumnType = "datetime" ColumnTypeDecimal ColumnType = "decimal" ColumnTypeDuration ColumnType = "duration" ColumnTypeInteger ColumnType = "integer" ColumnTypeJSONB ColumnType = "jsonb" ColumnTypeString ColumnType = "string" )
func (ColumnType) SQLiteType ¶
func (t ColumnType) SQLiteType() string
type Connection ¶
type Connection struct {
ID uuid.UUID `gorm:"primaryKey;unique_index;not null;column:id;default:generate_ulid()" json:"id" faker:"uuid_hyphenated" `
Name string `gorm:"column:name" json:"name" faker:"name" `
Namespace string `gorm:"column:namespace" json:"namespace"`
Source string `json:"source"`
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:"-" template:"true"`
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();<-:create" 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 ConnectionFromURL ¶
func ConnectionFromURL(url url.URL) *Connection
func (Connection) AsEnv ¶
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 ¶
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) GetFieldsMatcher ¶
func (c *Connection) GetFieldsMatcher() fields.Fields
func (*Connection) GetHealth ¶
func (c *Connection) GetHealth() (string, error)
func (*Connection) GetID ¶
func (c *Connection) GetID() string
func (*Connection) GetLabelsMatcher ¶
func (c *Connection) GetLabelsMatcher() labels.Labels
func (*Connection) GetName ¶
func (c *Connection) GetName() string
func (*Connection) GetNamespace ¶
func (c *Connection) GetNamespace() string
func (*Connection) GetStatus ¶
func (c *Connection) GetStatus() (string, error)
func (*Connection) GetType ¶
func (c *Connection) GetType() string
func (Connection) Merge ¶
func (c Connection) Merge(ctx types.GetEnvVarFromCache, from any) (*Connection, error)
func (Connection) PK ¶
func (c Connection) PK() string
func (*Connection) SetProperty ¶
func (c *Connection) SetProperty(key, value string)
func (Connection) String ¶
func (c Connection) String() string
func (Connection) TableName ¶
func (c Connection) TableName() string
type Contextable ¶
type Deleteable ¶
type EnvPrep ¶
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
}
type ExtendedDBTable ¶
TODO: Find a better way to handle this
type LabelableModel ¶
type LogNameAccessor ¶
type LogNameAccessor interface {
LoggerName() string
}
type LoggingBackend ¶
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"`
AgentID *uuid.UUID `json:"agent_id,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
DeletedAt *time.Time `json:"deleted_at,omitempty"`
}
func (LoggingBackend) PK ¶
func (l LoggingBackend) PK() string
func (LoggingBackend) TableName ¶
func (l LoggingBackend) TableName() string
type NamespaceScopeAccessor ¶
type NamespaceScopeAccessor interface {
GetNamespace() string
}
type TaggableModel ¶
Click to show internal directories.
Click to hide internal directories.