Documentation ¶
Index ¶
- type Manager
- type ManagerConfig
- type Option
- func WithBaseUrl(baseUrl string) Option
- func WithDebugging(enabled bool) Option
- func WithLogRequest(v bool) Option
- func WithLogResponse(v bool) Option
- func WithLogger(l logger.Manager) Option
- func WithMetrics(enabled bool, metric telemetry.MetricsManager) Option
- func WithName(name string) Option
- func WithProxy(addr string) Option
- func WithTracing(enabled bool) Option
- func WithTransport(t ...TransportOption) Option
- type Props
- type Transport
- type TransportOption
- func TransportAppendReqIdHeaders(headers ...string) TransportOption
- func TransportReqIdHeaders(headers ...string) TransportOption
- func TransportWithAttributes(attributes ...attribute.KeyValue) TransportOption
- func TransportWithMeter(meter metric.Meter) TransportOption
- func TransportWithName(name string) TransportOption
- func TransportWithParent(parent http.RoundTripper) TransportOption
- func TransportWithTelemetry(tm telemetry.Manager) TransportOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface { // Get use bindSuccessTo and bindFailedTo to bind remote response to struct, while props to replace manager config on the fly Get(ctx context.Context, path string, params map[string]string, bindSuccessTo, bindFailedTo interface{}, opts ...Props) (httpCode int, err error) // Post use bindSuccessTo and bindFailedTo to bind remote response to struct, while props to replace manager config on the fly Post(ctx context.Context, path string, body interface{}, bindSuccessTo, bindFailedTo interface{}, opts ...Props) (httpCode int, err error) // Put use bindSuccessTo and bindFailedTo to bind remote response to struct, while props to replace manager config on the fly Put(ctx context.Context, path string, body interface{}, bindSuccessTo, bindFailedTo interface{}, opts ...Props) (httpCode int, err error) // Delete use bindSuccessTo and bindFailedTo to bind remote response to struct, while props to replace manager config on the fly Delete(ctx context.Context, path string, params map[string]string, bindSuccessTo, bindFailedTo interface{}, opts ...Props) (httpCode int, err error) // Head use bindSuccessTo and bindFailedTo to bind remote response to struct, while props to replace manager config on the fly Head(ctx context.Context, path string, bindSuccessTo, bindFailedTo interface{}, opts ...Props) (httpCode int, err error) // Patch use bindSuccessTo and bindFailedTo to bind remote response to struct, while props to replace manager config on the fly Patch(ctx context.Context, path string, body interface{}, bindSuccessTo, bindFailedTo interface{}, opts ...Props) (httpCode int, err error) CustomRequest(ctx context.Context, qp map[string]string, body interface{}, opts ...Props) *resty.Request GetClient() *resty.Client ManagerConfig // contains filtered or unexported methods }
type ManagerConfig ¶
type ManagerConfig interface { SetName(name string) Manager BaseUrl() string ChangeBaseUrl(url string) Manager Transport() http.RoundTripper // SetDefaultHeaders will set headers that will exist on every request SetDefaultHeaders(values map[string]string) Manager // WithDefaultHeaders add additional headers on top of default headers WithDefaultHeaders(additionalHeaders map[string]string) Manager WithTransport(transport http.RoundTripper) Manager WithTelemetry(tm telemetry.Manager) Manager WithCircuitBreaker( maxRequest uint32, interval time.Duration, timeout time.Duration, ) Manager // WithToken will set authentication token for every request (Authorization: Bearer) WithToken(token string) Manager DisableCircuitBreaker() Manager }
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithBaseUrl ¶
func WithDebugging ¶
func WithLogRequest ¶
func WithLogResponse ¶
func WithLogger ¶
func WithMetrics ¶
func WithMetrics(enabled bool, metric telemetry.MetricsManager) Option
func WithTracing ¶
func WithTransport ¶
func WithTransport(t ...TransportOption) Option
type Props ¶
type Props interface {
// contains filtered or unexported methods
}
func AppendToHeaders ¶
func ReplaceHeaders ¶
type Transport ¶
type Transport interface {
BuildRoundTripper() http.RoundTripper
}
func NewTransport ¶
func NewTransport(opts ...TransportOption) Transport
type TransportOption ¶
type TransportOption interface {
// contains filtered or unexported methods
}
func TransportAppendReqIdHeaders ¶
func TransportAppendReqIdHeaders(headers ...string) TransportOption
func TransportReqIdHeaders ¶
func TransportReqIdHeaders(headers ...string) TransportOption
func TransportWithAttributes ¶
func TransportWithAttributes(attributes ...attribute.KeyValue) TransportOption
TransportWithAttributes sets a list of attribute.KeyValue labels for all metrics associated with this round tripper
func TransportWithMeter ¶
func TransportWithMeter(meter metric.Meter) TransportOption
TransportWithMeter sets the underlying metric.Meter that is used to create metric instruments By default the no-op meter is used.
func TransportWithName ¶
func TransportWithName(name string) TransportOption
TransportWithName sets the prefix for the metrics emitted by this round tripper. by default, the "http.client" name is used.
func TransportWithParent ¶
func TransportWithParent(parent http.RoundTripper) TransportOption
TransportWithParent sets the underlying http.RoundTripper which is wrapped by this round tripper. If the provided http.RoundTripper is nil, http.DefaultTransport will be used as the base http.RoundTripper
func TransportWithTelemetry ¶
func TransportWithTelemetry(tm telemetry.Manager) TransportOption
TransportWithTelemetry trace the request with assigned telemetry manager