network

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerFactory

type DockerFactory struct {
	ClientFactory composeclient.Factory
}

DockerFactory implements project.NetworksFactory

func (*DockerFactory) Create

func (f *DockerFactory) Create(projectName string, networkConfigs map[string]*config.NetworkConfig, serviceConfigs *config.ServiceConfigs, networkEnabled bool) (project.Networks, error)

Create implements project.NetworksFactory Create method. It creates a Networks (that implements project.Networks) from specified configurations.

type Network

type Network struct {
	// contains filtered or unexported fields
}

Network holds attributes and method for a network definition in compose

func NewNetwork

func NewNetwork(projectName, name string, config *config.NetworkConfig, client client.NetworkAPIClient) *Network

NewNetwork creates a new network from the specified name and config.

func (*Network) EnsureItExists

func (n *Network) EnsureItExists(ctx context.Context) error

EnsureItExists make sure the network exists and return an error if it does not exists and cannot be created.

func (*Network) Inspect

func (n *Network) Inspect(ctx context.Context) (types.NetworkResource, error)

Inspect inspect the current network

func (*Network) Remove

func (n *Network) Remove(ctx context.Context) error

Remove removes the current network (from docker engine)

type Networks

type Networks struct {
	// contains filtered or unexported fields
}

Networks holds a list of network

func NetworksFromServices

func NetworksFromServices(cli client.NetworkAPIClient, projectName string, networkConfigs map[string]*config.NetworkConfig, services *config.ServiceConfigs, networkEnabled bool) (*Networks, error)

NetworksFromServices creates a new Networks struct based on networks configurations and services configuration. If a network is defined but not used by any service, it will return an error along the Networks.

func (*Networks) Initialize

func (n *Networks) Initialize(ctx context.Context) error

Initialize make sure network exists if network is enabled

func (*Networks) Remove

func (n *Networks) Remove(ctx context.Context) error

Remove removes networks (clean-up)

Jump to

Keyboard shortcuts

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