-
Notifications
You must be signed in to change notification settings - Fork 25
[VC-43403] Refactor the CyberArk dataupload client to take an HTTP client #700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6c2e839
to
a49662f
Compare
a49662f
to
5bd316d
Compare
25eccd6
to
e61ad7a
Compare
…ability - Replaced `NewCyberArkClient` with `New` for a cleaner API - Removed dependency on `x509.CertPool` and `transport.NewDebuggingRoundTripper` - Updated `CyberArkClient` to use `http.Client` directly - Refactored tests to use `MockDataUploadServer` with `testing.TB` for better cleanup - Simplified mock server setup and logging for improved maintainability Signed-off-by: Richard Wall <[email protected]>
5bd316d
to
3fa015d
Compare
|
||
serviceURL := fmt.Sprintf("https://%s%s%s.%s", subdomain, separator, discoveryContextServiceName, platformDomain) | ||
// TODO(wallrj): get this from the servicediscovery API instead. | ||
inventoryAPI := fmt.Sprintf("https://%s.inventory.%s", subdomain, platformDomain) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This TODO is implemented in a followup PR: #701
|
||
_ "embed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
embed was never used in this mock. Other mocks load sample API responses from files, but this mock doesn't...yet.
@@ -6,4 +6,4 @@ import ( | |||
|
|||
type CyberArkClient = dataupload.CyberArkClient | |||
|
|||
var NewCyberArkClient = dataupload.NewCyberArkClient | |||
var NewCyberArkClient = dataupload.New |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In #696 I will introduce a MachineHub / CyberArk outputter (data publisher) and put it in this file.
Similar to #699, I want all the cyberark API wrappers to take an httpClient as an injected dependency rather than them each instantiating their own client. This way the http client can be created once, with sensible defaults and roundtrippers, and supplied to all the API wrappers.
NewCyberArkClient
withNew
to simplify client initializationby removing certificate pool handling and relying on an injected HTTP client.
CyberArkClient
to usehttpClient
instead ofclient
for clarity.MockDataUploadServer
to return both server URL and HTTP client,improving test setup and reducing boilerplate.
dataupload_test.go
andmock.go
.Follow up PRs