parser

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger  *LoggerConfig  `yaml:"logger"`
	Netbox  *NetboxConfig  `yaml:"netbox"`
	Sources []SourceConfig `yaml:"source"`
}

func ParseConfig

func ParseConfig(configFilename string) (*Config, error)

type HTTPScheme

type HTTPScheme string
const (
	HTTP  HTTPScheme = "http"
	HTTPS HTTPScheme = "https"
)

type LoggerConfig

type LoggerConfig struct {
	Level int    `yaml:"level"`
	Dest  string `yaml:"dest"`
}

func (LoggerConfig) String

func (l LoggerConfig) String() string

func (*LoggerConfig) UnmarshalYAML added in v1.7.0

func (l *LoggerConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type NetboxConfig

type NetboxConfig struct {
	APIToken string `yaml:"apiToken"`
	Hostname string `yaml:"hostname"`
	Port     int    `yaml:"port"`
	// Can be http or https (default)
	HTTPScheme             HTTPScheme `yaml:"httpScheme"`
	ValidateCert           bool       `yaml:"validateCert"`
	Timeout                int        `yaml:"timeout"`
	Tag                    string     `yaml:"tag"`
	TagColor               string     `yaml:"tagColor"`
	RemoveOrphans          bool       `yaml:"removeOrphans"`
	RemoveOrphansAfterDays int        `yaml:"removeOrphansAfterDays"`
	SourcePriority         []string   `yaml:"sourcePriority"`
	CAFile                 string     `yaml:"caFile"`
}

Configuration that can be used for Netbox. In netbox block.

func (NetboxConfig) String

func (n NetboxConfig) String() string

type SourceConfig

type SourceConfig struct {
	Name             string               `yaml:"name"`
	Type             constants.SourceType `yaml:"type"`
	HTTPScheme       HTTPScheme           `yaml:"httpScheme"`
	Hostname         string               `yaml:"hostname"`
	Port             int                  `yaml:"port"`
	Username         string               `yaml:"username"`
	Password         string               `yaml:"password"`
	APIToken         string               `yaml:"apiToken"`
	ValidateCert     bool                 `yaml:"validateCert"`
	Tag              string               `yaml:"tag"`
	TagColor         string               `yaml:"tagColor"`
	IgnoredSubnets   []string             `yaml:"ignoredSubnets"`
	PermittedSubnets []string             `yaml:"permittedSubnets"`
	InterfaceFilter  string               `yaml:"interfaceFilter"`
	CollectArpData   bool                 `yaml:"collectArpData"`
	CAFile           string               `yaml:"caFile"`

	// Relations
	DatacenterClusterGroupRelations map[string]string `yaml:"datacenterClusterGroupRelations"`
	HostSiteRelations               map[string]string `yaml:"hostSiteRelations"`
	HostRoleRelations               map[string]string `yaml:"hostRoleRelations"`
	ClusterSiteRelations            map[string]string `yaml:"clusterSiteRelations"`
	ClusterTenantRelations          map[string]string `yaml:"clusterTenantRelations"`
	HostTenantRelations             map[string]string `yaml:"hostTenantRelations"`
	VMTenantRelations               map[string]string `yaml:"vmTenantRelations"`
	VMRoleRelations                 map[string]string `yaml:"vmRoleRelations"`
	VlanGroupRelations              map[string]string `yaml:"vlanGroupRelations"`
	VlanTenantRelations             map[string]string `yaml:"vlanTenantRelations"`
	WlanTenantRelations             map[string]string `yaml:"wlanTenantRelations"`
	CustomFieldMappings             map[string]string `yaml:"customFieldMappings"`
}

Configuration that can be used for each of the sources. In sources block.

func (SourceConfig) String

func (sc SourceConfig) String() string

func (*SourceConfig) UnmarshalYAML added in v1.7.0

func (sc *SourceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is a custom unmarshal function for SourceConfig. This is needed because we map relations to the map[string]string.

Jump to

Keyboard shortcuts

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