api_backend

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateInTx

func CreateInTx(ctx dao.Context, apiServiceID uint, input CreateInput) (models.APIBackend, error)

Types

type CreateInput

type CreateInput struct {
	Name string `json:"name" binding:"required,max=64"`
}

type CreateRequest

type CreateRequest struct {
	APIServiceID uint `json:"api_service_id" binding:"required"`
	CreateInput
}

type Handler

type Handler struct {
	App       app.Application
	Publisher UpstreamPublisher
}

func (*Handler) Create

func (*Handler) Delete

func (h *Handler) Delete(c *app.Context, req IDRequest) (api.StatusResponse, error)

func (*Handler) Get

func (h *Handler) Get(c *app.Context, req IDRequest) (ManagementResponse, error)

func (*Handler) List

func (*Handler) Update

func (h *Handler) Update(c *app.Context, req UpdateRequest) (api.StatusResponse, error)

type IDRequest

type IDRequest struct {
	ID string `uri:"id" binding:"required"`
}

type ListRequest

type ListRequest struct {
	api.PaginationQuery
	APIServiceID *uint  `form:"api_service_id"`
	Search       string `form:"search"`
}

type ManagementResponse

type ManagementResponse struct {
	models.APIBackend
	RouteCount           int64    `json:"route_count"`
	UpstreamCount        int64    `json:"upstream_count"`
	EnabledUpstreamCount int64    `json:"enabled_upstream_count"`
	EndpointHosts        []string `json:"endpoint_hosts"`
}

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)

type UpstreamPublisher

type UpstreamPublisher interface {
	PublishUpstream(context.Context, string, models.APIUpstream) error
}

Jump to

Keyboard shortcuts

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