diff --git a/vendor/github.com/rancher/norman/pkg/api/writer/json.go b/vendor/github.com/rancher/norman/pkg/api/writer/json.go index 5d46bab6..67fbf698 100644 --- a/vendor/github.com/rancher/norman/pkg/api/writer/json.go +++ b/vendor/github.com/rancher/norman/pkg/api/writer/json.go @@ -157,12 +157,12 @@ func (j *EncodingResponseWriter) convert(b builder.Builder, context *types.APIRe ActionLinks: context.Request.Header.Get("X-API-Action-Links") != "", } - j.addLinks(b, schema, context, input, rawResource) - if schema.Formatter != nil { schema.Formatter(context, rawResource) } + j.addLinks(b, schema, context, input, rawResource) + return rawResource } @@ -172,12 +172,18 @@ func (j *EncodingResponseWriter) addLinks(b builder.Builder, schema *types.Schem } self := context.URLBuilder.ResourceLink(rawResource.Schema, rawResource.ID) - rawResource.Links["self"] = self - if context.AccessControl.CanUpdate(context, types.ToAPI(input), schema) == nil { - rawResource.Links["update"] = self + if _, ok := rawResource.Links["self"]; !ok { + rawResource.Links["self"] = self } - if context.AccessControl.CanDelete(context, types.ToAPI(input), schema) == nil { - rawResource.Links["remove"] = self + if _, ok := rawResource.Links["update"]; !ok { + if context.AccessControl.CanUpdate(context, types.ToAPI(input), schema) == nil { + rawResource.Links["update"] = self + } + } + if _, ok := rawResource.Links["remove"]; !ok { + if context.AccessControl.CanDelete(context, types.ToAPI(input), schema) == nil { + rawResource.Links["remove"] = self + } } } diff --git a/vendor/modules.txt b/vendor/modules.txt index 59e1fb15..a7c5a42f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -44,10 +44,10 @@ github.com/rancher/norman/pkg/types github.com/rancher/norman/pkg/types/convert github.com/rancher/norman/pkg/store/proxy github.com/rancher/norman/pkg/subscribe -github.com/rancher/norman/pkg/types/values -github.com/rancher/norman/pkg/store/empty -github.com/rancher/norman/pkg/api/builtin github.com/rancher/norman/pkg/data +github.com/rancher/norman/pkg/store/empty +github.com/rancher/norman/pkg/types/values +github.com/rancher/norman/pkg/api/builtin github.com/rancher/norman/pkg/api github.com/rancher/norman/pkg/urlbuilder github.com/rancher/norman/pkg/httperror @@ -237,8 +237,6 @@ k8s.io/client-go/util/cert k8s.io/client-go/util/flowcontrol k8s.io/client-go/kubernetes/scheme k8s.io/client-go/tools/clientcmd -k8s.io/client-go/informers -k8s.io/client-go/informers/rbac k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1 k8s.io/client-go/kubernetes/typed/apps/v1 k8s.io/client-go/kubernetes/typed/apps/v1beta1 @@ -274,6 +272,8 @@ k8s.io/client-go/kubernetes/typed/settings/v1alpha1 k8s.io/client-go/kubernetes/typed/storage/v1 k8s.io/client-go/kubernetes/typed/storage/v1alpha1 k8s.io/client-go/kubernetes/typed/storage/v1beta1 +k8s.io/client-go/informers +k8s.io/client-go/informers/rbac k8s.io/client-go/util/workqueue k8s.io/client-go/informers/internalinterfaces k8s.io/client-go/tools/pager @@ -286,6 +286,7 @@ k8s.io/client-go/util/keyutil k8s.io/client-go/tools/auth k8s.io/client-go/tools/clientcmd/api/latest k8s.io/client-go/util/homedir +k8s.io/client-go/tools/reference k8s.io/client-go/informers/admissionregistration k8s.io/client-go/informers/apps k8s.io/client-go/informers/auditregistration @@ -304,7 +305,6 @@ k8s.io/client-go/informers/settings k8s.io/client-go/informers/storage k8s.io/client-go/informers/rbac/v1alpha1 k8s.io/client-go/informers/rbac/v1beta1 -k8s.io/client-go/tools/reference k8s.io/client-go/tools/clientcmd/api/v1 k8s.io/client-go/informers/admissionregistration/v1beta1 k8s.io/client-go/informers/apps/v1