adapters

package
v0.0.0-...-ff6eb74 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

README

Version Adapters

Adapters are a good and simple way to extend the possibilities of fetching versions. There are already some simple adapters, please have a look at the example config to get an idea how they work.

Add a new Adapter

In order to add a new Adapter you need to ...

  1. have a proper adapter folder structure. Currently all adapters are ordered by its technology and transport/method (e.g. http is the technology and transport is get, so the adapter lives in pkg/adapters/http/get/adapter.go` but this is NOT a requirement. If you feel like there could be multiple adapters for the same technology (like multiple transports, methods, commands, ...) then make sure to have a nested adapter pattern already applied.
  2. register the AdapterConstructor for your AdapterType in adapters.go. Each AdapterType has to be a unique string and should be defined in the same package as the Adapter and its AdapterConstructor.
  3. Have all required config parameters defined in the config. Remember: Config is parsed from YAML, so all kinds of fancy nested types are supported.
  4. Have a decent test coverage for your adapter: go test ./... -cover
Adapter Example

For a pretty simple adapter have a look on the ShellCommandAdapter:

Documentation

Index

Constants

This section is empty.

Variables

Registry of all loaded adapters

Functions

func Register

func Register(logger *logrus.Logger) error

Register all adapters using their constructors

Types

type AdapterConstructor

type AdapterConstructor func(logger logging.Logger) (monitor.Adapter, error)

AdapterConstructor constructs a new adapter

Directories

Path Synopsis
github
http
get
kubernetes
shell

Jump to

Keyboard shortcuts

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