ocket8888 opened a new pull request #5512:
URL: https://github.com/apache/trafficcontrol/pull/5512
## What does this PR (Pull Request) do?
- [x] This PR is not related to any Issue
This PR primarily removes client methods that were marked deprecated in the
old, un-versioned `github.com/apache/trafficcontrol/traffic_ops/client`
package. It then removes the now-unnecessary qualifiers from method names. For
example, if the client currently has methods:
```go
func (to *Session) GetSomethingWithHdr(header http.Header) (ResponseType,
ReqInf, error) {
// Actually do something
}
func (to *Session) GetSomething() (ResponseType, ReqInf, error) {
return to.GetSomethingWithHdr(nil)
}
```
... this PR would replace it with:
```go
func (to *Session) GetSomething(header http.Header) (ResponseType, ReqInf,
error) {
// Actually do something
}
```
This PR also collapses duplicate methods, like turning:
```go
func (to *Session) GetSomethingWithHdr(header http.Header) (ResponseType,
ReqInf, error) {
return to.GGetSomethingWithQueryParamsAndHdr(nil, header)
}
func (to *Session) GetSomethingWithQueryParamsAndHdr(qparams url.Values,
header http.Header) (ResponseType, ReqInf, error) {
// Actually do something
}
```
into:
```go
func (to *Session) GetSomething(qparams url.Values, header http.Header)
(ResponseType, ReqInf, error) {
// Actually do something
}
```
Furthermore, there were roughly four different ways we were passing
arbitrary query string parameters into methods
* Using actual `net/url.Values` structures
* Using a pointer to a `net/url.Values` structure
* Just a raw `map[string]string`
* A literal string that is concatenated onto the end of a request path
These have been consolidated to use `net/url.Values`, (at least I hope I got
them all).
Because of an issue where a client method was duplicated - specifically
`GetParameters` takes query parameters for filtering but `GetParametersByValue`
existed and filtered client-side by iterating the response - because it
provided functionality not offered by the TO API itself, this PR also adds
support for the "value" query parameter to `/parameters`. This was a one-line
code change in TO (docs changes make it a bit longer), so I'm leaving it in
this open PR, but I also opened #5508 which would do that separately and if
it's deemed too big to squeeze into this PR then I'll put this in draft until
that's merged.
This PR also adds a bunch of GoDoc comments, removes the
`/deliveryservice_user` methods/file since that isn't in APIv4, enforces proper
ID types (a bunch of methods took strings for an `int` field which essentially
just caused a lot of `strconv.Itoa` in the places where they were called), and
changes most functions that took/returned ATC object type _pointers_ to just
use the types, to avoid requests having side effects on the caller's structures
and to avoid the caller having to do a lot of `nil` checks that ought to be
unnecessary.
Finally, because the CDN-in-a-Box enroller links against the v4 API client,
some changes to the client also necessitate changes to the enroller.
## Which Traffic Control components are affected by this PR?
- CDN-in-a-Box
- Documentation
- Traffic Ops Client (Go)
- Traffic Ops
## What is the best way to verify this PR?
Ensure the Go client/API integration tests all still pass, CDN-in-a-Box can
still build and run, docs build without errors or warnings, and read through
the Go client code to ensure I didn't miss any deprecated/duplicated methods or
uses of non-`net/url.Values` query parameters.
## The following criteria are ALL met by this PR
- [x] This PR includes tests
- [x] This PR includes documentation
- [x] This PR includes an update to CHANGELOG.md
- [x] This PR includes any and all required license headers
- [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY**
----------------------------------------------------------------
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]