Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pool labelset to client #157

Merged
merged 2 commits into from Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -21,7 +21,7 @@ require (
github.com/sethvargo/go-password v0.1.1
github.com/tsuru/config v0.0.0-20201023175036-375aaee8b560
github.com/tsuru/gnuflag v0.0.0-20151217162021-86b8c1b864aa
github.com/tsuru/go-tsuruclient v0.0.0-20210212185155-1a2f3d9e64cc
github.com/tsuru/go-tsuruclient v0.0.0-20210303180837-ce578d5dc7a9
github.com/tsuru/tablecli v0.0.0-20190131152944-7ded8a3383c6
github.com/tsuru/tsuru v0.0.0-20210212185225-da889133d5d9
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee
Expand Down
15 changes: 13 additions & 2 deletions go.sum
Expand Up @@ -432,8 +432,8 @@ github.com/tsuru/gandalf v0.0.0-20180117164358-86866cf0af24/go.mod h1:0VdaaU608j
github.com/tsuru/gnuflag v0.0.0-20151217162021-86b8c1b864aa h1:JlLQP1xa13a994p/Aau2e3K9xXYaHNoNvTDVIMHSUa4=
github.com/tsuru/gnuflag v0.0.0-20151217162021-86b8c1b864aa/go.mod h1:UibOSvkMFKRe/eiwktAPAvQG8L+p8nYsECJvu3Dgw7I=
github.com/tsuru/go-gandalfclient v0.0.0-20200928142220-6d227717b7c3/go.mod h1:p0UnkpWhQqUX4s3bzKPAYZ/rkz6NIS/PxsR8W4Opf3Q=
github.com/tsuru/go-tsuruclient v0.0.0-20210212185155-1a2f3d9e64cc h1:biq0AAbdmYl2aBKxzHTuK5cfY2+30Oy0KQfwkIg8whM=
github.com/tsuru/go-tsuruclient v0.0.0-20210212185155-1a2f3d9e64cc/go.mod h1:5/W1LtOsOE0uUGO0u57aVuXtHqFTxiiHpgkUlZNQzAc=
github.com/tsuru/go-tsuruclient v0.0.0-20210303180837-ce578d5dc7a9 h1:T64U+aMp/VDci0XdbTtBdbQ6HEhkMfZE2J1HkgDVqmA=
github.com/tsuru/go-tsuruclient v0.0.0-20210303180837-ce578d5dc7a9/go.mod h1:wYe4ngw/l34brrJ8IZqGmhTWNTycnQsxcAPxGNSY8YY=
github.com/tsuru/monsterqueue v0.0.0-20160909010522-70e946ec66c3 h1:+aJngj5cQjYyx/qSjffQceop25t97hLS0+t8bvx9hg4=
github.com/tsuru/monsterqueue v0.0.0-20160909010522-70e946ec66c3/go.mod h1:3KR1vkjfm5b7Lhu5OXuO0NMIyZNG0d0d9xh6ufWYVxg=
github.com/tsuru/tablecli v0.0.0-20180215113938-82de88f75181/go.mod h1:ztYpOhW+u1k21FEqp7nZNgpWbr0dUKok5lgGCZi+1AQ=
Expand Down Expand Up @@ -526,6 +526,11 @@ golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/oauth2 v0.0.0-20180402223937-921ae394b943 h1:hE+k6oRG1aru6/y8A0HI01Zqp65EZcUcKToTkbPsFFM=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
Expand All @@ -542,13 +547,17 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6 h1:DvY3Zkh7KabQE/kfzMvYvKirSiguP9Q/veMtkYyf0o8=
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand All @@ -573,6 +582,8 @@ golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0 h1:9sdfJOzWlkqPltHAuzT2Cp+yrBeY1KRVYgms8soxMwM=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
Expand Down
6 changes: 3 additions & 3 deletions tsuru/admin/event.go
Expand Up @@ -10,7 +10,6 @@ import (
"net/http"
"time"

"github.com/ajg/form"
"github.com/tsuru/gnuflag"
"github.com/tsuru/tablecli"
"github.com/tsuru/tsuru-client/tsuru/formatter"
Expand Down Expand Up @@ -150,11 +149,12 @@ func (c *EventBlockAdd) Run(context *cmd.Context, client *cmd.Client) error {
OwnerName: c.owner,
Target: target,
}
v, err := form.EncodeToValues(&block)

body, err := json.Marshal(block)
if err != nil {
return err
}
err = doRequest(client, url, http.MethodPost, v.Encode())
err = doRequest(client, url, http.MethodPost, body)
if err != nil {
return err
}
Expand Down
25 changes: 6 additions & 19 deletions tsuru/admin/event_test.go
Expand Up @@ -9,7 +9,6 @@ import (
"net/http"
"os"

"github.com/ajg/form"
"github.com/tsuru/tsuru/cmd"
"github.com/tsuru/tsuru/cmd/cmdtest"
"github.com/tsuru/tsuru/event"
Expand Down Expand Up @@ -108,15 +107,9 @@ func (s *S) TestEventBlockAdd(c *check.C) {
trans := &cmdtest.ConditionalTransport{
Transport: cmdtest.Transport{Message: "", Status: http.StatusOK},
CondFunc: func(req *http.Request) bool {
var block event.Block
err := req.ParseForm()
c.Assert(err, check.IsNil)
dec := form.NewDecoder(nil)
dec.IgnoreUnknownKeys(true)
dec.IgnoreCase(true)
err = dec.DecodeValues(&block, req.Form)
c.Assert(err, check.IsNil)
c.Assert(block, check.DeepEquals, event.Block{Reason: "Reason", Active: false})
block := new(event.Block)
decodeJSONBody(c, req, block)
c.Assert(block, check.DeepEquals, &event.Block{Reason: "Reason", Active: false})
return req.URL.Path == "/1.3/events/blocks" && req.Method == http.MethodPost
},
}
Expand All @@ -137,15 +130,9 @@ func (s *S) TestEventBlockAddAllFlags(c *check.C) {
trans := &cmdtest.ConditionalTransport{
Transport: cmdtest.Transport{Message: "", Status: http.StatusOK},
CondFunc: func(req *http.Request) bool {
var block event.Block
err := req.ParseForm()
c.Assert(err, check.IsNil)
dec := form.NewDecoder(nil)
dec.IgnoreUnknownKeys(true)
dec.IgnoreCase(true)
err = dec.DecodeValues(&block, req.Form)
c.Assert(err, check.IsNil)
c.Assert(block, check.DeepEquals, event.Block{
block := new(event.Block)
decodeJSONBody(c, req, block)
c.Assert(block, check.DeepEquals, &event.Block{
KindName: "app.deploy",
OwnerName: "user@email.com",
Target: event.Target{Type: event.TargetTypeApp, Value: "myapp"},
Expand Down