Documentation
¶
Index ¶
- Constants
- Variables
- func IsValidSlug(slug string) bool
- func NewSlug() (string, error)
- func NormalizeDomain(domain string) (string, error)
- func NormalizeSlug(slug string) string
- func SanitizeClientMetadata(metadata map[string]string) map[string]string
- func WithTenantID(metadata map[string]string, tenantID string) map[string]string
- type ClientTLSConfig
- type Gateway
- type ListFilter
- type Repository
- type SessionConfig
Constants ¶
View Source
const MetadataTenantIDKey = "tenant_id"
Variables ¶
View Source
var ( ErrNotFound = fmt.Errorf("gateway: %w", commonerrors.ErrNotFound) ErrAlreadyExists = fmt.Errorf("gateway: %w", commonerrors.ErrAlreadyExists) ErrHasDependents = fmt.Errorf("gateway: %w", commonerrors.ErrHasDependents) ErrInvalidDomain = fmt.Errorf("gateway: invalid domain: %w", commonerrors.ErrValidation) )
Sentinel errors for the gateway aggregate. They wrap the package-wide sentinels in pkg/common/errors so callers can match either the generic or the entity-specific error via errors.Is.
Functions ¶
func IsValidSlug ¶
func NewSlug ¶ added in v0.3.4
NewSlug returns a random gateway slug that satisfies the DNS-label format (e.g. "gw-k3f9x1a2b7c4"). 36^12 combinations make collisions vanishingly rare; the slug unique index plus a retry on save covers the residual risk.
func NormalizeDomain ¶
func NormalizeSlug ¶
func SanitizeClientMetadata ¶ added in v0.3.4
Types ¶
type ClientTLSConfig ¶
type ClientTLSConfig map[string]json.RawMessage
func (*ClientTLSConfig) Scan ¶
func (c *ClientTLSConfig) Scan(value interface{}) error
type Gateway ¶
type Gateway struct {
ID ids.GatewayID `json:"id"`
Slug string `json:"slug"`
Status string `json:"status"`
Domain string `json:"domain,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Telemetry *telemetry.Telemetry `json:"telemetry,omitempty"`
ClientTLSConfig ClientTLSConfig `json:"client_tls,omitempty"`
SessionConfig *SessionConfig `json:"session_config,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ListFilter ¶
type Repository ¶
type Repository interface {
Save(ctx context.Context, g *Gateway) error
Update(ctx context.Context, g *Gateway) error
Delete(ctx context.Context, id ids.GatewayID) error
FindByID(ctx context.Context, id ids.GatewayID) (*Gateway, error)
FindByDomain(ctx context.Context, domain string) (*Gateway, error)
FindBySlug(ctx context.Context, slug string) (*Gateway, error)
List(ctx context.Context, filter ListFilter) (items []*Gateway, total int, err error)
}
type SessionConfig ¶
type SessionConfig struct {
Enabled *bool `json:"enabled,omitempty"`
HeaderName string `json:"header_name,omitempty"`
BodyParamName string `json:"body_param_name,omitempty"`
}
func DefaultSessionConfig ¶
func DefaultSessionConfig() *SessionConfig
func (*SessionConfig) IsEnabled ¶
func (s *SessionConfig) IsEnabled() bool
Click to show internal directories.
Click to hide internal directories.