1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-19 09:50:52 +00:00

Add action to url builder

This commit is contained in:
Craig Jellick
2017-12-15 19:24:04 -07:00
committed by Darren Shepherd
parent df13831994
commit f26502f753
2 changed files with 5 additions and 0 deletions

View File

@@ -148,6 +148,7 @@ type URLBuilder interface {
Sort(field string) string Sort(field string) string
SetSubContext(subContext string) SetSubContext(subContext string)
FilterLink(schema *Schema, fieldName string, value string) string FilterLink(schema *Schema, fieldName string, value string) string
Action(action string, resource *RawResource) string
} }
type Store interface { type Store interface {

View File

@@ -254,3 +254,7 @@ func parseResponseURLBase(requestURL string, r *http.Request) (string, error) {
return requestURL[0:index], nil return requestURL[0:index], nil
} }
func (u *urlBuilder) Action(action string, resource *types.RawResource) string {
return u.constructBasicURL(resource.Schema.Version, resource.Schema.PluralName, resource.ID) + "?action=" + url.QueryEscape(action)
}