gateway

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 11 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

func SlugFromName

func SlugFromName(name 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"`
	Name            string               `json:"name"`
	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(name string, slug ...string) (*Gateway, error)

func Rehydrate

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

func RehydrateWithSlug

func RehydrateWithSlug(
	id ids.GatewayID,
	name, slug, status 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 {
	NameContains 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