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

rawlin pushed a commit to branch 4.1.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/4.1.x by this push:
     new bfd83c6  deep caching type and routing name are optional (#4756) 
(#4778)
bfd83c6 is described below

commit bfd83c6ae49e4ab6980cac6b28fea880ec735a85
Author: Rawlin Peters <[email protected]>
AuthorDate: Wed Jun 10 16:08:31 2020 -0600

    deep caching type and routing name are optional (#4756) (#4778)
    
    (cherry picked from commit 7fe31fa27c1c7b9b037c5884c3867874e9930cb2)
    
    Co-authored-by: Jeremy Mitchell <[email protected]>
---
 CHANGELOG.md                                    | 1 +
 docs/source/api/v1/deliveryservices_request.rst | 2 +-
 docs/source/api/v2/deliveryservices_request.rst | 2 +-
 lib/go-tc/deliveryservice_requests.go           | 6 +-----
 4 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index d597a3b..d10c750 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -63,6 +63,7 @@ The format is based on [Keep a 
Changelog](http://keepachangelog.com/en/1.0.0/).
 - Fixed the `GET /api/x/jobs` and `GET /api/x/jobs/:id` Traffic Ops API routes 
to allow falling back to Perl via the routing blacklist
 - Fixed audit logging from the `/jobs` APIs to bring them back to the same 
level of information provided by TO-Perl
 - Fixed #4541: traffic_ops_server.js searches based on which= and can find 
data for multiple servers
+- Fixed POST deliveryservices/request (designed to simple send an email) 
regression which erroneously required deep caching type and routing name. 
[Related github issue](https://github.com/apache/trafficcontrol/issues/4735)
 - Fixed `maxRevalDurationDays` validation for `POST 
/api/1.x/user/current/jobs` and added that validation to the `/api/x/jobs` 
endpoints
 
 ### Deprecated/Removed
diff --git a/docs/source/api/v1/deliveryservices_request.rst 
b/docs/source/api/v1/deliveryservices_request.rst
index 0d68dcb..a75e4b4 100644
--- a/docs/source/api/v1/deliveryservices_request.rst
+++ b/docs/source/api/v1/deliveryservices_request.rst
@@ -68,7 +68,7 @@ Request Structure
        :rangeRequestHandling:             A special string describing how the 
:term:`Delivery Service` should handle range requests
        :rateLimitingGBPS:                 An optional field which, if defined, 
should contain the maximum allowed data transfer rate for the :term:`Delivery 
Service` in GigaBytes Per Second (GBPS)
        :rateLimitingTPS:                  An optional field which, if defined, 
should contain the maximum allowed transaction rate for the :term:`Delivery 
Service` in Transactions Per Second (TPS)
-       :routingName:                      The routing name for the 
:term:`Delivery Service`, e.g. 
``SomeRoutingName.DeliveryService_xml_id.CDNName.com``
+       :routingName:                      An optional field which, if defined, 
should contain the routing name for the :term:`Delivery Service`, e.g. 
``SomeRoutingName.DeliveryService_xml_id.CDNName.com``
        :routingType:                      The :term:`Delivery Service`'s 
routing type, should be one of:
 
                HTTP
diff --git a/docs/source/api/v2/deliveryservices_request.rst 
b/docs/source/api/v2/deliveryservices_request.rst
index 48465c4..bf9d39e 100644
--- a/docs/source/api/v2/deliveryservices_request.rst
+++ b/docs/source/api/v2/deliveryservices_request.rst
@@ -68,7 +68,7 @@ Request Structure
        :rangeRequestHandling:             A special string describing how the 
:term:`Delivery Service` should handle range requests
        :rateLimitingGBPS:                 An optional field which, if defined, 
should contain the maximum allowed data transfer rate for the :term:`Delivery 
Service` in GigaBytes Per Second (GBPS)
        :rateLimitingTPS:                  An optional field which, if defined, 
should contain the maximum allowed transaction rate for the :term:`Delivery 
Service` in Transactions Per Second (TPS)
-       :routingName:                      The routing name for the 
:term:`Delivery Service`, e.g. 
``SomeRoutingName.DeliveryService_xml_id.CDNName.com``
+       :routingName:                      An optional field which, if defined, 
should contain the routing name for the :term:`Delivery Service`, e.g. 
``SomeRoutingName.DeliveryService_xml_id.CDNName.com``
        :routingType:                      The :term:`Delivery Service`'s 
routing type, should be one of:
 
                HTTP
diff --git a/lib/go-tc/deliveryservice_requests.go 
b/lib/go-tc/deliveryservice_requests.go
index cd5671f..3da0307 100644
--- a/lib/go-tc/deliveryservice_requests.go
+++ b/lib/go-tc/deliveryservice_requests.go
@@ -276,10 +276,7 @@ func (d *DeliveryServiceRequestRequest) Validate() error {
                validation.Field(&details.Customer, validation.Required),
                validation.Field(&details.DeepCachingType, validation.By(
                        func(t interface{}) error {
-                               if t == (*DeepCachingType)(nil) {
-                                       return errors.New("deepCachingType: 
required")
-                               }
-                               if *t.(*DeepCachingType) == 
DeepCachingTypeInvalid {
+                               if t != (*DeepCachingType)(nil) && 
*t.(*DeepCachingType) == DeepCachingTypeInvalid {
                                        return errors.New("deepCachingType: 
invalid Deep Caching Type")
                                }
                                return nil
@@ -339,7 +336,6 @@ func (d *DeliveryServiceRequestRequest) Validate() error {
                validation.Field(&details.PeakTPSEstimate, validation.Required),
                validation.Field(&details.QueryStringHandling, 
validation.Required),
                validation.Field(&details.RangeRequestHandling, 
validation.Required),
-               validation.Field(&details.RoutingName, validation.Required),
                validation.Field(&details.RoutingType, validation.By(
                        func(t interface{}) error {
                                if t == (*DSType)(nil) || *(t.(*DSType)) == "" {

Reply via email to