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 CommandShellRequest
- type EchoRouter
- type ErrorResponse
- type PostCommandExec202JSONResponse
- type PostCommandExec400JSONResponse
- type PostCommandExec401JSONResponse
- type PostCommandExec403JSONResponse
- type PostCommandExec500JSONResponse
- type PostCommandExecJSONRequestBody
- type PostCommandExecParams
- type PostCommandExecRequestObject
- type PostCommandExecResponseObject
- type PostCommandShell202JSONResponse
- type PostCommandShell400JSONResponse
- type PostCommandShell401JSONResponse
- type PostCommandShell403JSONResponse
- type PostCommandShell500JSONResponse
- type PostCommandShellJSONRequestBody
- type PostCommandShellParams
- type PostCommandShellRequestObject
- type PostCommandShellResponseObject
- 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 to process the request.
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"`
// 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 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 PostCommandExec202JSONResponse ¶
type PostCommandExec202JSONResponse CommandResultCollectionResponse
func (PostCommandExec202JSONResponse) VisitPostCommandExecResponse ¶
func (response PostCommandExec202JSONResponse) VisitPostCommandExecResponse(w http.ResponseWriter) error
type PostCommandExec400JSONResponse ¶
type PostCommandExec400JSONResponse externalRef0.ErrorResponse
func (PostCommandExec400JSONResponse) VisitPostCommandExecResponse ¶
func (response PostCommandExec400JSONResponse) VisitPostCommandExecResponse(w http.ResponseWriter) error
type PostCommandExec401JSONResponse ¶
type PostCommandExec401JSONResponse externalRef0.ErrorResponse
func (PostCommandExec401JSONResponse) VisitPostCommandExecResponse ¶
func (response PostCommandExec401JSONResponse) VisitPostCommandExecResponse(w http.ResponseWriter) error
type PostCommandExec403JSONResponse ¶
type PostCommandExec403JSONResponse externalRef0.ErrorResponse
func (PostCommandExec403JSONResponse) VisitPostCommandExecResponse ¶
func (response PostCommandExec403JSONResponse) VisitPostCommandExecResponse(w http.ResponseWriter) error
type PostCommandExec500JSONResponse ¶
type PostCommandExec500JSONResponse externalRef0.ErrorResponse
func (PostCommandExec500JSONResponse) VisitPostCommandExecResponse ¶
func (response PostCommandExec500JSONResponse) VisitPostCommandExecResponse(w http.ResponseWriter) error
type PostCommandExecJSONRequestBody ¶
type PostCommandExecJSONRequestBody = CommandExecRequest
PostCommandExecJSONRequestBody defines body for PostCommandExec for application/json ContentType.
type PostCommandExecParams ¶
type PostCommandExecParams struct {
// TargetHostname Target: _any (load-balanced), _all (broadcast), hostname (direct), or key:value (label group, e.g., group:web.dev).
TargetHostname *string `form:"target_hostname,omitempty" json:"target_hostname,omitempty" validate:"omitempty,min=1,valid_target"`
}
PostCommandExecParams defines parameters for PostCommandExec.
type PostCommandExecRequestObject ¶
type PostCommandExecRequestObject struct {
Params PostCommandExecParams
Body *PostCommandExecJSONRequestBody
}
type PostCommandExecResponseObject ¶
type PostCommandExecResponseObject interface {
VisitPostCommandExecResponse(w http.ResponseWriter) error
}
type PostCommandShell202JSONResponse ¶
type PostCommandShell202JSONResponse CommandResultCollectionResponse
func (PostCommandShell202JSONResponse) VisitPostCommandShellResponse ¶
func (response PostCommandShell202JSONResponse) VisitPostCommandShellResponse(w http.ResponseWriter) error
type PostCommandShell400JSONResponse ¶
type PostCommandShell400JSONResponse externalRef0.ErrorResponse
func (PostCommandShell400JSONResponse) VisitPostCommandShellResponse ¶
func (response PostCommandShell400JSONResponse) VisitPostCommandShellResponse(w http.ResponseWriter) error
type PostCommandShell401JSONResponse ¶
type PostCommandShell401JSONResponse externalRef0.ErrorResponse
func (PostCommandShell401JSONResponse) VisitPostCommandShellResponse ¶
func (response PostCommandShell401JSONResponse) VisitPostCommandShellResponse(w http.ResponseWriter) error
type PostCommandShell403JSONResponse ¶
type PostCommandShell403JSONResponse externalRef0.ErrorResponse
func (PostCommandShell403JSONResponse) VisitPostCommandShellResponse ¶
func (response PostCommandShell403JSONResponse) VisitPostCommandShellResponse(w http.ResponseWriter) error
type PostCommandShell500JSONResponse ¶
type PostCommandShell500JSONResponse externalRef0.ErrorResponse
func (PostCommandShell500JSONResponse) VisitPostCommandShellResponse ¶
func (response PostCommandShell500JSONResponse) VisitPostCommandShellResponse(w http.ResponseWriter) error
type PostCommandShellJSONRequestBody ¶
type PostCommandShellJSONRequestBody = CommandShellRequest
PostCommandShellJSONRequestBody defines body for PostCommandShell for application/json ContentType.
type PostCommandShellParams ¶
type PostCommandShellParams struct {
// TargetHostname Target: _any (load-balanced), _all (broadcast), hostname (direct), or key:value (label group, e.g., group:web.dev).
TargetHostname *string `form:"target_hostname,omitempty" json:"target_hostname,omitempty" validate:"omitempty,min=1,valid_target"`
}
PostCommandShellParams defines parameters for PostCommandShell.
type PostCommandShellRequestObject ¶
type PostCommandShellRequestObject struct {
Params PostCommandShellParams
Body *PostCommandShellJSONRequestBody
}
type PostCommandShellResponseObject ¶
type PostCommandShellResponseObject interface {
VisitPostCommandShellResponse(w http.ResponseWriter) error
}
type ServerInterface ¶
type ServerInterface interface {
// Execute a command
// (POST /command/exec)
PostCommandExec(ctx echo.Context, params PostCommandExecParams) error
// Execute a shell command
// (POST /command/shell)
PostCommandShell(ctx echo.Context, params PostCommandShellParams) 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) PostCommandExec ¶
func (w *ServerInterfaceWrapper) PostCommandExec(ctx echo.Context) error
PostCommandExec converts echo context to params.
func (*ServerInterfaceWrapper) PostCommandShell ¶
func (w *ServerInterfaceWrapper) PostCommandShell(ctx echo.Context) error
PostCommandShell 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 /command/exec)
PostCommandExec(ctx context.Context, request PostCommandExecRequestObject) (PostCommandExecResponseObject, error)
// Execute a shell command
// (POST /command/shell)
PostCommandShell(ctx context.Context, request PostCommandShellRequestObject) (PostCommandShellResponseObject, error)
}
StrictServerInterface represents all server handlers.