diff --git a/cmd/meroxa/root/apps/list_test.go b/cmd/meroxa/root/apps/list_test.go index 6e7653346..4c367d2af 100644 --- a/cmd/meroxa/root/apps/list_test.go +++ b/cmd/meroxa/root/apps/list_test.go @@ -24,8 +24,6 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/volatiletech/null/v8" - "github.com/meroxa/cli/log" "github.com/meroxa/cli/utils" "github.com/meroxa/meroxa-go/pkg/meroxa" @@ -44,8 +42,8 @@ func TestListAppsExecution(t *testing.T) { Language: GoLang, Status: meroxa.ApplicationStatus{State: meroxa.ApplicationStateReady}, Functions: []meroxa.FunctionIdentifier{ - {Name: null.StringFrom("one")}, - {Name: null.StringFrom("two")}, + {Name: "one"}, + {Name: "two"}, }, } diff --git a/cmd/meroxa/root/functions/create.go b/cmd/meroxa/root/functions/create.go index 97dd2eccf..dc2ea3931 100644 --- a/cmd/meroxa/root/functions/create.go +++ b/cmd/meroxa/root/functions/create.go @@ -6,8 +6,6 @@ import ( "strings" "github.com/mattn/go-shellwords" - "github.com/volatiletech/null/v8" - "github.com/meroxa/cli/cmd/meroxa/builder" "github.com/meroxa/cli/log" "github.com/meroxa/meroxa-go/pkg/meroxa" @@ -41,7 +39,6 @@ type Create struct { Args string `long:"args" usage:"Arguments to the entrypoint"` EnvVars []string `long:"env" usage:"List of environment variables to set in the function"` Pipeline string `long:"pipeline" usage:"pipeline name to attach function to" required:"true"` - Application string `long:"app" usage:"application name or UUID to which this function belongs" required:"true"` } } @@ -52,10 +49,10 @@ func (c *Create) Usage() string { func (c *Create) Docs() builder.Docs { return builder.Docs{ Short: "Create a function", - Long: "Use `functions create` to create a function to process records from an input stream (--input-stream)", + Long: "Use `functions create` to create a function to process records from an input steram (--input-stream)", Example: ` -meroxa functions create [NAME] --input-stream connector-output-stream --image myimage --app my-app -meroxa functions create [NAME] --input-stream connector-output-stream --image myimage --app my-app --env FOO=BAR --env BAR=BAZ +meroxa functions create [NAME] --input-stream connector-output-stream --image myimage --pipeline my-pipeline +meroxa functions create [NAME] --input-stream connector-output-stream --image myimage --pipeline my-pipeline --env FOO=BAR --env BAR=BAZ `, } } @@ -89,10 +86,7 @@ func (c *Create) Execute(ctx context.Context) error { Name: c.args.Name, InputStream: c.flags.InputStream, Pipeline: meroxa.PipelineIdentifier{ - Name: null.StringFrom(c.flags.Pipeline), - }, - Application: meroxa.ApplicationIdentifier{ - Name: null.StringFrom(c.flags.Application), + Name: c.flags.Pipeline, }, Image: c.flags.Image, Command: command, diff --git a/cmd/meroxa/root/functions/describe.go b/cmd/meroxa/root/functions/describe.go index 6504e4eef..d0c201bd3 100644 --- a/cmd/meroxa/root/functions/describe.go +++ b/cmd/meroxa/root/functions/describe.go @@ -19,7 +19,7 @@ var ( ) type describeFunctionClient interface { - GetFunction(ctx context.Context, appNameOrUUID, nameOrUUID string) (*meroxa.Function, error) + GetFunction(ctx context.Context, nameOrUUID string) (*meroxa.Function, error) } type Describe struct { @@ -29,10 +29,6 @@ type Describe struct { args struct { NameOrUUID string } - - flags struct { - Application string `long:"app" usage:"application name or UUID to which this function belongs" required:"true"` - } } func (d *Describe) Usage() string { @@ -46,7 +42,7 @@ func (d *Describe) Docs() builder.Docs { } func (d *Describe) Execute(ctx context.Context) error { - fun, err := d.client.GetFunction(ctx, d.flags.Application, d.args.NameOrUUID) + fun, err := d.client.GetFunction(ctx, d.args.NameOrUUID) if err != nil { return err } diff --git a/cmd/meroxa/root/functions/functions.go b/cmd/meroxa/root/functions/functions.go index 47bffca3f..36d7a52bf 100644 --- a/cmd/meroxa/root/functions/functions.go +++ b/cmd/meroxa/root/functions/functions.go @@ -14,7 +14,7 @@ var ( _ builder.CommandWithDocs = (*Functions)(nil) _ builder.CommandWithFeatureFlag = (*Functions)(nil) _ builder.CommandWithSubCommands = (*Functions)(nil) - _ builder.CommandWithHidden = (*Functions)(nil) // for internal use only, will always be hidden + _ builder.CommandWithHidden = (*Functions)(nil) ) func (*Functions) Usage() string { @@ -26,7 +26,7 @@ func (*Functions) Hidden() bool { } func (*Functions) FeatureFlag() (string, error) { - return "turbine", fmt.Errorf(`no access to the Meroxa Data applications feature`) + return "functions", fmt.Errorf(`no access to the Meroxa functions feature`) } func (*Functions) Docs() builder.Docs { diff --git a/cmd/meroxa/root/functions/list.go b/cmd/meroxa/root/functions/list.go index edb9ce402..835010f97 100644 --- a/cmd/meroxa/root/functions/list.go +++ b/cmd/meroxa/root/functions/list.go @@ -19,40 +19,19 @@ var ( ) type listFunctionClient interface { - ListApplications(ctx context.Context) ([]*meroxa.Application, error) - ListFunctions(ctx context.Context, appNameOrUUID string) ([]*meroxa.Function, error) + ListFunctions(ctx context.Context) ([]*meroxa.Function, error) } type List struct { client listFunctionClient logger log.Logger hideHeaders bool - - flags struct { - Application string `long:"app" usage:"application name or UUID to which this function belongs"` - } } func (l *List) Execute(ctx context.Context) error { - var err error - funs := make([]*meroxa.Function, 0) - if l.flags.Application != "" { - funs, err = l.client.ListFunctions(ctx, l.flags.Application) - if err != nil { - return err - } - } else { - apps, err := l.client.ListApplications(ctx) - if err != nil { - return err - } - for _, app := range apps { - fs, err := l.client.ListFunctions(ctx, app.UUID) - if err != nil { - return err - } - funs = append(funs, fs...) - } + funs, err := l.client.ListFunctions(ctx) + if err != nil { + return err } l.logger.JSON(ctx, funs) diff --git a/cmd/meroxa/root/functions/logs.go b/cmd/meroxa/root/functions/logs.go index 4ab91958b..7ae6c09e3 100644 --- a/cmd/meroxa/root/functions/logs.go +++ b/cmd/meroxa/root/functions/logs.go @@ -20,7 +20,7 @@ var ( ) type functionLogsClient interface { - GetFunctionLogs(ctx context.Context, appNameOrUUID, nameOrUUID string) (*http.Response, error) + GetFunctionLogs(ctx context.Context, nameOrUUID string) (*http.Response, error) } type Logs struct { @@ -30,10 +30,6 @@ type Logs struct { args struct { NameOrUUID string } - - flags struct { - Application string `long:"app" usage:"application name or UUID to which this function belongs" required:"true"` - } } func (l *Logs) Usage() string { @@ -47,7 +43,7 @@ func (l *Logs) Docs() builder.Docs { } func (l *Logs) Execute(ctx context.Context) error { - resp, err := l.client.GetFunctionLogs(ctx, l.flags.Application, l.args.NameOrUUID) + resp, err := l.client.GetFunctionLogs(ctx, l.args.NameOrUUID) if err != nil { return err diff --git a/cmd/meroxa/root/functions/remove.go b/cmd/meroxa/root/functions/remove.go index 26d8180c2..c402004b6 100644 --- a/cmd/meroxa/root/functions/remove.go +++ b/cmd/meroxa/root/functions/remove.go @@ -20,7 +20,7 @@ var ( ) type removeFunctionClient interface { - DeleteFunction(ctx context.Context, appNameOrUUID, nameOrUUID string) (*meroxa.Function, error) + DeleteFunction(ctx context.Context, nameOrUUID string) (*meroxa.Function, error) } type Remove struct { @@ -30,10 +30,6 @@ type Remove struct { args struct { NameOrUUID string } - - flags struct { - Application string `long:"app" usage:"application name or UUID to which this function belongs" required:"true"` - } } func (r *Remove) Usage() string { @@ -53,7 +49,7 @@ func (r *Remove) ValueToConfirm(_ context.Context) (wantInput string) { func (r *Remove) Execute(ctx context.Context) error { r.logger.Infof(ctx, "Function %q is being removed...", r.args.NameOrUUID) - e, err := r.client.DeleteFunction(ctx, r.flags.Application, r.args.NameOrUUID) + e, err := r.client.DeleteFunction(ctx, r.args.NameOrUUID) if err != nil { return err } diff --git a/utils/display.go b/utils/display.go index 37374bc0c..65c383bdf 100644 --- a/utils/display.go +++ b/utils/display.go @@ -509,7 +509,6 @@ func FunctionsTable(funs []*meroxa.Function, hideHeaders bool) string { {Align: simpletable.AlignCenter, Text: "OUTPUT STREAM"}, {Align: simpletable.AlignCenter, Text: "STATE"}, {Align: simpletable.AlignCenter, Text: "PIPELINE"}, - {Align: simpletable.AlignCenter, Text: "APPLICATION"}, }, } } @@ -521,8 +520,7 @@ func FunctionsTable(funs []*meroxa.Function, hideHeaders bool) string { {Align: simpletable.AlignCenter, Text: p.InputStream}, {Align: simpletable.AlignCenter, Text: p.OutputStream}, {Align: simpletable.AlignCenter, Text: p.Status.State}, - {Align: simpletable.AlignCenter, Text: p.Pipeline.Name.String}, - {Align: simpletable.AlignCenter, Text: p.Application.Name.String}, + {Align: simpletable.AlignCenter, Text: p.Pipeline.Name}, } table.Body.Cells = append(table.Body.Cells, r) @@ -574,11 +572,7 @@ func FunctionTable(fun *meroxa.Function) string { }, { {Align: simpletable.AlignRight, Text: "Pipeline:"}, - {Text: fun.Pipeline.Name.String}, - }, - { - {Align: simpletable.AlignRight, Text: "Application:"}, - {Text: fun.Application.Name.String}, + {Text: fun.Pipeline.Name}, }, { {Align: simpletable.AlignRight, Text: "State:"}, @@ -833,7 +827,7 @@ func AppsTable(apps []*meroxa.Application, hideHeaders bool) string { for _, app := range apps { names := make([]string, 0) for _, f := range app.Functions { - names = append(names, f.Name.String) + names = append(names, f.Name) } r := []*simpletable.Cell{ {Align: simpletable.AlignRight, Text: app.UUID},