Unify `endpoint` handling
#1775 introduced concept of endpoint and changed relevant components to use endpoint naming. With that in place we can unify their behavior in code.
Context
Current situation is a mix of using String and UriSerde where all of the components parse and validate them differently, making endpoint behave differently between components. So we have an opportunity to enhance UX by making endpoint consistent, reduce the amount of code by extracting parse and validation into shared code, make our validation more robust to catch potential issues early on, and make creating new components with endpoint a bit simpler.
Description
A list of what can be done, what are the issues, and other general notes:
- Push parsing to
serde(https://github.com/timberio/vector/issues/1775#issuecomment-584763786), this would reduce the amount of errors that we have to deal with later. - Allow
pathinendpoint. Even though #1775 definedendpointas having no path, we can't avoid that since some users are using it (https://github.com/timberio/vector/issues/1775#issuecomment-677915454). And while we could allow it for some components and not the others, that would decrease the benefits of this issue. - Check if we can actually disallow
queryandfragmentparts ofuri. For some of the components that's a hard yes, mostly for those that add a path of their own. - It would be nice if this all could be added by extending
UriSerde. For this,httpsink is the main outlier since it's usingUriSerdefor accepting fulluri. - Default schemes. For HTTP based components this should be
httpsso if users wants to use less secure connection they would need to specify the scheme. - Default authority. While all of the components can have a good default scheme, some of them also have default authority (ex.
logdnasink), but not all of them.
Problems
All of the above points tie to the three main problems:
- Determine the minimum of
urithat the user needs to pass for it to be a validendpoint. - Determine the maximum of
urithat the user can pass for it to be a validendpoint. - Define unified abstraction fluidly between those two points such that all of the components can use it.
Other
There is a trade-off between consistency and usability, and while the extreme of usability is a good option, the same can't be said for the opposite.
Source: vectordotdev/vector