checktypes

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Import

func Import(repos []string, l log.Logger) (map[ChecktypeRef]Checktype, error)

Import loads the information of the checktypes defined in the specified repos url's.

Types

type AssetType

type AssetType int

AssetType defines the valid types of assets a check can accept.

const (
	// IP represents an IP assettype.
	IP AssetType = iota
	// Hostname represents a hostname assettype.
	Hostname
	// DomainName represents an domain name assettype.
	DomainName
	// AWSAccount represents an AWS account assettype.
	AWSAccount
	// IPRange represents an IP range assettype.
	IPRange
	// DockerImage represents a DockerImage asset type.
	DockerImage
	// WebAddress represents a WebAddress asset type.
	WebAddress
	// GitRepository represents a git repo asset type.
	GitRepository
)

func (*AssetType) MarshalText

func (a *AssetType) MarshalText() (text []byte, err error)

MarshalText returns string representation of a AssetType instance.

func (*AssetType) String

func (a *AssetType) String() (string, error)

func (*AssetType) UnmarshalText

func (a *AssetType) UnmarshalText(text []byte) error

UnmarshalText creates a AssetType from its string representation.

type AssetTypes

type AssetTypes []*AssetType

AssetTypes represents and array of asset types supported by a concrete checktype.

func (AssetTypes) Strings

func (a AssetTypes) Strings() ([]string, error)

Strings converts a slice of Assettypes into a slice of strings.

type Checktype

type Checktype struct {
	Name         string                 `json:"name"`
	Description  string                 `json:"description"`
	Timeout      int                    `json:"timeout,omitempty"`
	Image        string                 `json:"image"`
	Options      map[string]interface{} `json:"options,omitempty"`
	RequiredVars []string               `json:"required_vars"`
	QueueName    string                 `json:"queue_name,omitempty"`
	Assets       []string               `json:"assets"`
}

Checktype defines the data about a concrete checktype.

type ChecktypeRef

type ChecktypeRef string

ChecktypeRef represents a checktype with an optional prefix denoting the repository (i.e. default/vulcan-zap vulcan-zap ).

type Checktypes

type Checktypes map[ChecktypeRef]Checktype

Checktypes contains a collection of checktypes indexed by checktype name.

func (Checktypes) Checktype

func (c Checktypes) Checktype(ref ChecktypeRef) (*Checktype, error)

Checktype returns a pointer to the a Checktype given is reference if it exists, otherwise it returns an error.

type Code

type Code string

Code stores a directory path containing the definition of a checktype.

func ParseCode

func ParseCode(u string) (Code, bool)

ParseCode returns the chekcktype represented in a dir as code. if the input parameter is not an url pointing to the code of a checktype, it returns false in the second return value. An url is considered to point to the code of a checktype if it uses the schema "code".

func (Code) Build

func (c Code) Build(logger log.Logger) (string, error)

Build builds the checktype defined in a directory. It builds the binary and the docker image of the checktype and returns the name of the docker image built.

type JSONChecktypes

type JSONChecktypes struct {
	Checktypes []Checktype `json:"checktypes"`
}

JSONChecktypes defines the shape of a file containing the definition of a set of checkstypes.

type Manifest

type Manifest struct {
	Description  string
	Timeout      int
	Options      string
	RequiredVars []string
	QueueName    string
	AssetTypes   AssetTypes
}

Manifest contains all the data defined in the manifest.

func ReadManifest

func ReadManifest(path string) (Manifest, error)

ReadManifest reads a manifest file.

func (Manifest) UnmarshalOptions

func (m Manifest) UnmarshalOptions() (map[string]interface{}, error)

UnmarshalOptions returns the options interpreted as json.

Jump to

Keyboard shortcuts

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