handler

package
v4.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InventoryHandler

type InventoryHandler struct {
	// contains filtered or unexported fields
}

InventoryHandler handles HTTP requests for inventory resources.

func NewInventoryHandler

func NewInventoryHandler(workdir string, restconfig *rest.Config, client ctrlclient.Client) *InventoryHandler

NewInventoryHandler creates a new InventoryHandler instance.

func (*InventoryHandler) Info

func (h *InventoryHandler) Info(request *restful.Request, response *restful.Response)

Info retrieves a specific inventory resource. It returns the inventory with the specified name in the given namespace.

func (*InventoryHandler) List

func (h *InventoryHandler) List(request *restful.Request, response *restful.Response)

List returns all inventory resources with optional filtering and sorting. It supports field selectors and label selectors for filtering the results.

func (*InventoryHandler) ListHosts

func (h *InventoryHandler) ListHosts(request *restful.Request, response *restful.Response)

ListHosts lists all hosts in an inventory with their details. It includes information about SSH configuration, IP addresses, and group membership.

func (*InventoryHandler) Patch

func (h *InventoryHandler) Patch(request *restful.Request, response *restful.Response)

Patch updates an existing inventory resource with clear variable definitions and English comments.

func (*InventoryHandler) Post

func (h *InventoryHandler) Post(request *restful.Request, response *restful.Response)

Post creates a new inventory resource. It reads the inventory from the request body and creates it in the Kubernetes cluster.

type PlaybookHandler

type PlaybookHandler struct {
	// contains filtered or unexported fields
}

PlaybookHandler handles HTTP requests for playbook resources.

func NewPlaybookHandler

func NewPlaybookHandler(workdir string, restconfig *rest.Config, client ctrlclient.Client) *PlaybookHandler

NewPlaybookHandler creates a new PlaybookHandler with the given workdir, restconfig, and client.

func (*PlaybookHandler) Delete

func (h *PlaybookHandler) Delete(request *restful.Request, response *restful.Response)

Delete handles deletion of a playbook resource and its associated tasks. It stops the playbook execution if running, deletes the playbook, removes related files, and deletes all related tasks.

func (*PlaybookHandler) Info

func (h *PlaybookHandler) Info(request *restful.Request, response *restful.Response)

Info handles retrieving a single playbook or watching for changes. If the "watch" query parameter is set to "true", it streams updates to the client.

func (*PlaybookHandler) List

func (h *PlaybookHandler) List(request *restful.Request, response *restful.Response)

List handles listing playbook resources with filtering and pagination. It supports field selectors and label selectors for filtering the results.

func (*PlaybookHandler) Log

func (h *PlaybookHandler) Log(request *restful.Request, response *restful.Response)

Log handles streaming the log file for a playbook. It opens the log file and streams its contents to the client, supporting live updates.

func (*PlaybookHandler) Post

func (h *PlaybookHandler) Post(request *restful.Request, response *restful.Response)

Post handles the creation of a new playbook resource. It reads the playbook from the request, checks schema label constraints, sets the workdir, creates the resource, and starts execution in a goroutine.

type ResourceHandler

type ResourceHandler struct {
	// contains filtered or unexported fields
}

ResourceHandler handles resource-related HTTP requests.

func NewResourceHandler

func NewResourceHandler(rootPath string, workdir string, client ctrlclient.Client) *ResourceHandler

NewResourceHandler creates a new ResourceHandler instance.

func (ResourceHandler) ConfigInfo

func (h ResourceHandler) ConfigInfo(request *restful.Request, response *restful.Response)

ConfigInfo serves the config file content as the HTTP response.

func (ResourceHandler) ListIP

func (h ResourceHandler) ListIP(request *restful.Request, response *restful.Response)

ListIP lists all IPs in the given CIDR, checks their online and SSH status, and returns the result.

func (ResourceHandler) ListSchema

func (h ResourceHandler) ListSchema(request *restful.Request, response *restful.Response)

ListSchema lists all schema JSON files in the rootPath directory as a table. It supports filtering, sorting, and pagination via query parameters.

func (ResourceHandler) PostConfig

func (h ResourceHandler) PostConfig(request *restful.Request, response *restful.Response)

PostConfig updates the config file and triggers precheck playbooks if needed.

func (ResourceHandler) PreCheckHost

func (h ResourceHandler) PreCheckHost(request *restful.Request, response *restful.Response)

PreCheckHost check input ssh information.

func (ResourceHandler) SchemaInfo

func (h ResourceHandler) SchemaInfo(request *restful.Request, response *restful.Response)

SchemaInfo serves static schema files from the rootPath directory. It strips the /resources/schema/ prefix and serves files using http.FileServer.

Jump to

Keyboard shortcuts

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