rawlinp commented on a change in pull request #2545: Update TO Go cdns/:name/federations (CRUDer) URL: https://github.com/apache/trafficcontrol/pull/2545#discussion_r202718141
########## File path: traffic_ops/client/v13/cdnfederations.go ########## @@ -0,0 +1,73 @@ +/* + + Licensed 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. +*/ + +package v13 + +import ( + "encoding/json" + "fmt" + + "github.com/apache/trafficcontrol/lib/go-tc/v13" +) + +/* Internally, the CDNName is only used in the GET method. The CDNName + * seems to primarily be used to differentiate between `/federations` and + * `/cdns/:name/federations`. Although the behavior is odd, it is kept to + * keep the same behavior from perl. */ + +func (to *Session) CreateCDNFederationByName(f v13.CDNFederation, CDNName string) (*v13.CreateCDNFederationResponse, ReqInf, error) { Review comment: The API implementation uses the nullable struct, which really only leaves the client implementation. If the client also uses the nullable struct, then there shouldn't be any need for the non-nullable struct. A lot of the legacy TO Go client code was already using the non-nullable structs, which is why they're still prevalent. IMO we need to go through all the existing client implementations to add methods that use the Nullable structs and properly decode the responses everywhere. We would then deprecate the existing methods that use non-nullable structs and eventually remove them. But for now we should just prevent adding onto that pile of non-nullable struct implementations. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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