diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index e74b67c23..e22ed8dcd 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -58,7 +58,6 @@ import ( "github.com/brevdev/brev-cli/pkg/cmd/updatemodel" "github.com/brevdev/brev-cli/pkg/cmd/upgrade" "github.com/brevdev/brev-cli/pkg/cmd/version" - "github.com/brevdev/brev-cli/pkg/cmd/workspacegroups" "github.com/brevdev/brev-cli/pkg/cmd/writeconnectionevent" "github.com/brevdev/brev-cli/pkg/config" "github.com/brevdev/brev-cli/pkg/entity" @@ -309,7 +308,6 @@ func createCmdTree(cmd *cobra.Command, t *terminal.Terminal, loginCmdStore *stor } else { _ = 0 // noop } - cmd.AddCommand(workspacegroups.NewCmdWorkspaceGroups(t, loginCmdStore)) cmd.AddCommand(scale.NewCmdScale(t, noLoginCmdStore)) cmd.AddCommand(gpusearch.NewCmdGPUSearch(t, noLoginCmdStore)) cmd.AddCommand(gpucreate.NewCmdGPUCreate(t, loginCmdStore)) diff --git a/pkg/cmd/workspacegroups/workspacegroups.go b/pkg/cmd/workspacegroups/workspacegroups.go deleted file mode 100644 index 13fa5423d..000000000 --- a/pkg/cmd/workspacegroups/workspacegroups.go +++ /dev/null @@ -1,69 +0,0 @@ -package workspacegroups - -import ( - "os" - - "github.com/jedib0t/go-pretty/v6/table" - "github.com/spf13/cobra" - - "github.com/brevdev/brev-cli/pkg/entity" - breverrors "github.com/brevdev/brev-cli/pkg/errors" - "github.com/brevdev/brev-cli/pkg/terminal" -) - -type WorkspaceGroupsStore interface { - GetWorkspaceGroups(organizationID string) ([]entity.WorkspaceGroup, error) - GetActiveOrganizationOrDefault() (*entity.Organization, error) -} - -func NewCmdWorkspaceGroups(t *terminal.Terminal, store WorkspaceGroupsStore) *cobra.Command { - cmd := &cobra.Command{ - Use: "workspacegroups", - DisableFlagsInUseLine: true, - Short: "TODO", - Long: "TODO", - Example: "TODO", - RunE: func(cmd *cobra.Command, args []string) error { - err := RunWorkspaceGroups(t, args, store) - if err != nil { - return breverrors.WrapAndTrace(err) - } - return nil - }, - } - return cmd -} - -func RunWorkspaceGroups(_ *terminal.Terminal, _ []string, store WorkspaceGroupsStore) error { - org, err := store.GetActiveOrganizationOrDefault() - if err != nil { - return breverrors.WrapAndTrace(err) - } - wsgs, err := store.GetWorkspaceGroups(org.ID) - if err != nil { - return breverrors.WrapAndTrace(err) - } - - ta := table.NewWriter() - ta.SetOutputMirror(os.Stdout) - ta.Style().Options = getBrevTableOptions() - header := table.Row{"NAME", "PLATFORM ID", "PLATFORM TYPE"} - ta.AppendHeader(header) - for _, w := range wsgs { - workspaceRow := []table.Row{{ - w.Name, w.PlatformID, w.Platform, - }} - ta.AppendRows(workspaceRow) - } - ta.Render() - return nil -} - -func getBrevTableOptions() table.Options { - options := table.OptionsDefault - options.DrawBorder = false - options.SeparateColumns = false - options.SeparateRows = false - options.SeparateHeader = false - return options -} diff --git a/pkg/store/workspacegroup.go b/pkg/store/workspacegroup.go deleted file mode 100644 index 6a1157024..000000000 --- a/pkg/store/workspacegroup.go +++ /dev/null @@ -1,24 +0,0 @@ -package store - -import ( - "github.com/brevdev/brev-cli/pkg/entity" - breverrors "github.com/brevdev/brev-cli/pkg/errors" -) - -var workspaceGroupBase = "api/workspace_groups" - -func (s AuthHTTPStore) GetWorkspaceGroups(organizationID string) ([]entity.WorkspaceGroup, error) { - var result []entity.WorkspaceGroup - res, err := s.authHTTPClient.restyClient.R(). - SetHeader("Content-Type", "application/json"). - SetQueryParam("organizationId", organizationID). - SetResult(&result). - Get(workspaceGroupBase) - if err != nil { - return nil, breverrors.WrapAndTrace(err) - } - if res.IsError() { - return nil, NewHTTPResponseError(res) - } - return result, nil -}