From 642303bb724257d80818cb45c7e8ca1c60cbcdf4 Mon Sep 17 00:00:00 2001 From: derailed Date: Thu, 13 Feb 2020 17:56:13 -0700 Subject: [PATCH] cleaning up --- internal/dao/ofaas.go | 7 +++++-- internal/ui/dialog/port_forwards.go | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/dao/ofaas.go b/internal/dao/ofaas.go index 7feb5402..123e702c 100644 --- a/internal/dao/ofaas.go +++ b/internal/dao/ofaas.go @@ -55,7 +55,7 @@ func getOpenFAASFlags() (string, string, bool) { return gw, token, tlsInsecure } -// List returns a collection of functions +// Get returns a function by name. func (f *OpenFaas) Get(ctx context.Context, path string) (runtime.Object, error) { ns, n := client.Namespaced(path) @@ -83,7 +83,7 @@ func (f *OpenFaas) Get(ctx context.Context, path string) (runtime.Object, error) return found, nil } -// List returns a collection of functions +// List returns a collection of functions. func (f *OpenFaas) List(_ context.Context, ns string) ([]runtime.Object, error) { if !IsOpenFaasEnabled() { return nil, errors.New("OpenFAAS is not enabled on this cluster") @@ -103,6 +103,7 @@ func (f *OpenFaas) List(_ context.Context, ns string) ([]runtime.Object, error) return oo, nil } +// Delete removes a function. func (f *OpenFaas) Delete(path string, _, _ bool) error { gw, token, tls := getOpenFAASFlags() ns, n := client.Namespaced(path) @@ -111,10 +112,12 @@ func (f *OpenFaas) Delete(path string, _, _ bool) error { return deleteFunctionToken(gw, n, tls, token, ns) } +// ToYAML dumps a function to yaml. func (f *OpenFaas) ToYAML(path string) (string, error) { return f.Describe(path) } +// Describe describes a function. func (f *OpenFaas) Describe(path string) (string, error) { o, err := f.Get(context.Background(), path) if err != nil { diff --git a/internal/ui/dialog/port_forwards.go b/internal/ui/dialog/port_forwards.go index 279e4524..45871e3b 100644 --- a/internal/ui/dialog/port_forwards.go +++ b/internal/ui/dialog/port_forwards.go @@ -8,6 +8,7 @@ import ( "github.com/derailed/tview" ) +// PortForwardFunc represents a port-forward callback function. type PortForwardFunc func(path, address, lport, cport string) // ShowPortForwards pops a port forwarding configuration dialog. @@ -56,7 +57,7 @@ func ShowPortForwards(p *ui.Pages, s *config.Styles, path string, ports []string p.ShowPage(portForwardKey) } -// DismissPortForward dismiss the port forward dialog. +// DismissPortForwards dismiss the port forward dialog. func DismissPortForwards(p *ui.Pages) { p.RemovePage(portForwardKey) }