@@ -2,14 +2,14 @@ package cmd
2
2
3
3
import (
4
4
"fmt"
5
- "net/url"
6
5
"time"
7
6
8
7
"github.com/apex/log"
9
8
"github.com/manifoldco/promptui"
10
9
"github.com/tarantool/go-tarantool/v2"
11
10
"github.com/tarantool/tt/cli/replicaset"
12
11
libcluster "github.com/tarantool/tt/lib/cluster"
12
+ "github.com/tarantool/tt/lib/connect"
13
13
clientv3 "go.etcd.io/etcd/client/v3"
14
14
)
15
15
@@ -107,9 +107,9 @@ func pickPatchKey(keys []string, force bool, pathMsg string) (int, error) {
107
107
func createDataCollectorAndKeyPublisher (
108
108
collectors libcluster.DataCollectorFactory ,
109
109
publishers libcluster.DataPublisherFactory ,
110
- opts UriOpts , connOpts connectOpts ) (
110
+ opts connect. UriOpts , connOpts connectOpts ) (
111
111
libcluster.DataCollector , replicaset.DataPublisher , func (), error ) {
112
- prefix , key , timeout := opts .Prefix , opts .Key , opts .Timeout
112
+ prefix , key , timeout := opts .Prefix , opts .Params [ "key" ] , opts .Timeout
113
113
var (
114
114
collector libcluster.DataCollector
115
115
publisher replicaset.DataPublisher
@@ -153,10 +153,10 @@ func createDataCollectorAndKeyPublisher(
153
153
}
154
154
155
155
// Promote promotes an instance by patching the cluster config.
156
- func Promote (uri * url. URL , ctx PromoteCtx ) error {
157
- opts , err := ParseUriOpts ( uri )
156
+ func Promote (url string , ctx PromoteCtx ) error {
157
+ opts , err := connect . CreateUriOpts ( url )
158
158
if err != nil {
159
- return fmt .Errorf ("invalid URL %q: %w" , uri , err )
159
+ return fmt .Errorf ("invalid URL %q: %w" , url , err )
160
160
}
161
161
connOpts := connectOpts {
162
162
Username : ctx .Username ,
@@ -200,10 +200,10 @@ type DemoteCtx struct {
200
200
}
201
201
202
202
// Demote demotes an instance by patching the cluster config.
203
- func Demote (uri * url. URL , ctx DemoteCtx ) error {
204
- opts , err := ParseUriOpts ( uri )
203
+ func Demote (url string , ctx DemoteCtx ) error {
204
+ opts , err := connect . CreateUriOpts ( url )
205
205
if err != nil {
206
- return fmt .Errorf ("invalid URL %q: %w" , uri , err )
206
+ return fmt .Errorf ("invalid URL %q: %w" , url , err )
207
207
}
208
208
connOpts := connectOpts {
209
209
Username : ctx .Username ,
@@ -247,10 +247,10 @@ type ExpelCtx struct {
247
247
}
248
248
249
249
// Expel expels an instance by patching the cluster config.
250
- func Expel (uri * url. URL , ctx ExpelCtx ) error {
251
- opts , err := ParseUriOpts ( uri )
250
+ func Expel (url string , ctx ExpelCtx ) error {
251
+ opts , err := connect . CreateUriOpts ( url )
252
252
if err != nil {
253
- return fmt .Errorf ("invalid URL %q: %w" , uri , err )
253
+ return fmt .Errorf ("invalid URL %q: %w" , url , err )
254
254
}
255
255
connOpts := connectOpts {
256
256
Username : ctx .Username ,
@@ -301,10 +301,10 @@ type RolesChangeCtx struct {
301
301
}
302
302
303
303
// ChangeRole adds/removes a role by patching the cluster config.
304
- func ChangeRole (uri * url. URL , ctx RolesChangeCtx , action replicaset.RolesChangerAction ) error {
305
- opts , err := ParseUriOpts ( uri )
304
+ func ChangeRole (url string , ctx RolesChangeCtx , action replicaset.RolesChangerAction ) error {
305
+ opts , err := connect . CreateUriOpts ( url )
306
306
if err != nil {
307
- return fmt .Errorf ("invalid URL %q: %w" , uri , err )
307
+ return fmt .Errorf ("invalid URL %q: %w" , url , err )
308
308
}
309
309
connOpts := connectOpts {
310
310
Username : ctx .Username ,
0 commit comments