network

package
v3.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, networkName string, ContainerNameOrID string, options *ConnectOptions) error

Connect adds a container to a network

func Create

Create makes a new CNI network configuration

func Disconnect

func Disconnect(ctx context.Context, networkName string, ContainerNameOrID string, options *DisconnectOptions) error

Disconnect removes a container from a given network

func Exists added in v3.1.0

func Exists(ctx context.Context, nameOrID string, options *ExistsOptions) (bool, error)

Exists returns true if a given network exists

func Inspect

func Inspect(ctx context.Context, nameOrID string, options *InspectOptions) ([]entities.NetworkInspectReport, error)

Inspect returns low level information about a CNI network configuration

func List

func List(ctx context.Context, options *ListOptions) ([]*entities.NetworkListReport, error)

List returns a summary of all CNI network configurations

func Prune added in v3.1.0

func Prune(ctx context.Context, options *PruneOptions) ([]*entities.NetworkPruneReport, error)

Prune removes unused CNI networks

func Remove

func Remove(ctx context.Context, nameOrID string, options *RemoveOptions) ([]*entities.NetworkRmReport, error)

Remove deletes a defined CNI network configuration by name. The optional force boolean will remove all containers associated with the network when set to true. A slice of NetworkRemoveReports are returned.

Types

type ConnectOptions

type ConnectOptions struct {
	// Aliases are names the container will be known as
	// when using the dns plugin
	Aliases *[]string
}

ConnectOptions are optional options for connecting containers from a network

func (*ConnectOptions) Changed

func (o *ConnectOptions) Changed(fieldName string) bool

Changed

func (*ConnectOptions) GetAliases

func (o *ConnectOptions) GetAliases() []string

GetAliases

func (*ConnectOptions) ToParams

func (o *ConnectOptions) ToParams() (url.Values, error)

ToParams

func (*ConnectOptions) WithAliases

func (o *ConnectOptions) WithAliases(value []string) *ConnectOptions

WithAliases

type CreateOptions

type CreateOptions struct {
	// DisableDNS turns off use of DNSMasq for name resolution
	// on the network
	DisableDNS *bool
	// Driver is the name of network driver
	Driver *string
	// Gateway of the network
	Gateway *net.IP
	// Internal turns off communication outside the networking
	// being created
	Internal *bool
	// Labels are metadata that can be associated with the network
	Labels map[string]string
	// MacVLAN is the name of the macvlan network to associate with
	MacVLAN *string
	// Range is the CIDR description of leasable IP addresses
	IPRange *net.IPNet `scheme:"range"`
	// Subnet to use
	Subnet *net.IPNet
	// IPv6 means the network is ipv6 capable
	IPv6 *bool
	// Options are a mapping of driver options and values.
	Options map[string]string
	// Name of the network
	Name *string
}

CreateOptions are optional options for creating networks

func (*CreateOptions) Changed

func (o *CreateOptions) Changed(fieldName string) bool

Changed

func (*CreateOptions) GetDisableDNS

func (o *CreateOptions) GetDisableDNS() bool

GetDisableDNS

func (*CreateOptions) GetDriver

func (o *CreateOptions) GetDriver() string

GetDriver

func (*CreateOptions) GetGateway

func (o *CreateOptions) GetGateway() net.IP

GetGateway

func (*CreateOptions) GetIPRange

func (o *CreateOptions) GetIPRange() net.IPNet

GetIPRange

func (*CreateOptions) GetIPv6

func (o *CreateOptions) GetIPv6() bool

GetIPv6

func (*CreateOptions) GetInternal

func (o *CreateOptions) GetInternal() bool

GetInternal

func (*CreateOptions) GetLabels

func (o *CreateOptions) GetLabels() map[string]string

GetLabels

func (*CreateOptions) GetMacVLAN

func (o *CreateOptions) GetMacVLAN() string

GetMacVLAN

func (*CreateOptions) GetName

func (o *CreateOptions) GetName() string

GetName

func (*CreateOptions) GetOptions

func (o *CreateOptions) GetOptions() map[string]string

GetOptions

func (*CreateOptions) GetSubnet

func (o *CreateOptions) GetSubnet() net.IPNet

GetSubnet

func (*CreateOptions) ToParams

func (o *CreateOptions) ToParams() (url.Values, error)

ToParams

func (*CreateOptions) WithDisableDNS

func (o *CreateOptions) WithDisableDNS(value bool) *CreateOptions

WithDisableDNS

func (*CreateOptions) WithDriver

func (o *CreateOptions) WithDriver(value string) *CreateOptions

WithDriver

func (*CreateOptions) WithGateway

func (o *CreateOptions) WithGateway(value net.IP) *CreateOptions

WithGateway

func (*CreateOptions) WithIPRange

func (o *CreateOptions) WithIPRange(value net.IPNet) *CreateOptions

WithIPRange

func (*CreateOptions) WithIPv6

func (o *CreateOptions) WithIPv6(value bool) *CreateOptions

WithIPv6

func (*CreateOptions) WithInternal

func (o *CreateOptions) WithInternal(value bool) *CreateOptions

WithInternal

func (*CreateOptions) WithLabels

func (o *CreateOptions) WithLabels(value map[string]string) *CreateOptions

WithLabels

func (*CreateOptions) WithMacVLAN

func (o *CreateOptions) WithMacVLAN(value string) *CreateOptions

WithMacVLAN

func (*CreateOptions) WithName

func (o *CreateOptions) WithName(value string) *CreateOptions

WithName

func (*CreateOptions) WithOptions

func (o *CreateOptions) WithOptions(value map[string]string) *CreateOptions

WithOptions

func (*CreateOptions) WithSubnet

func (o *CreateOptions) WithSubnet(value net.IPNet) *CreateOptions

WithSubnet

type DisconnectOptions

type DisconnectOptions struct {
	// Force indicates to remove the container from
	// the network forcibly
	Force *bool
}

DisconnectOptions are optional options for disconnecting containers from a network

func (*DisconnectOptions) Changed

func (o *DisconnectOptions) Changed(fieldName string) bool

Changed

func (*DisconnectOptions) GetForce

func (o *DisconnectOptions) GetForce() bool

GetForce

func (*DisconnectOptions) ToParams

func (o *DisconnectOptions) ToParams() (url.Values, error)

ToParams

func (*DisconnectOptions) WithForce

func (o *DisconnectOptions) WithForce(value bool) *DisconnectOptions

WithForce

type ExistsOptions added in v3.1.0

type ExistsOptions struct {
}

ExistsOptions are optional options for checking if a network exists

func (*ExistsOptions) Changed added in v3.1.0

func (o *ExistsOptions) Changed(fieldName string) bool

Changed

func (*ExistsOptions) ToParams added in v3.1.0

func (o *ExistsOptions) ToParams() (url.Values, error)

ToParams

type InspectOptions

type InspectOptions struct {
}

InspectOptions are optional options for inspecting networks

func (*InspectOptions) Changed

func (o *InspectOptions) Changed(fieldName string) bool

Changed

func (*InspectOptions) ToParams

func (o *InspectOptions) ToParams() (url.Values, error)

ToParams

type ListOptions

type ListOptions struct {
	// Filters are applied to the list of networks to be more
	// specific on the output
	Filters map[string][]string
}

ListOptions are optional options for listing networks

func (*ListOptions) Changed

func (o *ListOptions) Changed(fieldName string) bool

Changed

func (*ListOptions) GetFilters

func (o *ListOptions) GetFilters() map[string][]string

GetFilters

func (*ListOptions) ToParams

func (o *ListOptions) ToParams() (url.Values, error)

ToParams

func (*ListOptions) WithFilters

func (o *ListOptions) WithFilters(value map[string][]string) *ListOptions

WithFilters

type PruneOptions added in v3.1.0

type PruneOptions struct {
}

PruneOptions are optional options for removing unused CNI networks

func (*PruneOptions) Changed added in v3.1.0

func (o *PruneOptions) Changed(fieldName string) bool

Changed

func (*PruneOptions) ToParams added in v3.1.0

func (o *PruneOptions) ToParams() (url.Values, error)

ToParams

type RemoveOptions

type RemoveOptions struct {
	// Force removes the network even if it is being used
	Force *bool
}

RemoveOptions are optional options for inspecting networks

func (*RemoveOptions) Changed

func (o *RemoveOptions) Changed(fieldName string) bool

Changed

func (*RemoveOptions) GetForce

func (o *RemoveOptions) GetForce() bool

GetForce

func (*RemoveOptions) ToParams

func (o *RemoveOptions) ToParams() (url.Values, error)

ToParams

func (*RemoveOptions) WithForce

func (o *RemoveOptions) WithForce(value bool) *RemoveOptions

WithForce

Jump to

Keyboard shortcuts

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