From ca4ad023f706ab924e2ee9c8877406e614df8111 Mon Sep 17 00:00:00 2001 From: zpatrick Date: Thu, 8 Dec 2016 23:43:51 +0000 Subject: [PATCH 1/3] fix POST /deploy --- api/handlers/deploy_handler.go | 2 +- cli/client/deploy.go | 2 +- cli/client/deploy_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/handlers/deploy_handler.go b/api/handlers/deploy_handler.go index f1f0b6d75..e4bbe2ed6 100644 --- a/api/handlers/deploy_handler.go +++ b/api/handlers/deploy_handler.go @@ -49,7 +49,7 @@ func (this *DeployHandler) Routes() *restful.WebService { Param(id). Returns(http.StatusNoContent, "Deleted", nil)) - service.Route(service.POST("/create"). + service.Route(service.POST("/"). Filter(basicAuthenticate). To(this.CreateDeploy). Doc("Create a new Deploy"). diff --git a/cli/client/deploy.go b/cli/client/deploy.go index d3bbe6591..53f1f8ab2 100644 --- a/cli/client/deploy.go +++ b/cli/client/deploy.go @@ -11,7 +11,7 @@ func (c *APIClient) CreateDeploy(name string, content []byte) (*models.Deploy, e } var deploy *models.Deploy - if err := c.Execute(c.Sling("deploy/create").Post("").BodyJSON(req), &deploy); err != nil { + if err := c.Execute(c.Sling("deploy").Post("").BodyJSON(req), &deploy); err != nil { return nil, err } diff --git a/cli/client/deploy_test.go b/cli/client/deploy_test.go index b5920f554..1069f59dd 100644 --- a/cli/client/deploy_test.go +++ b/cli/client/deploy_test.go @@ -10,7 +10,7 @@ import ( func TestCreateDeploy(t *testing.T) { handler := func(w http.ResponseWriter, r *http.Request) { testutils.AssertEqual(t, r.Method, "POST") - testutils.AssertEqual(t, r.URL.Path, "/deploy/create") + testutils.AssertEqual(t, r.URL.Path, "/deploy") var req models.CreateDeployRequest Unmarshal(t, r, &req) From 83a4d23cd484f81df7f8687c90d51a1d089ccb5c Mon Sep 17 00:00:00 2001 From: zpatrick Date: Thu, 8 Dec 2016 23:47:05 +0000 Subject: [PATCH 2/3] fix PUT /loadbalancer/:id/ports --- api/handlers/load_balancer_handler.go | 2 +- cli/client/load_balancer.go | 2 +- cli/client/load_balancer_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/handlers/load_balancer_handler.go b/api/handlers/load_balancer_handler.go index 2a75f23c5..4dddffc5e 100644 --- a/api/handlers/load_balancer_handler.go +++ b/api/handlers/load_balancer_handler.go @@ -59,7 +59,7 @@ func (this *LoadBalancerHandler) Routes() *restful.WebService { Param(id). Returns(http.StatusNoContent, "Deleted", nil)) - service.Route(service.PUT("{id}"). + service.Route(service.PUT("{id}/ports"). Filter(basicAuthenticate). To(this.UpdateLoadBalancer). Reads(models.UpdateLoadBalancerRequest{}). diff --git a/cli/client/load_balancer.go b/cli/client/load_balancer.go index 27882f9bf..90903b1ce 100644 --- a/cli/client/load_balancer.go +++ b/cli/client/load_balancer.go @@ -53,7 +53,7 @@ func (c *APIClient) UpdateLoadBalancer(id string, ports []models.Port) (*models. } var loadBalancer *models.LoadBalancer - if err := c.Execute(c.Sling("loadbalancer/").Put(id).BodyJSON(req), &loadBalancer); err != nil { + if err := c.Execute(c.Sling("loadbalancer/").Put(id+"/ports").BodyJSON(req), &loadBalancer); err != nil { return nil, err } diff --git a/cli/client/load_balancer_test.go b/cli/client/load_balancer_test.go index e378d0ba3..c402e7657 100644 --- a/cli/client/load_balancer_test.go +++ b/cli/client/load_balancer_test.go @@ -136,7 +136,7 @@ func TestUpdateLoadBalancer(t *testing.T) { handler := func(w http.ResponseWriter, r *http.Request) { testutils.AssertEqual(t, r.Method, "PUT") - testutils.AssertEqual(t, r.URL.Path, "/loadbalancer/id") + testutils.AssertEqual(t, r.URL.Path, "/loadbalancer/id/ports") var req models.UpdateLoadBalancerRequest Unmarshal(t, r, &req) From 6e965b58f8f7ae9abb570aef51fa637866d16db6 Mon Sep 17 00:00:00 2001 From: zpatrick Date: Thu, 8 Dec 2016 23:49:27 +0000 Subject: [PATCH 3/3] fix PUT /service/:id/deploy url --- api/handlers/service_handler.go | 2 +- cli/client/service.go | 2 +- cli/client/service_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/handlers/service_handler.go b/api/handlers/service_handler.go index 3b9fe04c2..6f1e3910b 100644 --- a/api/handlers/service_handler.go +++ b/api/handlers/service_handler.go @@ -71,7 +71,7 @@ func (this *ServiceHandler) Routes() *restful.WebService { Returns(400, "Invalid request", models.ServerError{}). Writes(models.Service{})) - service.Route(service.PUT("/{id}/update"). + service.Route(service.PUT("/{id}/deploy"). Filter(basicAuthenticate). To(this.UpdateService). Doc("Run a new deploy on a service"). diff --git a/cli/client/service.go b/cli/client/service.go index 4cb0cc642..7408a8e2a 100644 --- a/cli/client/service.go +++ b/cli/client/service.go @@ -40,7 +40,7 @@ func (c *APIClient) UpdateService(serviceID, deployID string) (*models.Service, } var service *models.Service - if err := c.Execute(c.Sling("service/").Put(serviceID+"/update").BodyJSON(request), &service); err != nil { + if err := c.Execute(c.Sling("service/").Put(serviceID+"/deploy").BodyJSON(request), &service); err != nil { return nil, err } diff --git a/cli/client/service_test.go b/cli/client/service_test.go index 209c34657..607c1526b 100644 --- a/cli/client/service_test.go +++ b/cli/client/service_test.go @@ -158,7 +158,7 @@ func TestScaleService(t *testing.T) { func TestUpdateService(t *testing.T) { handler := func(w http.ResponseWriter, r *http.Request) { testutils.AssertEqual(t, r.Method, "PUT") - testutils.AssertEqual(t, r.URL.Path, "/service/id/update") + testutils.AssertEqual(t, r.URL.Path, "/service/id/deploy") var req models.UpdateServiceRequest Unmarshal(t, r, &req)