mirror of
https://github.com/rancher/steve.git
synced 2025-08-18 22:28:35 +00:00
22 lines
518 B
Go
22 lines
518 B
Go
package resources
|
|
|
|
import (
|
|
"github.com/rancher/norman/pkg/types"
|
|
"github.com/rancher/norman/pkg/types/convert"
|
|
"github.com/rancher/norman/pkg/types/values"
|
|
)
|
|
|
|
func Formatter(request *types.APIRequest, resource *types.RawResource) {
|
|
selfLink := convert.ToString(values.GetValueN(resource.Values, "metadata", "selfLink"))
|
|
if selfLink == "" {
|
|
return
|
|
}
|
|
|
|
u := request.URLBuilder.RelativeToRoot(selfLink)
|
|
resource.Links["view"] = u
|
|
|
|
if _, ok := resource.Links["update"]; ok {
|
|
resource.Links["update"] = u
|
|
}
|
|
}
|