local

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHttpService added in v0.22.80

func NewHttpService(service configuration.Service) (svr *http.Server)

Types

type Card added in v0.59.0

type Card struct {
	Type             string `json:"type"`
	PciAddress       string `json:"pciAddress"`
	Serial           string `json:"serial"`
	Endpoint         string `json:"endpoint"`
	Numa             string `json:"numa"`
	Firware          string `json:"firmware"`
	UserLogicVersion string `json:"userLogicVersion"`
}

type HttpService added in v0.22.80

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

func (*HttpService) ApiGetComponentConfiguration added in v1.0.0

func (httpsvc *HttpService) ApiGetComponentConfiguration(w http.ResponseWriter, r *http.Request)

ApiGetComponentConfiguration returns the processed configuration payload for a given component, run type, role name and entry key

@Summary		Returns a configuration payload for a given component, run type, role name and entry key
@Description	The provided component, run type, role name and entry key are used to query the configuration service for a configuration entry, which is then processed in the O² Apricot template system to produce the final payload, and returned as string..
@Tags			component configuration
@Produce		plain
@Param			process		query		boolean	false	"If true, template processing is performed to produce the final payload; if false, the entry is returned verbatim. In the true case, any number of additional string key-value pairs may be passed as query parameters (e.g. ?process=true&mykey1=myvalue1&mykey2=myvalue2), which are then fed into the template system as variables that affect configuration payload generation"	Default(false)
@Param			component	path		string	true	"Configuration component"
@Param			runtype		path		string	true	"O² Run type, must be capitalized"
@Param			rolename	path		string	true	"Role name"
@Param			entry		path		string	true	"Entry key"
@Success		200			{string}	string	"Configuration payload for the queried entry, either processed or verbatim depending on the process flag"
@Failure		400			{string}	string	"Bad request, if a parameter is invalid"
@Failure		500			{string}	string	"Internal server error"
@Router			/components/{component}/{runtype}/{rolename}/{entry} [get]

func (*HttpService) ApiGetDetectorFlps added in v0.22.80

func (httpsvc *HttpService) ApiGetDetectorFlps(w http.ResponseWriter, r *http.Request)

ApiGetDetectorFlps returns the list of FLPs in the cluster that serve a given detector

@Summary		Returns the list of FLPs in the cluster that serve a given detector
@Description	Returns the list of all Apricot-managed hosts in the cluster that are known to be FLPs and serving the given detector, newline-separated or JSON depending on the format parameter
@Tags			cluster inventory
@Param			format	path	string	false	"Output format, json or text"	Enums(json, text)	Default(text)
@Produce		plain
@Success		200	{string}	string	"List of FLPs in the cluster known to Apricot, newline-separated or JSON depending on the format parameter"
@Router			/inventory/detectors/{detector}/flps/{format} [get]

func (*HttpService) ApiGetDetectorsInventory added in v0.43.90

func (httpsvc *HttpService) ApiGetDetectorsInventory(w http.ResponseWriter, r *http.Request)

ApiGetDetectorsInventory returns the list of detectors belonging to the installed instance known to Apricot

@Summary		Returns the list of detectors belonging to the installed instance known to Apricot
@Description	Returns the list of all detectors known to Apricot that belong to the installed instance, newline-separated or JSON depending on the format parameter
@Tags			cluster inventory
@Param			format	path	string	false	"Output format, json or text"	Enums(json, text)	Default(text)
@Produce		plain
@Success		200	{string}	string	"List of detectors in the instance known to Apricot, newline-separated or JSON depending on the format parameter"
@Router			/inventory/detectors/{format} [get]

func (*HttpService) ApiGetFlps added in v0.22.80

func (httpsvc *HttpService) ApiGetFlps(w http.ResponseWriter, r *http.Request)

ApiGetFlps returns the list of FLPs in the cluster known to Apricot

@Summary		Returns the list of FLPs in the cluster known to Apricot
@Description	Returns the list of all Apricot-managed hosts in the cluster that are known to be FLPs, newline-separated or JSON depending on the format parameter
@Tags			cluster inventory
@Param			format	path	string	false	"Output format, json or text"	Enums(json, text)	Default(text)
@Produce		plain
@Success		200	{string}	string	"List of FLPs in the cluster known to Apricot, newline-separated or JSON depending on the format parameter"
@Router			/inventory/flps/{format} [get]

func (*HttpService) ApiGetHostInventory added in v0.43.90

func (httpsvc *HttpService) ApiGetHostInventory(w http.ResponseWriter, r *http.Request, detector string)

func (*HttpService) ApiInvalidateCache added in v1.0.0

func (httpsvc *HttpService) ApiInvalidateCache(w http.ResponseWriter, r *http.Request)

ApiInvalidateCache clears the component template cache

@Summary		Clear cache of Apricot-managed configuration component templates
@Description	Invalidates all cached templates for all configuration components managed by Apricot
@Tags			component configuration
@Produce		plain
@Success		200
@Router			/components/_invalidate_cache [post]

func (*HttpService) ApiListComponentEntries added in v1.0.0

func (httpsvc *HttpService) ApiListComponentEntries(w http.ResponseWriter, r *http.Request)

ApiListComponentEntries lists all entries for a given configuration component

@Summary		Lists all entries for an Apricot-managed configuration component
@Description	Returns a list of all entries belonging to a given configuration component corresponding to the given query. The component must be provided. If the run type is not provided, entries for all run types are returned. If the role name is not provided, entries for all role names are returned. If the raw flag is true, AApricot will not attempt to include "ANY"/"any" run types or role names, and will return only the entries stored under the provided Consul path. If the raw flag is false, Apricot will include all entries for the given component, run type and role name, including entries stored under "ANY" and "any" paths corresponding to fallback values valid for all run types or role names.
@Tags			component configuration
@Produce		json
@Produce		plain
@Param			format		query		string	false	"Output format, json or text"																					Enums(json, text)	Default(text)
@Param			raw			query		boolean	false	"If true, the query returns strictly Consul paths without catching all run types or role names with ANY/any"	Default(false)
@Param			component	path		string	true	"Configuration component"
@Param			runtype		path		string	false	"O² Run type, must be capitalized"	Default(ANY)
@Param			rolename	path		string	false	"Role name"							Default(any)
@Success		200			{array}		string	"List of entries, either as JSON array or comma-separated plain text"
@Failure		400			{string}	string	"Bad request, if the run type is invalid"
@Failure		500			{string}	string	"Internal server error"
@Router			/components/{component} [get]
@Router			/components/{component}/{runtype} [get]
@Router			/components/{component}/{runtype}/{rolename} [get]

func (*HttpService) ApiListComponents added in v1.0.0

func (httpsvc *HttpService) ApiListComponents(w http.ResponseWriter, r *http.Request)

ApiListComponents lists configuration components

@Summary		List Apricot-managed configuration components
@Description	Returns a list of all configuration components managed by Apricot
@Tags			component configuration
@Produce		json
@Produce		plain
@Param			format	query		string	false	"Output format, json or text"	Enums(json, text)	Default(text)
@Success		200		{array}		string	"List of components, either as JSON array or comma-separated plain text"
@Failure		500		{string}	string	"Internal server error"
@Router			/components [get]

func (*HttpService) ApiPrintClusterInformation added in v0.43.90

func (httpsvc *HttpService) ApiPrintClusterInformation(w http.ResponseWriter, r *http.Request, hosts []string, inventory map[string][]string)

func (*HttpService) ApiResolveComponentQuery added in v1.0.0

func (httpsvc *HttpService) ApiResolveComponentQuery(w http.ResponseWriter, r *http.Request)

ApiResolveComponentQuery resolves a query for a given component, run type, role name and entry key

@Summary		Resolves a query for a given component, run type, role name and entry key
@Description	Returns a resolved path for a given component, run type, role name and entry key. The path points to an actual existing entry in Consul, resolving ANY run type and any rolename wildcards.
@Tags			component configuration
@Produce		plain
@Param			component	path		string	true	"Configuration component"
@Param			runtype		path		string	true	"O² Run type, must be capitalized"
@Param			rolename	path		string	true	"Role name"
@Param			entry		path		string	true	"Entry key"
@Success		200			{string}	string	"Resolved path for the queried entry"
@Failure		400			{string}	string	"Bad request, if a parameter is invalid"
@Failure		500			{string}	string	"Internal server error"
@Router			/components/{component}/{runtype}/{rolename}/{entry}/resolve [get]

type Service

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

func NewService

func NewService(uri string) (svc *Service, err error)

func (*Service) GenerateWorkflowDescriptor

func (s *Service) GenerateWorkflowDescriptor(wfPath string, vars map[string]string) string

Returns a YAML file OR even a structure made of Roles or Nodes with: import() functions already computed and resolved vars inserted

func (*Service) GetAndProcessComponentConfiguration

func (s *Service) GetAndProcessComponentConfiguration(query *componentcfg.Query, varStack map[string]string) (payload string, err error)

func (*Service) GetCRUCardsForHost added in v0.22.0

func (s *Service) GetCRUCardsForHost(hostname string) (string, error)

func (*Service) GetComponentConfiguration

func (s *Service) GetComponentConfiguration(query *componentcfg.Query) (payload string, err error)

func (*Service) GetComponentConfigurationWithLastIndex added in v0.29.2

func (s *Service) GetComponentConfigurationWithLastIndex(query *componentcfg.Query) (payload string, lastIndex uint64, err error)

func (*Service) GetDefaults

func (s *Service) GetDefaults() map[string]string

maybe this one shouldn't exist at all, because vars should get inserted response: but not all of them! some vars will likely only get parsed at deployment time i.e. right before pushing TaskInfos

func (*Service) GetDetectorForHost added in v0.22.0

func (s *Service) GetDetectorForHost(hostname string) (string, error)

func (*Service) GetDetectorsForHosts added in v0.26.3

func (s *Service) GetDetectorsForHosts(hosts []string) ([]string, error)

func (*Service) GetDetectorsInventory added in v0.43.90

func (s *Service) GetDetectorsInventory() (inventory map[string][]string, err error)

func (*Service) GetEndpointsForCRUCard added in v0.22.0

func (s *Service) GetEndpointsForCRUCard(hostname, cardSerial string) (string, error)

func (*Service) GetHostInventory added in v0.22.80

func (s *Service) GetHostInventory(detector string) (hosts []string, err error)

func (*Service) GetRuntimeEntry

func (s *Service) GetRuntimeEntry(component string, key string) (string, error)

func (*Service) GetVars

func (s *Service) GetVars() map[string]string

func (*Service) ImportComponentConfiguration

func (s *Service) ImportComponentConfiguration(query *componentcfg.Query, payload string, newComponent bool, useVersioning bool) (existingComponentUpdated bool, existingEntryUpdated bool, newTimestamp int64, err error)

func (*Service) InvalidateComponentTemplateCache added in v1.0.0

func (s *Service) InvalidateComponentTemplateCache()

func (*Service) ListComponentEntries

func (s *Service) ListComponentEntries(query *componentcfg.EntriesQuery, showLatestTimestamp bool) (entries []string, err error)

func (*Service) ListComponentEntryHistory

func (s *Service) ListComponentEntryHistory(query *componentcfg.Query) (entries []string, err error)

func (*Service) ListComponents

func (s *Service) ListComponents() (components []string, err error)

func (*Service) ListDetectors added in v0.26.3

func (s *Service) ListDetectors(getAll bool) (detectors []string, err error)

func (*Service) ListRuntimeEntries added in v0.25.80

func (s *Service) ListRuntimeEntries(component string) ([]string, error)

func (*Service) NewRunNumber

func (s *Service) NewRunNumber() (runNumber uint32, err error)

func (*Service) RawGetRecursive

func (s *Service) RawGetRecursive(path string) (string, error)

func (*Service) ResolveComponentQuery added in v0.50.0

func (s *Service) ResolveComponentQuery(query *componentcfg.Query) (resolved *componentcfg.Query, err error)

func (*Service) SetRuntimeEntry

func (s *Service) SetRuntimeEntry(component string, key string, value string) error

Jump to

Keyboard shortcuts

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