Documentation ¶
Index ¶
- Constants
- func GetArg(name string) interface{}
- func LogNetworkInterfaces()
- func ParseArgs(args *ArgumentList, usage func())
- type Argument
- type ArgumentList
- type IpamApi
- type Listener
- func (listener *Listener) AddEndpoint(endpoint string)
- func (listener *Listener) AddHandler(path string, handler func(http.ResponseWriter, *http.Request))
- func (listener *Listener) Decode(w http.ResponseWriter, r *http.Request, request interface{}) error
- func (listener *Listener) Encode(w http.ResponseWriter, response interface{}) error
- func (listener *Listener) GetEndpoints() []string
- func (listener *Listener) GetMux() *http.ServeMux
- func (listener *Listener) Start(errChan chan error) error
- func (listener *Listener) Stop()
- type NetApi
- type Plugin
- type PluginApi
- type PluginConfig
- type XmlDocument
Constants ¶
const ( // Operating environment. OptEnvironment = "environment" OptEnvironmentAlias = "e" OptEnvironmentAzure = "azure" OptEnvironmentMAS = "mas" // API server URL. OptAPIServerURL = "api-url" OptAPIServerURLAlias = "u" // Logging level. OptLogLevel = "log-level" OptLogLevelAlias = "l" OptLogLevelInfo = "info" OptLogLevelDebug = "debug" // Logging target. OptLogTarget = "log-target" OptLogTargetAlias = "t" OptLogTargetSyslog = "syslog" OptLogTargetStderr = "stderr" OptLogTargetFile = "logfile" // IPAM query URL. OptIpamQueryUrl = "ipam-query-url" OptIpamQueryUrlAlias = "q" // IPAM query interval. OptIpamQueryInterval = "ipam-query-interval" OptIpamQueryIntervalAlias = "i" // Version. OptVersion = "version" OptVersionAlias = "v" // Help. OptHelp = "help" OptHelpAlias = "h" )
Command line options.
Variables ¶
This section is empty.
Functions ¶
func GetArg ¶
func GetArg(name string) interface{}
GetArg returns the parsed value of the given argument.
func LogNetworkInterfaces ¶
func LogNetworkInterfaces()
LogNetworkInterfaces logs the host's network interfaces in the default namespace.
func ParseArgs ¶
func ParseArgs(args *ArgumentList, usage func())
ParseArgs parses and validates command line arguments based on rules in the given ArgumentList.
Types ¶
type Argument ¶
type Argument struct { Name string Shorthand string Description string Type string DefaultValue interface{} Value interface{} ValueMap map[string]interface{} // contains filtered or unexported fields }
Argument represents a command line argument.
type ArgumentList ¶
type ArgumentList []*Argument
ArgumentList represents a set of command line arguments.
type Listener ¶
Listener represents an HTTP listener.
func NewListener ¶
NewListener creates a new Listener.
func (*Listener) AddEndpoint ¶
AddEndpoint registers a protocol endpoint.
func (*Listener) AddHandler ¶
AddHandler registers a protocol handler.
func (*Listener) Encode ¶
func (listener *Listener) Encode(w http.ResponseWriter, response interface{}) error
Encode encodes and sends a response as JSON payload.
func (*Listener) GetEndpoints ¶
GetEndpoints returns the list of registered protocol endpoints.
type Plugin ¶
type Plugin struct { Name string Version string Options map[string]interface{} ErrChan chan error Store store.KeyValueStore }
Plugin is the parent class that implements behavior common to all plugins.
func (*Plugin) Initialize ¶
func (plugin *Plugin) Initialize(config *PluginConfig) error
Initialize initializes the plugin.
func (*Plugin) Uninitialize ¶
func (plugin *Plugin) Uninitialize()
Uninitialize cleans up the plugin.
type PluginApi ¶
type PluginApi interface { Start(*PluginConfig) error Stop() GetOption(string) interface{} SetOption(string, interface{}) }
Plugin base interface.
type PluginConfig ¶
type PluginConfig struct { Version string NetApi NetApi IpamApi IpamApi Listener *Listener ErrChan chan error Store store.KeyValueStore }
Plugin common configuration.
type XmlDocument ¶
type XmlDocument struct { XMLName xml.Name `xml:"Interfaces"` Interface []struct { XMLName xml.Name `xml:"Interface"` MacAddress string `xml:"MacAddress,attr"` IsPrimary bool `xml:"IsPrimary,attr"` IPSubnet []struct { XMLName xml.Name `xml:"IPSubnet"` Prefix string `xml:"Prefix,attr"` IPAddress []struct { XMLName xml.Name `xml:"IPAddress"` Address string `xml:"Address,attr"` IsPrimary bool `xml:"IsPrimary,attr"` } } } }
Azure host agent XML document format.