Documentation
¶
Overview ¶
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). It exists so that handler code living outside this module (an event-gateway-controller binary importing gateway-controller as a library) can reuse the same request-body binding, auth-context extraction, and control-plane push behavior as core, without duplicating it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindRequestBody ¶
BindRequestBody binds the request body based on the Content-Type header. Supports both JSON and YAML content types. Handles Content-Type headers case-insensitively and strips parameters (e.g., charset).
func ExtractAuthenticatedUser ¶
func ExtractAuthenticatedUser(w http.ResponseWriter, r *http.Request, logger *slog.Logger, operationName string, correlationID string) (*commonmodels.AuthContext, bool)
ExtractAuthenticatedUser extracts and validates the authenticated user from the request context. Returns the AuthContext object and handles error responses automatically.
Types ¶
type DeploymentPusher ¶
type DeploymentPusher struct {
Store *storage.ConfigStore
ControlPlaneClient controlplane.ControlPlaneClient
SystemConfig *config.Config
}
DeploymentPusher wraps the DP->CP (data-plane to control-plane) artifact push behavior shared by every artifact kind's create/update/delete flow.
func (*DeploymentPusher) PushArtifactUndeploy ¶
func (p *DeploymentPusher) PushArtifactUndeploy(cfg *models.StoredConfig, log *slog.Logger)
PushArtifactUndeploy pushes an undeploy notification for a deleted artifact to the control plane, if this gateway is connected and deployment sync is enabled. It only applies to gateway-originated artifacts.
func (*DeploymentPusher) WaitForDeploymentAndPush ¶
func (p *DeploymentPusher) WaitForDeploymentAndPush(configID string, correlationID string, minDeployedAt *time.Time, log *slog.Logger)
WaitForDeploymentAndPush waits for API deployment to complete and pushes it to the control plane. This is only relevant for artifacts created directly via a gateway endpoint (not from platform API).
minDeployedAt is the DeployedAt of the deployment this push was triggered for.
type EventPublisher ¶
EventPublisher wraps event-hub publication for artifact lifecycle changes.
func (*EventPublisher) PublishEvent ¶
func (p *EventPublisher) PublishEvent(eventType eventhub.EventType, action, entityID, correlationID string, logger *slog.Logger)
PublishEvent publishes a lifecycle event to the event hub so all replicas (including self) converge through the event listener sync path.