Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v14] Update generic storage service to support validation and custom keys #46453

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

rosstimothy
Copy link
Contributor

Backport #46319 to branch/v14

@rosstimothy rosstimothy added backport no-changelog Indicates that a PR does not require a changelog entry labels Sep 10, 2024
@rosstimothy rosstimothy changed the title Update generic storage service to support validation and custom keys [v14] Update generic storage service to support validation and custom keys Sep 10, 2024
…46319)

Adds two new optional configuration options to the generic.Service:
ValidateFunc and KeyFunc.

ValidateFunc is a custom function that is called prior to persisting
a resource in the backend. If the function returns an error, the
resource is not stored and the error is returned to users.

KeyFunc is a custom function used to derive the key for a particular
resource. By default the generic service uses the metadata name as
the key, however, in some scenarios more control over the key might
be desired. For instance, a singleton resource might want to enforce
that the key is also a static value instead of something that a
user may supply.
@rosstimothy rosstimothy marked this pull request as ready for review September 10, 2024 19:36
@rosstimothy rosstimothy added this pull request to the merge queue Sep 11, 2024
Merged via the queue into branch/v14 with commit 0e4a899 Sep 11, 2024
30 checks passed
@rosstimothy rosstimothy deleted the tross/backport-46319/v14 branch September 11, 2024 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport no-changelog Indicates that a PR does not require a changelog entry size/md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants