handlers

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnvMapTargets = map[string]bool{
		"id":   true,
		"uuid": true,
		"name": true,
	}
)

Define targets to be used to retrieve an environment map

Functions

This section is empty.

Types

type APIQueryData

type APIQueryData map[string]string

APIQueryData to hold query result data

type ContextKey

type ContextKey string

ContextKey to help with the context key, to pass session data

type ContextValue

type ContextValue map[string]string

ContextValue to hold session data in the context

type HandlersApi

type HandlersApi struct {
	DB             *gorm.DB
	Users          *users.UserManager
	Tags           *tags.TagManager
	Envs           *environments.Environment
	Nodes          *nodes.NodeManager
	Queries        *queries.Queries
	Carves         *carves.Carves
	Settings       *settings.Settings
	RedisCache     *cache.RedisManager
	ServiceVersion string
	ServiceName    string
	ApiConfig      *config.JSONConfigurationService
}

func CreateHandlersApi

func CreateHandlersApi(opts ...HandlersOption) *HandlersApi

CreateHandlersApi to initialize the Admin handlers struct

func (*HandlersApi) ActiveNodesHandler

func (h *HandlersApi) ActiveNodesHandler(w http.ResponseWriter, r *http.Request)

ActiveNodesHandler - GET Handler for active JSON nodes

func (*HandlersApi) AllNodesHandler

func (h *HandlersApi) AllNodesHandler(w http.ResponseWriter, r *http.Request)

AllNodesHandler - GET Handler for all JSON nodes

func (*HandlersApi) AllQueriesShowHandler

func (h *HandlersApi) AllQueriesShowHandler(w http.ResponseWriter, r *http.Request)

AllQueriesShowHandler - GET Handler to return all queries in JSON

func (*HandlersApi) AllTagsHandler

func (h *HandlersApi) AllTagsHandler(w http.ResponseWriter, r *http.Request)

AllTagsHandler - GET Handler for all JSON tags

func (*HandlersApi) CarveListHandler

func (h *HandlersApi) CarveListHandler(w http.ResponseWriter, r *http.Request)

GET Handler to return carves in JSON by environment

func (*HandlersApi) CarveQueriesHandler

func (h *HandlersApi) CarveQueriesHandler(w http.ResponseWriter, r *http.Request)

GET Handler to return carve queries in JSON by target and environment

func (*HandlersApi) CarveShowHandler

func (h *HandlersApi) CarveShowHandler(w http.ResponseWriter, r *http.Request)

GET Handler to return a single carve in JSON

func (*HandlersApi) CarvesActionHandler

func (h *HandlersApi) CarvesActionHandler(w http.ResponseWriter, r *http.Request)

CarvesActionHandler - POST Handler to delete/expire a carve

func (*HandlersApi) CarvesRunHandler

func (h *HandlersApi) CarvesRunHandler(w http.ResponseWriter, r *http.Request)

POST Handler to run a carve

func (*HandlersApi) DeleteNodeHandler

func (h *HandlersApi) DeleteNodeHandler(w http.ResponseWriter, r *http.Request)

DeleteNodeHandler - POST Handler to delete single node

func (*HandlersApi) EnvEnrollActionsHandler

func (h *HandlersApi) EnvEnrollActionsHandler(w http.ResponseWriter, r *http.Request)

EnvEnrollActionsHandler - POST Handler to perform actions (extend, expire) in enroll values

func (*HandlersApi) EnvEnrollHandler

func (h *HandlersApi) EnvEnrollHandler(w http.ResponseWriter, r *http.Request)

EnvEnrollHandler - GET Handler to return node enrollment values (secret, certificate, one-liner) for an environment as JSON

func (*HandlersApi) EnvRemoveActionsHandler

func (h *HandlersApi) EnvRemoveActionsHandler(w http.ResponseWriter, r *http.Request)

EnvRemoveActionsHandler - POST Handler to perform actions (extend, expire) in remove values

func (*HandlersApi) EnvRemoveHandler

func (h *HandlersApi) EnvRemoveHandler(w http.ResponseWriter, r *http.Request)

EnvRemoveHandler - GET Handler to return node removal values for an environment as JSON

func (*HandlersApi) EnvironmentHandler

func (h *HandlersApi) EnvironmentHandler(w http.ResponseWriter, r *http.Request)

EnvironmentHandler - GET Handler to return one environment by UUID as JSON

func (*HandlersApi) EnvironmentMapHandler

func (h *HandlersApi) EnvironmentMapHandler(w http.ResponseWriter, r *http.Request)

EnvironmentMapHandler - GET Handler to return one environment as JSON

func (*HandlersApi) EnvironmentsHandler

func (h *HandlersApi) EnvironmentsHandler(w http.ResponseWriter, r *http.Request)

EnvironmentsHandler - GET Handler to return all environments as JSON

func (*HandlersApi) ErrorHandler

func (h *HandlersApi) ErrorHandler(w http.ResponseWriter, r *http.Request)

ErrorHandler - Handle error requests

func (*HandlersApi) ForbiddenHandler

func (h *HandlersApi) ForbiddenHandler(w http.ResponseWriter, r *http.Request)

ForbiddenHandler - Handle forbidden error requests

func (*HandlersApi) HealthHandler

func (h *HandlersApi) HealthHandler(w http.ResponseWriter, r *http.Request)

HealthHandler - Handle health requests

func (*HandlersApi) InactiveNodesHandler

func (h *HandlersApi) InactiveNodesHandler(w http.ResponseWriter, r *http.Request)

InactiveNodesHandler - GET Handler for inactive JSON nodes

func (*HandlersApi) LoginHandler

func (h *HandlersApi) LoginHandler(w http.ResponseWriter, r *http.Request)

LoginHandler - POST Handler for API login request

func (*HandlersApi) NodeHandler

func (h *HandlersApi) NodeHandler(w http.ResponseWriter, r *http.Request)

NodeHandler - GET Handler for single JSON nodes

func (*HandlersApi) PlatformsEnvHandler

func (h *HandlersApi) PlatformsEnvHandler(w http.ResponseWriter, r *http.Request)

PlatformsEnvHandler - GET Handler to return platforms for one environment as JSON

func (*HandlersApi) PlatformsHandler

func (h *HandlersApi) PlatformsHandler(w http.ResponseWriter, r *http.Request)

PlatformsHandler - GET Handler for multiple JSON platforms

func (*HandlersApi) QueriesActionHandler

func (h *HandlersApi) QueriesActionHandler(w http.ResponseWriter, r *http.Request)

QueriesActionHandler - POST Handler to delete/expire a query

func (*HandlersApi) QueriesRunHandler

func (h *HandlersApi) QueriesRunHandler(w http.ResponseWriter, r *http.Request)

QueriesRunHandler - POST Handler to run a query

func (*HandlersApi) QueryListHandler

func (h *HandlersApi) QueryListHandler(w http.ResponseWriter, r *http.Request)

QueryListHandler - GET Handler to return queries in JSON by target and environment

func (*HandlersApi) QueryResultsHandler

func (h *HandlersApi) QueryResultsHandler(w http.ResponseWriter, r *http.Request)

QueryResultsHandler - GET Handler to return a single query results in JSON

func (*HandlersApi) QueryShowHandler

func (h *HandlersApi) QueryShowHandler(w http.ResponseWriter, r *http.Request)

QueryShowHandler - GET Handler to return a single query in JSON

func (*HandlersApi) RootHandler

func (h *HandlersApi) RootHandler(w http.ResponseWriter, r *http.Request)

RootHandler - Handle root requests

func (*HandlersApi) SettingsHandler

func (h *HandlersApi) SettingsHandler(w http.ResponseWriter, r *http.Request)

SettingsHandler - GET Handler for all settings including JSON

func (*HandlersApi) SettingsServiceEnvHandler

func (h *HandlersApi) SettingsServiceEnvHandler(w http.ResponseWriter, r *http.Request)

SettingsServiceEnvHandler - GET Handler for service and environment specific settings excluding JSON

func (*HandlersApi) SettingsServiceEnvJSONHandler

func (h *HandlersApi) SettingsServiceEnvJSONHandler(w http.ResponseWriter, r *http.Request)

GET Handler for service and environment specific settings including JSON

func (*HandlersApi) SettingsServiceHandler

func (h *HandlersApi) SettingsServiceHandler(w http.ResponseWriter, r *http.Request)

SettingsServiceHandler - GET Handler for service specific settings excluding JSON

func (*HandlersApi) SettingsServiceJSONHandler

func (h *HandlersApi) SettingsServiceJSONHandler(w http.ResponseWriter, r *http.Request)

SettingsServiceJSONHandler - GET Handler for service specific settings including JSON

func (*HandlersApi) TagEnvHandler

func (h *HandlersApi) TagEnvHandler(w http.ResponseWriter, r *http.Request)

TagEnvHandler - GET Handler to return one tag for one environment as JSON

func (*HandlersApi) TagsActionHandler

func (h *HandlersApi) TagsActionHandler(w http.ResponseWriter, r *http.Request)

TagsActionHandler - POST Handler to create, update or delete tags

func (*HandlersApi) TagsEnvHandler

func (h *HandlersApi) TagsEnvHandler(w http.ResponseWriter, r *http.Request)

TagsEnvHandler - GET Handler to return tags for one environment as JSON

func (*HandlersApi) UserHandler

func (h *HandlersApi) UserHandler(w http.ResponseWriter, r *http.Request)

UserHandler - GET Handler for single JSON nodes

func (*HandlersApi) UsersHandler

func (h *HandlersApi) UsersHandler(w http.ResponseWriter, r *http.Request)

UsersHandler - GET Handler for multiple JSON nodes

type HandlersOption

type HandlersOption func(*HandlersApi)

func WithCache

func WithCache(rds *cache.RedisManager) HandlersOption

func WithCarves

func WithCarves(carves *carves.Carves) HandlersOption

func WithDB

func WithDB(db *gorm.DB) HandlersOption

func WithEnvs

func WithEnvs(envs *environments.Environment) HandlersOption

func WithName

func WithName(name string) HandlersOption

func WithNodes

func WithNodes(nodes *nodes.NodeManager) HandlersOption

func WithQueries

func WithQueries(queries *queries.Queries) HandlersOption

func WithSettings

func WithSettings(settings *settings.Settings) HandlersOption

func WithTags

func WithTags(tags *tags.TagManager) HandlersOption

func WithUsers

func WithUsers(users *users.UserManager) HandlersOption

func WithVersion

func WithVersion(version string) HandlersOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳