Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- /cachegroups/:id (GET)
- /cachegroup/:parameterID/parameter
- /cachegroups/:parameterID/parameter/available
- /cachegroups/:id/unassigned_parameters
- /cachegroups/trimmed
- /cdns/:name/configs/routing
- /cdns/:name/federations/:id (GET)
Expand Down
8 changes: 8 additions & 0 deletions docs/source/api/v1/cachegroups_id_unassigned_parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
********************************************
``cachegroups/{{id}}/unassigned_parameters``
********************************************
.. deprecated:: ATCv4
This endpoint and all of its functionality is deprecated. All of the information it can return can be obtained using :ref:`to-api-v1-cachegroupparameters` & :ref:`to-api-v1-parameters`.

``GET``
=======
Expand Down Expand Up @@ -104,4 +106,10 @@ Response Structure
"id": 6843,
"configFile": "hdr_rw_mid_bamtech-nhl-live-t.config"
}
],
"alerts": [
{
"text": "This endpoint is deprecated, please use GET /cachegroupparameters & GET /parameters instead",
"level": "warning"
}
]}
107 changes: 0 additions & 107 deletions docs/source/api/v2/cachegroups_id_unassigned_parameters.rst

This file was deleted.

11 changes: 0 additions & 11 deletions traffic_control/clients/python/trafficops/tosession.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,17 +387,6 @@ def get_cachegroup_parameters(self, cache_group_id=None):
:raises: Union[LoginError, OperationError]
"""

@api_request('get', 'cachegroups/{cache_group_id:d}/unassigned_parameters', ('2.0',))
def get_cachegroup_unassigned_parameters(self, cache_group_id=None):
"""
Get a cache groups unassigned parameters
:ref:`to-api-cachegroups-id-unassigned_parameters`
:param cache_group_id: The cache group Id
:type cache_group_id: int
:rtype: Tuple[Dict[str, Any], requests.Response]
:raises: Union[LoginError, OperationError]
"""

@api_request('get', 'cachegroupparameters', ('2.0',))
def get_all_cachegroup_parameters(self):
"""
Expand Down
12 changes: 0 additions & 12 deletions traffic_ops/client/cachegroup_parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ func (to *Session) GetCacheGroupParametersByQueryParams(cacheGroupID int, queryP
return to.getCacheGroupParameters(route, queryParams)
}

// GetCacheGroupUnassignedParameters Gets a Cache Group's Unassigned Parameters
func (to *Session) GetCacheGroupUnassignedParameters(cacheGroupID int) ([]tc.CacheGroupParameter, ReqInf, error) {
route := fmt.Sprintf("%s/%d/unassigned_parameters", API_CACHEGROUPS, cacheGroupID)
return to.getCacheGroupParameters(route, "")
}

// GetCacheGroupParametersByQueryParams Gets a Cache Group's Unassigned Parameters with query parameters
func (to *Session) GetCacheGroupUnassignedParametersByQueryParams(cacheGroupID int, queryParams string) ([]tc.CacheGroupParameter, ReqInf, error) {
route := fmt.Sprintf("%s/%d/unassigned_parameters", API_CACHEGROUPS, cacheGroupID)
return to.getCacheGroupParameters(route, queryParams)
}

func (to *Session) getCacheGroupParameters(route, queryParams string) ([]tc.CacheGroupParameter, ReqInf, error) {
r := fmt.Sprintf("%s%s", route, queryParams)
resp, remoteAddr, err := to.request(http.MethodGet, r, nil)
Expand Down
38 changes: 0 additions & 38 deletions traffic_ops/testing/api/v2/cachegroups_parameters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
func TestCacheGroupParameters(t *testing.T) {
WithObjs(t, []TCObj{Types, Parameters, CacheGroups, CacheGroupParameters}, func() {
GetTestCacheGroupParameters(t)
GetTestCacheGroupUnassignedParameters(t)
})
}

Expand Down Expand Up @@ -75,25 +74,6 @@ func GetTestCacheGroupParameters(t *testing.T) {
}
}

func GetTestCacheGroupUnassignedParameters(t *testing.T) {
for _, cgp := range testData.CacheGroupParameterRequests {
// Check that Unassigned Parameters does not include Assigned Parameter
unassignedCGParamsResp, _, err := TOSession.GetCacheGroupUnassignedParameters(cgp.CacheGroupID)
if err != nil {
t.Errorf("could not get unassigned parameters for cache group %v: %v", cgp.CacheGroupID, err)
}
if unassignedCGParamsResp == nil {
t.Fatal("unassigned parameters response should not be nil")
}

for _, param := range unassignedCGParamsResp {
if cgp.ParameterID == param.ID {
t.Errorf("assigned parameter %v found in unassigned response", param.ID)
}
}
}
}

func DeleteTestCacheGroupParameters(t *testing.T) {
for _, cgp := range testData.CacheGroupParameterRequests {
DeleteTestCacheGroupParameter(t, cgp)
Expand Down Expand Up @@ -121,24 +101,6 @@ func DeleteTestCacheGroupParameter(t *testing.T, cgp tc.CacheGroupParameterReque
t.Errorf("expected Parameter: %d to be to be disassociated from Cache Group: %d", cgp.ParameterID, cgp.CacheGroupID)
}

// Check that the disassociated Parameter is now apart of Unassigned Parameters
unassignedCGParamsResp, _, err := TOSession.GetCacheGroupUnassignedParameters(cgp.CacheGroupID)
if err != nil {
t.Errorf("could not get unassigned parameters for cache group %v: %v", cgp.CacheGroupID, err)
}
if unassignedCGParamsResp == nil {
t.Fatal("unassigned parameters response should not be nil")
}
found := false
for _, param := range unassignedCGParamsResp {
if cgp.ParameterID == param.ID {
found = true
}
}
if !found {
t.Fatalf("parameter %v removed from cache group %v was not found in unassigned parameters response", cgp.ParameterID, cgp.CacheGroupID)
}

// Attempt to delete it again and it should return an error now
_, _, err = TOSession.DeleteCacheGroupParameter(cgp.CacheGroupID, cgp.ParameterID)
if err == nil {
Expand Down
3 changes: 1 addition & 2 deletions traffic_ops/traffic_ops_golang/routing/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ func Routes(d ServerData) ([]Route, []RawRoute, http.Handler, error) {
{api.Version{2, 0}, http.MethodGet, `cachegroupparameters/?$`, cachegroupparameter.ReadAllCacheGroupParameters, auth.PrivLevelReadOnly, Authenticated, nil, 212449724, perlBypass},
{api.Version{2, 0}, http.MethodPost, `cachegroupparameters/?$`, cachegroupparameter.AddCacheGroupParameters, auth.PrivLevelOperations, Authenticated, nil, 212449725, perlBypass},
{api.Version{2, 0}, http.MethodGet, `cachegroups/{id}/parameters/?$`, api.ReadHandler(&cachegroupparameter.TOCacheGroupParameter{}), auth.PrivLevelReadOnly, Authenticated, nil, 212449723, noPerlBypass},
{api.Version{2, 0}, http.MethodGet, `cachegroups/{id}/unassigned_parameters/?$`, api.ReadHandler(&cachegroupparameter.TOCacheGroupUnassignedParameter{}), auth.PrivLevelReadOnly, Authenticated, nil, 2457339250, noPerlBypass},
{api.Version{2, 0}, http.MethodDelete, `cachegroupparameters/{cachegroupID}/{parameterId}$`, api.DeleteHandler(&cachegroupparameter.TOCacheGroupParameter{}), auth.PrivLevelOperations, Authenticated, nil, 212449733, noPerlBypass},

//Capabilities
Expand Down Expand Up @@ -559,7 +558,7 @@ func Routes(d ServerData) ([]Route, []RawRoute, http.Handler, error) {
{api.Version{1, 1}, http.MethodGet, `cachegroupparameters/?(\.json)?$`, cachegroupparameter.ReadAllCacheGroupParameters, auth.PrivLevelReadOnly, Authenticated, nil, 912449724, perlBypass},
{api.Version{1, 1}, http.MethodPost, `cachegroupparameters/?(\.json)?$`, cachegroupparameter.AddCacheGroupParameters, auth.PrivLevelOperations, Authenticated, nil, 912449725, perlBypass},
{api.Version{1, 1}, http.MethodGet, `cachegroups/{id}/parameters/?(\.json)?$`, api.ReadHandler(&cachegroupparameter.TOCacheGroupParameter{}), auth.PrivLevelReadOnly, Authenticated, nil, 912449723, perlBypass},
{api.Version{1, 1}, http.MethodGet, `cachegroups/{id}/unassigned_parameters/?(\.json)?$`, api.ReadHandler(&cachegroupparameter.TOCacheGroupUnassignedParameter{}), auth.PrivLevelReadOnly, Authenticated, nil, 1457339250, perlBypass},
{api.Version{1, 1}, http.MethodGet, `cachegroups/{id}/unassigned_parameters/?(\.json)?$`, api.DeprecatedReadHandler(&cachegroupparameter.TOCacheGroupUnassignedParameter{}, util.StrPtr("GET /cachegroupparameters & GET /parameters")), auth.PrivLevelReadOnly, Authenticated, nil, 1457339250, perlBypass},
{api.Version{1, 1}, http.MethodDelete, `cachegroupparameters/{cachegroupID}/{parameterId}$`, api.DeleteHandler(&cachegroupparameter.TOCacheGroupParameter{}), auth.PrivLevelOperations, Authenticated, nil, 912449733, perlBypass},

//Capabilities
Expand Down
11 changes: 0 additions & 11 deletions traffic_portal/app/src/common/api/ParameterService.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,6 @@ var ParameterService = function($http, locationUtils, messageModel, ENV) {
);
};

this.getCacheGroupUnassignedParams = function(cgId) {
return $http.get(ENV.api['legacy'] + 'cachegroups/' + cgId + '/unassigned_parameters').then(
function (result) {
return result.data.response;
},
function (err) {
throw err;
}
);
};

};

ParameterService.$inject = ['$http', 'locationUtils', 'messageModel', 'ENV'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ var TableCacheGroupParametersController = function(cacheGroup, parameters, $cont
cg: function() {
return cacheGroup;
},
parameters: function(parameterService) {
return parameterService.getCacheGroupUnassignedParams(cacheGroup.id);
allParams: function(parameterService) {
return parameterService.getParameters();
},
assignedParams: function() {
return new Set(parameters.map(function(x){return x.id;}));
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,30 @@
* under the License.
*/

var TableCacheGroupParamsUnassignedController = function(cg, parameters, $scope, $uibModalInstance) {
var TableCacheGroupParamsUnassignedController = function(cg, allParams, assignedParams, $scope, $uibModalInstance) {

var selectedParams = [];

$scope.cg = cg;

$scope.unassignedParams = parameters;
$scope.unassignedParams = allParams.filter(
function(p) {
return !assignedParams.has(p.id);
}
);

var addParam = function(paramId) {
if (_.indexOf(selectedParams, paramId) == -1) {
if (selectedParams.indexOf(paramId) === -1) {
selectedParams.push(paramId);
}
};

var removeParam = function(paramId) {
selectedParams = _.without(selectedParams, paramId);
selectedParams = selectedParams.filter(
function (param) {
return param !== paramId;
}
);
};

$scope.updateParams = function($event, paramId) {
Expand Down Expand Up @@ -70,5 +78,5 @@ var TableCacheGroupParamsUnassignedController = function(cg, parameters, $scope,

};

TableCacheGroupParamsUnassignedController.$inject = ['cg', 'parameters', '$scope', '$uibModalInstance'];
TableCacheGroupParamsUnassignedController.$inject = ['cg', 'allParams', 'assignedParams', '$scope', '$uibModalInstance'];
module.exports = TableCacheGroupParamsUnassignedController;