diff options
Diffstat (limited to 'pkg/domain')
-rw-r--r-- | pkg/domain/entities/network.go | 1 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/network.go | 27 |
2 files changed, 23 insertions, 5 deletions
diff --git a/pkg/domain/entities/network.go b/pkg/domain/entities/network.go index cffd40899..d001553e0 100644 --- a/pkg/domain/entities/network.go +++ b/pkg/domain/entities/network.go @@ -36,6 +36,7 @@ type NetworkRmReport struct { } // NetworkCreateOptions describes options to create a network +// swagger:model NetworkCreateOptions type NetworkCreateOptions struct { DisableDNS bool Driver string diff --git a/pkg/domain/infra/tunnel/network.go b/pkg/domain/infra/tunnel/network.go index 4ff72dcfc..7725d8257 100644 --- a/pkg/domain/infra/tunnel/network.go +++ b/pkg/domain/infra/tunnel/network.go @@ -2,22 +2,39 @@ package tunnel import ( "context" - "errors" + "github.com/containers/libpod/pkg/bindings/network" "github.com/containers/libpod/pkg/domain/entities" ) func (ic *ContainerEngine) NetworkList(ctx context.Context, options entities.NetworkListOptions) ([]*entities.NetworkListReport, error) { - return nil, errors.New("not implemented") + return network.List(ic.ClientCxt) } func (ic *ContainerEngine) NetworkInspect(ctx context.Context, namesOrIds []string, options entities.NetworkInspectOptions) ([]entities.NetworkInspectReport, error) { - return nil, errors.New("not implemented") + var reports []entities.NetworkInspectReport + for _, name := range namesOrIds { + report, err := network.Inspect(ic.ClientCxt, name) + if err != nil { + return nil, err + } + reports = append(reports, report...) + } + return reports, nil } + func (ic *ContainerEngine) NetworkRm(ctx context.Context, namesOrIds []string, options entities.NetworkRmOptions) ([]*entities.NetworkRmReport, error) { - return nil, errors.New("not implemented") + var reports []*entities.NetworkRmReport + for _, name := range namesOrIds { + report, err := network.Remove(ic.ClientCxt, name, &options.Force) + if err != nil { + report[0].Err = err + } + reports = append(reports, report...) + } + return reports, nil } func (ic *ContainerEngine) NetworkCreate(ctx context.Context, name string, options entities.NetworkCreateOptions) (*entities.NetworkCreateReport, error) { - return nil, errors.New("not implemented") + return network.Create(ic.ClientCxt, options, &name) } |