Documentation
¶
Overview ¶
Package configstore provides gateway key and tenant hierarchy storage backends.
Index ¶
- Variables
- type ConfigStore
- type GatewayKey
- type GatewayKeyFilter
- type GatewayKeyStore
- type GatewayKeyUsageTracker
- type OrgStore
- type Organization
- type PostgresStore
- func (s *PostgresStore) Close() error
- func (s *PostgresStore) CreateGatewayKey(ctx context.Context, key GatewayKey) (*GatewayKey, error)
- func (s *PostgresStore) GetGatewayKey(ctx context.Context, keyHash string) (*GatewayKey, error)
- func (s *PostgresStore) GetOrganization(ctx context.Context, id string) (*Organization, error)
- func (s *PostgresStore) GetWorkspace(ctx context.Context, id string) (*Workspace, error)
- func (s *PostgresStore) ListGatewayKeys(ctx context.Context, filter GatewayKeyFilter) ([]GatewayKey, error)
- func (s *PostgresStore) ListWorkspaces(ctx context.Context, orgID string) ([]Workspace, error)
- func (s *PostgresStore) RevokeGatewayKey(ctx context.Context, id string, filter GatewayKeyFilter) error
- func (s *PostgresStore) RotateGatewayKey(ctx context.Context, id, token string, filter GatewayKeyFilter) (*GatewayKey, error)
- func (s *PostgresStore) TouchGatewayKeyLastUsed(ctx context.Context, id string, filter GatewayKeyFilter) error
- type StaticStore
- func (s *StaticStore) Close() error
- func (s *StaticStore) CreateGatewayKey(_ context.Context, _ GatewayKey) (*GatewayKey, error)
- func (s *StaticStore) GetGatewayKey(_ context.Context, keyHash string) (*GatewayKey, error)
- func (s *StaticStore) GetOrganization(_ context.Context, id string) (*Organization, error)
- func (s *StaticStore) GetWorkspace(_ context.Context, id string) (*Workspace, error)
- func (s *StaticStore) ListGatewayKeys(_ context.Context, filter GatewayKeyFilter) ([]GatewayKey, error)
- func (s *StaticStore) ListWorkspaces(_ context.Context, orgID string) ([]Workspace, error)
- func (s *StaticStore) RevokeGatewayKey(_ context.Context, _ string, _ GatewayKeyFilter) error
- func (s *StaticStore) RotateGatewayKey(_ context.Context, _ string, _ string, _ GatewayKeyFilter) (*GatewayKey, error)
- func (s *StaticStore) TouchGatewayKeyLastUsed(_ context.Context, _ string, _ GatewayKeyFilter) error
- type Workspace
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrConflict = errors.New("config store record conflicts with existing data")
View Source
var ErrNotFound = errors.New("config store record not found")
View Source
var ErrNotImplemented = errors.New("config store method not implemented")
Functions ¶
This section is empty.
Types ¶
type ConfigStore ¶
type ConfigStore interface {
GatewayKeyStore
GatewayKeyUsageTracker
OrgStore
// GetGatewayKey resolves an active gateway key by token hash.
GetGatewayKey(ctx context.Context, keyHash string) (*GatewayKey, error)
}
ConfigStore is the gateway configuration boundary that backs key resolution, gateway key management, and tenant hierarchy lookups.
type GatewayKey ¶
type GatewayKeyFilter ¶
type GatewayKeyStore ¶
type GatewayKeyStore interface {
ListGatewayKeys(ctx context.Context, filter GatewayKeyFilter) ([]GatewayKey, error)
CreateGatewayKey(ctx context.Context, key GatewayKey) (*GatewayKey, error)
RevokeGatewayKey(ctx context.Context, id string, filter GatewayKeyFilter) error
RotateGatewayKey(ctx context.Context, id, token string, filter GatewayKeyFilter) (*GatewayKey, error)
Close() error
}
type GatewayKeyUsageTracker ¶
type GatewayKeyUsageTracker interface {
TouchGatewayKeyLastUsed(ctx context.Context, id string, filter GatewayKeyFilter) error
}
type OrgStore ¶
type OrgStore interface {
GetOrganization(ctx context.Context, id string) (*Organization, error)
GetWorkspace(ctx context.Context, id string) (*Workspace, error)
ListWorkspaces(ctx context.Context, orgID string) ([]Workspace, error)
}
OrgStore resolves the organization -> workspace hierarchy used by gateway keys.
type Organization ¶
Organization is the top-level tenant boundary for gateway data.
type PostgresStore ¶
type PostgresStore struct {
DSN string
// contains filtered or unexported fields
}
func NewPostgresStore ¶
func NewPostgresStore(dsn string) (*PostgresStore, error)
func (*PostgresStore) Close ¶
func (s *PostgresStore) Close() error
func (*PostgresStore) CreateGatewayKey ¶
func (s *PostgresStore) CreateGatewayKey(ctx context.Context, key GatewayKey) (*GatewayKey, error)
func (*PostgresStore) GetGatewayKey ¶
func (s *PostgresStore) GetGatewayKey(ctx context.Context, keyHash string) (*GatewayKey, error)
func (*PostgresStore) GetOrganization ¶
func (s *PostgresStore) GetOrganization(ctx context.Context, id string) (*Organization, error)
func (*PostgresStore) GetWorkspace ¶
func (*PostgresStore) ListGatewayKeys ¶
func (s *PostgresStore) ListGatewayKeys(ctx context.Context, filter GatewayKeyFilter) ([]GatewayKey, error)
func (*PostgresStore) ListWorkspaces ¶
func (*PostgresStore) RevokeGatewayKey ¶
func (s *PostgresStore) RevokeGatewayKey(ctx context.Context, id string, filter GatewayKeyFilter) error
func (*PostgresStore) RotateGatewayKey ¶
func (s *PostgresStore) RotateGatewayKey(ctx context.Context, id, token string, filter GatewayKeyFilter) (*GatewayKey, error)
func (*PostgresStore) TouchGatewayKeyLastUsed ¶
func (s *PostgresStore) TouchGatewayKeyLastUsed(ctx context.Context, id string, filter GatewayKeyFilter) error
type StaticStore ¶
type StaticStore struct {
// contains filtered or unexported fields
}
func NewStaticStore ¶
func NewStaticStore(keys []GatewayKey) *StaticStore
func (*StaticStore) Close ¶
func (s *StaticStore) Close() error
func (*StaticStore) CreateGatewayKey ¶
func (s *StaticStore) CreateGatewayKey(_ context.Context, _ GatewayKey) (*GatewayKey, error)
func (*StaticStore) GetGatewayKey ¶
func (s *StaticStore) GetGatewayKey(_ context.Context, keyHash string) (*GatewayKey, error)
func (*StaticStore) GetOrganization ¶
func (s *StaticStore) GetOrganization(_ context.Context, id string) (*Organization, error)
func (*StaticStore) GetWorkspace ¶
func (*StaticStore) ListGatewayKeys ¶
func (s *StaticStore) ListGatewayKeys(_ context.Context, filter GatewayKeyFilter) ([]GatewayKey, error)
func (*StaticStore) ListWorkspaces ¶
func (*StaticStore) RevokeGatewayKey ¶
func (s *StaticStore) RevokeGatewayKey(_ context.Context, _ string, _ GatewayKeyFilter) error
func (*StaticStore) RotateGatewayKey ¶
func (s *StaticStore) RotateGatewayKey(_ context.Context, _ string, _ string, _ GatewayKeyFilter) (*GatewayKey, error)
func (*StaticStore) TouchGatewayKeyLastUsed ¶
func (s *StaticStore) TouchGatewayKeyLastUsed(_ context.Context, _ string, _ GatewayKeyFilter) error
Click to show internal directories.
Click to hide internal directories.