spiegel_podman/pkg/domain/entities/network.go
Paul Holzinger 51fbf3da9e
enable gocritic linter
The linter ensures a common code style.
- use switch/case instead of else if
- use if instead of switch/case for single case statement
- add space between comment and text
- detect the use of defer with os.Exit()
- use short form var += "..." instead of var = var + "..."
- detect problems with append()
```
newSlice := append(orgSlice, val)
```
  This could lead to nasty bugs because the orgSlice will be changed in
  place if it has enough capacity too hold the new elements. Thus we
  newSlice might not be a copy.

Of course most of the changes are just cosmetic and do not cause any
logic errors but I think it is a good idea to enforce a common style.
This should help maintainability.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-26 18:12:22 +02:00

88 lines
1.9 KiB
Go

package entities
import (
"net"
"github.com/containers/common/libnetwork/types"
)
// NetworkListOptions describes options for listing networks in cli
type NetworkListOptions struct {
Format string
Quiet bool
Filters map[string][]string
}
// NetworkReloadOptions describes options for reloading container network
// configuration.
type NetworkReloadOptions struct {
All bool
Latest bool
}
// NetworkReloadReport describes the results of reloading a container network.
type NetworkReloadReport struct {
// nolint:stylecheck,revive
Id string
Err error
}
// NetworkRmOptions describes options for removing networks
type NetworkRmOptions struct {
Force bool
Timeout *uint
}
// NetworkRmReport describes the results of network removal
type NetworkRmReport struct {
Name string
Err error
}
// NetworkCreateOptions describes options to create a network
type NetworkCreateOptions struct {
DisableDNS bool
Driver string
Gateways []net.IP
Internal bool
Labels map[string]string
MacVLAN string
Ranges []string
Subnets []string
IPv6 bool
// Mapping of driver options and values.
Options map[string]string
}
// NetworkCreateReport describes a created network for the cli
type NetworkCreateReport struct {
Name string
}
// NetworkDisconnectOptions describes options for disconnecting
// containers from networks
type NetworkDisconnectOptions struct {
Container string
Force bool
}
// NetworkConnectOptions describes options for connecting
// a container to a network
type NetworkConnectOptions struct {
Container string `json:"container"`
types.PerNetworkOptions
}
// NetworkPruneReport containers the name of network and an error
// associated in its pruning (removal)
// swagger:model NetworkPruneReport
type NetworkPruneReport struct {
Name string
Error error
}
// NetworkPruneOptions describes options for pruning
// unused cni networks
type NetworkPruneOptions struct {
Filters map[string][]string
}