{"modulePath":"github.com/cloudnativelabs/libnetwork","version":"v0.5.6","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package driverapi\n\n## Constants\n\n```go\nconst NetworkPluginEndpointType = \"NetworkDriver\"\n```\nNetworkPluginEndpointType represents the Endpoint Type used by Plugin system\n\n```go\nconst (\n\t// NodeDiscovery represents Node join/leave events provided by discovery\n\tNodeDiscovery = iota + 1\n)\n```\n\n## Types\n\n```go\ntype Capability struct {\n\tDataScope string\n}\n```\nCapability represents the high level capabilities of the drivers which libnetwork can make use of\n\n```go\ntype DiscoveryType int\n```\nDiscoveryType represents the type of discovery element the DiscoverNew function is invoked on\n\n```go\ntype Driver interface {\n\t// CreateNetwork invokes the driver method to create a network passing\n\t// the network id and network specific config. The config mechanism will\n\t// eventually be replaced with labels which are yet to be introduced.\n\tCreateNetwork(nid string, options map[string]interface{}, ipV4Data, ipV6Data []IPAMData) error\n\n\t// DeleteNetwork invokes the driver method to delete network passing\n\t// the network id.\n\tDeleteNetwork(nid string) error\n\n\t// CreateEndpoint invokes the driver method to create an endpoint\n\t// passing the network id, endpoint id endpoint information and driver\n\t// specific config. The endpoint information can be either consumed by\n\t// the driver or populated by the driver. The config mechanism will\n\t// eventually be replaced with labels which are yet to be introduced.\n\tCreateEndpoint(nid, eid string, ifInfo InterfaceInfo, options map[string]interface{}) error\n\n\t// DeleteEndpoint invokes the driver method to delete an endpoint\n\t// passing the network id and endpoint id.\n\tDeleteEndpoint(nid, eid string) error\n\n\t// EndpointOperInfo retrieves from the driver the operational data related to the specified endpoint\n\tEndpointOperInfo(nid, eid string) (map[string]interface{}, error)\n\n\t// Join method is invoked when a Sandbox is attached to an endpoint.\n\tJoin(nid, eid string, sboxKey string, jinfo JoinInfo, options map[string]interface{}) error\n\n\t// Leave method is invoked when a Sandbox detaches from an endpoint.\n\tLeave(nid, eid string) error\n\n\t// DiscoverNew is a notification for a new discovery event, Example:a new node joining a cluster\n\tDiscoverNew(dType DiscoveryType, data interface{}) error\n\n\t// DiscoverDelete is a notification for a discovery delete event, Example:a node leaving a cluster\n\tDiscoverDelete(dType DiscoveryType, data interface{}) error\n\n\t// Type returns the the type of this driver, the network type this driver manages\n\tType() string\n}\n```\nDriver is an interface that every plugin driver needs to implement.\n\n```go\ntype DriverCallback interface {\n\t// RegisterDriver provides a way for Remote drivers to dynamically register new NetworkType and associate with a driver instance\n\tRegisterDriver(name string, driver Driver, capability Capability) error\n}\n```\nDriverCallback provides a Callback interface for Drivers into LibNetwork\n\n```go\ntype ErrActiveRegistration string\n```\nErrActiveRegistration represents an error when a driver is registered to a networkType that is previously registered\n\n```go\nfunc (ar ErrActiveRegistration) Error() string\n```\nError interface for ErrActiveRegistration\n\n```go\nfunc (ar ErrActiveRegistration) Forbidden()\n```\nForbidden denotes the type of this error\n\n```go\ntype ErrEndpointExists string\n```\nErrEndpointExists is returned if more than one endpoint is added to the network\n\n```go\nfunc (ee ErrEndpointExists) Error() string\n```\n\n```go\nfunc (ee ErrEndpointExists) Forbidden()\n```\nForbidden denotes the type of this error\n\n```go\ntype ErrNoEndpoint string\n```\nErrNoEndpoint is returned if no endpoint with the specified id exists\n\n```go\nfunc (ene ErrNoEndpoint) Error() string\n```\n\n```go\nfunc (ene ErrNoEndpoint) NotFound()\n```\nNotFound denotes the type of this error\n\n```go\ntype ErrNoNetwork string\n```\nErrNoNetwork is returned if no network with the specified id exists\n\n```go\nfunc (enn ErrNoNetwork) Error() string\n```\n\n```go\nfunc (enn ErrNoNetwork) NotFound()\n```\nNotFound denotes the type of this error\n\n```go\ntype ErrNotImplemented struct{}\n```\nErrNotImplemented is returned when a Driver has not implemented an API yet\n\n```go\nfunc (eni *ErrNotImplemented) Error() string\n```\n\n```go\nfunc (eni *ErrNotImplemented) NotImplemented()\n```\nNotImplemented denotes the type of this error\n\n```go\ntype IPAMData struct {\n\tAddressSpace string\n\tPool         *net.IPNet\n\tGateway      *net.IPNet\n\tAuxAddresses map[string]*net.IPNet\n}\n```\nIPAMData represents the per-network ip related operational information libnetwork will send to the network driver during CreateNetwork()\n\n```go\nfunc (i *IPAMData) IsV6() bool\n```\nIsV6 returns wheter this is an IPv6 IPAMData structure\n\n```go\nfunc (i *IPAMData) MarshalJSON() ([]byte, error)\n```\nMarshalJSON encodes IPAMData into json message\n\n```go\nfunc (i *IPAMData) String() string\n```\n\n```go\nfunc (i *IPAMData) UnmarshalJSON(data []byte) error\n```\nUnmarshalJSON decodes a json message into IPAMData\n\n```go\nfunc (i *IPAMData) Validate() error\n```\nValidate checks wheter the IPAMData structure contains congruent data\n\n```go\ntype InterfaceInfo interface {\n\t// SetMacAddress allows the driver to set the mac address to the endpoint interface\n\t// during the call to CreateEndpoint, if the mac address is not already set.\n\tSetMacAddress(mac net.HardwareAddr) error\n\n\t// SetIPAddress allows the driver to set the ip address to the endpoint interface\n\t// during the call to CreateEndpoint, if the address is not already set.\n\t// The API is to be used to assign both the IPv4 and IPv6 address types.\n\tSetIPAddress(ip *net.IPNet) error\n\n\t// MacAddress returns the MAC address.\n\tMacAddress() net.HardwareAddr\n\n\t// Address returns the IPv4 address.\n\tAddress() *net.IPNet\n\n\t// AddressIPv6 returns the IPv6 address.\n\tAddressIPv6() *net.IPNet\n}\n```\nInterfaceInfo provides a go interface for drivers to retrive network information to interface resources.\n\n```go\ntype InterfaceNameInfo interface {\n\t// SetNames method assigns the srcName and dstPrefix for the interface.\n\tSetNames(srcName, dstPrefix string) error\n}\n```\nInterfaceNameInfo provides a go interface for the drivers to assign names to interfaces.\n\n```go\ntype JoinInfo interface {\n\t// InterfaceName returns a InterfaceNameInfo go interface to facilitate\n\t// setting the names for the interface.\n\tInterfaceName() InterfaceNameInfo\n\n\t// SetGateway sets the default IPv4 gateway when a container joins the endpoint.\n\tSetGateway(net.IP) error\n\n\t// SetGatewayIPv6 sets the default IPv6 gateway when a container joins the endpoint.\n\tSetGatewayIPv6(net.IP) error\n\n\t// AddStaticRoute adds a routes to the sandbox.\n\t// It may be used in addtion to or instead of a default gateway (as above).\n\tAddStaticRoute(destination *net.IPNet, routeType int, nextHop net.IP) error\n\n\t// DisableGatewayService tells libnetwork not to provide Default GW for the container\n\tDisableGatewayService()\n}\n```\nJoinInfo represents a set of resources that the driver has the ability to provide during join time.\n\n```go\ntype NodeDiscoveryData struct {\n\tAddress string\n\tSelf    bool\n}\n```\nNodeDiscoveryData represents the structure backing the node discovery data json string\n\n","path":"github.com/cloudnativelabs/libnetwork/driverapi","name":"driverapi","synopsis":"","isRedistributable":true}
