diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2021-01-18 18:52:06 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2021-01-19 15:18:03 +0100 |
commit | a45d22a1ddd2840cf8c3a38540aa8683cc0d5c7d (patch) | |
tree | dfda1d8d5f64baa183dc0f166e2441d8719b1cc8 /pkg/bindings/network/network.go | |
parent | 5b3c7a52939275784c45c9747dd5864bd0581ff5 (diff) | |
download | podman-a45d22a1ddd2840cf8c3a38540aa8683cc0d5c7d.tar.gz podman-a45d22a1ddd2840cf8c3a38540aa8683cc0d5c7d.tar.bz2 podman-a45d22a1ddd2840cf8c3a38540aa8683cc0d5c7d.zip |
podman network exists
Add podman network exists command with remote support.
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'pkg/bindings/network/network.go')
-rw-r--r-- | pkg/bindings/network/network.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/bindings/network/network.go b/pkg/bindings/network/network.go index 7cd251b0e..8debeee84 100644 --- a/pkg/bindings/network/network.go +++ b/pkg/bindings/network/network.go @@ -167,3 +167,16 @@ func Connect(ctx context.Context, networkName string, ContainerNameOrId string, } return response.Process(nil) } + +// Exists returns true if a given network exists +func Exists(ctx context.Context, nameOrID string, options *ExistsOptions) (bool, error) { + conn, err := bindings.GetClient(ctx) + if err != nil { + return false, err + } + response, err := conn.DoRequest(nil, http.MethodGet, "/networks/%s/exists", nil, nil, nameOrID) + if err != nil { + return false, err + } + return response.IsSuccess(), nil +} |