handlers

package
v0.0.0-...-70ff550 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIServer

type APIServer struct {
	*RestAPIHandler // embedded — promotes CreateRestAPI, ListRestAPIs, GetRestAPIById, UpdateRestAPI, DeleteRestAPI
	// contains filtered or unexported fields
}

APIServer implements the generated ServerInterface

func NewAPIServer

func NewAPIServer(
	store *storage.ConfigStore,
	db storage.Storage,
	snapshotManager *xds.SnapshotManager,
	policyManager *policyxds.PolicyManager,
	lazyResourceManager *lazyresourcexds.LazyResourceStateManager,
	logger *slog.Logger,
	controlPlaneClient controlplane.ControlPlaneClient,
	policyDefinitions map[string]models.PolicyDefinition,
	templateDefinitions map[string]*api.LLMProviderTemplate,
	validator config.Validator,
	apiKeyXDSManager *apikeyxds.APIKeyStateManager,
	systemConfig *config.Config,
	eventHub eventhub.EventHub,
	subscriptionSnapshotUpdater utils.SubscriptionSnapshotUpdater,
	secretService *secrets.SecretService,
	restAPIService *restapi.RestAPIService,
) *APIServer

NewAPIServer creates a new API server with dependencies

func (*APIServer) BuildConfigDumpResponse

func (s *APIServer) BuildConfigDumpResponse(log *slog.Logger) (*adminapi.ConfigDumpResponse, error)

BuildConfigDumpResponse builds the complete configuration dump response payload.

func (*APIServer) CreateAPIKey

func (s *APIServer) CreateAPIKey(c *gin.Context, id string)

CreateAPIKey implements ServerInterface.CreateAPIKey (POST /apis/{id}/api-keys) Handles both local key generation and external key injection based on request payload

func (*APIServer) CreateLLMProvider

func (s *APIServer) CreateLLMProvider(c *gin.Context)

CreateLLMProvider implements ServerInterface.CreateLLMProvider (POST /llm-providers)

func (*APIServer) CreateLLMProviderAPIKey

func (s *APIServer) CreateLLMProviderAPIKey(c *gin.Context, id string)

CreateLLMProviderAPIKey implements ServerInterface.CreateLLMProviderAPIKey (POST /llm-providers/{id}/api-keys)

func (*APIServer) CreateLLMProviderTemplate

func (s *APIServer) CreateLLMProviderTemplate(c *gin.Context)

CreateLLMProviderTemplate implements ServerInterface.CreateLLMProviderTemplate (POST /llm-provider-templates)

func (*APIServer) CreateLLMProxy

func (s *APIServer) CreateLLMProxy(c *gin.Context)

CreateLLMProxy implements ServerInterface.CreateLLMProxy (POST /llm-proxies)

func (*APIServer) CreateLLMProxyAPIKey

func (s *APIServer) CreateLLMProxyAPIKey(c *gin.Context, id string)

CreateLLMProxyAPIKey implements ServerInterface.CreateLLMProxyAPIKey (POST /llm-proxies/{id}/api-keys)

func (*APIServer) CreateMCPProxy

func (s *APIServer) CreateMCPProxy(c *gin.Context)

CreateMCPProxy implements ServerInterface.CreateMCPProxy (POST /mcp-proxies)

func (*APIServer) CreateSecret

func (s *APIServer) CreateSecret(c *gin.Context)

CreateSecret handles POST /secrets

func (*APIServer) CreateSubscription

func (s *APIServer) CreateSubscription(c *gin.Context)

CreateSubscription implements ServerInterface.CreateSubscription (POST /subscriptions)

func (*APIServer) CreateSubscriptionPlan

func (s *APIServer) CreateSubscriptionPlan(c *gin.Context)

CreateSubscriptionPlan implements ServerInterface.CreateSubscriptionPlan (POST /subscription-plans)

func (*APIServer) CreateWebBrokerAPIKey

func (s *APIServer) CreateWebBrokerAPIKey(c *gin.Context, id string)

CreateWebBrokerAPIKey implements ServerInterface.CreateWebBrokerAPIKey (POST /webbroker-apis/{id}/api-keys)

func (*APIServer) CreateWebBrokerApi

func (s *APIServer) CreateWebBrokerApi(c *gin.Context)

CreateWebBrokerApi handles POST /webbroker-apis

func (*APIServer) CreateWebSubAPI

func (s *APIServer) CreateWebSubAPI(c *gin.Context)

CreateWebSubAPI implements ServerInterface.CreateWebSubAPI (POST /websub-apis)

func (*APIServer) CreateWebSubAPIKey

func (s *APIServer) CreateWebSubAPIKey(c *gin.Context, id string)

CreateWebSubAPIKey implements ServerInterface.CreateWebSubAPIKey (POST /websub-apis/{id}/api-keys)

func (*APIServer) DeleteCertificate

func (s *APIServer) DeleteCertificate(c *gin.Context, id string)

DeleteCertificate deletes a certificate by ID DELETE /certificates/:id

func (*APIServer) DeleteLLMProvider

func (s *APIServer) DeleteLLMProvider(c *gin.Context, id string)

DeleteLLMProvider implements ServerInterface.DeleteLLMProvider (DELETE /llm-providers/{id})

func (*APIServer) DeleteLLMProviderTemplate

func (s *APIServer) DeleteLLMProviderTemplate(c *gin.Context, id string)

DeleteLLMProviderTemplate implements ServerInterface.DeleteLLMProviderTemplate (DELETE /llm-provider-templates/{id})

func (*APIServer) DeleteLLMProxy

func (s *APIServer) DeleteLLMProxy(c *gin.Context, id string)

DeleteLLMProxy implements ServerInterface.DeleteLLMProxy (DELETE /llm-proxies/{id})

func (*APIServer) DeleteMCPProxy

func (s *APIServer) DeleteMCPProxy(c *gin.Context, id string)

DeleteMCPProxy implements ServerInterface.DeleteMCPProxy (DELETE /mcp-proxies/{handle})

func (*APIServer) DeleteSecret

func (s *APIServer) DeleteSecret(c *gin.Context, id string)

DeleteSecret handles DELETE /secrets/{id}

func (*APIServer) DeleteSubscription

func (s *APIServer) DeleteSubscription(c *gin.Context, subscriptionId string)

DeleteSubscription implements ServerInterface.DeleteSubscription (DELETE /subscriptions/{subscriptionId})

func (*APIServer) DeleteSubscriptionPlan

func (s *APIServer) DeleteSubscriptionPlan(c *gin.Context, planId string)

DeleteSubscriptionPlan implements ServerInterface.DeleteSubscriptionPlan (DELETE /subscription-plans/{planId})

func (*APIServer) DeleteWebBrokerApiById

func (s *APIServer) DeleteWebBrokerApiById(c *gin.Context, id string)

DeleteWebBrokerApiById handles DELETE /webbroker-apis/{id}

func (*APIServer) DeleteWebSubAPI

func (s *APIServer) DeleteWebSubAPI(c *gin.Context, id string)

DeleteWebSubAPI implements ServerInterface.DeleteWebSubAPI (DELETE /websub-apis/{id})

func (*APIServer) GetAPIByNameVersion

func (s *APIServer) GetAPIByNameVersion(c *gin.Context, name string, version string)

GetAPIByNameVersion implements ServerInterface.GetAPIByNameVersion (GET /apis/{name}/{version})

func (*APIServer) GetConfigDump

func (s *APIServer) GetConfigDump(c *gin.Context)

GetConfigDump implements the GET /config_dump endpoint

func (*APIServer) GetLLMProviderById

func (s *APIServer) GetLLMProviderById(c *gin.Context, id string)

GetLLMProviderById implements ServerInterface.GetLLMProviderById (GET /llm-providers/{id})

func (*APIServer) GetLLMProviderTemplateById

func (s *APIServer) GetLLMProviderTemplateById(c *gin.Context, id string)

GetLLMProviderTemplateById implements ServerInterface.GetLLMProviderTemplateById (GET /llm-provider-templates/{id})

func (*APIServer) GetLLMProxyById

func (s *APIServer) GetLLMProxyById(c *gin.Context, id string)

GetLLMProxyById implements ServerInterface.GetLLMProxyById (GET /llm-proxies/{id})

func (*APIServer) GetMCPProxyById

func (s *APIServer) GetMCPProxyById(c *gin.Context, id string)

GetMCPProxyById implements ServerInterface.GetMCPProxyById (GET /mcp-proxies/{id})

func (*APIServer) GetSecret

func (s *APIServer) GetSecret(c *gin.Context, id string)

GetSecret handles GET /secrets/{id}

func (*APIServer) GetSubscription

func (s *APIServer) GetSubscription(c *gin.Context, subscriptionId string)

GetSubscription implements ServerInterface.GetSubscription (GET /subscriptions/{subscriptionId})

func (*APIServer) GetSubscriptionPlan

func (s *APIServer) GetSubscriptionPlan(c *gin.Context, planId string)

GetSubscriptionPlan implements ServerInterface.GetSubscriptionPlan (GET /subscription-plans/{planId})

func (*APIServer) GetWebBrokerApiById

func (s *APIServer) GetWebBrokerApiById(c *gin.Context, id string)

GetWebBrokerApiById handles GET /webbroker-apis/{id}

func (*APIServer) GetWebSubAPIById

func (s *APIServer) GetWebSubAPIById(c *gin.Context, id string)

GetWebSubAPIById implements ServerInterface.GetWebSubAPIById (GET /websub-apis/{id})

func (*APIServer) GetXDSSyncStatus

func (s *APIServer) GetXDSSyncStatus(c *gin.Context)

GetXDSSyncStatus implements the GET /xds_sync_status endpoint.

func (*APIServer) GetXDSSyncStatusResponse

func (s *APIServer) GetXDSSyncStatusResponse() adminapi.XDSSyncStatusResponse

GetXDSSyncStatusResponse builds the xDS sync status response payload.

func (*APIServer) ListAPIKeys

func (s *APIServer) ListAPIKeys(c *gin.Context, id string)

ListAPIKeys implements ServerInterface.ListAPIKeys (GET /apis/{id}/api-keys)

func (*APIServer) ListCertificates

func (s *APIServer) ListCertificates(c *gin.Context)

ListCertificates lists all custom certificates GET /certificates

func (*APIServer) ListLLMProviderAPIKeys

func (s *APIServer) ListLLMProviderAPIKeys(c *gin.Context, id string)

ListLLMProviderAPIKeys implements ServerInterface.ListLLMProviderAPIKeys (GET /llm-providers/{id}/api-keys)

func (*APIServer) ListLLMProviderTemplates

func (s *APIServer) ListLLMProviderTemplates(c *gin.Context, params api.ListLLMProviderTemplatesParams)

ListLLMProviderTemplates implements ServerInterface.ListLLMProviderTemplates (GET /llm-providers/templates)

func (*APIServer) ListLLMProviders

func (s *APIServer) ListLLMProviders(c *gin.Context, params api.ListLLMProvidersParams)

ListLLMProviders implements ServerInterface.ListLLMProviders (GET /llm-providers)

func (*APIServer) ListLLMProxies

func (s *APIServer) ListLLMProxies(c *gin.Context, params api.ListLLMProxiesParams)

ListLLMProxies implements ServerInterface.ListLLMProxies (GET /llm-proxies)

func (*APIServer) ListLLMProxyAPIKeys

func (s *APIServer) ListLLMProxyAPIKeys(c *gin.Context, id string)

ListLLMProxyAPIKeys implements ServerInterface.ListLLMProxyAPIKeys (GET /llm-proxies/{id}/api-keys)

func (*APIServer) ListMCPProxies

func (s *APIServer) ListMCPProxies(c *gin.Context, params api.ListMCPProxiesParams)

ListMCPProxies implements ServerInterface.ListMCPProxies (GET /mcp-proxies)

func (*APIServer) ListSecrets

func (s *APIServer) ListSecrets(c *gin.Context)

ListSecrets implements ServerInterface.ListSecrets (GET /secrets)

func (*APIServer) ListSubscriptionPlans

func (s *APIServer) ListSubscriptionPlans(c *gin.Context)

ListSubscriptionPlans implements ServerInterface.ListSubscriptionPlans (GET /subscription-plans)

func (*APIServer) ListSubscriptions

func (s *APIServer) ListSubscriptions(c *gin.Context, params api.ListSubscriptionsParams)

ListSubscriptions implements ServerInterface.ListSubscriptions (GET /subscriptions)

func (*APIServer) ListWebBrokerAPIKeys

func (s *APIServer) ListWebBrokerAPIKeys(c *gin.Context, id string)

ListWebBrokerAPIKeys implements ServerInterface.ListWebBrokerAPIKeys (GET /webbroker-apis/{id}/api-keys)

func (*APIServer) ListWebBrokerApis

func (s *APIServer) ListWebBrokerApis(c *gin.Context, params api.ListWebBrokerApisParams)

ListWebBrokerApis handles GET /webbroker-apis

func (*APIServer) ListWebSubAPIKeys

func (s *APIServer) ListWebSubAPIKeys(c *gin.Context, id string)

ListWebSubAPIKeys implements ServerInterface.ListWebSubAPIKeys (GET /websub-apis/{id}/api-keys)

func (*APIServer) ListWebSubAPIs

func (s *APIServer) ListWebSubAPIs(c *gin.Context, params api.ListWebSubAPIsParams)

ListWebSubAPIs implements ServerInterface.ListWebSubAPIs (GET /websub-apis)

func (*APIServer) RegenerateAPIKey

func (s *APIServer) RegenerateAPIKey(c *gin.Context, id string, apiKeyName string)

RegenerateAPIKey implements ServerInterface.RegenerateAPIKey (POST /apis/{id}/api-keys/{apiKeyName}/regenerate)

func (*APIServer) RegenerateLLMProviderAPIKey

func (s *APIServer) RegenerateLLMProviderAPIKey(c *gin.Context, id string, apiKeyName string)

RegenerateLLMProviderAPIKey implements ServerInterface.RegenerateLLMProviderAPIKey (POST /llm-providers/{id}/api-keys/{apiKeyName}/regenerate)

func (*APIServer) RegenerateLLMProxyAPIKey

func (s *APIServer) RegenerateLLMProxyAPIKey(c *gin.Context, id string, apiKeyName string)

RegenerateLLMProxyAPIKey implements ServerInterface.RegenerateLLMProxyAPIKey (POST /llm-proxies/{id}/api-keys/{apiKeyName}/regenerate)

func (*APIServer) RegenerateWebBrokerAPIKey

func (s *APIServer) RegenerateWebBrokerAPIKey(c *gin.Context, id string, apiKeyName string)

RegenerateWebBrokerAPIKey implements ServerInterface.RegenerateWebBrokerAPIKey (POST /webbroker-apis/{id}/api-keys/{apiKeyName}/regenerate)

func (*APIServer) RegenerateWebSubAPIKey

func (s *APIServer) RegenerateWebSubAPIKey(c *gin.Context, id string, apiKeyName string)

RegenerateWebSubAPIKey implements ServerInterface.RegenerateWebSubAPIKey (POST /websub-apis/{id}/api-keys/{apiKeyName}/regenerate)

func (*APIServer) ReloadCertificates

func (s *APIServer) ReloadCertificates(c *gin.Context)

ReloadCertificates manually triggers certificate reload and SDS update POST /certificates/reload

func (*APIServer) RevokeAPIKey

func (s *APIServer) RevokeAPIKey(c *gin.Context, id string, apiKeyName string)

RevokeAPIKey implements ServerInterface.RevokeAPIKey (DELETE /apis/{id}/api-keys/{apiKeyName})

func (*APIServer) RevokeLLMProviderAPIKey

func (s *APIServer) RevokeLLMProviderAPIKey(c *gin.Context, id string, apiKeyName string)

RevokeLLMProviderAPIKey implements ServerInterface.RevokeLLMProviderAPIKey (DELETE /llm-providers/{id}/api-keys/{apiKeyName})

func (*APIServer) RevokeLLMProxyAPIKey

func (s *APIServer) RevokeLLMProxyAPIKey(c *gin.Context, id string, apiKeyName string)

RevokeLLMProxyAPIKey implements ServerInterface.RevokeLLMProxyAPIKey (DELETE /llm-proxies/{id}/api-keys/{apiKeyName})

func (*APIServer) RevokeWebBrokerAPIKey

func (s *APIServer) RevokeWebBrokerAPIKey(c *gin.Context, id string, apiKeyName string)

RevokeWebBrokerAPIKey implements ServerInterface.RevokeWebBrokerAPIKey (DELETE /webbroker-apis/{id}/api-keys/{apiKeyName})

func (*APIServer) RevokeWebSubAPIKey

func (s *APIServer) RevokeWebSubAPIKey(c *gin.Context, id string, apiKeyName string)

RevokeWebSubAPIKey implements ServerInterface.RevokeWebSubAPIKey (DELETE /websub-apis/{id}/api-keys/{apiKeyName})

func (*APIServer) SearchDeployments

func (s *APIServer) SearchDeployments(c *gin.Context, kind string)

func (*APIServer) UpdateAPIKey

func (s *APIServer) UpdateAPIKey(c *gin.Context, id string, apiKeyName string)

UpdateAPIKey implements ServerInterface.UpdateAPIKey (PUT /apis/{id}/api-keys/{apiKeyName})

func (*APIServer) UpdateLLMProvider

func (s *APIServer) UpdateLLMProvider(c *gin.Context, id string)

UpdateLLMProvider implements ServerInterface.UpdateLLMProvider (PUT /llm-providers/{id})

func (*APIServer) UpdateLLMProviderAPIKey

func (s *APIServer) UpdateLLMProviderAPIKey(c *gin.Context, id string, apiKeyName string)

UpdateLLMProviderAPIKey implements ServerInterface.UpdateLLMProviderAPIKey (PUT /llm-providers/{id}/api-keys/{apiKeyName})

func (*APIServer) UpdateLLMProviderTemplate

func (s *APIServer) UpdateLLMProviderTemplate(c *gin.Context, id string)

UpdateLLMProviderTemplate implements ServerInterface.UpdateLLMProviderTemplate (PUT /llm-provider-templates/{id})

func (*APIServer) UpdateLLMProxy

func (s *APIServer) UpdateLLMProxy(c *gin.Context, id string)

UpdateLLMProxy implements ServerInterface.UpdateLLMProxy (PUT /llm-proxies/{id})

func (*APIServer) UpdateLLMProxyAPIKey

func (s *APIServer) UpdateLLMProxyAPIKey(c *gin.Context, id string, apiKeyName string)

UpdateLLMProxyAPIKey implements ServerInterface.UpdateLLMProxyAPIKey (PUT /llm-proxies/{id}/api-keys/{apiKeyName})

func (*APIServer) UpdateMCPProxy

func (s *APIServer) UpdateMCPProxy(c *gin.Context, id string)

UpdateMCPProxy implements ServerInterface.UpdateMCPProxy (PUT /mcp-proxies/{handle})

func (*APIServer) UpdateSecret

func (s *APIServer) UpdateSecret(c *gin.Context, id string)

UpdateSecret handles PUT /secrets/{id}

func (*APIServer) UpdateSubscription

func (s *APIServer) UpdateSubscription(c *gin.Context, subscriptionId string)

UpdateSubscription implements ServerInterface.UpdateSubscription (PUT /subscriptions/{subscriptionId})

func (*APIServer) UpdateSubscriptionPlan

func (s *APIServer) UpdateSubscriptionPlan(c *gin.Context, planId string)

UpdateSubscriptionPlan implements ServerInterface.UpdateSubscriptionPlan (PUT /subscription-plans/{planId})

func (*APIServer) UpdateWebBrokerAPIKey

func (s *APIServer) UpdateWebBrokerAPIKey(c *gin.Context, id string, apiKeyName string)

UpdateWebBrokerAPIKey implements ServerInterface.UpdateWebBrokerAPIKey (PUT /webbroker-apis/{id}/api-keys/{apiKeyName})

func (*APIServer) UpdateWebSubAPI

func (s *APIServer) UpdateWebSubAPI(c *gin.Context, id string)

UpdateWebSubAPI implements ServerInterface.UpdateWebSubAPI (PUT /websub-apis/{id})

func (*APIServer) UpdateWebSubAPIKey

func (s *APIServer) UpdateWebSubAPIKey(c *gin.Context, id string, apiKeyName string)

UpdateWebSubAPIKey implements ServerInterface.UpdateWebSubAPIKey (PUT /websub-apis/{id}/api-keys/{apiKeyName})

func (*APIServer) UploadCertificate

func (s *APIServer) UploadCertificate(c *gin.Context)

UploadCertificate handles certificate upload via REST API POST /certificates

type CertificateResponse

type CertificateResponse struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Subject  string `json:"subject,omitempty"`
	Issuer   string `json:"issuer,omitempty"`
	NotAfter string `json:"notAfter,omitempty"`
	Count    int    `json:"count"` // Number of certs in file
	Message  string `json:"message,omitempty"`
	Status   string `json:"status"` // success, error
}

CertificateResponse represents a certificate information response

type ListCertificatesResponse

type ListCertificatesResponse struct {
	Certificates []CertificateResponse `json:"certificates"`
	TotalCount   int                   `json:"totalCount"`
	TotalBytes   int                   `json:"totalBytes"`
	Status       string                `json:"status"`
}

ListCertificatesResponse represents the response for listing certificates

type RestAPIHandler

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

RestAPIHandler handles HTTP requests for REST API CRUD operations.

func NewRestAPIHandler

func NewRestAPIHandler(service *restapi.RestAPIService, logger *slog.Logger) *RestAPIHandler

NewRestAPIHandler creates a new RestAPIHandler.

func (*RestAPIHandler) CreateRestAPI

func (h *RestAPIHandler) CreateRestAPI(c *gin.Context)

CreateRestAPI implements ServerInterface.CreateRestAPI (POST /rest-apis)

func (*RestAPIHandler) DeleteRestAPI

func (h *RestAPIHandler) DeleteRestAPI(c *gin.Context, id string)

DeleteRestAPI implements ServerInterface.DeleteRestAPI (DELETE /rest-apis/{id})

func (*RestAPIHandler) GetRestAPIById

func (h *RestAPIHandler) GetRestAPIById(c *gin.Context, id string)

GetRestAPIById implements ServerInterface.GetRestAPIById (GET /rest-apis/{id})

func (*RestAPIHandler) ListRestAPIs

func (h *RestAPIHandler) ListRestAPIs(c *gin.Context, params api.ListRestAPIsParams)

ListRestAPIs implements ServerInterface.ListRestAPIs (GET /rest-apis)

func (*RestAPIHandler) UpdateRestAPI

func (h *RestAPIHandler) UpdateRestAPI(c *gin.Context, id string)

UpdateRestAPI implements ServerInterface.UpdateRestAPI (PUT /rest-apis/{id})

type UploadCertificateRequest

type UploadCertificateRequest struct {
	Certificate string `json:"certificate" binding:"required"` // PEM-encoded certificate
	Name        string `json:"name" binding:"required"`        // Unique certificate name
}

UploadCertificateRequest represents the request body for certificate upload

Jump to

Keyboard shortcuts

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