cleaning up

mine
derailed 2020-02-13 17:56:13 -07:00
parent cd4e4a72ab
commit 642303bb72
2 changed files with 7 additions and 3 deletions

View File

@ -55,7 +55,7 @@ func getOpenFAASFlags() (string, string, bool) {
return gw, token, tlsInsecure 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) { func (f *OpenFaas) Get(ctx context.Context, path string) (runtime.Object, error) {
ns, n := client.Namespaced(path) ns, n := client.Namespaced(path)
@ -83,7 +83,7 @@ func (f *OpenFaas) Get(ctx context.Context, path string) (runtime.Object, error)
return found, nil 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) { func (f *OpenFaas) List(_ context.Context, ns string) ([]runtime.Object, error) {
if !IsOpenFaasEnabled() { if !IsOpenFaasEnabled() {
return nil, errors.New("OpenFAAS is not enabled on this cluster") 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 return oo, nil
} }
// Delete removes a function.
func (f *OpenFaas) Delete(path string, _, _ bool) error { func (f *OpenFaas) Delete(path string, _, _ bool) error {
gw, token, tls := getOpenFAASFlags() gw, token, tls := getOpenFAASFlags()
ns, n := client.Namespaced(path) ns, n := client.Namespaced(path)
@ -111,10 +112,12 @@ func (f *OpenFaas) Delete(path string, _, _ bool) error {
return deleteFunctionToken(gw, n, tls, token, ns) return deleteFunctionToken(gw, n, tls, token, ns)
} }
// ToYAML dumps a function to yaml.
func (f *OpenFaas) ToYAML(path string) (string, error) { func (f *OpenFaas) ToYAML(path string) (string, error) {
return f.Describe(path) return f.Describe(path)
} }
// Describe describes a function.
func (f *OpenFaas) Describe(path string) (string, error) { func (f *OpenFaas) Describe(path string) (string, error) {
o, err := f.Get(context.Background(), path) o, err := f.Get(context.Background(), path)
if err != nil { if err != nil {

View File

@ -8,6 +8,7 @@ import (
"github.com/derailed/tview" "github.com/derailed/tview"
) )
// PortForwardFunc represents a port-forward callback function.
type PortForwardFunc func(path, address, lport, cport string) type PortForwardFunc func(path, address, lport, cport string)
// ShowPortForwards pops a port forwarding configuration dialog. // 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) p.ShowPage(portForwardKey)
} }
// DismissPortForward dismiss the port forward dialog. // DismissPortForwards dismiss the port forward dialog.
func DismissPortForwards(p *ui.Pages) { func DismissPortForwards(p *ui.Pages) {
p.RemovePage(portForwardKey) p.RemovePage(portForwardKey)
} }