routing_api

package module
v0.0.0-...-00d61e7 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: Apache-2.0 Imports: 15 Imported by: 79

README

routing-api

Go Report Card Go Reference

The purpose of the Routing API is to present a RESTful interface for registering and deregistering routes for both internal and external clients. This allows easier consumption by different clients as well as the ability to register routes from outside of the CF deployment.

[!NOTE]

This repository should be imported as code.cloudfoundry.org/routing-api.

Docs

Contributing

See the Contributing.md for more information on how to contribute.

Working Group Charter

This repository is maintained by App Runtime Platform under Networking area.

[!IMPORTANT]

Content in this file is managed by the CI task sync-readme and is generated by CI following a convention.

Documentation

Index

Constants

View Source
const (
	UpsertRoute           = "UpsertRoute"
	DeleteRoute           = "Delete"
	ListRoute             = "List"
	EventStreamRoute      = "EventStream"
	ListRouterGroups      = "ListRouterGroups"
	UpdateRouterGroup     = "UpdateRouterGroup"
	CreateRouterGroup     = "CreateRouterGroup"
	DeleteRouterGroup     = "DeleteRouterGroup"
	UpsertTcpRouteMapping = "UpsertTcpRouteMapping"
	DeleteTcpRouteMapping = "DeleteTcpRouteMapping"
	ListTcpRouteMapping   = "ListTcpRouteMapping"
	EventStreamTcpRoute   = "TcpRouteEventStream"
)

Variables

View Source
var RoutesMap = map[string]rata.Route{UpsertRoute: {Path: "/routing/v1/routes", Method: "POST", Name: UpsertRoute},
	DeleteRoute:           {Path: "/routing/v1/routes", Method: "DELETE", Name: DeleteRoute},
	ListRoute:             {Path: "/routing/v1/routes", Method: "GET", Name: ListRoute},
	EventStreamRoute:      {Path: "/routing/v1/events", Method: "GET", Name: EventStreamRoute},
	CreateRouterGroup:     {Path: "/routing/v1/router_groups", Method: "POST", Name: CreateRouterGroup},
	DeleteRouterGroup:     {Path: "/routing/v1/router_groups/:guid", Method: "DELETE", Name: DeleteRouterGroup},
	ListRouterGroups:      {Path: "/routing/v1/router_groups", Method: "GET", Name: ListRouterGroups},
	UpdateRouterGroup:     {Path: "/routing/v1/router_groups/:guid", Method: "PUT", Name: UpdateRouterGroup},
	UpsertTcpRouteMapping: {Path: "/routing/v1/tcp_routes/create", Method: "POST", Name: UpsertTcpRouteMapping},
	DeleteTcpRouteMapping: {Path: "/routing/v1/tcp_routes/delete", Method: "POST", Name: DeleteTcpRouteMapping},
	ListTcpRouteMapping:   {Path: "/routing/v1/tcp_routes", Method: "GET", Name: ListTcpRouteMapping},
	EventStreamTcpRoute:   {Path: "/routing/v1/tcp_routes/events", Method: "GET", Name: EventStreamTcpRoute},
}

Functions

func Routes

func Routes() rata.Routes

Types

type Client

type Client interface {
	SetToken(string)
	UpsertRoutes([]models.Route) error
	Routes() ([]models.Route, error)
	DeleteRoutes([]models.Route) error
	RouterGroups() ([]models.RouterGroup, error)
	RouterGroupWithName(string) (models.RouterGroup, error)
	UpdateRouterGroup(models.RouterGroup) error
	CreateRouterGroup(models.RouterGroup) error
	DeleteRouterGroup(models.RouterGroup) error
	ReservePort(string, string) (int, error)
	UpsertTcpRouteMappings([]models.TcpRouteMapping) error
	DeleteTcpRouteMappings([]models.TcpRouteMapping) error
	TcpRouteMappings() ([]models.TcpRouteMapping, error)
	FilteredTcpRouteMappings([]string) ([]models.TcpRouteMapping, error)

	SubscribeToEvents() (EventSource, error)
	SubscribeToEventsWithMaxRetries(retries uint16) (EventSource, error)
	SubscribeToTcpEvents() (TcpEventSource, error)
	SubscribeToTcpEventsWithMaxRetries(retries uint16) (TcpEventSource, error)
}

func NewClient

func NewClient(url string, skipTLSVerification bool) Client

func NewClientWithTLSConfig

func NewClientWithTLSConfig(url string, tlsConfig *tls.Config) Client

type Error

type Error struct {
	Type    Type   `json:"name"`
	Message string `json:"message"`
}

func NewError

func NewError(errType Type, message string) Error

func (Error) Error

func (err Error) Error() string

type Event

type Event struct {
	Route  models.Route
	Action string
}

type EventSource

type EventSource interface {
	Next() (Event, error)
	Close() error
}

func NewEventSource

func NewEventSource(raw RawEventSource) EventSource

type RawEventSource

type RawEventSource interface {
	Next() (sse.Event, error)
	Close() error
}

type TcpEvent

type TcpEvent struct {
	TcpRouteMapping models.TcpRouteMapping
	Action          string
}

type TcpEventSource

type TcpEventSource interface {
	Next() (TcpEvent, error)
	Close() error
}

func NewTcpEventSource

func NewTcpEventSource(raw RawEventSource) TcpEventSource

type Type

type Type string
const (
	ResponseError               Type = "ResponseError"
	ResourceNotFoundError       Type = "ResourceNotFoundError"
	ProcessRequestError         Type = "ProcessRequestError"
	RouteInvalidError           Type = "RouteInvalidError"
	RouteServiceUrlInvalidError Type = "RouteServiceUrlInvalidError"
	DBCommunicationError        Type = "DBCommunicationError"
	GuidGenerationError         Type = "GuidGenerationError"
	UnauthorizedError           Type = "UnauthorizedError"
	TcpRouteMappingInvalidError Type = "TcpRouteMappingInvalidError"
	DBConflictError             Type = "DBConflictError"
	PortRangeExhaustedError     Type = "PortRangeExhaustedError"
)

Directories

Path Synopsis
cmd
db
fakes
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
fakes
Code generated by counterfeiter.
Code generated by counterfeiter.
fakes
This file was generated by counterfeiter
This file was generated by counterfeiter
fakes
Code generated by counterfeiter.
Code generated by counterfeiter.
v0
fakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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