Files
uptimesebi/internal/store/querier.go
T

259 lines
17 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
package store
import (
"context"
"time"
"github.com/google/uuid"
)
type Querier interface {
APITokenOrg(ctx context.Context, hash []byte) (uuid.UUID, error)
AddMaintenanceTarget(ctx context.Context, arg AddMaintenanceTargetParams) error
AddMembership(ctx context.Context, arg AddMembershipParams) error
AddMonitorRegion(ctx context.Context, arg AddMonitorRegionParams) error
AddStatusPageMonitor(ctx context.Context, arg AddStatusPageMonitorParams) error
AllMonitorRegions(ctx context.Context) ([]AllMonitorRegionsRow, error)
AnyUserExists(ctx context.Context) (bool, error)
// System scope. Leases due rows for five minutes so a crashed sender's rows
// come back; SKIP LOCKED lets every API replica work the outbox.
ClaimNotifications(ctx context.Context, max int32) ([]uuid.UUID, error)
// Shortens tokens that would outlive a newly set maximum lifetime.
ClampAPITokenExpiry(ctx context.Context, arg ClampAPITokenExpiryParams) (int64, error)
ClearMaintenanceTargets(ctx context.Context, windowID uuid.UUID) error
ClearStatusPageMonitors(ctx context.Context, pageID uuid.UUID) error
CountRoleAssignments(ctx context.Context, roleID uuid.UUID) (int64, error)
CountUnusedRecoveryCodes(ctx context.Context, userID uuid.UUID) (int64, error)
CreateAPIToken(ctx context.Context, arg CreateAPITokenParams) (ApiToken, error)
CreateAgent(ctx context.Context, arg CreateAgentParams) (Agent, error)
CreateAssignment(ctx context.Context, arg CreateAssignmentParams) (RoleAssignment, error)
CreateChannel(ctx context.Context, arg CreateChannelParams) (NotificationChannel, error)
CreateGroup(ctx context.Context, arg CreateGroupParams) (MonitorGroup, error)
CreateIdentity(ctx context.Context, arg CreateIdentityParams) error
CreateInvitation(ctx context.Context, arg CreateInvitationParams) (Invitation, error)
CreateMaintenance(ctx context.Context, arg CreateMaintenanceParams) (MaintenanceWindow, error)
CreateMonitor(ctx context.Context, arg CreateMonitorParams) (Monitor, error)
CreateOrg(ctx context.Context, arg CreateOrgParams) (Org, error)
CreateRegion(ctx context.Context, arg CreateRegionParams) (Region, error)
CreateRole(ctx context.Context, arg CreateRoleParams) (Role, error)
CreateSSOProvider(ctx context.Context, arg CreateSSOProviderParams) (SsoProvider, error)
CreateStatusPage(ctx context.Context, arg CreateStatusPageParams) (StatusPage, error)
CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
DailyBuckets(ctx context.Context, arg DailyBucketsParams) ([]DailyBucketsRow, error)
DailyBucketsForMonitors(ctx context.Context, arg DailyBucketsForMonitorsParams) ([]DailyBucketsForMonitorsRow, error)
DeleteAPIToken(ctx context.Context, id uuid.UUID) (int64, error)
DeleteAccountAudit(ctx context.Context, actorUserID *uuid.UUID) error
DeleteAgent(ctx context.Context, arg DeleteAgentParams) (int64, error)
DeleteAssignment(ctx context.Context, id uuid.UUID) (int64, error)
DeleteAssignmentsForResource(ctx context.Context, arg DeleteAssignmentsForResourceParams) error
DeleteChannel(ctx context.Context, id uuid.UUID) (int64, error)
DeleteGroup(ctx context.Context, id uuid.UUID) (int64, error)
DeleteInvitation(ctx context.Context, id uuid.UUID) (int64, error)
DeleteInvitationsForEmail(ctx context.Context, email string) error
DeleteLegalDocument(ctx context.Context, arg DeleteLegalDocumentParams) error
DeleteMaintenance(ctx context.Context, id uuid.UUID) (int64, error)
DeleteMonitor(ctx context.Context, id uuid.UUID) (int64, error)
DeleteMonitorRegions(ctx context.Context, monitorID uuid.UUID) error
DeleteOrg(ctx context.Context, id uuid.UUID) (int64, error)
DeleteOrgStorage(ctx context.Context, orgID uuid.UUID) error
DeleteRecoveryCodes(ctx context.Context, userID uuid.UUID) error
DeleteRegion(ctx context.Context, id uuid.UUID) (int64, error)
DeleteRole(ctx context.Context, id uuid.UUID) (int64, error)
DeleteSSOProvider(ctx context.Context, id uuid.UUID) (int64, error)
DeleteStatusPage(ctx context.Context, id uuid.UUID) (int64, error)
// Only the latest success per monitor and region is kept.
DeleteSuccessEvidence(ctx context.Context, arg DeleteSuccessEvidenceParams) error
DeleteUser(ctx context.Context, id uuid.UUID) (int64, error)
DisableTOTP(ctx context.Context, id uuid.UUID) error
EnableTOTP(ctx context.Context, arg EnableTOTPParams) error
EnqueueNotification(ctx context.Context, arg EnqueueNotificationParams) error
// An empty name names a new region after its key and keeps an existing name.
EnsurePlatformRegion(ctx context.Context, arg EnsurePlatformRegionParams) (Region, error)
// System scope: resolves a request to a page by verified custom domain or
// by slug.
FindPublishedPage(ctx context.Context, arg FindPublishedPageParams) (StatusPage, error)
// When each monitor and region first reported, to the day.
FirstDataDaily(ctx context.Context, orgID uuid.UUID) ([]FirstDataDailyRow, error)
// When each monitor and region first reported since $2, exactly. Used for
// data younger than the daily aggregate's resolution.
FirstDataRecent(ctx context.Context, arg FirstDataRecentParams) ([]FirstDataRecentRow, error)
// Keeps organization and platform entries readable as "deleted user" but
// drops who it was.
ForgetAuditActor(ctx context.Context, actorUserID *uuid.UUID) error
GetAPIToken(ctx context.Context, id uuid.UUID) (ApiToken, error)
GetAPITokenByHash(ctx context.Context, tokenHash []byte) (ApiToken, error)
// System scope.
GetAgentByHash(ctx context.Context, tokenHash []byte) (GetAgentByHashRow, error)
GetAssignment(ctx context.Context, id uuid.UUID) (RoleAssignment, error)
GetChannel(ctx context.Context, id uuid.UUID) (NotificationChannel, error)
GetEvidence(ctx context.Context, arg GetEvidenceParams) (CheckEvidence, error)
GetGroup(ctx context.Context, id uuid.UUID) (MonitorGroup, error)
GetIdentity(ctx context.Context, arg GetIdentityParams) (UserIdentity, error)
GetInvitation(ctx context.Context, id uuid.UUID) (Invitation, error)
GetInvitationByHash(ctx context.Context, tokenHash []byte) (GetInvitationByHashRow, error)
GetMaintenance(ctx context.Context, id uuid.UUID) (MaintenanceWindow, error)
GetMembership(ctx context.Context, arg GetMembershipParams) (Membership, error)
GetMonitor(ctx context.Context, id uuid.UUID) (Monitor, error)
GetOrg(ctx context.Context, id uuid.UUID) (Org, error)
GetOrgBySlug(ctx context.Context, slug string) (Org, error)
GetRegion(ctx context.Context, id uuid.UUID) (Region, error)
GetRole(ctx context.Context, id uuid.UUID) (Role, error)
GetSSOProvider(ctx context.Context, id uuid.UUID) (SsoProvider, error)
GetStatusPage(ctx context.Context, id uuid.UUID) (StatusPage, error)
GetUser(ctx context.Context, id uuid.UUID) (User, error)
GetUserByEmail(ctx context.Context, email string) (User, error)
// System scope: the monitor a ping token belongs to.
HeartbeatMonitor(ctx context.Context, target string) (HeartbeatMonitorRow, error)
// System scope: enabled heartbeat monitors with their grace period and
// since when they are being waited for: the latest result, or the last
// change of the monitor, which covers new and re-enabled ones. The result
// lookup is bounded because the longest interval plus grace is two days.
HeartbeatsDue(ctx context.Context) ([]HeartbeatsDueRow, error)
// Per monitor and hour since $2, across all regions.
HourlyBuckets(ctx context.Context, arg HourlyBucketsParams) ([]HourlyBucketsRow, error)
IncidentsForMonitors(ctx context.Context, arg IncidentsForMonitorsParams) ([]Incident, error)
// Incidents overlapping the time since $1, for SLA calculation.
IncidentsSince(ctx context.Context, resolvedAt *time.Time) ([]IncidentsSinceRow, error)
InsertAuditEvent(ctx context.Context, arg InsertAuditEventParams) error
// check_results and its aggregates have no row-level security (see
// migration 00013). Every query here must filter by org_id.
InsertCheckResults(ctx context.Context, arg []InsertCheckResultsParams) (int64, error)
InsertEvidence(ctx context.Context, arg InsertEvidenceParams) error
InsertRecoveryCodes(ctx context.Context, arg []InsertRecoveryCodesParams) (int64, error)
InvitationOrg(ctx context.Context, hash []byte) (uuid.UUID, error)
IsMember(ctx context.Context, arg IsMemberParams) (bool, error)
LastFailureEvidence(ctx context.Context, arg LastFailureEvidenceParams) (LastFailureEvidenceRow, error)
// Newest result per monitor and region in the org.
LatestResults(ctx context.Context, orgID uuid.UUID) ([]LatestResultsRow, error)
LatestResultsForMonitor(ctx context.Context, arg LatestResultsForMonitorParams) ([]LatestResultsForMonitorRow, error)
// The organization's documents and the platform's, organization first.
LegalDocuments(ctx context.Context, orgID *uuid.UUID) ([]LegalDocument, error)
ListAPITokens(ctx context.Context, arg ListAPITokensParams) ([]ListAPITokensRow, error)
// Agents owned by org, or platform agents when org is NULL.
ListAgents(ctx context.Context, orgID *uuid.UUID) ([]ListAgentsRow, error)
ListAssignments(ctx context.Context, orgID uuid.UUID) ([]ListAssignmentsRow, error)
// Newest first, paged by time. kind narrows to one kind; the row policy
// already limits what the scope can see.
ListAuditEvents(ctx context.Context, arg ListAuditEventsParams) ([]ListAuditEventsRow, error)
ListChannels(ctx context.Context) ([]NotificationChannel, error)
ListEnabledChannelIDs(ctx context.Context, orgID uuid.UUID) ([]uuid.UUID, error)
// System scope: every enabled monitor with its regions, for reconciling the
// schedule.
ListEnabledMonitorsForSchedule(ctx context.Context) ([]ListEnabledMonitorsForScheduleRow, error)
ListEnabledSSOProviders(ctx context.Context) ([]ListEnabledSSOProvidersRow, error)
ListEvidence(ctx context.Context, monitorID uuid.UUID) ([]ListEvidenceRow, error)
ListGroups(ctx context.Context) ([]MonitorGroup, error)
ListIncidents(ctx context.Context) ([]ListIncidentsRow, error)
ListMaintenance(ctx context.Context) ([]MaintenanceWindow, error)
ListMaintenanceTargets(ctx context.Context) ([]MaintenanceTarget, error)
ListMonitors(ctx context.Context) ([]Monitor, error)
ListOrgMembers(ctx context.Context, orgID uuid.UUID) ([]ListOrgMembersRow, error)
ListOrgs(ctx context.Context) ([]Org, error)
ListPendingInvitations(ctx context.Context) ([]ListPendingInvitationsRow, error)
ListPlatformRegions(ctx context.Context) ([]Region, error)
ListRoles(ctx context.Context) ([]Role, error)
ListSSOProviders(ctx context.Context) ([]SsoProvider, error)
ListStatusPages(ctx context.Context) ([]StatusPage, error)
ListUserIdentitiesInOrg(ctx context.Context, userID uuid.UUID) ([]ListUserIdentitiesInOrgRow, error)
ListUserOrgs(ctx context.Context, userID uuid.UUID) ([]ListUserOrgsRow, error)
// Row-level security limits this to platform regions and the scope's org;
// the org's own regions come first.
ListVisibleRegions(ctx context.Context) ([]Region, error)
// System scope: windows covering any of the monitors, directly or through
// their group or one of its ancestors.
MaintenanceForMonitors(ctx context.Context, ids []uuid.UUID) ([]MaintenanceForMonitorsRow, error)
MakeAdmin(ctx context.Context, id uuid.UUID) error
MarkDomainVerified(ctx context.Context, id uuid.UUID) error
MarkInvitationAccepted(ctx context.Context, id uuid.UUID) (int64, error)
MarkNotificationFailed(ctx context.Context, arg MarkNotificationFailedParams) error
MarkNotificationSent(ctx context.Context, id uuid.UUID) error
// Every role a member holds, with the scope it applies to.
MemberGrants(ctx context.Context, arg MemberGrantsParams) ([]MemberGrantsRow, error)
MonitorIncidents(ctx context.Context, monitorID uuid.UUID) ([]Incident, error)
MonitorRegions(ctx context.Context, monitorID uuid.UUID) ([]uuid.UUID, error)
// System scope: monitors to hand to a checker of region, skipping ones that
// were disabled, deleted or moved out of the region since dispatch. An
// org-owned checker only ever sees its org's monitors.
MonitorsForJobs(ctx context.Context, arg MonitorsForJobsParams) ([]Monitor, error)
// System scope: monitors a checker of region may report, with every region
// they are assigned to, for evaluation.
MonitorsForResults(ctx context.Context, arg MonitorsForResultsParams) ([]MonitorsForResultsRow, error)
// System scope.
NotificationDetails(ctx context.Context, ids []uuid.UUID) ([]NotificationDetailsRow, error)
OpenIncident(ctx context.Context, arg OpenIncidentParams) (Incident, error)
OpenIncidents(ctx context.Context) ([]Incident, error)
OrgAssignmentsExport(ctx context.Context, orgID uuid.UUID) ([]OrgAssignmentsExportRow, error)
OrgAuditExport(ctx context.Context, orgID uuid.UUID) ([]OrgAuditExportRow, error)
OrgDailyStats(ctx context.Context, orgID uuid.UUID) ([]OrgDailyStatsRow, error)
OrgIDBySlug(ctx context.Context, slug string) (uuid.UUID, error)
OrgIncidentsExport(ctx context.Context, orgID uuid.UUID) ([]OrgIncidentsExportRow, error)
OrgMembersExport(ctx context.Context, orgID uuid.UUID) ([]OrgMembersExportRow, error)
// Organizations user owns, with their member count.
OwnedOrgs(ctx context.Context, userID uuid.UUID) ([]OwnedOrgsRow, error)
PurgeAuditEvents(ctx context.Context, argTime time.Time) (int64, error)
PurgeEvidence(ctx context.Context, argTime time.Time) (int64, error)
PurgeExpiredTokens(ctx context.Context, expiresAt *time.Time) (int64, error)
// Incidents resolved before the oldest data still charted.
PurgeIncidents(ctx context.Context, resolvedAt *time.Time) (int64, error)
PurgeInvitations(ctx context.Context, expiresAt time.Time) (int64, error)
// Delivered and given-up notifications; pending ones are still being worked.
PurgeNotifications(ctx context.Context, createdAt time.Time) (int64, error)
PurgeOrgCheckData(ctx context.Context, org uuid.UUID) error
// Raw results bucketed by width since a point in time, for short ranges.
RangeBuckets(ctx context.Context, arg RangeBucketsParams) ([]RangeBucketsRow, error)
// The daily aggregate rebucketed by width, for ranges of months.
RangeBucketsDaily(ctx context.Context, arg RangeBucketsDailyParams) ([]RangeBucketsDailyRow, error)
// The hourly aggregate rebucketed by width, for ranges of days.
RangeBucketsHourly(ctx context.Context, arg RangeBucketsHourlyParams) ([]RangeBucketsHourlyRow, error)
RecentResults(ctx context.Context, arg RecentResultsParams) ([]RecentResultsRow, error)
// One monitor's raw results per region.
RegionBuckets(ctx context.Context, arg RegionBucketsParams) ([]RegionBucketsRow, error)
RegionBucketsDaily(ctx context.Context, arg RegionBucketsDailyParams) ([]RegionBucketsDailyRow, error)
RegionBucketsHourly(ctx context.Context, arg RegionBucketsHourlyParams) ([]RegionBucketsHourlyRow, error)
RegroupMonitors(ctx context.Context, arg RegroupMonitorsParams) error
RemoveMembership(ctx context.Context, arg RemoveMembershipParams) (int64, error)
// Moves the subgroups of a group that is about to be deleted.
ReparentGroups(ctx context.Context, arg ReparentGroupsParams) error
ResolveIncident(ctx context.Context, arg ResolveIncidentParams) (Incident, error)
ScrubAuditEmail(ctx context.Context, email string) error
SetPasswordHash(ctx context.Context, arg SetPasswordHashParams) error
// Changing the domain drops a previous verification.
SetStatusPageDomain(ctx context.Context, arg SetStatusPageDomainParams) (StatusPage, error)
SetUserAdmin(ctx context.Context, arg SetUserAdminParams) (int64, error)
SetUserLocale(ctx context.Context, arg SetUserLocaleParams) error
StatusPageMonitors(ctx context.Context, pageID uuid.UUID) ([]StatusPageMonitorsRow, error)
// Deletes key and, as certmagic expects, everything below it.
StorageDelete(ctx context.Context, arg StorageDeleteParams) (int64, error)
StorageGet(ctx context.Context, arg StorageGetParams) (StorageGetRow, error)
StorageList(ctx context.Context, arg StorageListParams) ([]StorageListRow, error)
StoragePut(ctx context.Context, arg StoragePutParams) error
TouchAPIToken(ctx context.Context, id uuid.UUID) error
TouchAgent(ctx context.Context, arg TouchAgentParams) error
TouchIdentity(ctx context.Context, arg TouchIdentityParams) error
UpdateChannel(ctx context.Context, arg UpdateChannelParams) (NotificationChannel, error)
UpdateGroup(ctx context.Context, arg UpdateGroupParams) (MonitorGroup, error)
UpdateMaintenance(ctx context.Context, arg UpdateMaintenanceParams) (MaintenanceWindow, error)
UpdateMonitor(ctx context.Context, arg UpdateMonitorParams) (Monitor, error)
UpdateOrgPolicy(ctx context.Context, arg UpdateOrgPolicyParams) (Org, error)
UpdateRole(ctx context.Context, arg UpdateRoleParams) (Role, error)
UpdateSSOProvider(ctx context.Context, arg UpdateSSOProviderParams) (SsoProvider, error)
UpdateStatusPage(ctx context.Context, arg UpdateStatusPageParams) (StatusPage, error)
UpsertLegalDocument(ctx context.Context, arg UpsertLegalDocumentParams) error
// Uptime per monitor from the hourly aggregate, including the not yet
// materialized most recent hours (real-time aggregation).
UptimeSince(ctx context.Context, arg UptimeSinceParams) ([]UptimeSinceRow, error)
UseRecoveryCode(ctx context.Context, arg UseRecoveryCodeParams) (int64, error)
// Everything the user did, in any organization, and their own account log.
UserAuditEvents(ctx context.Context, actorUserID *uuid.UUID) ([]UserAuditEventsRow, error)
UserIdentities(ctx context.Context, userID uuid.UUID) ([]UserIdentitiesRow, error)
UserMemberships(ctx context.Context, userID uuid.UUID) ([]UserMembershipsRow, error)
UserRoleNames(ctx context.Context, userID uuid.UUID) ([]UserRoleNamesRow, error)
UserTokens(ctx context.Context, userID uuid.UUID) ([]UserTokensRow, error)
}
var _ Querier = (*Queries)(nil)