sample

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package sample provides a Connect service for ingress experiments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server added in v0.3.0

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

Server serves sample Connect requests and HTTP health checks on one listener.

func NewServer added in v0.3.0

func NewServer(connectHandler http.Handler, log *slog.Logger) *Server

NewServer constructs a sample server around a configured Connect handler.

func (*Server) Serve added in v0.3.0

func (s *Server) Serve(ctx context.Context, listener net.Listener) error

Serve accepts sample traffic until the context is cancelled or the server fails.

func (*Server) ServeHTTP added in v0.3.0

func (s *Server) ServeHTTP(writer http.ResponseWriter, request *http.Request)

ServeHTTP serves sample Connect requests and health checks.

type Service

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

Service serves a read-only snapshot loaded from ProtoJSON.

func New

func New(data []byte) (*Service, error)

New loads sample users from a ProtoJSON ListUsersResponse.

func (*Service) GetUser

GetUser returns one sample user, or InvalidArgument or NotFound for an invalid ID.

func (*Service) ListUsers

ListUsers filters by IDs and optional role, preserving fixture order.

type Weather added in v0.12.0

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

Weather serves raw HTTP JSON endpoints modelled on a legacy weather service. WeatherService in weather.proto types its responses.

func NewWeather added in v0.12.0

func NewWeather(data []byte, revision string) (*Weather, error)

NewWeather loads weather from a JSON object mapping locations to ProtoJSON GetForecastV2Response values.

func (*Weather) GetForecast added in v0.12.0

func (w *Weather) GetForecast(writer http.ResponseWriter, request *http.Request)

GetForecast serves GET /api/v1/forecast for a location.

func (*Weather) GetForecastV2 added in v0.12.0

func (w *Weather) GetForecastV2(writer http.ResponseWriter, request *http.Request)

GetForecastV2 serves GET /v2/forecast for a location, including its alerts.

func (*Weather) GetStatus added in v0.12.0

func (w *Weather) GetStatus(writer http.ResponseWriter, _ *http.Request)

GetStatus serves GET /_status.

Directories

Path Synopsis
pb

Jump to

Keyboard shortcuts

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