Commit 103145cc authored by jackgr's avatar jackgr

Make all repo methods name based.

parent acfc6054
...@@ -50,8 +50,8 @@ type Manager interface { ...@@ -50,8 +50,8 @@ type Manager interface {
GetChart(chartName string) (*chart.Chart, error) GetChart(chartName string) (*chart.Chart, error)
// Repo Charts // Repo Charts
ListRepoCharts(repoURL string, regex *regexp.Regexp) ([]string, error) ListRepoCharts(repoName string, regex *regexp.Regexp) ([]string, error)
GetChartForRepo(repoURL, chartName string) (*chart.Chart, error) GetChartForRepo(repoName, chartName string) (*chart.Chart, error)
// Credentials // Credentials
CreateCredential(name string, c *repo.Credential) error CreateCredential(name string, c *repo.Credential) error
...@@ -60,8 +60,8 @@ type Manager interface { ...@@ -60,8 +60,8 @@ type Manager interface {
// Chart Repositories // Chart Repositories
ListRepos() (map[string]string, error) ListRepos() (map[string]string, error)
AddRepo(addition repo.IRepo) error AddRepo(addition repo.IRepo) error
RemoveRepo(name string) error RemoveRepo(repoName string) error
GetRepo(URL string) (repo.IRepo, error) GetRepo(repoName string) (repo.IRepo, error)
} }
type manager struct { type manager struct {
...@@ -377,17 +377,23 @@ func (m *manager) AddRepo(addition repo.IRepo) error { ...@@ -377,17 +377,23 @@ func (m *manager) AddRepo(addition repo.IRepo) error {
} }
// RemoveRepo removes a repository from the list by URL // RemoveRepo removes a repository from the list by URL
func (m *manager) RemoveRepo(name string) error { func (m *manager) RemoveRepo(repoName string) error {
url, err := m.service.GetRepoURLByName(name) repoURL, err := m.service.GetRepoURLByName(repoName)
if err != nil { if err != nil {
return err return err
} }
return m.service.DeleteRepo(url)
return m.service.DeleteRepo(repoURL)
} }
// GetRepo returns the repository with the given URL // GetRepo returns the repository with the given URL
func (m *manager) GetRepo(URL string) (repo.IRepo, error) { func (m *manager) GetRepo(repoName string) (repo.IRepo, error) {
return m.service.GetRepoByURL(URL) repoURL, err := m.service.GetRepoURLByName(repoName)
if err != nil {
return nil, err
}
return m.service.GetRepoByURL(repoURL)
} }
func generateManifestName() string { func generateManifestName() string {
...@@ -412,10 +418,15 @@ func getResourceErrors(c *common.Configuration) []string { ...@@ -412,10 +418,15 @@ func getResourceErrors(c *common.Configuration) []string {
return errs return errs
} }
// ListRepoCharts lists charts in a given repository whose URLs // ListRepoCharts lists charts in a given repository whose names
// conform to the supplied regular expression, or all charts, if the regular // conform to the supplied regular expression, or all charts, if the regular
// expression is nil. // expression is nil.
func (m *manager) ListRepoCharts(repoURL string, regex *regexp.Regexp) ([]string, error) { func (m *manager) ListRepoCharts(repoName string, regex *regexp.Regexp) ([]string, error) {
repoURL, err := m.service.GetRepoURLByName(repoName)
if err != nil {
return nil, err
}
r, err := m.repoProvider.GetRepoByURL(repoURL) r, err := m.repoProvider.GetRepoByURL(repoURL)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -425,7 +436,12 @@ func (m *manager) ListRepoCharts(repoURL string, regex *regexp.Regexp) ([]string ...@@ -425,7 +436,12 @@ func (m *manager) ListRepoCharts(repoURL string, regex *regexp.Regexp) ([]string
} }
// GetChartForRepo returns a chart by name from a given repository. // GetChartForRepo returns a chart by name from a given repository.
func (m *manager) GetChartForRepo(repoURL, chartName string) (*chart.Chart, error) { func (m *manager) GetChartForRepo(repoName, chartName string) (*chart.Chart, error) {
repoURL, err := m.service.GetRepoURLByName(repoName)
if err != nil {
return nil, err
}
r, err := m.repoProvider.GetRepoByURL(repoURL) r, err := m.repoProvider.GetRepoByURL(repoURL)
if err != nil { if err != nil {
return nil, err return nil, err
......
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