Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comments to exported functions #1437

Merged
merged 1 commit into from
Jan 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/kubeops/internal/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type Config struct {
ChartClient chartUtils.Resolver
}

// NewInClusterConfig returns an internal cluster config replacing the token
func NewInClusterConfig(token string) (*rest.Config, error) {
config, err := rest.InClusterConfig()
if err != nil {
Expand Down Expand Up @@ -107,6 +108,7 @@ func AddRouteWith(
}
}

// ListReleases list existing releases
func ListReleases(cfg Config, w http.ResponseWriter, req *http.Request, params handlerutil.Params) {
apps, err := agent.ListReleases(cfg.ActionConfig, params[namespaceParam], cfg.Options.ListLimit, req.URL.Query().Get("statuses"))
if err != nil {
Expand All @@ -116,10 +118,12 @@ func ListReleases(cfg Config, w http.ResponseWriter, req *http.Request, params h
response.NewDataResponse(apps).Write(w)
}

// ListAllReleases list all the releases available
func ListAllReleases(cfg Config, w http.ResponseWriter, req *http.Request, _ handlerutil.Params) {
ListReleases(cfg, w, req, make(map[string]string))
}

// CreateRelease creates a release
func CreateRelease(cfg Config, w http.ResponseWriter, req *http.Request, params handlerutil.Params) {
chartDetails, chartMulti, err := handlerutil.ParseAndGetChart(req, cfg.ChartClient, isV1SupportRequired)
if err != nil {
Expand Down Expand Up @@ -167,6 +171,7 @@ func upgradeRelease(cfg Config, w http.ResponseWriter, req *http.Request, params

}

// GetRelease returns a release
func GetRelease(cfg Config, w http.ResponseWriter, req *http.Request, params handlerutil.Params) {
// Namespace is already known by the RESTClientGetter.
releaseName := params[nameParam]
Expand All @@ -178,6 +183,7 @@ func GetRelease(cfg Config, w http.ResponseWriter, req *http.Request, params han
response.NewDataResponse(newDashboardCompatibleRelease(*release)).Write(w)
}

// DeleteRelease deletes a release
func DeleteRelease(cfg Config, w http.ResponseWriter, req *http.Request, params handlerutil.Params) {
releaseName := params[nameParam]
purge := handlerutil.QueryParamIsTruthy("purge", req)
Expand Down