handler

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditSink

type AuditSink interface {
	Log(ctx context.Context, entry audit.AuditEntry) error
}

AuditSink 는 감사 기록을 받는 쪽이다.

구현체(*audit.AuditLogger)가 아니라 동작에 의존한다. 설정 변경은 "누가 무엇을 바꿨나" 가 기능의 일부라서 무엇이 기록되는지를 테스트가 직접 확인해야 하는데, 구현체는 DB 풀을 요구해 그럴 수 없다.

type CompatibilityHandler

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

CompatibilityHandler handles HTTP requests for compatibility matrix operations.

func NewCompatibilityHandler

func NewCompatibilityHandler(
	compatRepo port.CompatibilityRepository,
	validateCompatibility *usecase.ValidateCompatibility,
	opts ...CompatibilityHandlerOption,
) *CompatibilityHandler

NewCompatibilityHandler constructs a CompatibilityHandler.

func (*CompatibilityHandler) CreateMatrix

func (h *CompatibilityHandler) CreateMatrix(c echo.Context) error

CreateMatrix handles POST /admin/compatibility/matrices.

func (*CompatibilityHandler) DeleteMatrix

func (h *CompatibilityHandler) DeleteMatrix(c echo.Context) error

DeleteMatrix handles DELETE /admin/compatibility/matrices/:id.

func (*CompatibilityHandler) GetMatrix

func (h *CompatibilityHandler) GetMatrix(c echo.Context) error

GetMatrix handles GET /api/v1/compatibility/matrix.

func (*CompatibilityHandler) RegisterAdminRoutes

func (h *CompatibilityHandler) RegisterAdminRoutes(g *echo.Group)

RegisterAdminRoutes adds the admin CRUD endpoints for compatibility matrices. F8-Phase5 (재개): no-op when ManageCompatibility was not wired via WithManageCompatibility.

func (*CompatibilityHandler) RegisterRoutes

func (h *CompatibilityHandler) RegisterRoutes(g *echo.Group)

RegisterRoutes registers compatibility routes on the given Echo group.

POST /:stackId/validate is the canonical per-stack validate endpoint. When the request body omits stack_id / tools, the handler infers stack_id from the path parameter and lets ValidateCompatibility run in persisted mode.

func (*CompatibilityHandler) UpdateMatrix

func (h *CompatibilityHandler) UpdateMatrix(c echo.Context) error

UpdateMatrix handles PUT /admin/compatibility/matrices/:id.

func (*CompatibilityHandler) Validate

func (h *CompatibilityHandler) Validate(c echo.Context) error

Validate handles POST /api/v1/stacks/:stackId/validate.

type CompatibilityHandlerOption

type CompatibilityHandlerOption func(*CompatibilityHandler)

CompatibilityHandlerOption configures optional CRUD/audit integration.

func WithCompatibilityAuditSink

func WithCompatibilityAuditSink(s audit.Sink) CompatibilityHandlerOption

WithCompatibilityAuditSink attaches an audit.Sink so Create/Update/Delete calls emit audit entries. Optional — nil sinks are silently skipped.

func WithManageCompatibility

func WithManageCompatibility(u *usecase.ManageCompatibility) CompatibilityHandlerOption

WithManageCompatibility enables the admin CRUD routes registered by RegisterAdminRoutes. Without this option, only the public read + validate routes are registered.

type DeployHandler

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

DeployHandler handles HTTP and WebSocket requests for stack deployments.

func NewDeployHandler

func NewDeployHandler(
	installStack *usecase.InstallStack,
	stackRepo port.StackRepository,
	streamer port.LogStreamer,
	auditLogger ...audit.Sink,
) *DeployHandler

NewDeployHandler constructs a DeployHandler. The audit logger is variadic for backward compatibility with existing call sites; any DeployHandlerOption values passed via the same variadic slot are applied.

Extra callers passing *audit.AuditLogger or any audit.Sink keep the old positional behavior. Callers that also want to inject the compatibility gate should use WithValidateCompatibility via WithOptions.

func (*DeployHandler) Continue

func (h *DeployHandler) Continue(c echo.Context) error

Continue handles POST /api/v1/stacks/:id/continue. It resumes a failed deployment without invoking rollback. Previously installed resources are left in place; Helm install will upgrade/reuse existing releases where possible and continue with the same stack config.

func (*DeployHandler) Deploy

func (h *DeployHandler) Deploy(c echo.Context) error

Deploy handles POST /api/v1/stacks/:id/deploy. It starts the installation asynchronously and returns 202 Accepted.

F8-F3 adds a server-side Pre-Deploy Gate: when the compatibility use case is wired, the handler re-runs validation in persisted mode against stack.Tools + stack.ClusterID before kicking off install. `fail` blocks with DEPLOY_COMPAT_FAIL; `warn` blocks with DEPLOY_COMPAT_WARN_UNACK unless the request body explicitly sets acknowledge_warnings=true.

func (*DeployHandler) RegisterRoutes

func (h *DeployHandler) RegisterRoutes(stacks *echo.Group, e *echo.Echo, wsMiddleware ...echo.MiddlewareFunc)

RegisterRoutes registers deployment routes.

stacks 는 **인증·권한 미들웨어가 이미 붙은** 그룹이어야 한다. 예전에는 v1 을 받아 이 함수가 `v1.Group("/stacks")` 를 새로 만들었는데, 그러면 경로만 같을 뿐 다른 그룹이라 main.go 가 stacks 그룹에 붙여 둔 인증 체인을 타지 않았다 — 배포·재시도가 인증 없이 열려 있었다.

wsMiddleware 는 /ws/* 에만 적용한다. WebSocket 은 Echo 그룹 밖(루트)에 달려야 하고, 브라우저가 헤더를 못 붙이는 제약 때문에 자격증명 전달 방식도 HTTP 와 다르다.

func (*DeployHandler) Retry

func (h *DeployHandler) Retry(c echo.Context) error

Retry handles POST /api/v1/stacks/:id/retry. Phase 3 of the F8 follow-up: transitions a stack from `failed` / `rolled_back` back to `pending` and re-runs the Pre-Deploy Gate + InstallStack, mirroring the Deploy flow. Other states return 409 STACK_RETRY_INVALID_STATE.

func (*DeployHandler) Status

func (h *DeployHandler) Status(c echo.Context) error

Status handles GET /api/v1/stacks/:id/status.

func (*DeployHandler) StreamLogs

func (h *DeployHandler) StreamLogs(c echo.Context) error

func (*DeployHandler) StreamPods

func (h *DeployHandler) StreamPods(c echo.Context) error

func (*DeployHandler) WithOptions

func (h *DeployHandler) WithOptions(opts ...DeployHandlerOption) *DeployHandler

WithOptions applies DeployHandlerOption values after construction. Kept as a separate step so the original NewDeployHandler signature stays backward-compatible (auditLogger positional variadic).

type DeployHandlerOption

type DeployHandlerOption func(*DeployHandler)

DeployHandlerOption configures optional dependencies on DeployHandler.

func WithKubeconfigProvider

func WithKubeconfigProvider(provider port.KubeconfigProvider) DeployHandlerOption

func WithManageHistory

func WithManageHistory(manageHistory *usecase.ManageHistory) DeployHandlerOption

WithManageHistory snapshots stack config before deploy/retry/continue starts.

func WithValidateCompatibility

func WithValidateCompatibility(uc *usecase.ValidateCompatibility) DeployHandlerOption

WithValidateCompatibility wires the server-side Pre-Deploy Gate. When set, Deploy() runs ValidateCompatibility in persisted mode before kicking off install, blocking `fail` verdicts and `warn` without an explicit ack.

type ExportHandler

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

ExportHandler handles stack configuration export requests.

func NewExportHandler

func NewExportHandler(exportConfig *usecase.ExportConfig, importConfig *usecase.ImportConfig) *ExportHandler

NewExportHandler constructs an ExportHandler.

func (*ExportHandler) ExportStack

func (h *ExportHandler) ExportStack(c echo.Context) error

ExportStack handles GET /api/v1/stacks/:id/export?format=json|yaml.

func (*ExportHandler) ImportStack

func (h *ExportHandler) ImportStack(c echo.Context) error

ImportStack handles POST /api/v1/stacks/import.

func (*ExportHandler) PreviewImport

func (h *ExportHandler) PreviewImport(c echo.Context) error

PreviewImport handles POST /api/v1/stacks/import/preview.

func (*ExportHandler) RegisterRoutes

func (h *ExportHandler) RegisterRoutes(g *echo.Group)

RegisterRoutes registers export routes on the given Echo group.

type HistoryHandler

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

HistoryHandler handles HTTP requests for stack version history operations.

func NewHistoryHandler

func NewHistoryHandler(
	historyRepo port.HistoryRepository,
	stackRepo port.StackRepository,
	manageHistory *usecase.ManageHistory,
) *HistoryHandler

NewHistoryHandler constructs a HistoryHandler.

func (*HistoryHandler) GetDiff

func (h *HistoryHandler) GetDiff(c echo.Context) error

func (*HistoryHandler) GetVersionsDiff

func (h *HistoryHandler) GetVersionsDiff(c echo.Context) error

func (*HistoryHandler) ListHistory

func (h *HistoryHandler) ListHistory(c echo.Context) error

ListHistory handles GET /api/v1/stacks/:id/history.

func (*HistoryHandler) RegisterRoutes

func (h *HistoryHandler) RegisterRoutes(g *echo.Group)

RegisterRoutes registers history routes on the given Echo group.

func (*HistoryHandler) Rollback

func (h *HistoryHandler) Rollback(c echo.Context) error

type ReleaseValuesHandler

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

ReleaseValuesHandler 는 배포된 스택의 OSS 설정(Helm values)을 편집하는 API 다.

func NewReleaseValuesHandler

func NewReleaseValuesHandler(manageValues *usecase.ManageReleaseValues, auditSink AuditSink) *ReleaseValuesHandler

NewReleaseValuesHandler 는 핸들러를 조립한다. auditSink 는 없어도 된다.

func (*ReleaseValuesHandler) ApplyValues

func (h *ReleaseValuesHandler) ApplyValues(c echo.Context) error

func (*ReleaseValuesHandler) GetValues

func (h *ReleaseValuesHandler) GetValues(c echo.Context) error

func (*ReleaseValuesHandler) ListReleases

func (h *ReleaseValuesHandler) ListReleases(c echo.Context) error

func (*ReleaseValuesHandler) PreviewValues

func (h *ReleaseValuesHandler) PreviewValues(c echo.Context) error

func (*ReleaseValuesHandler) RegisterRoutes

func (h *ReleaseValuesHandler) RegisterRoutes(g *echo.Group)

RegisterRoutes 는 stacks 그룹에 라우트를 붙인다.

type ResourceHandler

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

ResourceHandler handles HTTP requests for resource estimation.

func NewResourceHandler

func NewResourceHandler(
	calculateResources *usecase.CalculateResources,
	listDefaultsUC *usecase.ListResourceDefaults,
	upsertResourceUC *usecase.UpsertResourceDefault,
) *ResourceHandler

NewResourceHandler constructs a ResourceHandler.

func (*ResourceHandler) Estimate

func (h *ResourceHandler) Estimate(c echo.Context) error

Estimate handles POST /api/v1/resources/estimate.

func (*ResourceHandler) ListResourceDefaults

func (h *ResourceHandler) ListResourceDefaults(c echo.Context) error

func (*ResourceHandler) RegisterRoutes

func (h *ResourceHandler) RegisterRoutes(g *echo.Group)

RegisterRoutes registers resource routes on the given Echo group.

func (*ResourceHandler) UpsertResourceDefault

func (h *ResourceHandler) UpsertResourceDefault(c echo.Context) error

type RetryHistoryHandler

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

RetryHistoryHandler serves GET /api/v1/stacks/:id/retry-history. It reads audit events via audit.Reader (F8-UIUX-RetryAuditSurface) and returns only the ones emitted by the Retry handler, mapping the payload fields that the frontend panel consumes.

func NewRetryHistoryHandler

func NewRetryHistoryHandler(reader audit.Reader) *RetryHistoryHandler

NewRetryHistoryHandler wires the audit Reader that backs the endpoint.

func (*RetryHistoryHandler) GetRetryHistory

func (h *RetryHistoryHandler) GetRetryHistory(c echo.Context) error

GetRetryHistory returns the retry audit entries for the given stack id. Missing stacks yield a 200 with an empty items slice — consistent with the rest of the stack list surface and friendlier to eventual-consistency UI flows than a 404.

func (*RetryHistoryHandler) RegisterRoutes

func (h *RetryHistoryHandler) RegisterRoutes(stacks *echo.Group)

RegisterRoutes attaches the retry-history endpoint to the stacks group. Mirrors the convention of every other stack handler in this package.

type StackHandler

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

StackHandler handles HTTP requests for stack operations.

func NewStackHandler

func NewStackHandler(
	createStack *usecase.CreateStack,
	listStacks *usecase.ListStacks,
	deleteStack *usecase.DeleteStack,
	addToolsUC *usecase.AddToolsUseCase,
	stackRepo port.StackRepository,
	auditLogger *audit.AuditLogger,
	opts ...StackHandlerOption,
) *StackHandler

NewStackHandler constructs a StackHandler.

func (*StackHandler) AddTools

func (h *StackHandler) AddTools(c echo.Context) error

func (*StackHandler) CreateStack

func (h *StackHandler) CreateStack(c echo.Context) error

CreateStack handles POST /api/v1/stacks.

func (*StackHandler) DeleteStack

func (h *StackHandler) DeleteStack(c echo.Context) error

func (*StackHandler) GetConnectionInfo

func (h *StackHandler) GetConnectionInfo(c echo.Context) error

GetConnectionInfo handles GET /api/v1/stacks/:stackId/connection-info.

접속에 필요한 이름(Secret, 키, 엔드포인트)을 서버가 확정해 내려준다. 화면이 같은 값을 다시 조립하면 설치 경로와 규칙이 갈리는 순간 조용히 어긋나고, 존재하지 않는 리소스를 안내하게 된다.

func (*StackHandler) GetIntegrations

func (h *StackHandler) GetIntegrations(c echo.Context) error

func (*StackHandler) GetStack

func (h *StackHandler) GetStack(c echo.Context) error

GetStack handles GET /api/v1/stacks/:id.

func (*StackHandler) GetWorkloadLogs

func (h *StackHandler) GetWorkloadLogs(c echo.Context) error

GetWorkloadLogs handles GET /api/v1/stacks/:stackId/workloads/logs.

func (*StackHandler) GetWorkloads

func (h *StackHandler) GetWorkloads(c echo.Context) error

GetWorkloads handles GET /api/v1/stacks/:stackId/workloads.

func (*StackHandler) ListStacks

func (h *StackHandler) ListStacks(c echo.Context) error

ListStacks handles GET /api/v1/stacks.

func (*StackHandler) RegisterRoutes

func (h *StackHandler) RegisterRoutes(g *echo.Group)

RegisterRoutes registers stack routes on the given Echo group.

func (*StackHandler) SaveConfig

func (h *StackHandler) SaveConfig(c echo.Context) error

SaveConfig handles POST /api/v1/stacks/:id/config.

func (*StackHandler) SaveDraft

func (h *StackHandler) SaveDraft(c echo.Context) error

func (*StackHandler) TestStorageConnection

func (h *StackHandler) TestStorageConnection(c echo.Context) error

type StackHandlerOption

type StackHandlerOption func(*StackHandler)

StackHandlerOption configures optional StackHandler dependencies.

func WithPool

func WithPool(pool *pgxpool.Pool) StackHandlerOption

WithPool sets the database pool for cross-module queries.

func WithStackManageHistory

func WithStackManageHistory(manageHistory *usecase.ManageHistory) StackHandlerOption

WithStackManageHistory enables history snapshotting for stack config updates.

func WithWorkloadKubeconfigProvider

func WithWorkloadKubeconfigProvider(p port.KubeconfigProvider) StackHandlerOption

WithWorkloadKubeconfigProvider 는 /workloads 가 쓸 kubeconfig 공급자를 넣는다.

type StackMonitoringHandler

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

func NewStackMonitoringHandler

func NewStackMonitoringHandler(stackRepo port.StackRepository, kubeconfigProvider port.KubeconfigProvider) *StackMonitoringHandler

func (*StackMonitoringHandler) GetMonitoring

func (h *StackMonitoringHandler) GetMonitoring(c echo.Context) error

func (*StackMonitoringHandler) RegisterRoutes

func (h *StackMonitoringHandler) RegisterRoutes(g *echo.Group)

type TemplateHandler

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

TemplateHandler handles HTTP requests for Golden Path template operations.

func NewTemplateHandler

func NewTemplateHandler(
	getTemplate *usecase.GetTemplate,
	listTemplates *usecase.ListTemplates,
	templateRepo port.TemplateRepository,
) *TemplateHandler

NewTemplateHandler constructs a TemplateHandler.

func (*TemplateHandler) CreateTemplate

func (h *TemplateHandler) CreateTemplate(c echo.Context) error

func (*TemplateHandler) DeleteTemplate

func (h *TemplateHandler) DeleteTemplate(c echo.Context) error

func (*TemplateHandler) GetTemplate

func (h *TemplateHandler) GetTemplate(c echo.Context) error

GetTemplate handles GET /api/v1/templates/:id.

func (*TemplateHandler) ListTemplates

func (h *TemplateHandler) ListTemplates(c echo.Context) error

ListTemplates handles GET /api/v1/templates.

func (*TemplateHandler) RegisterRoutes

func (h *TemplateHandler) RegisterRoutes(g *echo.Group)

RegisterRoutes registers template routes on the given Echo group.

func (*TemplateHandler) UpdateTemplate

func (h *TemplateHandler) UpdateTemplate(c echo.Context) error

Jump to

Keyboard shortcuts

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