2018-02-05 16:05:59 -05:00
|
|
|
package network // import "github.com/docker/docker/api/server/router/network"
|
2015-10-26 14:47:48 -07:00
|
|
|
|
|
|
|
import (
|
2018-04-19 15:30:59 -07:00
|
|
|
"context"
|
2017-04-11 12:52:33 -07:00
|
|
|
|
2016-09-06 11:46:37 -07:00
|
|
|
"github.com/docker/docker/api/types"
|
2016-11-16 21:46:37 -08:00
|
|
|
"github.com/docker/docker/api/types/filters"
|
2016-09-06 11:46:37 -07:00
|
|
|
"github.com/docker/docker/api/types/network"
|
2015-10-26 14:47:48 -07:00
|
|
|
"github.com/docker/libnetwork"
|
|
|
|
)
|
|
|
|
|
2015-12-30 18:20:41 +01:00
|
|
|
// Backend is all the methods that need to be implemented
|
|
|
|
// to provide network specific functionality.
|
2015-10-26 14:47:48 -07:00
|
|
|
type Backend interface {
|
2018-01-15 17:26:43 +00:00
|
|
|
FindNetwork(idName string) (libnetwork.Network, error)
|
2018-05-23 10:03:02 -04:00
|
|
|
GetNetworks(filters.Args, types.NetworkListConfig) ([]types.NetworkResource, error)
|
2016-04-13 10:33:46 +02:00
|
|
|
CreateNetwork(nc types.NetworkCreateRequest) (*types.NetworkCreateResponse, error)
|
2016-01-07 16:18:34 -08:00
|
|
|
ConnectContainerToNetwork(containerName, networkName string, endpointConfig *network.EndpointSettings) error
|
2016-08-26 13:08:28 -07:00
|
|
|
DisconnectContainerFromNetwork(containerName string, networkName string, force bool) error
|
2017-10-31 19:46:53 +00:00
|
|
|
DeleteNetwork(networkID string) error
|
2017-04-11 12:52:33 -07:00
|
|
|
NetworksPrune(ctx context.Context, pruneFilters filters.Args) (*types.NetworksPruneReport, error)
|
2015-10-26 14:47:48 -07:00
|
|
|
}
|
2018-04-20 11:06:40 +02:00
|
|
|
|
|
|
|
// ClusterBackend is all the methods that need to be implemented
|
|
|
|
// to provide cluster network specific functionality.
|
|
|
|
type ClusterBackend interface {
|
2018-05-23 10:03:02 -04:00
|
|
|
GetNetworks(filters.Args) ([]types.NetworkResource, error)
|
2018-04-20 11:06:40 +02:00
|
|
|
GetNetwork(name string) (types.NetworkResource, error)
|
|
|
|
GetNetworksByName(name string) ([]types.NetworkResource, error)
|
|
|
|
CreateNetwork(nc types.NetworkCreateRequest) (string, error)
|
|
|
|
RemoveNetwork(name string) error
|
|
|
|
}
|