repo

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConflict = errors.New("repository conflict")
View Source
var ErrNotFound = errors.New("repository record not found")

Functions

func OpenPostgres added in v0.1.16

func OpenPostgres(databaseURL string) (*sql.DB, error)

Types

type AgentCredentialRecord

type AgentCredentialRecord struct {
	ID                  string
	OrganizationID      string
	AgentType           string
	AgentID             string
	CredentialHash      string
	RegistrationTokenID string
	ActivatedAt         string
	RevokedAt           string
	CreatedAt           string
	RotatedAt           string
}

type AgentCredentialRepository

type AgentCredentialRepository interface {
	FindCredentialByHash(ctx context.Context, credentialHash string) (AgentCredentialRecord, error)
	FindPendingCredentialByRegistrationToken(ctx context.Context, organizationID string, registrationTokenID string) (AgentCredentialRecord, error)
	CreateCredential(ctx context.Context, credential AgentCredentialRecord) error
	ActivateCredential(ctx context.Context, organizationID string, credentialID string, activatedAt string) error
	RevokeActiveCredentialsExcept(ctx context.Context, organizationID string, agentType string, agentID string, keepCredentialID string, revokedAt string) error
	RevokeCredential(ctx context.Context, organizationID string, credentialID string, revokedAt string) error
}

type AgentRegistrationTokenRecord

type AgentRegistrationTokenRecord struct {
	ID              string
	OrganizationID  string
	AgentType       string
	AgentID         string
	TokenHash       string
	ExpiresAt       string
	UsedAt          string
	RevokedAt       string
	CreatedAt       string
	CreatedByUserID string
}

type AgentRegistrationTokenRepository

type AgentRegistrationTokenRepository interface {
	ListRegistrationTokens(ctx context.Context, organizationID string, agentType string, agentID string) ([]AgentRegistrationTokenRecord, error)
	FindRegistrationTokenByHash(ctx context.Context, tokenHash string) (AgentRegistrationTokenRecord, error)
	CreateRegistrationToken(ctx context.Context, token AgentRegistrationTokenRecord) error
	ClaimRegistrationToken(ctx context.Context, organizationID string, tokenID string, claimedAt string) error
	ReleaseRegistrationTokenUse(ctx context.Context, organizationID string, tokenID string) error
	RevokeActiveUnusedRegistrationTokens(ctx context.Context, organizationID string, agentType string, agentID string, revokedAt string) error
	RevokeRegistrationToken(ctx context.Context, organizationID string, agentType string, agentID string, tokenID string, revokedAt string) error
}

type AuditLogRecord

type AuditLogRecord struct {
	ID                   string
	OrganizationID       string
	ActorUserID          string
	ActorRolesJSON       string
	ActorPermissionsJSON string
	Action               string
	ResourceType         string
	ResourceID           string
	Result               string
	ErrorMessage         string
	MetadataJSON         string
	SourceIP             string
	CreatedAt            string
}

type AuditLogRepository

type AuditLogRepository interface {
	CreateAuditLog(ctx context.Context, audit AuditLogRecord) error
}

type InboundBindingRecord

type InboundBindingRecord struct {
	ID             string
	OrganizationID string
	NodeGroupID    string
	ListenIP       string
	Protocol       string
	Port           int
	MatchType      string
	CreatedAt      string
}

type MemberRecord

type MemberRecord struct {
	ID             string
	OrganizationID string
	UserID         string
	UserEmail      string
	UserName       string
	Status         string
	CreatedAt      string
	UpdatedAt      string
}

type MemberRepository

type MemberRepository interface {
	FindMemberByUserAndOrganization(ctx context.Context, organizationID string, userID string) (MemberRecord, error)
	ListMembersByOrganization(ctx context.Context, organizationID string) ([]MemberRecord, error)
	CreateMember(ctx context.Context, member MemberRecord) error
	UpdateMemberStatus(ctx context.Context, organizationID string, memberID string, status string) error
	DeleteMember(ctx context.Context, organizationID string, memberID string) error
}

type MonitorGroupRecord

type MonitorGroupRecord struct {
	ID             string
	OrganizationID string
	Name           string
	Description    string
	CreatedAt      string
	UpdatedAt      string
	DeletedAt      string
}

type MonitorGroupRepository

type MonitorGroupRepository interface {
	ListMonitorGroupsByOrganization(ctx context.Context, organizationID string) ([]MonitorGroupRecord, error)
	FindMonitorGroupByID(ctx context.Context, organizationID string, monitorGroupID string) (MonitorGroupRecord, error)
	CreateMonitorGroup(ctx context.Context, monitorGroup MonitorGroupRecord) error
	UpdateMonitorGroup(ctx context.Context, monitorGroup MonitorGroupRecord) error
	DeleteMonitorGroup(ctx context.Context, organizationID string, monitorGroupID string, deletedAt string) error
}

type MonitorRecord

type MonitorRecord struct {
	ID                   string
	OrganizationID       string
	Name                 string
	Status               string
	DesiredConfigVersion int
	AppliedConfigVersion int
	LastSeenAt           string
	RegisteredAt         string
	CreatedAt            string
	UpdatedAt            string
	DeletedAt            string
	GroupIDs             []string
}

type MonitorRepository

type MonitorRepository interface {
	ListMonitorsByOrganization(ctx context.Context, organizationID string) ([]MonitorRecord, error)
	FindMonitorByID(ctx context.Context, organizationID string, monitorID string) (MonitorRecord, error)
	CreateMonitor(ctx context.Context, monitor MonitorRecord, groupIDs []string, now string, nextID func() string) error
	UpdateMonitor(ctx context.Context, monitor MonitorRecord, replaceGroups bool, groupIDs []string, now string, nextID func() string) error
	MarkMonitorAgentConnected(ctx context.Context, organizationID string, monitorID string, now string) error
	MarkMonitorAgentDisconnected(ctx context.Context, organizationID string, monitorID string, now string) error
	DeleteMonitor(ctx context.Context, organizationID string, monitorID string, deletedAt string) error
}

type NodeAgentVersionRecord

type NodeAgentVersionRecord struct {
	Version   string
	Commit    string
	BuildTime string
}

type NodeGroupRecord

type NodeGroupRecord struct {
	ID             string
	OrganizationID string
	Name           string
	Description    string
	CreatedAt      string
	UpdatedAt      string
	DeletedAt      string
}

type NodeGroupRepository

type NodeGroupRepository interface {
	ListNodeGroupsByOrganization(ctx context.Context, organizationID string) ([]NodeGroupRecord, error)
	FindNodeGroupByID(ctx context.Context, organizationID string, nodeGroupID string) (NodeGroupRecord, error)
	CreateNodeGroup(ctx context.Context, nodeGroup NodeGroupRecord) error
	UpdateNodeGroup(ctx context.Context, nodeGroup NodeGroupRecord) error
	DeleteNodeGroup(ctx context.Context, organizationID string, nodeGroupID string, deletedAt string) error
}

type NodeListenIPRecord

type NodeListenIPRecord struct {
	ID             string
	OrganizationID string
	NodeID         string
	ListenIP       string
	DisplayName    string
	Enabled        bool
	CreatedAt      string
	UpdatedAt      string
}

type NodePortRangeRecord

type NodePortRangeRecord struct {
	ID             string
	OrganizationID string
	NodeID         string
	Protocol       string
	StartPort      int
	EndPort        int
	Enabled        bool
	CreatedAt      string
	UpdatedAt      string
}

type NodeRecord

type NodeRecord struct {
	ID                     string
	OrganizationID         string
	Name                   string
	Status                 string
	PublicDescription      string
	DesiredConfigVersion   int
	AppliedConfigVersion   int
	ConfigStatus           string
	ConfigErrorMessage     string
	ConfigStatusUpdatedAt  string
	LastSeenAt             string
	RegisteredAt           string
	AgentVersion           string
	AgentCommit            string
	AgentBuildTime         string
	AgentAutoUpdateEnabled bool
	DesiredAgentVersion    string
	AgentUpdateStatus      string
	AgentUpdateError       string
	AgentUpdateStartedAt   string
	AgentUpdateFinishedAt  string
	CreatedAt              string
	UpdatedAt              string
	DeletedAt              string
	GroupIDs               []string
	ListenIPs              []NodeListenIPRecord
	PortRanges             []NodePortRangeRecord
}

type NodeRepository

type NodeRepository interface {
	ListNodesByOrganization(ctx context.Context, organizationID string) ([]NodeRecord, error)
	FindNodeByID(ctx context.Context, organizationID string, nodeID string) (NodeRecord, error)
	CreateNode(ctx context.Context, node NodeRecord, groupIDs []string, listenIPs []NodeListenIPRecord, portRanges []NodePortRangeRecord, now string, nextID func() string) error
	UpdateNode(ctx context.Context, node NodeRecord, replaceGroups bool, groupIDs []string, replaceListenIPs bool, listenIPs []NodeListenIPRecord, replacePortRanges bool, portRanges []NodePortRangeRecord, now string, nextID func() string) error
	MarkNodeAgentConnected(ctx context.Context, organizationID string, nodeID string, now string) error
	UpdateNodeAgentVersion(ctx context.Context, organizationID string, nodeID string, version NodeAgentVersionRecord, now string) error
	UpdateNodeAgentUpdatePolicy(ctx context.Context, organizationID string, nodeID string, enabled bool, now string) error
	MarkNodeAgentUpdateRequested(ctx context.Context, organizationID string, nodeID string, targetVersion string, now string) error
	MarkNodeAgentUpdateSatisfied(ctx context.Context, organizationID string, nodeID string, targetVersion string, now string) error
	RecordNodeAgentUpdateResult(ctx context.Context, organizationID string, nodeID string, status string, errorMessage string, now string) error
	MarkNodeAgentDisconnected(ctx context.Context, organizationID string, nodeID string, now string) error
	RecordNodeConfigAck(ctx context.Context, organizationID string, nodeID string, configVersion int, status string, errorMessage string, now string) error
	EnsureDesiredConfigVersionAtLeast(ctx context.Context, organizationID string, nodeID string, configVersion int, now string) error
	IncrementDesiredConfigForNode(ctx context.Context, organizationID string, nodeID string, now string) error
	IncrementDesiredConfigForNodeGroup(ctx context.Context, organizationID string, nodeGroupID string, now string) error
	DeleteNode(ctx context.Context, organizationID string, nodeID string, deletedAt string) error
}

type OrganizationRecord

type OrganizationRecord struct {
	ID                       string
	Name                     string
	Slug                     string
	OwnerUserID              string
	DefaultRuleLimit         int
	DefaultTrafficLimitBytes int64
	DefaultTrafficLimitMode  string
	CreatedAt                string
	UpdatedAt                string
	DeletedAt                string
}

type OrganizationRepository

type OrganizationRepository interface {
	CountOrganizations(ctx context.Context) (int, error)
	FindOrganizationByID(ctx context.Context, organizationID string) (OrganizationRecord, error)
	CreateOrganization(ctx context.Context, organization OrganizationRecord) error
	UpdateOrganization(ctx context.Context, organization OrganizationRecord) error
	ListOrganizations(ctx context.Context) ([]OrganizationRecord, error)
	ListOrganizationsByUserID(ctx context.Context, userID string) ([]OrganizationRecord, error)
}

type PostgresStore added in v0.1.16

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

func NewPostgresStore added in v0.1.16

func NewPostgresStore(db *sql.DB) *PostgresStore

func (*PostgresStore) ActivateCredential added in v0.1.16

func (store *PostgresStore) ActivateCredential(ctx context.Context, organizationID string, credentialID string, activatedAt string) error

func (*PostgresStore) AgentCredentials added in v0.1.16

func (store *PostgresStore) AgentCredentials() AgentCredentialRepository

func (*PostgresStore) AgentRegistrationTokens added in v0.1.16

func (store *PostgresStore) AgentRegistrationTokens() AgentRegistrationTokenRepository

func (*PostgresStore) AuditLogs added in v0.1.16

func (store *PostgresStore) AuditLogs() AuditLogRepository

func (*PostgresStore) ClaimRegistrationToken added in v0.1.16

func (store *PostgresStore) ClaimRegistrationToken(ctx context.Context, organizationID string, tokenID string, claimedAt string) error

func (*PostgresStore) CountOrganizations added in v0.1.16

func (store *PostgresStore) CountOrganizations(ctx context.Context) (int, error)

func (*PostgresStore) CountRulesByOrganization added in v0.1.16

func (store *PostgresStore) CountRulesByOrganization(ctx context.Context, organizationID string) (int, error)

func (*PostgresStore) CountRulesByOwner added in v0.1.16

func (store *PostgresStore) CountRulesByOwner(ctx context.Context, organizationID string, ownerUserID string) (int, error)

func (*PostgresStore) CreateAuditLog added in v0.1.16

func (store *PostgresStore) CreateAuditLog(ctx context.Context, audit AuditLogRecord) error

func (*PostgresStore) CreateCredential added in v0.1.16

func (store *PostgresStore) CreateCredential(ctx context.Context, credential AgentCredentialRecord) error

func (*PostgresStore) CreateMember added in v0.1.16

func (store *PostgresStore) CreateMember(ctx context.Context, member MemberRecord) error

func (*PostgresStore) CreateMonitor added in v0.1.16

func (store *PostgresStore) CreateMonitor(ctx context.Context, monitor MonitorRecord, groupIDs []string, now string, nextID func() string) error

func (*PostgresStore) CreateMonitorGroup added in v0.1.16

func (store *PostgresStore) CreateMonitorGroup(ctx context.Context, monitorGroup MonitorGroupRecord) error

func (*PostgresStore) CreateNode added in v0.1.16

func (store *PostgresStore) CreateNode(ctx context.Context, node NodeRecord, groupIDs []string, listenIPs []NodeListenIPRecord, portRanges []NodePortRangeRecord, now string, nextID func() string) error

func (*PostgresStore) CreateNodeGroup added in v0.1.16

func (store *PostgresStore) CreateNodeGroup(ctx context.Context, nodeGroup NodeGroupRecord) error

func (*PostgresStore) CreateOrganization added in v0.1.16

func (store *PostgresStore) CreateOrganization(ctx context.Context, organization OrganizationRecord) error

func (*PostgresStore) CreateRegistrationToken added in v0.1.16

func (store *PostgresStore) CreateRegistrationToken(ctx context.Context, token AgentRegistrationTokenRecord) error

func (*PostgresStore) CreateRole added in v0.1.16

func (store *PostgresStore) CreateRole(ctx context.Context, role RoleRecord) error

func (*PostgresStore) CreateRule added in v0.1.16

func (store *PostgresStore) CreateRule(ctx context.Context, rule RuleRecord, binding InboundBindingRecord, tags []string, now string, nextID func() string) error

func (*PostgresStore) CreateTarget added in v0.1.16

func (store *PostgresStore) CreateTarget(ctx context.Context, target TargetRecord) error

func (*PostgresStore) CreateTargetGroup added in v0.1.16

func (store *PostgresStore) CreateTargetGroup(ctx context.Context, targetGroup TargetGroupRecord, members []TargetGroupMemberRecord, now string, nextID func() string) error

func (*PostgresStore) DeleteMember added in v0.1.16

func (store *PostgresStore) DeleteMember(ctx context.Context, organizationID string, memberID string) error

func (*PostgresStore) DeleteMonitor added in v0.1.16

func (store *PostgresStore) DeleteMonitor(ctx context.Context, organizationID string, monitorID string, deletedAt string) error

func (*PostgresStore) DeleteMonitorGroup added in v0.1.16

func (store *PostgresStore) DeleteMonitorGroup(ctx context.Context, organizationID string, monitorGroupID string, deletedAt string) error

func (*PostgresStore) DeleteNode added in v0.1.16

func (store *PostgresStore) DeleteNode(ctx context.Context, organizationID string, nodeID string, deletedAt string) error

func (*PostgresStore) DeleteNodeGroup added in v0.1.16

func (store *PostgresStore) DeleteNodeGroup(ctx context.Context, organizationID string, nodeGroupID string, deletedAt string) error

func (*PostgresStore) DeleteRole added in v0.1.16

func (store *PostgresStore) DeleteRole(ctx context.Context, organizationID string, roleID string) error

func (*PostgresStore) DeleteRule added in v0.1.16

func (store *PostgresStore) DeleteRule(ctx context.Context, organizationID string, ruleID string, deletedAt string) error

func (*PostgresStore) DeleteTarget added in v0.1.16

func (store *PostgresStore) DeleteTarget(ctx context.Context, organizationID string, targetID string, deletedAt string) error

func (*PostgresStore) DeleteTargetGroup added in v0.1.16

func (store *PostgresStore) DeleteTargetGroup(ctx context.Context, organizationID string, targetGroupID string, deletedAt string) error

func (*PostgresStore) EnsureDesiredConfigVersionAtLeast added in v0.1.16

func (store *PostgresStore) EnsureDesiredConfigVersionAtLeast(ctx context.Context, organizationID string, nodeID string, configVersion int, now string) error

func (*PostgresStore) FindCredentialByHash added in v0.1.16

func (store *PostgresStore) FindCredentialByHash(ctx context.Context, credentialHash string) (AgentCredentialRecord, error)

func (*PostgresStore) FindMemberByUserAndOrganization added in v0.1.16

func (store *PostgresStore) FindMemberByUserAndOrganization(ctx context.Context, organizationID string, userID string) (MemberRecord, error)

func (*PostgresStore) FindMonitorByID added in v0.1.16

func (store *PostgresStore) FindMonitorByID(ctx context.Context, organizationID string, monitorID string) (MonitorRecord, error)

func (*PostgresStore) FindMonitorGroupByID added in v0.1.16

func (store *PostgresStore) FindMonitorGroupByID(ctx context.Context, organizationID string, monitorGroupID string) (MonitorGroupRecord, error)

func (*PostgresStore) FindNodeByID added in v0.1.16

func (store *PostgresStore) FindNodeByID(ctx context.Context, organizationID string, nodeID string) (NodeRecord, error)

func (*PostgresStore) FindNodeGroupByID added in v0.1.16

func (store *PostgresStore) FindNodeGroupByID(ctx context.Context, organizationID string, nodeGroupID string) (NodeGroupRecord, error)

func (*PostgresStore) FindOrganizationByID added in v0.1.16

func (store *PostgresStore) FindOrganizationByID(ctx context.Context, organizationID string) (OrganizationRecord, error)

func (*PostgresStore) FindPendingCredentialByRegistrationToken added in v0.1.16

func (store *PostgresStore) FindPendingCredentialByRegistrationToken(ctx context.Context, organizationID string, registrationTokenID string) (AgentCredentialRecord, error)

func (*PostgresStore) FindRegistrationTokenByHash added in v0.1.16

func (store *PostgresStore) FindRegistrationTokenByHash(ctx context.Context, tokenHash string) (AgentRegistrationTokenRecord, error)

func (*PostgresStore) FindRoleByID added in v0.1.16

func (store *PostgresStore) FindRoleByID(ctx context.Context, organizationID string, roleID string) (RoleRecord, error)

func (*PostgresStore) FindRuleByID added in v0.1.16

func (store *PostgresStore) FindRuleByID(ctx context.Context, organizationID string, ruleID string) (RuleRecord, error)

func (*PostgresStore) FindTargetByID added in v0.1.16

func (store *PostgresStore) FindTargetByID(ctx context.Context, organizationID string, targetID string) (TargetRecord, error)

func (*PostgresStore) FindTargetGroupByID added in v0.1.16

func (store *PostgresStore) FindTargetGroupByID(ctx context.Context, organizationID string, targetGroupID string) (TargetGroupRecord, error)

func (*PostgresStore) FindUserByEmail added in v0.1.16

func (store *PostgresStore) FindUserByEmail(ctx context.Context, email string) (UserRecord, error)

func (*PostgresStore) FindUserByID added in v0.1.16

func (store *PostgresStore) FindUserByID(ctx context.Context, userID string) (UserRecord, error)

func (*PostgresStore) IncrementDesiredConfigForNode added in v0.1.16

func (store *PostgresStore) IncrementDesiredConfigForNode(ctx context.Context, organizationID string, nodeID string, now string) error

func (*PostgresStore) IncrementDesiredConfigForNodeGroup added in v0.1.16

func (store *PostgresStore) IncrementDesiredConfigForNodeGroup(ctx context.Context, organizationID string, nodeGroupID string, now string) error

func (*PostgresStore) ListEnabledInboundBindings added in v0.1.16

func (store *PostgresStore) ListEnabledInboundBindings(ctx context.Context, organizationID string) ([]RuleRecord, error)

func (*PostgresStore) ListForMember added in v0.1.16

func (store *PostgresStore) ListForMember(ctx context.Context, organizationID string, memberID string) ([]RoleRecord, error)

func (*PostgresStore) ListMembersByOrganization added in v0.1.16

func (store *PostgresStore) ListMembersByOrganization(ctx context.Context, organizationID string) ([]MemberRecord, error)

func (*PostgresStore) ListMonitorGroupsByOrganization added in v0.1.16

func (store *PostgresStore) ListMonitorGroupsByOrganization(ctx context.Context, organizationID string) ([]MonitorGroupRecord, error)

func (*PostgresStore) ListMonitorsByOrganization added in v0.1.16

func (store *PostgresStore) ListMonitorsByOrganization(ctx context.Context, organizationID string) ([]MonitorRecord, error)

func (*PostgresStore) ListNodeGroupsByOrganization added in v0.1.16

func (store *PostgresStore) ListNodeGroupsByOrganization(ctx context.Context, organizationID string) ([]NodeGroupRecord, error)

func (*PostgresStore) ListNodesByOrganization added in v0.1.16

func (store *PostgresStore) ListNodesByOrganization(ctx context.Context, organizationID string) ([]NodeRecord, error)

func (*PostgresStore) ListOrganizations added in v0.1.16

func (store *PostgresStore) ListOrganizations(ctx context.Context) ([]OrganizationRecord, error)

func (*PostgresStore) ListOrganizationsByUserID added in v0.1.16

func (store *PostgresStore) ListOrganizationsByUserID(ctx context.Context, userID string) ([]OrganizationRecord, error)

func (*PostgresStore) ListQuotasByOrganization added in v0.1.16

func (store *PostgresStore) ListQuotasByOrganization(ctx context.Context, organizationID string) ([]QuotaRecord, error)

func (*PostgresStore) ListRegistrationTokens added in v0.1.16

func (store *PostgresStore) ListRegistrationTokens(ctx context.Context, organizationID string, agentType string, agentID string) ([]AgentRegistrationTokenRecord, error)

func (*PostgresStore) ListRolesByOrganization added in v0.1.16

func (store *PostgresStore) ListRolesByOrganization(ctx context.Context, organizationID string) ([]RoleRecord, error)

func (*PostgresStore) ListRulesByOrganization added in v0.1.16

func (store *PostgresStore) ListRulesByOrganization(ctx context.Context, organizationID string) ([]RuleRecord, error)

func (*PostgresStore) ListTargetGroupsByOrganization added in v0.1.16

func (store *PostgresStore) ListTargetGroupsByOrganization(ctx context.Context, organizationID string) ([]TargetGroupRecord, error)

func (*PostgresStore) ListTargetsByOrganization added in v0.1.16

func (store *PostgresStore) ListTargetsByOrganization(ctx context.Context, organizationID string) ([]TargetRecord, error)

func (*PostgresStore) MarkMonitorAgentConnected added in v0.1.16

func (store *PostgresStore) MarkMonitorAgentConnected(ctx context.Context, organizationID string, monitorID string, now string) error

func (*PostgresStore) MarkMonitorAgentDisconnected added in v0.1.16

func (store *PostgresStore) MarkMonitorAgentDisconnected(ctx context.Context, organizationID string, monitorID string, now string) error

func (*PostgresStore) MarkNodeAgentConnected added in v0.1.16

func (store *PostgresStore) MarkNodeAgentConnected(ctx context.Context, organizationID string, nodeID string, now string) error

func (*PostgresStore) MarkNodeAgentDisconnected added in v0.1.16

func (store *PostgresStore) MarkNodeAgentDisconnected(ctx context.Context, organizationID string, nodeID string, now string) error

func (*PostgresStore) MarkNodeAgentUpdateRequested added in v0.1.16

func (store *PostgresStore) MarkNodeAgentUpdateRequested(ctx context.Context, organizationID string, nodeID string, targetVersion string, now string) error

func (*PostgresStore) MarkNodeAgentUpdateSatisfied added in v0.1.16

func (store *PostgresStore) MarkNodeAgentUpdateSatisfied(ctx context.Context, organizationID string, nodeID string, targetVersion string, now string) error

func (*PostgresStore) Members added in v0.1.16

func (store *PostgresStore) Members() MemberRepository

func (*PostgresStore) MonitorGroups added in v0.1.16

func (store *PostgresStore) MonitorGroups() MonitorGroupRepository

func (*PostgresStore) Monitors added in v0.1.16

func (store *PostgresStore) Monitors() MonitorRepository

func (*PostgresStore) NodeGroups added in v0.1.16

func (store *PostgresStore) NodeGroups() NodeGroupRepository

func (*PostgresStore) Nodes added in v0.1.16

func (store *PostgresStore) Nodes() NodeRepository

func (*PostgresStore) Organizations added in v0.1.16

func (store *PostgresStore) Organizations() OrganizationRepository

func (*PostgresStore) Quotas added in v0.1.16

func (store *PostgresStore) Quotas() QuotaRepository

func (*PostgresStore) RecordNodeAgentUpdateResult added in v0.1.16

func (store *PostgresStore) RecordNodeAgentUpdateResult(ctx context.Context, organizationID string, nodeID string, status string, errorMessage string, now string) error

func (*PostgresStore) RecordNodeConfigAck added in v0.1.16

func (store *PostgresStore) RecordNodeConfigAck(ctx context.Context, organizationID string, nodeID string, configVersion int, status string, errorMessage string, now string) error

func (*PostgresStore) ReleaseRegistrationTokenUse added in v0.1.16

func (store *PostgresStore) ReleaseRegistrationTokenUse(ctx context.Context, organizationID string, tokenID string) error

func (*PostgresStore) ReplaceMemberRoles added in v0.1.16

func (store *PostgresStore) ReplaceMemberRoles(ctx context.Context, organizationID string, memberID string, roleIDs []string, now string, nextID func() string) error

func (*PostgresStore) ReplacePermissions added in v0.1.16

func (store *PostgresStore) ReplacePermissions(ctx context.Context, organizationID string, roleID string, permissions []string, now string, nextID func() string) error

func (*PostgresStore) ReplaceResourceScopes added in v0.1.16

func (store *PostgresStore) ReplaceResourceScopes(ctx context.Context, organizationID string, roleID string, scopes []ResourceScopeRecord, now string, nextID func() string) error

func (*PostgresStore) RevokeActiveCredentialsExcept added in v0.1.16

func (store *PostgresStore) RevokeActiveCredentialsExcept(ctx context.Context, organizationID string, agentType string, agentID string, keepCredentialID string, revokedAt string) error

func (*PostgresStore) RevokeActiveUnusedRegistrationTokens added in v0.1.16

func (store *PostgresStore) RevokeActiveUnusedRegistrationTokens(ctx context.Context, organizationID string, agentType string, agentID string, revokedAt string) error

func (*PostgresStore) RevokeCredential added in v0.1.16

func (store *PostgresStore) RevokeCredential(ctx context.Context, organizationID string, credentialID string, revokedAt string) error

func (*PostgresStore) RevokeRegistrationToken added in v0.1.16

func (store *PostgresStore) RevokeRegistrationToken(ctx context.Context, organizationID string, agentType string, agentID string, tokenID string, revokedAt string) error

func (*PostgresStore) Roles added in v0.1.16

func (store *PostgresStore) Roles() RoleRepository

func (*PostgresStore) Rules added in v0.1.16

func (store *PostgresStore) Rules() RuleRepository

func (*PostgresStore) SumRuleTraffic added in v0.1.16

func (store *PostgresStore) SumRuleTraffic(ctx context.Context, organizationID string, ruleID string) (RuleTrafficRecord, error)

func (*PostgresStore) TargetGroups added in v0.1.16

func (store *PostgresStore) TargetGroups() TargetGroupRepository

func (*PostgresStore) Targets added in v0.1.16

func (store *PostgresStore) Targets() TargetRepository

func (*PostgresStore) UpdateMemberStatus added in v0.1.16

func (store *PostgresStore) UpdateMemberStatus(ctx context.Context, organizationID string, memberID string, status string) error

func (*PostgresStore) UpdateMonitor added in v0.1.16

func (store *PostgresStore) UpdateMonitor(ctx context.Context, monitor MonitorRecord, replaceGroups bool, groupIDs []string, now string, nextID func() string) error

func (*PostgresStore) UpdateMonitorGroup added in v0.1.16

func (store *PostgresStore) UpdateMonitorGroup(ctx context.Context, monitorGroup MonitorGroupRecord) error

func (*PostgresStore) UpdateNode added in v0.1.16

func (store *PostgresStore) UpdateNode(ctx context.Context, node NodeRecord, replaceGroups bool, groupIDs []string, replaceListenIPs bool, listenIPs []NodeListenIPRecord, replacePortRanges bool, portRanges []NodePortRangeRecord, now string, nextID func() string) error

func (*PostgresStore) UpdateNodeAgentUpdatePolicy added in v0.1.16

func (store *PostgresStore) UpdateNodeAgentUpdatePolicy(ctx context.Context, organizationID string, nodeID string, enabled bool, now string) error

func (*PostgresStore) UpdateNodeAgentVersion added in v0.1.16

func (store *PostgresStore) UpdateNodeAgentVersion(ctx context.Context, organizationID string, nodeID string, version NodeAgentVersionRecord, now string) error

func (*PostgresStore) UpdateNodeGroup added in v0.1.16

func (store *PostgresStore) UpdateNodeGroup(ctx context.Context, nodeGroup NodeGroupRecord) error

func (*PostgresStore) UpdateOrganization added in v0.1.16

func (store *PostgresStore) UpdateOrganization(ctx context.Context, organization OrganizationRecord) error

func (*PostgresStore) UpdateRole added in v0.1.16

func (store *PostgresStore) UpdateRole(ctx context.Context, role RoleRecord) error

func (*PostgresStore) UpdateRule added in v0.1.16

func (store *PostgresStore) UpdateRule(ctx context.Context, rule RuleRecord, binding InboundBindingRecord, tags []string, now string, nextID func() string) error

func (*PostgresStore) UpdateTarget added in v0.1.16

func (store *PostgresStore) UpdateTarget(ctx context.Context, target TargetRecord) error

func (*PostgresStore) UpdateTargetGroup added in v0.1.16

func (store *PostgresStore) UpdateTargetGroup(ctx context.Context, targetGroup TargetGroupRecord, members []TargetGroupMemberRecord, now string, nextID func() string) error

func (*PostgresStore) Users added in v0.1.16

func (store *PostgresStore) Users() UserRepository

func (*PostgresStore) WithinTx added in v0.1.16

func (store *PostgresStore) WithinTx(ctx context.Context, fn func(ctx context.Context, repositories Repositories) error) error

type QuotaRecord

type QuotaRecord struct {
	ID                string
	OrganizationID    string
	Scope             string
	SubjectUserID     string
	SubjectRuleID     string
	RuleLimit         int
	TrafficLimitBytes int64
	TrafficLimitMode  string
	OverLimitAction   string
	CreatedAt         string
	UpdatedAt         string
}

type QuotaRepository

type QuotaRepository interface {
	ListQuotasByOrganization(ctx context.Context, organizationID string) ([]QuotaRecord, error)
}

type Repositories

type Repositories interface {
	Users() UserRepository
	Organizations() OrganizationRepository
	Members() MemberRepository
	Roles() RoleRepository
	NodeGroups() NodeGroupRepository
	Nodes() NodeRepository
	MonitorGroups() MonitorGroupRepository
	Monitors() MonitorRepository
	Targets() TargetRepository
	TargetGroups() TargetGroupRepository
	Rules() RuleRepository
	Quotas() QuotaRepository
	AgentRegistrationTokens() AgentRegistrationTokenRepository
	AgentCredentials() AgentCredentialRepository
	AuditLogs() AuditLogRepository
}

type ResourceScopeRecord

type ResourceScopeRecord struct {
	ID             string
	OrganizationID string
	RoleID         string
	ResourceType   string
	ResourceID     string
	AccessLevel    string
	CreatedAt      string
}

type RoleRecord

type RoleRecord struct {
	ID             string
	OrganizationID string
	Key            string
	Name           string
	Description    string
	IsSystem       bool
	Permissions    []string
	ResourceScopes []ResourceScopeRecord
	CreatedAt      string
	UpdatedAt      string
	DeletedAt      string
}

type RoleRepository

type RoleRepository interface {
	ListRolesByOrganization(ctx context.Context, organizationID string) ([]RoleRecord, error)
	FindRoleByID(ctx context.Context, organizationID string, roleID string) (RoleRecord, error)
	CreateRole(ctx context.Context, role RoleRecord) error
	UpdateRole(ctx context.Context, role RoleRecord) error
	DeleteRole(ctx context.Context, organizationID string, roleID string) error
	ReplacePermissions(ctx context.Context, organizationID string, roleID string, permissions []string, now string, nextID func() string) error
	ReplaceResourceScopes(ctx context.Context, organizationID string, roleID string, scopes []ResourceScopeRecord, now string, nextID func() string) error
	ReplaceMemberRoles(ctx context.Context, organizationID string, memberID string, roleIDs []string, now string, nextID func() string) error
	ListForMember(ctx context.Context, organizationID string, memberID string) ([]RoleRecord, error)
}

type RuleRecord

type RuleRecord struct {
	ID               string
	OrganizationID   string
	OwnerUserID      string
	Name             string
	Enabled          bool
	Status           string
	ForwardingType   string
	Protocol         string
	MatchType        string
	InboundBindingID string
	SNIHostname      string
	TargetType       string
	TargetID         string
	TargetGroupID    string
	ProxyProtocolIn  string
	ProxyProtocolOut string
	ConfigVersion    int
	CreatedAt        string
	UpdatedAt        string
	DeletedAt        string
	Binding          InboundBindingRecord
	Tags             []string
}

type RuleRepository

type RuleRepository interface {
	ListRulesByOrganization(ctx context.Context, organizationID string) ([]RuleRecord, error)
	FindRuleByID(ctx context.Context, organizationID string, ruleID string) (RuleRecord, error)
	CreateRule(ctx context.Context, rule RuleRecord, binding InboundBindingRecord, tags []string, now string, nextID func() string) error
	UpdateRule(ctx context.Context, rule RuleRecord, binding InboundBindingRecord, tags []string, now string, nextID func() string) error
	DeleteRule(ctx context.Context, organizationID string, ruleID string, deletedAt string) error
	ListEnabledInboundBindings(ctx context.Context, organizationID string) ([]RuleRecord, error)
	CountRulesByOrganization(ctx context.Context, organizationID string) (int, error)
	CountRulesByOwner(ctx context.Context, organizationID string, ownerUserID string) (int, error)
	SumRuleTraffic(ctx context.Context, organizationID string, ruleID string) (RuleTrafficRecord, error)
}

type RuleTrafficRecord

type RuleTrafficRecord struct {
	UploadBytes    int64
	DownloadBytes  int64
	TCPConnections int64
	UDPPackets     int64
}

type TargetGroupMemberRecord

type TargetGroupMemberRecord struct {
	ID             string
	OrganizationID string
	TargetGroupID  string
	TargetID       string
	Priority       int
	Enabled        bool
	CreatedAt      string
	UpdatedAt      string
}

type TargetGroupRecord

type TargetGroupRecord struct {
	ID             string
	OrganizationID string
	Name           string
	Description    string
	Scheduler      string
	CreatedAt      string
	UpdatedAt      string
	DeletedAt      string
	Members        []TargetGroupMemberRecord
}

type TargetGroupRepository

type TargetGroupRepository interface {
	ListTargetGroupsByOrganization(ctx context.Context, organizationID string) ([]TargetGroupRecord, error)
	FindTargetGroupByID(ctx context.Context, organizationID string, targetGroupID string) (TargetGroupRecord, error)
	CreateTargetGroup(ctx context.Context, targetGroup TargetGroupRecord, members []TargetGroupMemberRecord, now string, nextID func() string) error
	UpdateTargetGroup(ctx context.Context, targetGroup TargetGroupRecord, members []TargetGroupMemberRecord, now string, nextID func() string) error
	DeleteTargetGroup(ctx context.Context, organizationID string, targetGroupID string, deletedAt string) error
}

type TargetRecord

type TargetRecord struct {
	ID             string
	OrganizationID string
	Name           string
	Host           string
	Port           int
	Enabled        bool
	CreatedAt      string
	UpdatedAt      string
	DeletedAt      string
}

type TargetRepository

type TargetRepository interface {
	ListTargetsByOrganization(ctx context.Context, organizationID string) ([]TargetRecord, error)
	FindTargetByID(ctx context.Context, organizationID string, targetID string) (TargetRecord, error)
	CreateTarget(ctx context.Context, target TargetRecord) error
	UpdateTarget(ctx context.Context, target TargetRecord) error
	DeleteTarget(ctx context.Context, organizationID string, targetID string, deletedAt string) error
}

type UnitOfWork

type UnitOfWork interface {
	WithinTx(ctx context.Context, fn func(ctx context.Context, repositories Repositories) error) error
}

type UserRecord

type UserRecord struct {
	ID    string
	Email string
	Name  string
}

type UserRepository

type UserRepository interface {
	FindUserByID(ctx context.Context, userID string) (UserRecord, error)
	FindUserByEmail(ctx context.Context, email string) (UserRecord, error)
}

Jump to

Keyboard shortcuts

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