1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-18 00:08:17 +00:00

[release/v0.4] Add schema links and resource methods for resource verb patch (#450) (#498)

* Show patch link on the API resource when patch permission is present and add patch ResourceMethod to the schema.
This commit is contained in:
Chad Roberts
2025-02-14 12:19:15 -05:00
committed by GitHub
parent aa220d13a6
commit 504819d943
5 changed files with 30 additions and 8 deletions

View File

@@ -103,6 +103,10 @@ func formatter(summarycache *summarycache.SummaryCache) types.Formatter {
resource.Links["remove"] = "blocked"
}
if _, ok := resource.Links["patch"]; !ok && slice.ContainsString(resource.Schema.ResourceMethods, "blocked-PATCH") {
resource.Links["patch"] = "blocked"
}
if unstr, ok := resource.APIObject.Object.(*unstructured.Unstructured); ok {
// with the sql cache, these were already added by the indexer. However, the sql cache
// is only used for lists, so we need to re-add here for get/watch