From bcbcef36b3f10b14f06b3c5b525310447dcdb64a Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Mon, 16 Aug 2021 15:41:36 -0700 Subject: [PATCH] Add blocked links for update and remove if method is disallowed --- pkg/resources/common/formatter.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/resources/common/formatter.go b/pkg/resources/common/formatter.go index 1ffdc32..7ea90b2 100644 --- a/pkg/resources/common/formatter.go +++ b/pkg/resources/common/formatter.go @@ -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{}{