statedb

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertOutbox

type AlertOutbox struct {
	TenantID      string
	AlertKey      string
	ChannelID     string
	MonitorID     sql.NullString
	PayloadJson   string
	Attempts      int64
	NextAttemptMs int64
	State         string
	LastError     string
	CreatedMs     int64
	UpdatedMs     int64
}

type ApiToken

type ApiToken struct {
	ID            string
	TenantID      string
	Scope         string
	Name          string
	Role          string
	SecretHash    string
	CreatedMs     int64
	ExpiresMs     int64
	CreatedByKind string
	CreatedByID   string
	CreatedByName string
}

type AuditLog

type AuditLog struct {
	RaftIndex  int64
	Sub        int64
	AtMs       int64
	TenantID   string
	ActorKind  string
	ActorID    string
	ActorName  string
	Action     string
	ObjectKind string
	ObjectID   string
	RequestID  string
}

type ChannelRevisionParams

type ChannelRevisionParams struct {
	TenantID string
	ID       string
}

type ClusterCa

type ClusterCa struct {
	Fingerprint string
	ClusterID   string
	CertDer     []byte
	KeyEnc      string
	CreatedMs   int64
}

type CountEnabledUsersWithRoleParams

type CountEnabledUsersWithRoleParams struct {
	TenantID string
	Role     string
	ID       string
}

type CountOpenTenantJoinTokensParams added in v0.0.4

type CountOpenTenantJoinTokensParams struct {
	TenantID  string
	ExpiresMs int64
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DeleteAPITokenParams

type DeleteAPITokenParams struct {
	TenantID string
	ID       string
}

type DeleteChannelParams

type DeleteChannelParams struct {
	TenantID string
	ID       string
}

type DeleteMaintenanceWindowParams

type DeleteMaintenanceWindowParams struct {
	TenantID string
	ID       string
}

type DeleteMonitorChannelsParams

type DeleteMonitorChannelsParams struct {
	TenantID  string
	MonitorID string
}

type DeleteMonitorParams

type DeleteMonitorParams struct {
	TenantID string
	ID       string
}

type DeleteMonitorTagsParams

type DeleteMonitorTagsParams struct {
	TenantID  string
	MonitorID string
}

type DeleteStatusHistoryBetweenParams

type DeleteStatusHistoryBetweenParams struct {
	TenantID  string
	MonitorID string
	FromMs    int64
	ToMs      int64
}

type DeleteUserParams

type DeleteUserParams struct {
	TenantID string
	ID       string
}

type DeletedTenant

type DeletedTenant struct {
	ID        string
	DeletedMs int64
}

type DueAlertsParams

type DueAlertsParams struct {
	NowMs    int64
	RowLimit int64
}

type FsmMetum

type FsmMetum struct {
	Key   string
	Value int64
}

type GetAPITokenParams

type GetAPITokenParams struct {
	TenantID string
	ID       string
}

type GetAlertParams

type GetAlertParams struct {
	AlertKey  string
	ChannelID string
}

type GetChannelParams

type GetChannelParams struct {
	TenantID string
	ID       string
}

type GetIncidentParams

type GetIncidentParams struct {
	TenantID string
	ID       string
}

type GetIncidentRow

type GetIncidentRow struct {
	Incident    Incident
	MonitorName string
}

type GetJoinTokenRow

type GetJoinTokenRow struct {
	ID         string
	SecretHash string
	Role       string
	TenantID   string
	ExpiresMs  int64
	CreatedMs  int64
	UsedMs     int64
	UsedBy     string
}

type GetMaintenanceWindowParams

type GetMaintenanceWindowParams struct {
	TenantID string
	ID       string
}

type GetMonitorParams

type GetMonitorParams struct {
	TenantID string
	ID       string
}

type GetMonitorRow

type GetMonitorRow struct {
	Monitor              Monitor
	StateStatus          string
	StateConfirmed       int64
	StateSinceMs         int64
	StateFlapping        int64
	StateFlappingSinceMs int64
}

type GetMonitorStateParams

type GetMonitorStateParams struct {
	TenantID  string
	MonitorID string
}

type GetProbeAlertParams added in v0.0.4

type GetProbeAlertParams struct {
	TenantID string
	ProbeID  string
}

type GetSystemAlertParams

type GetSystemAlertParams struct {
	Kind    string
	Subject string
}

type GetUnconfirmedAlertParams

type GetUnconfirmedAlertParams struct {
	NodeID  string
	LocalID int64
}

type GetUserParams

type GetUserParams struct {
	TenantID string
	ID       string
}

type Incident

type Incident struct {
	TenantID          string
	ID                string
	MonitorID         string
	StartedMs         int64
	ResolvedMs        int64
	Cause             string
	ErrorClass        string
	AffectedNodesJson string
	Confirmed         int64
	Reevaluated       int64
}

type InsertAPITokenParams

type InsertAPITokenParams struct {
	ID            string
	TenantID      string
	Scope         string
	Name          string
	Role          string
	SecretHash    string
	CreatedMs     int64
	ExpiresMs     int64
	CreatedByKind string
	CreatedByID   string
	CreatedByName string
}

type InsertAlertParams

type InsertAlertParams struct {
	TenantID      string
	AlertKey      string
	ChannelID     string
	MonitorID     sql.NullString
	PayloadJson   string
	NextAttemptMs int64
	CreatedMs     int64
	UpdatedMs     int64
}

type InsertAuditEntryParams

type InsertAuditEntryParams struct {
	RaftIndex  int64
	Sub        int64
	AtMs       int64
	TenantID   string
	ActorKind  string
	ActorID    string
	ActorName  string
	Action     string
	ObjectKind string
	ObjectID   string
	RequestID  string
}

type InsertChannelParams

type InsertChannelParams struct {
	TenantID           string
	ID                 string
	Name               string
	Kind               string
	UrlEnc             string
	WebhookMethod      string
	WebhookHeadersJson string
	WebhookTemplate    string
	EventsJson         string
	IsDefault          int64
	Revision           int64
	CreatedMs          int64
	UpdatedMs          int64
}

type InsertClusterCAParams

type InsertClusterCAParams struct {
	Fingerprint string
	ClusterID   string
	CertDer     []byte
	KeyEnc      string
	CreatedMs   int64
}

type InsertDedupParams

type InsertDedupParams struct {
	RequestID    string
	AppliedIndex int64
	IssuedAtMs   int64
	ResultJson   string
	ErrorCode    string
	ErrorMessage string
}

type InsertDeletedTenantParams

type InsertDeletedTenantParams struct {
	ID        string
	DeletedMs int64
}

type InsertIncidentParams

type InsertIncidentParams struct {
	TenantID          string
	ID                string
	MonitorID         string
	StartedMs         int64
	ResolvedMs        int64
	Cause             string
	ErrorClass        string
	AffectedNodesJson string
	Confirmed         int64
	Reevaluated       int64
}

type InsertJoinTokenParams

type InsertJoinTokenParams struct {
	ID         string
	SecretHash string
	Role       string
	TenantID   string
	ExpiresMs  int64
	CreatedMs  int64
}

type InsertMaintenanceWindowParams

type InsertMaintenanceWindowParams struct {
	TenantID       string
	ID             string
	Name           string
	Description    string
	MonitorIdsJson string
	ScheduleJson   string
	Active         int64
	Revision       int64
	CreatedMs      int64
	UpdatedMs      int64
}

type InsertMonitorChannelParams

type InsertMonitorChannelParams struct {
	TenantID  string
	MonitorID string
	ChannelID string
}

type InsertMonitorParams

type InsertMonitorParams struct {
	TenantID          string
	ID                string
	Name              string
	Description       string
	Type              string
	ConfigJson        string
	SecretsJson       string
	IntervalS         int64
	TimeoutS          int64
	Retries           int64
	RecoveryThreshold int64
	ResendIntervalMin int64
	AssignmentJson    string
	ConsensusPolicy   string
	Paused            int64
	Revision          int64
	CreatedMs         int64
	UpdatedMs         int64
}

type InsertMonitorTagParams

type InsertMonitorTagParams struct {
	TenantID  string
	MonitorID string
	Tag       string
}

type InsertSessionParams

type InsertSessionParams struct {
	TokenHash string
	FamilyID  string
	TenantID  string
	UserID    string
	CreatedMs int64
	ExpiresMs int64
	UsedMs    int64
	RevokedMs int64
}

type InsertUnconfirmedAlertParams

type InsertUnconfirmedAlertParams struct {
	NodeID     string
	LocalID    int64
	TenantID   string
	MonitorID  string
	ChannelID  string
	Status     string
	SinceMs    int64
	SentMs     int64
	Outcome    string
	Reachable  int64
	Total      int64
	Reporters  string
	ReportedMs int64
}

type InsertUserParams

type InsertUserParams struct {
	TenantID     string
	ID           string
	Username     string
	DisplayName  string
	PasswordHash string
	Role         string
	Disabled     int64
	Revision     int64
	CreatedMs    int64
	UpdatedMs    int64
	LastLoginMs  int64
}

type JoinToken

type JoinToken struct {
	ID         string
	SecretHash string
	Role       string
	TenantID   string
	ExpiresMs  int64
	CreatedMs  int64
	UsedMs     sql.NullInt64
	UsedBy     string
}

type ListIncidentsParams

type ListIncidentsParams struct {
	TenantID        string
	MonitorID       string
	ToMs            int64
	FromMs          int64
	OpenOnly        int64
	BeforeStartedMs int64
	BeforeID        string
	RowLimit        int64
}

type ListIncidentsRow

type ListIncidentsRow struct {
	Incident    Incident
	MonitorName string
}

type ListJoinTokensRow

type ListJoinTokensRow struct {
	ID         string
	SecretHash string
	Role       string
	TenantID   string
	ExpiresMs  int64
	CreatedMs  int64
	UsedMs     int64
	UsedBy     string
}

type ListMonitorChannelIDsParams

type ListMonitorChannelIDsParams struct {
	TenantID  string
	MonitorID string
}

type ListMonitorTagsParams

type ListMonitorTagsParams struct {
	TenantID  string
	MonitorID string
}

type ListMonitorsParams

type ListMonitorsParams struct {
	TenantID string
	AfterID  string
	Status   string
	Search   string
	Tag      string
	RowLimit int64
}

type ListMonitorsRow

type ListMonitorsRow struct {
	Monitor              Monitor
	StateStatus          string
	StateConfirmed       int64
	StateSinceMs         int64
	StateFlapping        int64
	StateFlappingSinceMs int64
}

type ListUnrevokedSessionUsersRow

type ListUnrevokedSessionUsersRow struct {
	TenantID string
	UserID   string
}

type MaintenanceWindow

type MaintenanceWindow struct {
	TenantID       string
	ID             string
	Name           string
	Description    string
	MonitorIdsJson string
	ScheduleJson   string
	Active         int64
	Revision       int64
	CreatedMs      int64
	UpdatedMs      int64
}

type MaintenanceWindowRevisionParams

type MaintenanceWindowRevisionParams struct {
	TenantID string
	ID       string
}

type MarkJoinTokenUsedParams

type MarkJoinTokenUsedParams struct {
	UsedMs sql.NullInt64
	UsedBy string
	ID     string
}

type MarkSessionUsedParams

type MarkSessionUsedParams struct {
	UsedMs    int64
	TokenHash string
}

type Monitor

type Monitor struct {
	TenantID          string
	ID                string
	Name              string
	Description       string
	Type              string
	ConfigJson        string
	IntervalS         int64
	TimeoutS          int64
	Retries           int64
	RecoveryThreshold int64
	ResendIntervalMin int64
	AssignmentJson    string
	ConsensusPolicy   string
	Paused            int64
	Revision          int64
	CreatedMs         int64
	UpdatedMs         int64
	SecretsJson       string
}

type MonitorChannel

type MonitorChannel struct {
	TenantID  string
	MonitorID string
	ChannelID string
}

type MonitorRevisionParams

type MonitorRevisionParams struct {
	TenantID string
	ID       string
}

type MonitorState

type MonitorState struct {
	TenantID        string
	MonitorID       string
	Status          string
	Confirmed       int64
	SinceMs         int64
	Flapping        int64
	FlappingSinceMs int64
}

type MonitorStatusHistory

type MonitorStatusHistory struct {
	TenantID  string
	MonitorID string
	SinceMs   int64
	Status    string
}

type MonitorTag

type MonitorTag struct {
	TenantID  string
	MonitorID string
	Tag       string
}

type Node

type Node struct {
	ID                    string
	Name                  string
	Role                  string
	CapabilitiesJson      string
	LabelsJson            string
	Region                string
	Version               string
	MaxCommandVersion     int64
	Healthy               int64
	HealthChangedMs       int64
	RegisteredMs          int64
	UpdatedMs             int64
	ConnectivityImpaired  int64
	ConnectivityReason    string
	ConnectivityChangedMs int64
	OwnerTenantID         string
	Incarnation           string
}

type NodeIncarnation

type NodeIncarnation struct {
	NodeID      string
	Incarnation string
	SeenMs      int64
}

type NotificationChannel

type NotificationChannel struct {
	TenantID           string
	ID                 string
	Name               string
	Kind               string
	UrlEnc             string
	WebhookMethod      string
	WebhookHeadersJson string
	WebhookTemplate    string
	EventsJson         string
	IsDefault          int64
	State              string
	LastError          string
	Revision           int64
	CreatedMs          int64
	UpdatedMs          int64
}

type Plan

type Plan struct {
	ID         string
	Name       string
	LimitsJson string
	CreatedMs  int64
	UpdatedMs  int64
}

type ProbeAlert added in v0.0.4

type ProbeAlert struct {
	TenantID  string
	ProbeID   string
	Active    int64
	SinceMs   int64
	UpdatedMs int64
}

type PruneStatusHistoryParams

type PruneStatusHistoryParams struct {
	TenantID  string
	MonitorID string
	BeforeMs  int64
}

type PutNodeParams

type PutNodeParams struct {
	ID                    string
	Name                  string
	Role                  string
	CapabilitiesJson      string
	LabelsJson            string
	Region                string
	Version               string
	MaxCommandVersion     int64
	Healthy               int64
	HealthChangedMs       int64
	RegisteredMs          int64
	UpdatedMs             int64
	ConnectivityImpaired  int64
	ConnectivityReason    string
	ConnectivityChangedMs int64
	OwnerTenantID         string
	Incarnation           string
}

type PutRevokedCertParams

type PutRevokedCertParams struct {
	Serial     string
	NodeID     string
	RevokedMs  int64
	NotAfterMs int64
}

type PutRevokedNodeParams

type PutRevokedNodeParams struct {
	NodeID    string
	RevokedMs int64
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) ChannelRevision

func (q *Queries) ChannelRevision(ctx context.Context, arg ChannelRevisionParams) (int64, error)

func (*Queries) CountAPITokens

func (q *Queries) CountAPITokens(ctx context.Context, tenantID string) (int64, error)

func (*Queries) CountEnabledUsersWithRole

func (q *Queries) CountEnabledUsersWithRole(ctx context.Context, arg CountEnabledUsersWithRoleParams) (int64, error)

func (*Queries) CountOpenTenantJoinTokens added in v0.0.4

func (q *Queries) CountOpenTenantJoinTokens(ctx context.Context, arg CountOpenTenantJoinTokensParams) (int64, error)

func (*Queries) CountPendingAlerts

func (q *Queries) CountPendingAlerts(ctx context.Context) (int64, error)

func (*Queries) CountTenantChannels

func (q *Queries) CountTenantChannels(ctx context.Context, tenantID string) (int64, error)

func (*Queries) CountTenantMonitors

func (q *Queries) CountTenantMonitors(ctx context.Context, tenantID string) (int64, error)

func (*Queries) CountTenantPrivateProbes added in v0.0.4

func (q *Queries) CountTenantPrivateProbes(ctx context.Context, ownerTenantID string) (int64, error)

func (*Queries) CountTenantsBySource

func (q *Queries) CountTenantsBySource(ctx context.Context, source string) (int64, error)

func (*Queries) CountTenantsWithPlan

func (q *Queries) CountTenantsWithPlan(ctx context.Context, plan string) (int64, error)

func (*Queries) CountUsers

func (q *Queries) CountUsers(ctx context.Context) (int64, error)

func (*Queries) DeleteAPIToken

func (q *Queries) DeleteAPIToken(ctx context.Context, arg DeleteAPITokenParams) (int64, error)

func (*Queries) DeleteChannel

func (q *Queries) DeleteChannel(ctx context.Context, arg DeleteChannelParams) (int64, error)

func (*Queries) DeleteJoinToken

func (q *Queries) DeleteJoinToken(ctx context.Context, id string) (int64, error)

func (*Queries) DeleteMaintenanceWindow

func (q *Queries) DeleteMaintenanceWindow(ctx context.Context, arg DeleteMaintenanceWindowParams) (int64, error)

func (*Queries) DeleteMonitor

func (q *Queries) DeleteMonitor(ctx context.Context, arg DeleteMonitorParams) (int64, error)

func (*Queries) DeleteMonitorChannels

func (q *Queries) DeleteMonitorChannels(ctx context.Context, arg DeleteMonitorChannelsParams) error

func (*Queries) DeleteMonitorTags

func (q *Queries) DeleteMonitorTags(ctx context.Context, arg DeleteMonitorTagsParams) error

func (*Queries) DeleteNode

func (q *Queries) DeleteNode(ctx context.Context, id string) (int64, error)

func (*Queries) DeletePlan

func (q *Queries) DeletePlan(ctx context.Context, id string) (int64, error)

func (*Queries) DeleteProbeAlertsByProbe added in v0.0.4

func (q *Queries) DeleteProbeAlertsByProbe(ctx context.Context, probeID string) error

func (*Queries) DeleteStatusHistoryBetween

func (q *Queries) DeleteStatusHistoryBetween(ctx context.Context, arg DeleteStatusHistoryBetweenParams) error

Removes the changes in [from_ms, to_ms) of one monitor (FA-UPT-07).

func (*Queries) DeleteTenantAPITokens

func (q *Queries) DeleteTenantAPITokens(ctx context.Context, tenantID string) error

func (*Queries) DeleteTenantAlerts

func (q *Queries) DeleteTenantAlerts(ctx context.Context, tenantID string) error

The deletes below remove every row of one tenant from one table of state.db (ADR 0029). DeleteTenant runs them in this order; the tenants row goes last.

func (*Queries) DeleteTenantAudit

func (q *Queries) DeleteTenantAudit(ctx context.Context, tenantID string) error

func (*Queries) DeleteTenantChannels

func (q *Queries) DeleteTenantChannels(ctx context.Context, tenantID string) error

func (*Queries) DeleteTenantIncidents

func (q *Queries) DeleteTenantIncidents(ctx context.Context, tenantID string) error

func (*Queries) DeleteTenantJoinTokens

func (q *Queries) DeleteTenantJoinTokens(ctx context.Context, tenantID string) error

Only probe tokens of a private tenant carry the tenant ID (no foreign key).

func (*Queries) DeleteTenantMaintenanceWindows

func (q *Queries) DeleteTenantMaintenanceWindows(ctx context.Context, tenantID string) error

func (*Queries) DeleteTenantMonitorChannels

func (q *Queries) DeleteTenantMonitorChannels(ctx context.Context, tenantID string) error

func (*Queries) DeleteTenantMonitorStates

func (q *Queries) DeleteTenantMonitorStates(ctx context.Context, tenantID string) error

func (*Queries) DeleteTenantMonitorTags

func (q *Queries) DeleteTenantMonitorTags(ctx context.Context, tenantID string) error

func (*Queries) DeleteTenantMonitors

func (q *Queries) DeleteTenantMonitors(ctx context.Context, tenantID string) error

func (*Queries) DeleteTenantProbeAlerts added in v0.0.4

func (q *Queries) DeleteTenantProbeAlerts(ctx context.Context, tenantID string) error

func (*Queries) DeleteTenantRow

func (q *Queries) DeleteTenantRow(ctx context.Context, id string) (int64, error)

func (*Queries) DeleteTenantSessions

func (q *Queries) DeleteTenantSessions(ctx context.Context, tenantID string) error

func (*Queries) DeleteTenantStatusHistory

func (q *Queries) DeleteTenantStatusHistory(ctx context.Context, tenantID string) error

func (*Queries) DeleteTenantUnconfirmedAlerts

func (q *Queries) DeleteTenantUnconfirmedAlerts(ctx context.Context, tenantID string) error

func (*Queries) DeleteTenantUsers

func (q *Queries) DeleteTenantUsers(ctx context.Context, tenantID string) error

func (*Queries) DeleteUser

func (q *Queries) DeleteUser(ctx context.Context, arg DeleteUserParams) (int64, error)

func (*Queries) DueAlerts

func (q *Queries) DueAlerts(ctx context.Context, arg DueAlertsParams) ([]AlertOutbox, error)

func (*Queries) GetAPIToken

func (q *Queries) GetAPIToken(ctx context.Context, arg GetAPITokenParams) (ApiToken, error)

func (*Queries) GetAPITokenBySecretHash

func (q *Queries) GetAPITokenBySecretHash(ctx context.Context, secretHash string) (ApiToken, error)

func (*Queries) GetAlert

func (q *Queries) GetAlert(ctx context.Context, arg GetAlertParams) (AlertOutbox, error)

func (*Queries) GetChannel

func (q *Queries) GetChannel(ctx context.Context, arg GetChannelParams) (NotificationChannel, error)

func (*Queries) GetDedup

func (q *Queries) GetDedup(ctx context.Context, requestID string) (RequestDedup, error)

func (*Queries) GetFSMMeta

func (q *Queries) GetFSMMeta(ctx context.Context, key string) (int64, error)

func (*Queries) GetIncident

func (q *Queries) GetIncident(ctx context.Context, arg GetIncidentParams) (GetIncidentRow, error)

func (*Queries) GetJoinToken

func (q *Queries) GetJoinToken(ctx context.Context, id string) (GetJoinTokenRow, error)

func (*Queries) GetMaintenanceWindow

func (q *Queries) GetMaintenanceWindow(ctx context.Context, arg GetMaintenanceWindowParams) (MaintenanceWindow, error)

func (*Queries) GetMonitor

func (q *Queries) GetMonitor(ctx context.Context, arg GetMonitorParams) (GetMonitorRow, error)

Monitors and their state are written in the same FSM transaction; the defaults only cover monitors stored without the FSM (store tests).

func (*Queries) GetMonitorState

func (q *Queries) GetMonitorState(ctx context.Context, arg GetMonitorStateParams) (MonitorState, error)

func (*Queries) GetNode

func (q *Queries) GetNode(ctx context.Context, id string) (Node, error)

func (*Queries) GetPlan

func (q *Queries) GetPlan(ctx context.Context, id string) (Plan, error)

func (*Queries) GetProbeAlert added in v0.0.4

func (q *Queries) GetProbeAlert(ctx context.Context, arg GetProbeAlertParams) (ProbeAlert, error)

func (*Queries) GetRevokedNode

func (q *Queries) GetRevokedNode(ctx context.Context, nodeID string) (RevokedNode, error)

func (*Queries) GetSession

func (q *Queries) GetSession(ctx context.Context, tokenHash string) (RefreshSession, error)

func (*Queries) GetSystemAlert

func (q *Queries) GetSystemAlert(ctx context.Context, arg GetSystemAlertParams) (SystemAlert, error)

func (*Queries) GetTenant

func (q *Queries) GetTenant(ctx context.Context, id string) (Tenant, error)

func (*Queries) GetTenantByOrg

func (q *Queries) GetTenantByOrg(ctx context.Context, zitadelOrgID sql.NullString) (Tenant, error)

func (*Queries) GetUnconfirmedAlert

func (q *Queries) GetUnconfirmedAlert(ctx context.Context, arg GetUnconfirmedAlertParams) (UnconfirmedAlert, error)

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, arg GetUserParams) (User, error)

func (*Queries) GetUserByUsername

func (q *Queries) GetUserByUsername(ctx context.Context, username string) (User, error)

func (*Queries) InsertAPIToken

func (q *Queries) InsertAPIToken(ctx context.Context, arg InsertAPITokenParams) error

func (*Queries) InsertAlert

func (q *Queries) InsertAlert(ctx context.Context, arg InsertAlertParams) error

The same alert for the same channel is enqueued once (FA-ALR-03).

func (*Queries) InsertAuditEntry

func (q *Queries) InsertAuditEntry(ctx context.Context, arg InsertAuditEntryParams) error

func (*Queries) InsertChannel

func (q *Queries) InsertChannel(ctx context.Context, arg InsertChannelParams) error

func (*Queries) InsertClusterCA

func (q *Queries) InsertClusterCA(ctx context.Context, arg InsertClusterCAParams) error

func (*Queries) InsertDedup

func (q *Queries) InsertDedup(ctx context.Context, arg InsertDedupParams) error

func (*Queries) InsertDeletedTenant

func (q *Queries) InsertDeletedTenant(ctx context.Context, arg InsertDeletedTenantParams) error

func (*Queries) InsertIncident

func (q *Queries) InsertIncident(ctx context.Context, arg InsertIncidentParams) error

resolved_ms is 0 for an open incident; a re-evaluated gap is stored closed.

func (*Queries) InsertJoinToken

func (q *Queries) InsertJoinToken(ctx context.Context, arg InsertJoinTokenParams) error

func (*Queries) InsertMaintenanceWindow

func (q *Queries) InsertMaintenanceWindow(ctx context.Context, arg InsertMaintenanceWindowParams) error

func (*Queries) InsertMonitor

func (q *Queries) InsertMonitor(ctx context.Context, arg InsertMonitorParams) error

func (*Queries) InsertMonitorChannel

func (q *Queries) InsertMonitorChannel(ctx context.Context, arg InsertMonitorChannelParams) error

func (*Queries) InsertMonitorTag

func (q *Queries) InsertMonitorTag(ctx context.Context, arg InsertMonitorTagParams) error

func (*Queries) InsertSession

func (q *Queries) InsertSession(ctx context.Context, arg InsertSessionParams) error

func (*Queries) InsertUnconfirmedAlert

func (q *Queries) InsertUnconfirmedAlert(ctx context.Context, arg InsertUnconfirmedAlertParams) error

A report of an already stored alert changes nothing: the first copy wins.

func (*Queries) InsertUser

func (q *Queries) InsertUser(ctx context.Context, arg InsertUserParams) error

func (*Queries) IsTenantDeleted

func (q *Queries) IsTenantDeleted(ctx context.Context, id string) (int64, error)

func (*Queries) ListAPITokens

func (q *Queries) ListAPITokens(ctx context.Context, tenantID string) ([]ApiToken, error)

func (*Queries) ListActiveSystemAlerts

func (q *Queries) ListActiveSystemAlerts(ctx context.Context) ([]SystemAlert, error)

func (*Queries) ListActiveTenantProbeAlerts added in v0.0.4

func (q *Queries) ListActiveTenantProbeAlerts(ctx context.Context, tenantID string) ([]ProbeAlert, error)

func (*Queries) ListAllActiveProbeAlerts added in v0.0.4

func (q *Queries) ListAllActiveProbeAlerts(ctx context.Context) ([]ProbeAlert, error)

func (*Queries) ListAllMaintenanceWindows

func (q *Queries) ListAllMaintenanceWindows(ctx context.Context) ([]MaintenanceWindow, error)

func (*Queries) ListAllProbeAlerts added in v0.0.4

func (q *Queries) ListAllProbeAlerts(ctx context.Context) ([]ProbeAlert, error)

func (*Queries) ListChannels

func (q *Queries) ListChannels(ctx context.Context, tenantID string) ([]NotificationChannel, error)

func (*Queries) ListClusterCAs

func (q *Queries) ListClusterCAs(ctx context.Context) ([]ClusterCa, error)

func (*Queries) ListDeletedTenants

func (q *Queries) ListDeletedTenants(ctx context.Context) ([]DeletedTenant, error)

func (*Queries) ListIncidents

func (q *Queries) ListIncidents(ctx context.Context, arg ListIncidentsParams) ([]ListIncidentsRow, error)

Newest first with keyset (started_ms, id) descending. An incident matches the period if it overlaps [from_ms, to_ms].

func (*Queries) ListJoinTokens

func (q *Queries) ListJoinTokens(ctx context.Context) ([]ListJoinTokensRow, error)

func (*Queries) ListMaintenanceWindows

func (q *Queries) ListMaintenanceWindows(ctx context.Context, tenantID string) ([]MaintenanceWindow, error)

func (*Queries) ListMonitorChannelIDs

func (q *Queries) ListMonitorChannelIDs(ctx context.Context, arg ListMonitorChannelIDsParams) ([]string, error)

func (*Queries) ListMonitorTags

func (q *Queries) ListMonitorTags(ctx context.Context, arg ListMonitorTagsParams) ([]string, error)

func (*Queries) ListMonitors

func (q *Queries) ListMonitors(ctx context.Context, arg ListMonitorsParams) ([]ListMonitorsRow, error)

func (*Queries) ListNodeIncarnations

func (q *Queries) ListNodeIncarnations(ctx context.Context) ([]NodeIncarnation, error)

func (*Queries) ListNodes

func (q *Queries) ListNodes(ctx context.Context) ([]Node, error)

func (*Queries) ListOpenUnconfirmedAlerts

func (q *Queries) ListOpenUnconfirmedAlerts(ctx context.Context, rowLimit int64) ([]UnconfirmedAlert, error)

func (*Queries) ListPlans

func (q *Queries) ListPlans(ctx context.Context) ([]Plan, error)

func (*Queries) ListRevokedCerts

func (q *Queries) ListRevokedCerts(ctx context.Context) ([]RevokedCert, error)

func (*Queries) ListRevokedNodes

func (q *Queries) ListRevokedNodes(ctx context.Context) ([]RevokedNode, error)

func (*Queries) ListSecretKeys

func (q *Queries) ListSecretKeys(ctx context.Context) ([]SecretKey, error)

func (*Queries) ListSigningKeys

func (q *Queries) ListSigningKeys(ctx context.Context) ([]SigningKey, error)

func (*Queries) ListSystemAlerts

func (q *Queries) ListSystemAlerts(ctx context.Context) ([]SystemAlert, error)

func (*Queries) ListTenantProbeAlerts added in v0.0.4

func (q *Queries) ListTenantProbeAlerts(ctx context.Context, tenantID string) ([]ProbeAlert, error)

func (*Queries) ListTenants

func (q *Queries) ListTenants(ctx context.Context) ([]Tenant, error)

func (*Queries) ListUnrevokedSessionUsers

func (q *Queries) ListUnrevokedSessionUsers(ctx context.Context) ([]ListUnrevokedSessionUsersRow, error)

The users that still hold a refresh token that is not revoked (ADR 0032).

func (*Queries) ListUsers

func (q *Queries) ListUsers(ctx context.Context, tenantID string) ([]User, error)

func (*Queries) MaintenanceWindowRevision

func (q *Queries) MaintenanceWindowRevision(ctx context.Context, arg MaintenanceWindowRevisionParams) (int64, error)

func (*Queries) MarkJoinTokenUsed

func (q *Queries) MarkJoinTokenUsed(ctx context.Context, arg MarkJoinTokenUsedParams) (int64, error)

The first redemption is kept: a token with used_ms set matches no row.

func (*Queries) MarkSessionUsed

func (q *Queries) MarkSessionUsed(ctx context.Context, arg MarkSessionUsedParams) (int64, error)

The first use is kept: a second use is detected by used_ms <> 0.

func (*Queries) MinTenantMonitorInterval

func (q *Queries) MinTenantMonitorInterval(ctx context.Context, tenantID string) (int64, error)

The shortest monitor interval of the tenant, 0 without monitors.

func (*Queries) MonitorRevision

func (q *Queries) MonitorRevision(ctx context.Context, arg MonitorRevisionParams) (int64, error)

func (*Queries) PruneAPITokens

func (q *Queries) PruneAPITokens(ctx context.Context, expiresMs int64) error

func (*Queries) PruneAlerts

func (q *Queries) PruneAlerts(ctx context.Context, updatedMs int64) error

func (*Queries) PruneAudit

func (q *Queries) PruneAudit(ctx context.Context, atMs int64) error

func (*Queries) PruneDedup

func (q *Queries) PruneDedup(ctx context.Context, issuedAtMs int64) (int64, error)

func (*Queries) PruneJoinTokens

func (q *Queries) PruneJoinTokens(ctx context.Context, expiresMs int64) error

func (*Queries) PruneRevokedCerts

func (q *Queries) PruneRevokedCerts(ctx context.Context, notAfterMs int64) error

func (*Queries) PruneSessions

func (q *Queries) PruneSessions(ctx context.Context, expiresMs int64) error

func (*Queries) PruneStatusHistory

func (q *Queries) PruneStatusHistory(ctx context.Context, arg PruneStatusHistoryParams) error

Removes changes before before_ms but keeps the last one at or before it, which still defines the status at before_ms.

func (*Queries) PutNode

func (q *Queries) PutNode(ctx context.Context, arg PutNodeParams) error

func (*Queries) PutRevokedCert

func (q *Queries) PutRevokedCert(ctx context.Context, arg PutRevokedCertParams) error

A repeated revocation of the same serial changes nothing.

func (*Queries) PutRevokedNode

func (q *Queries) PutRevokedNode(ctx context.Context, arg PutRevokedNodeParams) error

A repeated revocation keeps the later time: a node revoked again stays revoked for everything issued before the newer revocation.

func (*Queries) ResolveIncident

func (q *Queries) ResolveIncident(ctx context.Context, arg ResolveIncidentParams) (int64, error)

func (*Queries) ResolveUnconfirmedAlert

func (q *Queries) ResolveUnconfirmedAlert(ctx context.Context, arg ResolveUnconfirmedAlertParams) (int64, error)

func (*Queries) RevokeSessionFamily

func (q *Queries) RevokeSessionFamily(ctx context.Context, arg RevokeSessionFamilyParams) error

func (*Queries) RevokeTenantSessions

func (q *Queries) RevokeTenantSessions(ctx context.Context, arg RevokeTenantSessionsParams) error

func (*Queries) RevokeUserSessions

func (q *Queries) RevokeUserSessions(ctx context.Context, arg RevokeUserSessionsParams) error

func (*Queries) SetChannelState

func (q *Queries) SetChannelState(ctx context.Context, arg SetChannelStateParams) error

func (*Queries) SetFSMMeta

func (q *Queries) SetFSMMeta(ctx context.Context, arg SetFSMMetaParams) error

func (*Queries) SetMonitorFlapping

func (q *Queries) SetMonitorFlapping(ctx context.Context, arg SetMonitorFlappingParams) (int64, error)

func (*Queries) SetNodeConnectivity

func (q *Queries) SetNodeConnectivity(ctx context.Context, arg SetNodeConnectivityParams) (int64, error)

func (*Queries) SetUserLastLogin

func (q *Queries) SetUserLastLogin(ctx context.Context, arg SetUserLastLoginParams) (int64, error)

func (*Queries) StatusChangesSince

func (q *Queries) StatusChangesSince(ctx context.Context, arg StatusChangesSinceParams) ([]StatusChangesSinceRow, error)

The changes at or after from_ms; the FSM counts flapping changes from them.

func (*Queries) StatusHistory

func (q *Queries) StatusHistory(ctx context.Context, arg StatusHistoryParams) ([]StatusHistoryRow, error)

Changes in [from_ms, to_ms) plus the last change before from_ms.

func (*Queries) StatusHistoryBatch

func (q *Queries) StatusHistoryBatch(ctx context.Context, arg StatusHistoryBatchParams) ([]StatusHistoryBatchRow, error)

StatusHistory of several monitors at once: per monitor, the changes in [from_ms, to_ms) plus the last change before from_ms, as StatusHistory. The slice comes last in the WHERE clause: sqlc numbers the named parameters before the slice's placeholders only if it does.

func (*Queries) UpdateAlert

func (q *Queries) UpdateAlert(ctx context.Context, arg UpdateAlertParams) error

func (*Queries) UpdateChannel

func (q *Queries) UpdateChannel(ctx context.Context, arg UpdateChannelParams) (int64, error)

An update by the user resets the delivery state (the channel may be fixed).

func (*Queries) UpdateMaintenanceWindow

func (q *Queries) UpdateMaintenanceWindow(ctx context.Context, arg UpdateMaintenanceWindowParams) (int64, error)

created_ms is kept: it is set once by the create.

func (*Queries) UpdateMonitor

func (q *Queries) UpdateMonitor(ctx context.Context, arg UpdateMonitorParams) (int64, error)

func (*Queries) UpdateUser

func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (int64, error)

created_ms and last_login_ms are kept: they are not part of the update.

func (*Queries) UpsertMonitorState

func (q *Queries) UpsertMonitorState(ctx context.Context, arg UpsertMonitorStateParams) error

The flapping columns are not touched: only SetMonitorFlapping writes them.

func (*Queries) UpsertNodeIncarnation

func (q *Queries) UpsertNodeIncarnation(ctx context.Context, arg UpsertNodeIncarnationParams) error

func (*Queries) UpsertPlan

func (q *Queries) UpsertPlan(ctx context.Context, arg UpsertPlanParams) error

created_ms is kept on update (ADR 0029).

func (*Queries) UpsertProbeAlert added in v0.0.4

func (q *Queries) UpsertProbeAlert(ctx context.Context, arg UpsertProbeAlertParams) error

func (*Queries) UpsertSecretKey

func (q *Queries) UpsertSecretKey(ctx context.Context, arg UpsertSecretKeyParams) error

created_ms is kept on update; rewrapping (KEK rotation) and retiring update the row.

func (*Queries) UpsertSigningKey

func (q *Queries) UpsertSigningKey(ctx context.Context, arg UpsertSigningKeyParams) error

The creation time and the public part of an existing key are kept.

func (*Queries) UpsertStatusHistory

func (q *Queries) UpsertStatusHistory(ctx context.Context, arg UpsertStatusHistoryParams) error

A second change at the same instant (PENDING, then DOWN dated back to the same failure) replaces the first.

func (*Queries) UpsertSystemAlert

func (q *Queries) UpsertSystemAlert(ctx context.Context, arg UpsertSystemAlertParams) error

func (*Queries) UpsertTenant

func (q *Queries) UpsertTenant(ctx context.Context, arg UpsertTenantParams) error

created_ms and source are kept on conflict: they are set once by the creation (ADR 0029).

func (*Queries) UserRevision

func (q *Queries) UserRevision(ctx context.Context, arg UserRevisionParams) (int64, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type RefreshSession

type RefreshSession struct {
	TokenHash string
	FamilyID  string
	TenantID  string
	UserID    string
	CreatedMs int64
	ExpiresMs int64
	UsedMs    int64
	RevokedMs int64
}

type RequestDedup

type RequestDedup struct {
	RequestID    string
	AppliedIndex int64
	IssuedAtMs   int64
	ResultJson   string
	ErrorCode    string
	ErrorMessage string
}

type ResolveIncidentParams

type ResolveIncidentParams struct {
	ResolvedMs int64
	TenantID   string
	MonitorID  string
}

type ResolveUnconfirmedAlertParams

type ResolveUnconfirmedAlertParams struct {
	Verdict    string
	ResolvedMs int64
	NodeID     string
	LocalID    int64
}

type RevokeSessionFamilyParams

type RevokeSessionFamilyParams struct {
	RevokedMs int64
	FamilyID  string
}

type RevokeTenantSessionsParams

type RevokeTenantSessionsParams struct {
	RevokedMs int64
	TenantID  string
}

type RevokeUserSessionsParams

type RevokeUserSessionsParams struct {
	RevokedMs int64
	TenantID  string
	UserID    string
}

type RevokedCert

type RevokedCert struct {
	Serial     string
	NodeID     string
	RevokedMs  int64
	NotAfterMs int64
}

type RevokedNode

type RevokedNode struct {
	NodeID    string
	RevokedMs int64
}

type SecretKey

type SecretKey struct {
	KeyID          string
	WrappedDek     []byte
	KekFingerprint string
	CreatedMs      int64
	RetiredMs      int64
}

type SetChannelStateParams

type SetChannelStateParams struct {
	State     string
	LastError string
	TenantID  string
	ID        string
}

type SetFSMMetaParams

type SetFSMMetaParams struct {
	Key   string
	Value int64
}

type SetMonitorFlappingParams

type SetMonitorFlappingParams struct {
	Flapping        int64
	FlappingSinceMs int64
	TenantID        string
	MonitorID       string
}

type SetNodeConnectivityParams

type SetNodeConnectivityParams struct {
	ConnectivityImpaired  int64
	ConnectivityReason    string
	ConnectivityChangedMs int64
	UpdatedMs             int64
	ID                    string
}

type SetUserLastLoginParams

type SetUserLastLoginParams struct {
	LastLoginMs int64
	TenantID    string
	ID          string
}

type SigningKey

type SigningKey struct {
	Kid           string
	Alg           string
	PublicKey     []byte
	PrivateKeyEnc string
	CreatedMs     int64
	RetiredMs     int64
}

type StatusChangesSinceParams

type StatusChangesSinceParams struct {
	TenantID  string
	MonitorID string
	FromMs    int64
}

type StatusChangesSinceRow

type StatusChangesSinceRow struct {
	SinceMs int64
	Status  string
}

type StatusHistoryBatchParams

type StatusHistoryBatchParams struct {
	TenantID   string
	ToMs       int64
	FromMs     int64
	MonitorIds []string
}

type StatusHistoryBatchRow

type StatusHistoryBatchRow struct {
	MonitorID string
	SinceMs   int64
	Status    string
}

type StatusHistoryParams

type StatusHistoryParams struct {
	TenantID  string
	MonitorID string
	ToMs      int64
	FromMs    int64
}

type StatusHistoryRow

type StatusHistoryRow struct {
	SinceMs int64
	Status  string
}

type SystemAlert

type SystemAlert struct {
	Kind        string
	Subject     string
	Active      int64
	Level       int64
	SinceMs     int64
	UpdatedMs   int64
	DetailsJson string
}

type Tenant

type Tenant struct {
	ID           string
	Name         string
	ZitadelOrgID sql.NullString
	Plan         string
	LimitsJson   string
	Suspended    int64
	CreatedMs    int64
	UpdatedMs    int64
	Source       string
}

type UnconfirmedAlert

type UnconfirmedAlert struct {
	NodeID     string
	LocalID    int64
	TenantID   string
	MonitorID  string
	ChannelID  string
	Status     string
	SinceMs    int64
	SentMs     int64
	Outcome    string
	Reachable  int64
	Total      int64
	Reporters  string
	ReportedMs int64
	Verdict    string
	ResolvedMs int64
}

type UpdateAlertParams

type UpdateAlertParams struct {
	Attempts      int64
	NextAttemptMs int64
	State         string
	LastError     string
	UpdatedMs     int64
	AlertKey      string
	ChannelID     string
}

type UpdateChannelParams

type UpdateChannelParams struct {
	Name               string
	Kind               string
	UrlEnc             string
	WebhookMethod      string
	WebhookHeadersJson string
	WebhookTemplate    string
	EventsJson         string
	IsDefault          int64
	Revision           int64
	UpdatedMs          int64
	TenantID           string
	ID                 string
	ExpectedRevision   int64
}

type UpdateMaintenanceWindowParams

type UpdateMaintenanceWindowParams struct {
	Name             string
	Description      string
	MonitorIdsJson   string
	ScheduleJson     string
	Active           int64
	Revision         int64
	UpdatedMs        int64
	TenantID         string
	ID               string
	ExpectedRevision int64
}

type UpdateMonitorParams

type UpdateMonitorParams struct {
	Name              string
	Description       string
	Type              string
	ConfigJson        string
	SecretsJson       string
	IntervalS         int64
	TimeoutS          int64
	Retries           int64
	RecoveryThreshold int64
	ResendIntervalMin int64
	AssignmentJson    string
	ConsensusPolicy   string
	Paused            int64
	Revision          int64
	UpdatedMs         int64
	TenantID          string
	ID                string
	ExpectedRevision  int64
}

type UpdateUserParams

type UpdateUserParams struct {
	Username         string
	DisplayName      string
	PasswordHash     string
	Role             string
	Disabled         int64
	Revision         int64
	UpdatedMs        int64
	TenantID         string
	ID               string
	ExpectedRevision int64
}

type UpsertMonitorStateParams

type UpsertMonitorStateParams struct {
	TenantID  string
	MonitorID string
	Status    string
	Confirmed int64
	SinceMs   int64
}

type UpsertNodeIncarnationParams

type UpsertNodeIncarnationParams struct {
	NodeID      string
	Incarnation string
	SeenMs      int64
}

type UpsertPlanParams

type UpsertPlanParams struct {
	ID         string
	Name       string
	LimitsJson string
	CreatedMs  int64
	UpdatedMs  int64
}

type UpsertProbeAlertParams added in v0.0.4

type UpsertProbeAlertParams struct {
	TenantID  string
	ProbeID   string
	Active    int64
	SinceMs   int64
	UpdatedMs int64
}

type UpsertSecretKeyParams

type UpsertSecretKeyParams struct {
	KeyID          string
	WrappedDek     []byte
	KekFingerprint string
	CreatedMs      int64
	RetiredMs      int64
}

type UpsertSigningKeyParams

type UpsertSigningKeyParams struct {
	Kid           string
	Alg           string
	PublicKey     []byte
	PrivateKeyEnc string
	CreatedMs     int64
	RetiredMs     int64
}

type UpsertStatusHistoryParams

type UpsertStatusHistoryParams struct {
	TenantID  string
	MonitorID string
	SinceMs   int64
	Status    string
}

type UpsertSystemAlertParams

type UpsertSystemAlertParams struct {
	Kind        string
	Subject     string
	Active      int64
	Level       int64
	SinceMs     int64
	UpdatedMs   int64
	DetailsJson string
}

type UpsertTenantParams

type UpsertTenantParams struct {
	ID           string
	Name         string
	ZitadelOrgID sql.NullString
	Plan         string
	LimitsJson   string
	Suspended    int64
	Source       string
	CreatedMs    int64
	UpdatedMs    int64
}

type User

type User struct {
	TenantID     string
	ID           string
	Username     string
	DisplayName  string
	PasswordHash string
	Role         string
	Disabled     int64
	Revision     int64
	CreatedMs    int64
	UpdatedMs    int64
	LastLoginMs  int64
}

type UserRevisionParams

type UserRevisionParams struct {
	TenantID string
	ID       string
}

Jump to

Keyboard shortcuts

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