ocket8888 commented on a change in pull request #3534: TP Delivery Service 
Generate SSL update, new letsencrypt generate and renew API endpoints
URL: https://github.com/apache/trafficcontrol/pull/3534#discussion_r375447029
 
 

 ##########
 File path: traffic_ops/traffic_ops_golang/deliveryservice/keys.go
 ##########
 @@ -135,6 +144,48 @@ func GetSSLKeysByHostName(w http.ResponseWriter, r 
*http.Request) {
        }
 
        hostName := inf.Params["hostname"]
+       xmlID, ok, err := getXmlIdFromHostname(inf, hostName)
+       if err != nil {
+               api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError, 
nil, err)
+               return
+       }
+       if !ok {
+               api.WriteRespAlert(w, r, tc.InfoLevel, "- error getting cdn or 
delivery service for hostname "+hostName)
+               return
+       }
+
+       getSSLKeysByXMLIDHelper(xmlID, inf, w, r)
+}
+
+// GetSSLKeysByHostName fetches the ssl keys for a deliveryservice specified 
by the fully qualified hostname. V14 includes expiration date.
+func GetSSLKeysByHostNameV14(w http.ResponseWriter, r *http.Request) {
+       inf, userErr, sysErr, errCode := api.NewInfo(r, []string{"hostname"}, 
nil)
+       if userErr != nil || sysErr != nil {
+               api.HandleErr(w, r, inf.Tx.Tx, errCode, userErr, sysErr)
+               return
+       }
+       defer inf.Close()
+
+       if inf.Config.RiakEnabled == false {
+               api.HandleErr(w, r, inf.Tx.Tx, http.StatusServiceUnavailable, 
errors.New("the Riak service is unavailable"), errors.New("getting SSL keys 
from Riak by host name: Riak is not configured"))
+               return
+       }
+
+       hostName := inf.Params["hostname"]
+       xmlID, ok, err := getXmlIdFromHostname(inf, hostName)
+       if err != nil {
+               api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError, 
nil, err)
+               return
+       }
+       if !ok {
+               api.WriteRespAlert(w, r, tc.InfoLevel, "- error getting cdn or 
delivery service for hostname "+hostName)
 
 Review comment:
   Same as above RE: `info` vs `error` and returning `200 OK` on errors.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to