csvtargetmanager

package
v0.0.0-...-aac4589 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package csvtargetmanager implements a simple target manager that parses a CSV file. The format of the CSV file is the following:

123,hostname1.example.com,1.2.3.4, 456,hostname2,,2001:db8::1

In other words, four fields: the first containing a unique ID for the device (might be identical to the IP or FQDN), next one is FQDN, and then IPv4 and IPv6. All fields except ID are optional, but many plugins require FQDN or IP fields to reach the targets over the network.

Index

Constants

This section is empty.

Variables

View Source
var (
	Name = "CSVFileTargetManager"
)

Name defined the name of the plugin

Functions

func Load

Load returns the name and factory which are needed to register the TargetManager.

func New

func New() target.TargetManager

New builds a CSVFileTargetManager

Types

type AcquireParameters

type AcquireParameters struct {
	FileURI          *xjson.URL
	MinNumberDevices uint32
	MaxNumberDevices uint32
	HostPrefixes     []string
	Shuffle          bool
}

AcquireParameters contains the parameters necessary to acquire targets.

type CSVFileTargetManager

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

CSVFileTargetManager implements the contest.TargetManager interface, reading CSV entries from a text file.

func (*CSVFileTargetManager) Acquire

func (tf *CSVFileTargetManager) Acquire(ctx xcontext.Context, jobID types.JobID, jobTargetManagerAcquireTimeout time.Duration, parameters interface{}, tl target.Locker) ([]*target.Target, error)

Acquire implements contest.TargetManager.Acquire, reading one entry per line from a text file. Each input record looks like this: ID,FQDN,IPv4,IPv6. Only ID is required

func (*CSVFileTargetManager) Release

func (tf *CSVFileTargetManager) Release(ctx xcontext.Context, jobID types.JobID, targets []*target.Target, params interface{}) error

Release releases the acquired resources.

func (CSVFileTargetManager) ValidateAcquireParameters

func (tf CSVFileTargetManager) ValidateAcquireParameters(params []byte) (interface{}, error)

ValidateAcquireParameters performs sanity checks on the fields of the parameters that will be passed to Acquire.

func (CSVFileTargetManager) ValidateReleaseParameters

func (tf CSVFileTargetManager) ValidateReleaseParameters(params []byte) (interface{}, error)

ValidateReleaseParameters performs sanity checks on the fields of the parameters that will be passed to Release.

type ReleaseParameters

type ReleaseParameters struct {
}

ReleaseParameters contains the parameters necessary to release targets.

Jump to

Keyboard shortcuts

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