Files
headscale/gen/api/v1/oas_server_gen.go
T
Kristoffer Dalby 01dcd4011e gen: generate v1 API server and client with ogen
go generate (gen/api/v1) runs ogen against openapi/v1/headscale.yaml; ogen
added as a tool dependency. CI freshness check covers openapi/.
2026-06-19 05:57:03 +00:00

211 lines
6.6 KiB
Go

// Code generated by ogen, DO NOT EDIT.
package apiv1
import (
"context"
)
// Handler handles operations described by OpenAPI v3 specification.
type Handler interface {
// AuthApprove implements AuthApprove operation.
//
// Approve a pending auth session.
//
// POST /api/v1/auth/approve
AuthApprove(ctx context.Context, req *AuthApproveReq) error
// AuthRegister implements AuthRegister operation.
//
// Register a node via an auth id (alias of RegisterNode).
//
// POST /api/v1/auth/register
AuthRegister(ctx context.Context, req *AuthRegisterReq) (*AuthRegisterOK, error)
// AuthReject implements AuthReject operation.
//
// Reject a pending auth session.
//
// POST /api/v1/auth/reject
AuthReject(ctx context.Context, req *AuthRejectReq) error
// BackfillNodeIPs implements BackfillNodeIPs operation.
//
// Backfill missing IP addresses for all nodes.
//
// POST /api/v1/node/backfillips
BackfillNodeIPs(ctx context.Context, params BackfillNodeIPsParams) (*BackfillNodeIPsOK, error)
// CheckPolicy implements CheckPolicy operation.
//
// Validate a policy against live users and nodes without storing it.
//
// POST /api/v1/policy/check
CheckPolicy(ctx context.Context, req *CheckPolicyReq) error
// CreateApiKey implements CreateApiKey operation.
//
// Create an API key.
//
// POST /api/v1/apikey
CreateApiKey(ctx context.Context, req *CreateApiKeyReq) (*CreateApiKeyOK, error)
// CreatePreAuthKey implements CreatePreAuthKey operation.
//
// Create a pre-auth key.
//
// POST /api/v1/preauthkey
CreatePreAuthKey(ctx context.Context, req *CreatePreAuthKeyReq) (*CreatePreAuthKeyOK, error)
// CreateUser implements CreateUser operation.
//
// Create a user.
//
// POST /api/v1/user
CreateUser(ctx context.Context, req *CreateUserReq) (*CreateUserOK, error)
// DebugCreateNode implements DebugCreateNode operation.
//
// Create a debug node and cache its registration (testing only).
//
// POST /api/v1/debug/node
DebugCreateNode(ctx context.Context, req *DebugCreateNodeReq) (*DebugCreateNodeOK, error)
// DeleteApiKey implements DeleteApiKey operation.
//
// Delete an API key by prefix (or id).
//
// DELETE /api/v1/apikey/{prefix}
DeleteApiKey(ctx context.Context, params DeleteApiKeyParams) error
// DeleteNode implements DeleteNode operation.
//
// Delete a node.
//
// DELETE /api/v1/node/{node_id}
DeleteNode(ctx context.Context, params DeleteNodeParams) error
// DeletePreAuthKey implements DeletePreAuthKey operation.
//
// Delete a pre-auth key.
//
// DELETE /api/v1/preauthkey
DeletePreAuthKey(ctx context.Context, params DeletePreAuthKeyParams) error
// DeleteUser implements DeleteUser operation.
//
// Delete a user.
//
// DELETE /api/v1/user/{id}
DeleteUser(ctx context.Context, params DeleteUserParams) error
// ExpireApiKey implements ExpireApiKey operation.
//
// Expire an API key by id or prefix.
//
// POST /api/v1/apikey/expire
ExpireApiKey(ctx context.Context, req *ExpireApiKeyReq) error
// ExpireNode implements ExpireNode operation.
//
// Expire a node, or disable its expiry.
//
// POST /api/v1/node/{node_id}/expire
ExpireNode(ctx context.Context, params ExpireNodeParams) (*ExpireNodeOK, error)
// ExpirePreAuthKey implements ExpirePreAuthKey operation.
//
// Expire a pre-auth key.
//
// POST /api/v1/preauthkey/expire
ExpirePreAuthKey(ctx context.Context, req *ExpirePreAuthKeyReq) error
// GetNode implements GetNode operation.
//
// Get a node by id.
//
// GET /api/v1/node/{node_id}
GetNode(ctx context.Context, params GetNodeParams) (*GetNodeOK, error)
// GetPolicy implements GetPolicy operation.
//
// Get the current ACL policy.
//
// GET /api/v1/policy
GetPolicy(ctx context.Context) (*GetPolicyOK, error)
// Health implements Health operation.
//
// Report server health, including database connectivity.
//
// GET /api/v1/health
Health(ctx context.Context) (*HealthOK, error)
// ListApiKeys implements ListApiKeys operation.
//
// List all API keys.
//
// GET /api/v1/apikey
ListApiKeys(ctx context.Context) (*ListApiKeysOK, error)
// ListNodes implements ListNodes operation.
//
// List nodes, optionally filtered by user.
//
// GET /api/v1/node
ListNodes(ctx context.Context, params ListNodesParams) (*ListNodesOK, error)
// ListPreAuthKeys implements ListPreAuthKeys operation.
//
// List all pre-auth keys.
//
// GET /api/v1/preauthkey
ListPreAuthKeys(ctx context.Context) (*ListPreAuthKeysOK, error)
// ListUsers implements ListUsers operation.
//
// List users, optionally filtered by id, name, or email.
//
// GET /api/v1/user
ListUsers(ctx context.Context, params ListUsersParams) (*ListUsersOK, error)
// RegisterNode implements RegisterNode operation.
//
// Register a node to a user using a registration id.
//
// POST /api/v1/node/register
RegisterNode(ctx context.Context, params RegisterNodeParams) (*RegisterNodeOK, error)
// RenameNode implements RenameNode operation.
//
// Rename a node.
//
// POST /api/v1/node/{node_id}/rename/{new_name}
RenameNode(ctx context.Context, params RenameNodeParams) (*RenameNodeOK, error)
// RenameUser implements RenameUser operation.
//
// Rename a user.
//
// POST /api/v1/user/{old_id}/rename/{new_name}
RenameUser(ctx context.Context, params RenameUserParams) (*RenameUserOK, error)
// SetApprovedRoutes implements SetApprovedRoutes operation.
//
// Set the approved subnet routes of a node.
//
// POST /api/v1/node/{node_id}/approve_routes
SetApprovedRoutes(ctx context.Context, req *SetApprovedRoutesReq, params SetApprovedRoutesParams) (*SetApprovedRoutesOK, error)
// SetPolicy implements SetPolicy operation.
//
// Set the ACL policy (database policy mode only).
//
// PUT /api/v1/policy
SetPolicy(ctx context.Context, req *SetPolicyReq) (*SetPolicyOK, error)
// SetTags implements SetTags operation.
//
// Set the tags of a node (converts it to a tagged node).
//
// POST /api/v1/node/{node_id}/tags
SetTags(ctx context.Context, req *SetTagsReq, params SetTagsParams) (*SetTagsOK, error)
// NewError creates *ErrorStatusCode from error returned by handler.
//
// Used for common default response.
NewError(ctx context.Context, err error) *ErrorStatusCode
}
// Server implements http server based on OpenAPI v3 specification and
// calls Handler to handle requests.
type Server struct {
h Handler
sec SecurityHandler
baseServer
}
// NewServer creates new Server.
func NewServer(h Handler, sec SecurityHandler, opts ...ServerOption) (*Server, error) {
s, err := newServerConfig(opts...).baseServer()
if err != nil {
return nil, err
}
return &Server{
h: h,
sec: sec,
baseServer: s,
}, nil
}