ocket8888 commented on a change in pull request #4942:
URL: https://github.com/apache/trafficcontrol/pull/4942#discussion_r474191418
##########
File path: traffic_ops/v3-client/deliveryservice.go
##########
@@ -357,6 +357,45 @@ func (to *Session) CreateDeliveryServiceNullable(ds
*tc.DeliveryServiceNullable)
return &data, nil
}
+func (to *Session) UpdateDeliveryServiceV30WithHdr(id int, ds
tc.DeliveryServiceNullableV30, header http.Header)
(tc.DeliveryServiceNullableV30, ReqInf, error) {
+ var reqInf ReqInf
+ bts, err := json.Marshal(ds)
+ if err != nil {
+ return tc.DeliveryServiceNullableV30{}, reqInf, err
+ }
+
+ var data tc.DeliveryServicesResponseV30
+ reqInf, err = put(to, fmt.Sprintf(API_DELIVERY_SERVICE_ID, id), bts,
&data, header)
+ if err != nil {
+ return tc.DeliveryServiceNullableV30{}, reqInf, err
+ }
+ if len(data.Response) != 1 {
+ return tc.DeliveryServiceNullableV30{}, reqInf,
fmt.Errorf("failed to update Delivery Service #%d; response indicated that %d
were updated", id, len(data.Response))
+ }
+ return data.Response[0], reqInf, nil
+
+}
+
+// UpdateDeliveryServiceV30 replaces the Delivery Service identified by the
+// integral, unique identifier 'id' with the one it's passed.
+// Deprecated: Use UpdateDeliveryServiceV30WithHdr instead.
+func (to *Session) UpdateDeliveryServiceV30(id int, ds
tc.DeliveryServiceNullableV30) (tc.DeliveryServiceNullableV30, ReqInf, error) {
+ return to.UpdateDeliveryServiceV30WithHdr(id, ds, nil)
+}
Review comment:
You can just make this take a header instead. Ditto the other functions.
They're brand new, so there's no need to deprecate them; you can change these.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]