Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Fixes #840 Add Url to HREF field for available plugin (#841)
Browse files Browse the repository at this point in the history
  • Loading branch information
IRCody committed Apr 8, 2016
1 parent 33ff9a6 commit d9f56a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mgmt/rest/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ func getPlugins(mm managesMetrics, detail bool, h string, plName string, plType
HitCount: p.HitCount(),
LastHitTimestamp: p.LastHit().Unix(),
ID: p.ID(),
Href: pluginURI(h, p),
}
}
}
Expand Down Expand Up @@ -342,7 +343,7 @@ func catalogedPluginToLoaded(host string, c core.CatalogedPlugin) *rbody.LoadedP
Signed: c.IsSigned(),
Status: c.Status(),
LoadedTimestamp: c.LoadedTimestamp().Unix(),
Href: catalogedPluginURI(host, c),
Href: pluginURI(host, c),
}
}

Expand Down Expand Up @@ -441,13 +442,13 @@ func (s *Server) getPlugin(w http.ResponseWriter, r *http.Request, p httprouter.
Signed: plugin.IsSigned(),
Status: plugin.Status(),
LoadedTimestamp: plugin.LoadedTimestamp().Unix(),
Href: catalogedPluginURI(r.Host, plugin),
Href: pluginURI(r.Host, plugin),
ConfigPolicy: configPolicy,
}
respond(200, pluginRet, w)
}
}

func catalogedPluginURI(host string, c core.CatalogedPlugin) string {
func pluginURI(host string, c core.Plugin) string {
return fmt.Sprintf("%s://%s/v1/plugins/%s/%s/%d", protocolPrefix, host, c.TypeName(), c.Name(), c.Version())
}

0 comments on commit d9f56a0

Please sign in to comment.