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 ¶
- Variables
- func Load() (string, target.TargetManagerFactory)
- func New() target.TargetManager
- type AcquireParameters
- type CSVFileTargetManager
- func (tf *CSVFileTargetManager) Acquire(ctx xcontext.Context, jobID types.JobID, ...) ([]*target.Target, error)
- func (tf *CSVFileTargetManager) Release(ctx xcontext.Context, jobID types.JobID, targets []*target.Target, ...) error
- func (tf CSVFileTargetManager) ValidateAcquireParameters(params []byte) (interface{}, error)
- func (tf CSVFileTargetManager) ValidateReleaseParameters(params []byte) (interface{}, error)
- type ReleaseParameters
Constants ¶
This section is empty.
Variables ¶
var (
Name = "CSVFileTargetManager"
)
Name defined the name of the plugin
Functions ¶
func Load ¶
func Load() (string, target.TargetManagerFactory)
Load returns the name and factory which are needed to register the TargetManager.
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.