Add support for recursive listing (#885)
This commit is contained in:
1 parent
1f9fcad1cd
commit
6cd97a4a6e
77 files changed
+2244
-1448
No files matched your search
@@ -2,6 +2,7 @@ package scopes
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/hashicorp/boundary/api"
|
||||
)
|
||||
@@ -20,6 +21,7 @@ type options struct {
|
||||
queryMap map[string]string
|
||||
withAutomaticVersioning bool
|
||||
withSkipCurlOutput bool
|
||||
withRecursive bool
|
||||
}
|
||||
|
||||
func getDefaultOptions() options {
|
||||
@@ -38,6 +40,9 @@ func getOpts(opt ...Option) (options, []api.Option) {
|
||||
if opts.withSkipCurlOutput {
|
||||
apiOpts = append(apiOpts, api.WithSkipCurlOutput(true))
|
||||
}
|
||||
if opts.withRecursive {
|
||||
opts.queryMap["recursive"] = strconv.FormatBool(opts.withRecursive)
|
||||
}
|
||||
return opts, apiOpts
|
||||
}
|
||||
|
||||
@@ -59,6 +64,14 @@ func WithSkipCurlOutput(skip bool) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// WithRecursive tells the API to use recursion for listing operations on this
|
||||
// resource
|
||||
func WithRecursive(recurse bool) Option {
|
||||
return func(o *options) {
|
||||
o.withRecursive = true
|
||||
}
|
||||
}
|
||||
|
||||
func WithDescription(inDescription string) Option {
|
||||
return func(o *options) {
|
||||
o.postMap["description"] = inDescription
|
||||
|
||||
Reference in new issue
Block a user