database

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const MaxRRsetBatch = 100

Variables

View Source
var (
	ErrDatabaseUnavailable     = errors.New("database: unavailable")
	ErrUnsupportedPostgreSQL   = errors.New("database: unsupported PostgreSQL version")
	ErrReadOnlyDatabase        = errors.New("database: primary is not writable")
	ErrIncompatibleSchema      = errors.New("database: incompatible schema")
	ErrAuditUnavailable        = errors.New("database: audit storage unavailable")
	ErrInstallationUnavailable = errors.New("database: installation unavailable")
)
View Source
var (
	// ErrUnauthenticated reports an unusable credential without disclosing why.
	ErrUnauthenticated = errors.New("database: unauthenticated")
	// ErrForbidden reports an authenticated actor lacking current authority.
	ErrForbidden = errors.New("database: forbidden")
	// ErrNotFound reports a resource that is not visible or does not exist.
	ErrNotFound = errors.New("database: not found")
	// ErrConflict reports a request conflicting with current durable state.
	ErrConflict = errors.New("database: conflict")
	// ErrInvalid reports invalid domain input.
	ErrInvalid = errors.New("database: invalid input")
)
View Source
var ErrBrowseLeaseLost = errors.New("database: browse lease lost")

ErrBrowseLeaseLost prevents a replaced, expired or retired worker publishing.

View Source
var ErrMigrationDrift = errors.New("database: migration drift")

ErrMigrationDrift means an applied migration no longer matches the binary.

Functions

func CheckRuntimeCompatibility

func CheckRuntimeCompatibility(ctx context.Context, database runtimeQueryRower) error

CheckRuntimeCompatibility verifies all durable readiness invariants without creating or migrating schema.

func Migrate

func Migrate(ctx context.Context, conn *pgx.Conn) error

Migrate applies every embedded migration in order under a database-wide lock.

func ValidBrowserSession

func ValidBrowserSession(secret string) bool

ValidBrowserSession verifies the distinct, canonical browser credential syntax.

Types

type APIToken

type APIToken struct {
	ID         string             `db:"id"`
	IdentityID string             `db:"identity_id"`
	Label      string             `db:"label"`
	Digest     []byte             `db:"digest"`
	ExpiresAt  pgtype.Timestamptz `db:"expires_at"`
	RevokedAt  pgtype.Timestamptz `db:"revoked_at"`
	CreatedAt  pgtype.Timestamptz `db:"created_at"`
}

type Actor

type Actor struct {
	IdentityID string
	TokenID    string
	Kind       string
	Handle     string
	Operator   bool
	RequestID  string
}

Actor is the current authenticated identity and token at one decision point.

type AddGroupMembershipParams

type AddGroupMembershipParams struct {
	GroupID           string `db:"group_id"`
	IdentityID        string `db:"identity_id"`
	AddedByIdentityID string `db:"added_by_identity_id"`
}

type AuditEvent

type AuditEvent struct {
	ID                   string             `db:"id"`
	OccurredAt           pgtype.Timestamptz `db:"occurred_at"`
	EventKind            string             `db:"event_kind"`
	OperationID          *string            `db:"operation_id"`
	IntentEventID        *string            `db:"intent_event_id"`
	IntentEventKind      *string            `db:"intent_event_kind"`
	RequestID            string             `db:"request_id"`
	ActorIdentityID      *string            `db:"actor_identity_id"`
	ActorTokenID         *string            `db:"actor_token_id"`
	Action               string             `db:"action"`
	TargetKind           string             `db:"target_kind"`
	TargetID             string             `db:"target_id"`
	Result               string             `db:"result"`
	RRsetSummary         []byte             `db:"rrset_summary"`
	MatchedDelegationIDs []string           `db:"matched_delegation_ids"`
	Details              []byte             `db:"details"`
	ResponseClass        *string            `db:"response_class"`
	ResponseCode         *int32             `db:"response_code"`
	RequestDigest        []byte             `db:"request_digest"`
	ResponseDigest       []byte             `db:"response_digest"`
	DeadlineAt           pgtype.Timestamptz `db:"deadline_at"`
}

type AuditListOptions

type AuditListOptions struct {
	Limit      int
	After      *page.Key
	ActorID    *string
	Action     *string
	TargetKind *string
	TargetID   *string
	Result     *string
}

type AuditPage

type AuditPage struct {
	Items []AuditRecord
	Next  *page.Key
}

type AuditRecord

type AuditRecord struct {
	ID         string          `json:"id"`
	OccurredAt time.Time       `json:"occurred_at"`
	RequestID  string          `json:"request_id"`
	ActorID    *string         `json:"actor_id"`
	Action     string          `json:"action"`
	TargetKind string          `json:"target_type"`
	TargetID   string          `json:"target_id"`
	Result     string          `json:"result"`
	Details    json.RawMessage `json:"details"`
}

type AuthenticateTokenParams

type AuthenticateTokenParams struct {
	CredentialDigest []byte `db:"credential_digest"`
	IsSession        bool   `db:"is_session"`
}

type AuthenticateTokenRow

type AuthenticateTokenRow struct {
	TokenID    string `db:"token_id"`
	IdentityID string `db:"identity_id"`
	Kind       string `db:"kind"`
	Handle     string `db:"handle"`
	IsOperator bool   `db:"is_operator"`
}

type AuthorizationDecision

type AuthorizationDecision struct {
	Actor                Actor              `json:"-"`
	Allowed              bool               `json:"allowed"`
	ZoneBindingID        string             `json:"-"`
	Denied               []DeniedRRsetTuple `json:"denied"`
	MatchedDelegationIDs []string           `json:"-"`
}

type AuthorizationDenialInput

type AuthorizationDenialInput struct {
	Action        string
	TargetKind    string
	TargetID      string
	Details       map[string]any
	RequestDigest []byte
}

AuthorizationDenialInput is sanitized evidence for an authenticated request rejected before a DNS mutation handler is reached.

type AuthorizeRRsetBatchParams

type AuthorizeRRsetBatchParams struct {
	CredentialDigest []byte `db:"credential_digest"`
	IsSession        bool   `db:"is_session"`
	Tuples           []byte `db:"tuples"`
	Upstream         string `db:"upstream"`
	PowerDNSZoneID   string `db:"powerdns_zone_id"`
}

type AuthorizeRRsetBatchRow

type AuthorizeRRsetBatchRow struct {
	TokenID              string   `db:"token_id"`
	IdentityID           string   `db:"identity_id"`
	IdentityKind         string   `db:"identity_kind"`
	IdentityHandle       string   `db:"identity_handle"`
	IsOperator           bool     `db:"is_operator"`
	ZoneBindingID        string   `db:"zone_binding_id"`
	BatchIndex           int32    `db:"batch_index"`
	Owner                string   `db:"owner"`
	RecordType           string   `db:"record_type"`
	ChangeKind           string   `db:"change_kind"`
	Allowed              bool     `db:"allowed"`
	MatchedDelegationIDs []string `db:"matched_delegation_ids"`
}

type BootstrapInput

type BootstrapInput struct {
	Handle      string
	DisplayName string
	TokenLabel  string
}

type BootstrapResult

type BootstrapResult struct {
	InstallationID string
	Identity       Identity
	Token          CreatedToken
}

type BrowseChange

type BrowseChange struct {
	Zone       string             `db:"zone"`
	Operation  string             `db:"operation"`
	Name       string             `db:"name"`
	Type       string             `db:"type"`
	ReadyAt    pgtype.Timestamptz `db:"ready_at"`
	ChangedAt  pgtype.Timestamptz `db:"changed_at"`
	Processed  bool               `db:"processed"`
	Lease      *string            `db:"lease"`
	LeaseUntil pgtype.Timestamptz `db:"lease_until"`
}

type BrowseChangeClaim

type BrowseChangeClaim struct {
	BrowseClaim
	Operation, Name, Type string
}

BrowseChangeClaim identifies one durable affected-set read, never a DNS write.

type BrowseClaim

type BrowseClaim struct{ Zone, ZoneID, Lease string }

BrowseClaim fences one collection against lease replacement and zone lifetime.

type BrowseOptions

type BrowseOptions struct{ Name, Match, Type, Cursor string }

type BrowsePage

type BrowsePage struct {
	Items           []json.RawMessage `json:"items"`
	NextCursor      *string           `json:"next_cursor"`
	State           string            `json:"state"`
	LastRefreshedAt *time.Time        `json:"last_refreshed_at"`
	Error           *string           `json:"error"`
}

BrowsePage carries bounded complete RRsets and explicit snapshot freshness.

type BrowseRrset

type BrowseRrset struct {
	Zone       string `db:"zone"`
	Generation string `db:"generation"`
	Name       string `db:"name"`
	Type       string `db:"type"`
	Payload    []byte `db:"payload"`
}

type BrowseWorker

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

BrowseWorker runs one full collection and one affected-set reader per instance. Shared PostgreSQL leases coalesce requests and recover interrupted readers.

func NewBrowseWorker

func NewBrowseWorker(store *Store, client *upstream.Client, upstreamID string, ready func() bool) *BrowseWorker

func (*BrowseWorker) Run

func (w *BrowseWorker) Run(ctx context.Context) error

Run owns every worker goroutine; all exit and are joined on cancellation.

type BrowseZone

type BrowseZone struct {
	ID             string             `db:"id"`
	Upstream       string             `db:"upstream"`
	ZoneID         string             `db:"zone_id"`
	Generation     *string            `db:"generation"`
	Revision       int64              `db:"revision"`
	CursorKey      []byte             `db:"cursor_key"`
	LastViewedAt   pgtype.Timestamptz `db:"last_viewed_at"`
	RefreshedAt    pgtype.Timestamptz `db:"refreshed_at"`
	Error          *string            `db:"error"`
	FullRequested  bool               `db:"full_requested"`
	FullLease      *string            `db:"full_lease"`
	FullLeaseUntil pgtype.Timestamptz `db:"full_lease_until"`
	FullStartedAt  pgtype.Timestamptz `db:"full_started_at"`
	RetryAt        pgtype.Timestamptz `db:"retry_at"`
}

type BrowserSession

type BrowserSession struct {
	Digest    []byte             `db:"digest"`
	TokenID   string             `db:"token_id"`
	CreatedAt pgtype.Timestamptz `db:"created_at"`
	ExpiresAt pgtype.Timestamptz `db:"expires_at"`
}

type CloseOverdueDNSIntentsParams

type CloseOverdueDNSIntentsParams struct {
	EventIDs []string `db:"event_ids"`
	RowLimit int32    `db:"row_limit"`
}

type CreateAPITokenParams

type CreateAPITokenParams struct {
	ID         string             `db:"id"`
	IdentityID string             `db:"identity_id"`
	Label      string             `db:"label"`
	Digest     []byte             `db:"digest"`
	ExpiresAt  pgtype.Timestamptz `db:"expires_at"`
}

type CreateAPITokenRow

type CreateAPITokenRow struct {
	ID         string             `db:"id"`
	IdentityID string             `db:"identity_id"`
	Label      string             `db:"label"`
	ExpiresAt  pgtype.Timestamptz `db:"expires_at"`
	RevokedAt  pgtype.Timestamptz `db:"revoked_at"`
	CreatedAt  pgtype.Timestamptz `db:"created_at"`
	Status     string             `db:"status"`
}

type CreateBrowserSessionParams

type CreateBrowserSessionParams struct {
	SessionDigest []byte `db:"session_digest"`
	TokenDigest   []byte `db:"token_digest"`
}

type CreateDelegationChangeKindParams

type CreateDelegationChangeKindParams struct {
	DelegationID string `db:"delegation_id"`
	ChangeKind   string `db:"change_kind"`
}

type CreateDelegationParams

type CreateDelegationParams struct {
	ID                  string `db:"id"`
	ZoneBindingID       string `db:"zone_binding_id"`
	GranteeIdentityID   string `db:"grantee_identity_id"`
	GranteeGroupID      string `db:"grantee_group_id"`
	CreatedByIdentityID string `db:"created_by_identity_id"`
}

type CreateDelegationRecordTypeParams

type CreateDelegationRecordTypeParams struct {
	DelegationID string `db:"delegation_id"`
	RecordType   string `db:"record_type"`
}

type CreateDelegationSelectorParams

type CreateDelegationSelectorParams struct {
	DelegationID   string `db:"delegation_id"`
	Position       int16  `db:"position"`
	Kind           string `db:"kind"`
	Selector       string `db:"selector"`
	SQLLikePattern string `db:"sql_like_pattern"`
}

type CreateGroupParams

type CreateGroupParams struct {
	ID          string  `db:"id"`
	Handle      string  `db:"handle"`
	DisplayName *string `db:"display_name"`
}

type CreateIdentityParams

type CreateIdentityParams struct {
	ID          string  `db:"id"`
	Kind        string  `db:"kind"`
	Handle      string  `db:"handle"`
	DisplayName *string `db:"display_name"`
}

type CreateOperatorIdentityParams

type CreateOperatorIdentityParams struct {
	ID          string  `db:"id"`
	Handle      string  `db:"handle"`
	DisplayName *string `db:"display_name"`
}

type CreateZoneBindingParams

type CreateZoneBindingParams struct {
	ID                  string `db:"id"`
	Generation          int64  `db:"generation"`
	Upstream            string `db:"upstream"`
	PowerDNSZoneID      string `db:"powerdns_zone_id"`
	ZoneName            string `db:"zone_name"`
	CreatedByIdentityID string `db:"created_by_identity_id"`
}

type CreatedBrowserSession

type CreatedBrowserSession struct {
	Secret    string `json:"-"`
	ExpiresAt time.Time
}

CreatedBrowserSession carries the one-time secret to the cookie response only.

type CreatedToken

type CreatedToken struct {
	Token  TokenMetadata
	Secret string
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type DNSIntent

type DNSIntent struct {
	EventID     string
	OperationID string
	Deadline    time.Time
}

type DNSIntentInput

type DNSIntentInput struct {
	Action               string
	TargetKind           string
	TargetID             string
	RRsets               []RRsetTuple
	MatchedDelegationIDs []string
	RequestDigest        []byte
	Deadline             time.Time
}

type DNSOutcome

type DNSOutcome struct {
	ID             string
	EventKind      string
	IntentEventID  string
	OperationID    string
	Result         string
	ResponseClass  *string
	ResponseCode   *int32
	ResponseDigest []byte
	OccurredAt     pgtype.Timestamptz
}

type DNSOutcomeInput

type DNSOutcomeInput struct {
	IntentEventID  string
	OperationID    string
	Result         string
	ResponseClass  string
	ResponseCode   *int
	ResponseDigest []byte
}

type Delegation

type Delegation struct {
	ID                  string             `db:"id"`
	ZoneBindingID       string             `db:"zone_binding_id"`
	GranteeIdentityID   *string            `db:"grantee_identity_id"`
	GranteeGroupID      *string            `db:"grantee_group_id"`
	CreatedByIdentityID string             `db:"created_by_identity_id"`
	RevokedByIdentityID *string            `db:"revoked_by_identity_id"`
	CreatedAt           pgtype.Timestamptz `db:"created_at"`
	RevokedAt           pgtype.Timestamptz `db:"revoked_at"`
}

type DelegationChangeKind

type DelegationChangeKind struct {
	DelegationID string `db:"delegation_id"`
	ChangeKind   string `db:"change_kind"`
}

type DelegationCreate

type DelegationCreate struct {
	ZoneBindingID     string
	GranteeIdentityID *string
	GranteeGroupID    *string
	Selectors         []DelegationSelectorInput
	RecordTypes       *[]string
	ChangeKinds       *[]string
}

type DelegationDetails

type DelegationDetails struct {
	ZoneID        string
	ZoneName      string
	ID            string
	ZoneBindingID string
	GranteeKind   string
	GranteeID     string
	Selectors     []DelegationSelectorInput
	RecordTypes   []string
	ChangeKinds   []string
	CreatedAt     pgtype.Timestamptz
	RevokedAt     pgtype.Timestamptz
}

type DelegationListOptions

type DelegationListOptions struct {
	Limit         int
	After         *page.Key
	ZoneBindingID *string
	GranteeID     *string
	Active        *bool
}

type DelegationPage

type DelegationPage struct {
	Items []DelegationDetails
	Next  *page.Key
}

type DelegationRecordType

type DelegationRecordType struct {
	DelegationID string `db:"delegation_id"`
	RecordType   string `db:"record_type"`
}

type DelegationSelector

type DelegationSelector struct {
	DelegationID   string `db:"delegation_id"`
	Position       int16  `db:"position"`
	Kind           string `db:"kind"`
	Selector       string `db:"selector"`
	SQLLikePattern string `db:"sql_like_pattern"`
}

type DelegationSelectorInput

type DelegationSelectorInput struct {
	Kind  delegationdomain.SelectorKind
	Value string
}

type DeniedRRsetTuple

type DeniedRRsetTuple struct {
	Index      int    `json:"index"`
	Owner      string `json:"owner"`
	RecordType string `json:"record_type"`
	ChangeKind string `json:"change_kind"`
}

type GetAPITokenMetadataParams

type GetAPITokenMetadataParams struct {
	IdentityID string `db:"identity_id"`
	ID         string `db:"id"`
}

type GetAPITokenMetadataRow

type GetAPITokenMetadataRow struct {
	ID         string             `db:"id"`
	IdentityID string             `db:"identity_id"`
	Label      string             `db:"label"`
	ExpiresAt  pgtype.Timestamptz `db:"expires_at"`
	RevokedAt  pgtype.Timestamptz `db:"revoked_at"`
	CreatedAt  pgtype.Timestamptz `db:"created_at"`
	Status     string             `db:"status"`
}

type GetActiveZoneBindingByUpstreamZoneIDForUpdateParams

type GetActiveZoneBindingByUpstreamZoneIDForUpdateParams struct {
	Upstream       string `db:"upstream"`
	PowerDNSZoneID string `db:"powerdns_zone_id"`
}

type GetAuditEventByIDRow

type GetAuditEventByIDRow struct {
	ID                   string             `db:"id"`
	OccurredAt           pgtype.Timestamptz `db:"occurred_at"`
	EventKind            string             `db:"event_kind"`
	OperationID          *string            `db:"operation_id"`
	IntentEventID        *string            `db:"intent_event_id"`
	RequestID            string             `db:"request_id"`
	ActorIdentityID      *string            `db:"actor_identity_id"`
	ActorTokenID         *string            `db:"actor_token_id"`
	Action               string             `db:"action"`
	TargetKind           string             `db:"target_kind"`
	TargetID             string             `db:"target_id"`
	Result               string             `db:"result"`
	RRsetSummary         []byte             `db:"rrset_summary"`
	MatchedDelegationIDs []string           `db:"matched_delegation_ids"`
	Details              []byte             `db:"details"`
	ResponseClass        *string            `db:"response_class"`
	ResponseCode         *int32             `db:"response_code"`
	RequestDigest        []byte             `db:"request_digest"`
	ResponseDigest       []byte             `db:"response_digest"`
	DeadlineAt           pgtype.Timestamptz `db:"deadline_at"`
}

type GetBootstrapStateRow

type GetBootstrapStateRow struct {
	Installations int64 `db:"installations"`
	Identities    int64 `db:"identities"`
}

type GetBrowseZoneParams

type GetBrowseZoneParams struct {
	Upstream string `db:"upstream"`
	ZoneID   string `db:"zone_id"`
}

type GetDNSOutcomeByOperationIDRow

type GetDNSOutcomeByOperationIDRow struct {
	ID             string             `db:"id"`
	EventKind      string             `db:"event_kind"`
	OperationID    string             `db:"operation_id"`
	IntentEventID  string             `db:"intent_event_id"`
	Result         string             `db:"result"`
	ResponseClass  *string            `db:"response_class"`
	ResponseCode   *int32             `db:"response_code"`
	ResponseDigest []byte             `db:"response_digest"`
	OccurredAt     pgtype.Timestamptz `db:"occurred_at"`
}

type GetDelegationDetailsRow

type GetDelegationDetailsRow struct {
	ID            string             `db:"id"`
	ZoneBindingID string             `db:"zone_binding_id"`
	GranteeKind   string             `db:"grantee_kind"`
	GranteeID     string             `db:"grantee_id"`
	CreatedAt     pgtype.Timestamptz `db:"created_at"`
	RevokedAt     pgtype.Timestamptz `db:"revoked_at"`
}

type GetGroupMembershipParams

type GetGroupMembershipParams struct {
	GroupID    string `db:"group_id"`
	IdentityID string `db:"identity_id"`
}

type GetInstallationMetadataRow

type GetInstallationMetadataRow struct {
	InstallationID     string             `db:"installation_id"`
	InitializedAt      pgtype.Timestamptz `db:"initialized_at"`
	RestoreRequired    bool               `db:"restore_required"`
	RestoreFinalizedAt pgtype.Timestamptz `db:"restore_finalized_at"`
}

type GetZoneDeletionReconciliationStateRow

type GetZoneDeletionReconciliationStateRow struct {
	LatestResult    string `db:"latest_result"`
	HasAttempt      bool   `db:"has_attempt"`
	HasPending      bool   `db:"has_pending"`
	HasSucceeded    bool   `db:"has_succeeded"`
	HasRetryable    bool   `db:"has_retryable"`
	ConfirmedAbsent bool   `db:"confirmed_absent"`
}

type Group

type Group struct {
	ID          string             `db:"id"`
	Handle      string             `db:"handle"`
	DisplayName *string            `db:"display_name"`
	Enabled     bool               `db:"enabled"`
	CreatedAt   pgtype.Timestamptz `db:"created_at"`
	UpdatedAt   pgtype.Timestamptz `db:"updated_at"`
}

type GroupCreate

type GroupCreate struct {
	Handle      string
	DisplayName *string
}

type GroupListOptions

type GroupListOptions struct {
	Limit        int
	After        *page.Key
	Enabled      *bool
	Handle       *string
	HandlePrefix *string
}

type GroupMembership

type GroupMembership struct {
	GroupID           string             `db:"group_id"`
	IdentityID        string             `db:"identity_id"`
	AddedByIdentityID string             `db:"added_by_identity_id"`
	CreatedAt         pgtype.Timestamptz `db:"created_at"`
}

type GroupPage

type GroupPage struct {
	Items []Group
	Next  *page.Key
}

type GroupPatch

type GroupPatch struct {
	DisplayName NullableStringPatch
	Enabled     *bool
}

type Identity

type Identity struct {
	ID          string             `db:"id"`
	Kind        string             `db:"kind"`
	Handle      string             `db:"handle"`
	DisplayName *string            `db:"display_name"`
	Enabled     bool               `db:"enabled"`
	IsOperator  bool               `db:"is_operator"`
	CreatedAt   pgtype.Timestamptz `db:"created_at"`
	UpdatedAt   pgtype.Timestamptz `db:"updated_at"`
}

type IdentityCreate

type IdentityCreate struct {
	Kind        string
	Handle      string
	DisplayName *string
}

type IdentityListOptions

type IdentityListOptions struct {
	Limit        int
	After        *page.Key
	Kind         *string
	Enabled      *bool
	Operator     *bool
	Handle       *string
	HandlePrefix *string
}

type IdentityPage

type IdentityPage struct {
	Items []Identity
	Next  *page.Key
}

type IdentityPatch

type IdentityPatch struct {
	DisplayName NullableStringPatch
	Enabled     *bool
	Operator    *bool
}

type InsertAuthorizationDeniedAuditParams

type InsertAuthorizationDeniedAuditParams struct {
	ID              string `db:"id"`
	RequestID       string `db:"request_id"`
	ActorIdentityID string `db:"actor_identity_id"`
	ActorTokenID    string `db:"actor_token_id"`
	Action          string `db:"action"`
	TargetKind      string `db:"target_kind"`
	TargetID        string `db:"target_id"`
	Details         []byte `db:"details"`
	RequestDigest   []byte `db:"request_digest"`
}

type InsertAuthorizationDeniedAuditRow

type InsertAuthorizationDeniedAuditRow struct {
	ID                   string             `db:"id"`
	OccurredAt           pgtype.Timestamptz `db:"occurred_at"`
	EventKind            string             `db:"event_kind"`
	OperationID          *string            `db:"operation_id"`
	IntentEventID        *string            `db:"intent_event_id"`
	RequestID            string             `db:"request_id"`
	ActorIdentityID      *string            `db:"actor_identity_id"`
	ActorTokenID         *string            `db:"actor_token_id"`
	Action               string             `db:"action"`
	TargetKind           string             `db:"target_kind"`
	TargetID             string             `db:"target_id"`
	Result               string             `db:"result"`
	RRsetSummary         []byte             `db:"rrset_summary"`
	MatchedDelegationIDs []string           `db:"matched_delegation_ids"`
	Details              []byte             `db:"details"`
	ResponseClass        *string            `db:"response_class"`
	ResponseCode         *int32             `db:"response_code"`
	RequestDigest        []byte             `db:"request_digest"`
	ResponseDigest       []byte             `db:"response_digest"`
	DeadlineAt           pgtype.Timestamptz `db:"deadline_at"`
}

type InsertDNSIntentParams

type InsertDNSIntentParams struct {
	ID                   string             `db:"id"`
	OperationID          string             `db:"operation_id"`
	RequestID            string             `db:"request_id"`
	ActorIdentityID      string             `db:"actor_identity_id"`
	ActorTokenID         string             `db:"actor_token_id"`
	Action               string             `db:"action"`
	TargetKind           string             `db:"target_kind"`
	TargetID             string             `db:"target_id"`
	RRsetSummary         []byte             `db:"rrset_summary"`
	MatchedDelegationIDs []string           `db:"matched_delegation_ids"`
	RequestDigest        []byte             `db:"request_digest"`
	DeadlineAt           pgtype.Timestamptz `db:"deadline_at"`
}

type InsertDNSIntentRow

type InsertDNSIntentRow struct {
	ID                   string             `db:"id"`
	OccurredAt           pgtype.Timestamptz `db:"occurred_at"`
	EventKind            string             `db:"event_kind"`
	OperationID          *string            `db:"operation_id"`
	IntentEventID        *string            `db:"intent_event_id"`
	RequestID            string             `db:"request_id"`
	ActorIdentityID      *string            `db:"actor_identity_id"`
	ActorTokenID         *string            `db:"actor_token_id"`
	Action               string             `db:"action"`
	TargetKind           string             `db:"target_kind"`
	TargetID             string             `db:"target_id"`
	Result               string             `db:"result"`
	RRsetSummary         []byte             `db:"rrset_summary"`
	MatchedDelegationIDs []string           `db:"matched_delegation_ids"`
	Details              []byte             `db:"details"`
	ResponseClass        *string            `db:"response_class"`
	ResponseCode         *int32             `db:"response_code"`
	RequestDigest        []byte             `db:"request_digest"`
	ResponseDigest       []byte             `db:"response_digest"`
	DeadlineAt           pgtype.Timestamptz `db:"deadline_at"`
}

type InsertDNSOutcomeParams

type InsertDNSOutcomeParams struct {
	ID             string `db:"id"`
	Result         string `db:"result"`
	ResponseClass  string `db:"response_class"`
	ResponseCode   *int32 `db:"response_code"`
	ResponseDigest []byte `db:"response_digest"`
	IntentEventID  string `db:"intent_event_id"`
	OperationID    string `db:"operation_id"`
}

type InsertManagementAuditParams

type InsertManagementAuditParams struct {
	ID              string `db:"id"`
	RequestID       string `db:"request_id"`
	ActorIdentityID string `db:"actor_identity_id"`
	ActorTokenID    string `db:"actor_token_id"`
	Action          string `db:"action"`
	TargetKind      string `db:"target_kind"`
	TargetID        string `db:"target_id"`
	Result          string `db:"result"`
	Details         []byte `db:"details"`
}

type InsertManagementAuditRow

type InsertManagementAuditRow struct {
	ID                   string             `db:"id"`
	OccurredAt           pgtype.Timestamptz `db:"occurred_at"`
	EventKind            string             `db:"event_kind"`
	OperationID          *string            `db:"operation_id"`
	IntentEventID        *string            `db:"intent_event_id"`
	RequestID            string             `db:"request_id"`
	ActorIdentityID      *string            `db:"actor_identity_id"`
	ActorTokenID         *string            `db:"actor_token_id"`
	Action               string             `db:"action"`
	TargetKind           string             `db:"target_kind"`
	TargetID             string             `db:"target_id"`
	Result               string             `db:"result"`
	RRsetSummary         []byte             `db:"rrset_summary"`
	MatchedDelegationIDs []string           `db:"matched_delegation_ids"`
	Details              []byte             `db:"details"`
	ResponseClass        *string            `db:"response_class"`
	ResponseCode         *int32             `db:"response_code"`
	RequestDigest        []byte             `db:"request_digest"`
	ResponseDigest       []byte             `db:"response_digest"`
	DeadlineAt           pgtype.Timestamptz `db:"deadline_at"`
}

type InstallationMetadata

type InstallationMetadata struct {
	Singleton          bool               `db:"singleton"`
	InstallationID     string             `db:"installation_id"`
	InitializedAt      pgtype.Timestamptz `db:"initialized_at"`
	RestoreRequired    bool               `db:"restore_required"`
	RestoreFinalizedAt pgtype.Timestamptz `db:"restore_finalized_at"`
}

type ListAPITokensParams

type ListAPITokensParams struct {
	IdentityID     string             `db:"identity_id"`
	AfterCreatedAt pgtype.Timestamptz `db:"after_created_at"`
	AfterID        string             `db:"after_id"`
	RowLimit       int32              `db:"row_limit"`
}

type ListAPITokensRow

type ListAPITokensRow struct {
	ID         string             `db:"id"`
	IdentityID string             `db:"identity_id"`
	Label      string             `db:"label"`
	ExpiresAt  pgtype.Timestamptz `db:"expires_at"`
	RevokedAt  pgtype.Timestamptz `db:"revoked_at"`
	CreatedAt  pgtype.Timestamptz `db:"created_at"`
	Status     string             `db:"status"`
}

type ListActiveZoneBindingCandidatesParams

type ListActiveZoneBindingCandidatesParams struct {
	Upstream       string `db:"upstream"`
	PowerDNSZoneID string `db:"powerdns_zone_id"`
	ZoneName       string `db:"zone_name"`
}

type ListAuditRecordsParams

type ListAuditRecordsParams struct {
	ActorID         string             `db:"actor_id"`
	Action          string             `db:"action"`
	TargetKind      string             `db:"target_kind"`
	TargetID        string             `db:"target_id"`
	Result          string             `db:"result"`
	AfterOccurredAt pgtype.Timestamptz `db:"after_occurred_at"`
	AfterID         string             `db:"after_id"`
	RowLimit        int32              `db:"row_limit"`
}

type ListAuditRecordsRow

type ListAuditRecordsRow struct {
	ID         string             `db:"id"`
	OccurredAt pgtype.Timestamptz `db:"occurred_at"`
	RequestID  string             `db:"request_id"`
	ActorID    string             `db:"actor_id"`
	Action     string             `db:"action"`
	TargetKind string             `db:"target_kind"`
	TargetID   string             `db:"target_id"`
	Result     string             `db:"result"`
	Details    []byte             `db:"details"`
}

type ListBrowseRRsetsByTypeParams

type ListBrowseRRsetsByTypeParams struct {
	Zone        string `db:"zone"`
	Generation  string `db:"generation"`
	Type        string `db:"type"`
	NameFrom    string `db:"name_from"`
	NameThrough string `db:"name_through"`
	AfterName   string `db:"after_name"`
	AfterType   string `db:"after_type"`
}

type ListBrowseRRsetsByTypeRow

type ListBrowseRRsetsByTypeRow struct {
	Name    string `db:"name"`
	Type    string `db:"type"`
	Payload []byte `db:"payload"`
}

type ListBrowseRRsetsParams

type ListBrowseRRsetsParams struct {
	Zone        string `db:"zone"`
	Generation  string `db:"generation"`
	NameFrom    string `db:"name_from"`
	NameThrough string `db:"name_through"`
	AfterName   string `db:"after_name"`
	AfterType   string `db:"after_type"`
}

type ListBrowseRRsetsRow

type ListBrowseRRsetsRow struct {
	Name    string `db:"name"`
	Type    string `db:"type"`
	Payload []byte `db:"payload"`
}

type ListDelegationDetailsParams

type ListDelegationDetailsParams struct {
	ZoneBindingID  string             `db:"zone_binding_id"`
	GranteeID      string             `db:"grantee_id"`
	Active         *bool              `db:"active"`
	AfterCreatedAt pgtype.Timestamptz `db:"after_created_at"`
	AfterID        string             `db:"after_id"`
	RowLimit       int32              `db:"row_limit"`
}

type ListDelegationDetailsRow

type ListDelegationDetailsRow struct {
	ID            string             `db:"id"`
	ZoneBindingID string             `db:"zone_binding_id"`
	GranteeKind   string             `db:"grantee_kind"`
	GranteeID     string             `db:"grantee_id"`
	CreatedAt     pgtype.Timestamptz `db:"created_at"`
	RevokedAt     pgtype.Timestamptz `db:"revoked_at"`
}

type ListEffectiveDelegationDetailsParams

type ListEffectiveDelegationDetailsParams struct {
	IdentityID     string             `db:"identity_id"`
	AfterCreatedAt pgtype.Timestamptz `db:"after_created_at"`
	AfterID        string             `db:"after_id"`
	RowLimit       int32              `db:"row_limit"`
}

type ListEffectiveDelegationDetailsRow

type ListEffectiveDelegationDetailsRow struct {
	ID             string             `db:"id"`
	ZoneBindingID  string             `db:"zone_binding_id"`
	PowerDNSZoneID string             `db:"powerdns_zone_id"`
	ZoneName       string             `db:"zone_name"`
	GranteeKind    string             `db:"grantee_kind"`
	GranteeID      string             `db:"grantee_id"`
	CreatedAt      pgtype.Timestamptz `db:"created_at"`
	RevokedAt      pgtype.Timestamptz `db:"revoked_at"`
}

type ListGroupMembersParams

type ListGroupMembersParams struct {
	GroupID        string             `db:"group_id"`
	HandlePrefix   *string            `db:"handle_prefix"`
	AfterCreatedAt pgtype.Timestamptz `db:"after_created_at"`
	AfterID        string             `db:"after_id"`
	RowLimit       int32              `db:"row_limit"`
}

type ListGroupsParams

type ListGroupsParams struct {
	Enabled        *bool              `db:"enabled"`
	Handle         *string            `db:"handle"`
	HandlePrefix   *string            `db:"handle_prefix"`
	AfterCreatedAt pgtype.Timestamptz `db:"after_created_at"`
	AfterID        string             `db:"after_id"`
	RowLimit       int32              `db:"row_limit"`
}

type ListIdentitiesParams

type ListIdentitiesParams struct {
	Kind           *string            `db:"kind"`
	Enabled        *bool              `db:"enabled"`
	IsOperator     *bool              `db:"is_operator"`
	Handle         *string            `db:"handle"`
	HandlePrefix   *string            `db:"handle_prefix"`
	AfterCreatedAt pgtype.Timestamptz `db:"after_created_at"`
	AfterID        string             `db:"after_id"`
	RowLimit       int32              `db:"row_limit"`
}

type ListIdentityAssignmentDetailsParams

type ListIdentityAssignmentDetailsParams struct {
	IdentityID     string             `db:"identity_id"`
	AfterCreatedAt pgtype.Timestamptz `db:"after_created_at"`
	AfterID        string             `db:"after_id"`
	RowLimit       int32              `db:"row_limit"`
}

type ListIdentityAssignmentDetailsRow

type ListIdentityAssignmentDetailsRow struct {
	ID              string             `db:"id"`
	ZoneBindingID   string             `db:"zone_binding_id"`
	PowerDNSZoneID  string             `db:"powerdns_zone_id"`
	ZoneName        string             `db:"zone_name"`
	GranteeKind     string             `db:"grantee_kind"`
	GranteeID       string             `db:"grantee_id"`
	CreatedAt       pgtype.Timestamptz `db:"created_at"`
	RevokedAt       pgtype.Timestamptz `db:"revoked_at"`
	IdentityEnabled bool               `db:"identity_enabled"`
	GroupEnabled    *bool              `db:"group_enabled"`
	GroupHandle     *string            `db:"group_handle"`
	BindingStatus   string             `db:"binding_status"`
	Effective       bool               `db:"effective"`
}

type ListIdentityGroupsParams

type ListIdentityGroupsParams struct {
	IdentityID     string             `db:"identity_id"`
	HandlePrefix   *string            `db:"handle_prefix"`
	AfterCreatedAt pgtype.Timestamptz `db:"after_created_at"`
	AfterID        string             `db:"after_id"`
	RowLimit       int32              `db:"row_limit"`
}

type ListZoneBindingsParams

type ListZoneBindingsParams struct {
	Status         string             `db:"status"`
	ZoneName       string             `db:"zone_name"`
	AfterCreatedAt pgtype.Timestamptz `db:"after_created_at"`
	AfterID        string             `db:"after_id"`
	RowLimit       int32              `db:"row_limit"`
}

type NextZoneBindingGenerationParams

type NextZoneBindingGenerationParams struct {
	Upstream string `db:"upstream"`
	ZoneName string `db:"zone_name"`
}

type NullableStringPatch

type NullableStringPatch struct {
	Set   bool
	Value *string
}

type OperatorCredential

type OperatorCredential struct {
	Identity Identity
	Token    TokenMetadata
	Secret   string
}

type OperatorGuard

type OperatorGuard struct {
	Singleton bool `db:"singleton"`
}

type OperatorRecoveryInput

type OperatorRecoveryInput struct {
	IdentityID string
	Handle     string
	TokenLabel string
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddGroupMembership

func (q *Queries) AddGroupMembership(ctx context.Context, arg AddGroupMembershipParams) (int64, error)

func (*Queries) AuthenticateToken

func (q *Queries) AuthenticateToken(ctx context.Context, arg AuthenticateTokenParams) (AuthenticateTokenRow, error)

func (*Queries) AuthorizeRRsetBatch

func (q *Queries) AuthorizeRRsetBatch(ctx context.Context, arg AuthorizeRRsetBatchParams) ([]AuthorizeRRsetBatchRow, error)

func (*Queries) BrowseHasPending

func (q *Queries) BrowseHasPending(ctx context.Context, zone string) (bool, error)

func (*Queries) CloseOverdueDNSIntents

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

func (*Queries) CountEnabledOperators

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

func (*Queries) CreateAPIToken

func (q *Queries) CreateAPIToken(ctx context.Context, arg CreateAPITokenParams) (CreateAPITokenRow, error)

func (*Queries) CreateBrowserSession

func (q *Queries) CreateBrowserSession(ctx context.Context, arg CreateBrowserSessionParams) (pgtype.Timestamptz, error)

func (*Queries) CreateDelegation

func (q *Queries) CreateDelegation(ctx context.Context, arg CreateDelegationParams) (Delegation, error)

func (*Queries) CreateDelegationChangeKind

func (q *Queries) CreateDelegationChangeKind(ctx context.Context, arg CreateDelegationChangeKindParams) error

func (*Queries) CreateDelegationRecordType

func (q *Queries) CreateDelegationRecordType(ctx context.Context, arg CreateDelegationRecordTypeParams) error

func (*Queries) CreateDelegationSelector

func (q *Queries) CreateDelegationSelector(ctx context.Context, arg CreateDelegationSelectorParams) error

func (*Queries) CreateGroup

func (q *Queries) CreateGroup(ctx context.Context, arg CreateGroupParams) (Group, error)

func (*Queries) CreateIdentity

func (q *Queries) CreateIdentity(ctx context.Context, arg CreateIdentityParams) (Identity, error)

func (*Queries) CreateInstallationMetadata

func (q *Queries) CreateInstallationMetadata(ctx context.Context, installationID string) (InstallationMetadata, error)

func (*Queries) CreateOperatorIdentity

func (q *Queries) CreateOperatorIdentity(ctx context.Context, arg CreateOperatorIdentityParams) (Identity, error)

func (*Queries) CreateZoneBinding

func (q *Queries) CreateZoneBinding(ctx context.Context, arg CreateZoneBindingParams) (ZoneBinding, error)

func (*Queries) DeleteBrowserSession

func (q *Queries) DeleteBrowserSession(ctx context.Context, digest []byte) error

func (*Queries) DeleteExpiredBrowserSessions

func (q *Queries) DeleteExpiredBrowserSessions(ctx context.Context) error

func (*Queries) FinalizeInstallationRestore

func (q *Queries) FinalizeInstallationRestore(ctx context.Context) (InstallationMetadata, error)

func (*Queries) GetAPITokenMetadata

func (q *Queries) GetAPITokenMetadata(ctx context.Context, arg GetAPITokenMetadataParams) (GetAPITokenMetadataRow, error)

func (*Queries) GetActiveZoneBindingByUpstreamZoneIDForUpdate

func (q *Queries) GetActiveZoneBindingByUpstreamZoneIDForUpdate(ctx context.Context, arg GetActiveZoneBindingByUpstreamZoneIDForUpdateParams) (ZoneBinding, error)

func (*Queries) GetAuditEventByID

func (q *Queries) GetAuditEventByID(ctx context.Context, id string) (GetAuditEventByIDRow, error)

func (*Queries) GetBootstrapState

func (q *Queries) GetBootstrapState(ctx context.Context) (GetBootstrapStateRow, error)

func (*Queries) GetBrowseZone

func (q *Queries) GetBrowseZone(ctx context.Context, arg GetBrowseZoneParams) (BrowseZone, error)

func (*Queries) GetDNSOutcomeByOperationID

func (q *Queries) GetDNSOutcomeByOperationID(ctx context.Context, operationID string) (GetDNSOutcomeByOperationIDRow, error)

func (*Queries) GetDelegationByID

func (q *Queries) GetDelegationByID(ctx context.Context, id string) (Delegation, error)

func (*Queries) GetDelegationDetails

func (q *Queries) GetDelegationDetails(ctx context.Context, id string) (GetDelegationDetailsRow, error)

func (*Queries) GetDelegationForUpdate

func (q *Queries) GetDelegationForUpdate(ctx context.Context, id string) (Delegation, error)

func (*Queries) GetGroupByID

func (q *Queries) GetGroupByID(ctx context.Context, id string) (Group, error)

func (*Queries) GetGroupForUpdate

func (q *Queries) GetGroupForUpdate(ctx context.Context, id string) (Group, error)

func (*Queries) GetGroupMembership

func (q *Queries) GetGroupMembership(ctx context.Context, arg GetGroupMembershipParams) (GroupMembership, error)

func (*Queries) GetIdentityByHandleForUpdate

func (q *Queries) GetIdentityByHandleForUpdate(ctx context.Context, handle string) (Identity, error)

func (*Queries) GetIdentityByID

func (q *Queries) GetIdentityByID(ctx context.Context, id string) (Identity, error)

func (*Queries) GetIdentityForUpdate

func (q *Queries) GetIdentityForUpdate(ctx context.Context, id string) (Identity, error)

func (*Queries) GetInstallationMetadata

func (q *Queries) GetInstallationMetadata(ctx context.Context) (GetInstallationMetadataRow, error)

func (*Queries) GetZoneBindingByID

func (q *Queries) GetZoneBindingByID(ctx context.Context, id string) (ZoneBinding, error)

func (*Queries) GetZoneBindingForUpdate

func (q *Queries) GetZoneBindingForUpdate(ctx context.Context, id string) (ZoneBinding, error)

func (*Queries) GetZoneDeletionReconciliationState

func (q *Queries) GetZoneDeletionReconciliationState(ctx context.Context, bindingID string) (GetZoneDeletionReconciliationStateRow, error)

func (*Queries) InsertDNSIntent

func (q *Queries) InsertDNSIntent(ctx context.Context, arg InsertDNSIntentParams) (InsertDNSIntentRow, error)

func (*Queries) InsertDNSOutcome

func (q *Queries) InsertDNSOutcome(ctx context.Context, arg InsertDNSOutcomeParams) (int64, error)

func (*Queries) InsertManagementAudit

func (q *Queries) InsertManagementAudit(ctx context.Context, arg InsertManagementAuditParams) (InsertManagementAuditRow, error)

func (*Queries) ListAPITokens

func (q *Queries) ListAPITokens(ctx context.Context, arg ListAPITokensParams) ([]ListAPITokensRow, error)

func (*Queries) ListActiveZoneBindingCandidates

func (q *Queries) ListActiveZoneBindingCandidates(ctx context.Context, arg ListActiveZoneBindingCandidatesParams) ([]ZoneBinding, error)

func (*Queries) ListAuditRecords

func (q *Queries) ListAuditRecords(ctx context.Context, arg ListAuditRecordsParams) ([]ListAuditRecordsRow, error)

func (*Queries) ListBrowseRRsets

func (q *Queries) ListBrowseRRsets(ctx context.Context, arg ListBrowseRRsetsParams) ([]ListBrowseRRsetsRow, error)

func (*Queries) ListBrowseRRsetsByType

func (q *Queries) ListBrowseRRsetsByType(ctx context.Context, arg ListBrowseRRsetsByTypeParams) ([]ListBrowseRRsetsByTypeRow, error)

func (*Queries) ListDelegationChangeKindsByIDs

func (q *Queries) ListDelegationChangeKindsByIDs(ctx context.Context, delegationIds []string) ([]DelegationChangeKind, error)

func (*Queries) ListDelegationDetails

func (q *Queries) ListDelegationDetails(ctx context.Context, arg ListDelegationDetailsParams) ([]ListDelegationDetailsRow, error)

func (*Queries) ListDelegationRecordTypesByIDs

func (q *Queries) ListDelegationRecordTypesByIDs(ctx context.Context, delegationIds []string) ([]DelegationRecordType, error)

func (*Queries) ListDelegationSelectorsByIDs

func (q *Queries) ListDelegationSelectorsByIDs(ctx context.Context, delegationIds []string) ([]DelegationSelector, error)

func (*Queries) ListGroupMembers

func (q *Queries) ListGroupMembers(ctx context.Context, arg ListGroupMembersParams) ([]Identity, error)

func (*Queries) ListGroups

func (q *Queries) ListGroups(ctx context.Context, arg ListGroupsParams) ([]Group, error)

func (*Queries) ListIdentities

func (q *Queries) ListIdentities(ctx context.Context, arg ListIdentitiesParams) ([]Identity, error)

func (*Queries) ListIdentityGroups

func (q *Queries) ListIdentityGroups(ctx context.Context, arg ListIdentityGroupsParams) ([]Group, error)

func (*Queries) ListZoneBindings

func (q *Queries) ListZoneBindings(ctx context.Context, arg ListZoneBindingsParams) ([]ZoneBinding, error)

func (*Queries) LockOperatorGuard

func (q *Queries) LockOperatorGuard(ctx context.Context) (bool, error)

func (*Queries) LockZoneBindingKey

func (q *Queries) LockZoneBindingKey(ctx context.Context, hashtext string) error

func (*Queries) NextZoneBindingGeneration

func (q *Queries) NextZoneBindingGeneration(ctx context.Context, arg NextZoneBindingGenerationParams) (int64, error)

func (*Queries) RemoveGroupMembership

func (q *Queries) RemoveGroupMembership(ctx context.Context, arg RemoveGroupMembershipParams) (int64, error)

func (*Queries) RequestBrowseRefresh

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

func (*Queries) RetireZoneBinding

func (q *Queries) RetireZoneBinding(ctx context.Context, arg RetireZoneBindingParams) (ZoneBinding, error)

func (*Queries) RevokeAPIToken

func (q *Queries) RevokeAPIToken(ctx context.Context, arg RevokeAPITokenParams) (RevokeAPITokenRow, error)

func (*Queries) RevokeAllActiveAPITokens

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

func (*Queries) RevokeDelegation

func (q *Queries) RevokeDelegation(ctx context.Context, arg RevokeDelegationParams) (Delegation, error)

func (*Queries) RevokeDelegationsForZoneDeletion

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

func (*Queries) TouchBrowseZone

func (q *Queries) TouchBrowseZone(ctx context.Context, arg TouchBrowseZoneParams) (BrowseZone, error)

func (*Queries) UpdateGroup

func (q *Queries) UpdateGroup(ctx context.Context, arg UpdateGroupParams) (Group, error)

func (*Queries) UpdateIdentity

func (q *Queries) UpdateIdentity(ctx context.Context, arg UpdateIdentityParams) (Identity, error)

func (*Queries) WithTx

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

func (*Queries) ZoneBindingHistoryExists

func (q *Queries) ZoneBindingHistoryExists(ctx context.Context, arg ZoneBindingHistoryExistsParams) (bool, error)

type RRsetTuple

type RRsetTuple struct {
	Owner      string
	RecordType string
	ChangeKind string
}

type RemoveGroupMembershipParams

type RemoveGroupMembershipParams struct {
	GroupID    string `db:"group_id"`
	IdentityID string `db:"identity_id"`
}

type RestoreFinalizationInput

type RestoreFinalizationInput = OperatorRecoveryInput

type RetainedAssignment

type RetainedAssignment struct {
	DelegationDetails
	IdentityEnabled bool
	GroupEnabled    *bool
	GroupHandle     *string
	BindingStatus   string
	Effective       bool
}

type RetainedAssignmentPage

type RetainedAssignmentPage struct {
	Items []RetainedAssignment
	Next  *page.Key
}

type RetireZoneBindingParams

type RetireZoneBindingParams struct {
	RetiredByIdentityID string `db:"retired_by_identity_id"`
	ID                  string `db:"id"`
}

type RevokeAPITokenParams

type RevokeAPITokenParams struct {
	IdentityID string `db:"identity_id"`
	ID         string `db:"id"`
}

type RevokeAPITokenRow

type RevokeAPITokenRow struct {
	ID         string             `db:"id"`
	IdentityID string             `db:"identity_id"`
	Label      string             `db:"label"`
	ExpiresAt  pgtype.Timestamptz `db:"expires_at"`
	RevokedAt  pgtype.Timestamptz `db:"revoked_at"`
	CreatedAt  pgtype.Timestamptz `db:"created_at"`
	Status     string             `db:"status"`
}

type RevokeDelegationParams

type RevokeDelegationParams struct {
	ID                  string `db:"id"`
	RevokedByIdentityID string `db:"revoked_by_identity_id"`
}

type RevokeDelegationsForZoneDeletionParams

type RevokeDelegationsForZoneDeletionParams struct {
	RevokedByIdentityID string `db:"revoked_by_identity_id"`
	ZoneBindingID       string `db:"zone_binding_id"`
}

type RuntimePoolConfig

type RuntimePoolConfig struct {
	ConnectionString      string
	MaxConnections        int32
	AuthenticationReserve int32
	ReadinessReserve      int32
	ConnectTimeout        time.Duration
	StatementTimeout      time.Duration
	LockTimeout           time.Duration
	TransactionTimeout    time.Duration
}

RuntimePoolConfig bounds all database connections owned by one API instance.

type RuntimePoolConfigurationSet

type RuntimePoolConfigurationSet struct {
	Requests       poolConfiguration
	Authentication poolConfiguration
	Readiness      poolConfiguration
}

RuntimePoolConfigurationSet holds separate capacity for ordinary requests, authentication decisions, and readiness probes.

func RuntimePoolConfigs

func RuntimePoolConfigs(config RuntimePoolConfig) (RuntimePoolConfigurationSet, error)

RuntimePoolConfigs validates one immutable configuration and derives the three pool configurations without making a database connection.

type RuntimePools

type RuntimePools struct {
	Requests       *pgxpool.Pool
	Authentication *pgxpool.Pool
	Readiness      *pgxpool.Pool
}

RuntimePools are three primary-only pgx pools whose combined maximum is the configured per-instance connection limit.

func OpenRuntimePools

func OpenRuntimePools(ctx context.Context, config RuntimePoolConfig) (*RuntimePools, error)

OpenRuntimePools creates lazy pools; callers explicitly ping through the readiness pool before accepting authenticated traffic.

func (*RuntimePools) Close

func (pools *RuntimePools) Close()

Close releases every pool owned by the instance.

type SchemaStatus

type SchemaStatus struct {
	CurrentVersion int
	LatestVersion  int
	Compatible     bool
}

SchemaStatus describes how the durable migration ledger relates to this binary.

func MigrationStatus

func MigrationStatus(ctx context.Context, conn *pgx.Conn) (SchemaStatus, error)

MigrationStatus inspects the migration ledger without creating or changing it.

type Store

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

Store owns DANS persistence transactions and invariants.

func NewStore

func NewStore(db transactor) *Store

NewStore returns a persistence store backed by a PostgreSQL connection or pool.

func (*Store) AddGroupMember

func (s *Store) AddGroupMember(ctx context.Context, actor Actor, groupID, identityID string) (GroupMembership, error)

func (*Store) Authenticate

func (s *Store) Authenticate(ctx context.Context, token string) (Actor, error)

Authenticate resolves current API-token or browser-session state in one statement.

func (*Store) AuthorizeRRsetBatch

func (s *Store) AuthorizeRRsetBatch(ctx context.Context, token, requestID, upstream, powerDNSZoneID string, tuples []RRsetTuple) (AuthorizationDecision, error)

AuthorizeRRsetBatch evaluates every tuple against one current database statement.

func (*Store) BindCreatedZone

func (s *Store) BindCreatedZone(ctx context.Context, actor Actor, input ZoneBindingInput) (ZoneBinding, error)

func (*Store) Bootstrap

func (s *Store) Bootstrap(ctx context.Context, input BootstrapInput) (BootstrapResult, error)

func (*Store) BrowseRRsets

func (s *Store) BrowseRRsets(ctx context.Context, actor Actor, upstream, zoneID string, options BrowseOptions, refresh bool) (BrowsePage, error)

BrowseRRsets authenticates through the caller's current actor and reads a single consistent page while holding only the zone metadata row lock.

func (*Store) ClaimBrowseChange

func (s *Store) ClaimBrowseChange(ctx context.Context, upstream string) (BrowseChangeClaim, error)

func (*Store) ClaimBrowseFull

func (s *Store) ClaimBrowseFull(ctx context.Context, upstream string) (BrowseClaim, error)

func (*Store) CleanupBrowseRows

func (s *Store) CleanupBrowseRows(ctx context.Context, zone string) (int64, error)

CleanupBrowseRows deletes a bounded batch of unpublished or retired snapshots.

func (*Store) CloseOverdueDNSIntents

func (s *Store) CloseOverdueDNSIntents(ctx context.Context, requestedLimit int) (int, error)

func (*Store) ConfirmZoneBindingAbsent

func (s *Store) ConfirmZoneBindingAbsent(ctx context.Context, actor Actor, bindingID string) (ZoneBinding, error)

func (*Store) CreateBrowserSession

func (s *Store) CreateBrowserSession(ctx context.Context, token, previous string) (CreatedBrowserSession, error)

CreateBrowserSession replaces only the supplied previous browser session.

func (*Store) CreateDNSIntent

func (s *Store) CreateDNSIntent(ctx context.Context, actor Actor, input DNSIntentInput) (DNSIntent, error)

func (*Store) CreateDelegation

func (s *Store) CreateDelegation(ctx context.Context, actor Actor, input DelegationCreate) (DelegationDetails, error)

func (*Store) CreateGroup

func (s *Store) CreateGroup(ctx context.Context, actor Actor, input GroupCreate) (Group, error)

func (*Store) CreateIdentity

func (s *Store) CreateIdentity(ctx context.Context, actor Actor, input IdentityCreate) (Identity, error)

func (*Store) CreateToken

func (s *Store) CreateToken(ctx context.Context, actor Actor, identityID string, input TokenCreate) (CreatedToken, error)

func (*Store) DeleteBrowserSession

func (s *Store) DeleteBrowserSession(ctx context.Context, secret string) error

DeleteBrowserSession invalidates a session without changing its original token.

func (*Store) EnsureZoneBinding

func (s *Store) EnsureZoneBinding(ctx context.Context, actor Actor, input ZoneBindingInput) (ZoneBinding, error)

func (*Store) FailBrowseChange

func (s *Store) FailBrowseChange(ctx context.Context, c BrowseChangeClaim) error

FailBrowseChange retains read work and avoids retrying DNS mutations.

func (*Store) FailBrowseFull

func (s *Store) FailBrowseFull(ctx context.Context, c BrowseClaim) error

func (*Store) FinalizeRestore

func (s *Store) FinalizeRestore(ctx context.Context, input RestoreFinalizationInput) (OperatorCredential, error)

FinalizeRestore atomically invalidates restored credentials and issues one replacement. The supported restore procedure keeps every API instance quiesced until this commits.

func (*Store) GetCurrentIdentity

func (s *Store) GetCurrentIdentity(ctx context.Context, actor Actor) (Identity, error)

func (*Store) GetDelegation

func (s *Store) GetDelegation(ctx context.Context, actor Actor, id string) (DelegationDetails, error)

func (*Store) GetGroup

func (s *Store) GetGroup(ctx context.Context, actor Actor, id string) (Group, error)

func (*Store) GetIdentity

func (s *Store) GetIdentity(ctx context.Context, actor Actor, id string) (Identity, error)

func (*Store) GetZoneBinding

func (s *Store) GetZoneBinding(ctx context.Context, actor Actor, id string) (ZoneBinding, error)

func (*Store) GetZoneBindingRecovery

func (s *Store) GetZoneBindingRecovery(ctx context.Context, actor Actor, bindingID string) (ZoneBindingRecovery, error)

func (*Store) ListAuditEvents

func (s *Store) ListAuditEvents(ctx context.Context, actor Actor, options AuditListOptions) (AuditPage, error)

func (*Store) ListCurrentIdentityDelegations

func (s *Store) ListCurrentIdentityDelegations(ctx context.Context, actor Actor, options DelegationListOptions) (DelegationPage, error)

func (*Store) ListCurrentIdentityGroups

func (s *Store) ListCurrentIdentityGroups(ctx context.Context, actor Actor, options GroupListOptions) (GroupPage, error)

func (*Store) ListDelegations

func (s *Store) ListDelegations(ctx context.Context, actor Actor, options DelegationListOptions) (DelegationPage, error)

func (*Store) ListGroupMembers

func (s *Store) ListGroupMembers(ctx context.Context, actor Actor, groupID string, options IdentityListOptions) (IdentityPage, error)

func (*Store) ListGroups

func (s *Store) ListGroups(ctx context.Context, actor Actor, options GroupListOptions) (GroupPage, error)

func (*Store) ListIdentities

func (s *Store) ListIdentities(ctx context.Context, actor Actor, options IdentityListOptions) (IdentityPage, error)

func (*Store) ListIdentityAssignments

func (s *Store) ListIdentityAssignments(ctx context.Context, actor Actor, identityID string, options DelegationListOptions) (RetainedAssignmentPage, error)

func (*Store) ListIdentityDelegations

func (s *Store) ListIdentityDelegations(ctx context.Context, actor Actor, identityID string, options DelegationListOptions) (DelegationPage, error)

func (*Store) ListIdentityGroups

func (s *Store) ListIdentityGroups(ctx context.Context, actor Actor, identityID string, options GroupListOptions) (GroupPage, error)

func (*Store) ListTokens

func (s *Store) ListTokens(ctx context.Context, actor Actor, identityID string, options TokenListOptions) (TokenPage, error)

func (*Store) ListZoneBindings

func (s *Store) ListZoneBindings(ctx context.Context, actor Actor, options ZoneBindingListOptions) (ZoneBindingPage, error)

func (*Store) ObserveZoneBinding

func (s *Store) ObserveZoneBinding(ctx context.Context, actor Actor, input ZoneObservationInput) (ZoneObservation, error)

func (*Store) PatchGroup

func (s *Store) PatchGroup(ctx context.Context, actor Actor, id string, patch GroupPatch) (Group, error)

func (*Store) PatchIdentity

func (s *Store) PatchIdentity(ctx context.Context, actor Actor, id string, patch IdentityPatch) (Identity, error)

func (*Store) PrepareZoneDeletion

func (s *Store) PrepareZoneDeletion(ctx context.Context, actor Actor, input ZoneDeletionInput) (ZoneDeletionPlan, error)

func (*Store) PrepareZoneDeletionByUpstreamZoneID

func (s *Store) PrepareZoneDeletionByUpstreamZoneID(ctx context.Context, actor Actor, input ZoneDeletionByUpstreamInput) (ZoneDeletionPlan, error)

func (*Store) PrepareZoneDeletionRetry

func (s *Store) PrepareZoneDeletionRetry(ctx context.Context, actor Actor, input ZoneDeletionInput) (ZoneDeletionPlan, error)

func (*Store) ProbeAuditPersistence

func (s *Store) ProbeAuditPersistence(ctx context.Context) error

ProbeAuditPersistence verifies the complete audit INSERT path without retaining a probe event in the immutable ledger.

func (*Store) PublishBrowseChange

func (s *Store) PublishBrowseChange(ctx context.Context, c BrowseChangeClaim, sets []json.RawMessage) error

func (*Store) PublishBrowseFull

func (s *Store) PublishBrowseFull(ctx context.Context, c BrowseClaim) error

func (*Store) RebindZoneBinding

func (s *Store) RebindZoneBinding(ctx context.Context, actor Actor, retiredBindingID string, input ZoneBindingInput) (ZoneBinding, error)

func (*Store) RecordAuthorizationDenial

func (s *Store) RecordAuthorizationDenial(ctx context.Context, actor Actor, input AuthorizationDenialInput) error

RecordAuthorizationDenial appends one durable, sanitized denial event.

func (*Store) RecordDNSOutcome

func (s *Store) RecordDNSOutcome(ctx context.Context, input DNSOutcomeInput) (DNSOutcome, error)

func (*Store) RecordZoneDeletionOutcome

func (s *Store) RecordZoneDeletionOutcome(ctx context.Context, plan ZoneDeletionPlan, input ZoneDeletionOutcomeInput) (DNSOutcome, error)

func (*Store) RecoverOperator

func (s *Store) RecoverOperator(ctx context.Context, input OperatorRecoveryInput) (OperatorCredential, error)

func (*Store) RemoveGroupMember

func (s *Store) RemoveGroupMember(ctx context.Context, actor Actor, groupID, identityID string) error

func (*Store) RenewBrowseFull

func (s *Store) RenewBrowseFull(ctx context.Context, c BrowseClaim) error

RenewBrowseFull holds only a metadata lock, independent of API collection.

func (*Store) RevokeDelegation

func (s *Store) RevokeDelegation(ctx context.Context, actor Actor, id string) error

func (*Store) RevokeToken

func (s *Store) RevokeToken(ctx context.Context, actor Actor, identityID, tokenID string) error

func (*Store) StageBrowseRRsets

func (s *Store) StageBrowseRRsets(ctx context.Context, c BrowseClaim, sets []json.RawMessage) error

func (*Store) WriteAuditNDJSON

func (s *Store) WriteAuditNDJSON(ctx context.Context, actor Actor, options AuditListOptions, output io.Writer) error

type TokenCreate

type TokenCreate struct {
	Label     string
	ExpiresAt *time.Time
}

type TokenListOptions

type TokenListOptions struct {
	Limit int
	After *page.Key
}

type TokenMetadata

type TokenMetadata struct {
	ID         string
	IdentityID string
	Label      string
	Status     string
	ExpiresAt  pgtype.Timestamptz
	RevokedAt  pgtype.Timestamptz
	CreatedAt  pgtype.Timestamptz
}

TokenMetadata deliberately excludes the credential digest and plaintext.

type TokenPage

type TokenPage struct {
	Items []TokenMetadata
	Next  *page.Key
}

type TouchBrowseZoneParams

type TouchBrowseZoneParams struct {
	ID        string `db:"id"`
	Upstream  string `db:"upstream"`
	ZoneID    string `db:"zone_id"`
	CursorKey []byte `db:"cursor_key"`
}

type UpdateGroupParams

type UpdateGroupParams struct {
	ID          string  `db:"id"`
	DisplayName *string `db:"display_name"`
	Enabled     bool    `db:"enabled"`
}

type UpdateIdentityParams

type UpdateIdentityParams struct {
	ID          string  `db:"id"`
	DisplayName *string `db:"display_name"`
	Enabled     bool    `db:"enabled"`
	IsOperator  bool    `db:"is_operator"`
}

type ZoneBinding

type ZoneBinding struct {
	ID                  string             `db:"id"`
	Generation          int64              `db:"generation"`
	Upstream            string             `db:"upstream"`
	PowerDNSZoneID      string             `db:"powerdns_zone_id"`
	ZoneName            string             `db:"zone_name"`
	CreatedByIdentityID string             `db:"created_by_identity_id"`
	RetiredByIdentityID *string            `db:"retired_by_identity_id"`
	CreatedAt           pgtype.Timestamptz `db:"created_at"`
	RetiredAt           pgtype.Timestamptz `db:"retired_at"`
}

type ZoneBindingHistoryExistsParams

type ZoneBindingHistoryExistsParams struct {
	Upstream       string `db:"upstream"`
	PowerDNSZoneID string `db:"powerdns_zone_id"`
	ZoneName       string `db:"zone_name"`
}

type ZoneBindingInput

type ZoneBindingInput struct {
	Upstream       string
	PowerDNSZoneID string
	ZoneName       string
}

type ZoneBindingListOptions

type ZoneBindingListOptions struct {
	Limit    int
	After    *page.Key
	Status   *string
	ZoneName *string
}

type ZoneBindingPage

type ZoneBindingPage struct {
	Items []ZoneBinding
	Next  *page.Key
}

type ZoneBindingRecovery

type ZoneBindingRecovery struct {
	DeletionState string
	Actions       []string
}

ZoneBindingRecovery describes advisory actions; mutations always recheck state.

type ZoneDeletionByUpstreamInput

type ZoneDeletionByUpstreamInput struct {
	Upstream       string
	PowerDNSZoneID string
	RequestDigest  []byte
	Deadline       time.Time
}

type ZoneDeletionInput

type ZoneDeletionInput struct {
	BindingID     string
	RequestDigest []byte
	Deadline      time.Time
}

type ZoneDeletionOutcomeInput

type ZoneDeletionOutcomeInput struct {
	Result         ZoneDeletionResult
	ResponseClass  string
	ResponseCode   *int
	ResponseDigest []byte
}

type ZoneDeletionPlan

type ZoneDeletionPlan struct {
	Binding        ZoneBinding
	Intent         DNSIntent
	Upstream       string
	PowerDNSZoneID string
	ZoneName       string
}

type ZoneDeletionResult

type ZoneDeletionResult string
const (
	ZoneDeletionDeleted  ZoneDeletionResult = "deleted"
	ZoneDeletionNotFound ZoneDeletionResult = "not_found"
	ZoneDeletionFailed   ZoneDeletionResult = "failed"
	ZoneDeletionUnknown  ZoneDeletionResult = "unknown"
)

type ZoneObservation

type ZoneObservation struct {
	BindingID      string
	ObservedAt     time.Time
	ZonePresent    bool
	ObservedZoneID *string
}

type ZoneObservationInput

type ZoneObservationInput struct {
	BindingID      string
	ZonePresent    bool
	ObservedZoneID *string
}

Jump to

Keyboard shortcuts

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