-
Notifications
You must be signed in to change notification settings - Fork 223
/
redis.go
52 lines (40 loc) · 990 Bytes
/
redis.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package redis
import (
"context"
"github.com/spf13/cobra"
fly "github.com/superfly/fly-go"
"github.com/superfly/flyctl/gql"
"github.com/superfly/flyctl/internal/command"
)
// TODO: make internal once the open command has been deprecated
func New() (cmd *cobra.Command) {
const (
long = `Launch and manage Redis databases managed by Upstash.com`
short = long
)
cmd = command.New("redis", short, long, nil)
cmd.AddCommand(
newCreate(),
newList(),
newDestroy(),
newStatus(),
newPlans(),
newUpdate(),
newConnect(),
newDashboard(),
newReset(),
newProxy(),
)
return cmd
}
func GetExcludedRegions(ctx context.Context) (excludedRegions []string, err error) {
client := fly.ClientFromContext(ctx).GenqClient
response, err := gql.GetAddOnProvider(ctx, client, "upstash_redis")
if err != nil {
return nil, err
}
for _, region := range response.AddOnProvider.ExcludedRegions {
excludedRegions = append(excludedRegions, region.Code)
}
return
}