Documentation
¶
Index ¶
- type CreateRequest
- type Handler
- func (h *Handler) Create(c *app.Context, req CreateRequest) (api.Created[models.APIRoute], error)
- func (h *Handler) Delete(c *app.Context, req IDRequest) (api.StatusResponse, error)
- func (h *Handler) Get(c *app.Context, req IDRequest) (models.APIRoute, error)
- func (h *Handler) List(c *app.Context, req ListRequest) (api.PaginatedResponse[models.APIRoute], error)
- func (h *Handler) Preview(c *app.Context, req PreviewRequest) (RoutePreviewResponse, error)
- func (h *Handler) Update(c *app.Context, req UpdateRequest) (api.StatusResponse, error)
- type IDRequest
- type ListRequest
- type PreviewEndpoint
- type PreviewRequest
- type RoutePreviewResponse
- type RoutePublisher
- type RouteTargetCommand
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateRequest ¶
type CreateRequest struct {
APIServiceID uint `json:"api_service_id" binding:"required"`
Slug string `json:"slug" binding:"max=64"`
Protocols []models.APIProtocol `json:"protocols"`
AllowedMethods []string `json:"allowed_methods"`
WebSocketSubprotocols []string `json:"websocket_subprotocols"`
UpstreamPath string `json:"upstream_path"`
ForwardSubpath bool `json:"forward_subpath"`
ExampleRequest models.APIRequestExample `json:"example_request"`
Target RouteTargetCommand `json:"target" binding:"required"`
Status *int `json:"status"`
}
type Handler ¶
type Handler struct {
App app.Application
Publisher RoutePublisher
UpstreamCreator api_upstream.Creator
}
func (*Handler) List ¶
func (h *Handler) List(c *app.Context, req ListRequest) (api.PaginatedResponse[models.APIRoute], error)
func (*Handler) Preview ¶
func (h *Handler) Preview(c *app.Context, req PreviewRequest) (RoutePreviewResponse, error)
Preview returns every statically configured candidate for a route draft. It is deliberately read-only: it neither selects a candidate nor calls any runtime gate, transport, accounting, observation, or publish component.
func (*Handler) Update ¶
func (h *Handler) Update(c *app.Context, req UpdateRequest) (api.StatusResponse, error)
type ListRequest ¶
type ListRequest struct {
api.PaginationQuery
APIServiceID *uint `form:"api_service_id"`
Search string `form:"search"`
Status *int `form:"status"`
}
type PreviewEndpoint ¶
type PreviewRequest ¶
type PreviewRequest struct {
APIServiceID uint `json:"api_service_id" binding:"required"`
Slug string `json:"slug" binding:"max=64"`
UpstreamPath string `json:"upstream_path"`
ForwardSubpath bool `json:"forward_subpath"`
Sample models.APIRequestExample `json:"sample"`
Target RouteTargetCommand `json:"target"`
}
type RoutePreviewResponse ¶
type RoutePreviewResponse struct {
Endpoints []PreviewEndpoint `json:"endpoints"`
Diagnostics []string `json:"diagnostics"`
}
type RoutePublisher ¶
type RouteTargetCommand ¶
type RouteTargetCommand struct {
Mode string `json:"mode" binding:"required,oneof=existing create"`
BackendID uint `json:"backend_id"`
Backend *api_backend.CreateInput `json:"backend"`
FirstUpstream *api_upstream.CreateInput `json:"first_upstream"`
}
RouteTargetCommand selects an existing backend or atomically creates a new backend with its first upstream before attaching the route to it.
type UpdateRequest ¶
type UpdateRequest struct {
ID string `uri:"id" binding:"required"`
Fields map[string]any `json:"-"`
}
func (*UpdateRequest) SetBodyMap ¶
func (r *UpdateRequest) SetBodyMap(v map[string]any)
Click to show internal directories.
Click to hide internal directories.