1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-13 13:59:40 +00:00

Add blocked links for update and remove if method is disallowed

This commit is contained in:
Darren Shepherd
2021-08-16 15:41:36 -07:00
committed by Brenda Rearden
parent 4eab753f74
commit 1d28106b6e

View File

@@ -73,6 +73,14 @@ func formatter(summarycache *summarycache.SummaryCache) types.Formatter {
resource.Links["update"] = u
}
if _, ok := resource.Links["update"]; !ok && slice.ContainsString(resource.Schema.ResourceMethods, "blocked-PUT") {
resource.Links["update"] = "blocked"
}
if _, ok := resource.Links["remove"]; !ok && slice.ContainsString(resource.Schema.ResourceMethods, "blocked-DELETE") {
resource.Links["remove"] = "blocked"
}
if unstr, ok := resource.APIObject.Object.(*unstructured.Unstructured); ok {
s, rel := summarycache.SummaryAndRelationship(unstr)
data.PutValue(unstr.Object, map[string]interface{}{