gateway

package
v0.8.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a reference implementation for API gateway integration It watches for service schema changes and provides conversion utilities.

func NewClient

func NewClient(registry farp.SchemaRegistry) *Client

NewClient creates a new gateway client.

func (*Client) ClearCache

func (c *Client) ClearCache()

ClearCache clears the schema cache.

func (*Client) ConvertToRoutes

func (c *Client) ConvertToRoutes(manifests []*farp.SchemaManifest) []ServiceRoute

ConvertToRoutes converts service manifests to gateway routes This is a reference implementation - actual gateways should customize this.

func (*Client) GetManifest

func (c *Client) GetManifest(instanceID string) (*farp.SchemaManifest, bool)

GetManifest retrieves a cached manifest by instance ID.

func (*Client) WatchServices

func (c *Client) WatchServices(ctx context.Context, serviceName string, onChange func([]ServiceRoute)) error

WatchServices watches for service registrations and schema updates onChange is called whenever services are added, updated, or removed.

type ServiceRoute

type ServiceRoute struct {
	// Path is the route path pattern
	Path string

	// Methods are HTTP methods for this route (e.g., ["GET", "POST"])
	Methods []string

	// TargetURL is the backend service URL
	TargetURL string

	// HealthURL is the health check URL
	HealthURL string

	// Middleware are middleware names to apply
	Middleware []string

	// Metadata contains additional route information
	Metadata map[string]any

	// ServiceName is the name of the backend service
	ServiceName string

	// ServiceVersion is the version of the backend service
	ServiceVersion string
}

ServiceRoute represents a route configuration for the gateway.

Jump to

Keyboard shortcuts

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