Remove http2curl dependency#368
Closed
nicolai86 wants to merge 2 commits into
Closed
Conversation
Instead of printing http requests to play around with, the API SDK should be lightweight so it itself can be easily vendored into 3rd party tools (e.g. terraform). Similar functionality could be introduced by allowing users of the SDK to inject a custom logger, which has functions to log http requests specifically; the user could then decide to use whatever mechanism he sees fit, which would allow us to push this dependency to the user.
since the http2curl dependency is dropped, we can safely move the hideAPICredentials to where it is being used. Looking at similar golang based API SDKs, it might make sense to log sensitive by default if debug logging is enabled; otherwise we're supporting verbose logging w & w/o sensitive information, which makes configuration more complicated.
|
👍 for creating logger interfaces and remove all the unnecessary dependencies for the API clients users but we need to keep anonuuid and http2curl in the cli so we can continue to ask our users some outputs for support |
|
@QuentinPerez and I would be happy to help you on this point, do not hesitate if you feel it will take too much of your time |
Author
|
@moul I understand that use case. Introducing a pluggable Logger would allow us to keep the current logging as is, while also being able to use the SDK without anonuuid, logrus and http2curl. I'll open another PR which will introduce the Logger interface. thanks for the feedback. |
|
Perfect, looking forward for your pull-request |
Merged
clement-gilbert
pushed a commit
to clement-gilbert/scaleway-cli
that referenced
this pull request
Mar 3, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of printing http requests to play around with, the API SDK should be easy to use by itself (expose client use cases) & lightweight so it itself can be easily vendored into 3rd party tools (e.g. terraform).
For now, I'd like to remove seemingly unnecessary dependencies (specifically logrus, http2curl & anonuuid), to ease getting my terraform provider for scaleway merged.
Looking at the AWS SDK itself, introducing a customer logger interface looks like the clean solution, which would allow us to re-introduced the http2curl logging functionality by allowing users of the SDK to inject a custom logger, which has functions to log http requests specifically; the user can then decide to use whatever mechanism he sees fit, which would allow us to push this dependency to the user, which should be preferred for an API SDK.
In this PR I'm just removing the http2curl dependency, without introducing a custom logger interface, to keep the PR small. If you like the idea I'll go ahead to get a proper logger interface setup.
The logger interface is required anyway to get logrus & anonuuid out of the picture, but that's a separate discussion.