gateway

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MetadataTeamIDKey = "team_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 IsValidSlug(slug string) bool

func NormalizeDomain

func NormalizeDomain(domain string) (string, error)

func NormalizeSlug

func NormalizeSlug(slug string) string

Types

type ClientTLSConfig

type ClientTLSConfig map[string]json.RawMessage

func (*ClientTLSConfig) Scan

func (c *ClientTLSConfig) Scan(value interface{}) error

func (ClientTLSConfig) Value

func (c ClientTLSConfig) Value() (driver.Value, 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"`
}

func New

func New(slug string) (*Gateway, error)

func Rehydrate

func Rehydrate(
	id ids.GatewayID,
	slug, status, domain string,
	tel *telemetry.Telemetry,
	clientTLS ClientTLSConfig,
	session *SessionConfig,
	createdAt, updatedAt time.Time,
) *Gateway

func (*Gateway) TeamID

func (g *Gateway) TeamID() string

func (*Gateway) Validate

func (g *Gateway) Validate() error

type ListFilter

type ListFilter struct {
	SlugContains string
	Page         int
	Size         int
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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