configapi

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APITokenIdRoute added in v0.22.0

func APITokenIdRoute(w http.ResponseWriter, req *http.Request)

func APITokenRoute added in v0.22.0

func APITokenRoute(w http.ResponseWriter, req *http.Request)

func BackupFileApiGet added in v0.12.0

func BackupFileApiGet(w http.ResponseWriter, req *http.Request)

BackupFileApiGet godoc @Summary Get backup file @Description Returns the backup cosmos-compose JSON file @Tags config @Produce json @Security BearerAuth @Success 200 {file} binary @Failure 401 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 405 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/get-backup [get]

func ConfigApiDNS added in v0.21.0

func ConfigApiDNS(w http.ResponseWriter, req *http.Request)

ConfigApiDNS godoc @Summary Update DNS configuration @Description Patches DNS-related settings including port, fallback, blocklists, and custom entries @Tags config @Accept json @Produce json @Security BearerAuth @Param request body DNSConfigRequest true "DNS configuration fields to update" @Success 200 {object} utils.APIResponse @Failure 400 {object} utils.HTTPErrorResult @Failure 401 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 405 {object} utils.HTTPErrorResult @Router /api/config/dns [patch]

func ConfigApiGet

func ConfigApiGet(w http.ResponseWriter, req *http.Request)

ConfigApiGet godoc @Summary Get server configuration @Description Returns the full server configuration (sensitive fields masked for non-credential users) @Tags config @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse{data=utils.Config} @Failure 401 {object} utils.HTTPErrorResult @Failure 405 {object} utils.HTTPErrorResult @Router /api/config [get]

func ConfigApiPatch

func ConfigApiPatch(w http.ResponseWriter, req *http.Request)

ConfigApiPatch godoc @Summary Patch route configuration @Description Performs route operations (add, replace, delete, move_up, move_down) on proxy routes @Tags config @Accept json @Produce json @Security BearerAuth @Param request body UpdateRouteRequest true "Route update operation" @Success 200 {object} utils.APIResponse @Failure 400 {object} utils.HTTPErrorResult @Failure 401 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 404 {object} utils.HTTPErrorResult @Router /api/config [patch]

func ConfigApiRestart

func ConfigApiRestart(w http.ResponseWriter, req *http.Request)

ConfigApiRestart godoc @Summary Restart the server @Description Triggers a graceful server restart @Tags config @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 401 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 405 {object} utils.HTTPErrorResult @Router /api/restart [get]

func ConfigApiSet

func ConfigApiSet(w http.ResponseWriter, req *http.Request)

ConfigApiSet godoc @Summary Update server configuration @Description Replaces the entire server configuration (masked credential fields are preserved from existing config) @Tags config @Accept json @Produce json @Security BearerAuth @Param request body utils.Config true "Full configuration object" @Success 200 {object} utils.APIResponse @Failure 401 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 405 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/config [put]

func ConfigRoute

func ConfigRoute(w http.ResponseWriter, req *http.Request)

func DashboardApiGet added in v0.20.0

func DashboardApiGet(w http.ResponseWriter, req *http.Request)

DashboardApiGet godoc @Summary Get dashboard data @Description Returns dashboard route information with container status for SERVAPP routes @Tags config @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse{data=[]DashboardRoute} @Failure 401 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 405 {object} utils.HTTPErrorResult @Router /api/dashboard [get]

func GenerateAPIToken added in v0.22.0

func GenerateAPIToken(name, description, owner string, permissions []utils.Permission) (string, utils.APITokenConfig, error)

GenerateAPIToken creates a new API token with the given parameters and returns the raw token (to be shown once to the caller) and the config to store. The caller is responsible for persisting the config.

func OpenIDIdRoute added in v0.22.0

func OpenIDIdRoute(w http.ResponseWriter, req *http.Request)

func OpenIDRoute added in v0.22.0

func OpenIDRoute(w http.ResponseWriter, req *http.Request)

func RoutesIdRoute added in v0.22.0

func RoutesIdRoute(w http.ResponseWriter, req *http.Request)

func RoutesRoute added in v0.22.0

func RoutesRoute(w http.ResponseWriter, req *http.Request)

func ZonesApiAddresses added in v0.24.0

func ZonesApiAddresses(w http.ResponseWriter, req *http.Request)

ZonesApiAddresses godoc @Summary List the addresses this server can advertise @Description Lists the choices for HTTPConfig.AdvertisedAddress, the address the managed DNS records of this server point at: the detected public IP (empty value, the default), each network interface (iface:<name>, for a server published on its LAN), with the address each one currently resolves to. @Tags zones @Produce json @Security BearerAuth @Success 200 {object} AdvertisedAddressesResponse @Failure 401 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Router /api/zones-addresses [get]

func ZonesApiDelete added in v0.24.0

func ZonesApiDelete(w http.ResponseWriter, req *http.Request)

ZonesApiDelete godoc @Summary Delete a DNS zone @Description Deletes the explicit zone. Its hostnames fall back to the next matching zone, or to a derived zone each. Replicated to the whole Constellation. @Tags zones @Produce json @Security BearerAuth @Param zone path string true "Zone name" @Success 200 {object} utils.APIResponse @Failure 401 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 404 {object} utils.HTTPErrorResult @Failure 409 {object} utils.HTTPErrorResult @Router /api/zones/{zone} [delete]

func ZonesApiList added in v0.24.0

func ZonesApiList(w http.ResponseWriter, req *http.Request)

ZonesApiList godoc @Summary List the DNS zones @Description Lists every zone: the explicit ones, and one derived zone per hostname no explicit zone covers. Each zone comes with its hostnames (cluster-wide) and the certificate each hostname is served with. DNS provider credentials are only included with the credentials permission. @Tags zones @Produce json @Security BearerAuth @Success 200 {object} ZonesResponse @Failure 401 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Router /api/zones [get]

func ZonesApiSet added in v0.24.0

func ZonesApiSet(w http.ResponseWriter, req *http.Request)

ZonesApiSet godoc @Summary Create or replace a DNS zone @Description Creates the explicit zone, or replaces it. A zone is a domain with its HTTPS setup (certificate mode, DNS challenge provider, wildcard) and its DynDNS setup. Every hostname under the domain uses it, unless a longer zone matches. The certificate mode is LETSENCRYPT, SELFSIGNED, PROVIDED (TLSCert and TLSKey in PEM format) or DISABLED (plain HTTP), and no server-wide mode overrides it. Replicated to the whole Constellation. Credentials sent empty by a client without the credentials permission keep their current value, and so does the private key of a provided certificate, which is never returned. @Tags zones @Accept json @Produce json @Security BearerAuth @Param zone path string true "Zone name, e.g. example.com" @Param request body utils.DNSZoneConfig true "Zone configuration" @Success 200 {object} utils.APIResponse @Failure 400 {object} utils.HTTPErrorResult @Failure 401 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 409 {object} utils.HTTPErrorResult @Router /api/zones/{zone} [put]

func ZonesIdRoute added in v0.24.0

func ZonesIdRoute(w http.ResponseWriter, req *http.Request)

func ZonesRoute added in v0.24.0

func ZonesRoute(w http.ResponseWriter, req *http.Request)

Types

type AdvertisedAddressOption added in v0.24.0

type AdvertisedAddressOption struct {
	Value   string `json:"value"`
	Address string `json:"address"`
}

AdvertisedAddressOption is one choice for HTTPConfig.AdvertisedAddress

type AdvertisedAddressesResponse added in v0.24.0

type AdvertisedAddressesResponse struct {
	Status string                    `json:"status"`
	Data   []AdvertisedAddressOption `json:"data"`
}

type CreateAPITokenRequest added in v0.22.0

type CreateAPITokenRequest struct {
	Name                    string             `json:"name" validate:"required"`
	Description             string             `json:"description,omitempty"`
	ReadOnly                bool               `json:"readOnly"`
	Permissions             []utils.Permission `json:"permissions,omitempty"`
	IPWhitelist             []string           `json:"ipWhitelist,omitempty"`
	RestrictToConstellation bool               `json:"restrictToConstellation"`
	ExpiryDays              int                `json:"expiryDays,omitempty"`
}

type DNSConfigRequest added in v0.21.0

type DNSConfigRequest struct {
	DNSPort                 string                        `json:"dnsPort,omitempty"`
	DNSFallback             string                        `json:"dnsFallback,omitempty"`
	DNSBlockBlacklist       *bool                         `json:"dnsBlockBlacklist,omitempty"`
	DNSAdditionalBlocklists []string                      `json:"dnsAdditionalBlocklists,omitempty"`
	CustomDNSEntries        []utils.ConstellationDNSEntry `json:"customDNSEntries,omitempty"`
}

type DashboardRoute added in v0.20.0

type DashboardRoute struct {
	Name              string `json:"Name"`
	Description       string `json:"Description,omitempty"`
	Target            string `json:"Target"`
	Mode              string `json:"Mode"`
	Host              string `json:"Host,omitempty"`
	UseHost           bool   `json:"UseHost"`
	UsePathPrefix     bool   `json:"UsePathPrefix"`
	PathPrefix        string `json:"PathPrefix,omitempty"`
	Icon              string `json:"Icon,omitempty"`
	HideFromDashboard bool   `json:"HideFromDashboard"`
	// Container info (for SERVAPP routes)
	ContainerRunning bool   `json:"ContainerRunning"`
	ContainerIcon    string `json:"ContainerIcon,omitempty"`
}

type DeleteAPITokenRequest added in v0.22.0

type DeleteAPITokenRequest struct {
	Name string `json:"name" validate:"required"`
}

type UpdateAPITokenRequest added in v0.22.0

type UpdateAPITokenRequest struct {
	Description             *string            `json:"description,omitempty"`
	Permissions             []utils.Permission `json:"permissions,omitempty"`
	IPWhitelist             []string           `json:"ipWhitelist,omitempty"`
	RestrictToConstellation *bool              `json:"restrictToConstellation,omitempty"`
}

type UpdateRouteRequest

type UpdateRouteRequest struct {
	RouteName string                  `json:"routeName"`
	Operation string                  `json:"operation" validate:"required"`
	NewRoute  *utils.ProxyRouteConfig `json:"newRoute,omitempty"`
}

type ZoneCertStatus added in v0.24.0

type ZoneCertStatus struct {
	Hosts      []string  `json:"hosts"`
	ValidUntil time.Time `json:"validUntil"`
	IssuedBy   string    `json:"issuedBy,omitempty"`
}

ZoneCertStatus is the certificate of a zone without its key

type ZoneStatus added in v0.24.0

type ZoneStatus struct {
	utils.DNSZoneConfig
	Derived bool `json:"derived"`
	// IssuesCertificate is true when the zone gets a certificate of its own
	// through its DNS provider; its hostnames use this node's one otherwise
	IssuesCertificate bool                             `json:"issuesCertificate"`
	Hosts             []string                         `json:"hosts"`
	Certificate       *ZoneCertStatus                  `json:"certificate,omitempty"`
	HostCertificates  map[string]utils.HostCertificate `json:"hostCertificates"`
	// RecordsSupported is true when the DNS provider of the zone can manage records
	RecordsSupported bool `json:"recordsSupported"`
	// Records is the DynDNS state of the zone, only known by the node writing
	// the records (this node when standalone, the cluster leader otherwise)
	Records *dnsrecords.ZoneStatus `json:"records,omitempty"`
}

ZoneStatus is a zone as served: explicit or derived from a hostname, with the hostnames filed under it and the certificate each one is served with.

type ZonesResponse added in v0.24.0

type ZonesResponse struct {
	Status string       `json:"status"`
	Data   []ZoneStatus `json:"data"`
}

Jump to

Keyboard shortcuts

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