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 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.

Package gen contains generated code for the command API.

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 CommandExecRequest

type CommandExecRequest struct {
	// Args Command arguments.
	Args *[]string `json:"args,omitempty"`

	// Command The executable name or path.
	Command string `json:"command" validate:"required,min=1"`

	// Cwd Working directory for the command.
	Cwd *string `json:"cwd,omitempty"`

	// Timeout Timeout in seconds (default 30, max 300).
	Timeout *int `json:"timeout,omitempty" validate:"omitempty,min=1,max=300"`
}

CommandExecRequest defines model for CommandExecRequest.

type CommandResultCollectionResponse

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

CommandResultCollectionResponse defines model for CommandResultCollectionResponse.

type CommandResultItem

type CommandResultItem struct {
	// Changed Whether the command modified system state.
	Changed *bool `json:"changed,omitempty"`

	// DurationMs Execution time in milliseconds.
	DurationMs *int64 `json:"duration_ms,omitempty"`

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

	// ExitCode Exit code of the command.
	ExitCode *int `json:"exit_code,omitempty"`

	// Hostname The hostname of the agent that executed the command.
	Hostname string `json:"hostname"`

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

	// Stderr Standard error output of the command.
	Stderr *string `json:"stderr,omitempty"`

	// Stdout Standard output of the command.
	Stdout *string `json:"stdout,omitempty"`
}

CommandResultItem defines model for CommandResultItem.

type CommandResultItemStatus

type CommandResultItemStatus string

CommandResultItemStatus The status of the operation for this host.

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

Defines values for CommandResultItemStatus.

func (CommandResultItemStatus) Valid

func (e CommandResultItemStatus) Valid() bool

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

type CommandShellRequest

type CommandShellRequest struct {
	// Command The full shell command string.
	Command string `json:"command" validate:"required,min=1"`

	// Cwd Working directory for the command.
	Cwd *string `json:"cwd,omitempty"`

	// Timeout Timeout in seconds (default 30, max 300).
	Timeout *int `json:"timeout,omitempty" validate:"omitempty,min=1,max=300"`
}

CommandShellRequest defines model for CommandShellRequest.

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 PostNodeCommandExec202JSONResponse

type PostNodeCommandExec202JSONResponse CommandResultCollectionResponse

func (PostNodeCommandExec202JSONResponse) VisitPostNodeCommandExecResponse

func (response PostNodeCommandExec202JSONResponse) VisitPostNodeCommandExecResponse(w http.ResponseWriter) error

type PostNodeCommandExec400JSONResponse

type PostNodeCommandExec400JSONResponse externalRef0.ErrorResponse

func (PostNodeCommandExec400JSONResponse) VisitPostNodeCommandExecResponse

func (response PostNodeCommandExec400JSONResponse) VisitPostNodeCommandExecResponse(w http.ResponseWriter) error

type PostNodeCommandExec401JSONResponse

type PostNodeCommandExec401JSONResponse externalRef0.ErrorResponse

func (PostNodeCommandExec401JSONResponse) VisitPostNodeCommandExecResponse

func (response PostNodeCommandExec401JSONResponse) VisitPostNodeCommandExecResponse(w http.ResponseWriter) error

type PostNodeCommandExec403JSONResponse

type PostNodeCommandExec403JSONResponse externalRef0.ErrorResponse

func (PostNodeCommandExec403JSONResponse) VisitPostNodeCommandExecResponse

func (response PostNodeCommandExec403JSONResponse) VisitPostNodeCommandExecResponse(w http.ResponseWriter) error

type PostNodeCommandExec500JSONResponse

type PostNodeCommandExec500JSONResponse externalRef0.ErrorResponse

func (PostNodeCommandExec500JSONResponse) VisitPostNodeCommandExecResponse

func (response PostNodeCommandExec500JSONResponse) VisitPostNodeCommandExecResponse(w http.ResponseWriter) error

type PostNodeCommandExecJSONRequestBody

type PostNodeCommandExecJSONRequestBody = CommandExecRequest

PostNodeCommandExecJSONRequestBody defines body for PostNodeCommandExec for application/json ContentType.

type PostNodeCommandExecRequestObject

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

type PostNodeCommandExecResponseObject

type PostNodeCommandExecResponseObject interface {
	VisitPostNodeCommandExecResponse(w http.ResponseWriter) error
}

type PostNodeCommandShell202JSONResponse

type PostNodeCommandShell202JSONResponse CommandResultCollectionResponse

func (PostNodeCommandShell202JSONResponse) VisitPostNodeCommandShellResponse

func (response PostNodeCommandShell202JSONResponse) VisitPostNodeCommandShellResponse(w http.ResponseWriter) error

type PostNodeCommandShell400JSONResponse

type PostNodeCommandShell400JSONResponse externalRef0.ErrorResponse

func (PostNodeCommandShell400JSONResponse) VisitPostNodeCommandShellResponse

func (response PostNodeCommandShell400JSONResponse) VisitPostNodeCommandShellResponse(w http.ResponseWriter) error

type PostNodeCommandShell401JSONResponse

type PostNodeCommandShell401JSONResponse externalRef0.ErrorResponse

func (PostNodeCommandShell401JSONResponse) VisitPostNodeCommandShellResponse

func (response PostNodeCommandShell401JSONResponse) VisitPostNodeCommandShellResponse(w http.ResponseWriter) error

type PostNodeCommandShell403JSONResponse

type PostNodeCommandShell403JSONResponse externalRef0.ErrorResponse

func (PostNodeCommandShell403JSONResponse) VisitPostNodeCommandShellResponse

func (response PostNodeCommandShell403JSONResponse) VisitPostNodeCommandShellResponse(w http.ResponseWriter) error

type PostNodeCommandShell500JSONResponse

type PostNodeCommandShell500JSONResponse externalRef0.ErrorResponse

func (PostNodeCommandShell500JSONResponse) VisitPostNodeCommandShellResponse

func (response PostNodeCommandShell500JSONResponse) VisitPostNodeCommandShellResponse(w http.ResponseWriter) error

type PostNodeCommandShellJSONRequestBody

type PostNodeCommandShellJSONRequestBody = CommandShellRequest

PostNodeCommandShellJSONRequestBody defines body for PostNodeCommandShell for application/json ContentType.

type PostNodeCommandShellRequestObject

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

type PostNodeCommandShellResponseObject

type PostNodeCommandShellResponseObject interface {
	VisitPostNodeCommandShellResponse(w http.ResponseWriter) error
}

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 {
	// Execute a command
	// (POST /api/node/{hostname}/command/exec)
	PostNodeCommandExec(ctx *echo.Context, hostname Hostname) error
	// Execute a shell command
	// (POST /api/node/{hostname}/command/shell)
	PostNodeCommandShell(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) PostNodeCommandExec

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

PostNodeCommandExec converts echo context to params.

func (*ServerInterfaceWrapper) PostNodeCommandShell

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

PostNodeCommandShell 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 {
	// Execute a command
	// (POST /api/node/{hostname}/command/exec)
	PostNodeCommandExec(ctx context.Context, request PostNodeCommandExecRequestObject) (PostNodeCommandExecResponseObject, error)
	// Execute a shell command
	// (POST /api/node/{hostname}/command/shell)
	PostNodeCommandShell(ctx context.Context, request PostNodeCommandShellRequestObject) (PostNodeCommandShellResponseObject, error)
}

StrictServerInterface represents all server handlers.

Jump to

Keyboard shortcuts

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