handler

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package handler provides HTTP handlers for the dehydrated-api-go application. It includes handlers for domain management and configuration operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigHandler added in v0.2.0

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

ConfigHandler handles HTTP requests for Config operations

func NewConfigHandler added in v0.2.0

func NewConfigHandler(cfg *dehydrated.Config) *ConfigHandler

NewConfigHandler creates a new ConfigHandler instance

func (*ConfigHandler) Config added in v0.2.0

func (h *ConfigHandler) Config(c *fiber.Ctx) error

@Summary Get dehydrated configuration @Description Retrieve the current dehydrated configuration settings including paths, certificates, and operational parameters @Tags config @Accept json @Produce json @Security BearerAuth @Success 200 {object} model.ConfigResponse "Configuration retrieved successfully" @Failure 401 {object} model.ConfigResponse "Unauthorized - Invalid or missing authentication token" @Failure 500 {object} model.ConfigResponse "Internal Server Error - Failed to retrieve configuration" @Router /config [get]

func (*ConfigHandler) RegisterRoutes added in v0.2.0

func (h *ConfigHandler) RegisterRoutes(app *fiber.App)

RegisterRoutes registers all Config-related routes

type DomainHandler

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

DomainHandler handles HTTP requests for domain operations

func NewDomainHandler

func NewDomainHandler(service serviceinterface.DomainService) *DomainHandler

NewDomainHandler creates a new DomainHandler instance

func (*DomainHandler) CreateDomain

func (h *DomainHandler) CreateDomain(c *fiber.Ctx) error

@Summary Create a domain @Description Create a new domain entry @Tags domains @Accept json @Produce json @Security BearerAuth @Param request body model.CreateDomainRequest true "Domain creation request" @Success 201 {object} model.DomainResponse @Failure 400 {object} model.DomainResponse "Bad Request - Invalid request body or domain already exists" @Failure 401 {object} model.DomainResponse "Unauthorized - Invalid or missing authentication token" @Router /api/v1/domains [post] CreateDomain handles POST /api/v1/domains

func (*DomainHandler) DeleteDomain

func (h *DomainHandler) DeleteDomain(c *fiber.Ctx) error

@Summary Delete a domain @Description Delete a domain entry @Tags domains @Accept json @Produce json @Security BearerAuth @Param domain path string true "Domain name" @Param request body model.DeleteDomainRequest true "Domain delete request" @Success 204 "No Content" @Failure 400 {object} model.DomainResponse "Bad Request - Invalid domain parameter" @Failure 401 {object} model.DomainResponse "Unauthorized - Invalid or missing authentication token" @Failure 404 {object} model.DomainResponse "Not Found - Domain not found" @Router /api/v1/domains/{domain} [delete] DeleteDomain handles DELETE /api/v1/domains/:domain

func (*DomainHandler) GetDomain

func (h *DomainHandler) GetDomain(c *fiber.Ctx) error

@Summary Get a domain @Description Get details of a specific domain @Tags domains @Produce json @Security BearerAuth @Param domain path string true "Domain name" @Param alias query string false "Optional alias to uniquely identify the domain entry" @Success 200 {object} model.DomainResponse @Failure 400 {object} model.DomainResponse "Bad Request - Invalid domain parameter" @Failure 401 {object} model.DomainResponse "Unauthorized - Invalid or missing authentication token" @Failure 404 {object} model.DomainResponse "Not Found - Domain not found" @Router /api/v1/domains/{domain} [get] GetDomain handles GET /api/v1/domains/:domain

func (*DomainHandler) ListDomains

func (h *DomainHandler) ListDomains(c *fiber.Ctx) error

@Summary List all domains @Description Get a paginated list of all configured domains with optional sorting and searching @Tags domains @Accept json @Produce json @Security BearerAuth @Param page query int false "Page number (1-based, defaults to 1)" minimum(1) @Param per_page query int false "Number of items per page (defaults to 100, max 1000)" minimum(1) maximum(1000) @Param sort query string false "Sort order for domain field (asc or desc, optional - defaults to alphabetical order)" Enums(asc, desc) @Param search query string false "Search term to filter domains by domain field (case-insensitive contains)" @Success 200 {object} model.PaginatedDomainsResponse @Failure 400 {object} model.PaginatedDomainsResponse "Bad Request - Invalid pagination parameters" @Failure 401 {object} model.PaginatedDomainsResponse "Unauthorized - Invalid or missing authentication token" @Failure 500 {object} model.PaginatedDomainsResponse "Internal Server Error" @Router /api/v1/domains [get] ListDomains handles GET /api/v1/domains

func (*DomainHandler) RegisterRoutes

func (h *DomainHandler) RegisterRoutes(app fiber.Router)

RegisterRoutes registers all domain-related routes

func (*DomainHandler) UpdateDomain

func (h *DomainHandler) UpdateDomain(c *fiber.Ctx) error

@Summary Update a domain @Description Update an existing domain entry @Tags domains @Accept json @Produce json @Security BearerAuth @Param domain path string true "Domain name" @Param request body model.UpdateDomainRequest true "Domain update request" @Success 200 {object} model.DomainResponse @Failure 400 {object} model.DomainResponse "Bad Request - Invalid request body or domain parameter" @Failure 401 {object} model.DomainResponse "Unauthorized - Invalid or missing authentication token" @Failure 404 {object} model.DomainResponse "Not Found - Domain not found" @Router /api/v1/domains/{domain} [put] UpdateDomain handles PUT /api/v1/domains/:domain

type HealthHandler

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

HealthHandler handles HTTP requests for health operations

func NewHealthHandler

func NewHealthHandler() *HealthHandler

NewHealthHandler creates a new HealthHandler instance

func (*HealthHandler) Health

func (h *HealthHandler) Health(c *fiber.Ctx) error

@Summary Health check @Description Check if the API is running and healthy @Tags health @Accept json @Produce json @Success 200 {object} model.DomainsResponse @Router /health [get] Health handles GET /health

func (*HealthHandler) RegisterRoutes

func (h *HealthHandler) RegisterRoutes(app *fiber.App)

RegisterRoutes registers all health-related routes

Jump to

Keyboard shortcuts

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