|
@@ -107,10 +107,10 @@ func (c *Client) GetSecretMap(ctx context.Context, ref esv1.ExternalSecretDataRe
|
|
|
return out, nil
|
|
return out, nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// GetAllSecrets gets all secrets by the remote reference.
|
|
|
|
|
|
|
+// GetAllSecrets returns all secrets matching the find criteria (path, name, tags).
|
|
|
func (c *Client) GetAllSecrets(ctx context.Context, ref esv1.ExternalSecretFind) (map[string][]byte, error) {
|
|
func (c *Client) GetAllSecrets(ctx context.Context, ref esv1.ExternalSecretFind) (map[string][]byte, error) {
|
|
|
- if len(ref.Tags) == 0 && ref.Name == nil {
|
|
|
|
|
- return nil, fmt.Errorf("at least one of the following fields must be set: tags, name")
|
|
|
|
|
|
|
+ if len(ref.Tags) == 0 && ref.Name == nil && ref.Path == nil {
|
|
|
|
|
+ return nil, fmt.Errorf("at least one of the following fields must be set: tags, name, path")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var nameFilter string
|
|
var nameFilter string
|
|
@@ -123,6 +123,9 @@ func (c *Client) GetAllSecrets(ctx context.Context, ref esv1.ExternalSecretFind)
|
|
|
Labels: ref.Tags,
|
|
Labels: ref.Tags,
|
|
|
NameRegex: nameFilter,
|
|
NameRegex: nameFilter,
|
|
|
}
|
|
}
|
|
|
|
|
+ if ref.Path != nil {
|
|
|
|
|
+ searchReq.Path = *ref.Path
|
|
|
|
|
+ }
|
|
|
secrets, err := c.apiClient.ListSecrets(ctx, searchReq)
|
|
secrets, err := c.apiClient.ListSecrets(ctx, searchReq)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return nil, fmt.Errorf("failed to list secrets: %w", err)
|
|
return nil, fmt.Errorf("failed to list secrets: %w", err)
|