api

package
v0.0.0-...-0514228 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

README

API

Version management

Handling versioning is done by the API server. The API server will only serve the latest version of the API.

Version v1alpha1

Routes
Register Route
POST /v1alpha1/routes

{
    "name": "my-route",
    "hostnames": ["example.com"],
    "backends": [
        {
            "host": "example.com:8080",
            "weight": 2,
            "scheme": "https"
        },
        {
            "addr": "example.com:8081",
            "weight": 1,
            "scheme": "http"
        }
    ]
}
Get Route
GET /v1alpha1/routes/{name}
Delete Route
DELETE /v1alpha1/routes/{name}
Update Route
PUT /v1alpha1/routes/{name}

{
    "name": "my-route",
    "hostnames": ["example.com"],
    "backends": [
        ...
    ]
}

Documentation

Index

Constants

View Source
const (
	APIV1Alpha1       = "/v1alpha1"
	APIV1Alpha1Routes = APIV1Alpha1 + "/routes"
	ContentTypeJSON   = "application/json"
	ContentTypeYAML   = "application/yaml"
)

Variables

View Source
var (
	ErrRouteNotFound = errors.New("route not found")
)

Functions

func RegisterRoutesV1Alpha1

func RegisterRoutesV1Alpha1(mux *http.ServeMux, proxy v1alpha1.Proxy)

Types

type Proxy

type Proxy interface {
	http.Handler
	v1alpha1.Proxy
}

type Router

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

func NewRouter

func NewRouter(ctx context.Context, apiAddr string, proxy Proxy) *Router

func (*Router) Run

func (r *Router) Run(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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