trafficcontrol-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject [trafficcontrol] branch master updated: Changed post, put, and delete to pass on ReqInf
Date Thu, 20 Sep 2018 22:31:37 GMT
This is an automated email from the ASF dual-hosted git repository.

rob pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 4c7315e  Changed post, put, and delete to pass on ReqInf
4c7315e is described below

commit 4c7315e18d80d279308d00fc122e5066b8fe8842
Author: moltzaum <matthew@moltzau.net>
AuthorDate: Tue Sep 18 10:38:22 2018 -0600

    Changed post, put, and delete to pass on ReqInf
---
 traffic_ops/client/deliveryservice.go       |  6 +++---
 traffic_ops/client/deliveryserviceserver.go |  2 +-
 traffic_ops/client/dsuser.go                |  4 ++--
 traffic_ops/client/tenant.go                |  6 +++---
 traffic_ops/client/util.go                  | 15 ++++++---------
 5 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/traffic_ops/client/deliveryservice.go b/traffic_ops/client/deliveryservice.go
index bfa5d74..da3d855 100644
--- a/traffic_ops/client/deliveryservice.go
+++ b/traffic_ops/client/deliveryservice.go
@@ -92,7 +92,7 @@ func (to *Session) CreateDeliveryService(ds *tc.DeliveryService) (*tc.CreateDeli
 	if err != nil {
 		return nil, err
 	}
-	err = post(to, deliveryServicesEp(), jsonReq, &data)
+	_, err = post(to, deliveryServicesEp(), jsonReq, &data)
 	if err != nil {
 		return nil, err
 	}
@@ -108,7 +108,7 @@ func (to *Session) UpdateDeliveryService(id string, ds *tc.DeliveryService)
(*tc
 	if err != nil {
 		return nil, err
 	}
-	err = put(to, deliveryServiceEp(id), jsonReq, &data)
+	_, err = put(to, deliveryServiceEp(id), jsonReq, &data)
 	if err != nil {
 		return nil, err
 	}
@@ -119,7 +119,7 @@ func (to *Session) UpdateDeliveryService(id string, ds *tc.DeliveryService)
(*tc
 // DeleteDeliveryService deletes the DeliveryService matching the ID it's passed
 func (to *Session) DeleteDeliveryService(id string) (*tc.DeleteDeliveryServiceResponse, error)
{
 	var data tc.DeleteDeliveryServiceResponse
-	err := del(to, deliveryServiceEp(id), &data)
+	_, err := del(to, deliveryServiceEp(id), &data)
 	if err != nil {
 		return nil, err
 	}
diff --git a/traffic_ops/client/deliveryserviceserver.go b/traffic_ops/client/deliveryserviceserver.go
index 4e618ea..bff05fd 100644
--- a/traffic_ops/client/deliveryserviceserver.go
+++ b/traffic_ops/client/deliveryserviceserver.go
@@ -37,7 +37,7 @@ func (to *Session) CreateDeliveryServiceServers(dsID int, serverIDs []int,
repla
 	resp := struct {
 		Response tc.DSServerIDs `json:"response"`
 	}{}
-	if err := post(to, path, jsonReq, &resp); err != nil {
+	if _, err := post(to, path, jsonReq, &resp); err != nil {
 		return nil, err
 	}
 	return &resp.Response, nil
diff --git a/traffic_ops/client/dsuser.go b/traffic_ops/client/dsuser.go
index f39137b..f6f7b67 100644
--- a/traffic_ops/client/dsuser.go
+++ b/traffic_ops/client/dsuser.go
@@ -42,7 +42,7 @@ func (to *Session) SetDeliveryServiceUser(userID int, dses []int, replace
bool)
 		return nil, err
 	}
 	resp := tc.UserDeliveryServicePostResponse{}
-	err = post(to, uri, jsonReq, &resp)
+	_, err = post(to, uri, jsonReq, &resp)
 	if err != nil {
 		return nil, err
 	}
@@ -53,7 +53,7 @@ func (to *Session) SetDeliveryServiceUser(userID int, dses []int, replace
bool)
 func (to *Session) DeleteDeliveryServiceUser(userID int, dsID int) (*tc.UserDeliveryServiceDeleteResponse,
error) {
 	uri := apiBase + `/deliveryservice_user/` + strconv.Itoa(dsID) + `/` + strconv.Itoa(userID)
 	resp := tc.UserDeliveryServiceDeleteResponse{}
-	if err := del(to, uri, &resp); err != nil {
+	if _, err := del(to, uri, &resp); err != nil {
 		return nil, err
 	}
 	return &resp, nil
diff --git a/traffic_ops/client/tenant.go b/traffic_ops/client/tenant.go
index 6955b72..23552ce 100644
--- a/traffic_ops/client/tenant.go
+++ b/traffic_ops/client/tenant.go
@@ -70,7 +70,7 @@ func (to *Session) CreateTenant(t *tc.Tenant) (*tc.TenantResponse, error)
{
 	if err != nil {
 		return nil, err
 	}
-	err = post(to, tenantsEp(), jsonReq, &data)
+	_, err = post(to, tenantsEp(), jsonReq, &data)
 	if err != nil {
 		return nil, err
 	}
@@ -86,7 +86,7 @@ func (to *Session) UpdateTenant(id string, t *tc.Tenant) (*tc.TenantResponse,
er
 	if err != nil {
 		return nil, err
 	}
-	err = put(to, tenantEp(id), jsonReq, &data)
+	_, err = put(to, tenantEp(id), jsonReq, &data)
 	if err != nil {
 		return nil, err
 	}
@@ -97,7 +97,7 @@ func (to *Session) UpdateTenant(id string, t *tc.Tenant) (*tc.TenantResponse,
er
 // DeleteTenant deletes the Tenant matching the ID it's passed
 func (to *Session) DeleteTenant(id string) (*tc.DeleteTenantResponse, error) {
 	var data tc.DeleteTenantResponse
-	err := del(to, tenantEp(id), &data)
+	_, err := del(to, tenantEp(id), &data)
 	if err != nil {
 		return nil, err
 	}
diff --git a/traffic_ops/client/util.go b/traffic_ops/client/util.go
index af95be6..ed4443a 100644
--- a/traffic_ops/client/util.go
+++ b/traffic_ops/client/util.go
@@ -25,19 +25,16 @@ func get(to *Session, endpoint string, respStruct interface{}) (ReqInf,
error) {
 	return makeReq(to, "GET", endpoint, nil, respStruct)
 }
 
-func post(to *Session, endpoint string, body []byte, respStruct interface{}) error {
-	_, err := makeReq(to, "POST", endpoint, body, respStruct)
-	return err
+func post(to *Session, endpoint string, body []byte, respStruct interface{}) (ReqInf, error)
{
+	return makeReq(to, "POST", endpoint, body, respStruct)
 }
 
-func put(to *Session, endpoint string, body []byte, respStruct interface{}) error {
-	_, err := makeReq(to, "PUT", endpoint, body, respStruct)
-	return err
+func put(to *Session, endpoint string, body []byte, respStruct interface{}) (ReqInf, error)
{
+	return makeReq(to, "PUT", endpoint, body, respStruct)
 }
 
-func del(to *Session, endpoint string, respStruct interface{}) error {
-	_, err := makeReq(to, "DELETE", endpoint, nil, respStruct)
-	return err
+func del(to *Session, endpoint string, respStruct interface{}) (ReqInf, error) {
+	return makeReq(to, "DELETE", endpoint, nil, respStruct)
 }
 
 func makeReq(to *Session, method, endpoint string, body []byte, respStruct interface{}) (ReqInf,
error) {


Mime
View raw message