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
Show all changes
21 commits
Select commit Hold shift + click to select a range
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 @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [unreleased]
### Added
- [#6234](https://github.com/apache/trafficcontrol/issues/6234) *Traffic Ops, Traffic Portal* Added description field to Server Capabilities
- [#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.
Expand Down
29 changes: 27 additions & 2 deletions docs/source/api/v4/server_capabilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ Request Structure
Response Structure
------------------
:name: The name of this :term:`Server Capability`
:description: The description of this :term:`Server Capability`
Comment thread
rimashah25 marked this conversation as resolved.
Outdated

.. versionadded:: 4.1

:lastUpdated: The date and time at which this :term:`Server Capability` was last updated, in ISO-like format

.. code-block:: http
Expand All @@ -71,6 +75,7 @@ Response Structure
"response": [
{
"name": "RAM",
"description": "ram server capability",
"lastUpdated": "2019-10-07 20:38:24+00"
}
]
Expand All @@ -88,6 +93,10 @@ Create a new :term:`Server Capability`.
Request Structure
-----------------
:name: The name of the :term:`Server Capability`
:description: The description of this :term:`Server Capability`

.. versionadded:: 4.1


.. code-block:: http
:caption: Request Example
Expand All @@ -101,12 +110,17 @@ Request Structure
Content-Type: application/json

{
"name": "RAM"
"name": "RAM",
"description": "ram server capability",
}

Response Structure
------------------
:name: The name of this :term:`Server Capability`
:description: The description of this :term:`Server Capability`

.. versionadded:: 4.1

:lastUpdated: The date and time at which this :term:`Server Capability` was last updated, in ISO-like format

.. code-block:: http
Expand All @@ -133,6 +147,7 @@ Response Structure
],
"response": {
"name": "RAM",
"description": "ram server capability",
"lastUpdated": "2019-10-07 22:10:00+00"
}
}
Expand All @@ -149,6 +164,10 @@ Update an existing :term:`Server Capability`.
Request Structure
-----------------
:name: The name of the :term:`Server Capability`
:description: The description of this :term:`Server Capability`

.. versionadded:: 4.1


.. code-block:: http
:caption: Request Example
Expand All @@ -162,12 +181,17 @@ Request Structure
Content-Type: application/json

{
"name": "HDD"
"name": "HDD",
"description": "HDD server capability"
}

Response Structure
------------------
:name: The name of this :term:`Server Capability`
:description: The description of this :term:`Server Capability`

.. versionadded:: 4.1

:lastUpdated: The date and time at which this :term:`Server Capability` was last updated, in ISO-like format

.. code-block:: http
Expand All @@ -194,6 +218,7 @@ Response Structure
],
"response": {
"name": "HDD",
"description": "HDD server capability",
"lastUpdated": "2021-03-03 21:22:08+00"
}
}
Expand Down
14 changes: 12 additions & 2 deletions docs/source/api/v5/server_capabilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Request Structure
Response Structure
------------------
:name: The name of this :term:`Server Capability`
:description: The description of this :term:`Server Capability`
:lastUpdated: The date and time at which this :term:`Server Capability` was last updated, in ISO-like format

.. code-block:: http
Expand All @@ -71,6 +72,7 @@ Response Structure
"response": [
{
"name": "RAM",
"description": "ram server capability",
"lastUpdated": "2019-10-07 20:38:24+00"
}
]
Expand All @@ -88,6 +90,7 @@ Create a new :term:`Server Capability`.
Request Structure
-----------------
:name: The name of the :term:`Server Capability`
:description: The description of this :term:`Server Capability`

.. code-block:: http
:caption: Request Example
Expand All @@ -101,12 +104,14 @@ Request Structure
Content-Type: application/json

{
"name": "RAM"
"name": "RAM",
"description": "ram server capability",
}

Response Structure
------------------
:name: The name of this :term:`Server Capability`
:description: The description of this :term:`Server Capability`
:lastUpdated: The date and time at which this :term:`Server Capability` was last updated, in ISO-like format

.. code-block:: http
Expand All @@ -133,6 +138,7 @@ Response Structure
],
"response": {
"name": "RAM",
"description": "ram server capability",
"lastUpdated": "2019-10-07 22:10:00+00"
}
}
Expand All @@ -149,6 +155,7 @@ Update an existing :term:`Server Capability`.
Request Structure
-----------------
:name: The name of the :term:`Server Capability`
:description: The description of this :term:`Server Capability`

.. code-block:: http
:caption: Request Example
Expand All @@ -162,12 +169,14 @@ Request Structure
Content-Type: application/json

{
"name": "HDD"
"name": "HDD",
"description": "HDD server capability"
}

Response Structure
------------------
:name: The name of this :term:`Server Capability`
:description: The description of this :term:`Server Capability`
:lastUpdated: The date and time at which this :term:`Server Capability` was last updated, in ISO-like format

.. code-block:: http
Expand All @@ -194,6 +203,7 @@ Response Structure
],
"response": {
"name": "HDD",
"description": "HDD server capability",
"lastUpdated": "2021-03-03 21:22:08+00"
}
}
Expand Down
6 changes: 3 additions & 3 deletions infrastructure/cdn-in-a-box/enroller/enroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -771,18 +771,18 @@ func enrollServer(toSession *session, r io.Reader) error {
return err
}

// enrollServerCapability takes a json file and creates a ServerCapability object using the TO API
// enrollServerCapability takes a json file and creates a ServerCapabilityV41 object using the TO API
func enrollServerCapability(toSession *session, r io.Reader) error {
dec := json.NewDecoder(r)
var s tc.ServerCapability
var s tc.ServerCapabilityV41
err := dec.Decode(&s)
if err != nil {
err = fmt.Errorf("error decoding Server Capability: %v", err)
log.Infoln(err)
return err
}

alerts, _, err := toSession.CreateServerCapability(s, client.RequestOptions{})
alerts, _, err := toSession.CreateServerCapabilityV41(s, client.RequestOptions{})
if err != nil {
err = fmt.Errorf("error creating Server Capability: %v - alerts: %+v", err, alerts.Alerts)
log.Infoln(err)
Expand Down
21 changes: 21 additions & 0 deletions lib/go-tc/server_capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,35 @@ type ServerCapabilitiesResponse struct {
Alerts
}

// ServerCapabilitiesResponseV41 contains the result data from a GET(v4.1 and above) /server_capabilities request.
type ServerCapabilitiesResponseV41 struct {
Response []ServerCapabilityV41 `json:"response"`
Alerts
}

// ServerCapability contains information about a given ServerCapability in Traffic Ops.
type ServerCapability struct {
Name string `json:"name" db:"name"`
LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
}

// ServerCapabilityV4 is an alias for the latest minor version for the major version 4.
type ServerCapabilityV4 ServerCapabilityV41

// ServerCapabilityV41 contains information (in-addition to description) about a given ServerCapability in Traffic Ops.
type ServerCapabilityV41 struct {
ServerCapability
Description string `json:"description" db:"description"`
}

// ServerCapabilityDetailResponse contains the result data from a POST /server_capabilities request.
type ServerCapabilityDetailResponse struct {
Response ServerCapability `json:"response"`
Alerts
}

// ServerCapabilityDetailResponseV41 contains the result data from a POST(v4.1 and above) /server_capabilities request.
type ServerCapabilityDetailResponseV41 struct {
Response ServerCapabilityV41 `json:"response"`
Alerts
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to you 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.
*/

ALTER TABLE public.server_capability DROP column description;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to you 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.
*/

ALTER TABLE public.server_capability ADD COLUMN IF NOT EXISTS description text NOT NULL DEFAULT '';
Loading