Client cache API paging (#5107)
* internal/clientcache: add -force-reset-schema flag * clientcache: stream list pages directly to DB --------- Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> (cherry picked from commit ccea8a4ce53f7b0d1105c1c1e4875e443635d96a)
This commit is contained in:
1 parent
3a4ee032d9
commit
2945692bf4
54 files changed
+793
-397
No files matched your search
@@ -325,7 +325,12 @@ func (c *Client) List(ctx context.Context, credentialStoreId string, opt ...Opti
|
||||
opts, apiOpts := getOpts(opt...)
|
||||
opts.queryMap["credential_store_id"] = credentialStoreId
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "GET", "credentials", nil, apiOpts...)
|
||||
requestPath := "credentials"
|
||||
if opts.withResourcePathOverride != "" {
|
||||
requestPath = opts.withResourcePathOverride
|
||||
}
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "GET", requestPath, nil, apiOpts...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating List request: %w", err)
|
||||
}
|
||||
@@ -474,7 +479,12 @@ func (c *Client) ListNextPage(ctx context.Context, currentPage *CredentialListRe
|
||||
opts.queryMap["page_size"] = strconv.FormatUint(uint64(currentPage.pageSize), 10)
|
||||
}
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "GET", "credentials", nil, apiOpts...)
|
||||
requestPath := "credentials"
|
||||
if opts.withResourcePathOverride != "" {
|
||||
requestPath = opts.withResourcePathOverride
|
||||
}
|
||||
|
||||
req, err := c.client.NewRequest(ctx, "GET", requestPath, nil, apiOpts...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating List request: %w", err)
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ type options struct {
|
||||
withListToken string
|
||||
withClientDirectedPagination bool
|
||||
withPageSize uint32
|
||||
withResourcePathOverride string
|
||||
}
|
||||
|
||||
func getDefaultOptions() options {
|
||||
@@ -111,6 +112,13 @@ func WithPageSize(with uint32) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// WithResourcePathOverride tells the API to use the provided resource path
|
||||
func WithResourcePathOverride(path string) Option {
|
||||
return func(o *options) {
|
||||
o.withResourcePathOverride = path
|
||||
}
|
||||
}
|
||||
|
||||
func WithAttributes(inAttributes map[string]interface{}) Option {
|
||||
return func(o *options) {
|
||||
o.postMap["attributes"] = inAttributes
|
||||
|
||||
Reference in new issue
Block a user