Documentation
¶
Index ¶
Constants ¶
View Source
const (
DeviceUIDHeader = "X-Device-UID"
)
Variables ¶
View Source
var ( ErrConnectionFailed = errors.New("connection failed") ErrNotFound = errors.New("not found") ErrForbidden = errors.New("forbidden") ErrUnknown = errors.New("unknown error") )
View Source
var ErrRequestFailed = errors.New("request failed")
ErrRequestFailed is returned when an HTTP request fails to be executed.
Functions ¶
func HasError ¶ added in v0.21.0
HasError checks if there was an error in the HTTP response or if the provided error is not nil.
func WithAsynqWorker ¶ added in v0.17.0
func WithAsynqWorker(redisURI string) clientOption
Types ¶
type Config ¶ added in v0.21.0
type Config struct {
// RetryCount defines how many times the client should retry a request in case of failure.
RetryCount int `env:"SHELLHUB_INTERNAL_HTTP_CLIENT_RETRY_COUNT,default=3"`
// RetryWaitTime defines the wait time between retries.
RetryWaitTime int `env:"SHELLHUB_INTERNAL_HTTP_CLIENT_RETRY_WAIT_TIME,default=5"`
// RetryMaxWaitTime defines the maximum wait time between retries.
RetryMaxWaitTime int `env:"SHELLHUB_INTERNAL_HTTP_CLIENT_RETRY_MAX_WAIT_TIME,default=20"`
// APIBaseURL defines the base URL for the API service.
APIBaseURL string `env:"SHELLHUB_INTERNAL_HTTP_CLIENT_API_BASE_URL,default=http://api:8080"`
// EnterpriseBaseURL defines the base URL for enterprise endpoints (cloud component).
EnterpriseBaseURL string `env:"SHELLHUB_INTERNAL_HTTP_CLIENT_ENTERPRISE_BASE_URL,default=http://cloud:8080"`
}
Config holds configuration options for the client.
func DefaultConfig ¶ added in v0.21.0
DefaultConfig returns a Config struct with default values.
func NewConfigFromEnv ¶ added in v0.21.0
type Error ¶ added in v0.21.0
Error represents a custom error structure that includes an HTTP status code and a message.
type LeveledLogger ¶
func (*LeveledLogger) Debugf ¶ added in v0.9.0
func (l *LeveledLogger) Debugf(msg string, keysAndValues ...any)
func (*LeveledLogger) Errorf ¶ added in v0.9.0
func (l *LeveledLogger) Errorf(msg string, keysAndValues ...any)
func (*LeveledLogger) Warnf ¶ added in v0.9.0
func (l *LeveledLogger) Warnf(msg string, keysAndValues ...any)
type WebEndpoint ¶ added in v0.20.0
type WebEndpoint struct {
Address string `json:"address"`
Namespace string `json:"namespace"`
DeviceUID string `json:"device_uid"`
Device *models.Device `json:"device"`
Host string `json:"host"`
Port int `json:"port"`
TimeToLive int `json:"ttl"`
TLS WebEndpointTLS `json:"tls"`
ExpiresIn time.Time `json:"expires_in"`
CreatedAt time.Time `json:"time" bson:"time"`
}
type WebEndpointTLS ¶ added in v0.21.0
Source Files
¶
Click to show internal directories.
Click to hide internal directories.