Skip to content

Commit 199751b

Browse files
authored
Change Redis product to Key Value (#174)
Redis is now under the Render Key Value product name that encompasses both Redis and Valkey as available runtime engines. This will move the JSON / YAML outputs under the key-value scoping, as well as add a new `kv-cli` command that replaces the existing `redis-cli` command and will use `redis-cli` or `valkey-cli` depending on what is available on the path.
1 parent 4da813d commit 199751b

17 files changed

Lines changed: 8583 additions & 6033 deletions

File tree

cmd/rediscli.go renamed to cmd/kvcli.go

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,39 @@ import (
88

99
"github.com/render-oss/cli/pkg/client"
1010
"github.com/render-oss/cli/pkg/command"
11-
"github.com/render-oss/cli/pkg/redis"
11+
"github.com/render-oss/cli/pkg/keyvalue"
1212
"github.com/render-oss/cli/pkg/tui"
1313
"github.com/render-oss/cli/pkg/tui/views"
1414
)
1515

1616
// redisCLICmd represents the redisCLI command
1717
var redisCLICmd = &cobra.Command{
18-
Use: "redis-cli [redisID]",
19-
Short: "Open a redis-cli session to a Redis instance",
20-
Long: `Open a redis-cli session to a Redis instance. Optionally pass the redis id as an argument.
21-
To pass arguments to redis-cli, use the following syntax: render redis-cli [redisID] -- [redis-cli args]`,
18+
Use: "kv-cli [keyValueID]",
19+
Short: "Open a redis-cli or valkey-cli session to a Key Value instance",
20+
Long: `Open a redis-cli or valkey-cli session to a Key Value instance. Optionally pass the key value id as an argument.
21+
To pass arguments to redis-cli or valkey-cli, use the following syntax: render kv-cli [keyValuID] -- [redis-cli args]`,
2222
GroupID: GroupSession.ID,
2323
}
2424

25-
func InteractiveRedisView(ctx context.Context, input *views.RedisCLIInput) tea.Cmd {
25+
func InteractiveKeyValueCLIView(ctx context.Context, input *views.RedisCLIInput) tea.Cmd {
2626
return command.AddToStackFunc(
2727
ctx,
2828
redisCLICmd,
29-
"redis-cli",
29+
"kv-cli",
3030
input,
31-
views.NewRedisCLIView(ctx, input, tui.WithCustomOptions[*redis.Model](getRedisTableOptions(ctx))),
31+
views.NewRedisCLIView(ctx, input, tui.WithCustomOptions[*keyvalue.Model](getRedisTableOptions(ctx, input))),
3232
)
3333
}
3434

35-
func getRedisTableOptions(ctx context.Context) []tui.CustomOption {
35+
func getRedisTableOptions(ctx context.Context, input *views.RedisCLIInput) []tui.CustomOption {
3636
return []tui.CustomOption{
3737
WithCopyID(ctx, servicesCmd),
3838
WithWorkspaceSelection(ctx),
39-
WithProjectFilter(ctx, redisCLICmd, "redisCLI", &views.RedisCLIInput{}, func(ctx context.Context, project *client.Project) tea.Cmd {
40-
input := &views.RedisCLIInput{}
39+
WithProjectFilter(ctx, redisCLICmd, "redisCLI", input, func(ctx context.Context, project *client.Project) tea.Cmd {
4140
if project != nil {
4241
input.EnvironmentIDs = project.EnvironmentIds
4342
}
44-
return InteractiveRedisView(ctx, input)
43+
return InteractiveKeyValueCLIView(ctx, input)
4544
}),
4645
}
4746
}
@@ -65,7 +64,7 @@ func init() {
6564
input.Args = args[cmd.ArgsLenAtDash():]
6665
}
6766

68-
InteractiveRedisView(ctx, &input)
67+
InteractiveKeyValueCLIView(ctx, &input)
6968
return nil
7069
}
7170
}

cmd/service.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"github.com/render-oss/cli/pkg/client"
1111
"github.com/render-oss/cli/pkg/command"
1212
"github.com/render-oss/cli/pkg/dashboard"
13+
"github.com/render-oss/cli/pkg/keyvalue"
1314
"github.com/render-oss/cli/pkg/pointers"
1415
"github.com/render-oss/cli/pkg/postgres"
15-
"github.com/render-oss/cli/pkg/redis"
1616
"github.com/render-oss/cli/pkg/resource"
1717
"github.com/render-oss/cli/pkg/service"
1818
"github.com/render-oss/cli/pkg/text"
@@ -63,7 +63,7 @@ func selectResource(ctx context.Context) func(resource.Resource) []views.Palette
6363
}, "Logs")
6464
},
6565
},
66-
allowedTypes: append([]string{postgres.PostgresType, redis.RedisType}, service.NonStaticTypes...),
66+
allowedTypes: append([]string{postgres.PostgresType, keyvalue.KeyValueType}, service.NonStaticTypes...),
6767
},
6868
{
6969
command: views.PaletteCommand{
@@ -75,6 +75,16 @@ func selectResource(ctx context.Context) func(resource.Resource) []views.Palette
7575
},
7676
allowedTypes: append([]string{postgres.PostgresType}, service.NonStaticServerTypes...),
7777
},
78+
{
79+
command: views.PaletteCommand{
80+
Name: "kv-cli",
81+
Description: "Connect to the Key Value using either redis-cli or valkey-cli",
82+
Action: func(ctx context.Context, args []string) tea.Cmd {
83+
return InteractiveKeyValueCLIView(ctx, &views.RedisCLIInput{RedisID: r.ID()})
84+
},
85+
},
86+
allowedTypes: []string{keyvalue.KeyValueType},
87+
},
7888
{
7989
command: views.PaletteCommand{
8090
Name: "psql",

pkg/client/client_gen.go

Lines changed: 7761 additions & 5582 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/events/events_gen.go

Lines changed: 16 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client/eventtypes/eventtypes_gen.go

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)