Commit acfc6054 authored by jackgr's avatar jackgr

Disambiguate method names

parent 04dc6705
...@@ -39,7 +39,7 @@ func registerChartRepoRoutes(c *router.Context, h *router.Handler) { ...@@ -39,7 +39,7 @@ func registerChartRepoRoutes(c *router.Context, h *router.Handler) {
func listChartReposHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.Context) error { func listChartReposHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.Context) error {
handler := "manager: list chart repositories" handler := "manager: list chart repositories"
repos, err := c.Manager.ListChartRepos() repos, err := c.Manager.ListRepos()
if err != nil { if err != nil {
return err return err
} }
...@@ -58,7 +58,7 @@ func addChartRepoHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.C ...@@ -58,7 +58,7 @@ func addChartRepoHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.C
return nil return nil
} }
if err := c.Manager.AddChartRepo(cr); err != nil { if err := c.Manager.AddRepo(cr); err != nil {
httputil.BadRequest(w, r, err) httputil.BadRequest(w, r, err)
return nil return nil
} }
...@@ -77,7 +77,7 @@ func removeChartRepoHandlerFunc(w http.ResponseWriter, r *http.Request, c *route ...@@ -77,7 +77,7 @@ func removeChartRepoHandlerFunc(w http.ResponseWriter, r *http.Request, c *route
return err return err
} }
err = c.Manager.RemoveChartRepo(name) err = c.Manager.RemoveRepo(name)
if err != nil { if err != nil {
return err return err
} }
...@@ -95,7 +95,7 @@ func getChartRepoHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.C ...@@ -95,7 +95,7 @@ func getChartRepoHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.C
return err return err
} }
cr, err := c.Manager.GetChartRepo(repoURL) cr, err := c.Manager.GetRepo(repoURL)
if err != nil { if err != nil {
httputil.BadRequest(w, r, err) httputil.BadRequest(w, r, err)
return nil return nil
...@@ -159,39 +159,3 @@ func getRepoChartHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.C ...@@ -159,39 +159,3 @@ func getRepoChartHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.C
util.LogHandlerExitWithJSON(handler, w, repoChart, http.StatusOK) util.LogHandlerExitWithJSON(handler, w, repoChart, http.StatusOK)
return nil return nil
} }
func addChartRepoHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.Context) error {
handler := "manager: add chart repository"
util.LogHandlerEntry(handler, r)
defer r.Body.Close()
cr := &repo.Repo{}
if err := httputil.Decode(w, r, cr); err != nil {
httputil.BadRequest(w, r, err)
return nil
}
if err := c.Manager.AddChartRepo(cr); err != nil {
httputil.BadRequest(w, r, err)
return nil
}
util.LogHandlerExitWithText(handler, w, "added", http.StatusOK)
return nil
}
func removeChartRepoHandlerFunc(w http.ResponseWriter, r *http.Request, c *router.Context) error {
handler := "manager: remove chart repository"
util.LogHandlerEntry(handler, r)
URL, err := pos(w, r, 2)
if err != nil {
return err
}
err = c.Manager.RemoveChartRepo(URL)
if err != nil {
return err
}
util.LogHandlerExitWithText(handler, w, "removed", http.StatusOK)
return nil
}
...@@ -58,10 +58,10 @@ type Manager interface { ...@@ -58,10 +58,10 @@ type Manager interface {
GetCredential(name string) (*repo.Credential, error) GetCredential(name string) (*repo.Credential, error)
// Chart Repositories // Chart Repositories
ListChartRepos() (map[string]string, error) ListRepos() (map[string]string, error)
AddChartRepo(addition repo.IRepo) error AddRepo(addition repo.IRepo) error
RemoveChartRepo(name string) error RemoveRepo(name string) error
GetChartRepo(URL string) (repo.IRepo, error) GetRepo(URL string) (repo.IRepo, error)
} }
type manager struct { type manager struct {
...@@ -366,18 +366,18 @@ func (m *manager) GetChart(reference string) (*chart.Chart, error) { ...@@ -366,18 +366,18 @@ func (m *manager) GetChart(reference string) (*chart.Chart, error) {
return c, nil return c, nil
} }
// ListChartRepos returns the list of available chart repository URLs // ListRepos returns the list of available repository URLs
func (m *manager) ListChartRepos() (map[string]string, error) { func (m *manager) ListRepos() (map[string]string, error) {
return m.service.ListRepos() return m.service.ListRepos()
} }
// AddChartRepo adds a chart repository to the list // AddRepo adds a repository to the list
func (m *manager) AddChartRepo(addition repo.IRepo) error { func (m *manager) AddRepo(addition repo.IRepo) error {
return m.service.CreateRepo(addition) return m.service.CreateRepo(addition)
} }
// RemoveChartRepo removes a chart repository from the list by URL // RemoveRepo removes a repository from the list by URL
func (m *manager) RemoveChartRepo(name string) error { func (m *manager) RemoveRepo(name string) error {
url, err := m.service.GetRepoURLByName(name) url, err := m.service.GetRepoURLByName(name)
if err != nil { if err != nil {
return err return err
...@@ -385,8 +385,8 @@ func (m *manager) RemoveChartRepo(name string) error { ...@@ -385,8 +385,8 @@ func (m *manager) RemoveChartRepo(name string) error {
return m.service.DeleteRepo(url) return m.service.DeleteRepo(url)
} }
// GetChartRepo returns the chart repository with the given URL // GetRepo returns the repository with the given URL
func (m *manager) GetChartRepo(URL string) (repo.IRepo, error) { func (m *manager) GetRepo(URL string) (repo.IRepo, error) {
return m.service.GetRepoByURL(URL) return m.service.GetRepoByURL(URL)
} }
......
...@@ -119,19 +119,19 @@ func (m *mockManager) GetChart(chartName string) (*chart.Chart, error) { ...@@ -119,19 +119,19 @@ func (m *mockManager) GetChart(chartName string) (*chart.Chart, error) {
return nil, nil return nil, nil
} }
func (m *mockManager) AddChartRepo(addition repo.IRepo) error { func (m *mockManager) AddRepo(addition repo.IRepo) error {
return nil return nil
} }
func (m *mockManager) ListChartRepos() (map[string]string, error) { func (m *mockManager) ListRepos() (map[string]string, error) {
return map[string]string{}, nil return map[string]string{}, nil
} }
func (m *mockManager) RemoveChartRepo(name string) error { func (m *mockManager) RemoveRepo(name string) error {
return nil return nil
} }
func (m *mockManager) GetChartRepo(URL string) (repo.IRepo, error) { func (m *mockManager) GetRepo(URL string) (repo.IRepo, error) {
return nil, nil return nil, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment