Skip to content

Commit 2eef8fc

Browse files
committed
fix(rdb): use provided db name directly in get-url without listing
1 parent 90f027f commit 2eef8fc

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

internal/namespaces/rdb/v1/custom_url.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -116,22 +116,7 @@ func generateURL(ctx context.Context, argsI any) (any, error) {
116116

117117
// Finally we add the database if it was given
118118
if args.Db != "" {
119-
databases, err := api.ListDatabases(&rdb.ListDatabasesRequest{
120-
Region: args.Region,
121-
InstanceID: args.InstanceID,
122-
Name: &args.Db,
123-
}, scw.WithContext(ctx), scw.WithAllPages())
124-
if err != nil {
125-
return nil, fmt.Errorf("failed to list databases for instance %q", args.InstanceID)
126-
}
127-
if databases.TotalCount != 1 {
128-
return nil, fmt.Errorf(
129-
"expected 1 database with the name %q, got %d",
130-
args.Db,
131-
databases.TotalCount,
132-
)
133-
}
134-
u = u.JoinPath(databases.Databases[0].Name)
119+
u = u.JoinPath(args.Db)
135120
}
136121

137122
return u.String(), nil

0 commit comments

Comments
 (0)