From f86e19a3013a34f9207670be6ca0859936c67562 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Tue, 29 Sep 2020 10:47:59 -0700 Subject: [PATCH] Don't put an update link if update is not allowed --- pkg/resources/common/formatter.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/resources/common/formatter.go b/pkg/resources/common/formatter.go index 201a1db..1688c9e 100644 --- a/pkg/resources/common/formatter.go +++ b/pkg/resources/common/formatter.go @@ -9,6 +9,7 @@ import ( "github.com/rancher/steve/pkg/stores/proxy" "github.com/rancher/steve/pkg/summarycache" "github.com/rancher/wrangler/pkg/data" + "github.com/rancher/wrangler/pkg/slice" "github.com/rancher/wrangler/pkg/summary" "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -38,7 +39,7 @@ func formatter(summarycache *summarycache.SummaryCache) types.Formatter { u := request.URLBuilder.RelativeToRoot(selfLink) resource.Links["view"] = u - if _, ok := resource.Links["update"]; !ok { + if _, ok := resource.Links["update"]; !ok && slice.ContainsString(resource.Schema.CollectionMethods, "PUT") { resource.Links["update"] = u }