gen

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package gen contains generated code for the Power API.

Package gen provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.1 DO NOT EDIT.

Index

Constants

View Source
const (
	BearerAuthScopes bearerAuthContextKey = "BearerAuth.Scopes"
)

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

RegisterHandlersWithBaseURL registers handlers and prepends BaseURL to the paths so the API can be served under a prefix.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router EchoRouter, si ServerInterface, options RegisterHandlersOptions)

RegisterHandlersWithOptions registers handlers using the supplied options, including any per-operation middleware.

Types

type EchoRouter

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type ErrorResponse

type ErrorResponse = externalRef0.ErrorResponse

ErrorResponse defines model for ErrorResponse.

type Hostname

type Hostname = string

Hostname defines model for Hostname.

type PostNodePowerReboot200JSONResponse

type PostNodePowerReboot200JSONResponse PowerRebootResponse

func (PostNodePowerReboot200JSONResponse) VisitPostNodePowerRebootResponse

func (response PostNodePowerReboot200JSONResponse) VisitPostNodePowerRebootResponse(w http.ResponseWriter) error

type PostNodePowerReboot400JSONResponse

type PostNodePowerReboot400JSONResponse externalRef0.ErrorResponse

func (PostNodePowerReboot400JSONResponse) VisitPostNodePowerRebootResponse

func (response PostNodePowerReboot400JSONResponse) VisitPostNodePowerRebootResponse(w http.ResponseWriter) error

type PostNodePowerReboot401JSONResponse

type PostNodePowerReboot401JSONResponse externalRef0.ErrorResponse

func (PostNodePowerReboot401JSONResponse) VisitPostNodePowerRebootResponse

func (response PostNodePowerReboot401JSONResponse) VisitPostNodePowerRebootResponse(w http.ResponseWriter) error

type PostNodePowerReboot403JSONResponse

type PostNodePowerReboot403JSONResponse externalRef0.ErrorResponse

func (PostNodePowerReboot403JSONResponse) VisitPostNodePowerRebootResponse

func (response PostNodePowerReboot403JSONResponse) VisitPostNodePowerRebootResponse(w http.ResponseWriter) error

type PostNodePowerReboot500JSONResponse

type PostNodePowerReboot500JSONResponse externalRef0.ErrorResponse

func (PostNodePowerReboot500JSONResponse) VisitPostNodePowerRebootResponse

func (response PostNodePowerReboot500JSONResponse) VisitPostNodePowerRebootResponse(w http.ResponseWriter) error

type PostNodePowerRebootJSONRequestBody

type PostNodePowerRebootJSONRequestBody = PowerRequest

PostNodePowerRebootJSONRequestBody defines body for PostNodePowerReboot for application/json ContentType.

type PostNodePowerRebootRequestObject

type PostNodePowerRebootRequestObject struct {
	Hostname Hostname `json:"hostname" validate:"required,min=1,valid_target"`
	Body     *PostNodePowerRebootJSONRequestBody
}

type PostNodePowerRebootResponseObject

type PostNodePowerRebootResponseObject interface {
	VisitPostNodePowerRebootResponse(w http.ResponseWriter) error
}

type PostNodePowerShutdown200JSONResponse

type PostNodePowerShutdown200JSONResponse PowerShutdownResponse

func (PostNodePowerShutdown200JSONResponse) VisitPostNodePowerShutdownResponse

func (response PostNodePowerShutdown200JSONResponse) VisitPostNodePowerShutdownResponse(w http.ResponseWriter) error

type PostNodePowerShutdown400JSONResponse

type PostNodePowerShutdown400JSONResponse externalRef0.ErrorResponse

func (PostNodePowerShutdown400JSONResponse) VisitPostNodePowerShutdownResponse

func (response PostNodePowerShutdown400JSONResponse) VisitPostNodePowerShutdownResponse(w http.ResponseWriter) error

type PostNodePowerShutdown401JSONResponse

type PostNodePowerShutdown401JSONResponse externalRef0.ErrorResponse

func (PostNodePowerShutdown401JSONResponse) VisitPostNodePowerShutdownResponse

func (response PostNodePowerShutdown401JSONResponse) VisitPostNodePowerShutdownResponse(w http.ResponseWriter) error

type PostNodePowerShutdown403JSONResponse

type PostNodePowerShutdown403JSONResponse externalRef0.ErrorResponse

func (PostNodePowerShutdown403JSONResponse) VisitPostNodePowerShutdownResponse

func (response PostNodePowerShutdown403JSONResponse) VisitPostNodePowerShutdownResponse(w http.ResponseWriter) error

type PostNodePowerShutdown500JSONResponse

type PostNodePowerShutdown500JSONResponse externalRef0.ErrorResponse

func (PostNodePowerShutdown500JSONResponse) VisitPostNodePowerShutdownResponse

func (response PostNodePowerShutdown500JSONResponse) VisitPostNodePowerShutdownResponse(w http.ResponseWriter) error

type PostNodePowerShutdownJSONRequestBody

type PostNodePowerShutdownJSONRequestBody = PowerRequest

PostNodePowerShutdownJSONRequestBody defines body for PostNodePowerShutdown for application/json ContentType.

type PostNodePowerShutdownRequestObject

type PostNodePowerShutdownRequestObject struct {
	Hostname Hostname `json:"hostname" validate:"required,min=1,valid_target"`
	Body     *PostNodePowerShutdownJSONRequestBody
}

type PostNodePowerShutdownResponseObject

type PostNodePowerShutdownResponseObject interface {
	VisitPostNodePowerShutdownResponse(w http.ResponseWriter) error
}

type PowerRebootResponse

type PowerRebootResponse struct {
	// JobId The job ID used to process this request.
	JobId   *openapi_types.UUID `json:"job_id,omitempty"`
	Results []PowerResult       `json:"results"`
}

PowerRebootResponse defines model for PowerRebootResponse.

type PowerRequest

type PowerRequest struct {
	// Delay Delay in seconds before the operation is executed.
	Delay *int `json:"delay,omitempty" validate:"omitempty,min=0"`

	// Message Optional message to broadcast before the operation.
	Message *string `json:"message,omitempty" validate:"omitempty"`
}

PowerRequest defines model for PowerRequest.

type PowerResult

type PowerResult struct {
	// Action The power action performed (reboot, shutdown).
	Action *string `json:"action,omitempty"`

	// Changed Whether the operation modified system state.
	Changed *bool `json:"changed,omitempty"`

	// Delay The delay in seconds before the operation executes.
	Delay *int `json:"delay,omitempty"`

	// Error Error message if the agent failed.
	Error *string `json:"error,omitempty"`

	// Hostname Hostname of the agent that processed this operation.
	Hostname string `json:"hostname"`

	// Status The status of the operation for this host.
	Status PowerResultStatus `json:"status"`
}

PowerResult Result of a power operation for one host.

type PowerResultStatus

type PowerResultStatus string

PowerResultStatus The status of the operation for this host.

const (
	Failed  PowerResultStatus = "failed"
	Ok      PowerResultStatus = "ok"
	Skipped PowerResultStatus = "skipped"
	Timeout PowerResultStatus = "timeout"
)

Defines values for PowerResultStatus.

func (PowerResultStatus) Valid

func (e PowerResultStatus) Valid() bool

Valid indicates whether the value is a known member of the PowerResultStatus enum.

type PowerShutdownResponse

type PowerShutdownResponse struct {
	// JobId The job ID used to process this request.
	JobId   *openapi_types.UUID `json:"job_id,omitempty"`
	Results []PowerResult       `json:"results"`
}

PowerShutdownResponse defines model for PowerShutdownResponse.

type RegisterHandlersOptions

type RegisterHandlersOptions struct {
	// BaseURL is prepended to every registered path so the API can be served
	// under a prefix.
	BaseURL string
	// OperationMiddlewares lets the caller attach per-operation middleware at
	// registration time. The map key is the OpenAPI `operationId` value as it
	// appears in the spec (the raw, un-normalized form). Operations that have
	// no entry are registered with no extra middleware. A nil map disables
	// per-operation middleware entirely.
	OperationMiddlewares map[string][]echo.MiddlewareFunc
}

RegisterHandlersOptions configures RegisterHandlersWithOptions.

type ServerInterface

type ServerInterface interface {
	// Reboot node
	// (POST /api/node/{hostname}/power/reboot)
	PostNodePowerReboot(ctx *echo.Context, hostname Hostname) error
	// Shutdown node
	// (POST /api/node/{hostname}/power/shutdown)
	PostNodePowerShutdown(ctx *echo.Context, hostname Hostname) error
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) PostNodePowerReboot

func (w *ServerInterfaceWrapper) PostNodePowerReboot(ctx *echo.Context) error

PostNodePowerReboot converts echo context to params.

func (*ServerInterfaceWrapper) PostNodePowerShutdown

func (w *ServerInterfaceWrapper) PostNodePowerShutdown(ctx *echo.Context) error

PostNodePowerShutdown converts echo context to params.

type StrictHandlerFunc

type StrictHandlerFunc func(ctx *echo.Context, request any) (any, error)

type StrictMiddlewareFunc

type StrictMiddlewareFunc func(f StrictHandlerFunc, operationID string) StrictHandlerFunc

type StrictServerInterface

type StrictServerInterface interface {
	// Reboot node
	// (POST /api/node/{hostname}/power/reboot)
	PostNodePowerReboot(ctx context.Context, request PostNodePowerRebootRequestObject) (PostNodePowerRebootResponseObject, error)
	// Shutdown node
	// (POST /api/node/{hostname}/power/shutdown)
	PostNodePowerShutdown(ctx context.Context, request PostNodePowerShutdownRequestObject) (PostNodePowerShutdownResponseObject, error)
}

StrictServerInterface represents all server handlers.

Jump to

Keyboard shortcuts

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