Documentation ¶
Index ¶
- func WithBasicAuth(username, password string) func(*RoundTripper)
- func WithDefault429RetryDuration(duration time.Duration) func(*RetryableRoundtripper)
- func WithInsecureTLS() func(*RoundTripper)
- func WithLogger(log logr.Logger) func(*RoundTripper)
- func WithLogging() func(*RoundTripper)
- func WithMaxRetries(max uint) func(*RetryableRoundtripper)
- func WithRetryable(opts ...func(*RetryableRoundtripper)) func(*RoundTripper)
- func WithShouldRetry401Duration(duration time.Duration) func(*RetryableRoundtripper)
- func WithShouldRetry5XX(should bool) func(*RetryableRoundtripper)
- func WithShouldRetry5XXDuration(duration time.Duration) func(*RetryableRoundtripper)
- func WithShouldRetryError(should bool) func(*RetryableRoundtripper)
- func WithShouldRetryErrorDuration(duration time.Duration) func(*RetryableRoundtripper)
- type BasicAuthRoundTripper
- type LoggingRoundtripper
- type RetryableRoundtripper
- type RoundTripper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithBasicAuth ¶
func WithBasicAuth(username, password string) func(*RoundTripper)
func WithDefault429RetryDuration ¶
func WithDefault429RetryDuration(duration time.Duration) func(*RetryableRoundtripper)
func WithInsecureTLS ¶
func WithInsecureTLS() func(*RoundTripper)
WithInsecureTLS will disable TLS verification.
func WithLogger ¶
func WithLogger(log logr.Logger) func(*RoundTripper)
func WithLogging ¶
func WithLogging() func(*RoundTripper)
func WithMaxRetries ¶
func WithMaxRetries(max uint) func(*RetryableRoundtripper)
func WithRetryable ¶
func WithRetryable(opts ...func(*RetryableRoundtripper)) func(*RoundTripper)
func WithShouldRetry401Duration ¶
func WithShouldRetry401Duration(duration time.Duration) func(*RetryableRoundtripper)
func WithShouldRetry5XX ¶
func WithShouldRetry5XX(should bool) func(*RetryableRoundtripper)
func WithShouldRetry5XXDuration ¶
func WithShouldRetry5XXDuration(duration time.Duration) func(*RetryableRoundtripper)
func WithShouldRetryError ¶
func WithShouldRetryError(should bool) func(*RetryableRoundtripper)
func WithShouldRetryErrorDuration ¶
func WithShouldRetryErrorDuration(duration time.Duration) func(*RetryableRoundtripper)
Types ¶
type BasicAuthRoundTripper ¶
type BasicAuthRoundTripper struct {
// contains filtered or unexported fields
}
type LoggingRoundtripper ¶
type LoggingRoundtripper struct{}
type RetryableRoundtripper ¶
type RetryableRoundtripper struct {
// contains filtered or unexported fields
}
type RoundTripper ¶
type RoundTripper struct { *BasicAuthRoundTripper *RetryableRoundtripper *LoggingRoundtripper // contains filtered or unexported fields }
func NewRoundTripper ¶
func NewRoundTripper(original http.RoundTripper, opts ...func(*RoundTripper)) *RoundTripper
NewRoundTripper creates a new RoundTripper instance tailored for the application's specific needs. This custom RoundTripper provides a centralized place to manage outbound HTTP requests. By allowing configuration through functional options, it provides a clear, extensible, and maintainable way to adjust the behavior of HTTP calls. This ensures consistent logging, error handling, and other behaviors across all HTTP requests made in the application, reducing potential points of failure and simplifying debugging.
Click to show internal directories.
Click to hide internal directories.