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.5.1 DO NOT EDIT.
Package gen contains generated code for the command API.
Index ¶
- Constants
- func RegisterHandlers(router EchoRouter, si ServerInterface)
- func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
- type CommandExecRequest
- type CommandResultCollectionResponse
- type CommandResultItem
- type CommandResultItemStatus
- type CommandShellRequest
- type EchoRouter
- type ErrorResponse
- type Hostname
- type PostNodeCommandExec202JSONResponse
- type PostNodeCommandExec400JSONResponse
- type PostNodeCommandExec401JSONResponse
- type PostNodeCommandExec403JSONResponse
- type PostNodeCommandExec500JSONResponse
- type PostNodeCommandExecJSONRequestBody
- type PostNodeCommandExecRequestObject
- type PostNodeCommandExecResponseObject
- type PostNodeCommandShell202JSONResponse
- type PostNodeCommandShell400JSONResponse
- type PostNodeCommandShell401JSONResponse
- type PostNodeCommandShell403JSONResponse
- type PostNodeCommandShell500JSONResponse
- type PostNodeCommandShellJSONRequestBody
- type PostNodeCommandShellRequestObject
- type PostNodeCommandShellResponseObject
- type ServerInterface
- type ServerInterfaceWrapper
- type StrictHandlerFunc
- type StrictMiddlewareFunc
- type StrictServerInterface
Constants ¶
const (
BearerAuthScopes = "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)
Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.
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" )
Defines values for CommandResultItemStatus.
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 ¶
type EchoRouter interface {
CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}
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 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"`
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"`
Body *PostNodeCommandShellJSONRequestBody
}
type PostNodeCommandShellResponseObject ¶
type PostNodeCommandShellResponseObject interface {
VisitPostNodeCommandShellResponse(w http.ResponseWriter) error
}
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 = strictecho.StrictEchoHandlerFunc
type StrictMiddlewareFunc ¶
type StrictMiddlewareFunc = strictecho.StrictEchoMiddlewareFunc
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.