mattjackson220 commented on a change in pull request #3534: TP Delivery Service 
Generate SSL update, new letsencrypt generate and…
URL: https://github.com/apache/trafficcontrol/pull/3534#discussion_r339763826
 
 

 ##########
 File path: traffic_ops/traffic_ops_golang/deliveryservice/keys.go
 ##########
 @@ -210,9 +218,75 @@ func getSSLKeysByXMLIDHelper(xmlID string, inf 
*api.APIInfo, w http.ResponseWrit
                        return
                }
        }
+
        api.WriteResp(w, r, keyObj)
 }
 
+// GetSSLKeysByXMLID fetches the deliveryservice ssl keys by the specified 
xmlID.
+func GetSSLKeysByXMLIDV14(w http.ResponseWriter, r *http.Request) {
+       inf, userErr, sysErr, errCode := api.NewInfo(r, []string{"xmlid"}, 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 xml id: Riak is not configured"))
+               return
+       }
+       xmlID := inf.Params["xmlid"]
+       getSSLKeysByXMLIDHelperV14(xmlID, inf, w, r)
+}
+
+func getSSLKeysByXMLIDHelperV14(xmlID string, inf *api.APIInfo, w 
http.ResponseWriter, r *http.Request) {
+       version := inf.Params["version"]
+       decode := inf.Params["decode"]
+       if userErr, sysErr, errCode := tenant.Check(inf.User, xmlID, 
inf.Tx.Tx); userErr != nil || sysErr != nil {
+               api.HandleErr(w, r, inf.Tx.Tx, errCode, userErr, sysErr)
+               return
+       }
+       keyObj, ok, err := riaksvc.GetDeliveryServiceSSLKeysObjV14(xmlID, 
version, inf.Tx.Tx, inf.Config.RiakAuthOptions, inf.Config.RiakPort)
+       if err != nil {
+               api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError, 
nil, errors.New("getting ssl keys: "+err.Error()))
+               return
+       }
+       if !ok {
+               api.WriteRespAlertObj(w, r, tc.InfoLevel, "no object found for 
the specified key", struct{}{}) // empty response object because Perl
 
 Review comment:
   done

----------------------------------------------------------------
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