diff --git a/go.mod b/go.mod index 1a27dcc..9f1c2d9 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,11 @@ module github.com/kubemq-io/kubemq-go require ( - github.com/go-resty/resty v1.8.0 + github.com/go-resty/resty/v2 v2.0.0 github.com/gogo/protobuf v1.2.0 github.com/google/uuid v1.1.0 github.com/gorilla/websocket v1.4.0 go.opencensus.io v0.21.0 - golang.org/x/net v0.0.0-20190311183353-d8887717615a + golang.org/x/net v0.0.0-20190628185345-da137c7871d7 google.golang.org/grpc v1.21.0 ) diff --git a/go.sum b/go.sum deleted file mode 100644 index 614cb56..0000000 --- a/go.sum +++ /dev/null @@ -1,56 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/go-resty/resty v1.8.0 h1:vbNCxbHOWCototzwxf3L63PQCKx6xgT6v8SHfoqkp6U= -github.com/go-resty/resty v1.8.0/go.mod h1:n37daLLGIHq2FFYHxg+FYQiwA95FpfNI+A9uxoIYGRk= -github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/uuid v1.1.0 h1:Jf4mxPC/ziBnoPIdpQdPJ9OeiomAUHLvxmPRSPH9m4s= -github.com/google/uuid v1.1.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -go.opencensus.io v0.21.0 h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 h1:bjcUS9ztw9kFmmIxJInhon/0Is3p+EHBKNgquIzo1OI= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19 h1:Lj2SnHtxkRGJDqnGaSjo+CCdIieEnwVazbOXILwQemk= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.21.0 h1:G+97AoqBnmZIT91cLG/EkCoK9NSelj64P8bOHHNmGn0= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/rest.go b/rest.go index 9ff14f6..0f86851 100644 --- a/rest.go +++ b/rest.go @@ -9,7 +9,7 @@ import ( "github.com/google/uuid" "github.com/kubemq-io/kubemq-go/pb" - "github.com/go-resty/resty" + "github.com/go-resty/resty/v2" "github.com/gorilla/websocket" ) @@ -140,7 +140,7 @@ func newRestTransport(ctx context.Context, opts *Options) (Transport, *ServerInf func (rt *restTransport) Ping(ctx context.Context) (*ServerInfo, error) { resp := &restResponse{} uri := fmt.Sprintf("%s/ping", rt.restAddress) - _, err := resty.R().SetResult(resp).SetError(resp).Get(uri) + _, err := resty.New().R().SetResult(resp).SetError(resp).Get(uri) if err != nil { return nil, err } @@ -163,7 +163,7 @@ func (rt *restTransport) SendEvent(ctx context.Context, event *Event) error { Tags: event.Tags, } uri := fmt.Sprintf("%s/send/event", rt.restAddress) - _, err := resty.R().SetBody(eventPb).SetResult(resp).SetError(resp).Post(uri) + _, err := resty.New().R().SetBody(eventPb).SetResult(resp).SetError(resp).Post(uri) if err != nil { return err } @@ -271,7 +271,7 @@ func (rt *restTransport) SendEventStore(ctx context.Context, eventStore *EventSt Tags: eventStore.Tags, } uri := fmt.Sprintf("%s/send/event", rt.restAddress) - _, err := resty.R().SetBody(eventPb).SetResult(resp).SetError(resp).Post(uri) + _, err := resty.New().R().SetBody(eventPb).SetResult(resp).SetError(resp).Post(uri) if err != nil { return nil, err } @@ -395,7 +395,7 @@ func (rt *restTransport) SendCommand(ctx context.Context, command *Command) (*Co XXX_sizecache: 0, } uri := fmt.Sprintf("%s/send/request", rt.restAddress) - _, err := resty.R().SetBody(request).SetResult(resp).SetError(resp).Post(uri) + _, err := resty.New().R().SetBody(request).SetResult(resp).SetError(resp).Post(uri) if err != nil { return nil, err } @@ -465,7 +465,7 @@ func (rt *restTransport) SendQuery(ctx context.Context, query *Query) (*QueryRes Tags: query.Tags, } uri := fmt.Sprintf("%s/send/request", rt.restAddress) - _, err := resty.R().SetBody(request).SetResult(resp).SetError(resp).Post(uri) + _, err := resty.New().R().SetBody(request).SetResult(resp).SetError(resp).Post(uri) if err != nil { return nil, err } @@ -533,7 +533,7 @@ func (rt *restTransport) SendResponse(ctx context.Context, response *Response) e Tags: response.Tags, } uri := fmt.Sprintf("%s/send/response", rt.restAddress) - _, err := resty.R().SetBody(request).SetResult(resp).SetError(resp).Post(uri) + _, err := resty.New().R().SetBody(request).SetResult(resp).SetError(resp).Post(uri) if err != nil { return err } @@ -561,7 +561,7 @@ func (rt *restTransport) SendQueueMessage(ctx context.Context, msg *QueueMessage }, } uri := fmt.Sprintf("%s/queue/send", rt.restAddress) - _, err := resty.R().SetBody(msgSend).SetResult(resp).SetError(resp).Post(uri) + _, err := resty.New().R().SetBody(msgSend).SetResult(resp).SetError(resp).Post(uri) if err != nil { return nil, err } @@ -596,7 +596,7 @@ func (rt *restTransport) SendQueueMessages(ctx context.Context, msgs []*QueueMes }) } uri := fmt.Sprintf("%s/queue/send_batch", rt.restAddress) - _, err := resty.R().SetBody(br).SetResult(resp).SetError(resp).Post(uri) + _, err := resty.New().R().SetBody(br).SetResult(resp).SetError(resp).Post(uri) if err != nil { return nil, err } @@ -630,7 +630,7 @@ func (rt *restTransport) ReceiveQueueMessages(ctx context.Context, req *ReceiveQ IsPeak: req.IsPeak, } uri := fmt.Sprintf("%s/queue/receive", rt.restAddress) - _, err := resty.R().SetBody(request).SetResult(resp).SetError(resp).Post(uri) + _, err := resty.New().R().SetBody(request).SetResult(resp).SetError(resp).Post(uri) if err != nil { return nil, err } @@ -650,7 +650,7 @@ func (rt *restTransport) AckAllQueueMessages(ctx context.Context, req *AckAllQue WaitTimeSeconds: req.WaitTimeSeconds, } uri := fmt.Sprintf("%s/queue/ack_all", rt.restAddress) - _, err := resty.R().SetBody(request).SetResult(resp).SetError(resp).Post(uri) + _, err := resty.New().R().SetBody(request).SetResult(resp).SetError(resp).Post(uri) if err != nil { return nil, err }