summaryrefslogtreecommitdiff
path: root/pkg/bindings/volumes/volumes.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/bindings/volumes/volumes.go')
-rw-r--r--pkg/bindings/volumes/volumes.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/bindings/volumes/volumes.go b/pkg/bindings/volumes/volumes.go
index fe081eb46..60fdd0a23 100644
--- a/pkg/bindings/volumes/volumes.go
+++ b/pkg/bindings/volumes/volumes.go
@@ -114,3 +114,16 @@ func Remove(ctx context.Context, nameOrID string, options *RemoveOptions) error
}
return response.Process(nil)
}
+
+// Exists returns true if a given volume 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, "/volumes/%s/exists", nil, nil, nameOrID)
+ if err != nil {
+ return false, err
+ }
+ return response.IsSuccess(), nil
+}