handlers

package
v0.0.0-...-d169211 Latest Latest
Warning

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

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

Documentation

Overview

Upstream credential redaction for management API responses.

An upstream `auth.value` is write-only: accepted on create/update and never returned by the management API on a read, for any role. The corresponding `value` properties in management-openapi.yaml are marked `writeOnly: true`.

These functions operate on the re-materialised configuration produced by each rematerialize*Config round-trip — a response-bound copy — never on a StoredConfig's own SourceConfiguration, which is what each replica re-renders on consumption.

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,
	httpClient *http.Client,
) (*APIServer, error)

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(w http.ResponseWriter, r *http.Request, 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(w http.ResponseWriter, r *http.Request)

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

func (*APIServer) CreateLLMProviderAPIKey

func (s *APIServer) CreateLLMProviderAPIKey(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) CreateLLMProviderTemplate

func (s *APIServer) CreateLLMProviderTemplate(w http.ResponseWriter, r *http.Request)

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

func (*APIServer) CreateLLMProxy

func (s *APIServer) CreateLLMProxy(w http.ResponseWriter, r *http.Request)

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

func (*APIServer) CreateLLMProxyAPIKey

func (s *APIServer) CreateLLMProxyAPIKey(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) CreateMCPProxy

func (s *APIServer) CreateMCPProxy(w http.ResponseWriter, r *http.Request)

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

func (*APIServer) CreateSecret

func (s *APIServer) CreateSecret(w http.ResponseWriter, r *http.Request)

CreateSecret handles POST /secrets

func (*APIServer) CreateSubscription

func (s *APIServer) CreateSubscription(w http.ResponseWriter, r *http.Request)

CreateSubscription implements ServerInterface.CreateSubscription (POST /subscriptions)

func (*APIServer) CreateSubscriptionPlan

func (s *APIServer) CreateSubscriptionPlan(w http.ResponseWriter, r *http.Request)

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

func (*APIServer) DeleteCertificate

func (s *APIServer) DeleteCertificate(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) DeleteLLMProvider

func (s *APIServer) DeleteLLMProvider(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) DeleteLLMProviderTemplate

func (s *APIServer) DeleteLLMProviderTemplate(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) DeleteLLMProxy

func (s *APIServer) DeleteLLMProxy(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) DeleteMCPProxy

func (s *APIServer) DeleteMCPProxy(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) DeleteSecret

func (s *APIServer) DeleteSecret(w http.ResponseWriter, r *http.Request, id string)

DeleteSecret handles DELETE /secrets/{id}

func (*APIServer) DeleteSubscription

func (s *APIServer) DeleteSubscription(w http.ResponseWriter, r *http.Request, subscriptionId string)

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

func (*APIServer) DeleteSubscriptionPlan

func (s *APIServer) DeleteSubscriptionPlan(w http.ResponseWriter, r *http.Request, planId string)

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

func (*APIServer) GetAPIByNameVersion

func (s *APIServer) GetAPIByNameVersion(w http.ResponseWriter, r *http.Request, name string, version string)

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

func (*APIServer) GetConfigDump

func (s *APIServer) GetConfigDump(w http.ResponseWriter, r *http.Request)

GetConfigDump implements the GET /config_dump endpoint

func (*APIServer) GetLLMProviderById

func (s *APIServer) GetLLMProviderById(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) GetLLMProviderTemplateById

func (s *APIServer) GetLLMProviderTemplateById(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) GetLLMProxyById

func (s *APIServer) GetLLMProxyById(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) GetMCPProxyById

func (s *APIServer) GetMCPProxyById(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) GetSecret

func (s *APIServer) GetSecret(w http.ResponseWriter, r *http.Request, id string)

GetSecret handles GET /secrets/{id}

func (*APIServer) GetSubscription

func (s *APIServer) GetSubscription(w http.ResponseWriter, r *http.Request, subscriptionId string)

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

func (*APIServer) GetSubscriptionPlan

func (s *APIServer) GetSubscriptionPlan(w http.ResponseWriter, r *http.Request, planId string)

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

func (*APIServer) GetXDSSyncStatus

func (s *APIServer) GetXDSSyncStatus(w http.ResponseWriter, r *http.Request)

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(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) ListCertificates

func (s *APIServer) ListCertificates(w http.ResponseWriter, r *http.Request)

ListCertificates lists all custom certificates GET /certificates

func (*APIServer) ListLLMProviderAPIKeys

func (s *APIServer) ListLLMProviderAPIKeys(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) ListLLMProviderTemplates

func (s *APIServer) ListLLMProviderTemplates(w http.ResponseWriter, r *http.Request, params api.ListLLMProviderTemplatesParams)

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

func (*APIServer) ListLLMProviders

func (s *APIServer) ListLLMProviders(w http.ResponseWriter, r *http.Request, params api.ListLLMProvidersParams)

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

func (*APIServer) ListLLMProxies

func (s *APIServer) ListLLMProxies(w http.ResponseWriter, r *http.Request, params api.ListLLMProxiesParams)

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

func (*APIServer) ListLLMProxyAPIKeys

func (s *APIServer) ListLLMProxyAPIKeys(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) ListMCPProxies

func (s *APIServer) ListMCPProxies(w http.ResponseWriter, r *http.Request, params api.ListMCPProxiesParams)

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

func (*APIServer) ListSecrets

func (s *APIServer) ListSecrets(w http.ResponseWriter, r *http.Request)

ListSecrets implements ServerInterface.ListSecrets (GET /secrets)

func (*APIServer) ListSubscriptionPlans

func (s *APIServer) ListSubscriptionPlans(w http.ResponseWriter, r *http.Request)

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

func (*APIServer) ListSubscriptions

func (s *APIServer) ListSubscriptions(w http.ResponseWriter, r *http.Request, params api.ListSubscriptionsParams)

ListSubscriptions implements ServerInterface.ListSubscriptions (GET /subscriptions)

func (*APIServer) RegenerateAPIKey

func (s *APIServer) RegenerateAPIKey(w http.ResponseWriter, r *http.Request, id string, apiKeyName string)

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

func (*APIServer) RegenerateLLMProviderAPIKey

func (s *APIServer) RegenerateLLMProviderAPIKey(w http.ResponseWriter, r *http.Request, id string, apiKeyName string)

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

func (*APIServer) RegenerateLLMProxyAPIKey

func (s *APIServer) RegenerateLLMProxyAPIKey(w http.ResponseWriter, r *http.Request, id string, apiKeyName string)

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

func (*APIServer) ReloadCertificates

func (s *APIServer) ReloadCertificates(w http.ResponseWriter, r *http.Request)

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

func (*APIServer) RevokeAPIKey

func (s *APIServer) RevokeAPIKey(w http.ResponseWriter, r *http.Request, id string, apiKeyName string)

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

func (*APIServer) RevokeLLMProviderAPIKey

func (s *APIServer) RevokeLLMProviderAPIKey(w http.ResponseWriter, r *http.Request, id string, apiKeyName string)

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

func (*APIServer) RevokeLLMProxyAPIKey

func (s *APIServer) RevokeLLMProxyAPIKey(w http.ResponseWriter, r *http.Request, id string, apiKeyName string)

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

func (*APIServer) SearchDeployments

func (s *APIServer) SearchDeployments(w http.ResponseWriter, r *http.Request, kind string)

func (*APIServer) UpdateAPIKey

func (s *APIServer) UpdateAPIKey(w http.ResponseWriter, r *http.Request, id string, apiKeyName string)

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

func (*APIServer) UpdateLLMProvider

func (s *APIServer) UpdateLLMProvider(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) UpdateLLMProviderAPIKey

func (s *APIServer) UpdateLLMProviderAPIKey(w http.ResponseWriter, r *http.Request, id string, apiKeyName string)

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

func (*APIServer) UpdateLLMProviderTemplate

func (s *APIServer) UpdateLLMProviderTemplate(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) UpdateLLMProxy

func (s *APIServer) UpdateLLMProxy(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) UpdateLLMProxyAPIKey

func (s *APIServer) UpdateLLMProxyAPIKey(w http.ResponseWriter, r *http.Request, id string, apiKeyName string)

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

func (*APIServer) UpdateMCPProxy

func (s *APIServer) UpdateMCPProxy(w http.ResponseWriter, r *http.Request, id string)

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

func (*APIServer) UpdateSecret

func (s *APIServer) UpdateSecret(w http.ResponseWriter, r *http.Request, id string)

UpdateSecret handles PUT /secrets/{id}

func (*APIServer) UpdateSubscription

func (s *APIServer) UpdateSubscription(w http.ResponseWriter, r *http.Request, subscriptionId string)

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

func (*APIServer) UpdateSubscriptionPlan

func (s *APIServer) UpdateSubscriptionPlan(w http.ResponseWriter, r *http.Request, planId string)

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

func (*APIServer) UploadCertificate

func (s *APIServer) UploadCertificate(w http.ResponseWriter, r *http.Request)

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(w http.ResponseWriter, r *http.Request)

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

func (*RestAPIHandler) DeleteRestAPI

func (h *RestAPIHandler) DeleteRestAPI(w http.ResponseWriter, r *http.Request, id string)

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

func (*RestAPIHandler) GetRestAPIById

func (h *RestAPIHandler) GetRestAPIById(w http.ResponseWriter, r *http.Request, id string)

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

func (*RestAPIHandler) ListRestAPIs

func (h *RestAPIHandler) ListRestAPIs(w http.ResponseWriter, r *http.Request, params api.ListRestAPIsParams)

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

func (*RestAPIHandler) UpdateRestAPI

func (h *RestAPIHandler) UpdateRestAPI(w http.ResponseWriter, r *http.Request, 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

Directories

Path Synopsis
Package handlerkit holds generic request-handling infrastructure shared by every gateway-controller API handler kind (REST, LLM, MCP, subscriptions, api-keys, and — in an event-gateway-controller binary — WebSub/WebBroker).
Package handlerkit holds generic request-handling infrastructure shared by every gateway-controller API handler kind (REST, LLM, MCP, subscriptions, api-keys, and — in an event-gateway-controller binary — WebSub/WebBroker).

Jump to

Keyboard shortcuts

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