Skip to content

Commit e37d2b5

Browse files
authored
remove turso db/group update CLI methods (#1031)
They are now unavailable at platform
2 parents 3e28ea5 + 7e3d0ce commit e37d2b5

7 files changed

Lines changed: 14 additions & 250 deletions

File tree

internal/cmd/db_update.go

Lines changed: 0 additions & 90 deletions
This file was deleted.

internal/cmd/group.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,17 @@ func handleGroupWaitFlag(client *turso.Client, group, location string) error {
291291
}
292292
return client.Groups.WaitLocation(group, location)
293293
}
294+
295+
func groupArg(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
296+
if len(args) > 0 {
297+
return nil, cobra.ShellCompDirectiveNoFileComp | cobra.ShellCompDirectiveNoSpace
298+
}
299+
300+
client, err := authedTursoClient()
301+
if err != nil {
302+
return nil, cobra.ShellCompDirectiveNoFileComp | cobra.ShellCompDirectiveNoSpace
303+
}
304+
305+
groups, _ := groupNames(client)
306+
return groups, cobra.ShellCompDirectiveNoFileComp | cobra.ShellCompDirectiveNoSpace
307+
}

internal/cmd/group_flag.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ import (
1919
"github.com/tursodatabase/turso-cli/internal/turso"
2020
)
2121

22-
var groupBoolFlag bool
23-
24-
func addGroupBoolFlag(cmd *cobra.Command, description string) {
25-
cmd.Flags().BoolVar(&groupBoolFlag, "group", false, description)
26-
}
27-
2822
var groupFlag string
2923

3024
func addGroupFlag(cmd *cobra.Command) {

internal/cmd/group_update.go

Lines changed: 0 additions & 87 deletions
This file was deleted.

internal/flags/extensions.go

Lines changed: 0 additions & 18 deletions
This file was deleted.

internal/turso/databases.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -419,29 +419,6 @@ func (d *DatabasesClient) Rotate(database string) error {
419419
return nil
420420
}
421421

422-
func (d *DatabasesClient) Update(database string, group bool) error {
423-
url := d.URL(fmt.Sprintf("/%s/update", database))
424-
if group {
425-
url += "?group=true"
426-
}
427-
r, err := d.client.Post(url, nil)
428-
if err != nil {
429-
return fmt.Errorf("failed to update database: %w", err)
430-
}
431-
defer r.Body.Close()
432-
433-
org := d.client.Org
434-
if isNotMemberErr(r.StatusCode, org) {
435-
return notMemberErr(org)
436-
}
437-
438-
if r.StatusCode != http.StatusOK {
439-
return fmt.Errorf("failed to update database: %w", parseResponseError(r))
440-
}
441-
442-
return nil
443-
}
444-
445422
type Stats struct {
446423
Query string `json:"query"`
447424
RowsRead int `json:"rows_read"`

internal/turso/groups.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -334,32 +334,6 @@ func (d *GroupsClient) Rotate(group string) error {
334334
return nil
335335
}
336336

337-
func (d *GroupsClient) Update(group string, version, extensions string) error {
338-
type Body struct{ Version, Extensions string }
339-
body, err := marshal(Body{version, extensions})
340-
if err != nil {
341-
return fmt.Errorf("could not serialize request body: %w", err)
342-
}
343-
344-
url := d.URL(fmt.Sprintf("/%s/update", group))
345-
r, err := d.client.Post(url, body)
346-
if err != nil {
347-
return fmt.Errorf("failed to update group: %w", err)
348-
}
349-
defer r.Body.Close()
350-
351-
org := d.client.Org
352-
if isNotMemberErr(r.StatusCode, org) {
353-
return notMemberErr(org)
354-
}
355-
356-
if r.StatusCode != http.StatusOK {
357-
return fmt.Errorf("failed to update group: %w", parseResponseError(r))
358-
}
359-
360-
return nil
361-
}
362-
363337
func (d *GroupsClient) Rename(oldName, newName string) error {
364338
type Body struct{ Name string }
365339
body, err := marshal(Body{Name: newName})

0 commit comments

Comments
 (0)