plugin

package
v0.0.0-...-ad6f596 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EnvLogLevel     = "PLUGIN_SERVER_LOG_LEVEL"
	DefaultLogLevel = "info"

	EnvListenAddress     = "PLUGIN_SERVER_LISTEN_ADDRESS"
	DefaultListenAddress = "http://0.0.0.0:8080"
)
View Source
const APIVersion = "1.0.0"

APIVersion defines the current version of the Scanner Plugin API.

Variables

This section is empty.

Functions

func GetLogger

func GetLogger() *slog.Logger

GetLogger defines JSON logger that outputs to stdout with level loaded fom EnvLogLevel.

func Run

func Run(scanner types.Scanner)

Run starts Plugin HTTP Server and uses provided Scanner to respond to requests. Run logs data to standard output using GetLogger. This operation blocks until exit. It handles graceful termination. Server listens on address loaded from EnvListenAddress. It exists with exit code 1 on error. Run simplifies the main logic. Can only be called once.

Usage example:

import (

"github.com/openclarity/vmclarity/plugins/sdk-go/plugin"
"github.com/openclarity/vmclarity/plugins/sdk-go/types"
)

func main() {
     var myScanner types.Scanner    // your implementation of Scanner interface
     plugin.Run(myScanner)          // start server until exit
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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