This is an automated email from the ASF dual-hosted git repository.

ocket8888 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 994524d  Param name change to hostName for servercheck API (#5591)
994524d is described below

commit 994524dddee4b341a28e31a9f2d314691882f705
Author: Rima Shah <[email protected]>
AuthorDate: Mon Mar 1 13:16:33 2021 -0700

    Param name change to hostName for servercheck API (#5591)
    
    * Param name change to hostName
    
    * Updated test
---
 docs/source/api/v3/servercheck.rst                        |  6 +++---
 docs/source/api/v4/servercheck.rst                        |  6 +++---
 traffic_ops/testing/api/v4/serverchecks_test.go           |  2 +-
 traffic_ops/traffic_ops_golang/servercheck/servercheck.go | 12 ++++++------
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/docs/source/api/v3/servercheck.rst 
b/docs/source/api/v3/servercheck.rst
index dc90a38..b297d9a 100644
--- a/docs/source/api/v3/servercheck.rst
+++ b/docs/source/api/v3/servercheck.rst
@@ -38,13 +38,13 @@ Request Structure
        
+===========+==========+====================================================================================+
        | id        | no       | Return only :term:`cache servers` with this 
integral, unique identifier (id)       |
        
+-----------+----------+------------------------------------------------------------------------------------+
-       | name      | no       | Return only :term:`cache servers` with this 
host_name                              |
+       | hostName  | no       | Return only :term:`cache servers` with this 
host_name                              |
        
+-----------+----------+------------------------------------------------------------------------------------+
 
 .. code-block:: http
-       :caption: Request Example with ``name`` query param
+       :caption: Request Example with ``hostName`` query param
 
-       GET /api/4.0/servercheck?name=edge HTTP/1.1
+       GET /api/4.0/servercheck?hostName=edge HTTP/1.1
        Host: trafficops.infra.ciab.test
        User-Agent: curl/7.47.0
        Accept: */*
diff --git a/docs/source/api/v4/servercheck.rst 
b/docs/source/api/v4/servercheck.rst
index 3f71966..40b9b42 100644
--- a/docs/source/api/v4/servercheck.rst
+++ b/docs/source/api/v4/servercheck.rst
@@ -38,13 +38,13 @@ Request Structure
        
+===========+==========+====================================================================================+
        | id        | no       | Return only :term:`cache servers` with this 
integral, unique identifier (id)       |
        
+-----------+----------+------------------------------------------------------------------------------------+
-       | name      | no       | Return only :term:`cache servers` with this 
host_name                              |
+       | hostName  | no       | Return only :term:`cache servers` with this 
host_name                              |
        
+-----------+----------+------------------------------------------------------------------------------------+
 
 .. code-block:: http
-       :caption: Request Example with ``name`` query param
+       :caption: Request Example with ``hostName`` query param
 
-       GET /api/4.0/servercheck?name=edge HTTP/1.1
+       GET /api/4.0/servercheck?hostName=edge HTTP/1.1
        Host: trafficops.infra.ciab.test
        User-Agent: curl/7.47.0
        Accept: */*
diff --git a/traffic_ops/testing/api/v4/serverchecks_test.go 
b/traffic_ops/testing/api/v4/serverchecks_test.go
index f782e4f..ac98454 100644
--- a/traffic_ops/testing/api/v4/serverchecks_test.go
+++ b/traffic_ops/testing/api/v4/serverchecks_test.go
@@ -144,7 +144,7 @@ func GetTestServerChecks(t *testing.T) {
 
 func GetTestServerChecksWithName(t *testing.T) {
        params := url.Values{}
-       params.Set("name", "atlanta-edge-01")
+       params.Set("hostName", "atlanta-edge-01")
 
        // Get server checks
        scResp, alerts, _, err := TOSession.GetServersChecks(params, nil)
diff --git a/traffic_ops/traffic_ops_golang/servercheck/servercheck.go 
b/traffic_ops/traffic_ops_golang/servercheck/servercheck.go
index 385c9c3..436b55b 100644
--- a/traffic_ops/traffic_ops_golang/servercheck/servercheck.go
+++ b/traffic_ops/traffic_ops_golang/servercheck/servercheck.go
@@ -240,8 +240,8 @@ func handleReadServerCheck(inf *api.APIInfo, tx *sql.Tx) 
([]tc.GenericServerChec
 
        // Query Parameters to Database Query column mappings
        queryParamsToQueryCols := map[string]dbhelpers.WhereColumnInfo{
-               "id":   dbhelpers.WhereColumnInfo{"servercheck.server", 
api.IsInt},
-               "name": dbhelpers.WhereColumnInfo{"server.host_name", nil},
+               "id":       dbhelpers.WhereColumnInfo{"servercheck.server", 
api.IsInt},
+               "hostName": dbhelpers.WhereColumnInfo{"server.host_name", nil},
        }
 
        where, orderBy, pagination, queryValues, errs := 
dbhelpers.BuildWhereAndOrderByAndPagination(inf.Params, queryParamsToQueryCols)
@@ -254,8 +254,8 @@ func handleReadServerCheck(inf *api.APIInfo, tx *sql.Tx) 
([]tc.GenericServerChec
                whereSI = "WHERE type.name LIKE 'MID%' OR type.name LIKE 
'EDGE%' "
                whereSC = ""
        } else if len(inf.Params) == 1 {
-               if _, ok := inf.Params["name"]; ok {
-                       whereSI = "WHERE (type.name LIKE 'MID%' OR type.name 
LIKE 'EDGE%') AND server.host_name=:name "
+               if _, ok := inf.Params["hostName"]; ok {
+                       whereSI = "WHERE (type.name LIKE 'MID%' OR type.name 
LIKE 'EDGE%') AND server.host_name=:hostName "
                        whereSC = ""
                } else if _, ok = inf.Params["id"]; ok {
                        whereSI = "WHERE (type.name LIKE 'MID%' OR type.name 
LIKE 'EDGE%') AND server.id=:id "
@@ -266,9 +266,9 @@ func handleReadServerCheck(inf *api.APIInfo, tx *sql.Tx) 
([]tc.GenericServerChec
                }
        } else if len(inf.Params) > 1 {
                _, ok := inf.Params["id"]
-               _, ok1 := inf.Params["name"]
+               _, ok1 := inf.Params["hostName"]
                if ok && ok1 {
-                       whereSI = "WHERE (type.name LIKE 'MID%' OR type.name 
LIKE 'EDGE%') AND (server.host_name=:name AND server.id=:id)"
+                       whereSI = "WHERE (type.name LIKE 'MID%' OR type.name 
LIKE 'EDGE%') AND (server.host_name=:hostName AND server.id=:id)"
                        whereSC = "WHERE servercheck.server=:id"
                } else {
                        whereSI = "WHERE type.name LIKE 'MID%' OR type.name 
LIKE 'EDGE%' "

Reply via email to