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

Assign multiple servers to a capability #7079

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5b1f4bf
Added TO logic to assign multiple servers per capability.
rimashah25 Sep 21, 2022
bb9b700
Added TP logic to assign multiple servers per capability.
rimashah25 Sep 21, 2022
9d371c1
minor corrections and variable name change
rimashah25 Sep 21, 2022
d4d5173
Fixed vairable names.
rimashah25 Sep 22, 2022
46c00bc
Fixed broken links and another variable name change.
rimashah25 Sep 22, 2022
0ac8e34
Updated test client.
rimashah25 Sep 22, 2022
5924351
Updated based on review comments.
rimashah25 Sep 29, 2022
b31b4eb
Changed serverIDs type to int to avoid string to int conversion.
rimashah25 Sep 29, 2022
997379e
Added multiple_servers_capabilities() and changed the documents and r…
rimashah25 Oct 3, 2022
6271af2
Updated tests, and TP to relate to multiple_servers_capabilities().
rimashah25 Oct 3, 2022
5ac15fa
Removed old function for mass-assignment (server or capability)
rimashah25 Oct 4, 2022
f55f614
Updated route ID
rimashah25 Oct 4, 2022
63d9e15
Updated docs
rimashah25 Oct 4, 2022
27dc286
Updated docs-1
rimashah25 Oct 4, 2022
b4d16bd
Split PUT API call into POST and DELETE.
rimashah25 Oct 5, 2022
bbb60c8
Updated tests
rimashah25 Oct 5, 2022
a2ff315
Updated docs-2
rimashah25 Oct 5, 2022
b568d72
Updated tests, added another condition for simultaneous add, delete.
rimashah25 Oct 5, 2022
8aa5973
Updated tests-1
rimashah25 Oct 6, 2022
ef2ae39
Tired to remove database query built from user-controlled sources
rimashah25 Oct 6, 2022
66cb5b4
Fix APIv5 test.
rimashah25 Oct 6, 2022
29b55eb
Fixed docs based on review comments and removed duplicate code.
rimashah25 Oct 8, 2022
888acca
Added pageType variable to reduce if-else statements.
rimashah25 Oct 11, 2022
b4b2d8d
Updated per review comments-1
rimashah25 Oct 12, 2022
4065690
Updated tests.
rimashah25 Oct 27, 2022
bdf32e1
Updated tests and docs.
rimashah25 Oct 27, 2022
35f6e8e
Removed unused variable
rimashah25 Oct 27, 2022
2228131
Added check for many:many
rimashah25 Oct 28, 2022
68fae1d
Added validation for JSON body.
rimashah25 Oct 31, 2022
a6a3a02
Updated tests based on newly added validation logic.
rimashah25 Oct 31, 2022
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [unreleased]
### Added
- [#6033](https://github.com/apache/trafficcontrol/issues/6033) *Traffic Ops, Traffic Portal* Added ability to assign multiple servers per capability.
- [#7081](https://github.com/apache/trafficcontrol/issues/7081) *Traffic Router* Added better log messages for TR connection exceptions.
- [#7089](https://github.com/apache/trafficcontrol/issues/7089) *Traffic Router* Added the ability to specify HTTPS certificate attributes.
- [#7109](https://github.com/apache/trafficcontrol/pull/7109) *Traffic Router* Removed `dnssec.zone.diffing.enabled` and `dnssec.rrsig.cache.enabled` parameters.
Expand All @@ -14,7 +15,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- [#7063](https://github.com/apache/trafficcontrol/pull/7063) *Traffic Ops* Added API version 5.0 (IN DEVELOPMENT)
- [#2101](https://github.com/apache/trafficcontrol/issues/2101) *Traffic Portal* Added the ability to tell if a Delivery Service is the target of another steering DS.
- [#6021](https://github.com/apache/trafficcontrol/issues/6021) *Traffic Portal* Added the ability to view a change logs message in it's entirety by clicking on it.
- [#6033](https://github.com/apache/trafficcontrol/issues/6033) *Traffic Ops, Traffic Portal* Added ability to assign multiple server capabilities to a server.
- [#7078](https://github.com/apache/trafficcontrol/issues/7078) *Traffic Ops, Traffic Portal* Added ability to assign multiple server capabilities to a server.
- [#7096](https://github.com/apache/trafficcontrol/issues/7096) [Health Client] Added health client parent health
- [#7032](https://github.com/apache/trafficcontrol/issues/7032) *Cache Config* Add t3c-apply flag to use local ATS version for config generation rather than Server package Parameter, to allow managing the ATS OS package via external tools. See 'man t3c-apply' and 'man t3c-generate' for details.
- [#7097](https://github.com/apache/trafficcontrol/issues/7097) *Traffic Ops, Traffic Portal, t3c* Added the `regional` field to Delivery Services, which affects whether `maxOriginConnections` should be per Cache Group
Expand Down
83 changes: 0 additions & 83 deletions docs/source/api/v4/multiple_server_capabilities.rst

This file was deleted.

192 changes: 192 additions & 0 deletions docs/source/api/v4/multiple_servers_capabilities.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
..
..
.. Licensed under the Apache License, Version 2.0 (the "License");
.. you may not use this file except in compliance with the License.
.. You may obtain a copy of the License at
..
.. http://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS,
.. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
.. See the License for the specific language governing permissions and
.. limitations under the License.
..

.. _to-api-v4-multiple_servers_capabilities:

*********************************
``multiple_servers_capabilities``
*********************************

.. versionadded:: 4.1

``POST``
========
Inserts a list of :term:`Server Capability` names associated to a server and vice versa i.e insert a list of :term:`Server` ids associated to a server capability.

:Auth. Required: Yes
:Roles Required: "admin" or "operations"
:Permissions Required: SERVER:READ, SERVER:CREATE, SERVER-CAPABILITY:READ, SERVER-CAPABILITY:CREATE
:Response Type: Object

Request Structure
-----------------
:serverIds: List of :term:`Server` ids (integral, unique identifier) associated with a :term:`Server Capability`
:serverCapabilities: List of :term:`Server Capability` names to associate with a :term:`Server` id
:pageType: To determine which configuration (server or server capabilities) is requesting association. Only two values are permitted: `server` or `sc` (short for server capability). If `server` is chosen, it implies that multiple server capabilities are to be associated with a given server id. If `sc` is chosen, it implies that multiple server ids are to be associated with a given server capability.

.. code-block:: http
:caption: Request Example1

POST /api/4.1/multiple_servers_capabilities/ HTTP/1.1
Host: trafficops.infra.ciab.test
User-Agent: curl/7.47.0
Accept: */*
Cookie: mojolicious=...
Content-Length: 84
Content-Type: application/json

{
"serverIds": [1],
"serverCapabilities": ["test", "disk"]
"pageType": "server"
}

.. code-block:: http
:caption: Request Example2

POST /api/4.1/multiple_servers_capabilities/ HTTP/1.1
Host: trafficops.infra.ciab.test
User-Agent: curl/7.47.0
Accept: */*
Cookie: mojolicious=...
Content-Length: 84
Content-Type: application/json

{
"serverIds": [2, 3]
"serverCapabilities": ["eas"],
"pageType": "sc"
}

Response Structure
------------------
:serverId: List of :term:`Server` ids (integral, unique identifier) associated with a server capability.
:serverCapabilities: List of :term:`Server Capability` names to be associated with a :term:`Server` id.

.. code-block:: http
rimashah25 marked this conversation as resolved.
Show resolved Hide resolved
:caption: Response Example1

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin: *
Content-Type: application/json
Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 8 Aug 2022 22:40:54 GMT; Max-Age=3600; HttpOnly
Whole-Content-Sha512: eQrl48zWids0kDpfCYmmtYMpegjnFxfOVvlBYxxLSfp7P7p6oWX4uiC+/Cfh2X9i3G+MQ36eH95gukJqOBOGbQ==
X-Server-Name: traffic_ops_golang/
Date: Mon, 08 Aug 2022 16:15:11 GMT
Content-Length: 157

{
"alerts": [{
"text": "Multiple Server Capabilities assigned to a server",
"level": "success"
}],
"response": {
"serverIds": [1],
"serverCapabilities": ["test", "disk"]
}
}

.. code-block:: http
:caption: Response Example2

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin: *
Content-Type: application/json
Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 8 Aug 2022 22:40:54 GMT; Max-Age=3600; HttpOnly
Whole-Content-Sha512: eQrl48zWids0kDpfCYmmtYMpegjnFxfOVvlBYxxLSfp7P7p6oWX4uiC+/Cfh2X9i3G+MQ36eH95gukJqOBOGbQ==
X-Server-Name: traffic_ops_golang/
Date: Mon, 08 Aug 2022 16:15:11 GMT
Content-Length: 157

{
"alerts": [{
"text": "Multiple Servers assigned to a capability",
"level": "success"
}],
"response": {
"serverIds": [2, 3]
"serverCapabilities": ["eas"],
}
}

``DELETE``
==========
Deletes a list of :term:`Server Capability` names associated to a server and vice versa i.e. deletes a list of :term:`Server` ids associated to a server capability.

:Auth. Required: Yes
:Roles Required: "admin" or "operations"
:Permissions Required: SERVER:READ, SERVER:DELETE, SERVER-CAPABILITY:READ, SERVER-CAPABILITY:DELETE
:Response Type: Object

Request Structure
-----------------
:serverIds: List of :term:`Server` ids (integral, unique identifier) associated with a :term:`Server Capability`
:serverCapabilities: List of :term:`Server Capability` names to associate with a :term:`Server` id
:pageType: To determine which configuration (server or server capabilities) is requesting deletion. Only two values are permitted: `server` or `sc` (short for server capability). If `server` is chosen, it implies that multiple server capabilities are to be deleted for a given server id. If `sc` is chosen, it implies that multiple server ids are to be deleted for a given server capability.

.. code-block:: http
:caption: Request Example

DELETE /api/4.1/multiple_servers_capabilities/ HTTP/1.1
Host: trafficops.infra.ciab.test
User-Agent: curl/7.47.0
Accept: */*
Cookie: mojolicious=...
Content-Length: 84
Content-Type: application/json

{
"serverIds": [2, 3]
"serverCapabilities": ["eas"],
"pageType": "sc"
}

Response Structure
------------------
:serverId: List of :term:`Server` ids (integral, unique identifier) associated with a server capability.
:serverCapabilities: List of :term:`Server Capability` names to be associated with a :term:`Server` id.

.. code-block:: http
:caption: Response Example

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin: *
Content-Type: application/json
Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 8 Aug 2022 22:40:54 GMT; Max-Age=3600; HttpOnly
Whole-Content-Sha512: eQrl48zWids0kDpfCYmmtYMpegjnFxfOVvlBYxxLSfp7P7p6oWX4uiC+/Cfh2X9i3G+MQ36eH95gukJqOBOGbQ==
X-Server-Name: traffic_ops_golang/
Date: Mon, 08 Aug 2022 16:15:11 GMT
Content-Length: 157

{
"alerts": [{
"text": "Removed multiple servers from capabilities or multiple servers to a capability",
"level": "success"
}],
"response": {
"serverIds": [2, 3]
"serverCapabilities": ["eas"],
}
}

81 changes: 0 additions & 81 deletions docs/source/api/v5/multiple_server_capabilities.rst

This file was deleted.