internal/host: add pagination options
Add options to support pagination of hosts, host sets and host catalogs.
This commit is contained in:
1 parent
21c593ab71
commit
faf7ebce85
4 files changed
+77
-6
No files matched your search
@@ -3,7 +3,10 @@
|
||||
|
||||
package plugin
|
||||
|
||||
import "google.golang.org/protobuf/types/known/structpb"
|
||||
import (
|
||||
"github.com/hashicorp/boundary/internal/pagination"
|
||||
"google.golang.org/protobuf/types/known/structpb"
|
||||
)
|
||||
|
||||
// getOpts - iterate the inbound Options and return a struct
|
||||
func getOpts(opt ...Option) options {
|
||||
@@ -33,6 +36,7 @@ type options struct {
|
||||
withLimit int
|
||||
withSetIds []string
|
||||
withSecretsHmac []byte
|
||||
withStartPageAfterItem pagination.Item
|
||||
}
|
||||
|
||||
func getDefaultOptions() options {
|
||||
@@ -141,3 +145,11 @@ func WithSecretsHmac(secretsHmac []byte) Option {
|
||||
o.withSecretsHmac = secretsHmac
|
||||
}
|
||||
}
|
||||
|
||||
// WithStartPageAfterItem is used to paginate over the results.
|
||||
// The next page will start after the provided item.
|
||||
func WithStartPageAfterItem(item pagination.Item) Option {
|
||||
return func(o *options) {
|
||||
o.withStartPageAfterItem = item
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user