Documentation ¶
Index ¶
- Constants
- type Authorization
- type Body
- type Error
- type Header
- type Options
- func (o *Options) ClientHTTP(servername string) *http.Client
- func (o *Options) ClientHTTPTLS(tls libtls.TLSConfig, servername string) *http.Client
- func (o *Options) New(ctx libctx.FuncContext) (Request, error)
- func (o *Options) SetDefaultLog(fct liblog.FuncLog)
- func (o *Options) SetDefaultTLS(fct libtls.FctTLSDefault)
- func (o *Options) Update(ctx libctx.FuncContext, req Request) (Request, error)
- func (o *Options) Validate() liberr.Error
- type OptionsAuth
- type OptionsCredentials
- type OptionsHealth
- type OptionsHealthResult
- type OptionsToken
- type Request
- type Url
Constants ¶
View Source
const ( ErrorParamEmpty liberr.CodeError = iota + liberr.MinPkgRequest ErrorParamInvalid ErrorValidatorError ErrorCreateRequest ErrorSendRequest ErrorResponseInvalid ErrorResponseLoadBody ErrorResponseStatus ErrorResponseUnmarshall ErrorResponseContainsNotFound ErrorResponseNotContainsFound )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authorization ¶ added in v1.10.0
type Options ¶
type Options struct { Endpoint string `json:"endpoint" yaml:"endpoint" toml:"endpoint" mapstructure:"endpoint" validate:"required,url"` HttpClient libhtc.Options `json:"http_client" yaml:"http_client" toml:"http_client" mapstructure:"http_client" validate:"required,dive"` Auth OptionsAuth `json:"auth" yaml:"auth" toml:"auth" mapstructure:"auth" validate:"required,dive"` Health OptionsHealth `json:"health" yaml:"health" toml:"health" mapstructure:"health" validate:"required,dive"` // contains filtered or unexported fields }
func (*Options) ClientHTTP ¶ added in v1.10.0
func (*Options) ClientHTTPTLS ¶ added in v1.10.0
func (*Options) SetDefaultLog ¶ added in v1.10.0
func (*Options) SetDefaultTLS ¶
func (o *Options) SetDefaultTLS(fct libtls.FctTLSDefault)
type OptionsAuth ¶
type OptionsAuth struct { Basic OptionsCredentials `json:"basic" yaml:"basic" toml:"basic" mapstructure:"basic" validate:"required,dive"` Bearer OptionsToken `json:"bearer" yaml:"bearer" toml:"bearer" mapstructure:"bearer" validate:"required,dive"` }
type OptionsCredentials ¶
type OptionsHealth ¶
type OptionsHealth struct { Enable bool `json:"enable" yaml:"enable" toml:"enable" mapstructure:"enable"` Endpoint string `json:"endpoint" yaml:"endpoint" toml:"endpoint" mapstructure:"endpoint" validate:"url"` Auth OptionsAuth `json:"auth" yaml:"auth" toml:"auth" mapstructure:"auth" validate:"required,dive"` Result OptionsHealthResult `json:"result" yaml:"result" toml:"result" mapstructure:"result" validate:"required,dive"` Monitor moncfg.Config `json:"monitor" yaml:"monitor" toml:"monitor" mapstructure:"monitor" validate:"required,dive"` }
func (*OptionsHealth) Validate ¶ added in v1.10.2
func (o *OptionsHealth) Validate() liberr.Error
type OptionsHealthResult ¶
type OptionsHealthResult struct { ValidHTTPCode []int `json:"valid_http_code" yaml:"valid_http_code" toml:"valid_http_code" mapstructure:"valid_http_code"` InvalidHTTPCode []int `json:"invalid_http_code" yaml:"invalid_http_code" toml:"invalid_http_code" mapstructure:"invalid_http_code"` Contain []string `json:"contain" yaml:"contain" toml:"contain" mapstructure:"contain"` NotContain []string `json:"not_contain" yaml:"not_contain" toml:"not_contain" mapstructure:"not_contain"` }
type OptionsToken ¶
type Request ¶
type Request interface { Url Authorization Header Body Clone() (Request, error) New() (Request, error) GetOption() *Options SetOption(opt *Options) error RegisterHTTPClient(fct libtls.FctHttpClient) RegisterDefaultLogger(fct liblog.FuncLog) RegisterContext(fct libctx.FuncContext) Error() Error IsError() bool Do() (*http.Response, liberr.Error) DoParse(model interface{}, validStatus ...int) liberr.Error DoParseRetry(retry int, model interface{}, validStatus ...int) liberr.Error Monitor(ctx context.Context, vrs libver.Version) (montps.Monitor, error) HealthCheck(ctx context.Context) error }
type Url ¶ added in v1.10.0
type Url interface { SetEndpoint(u string) error GetEndpoint() string SetPath(raw bool, path string) AddPath(raw bool, path ...string) SetMethod(mtd string) GetMethod() string CleanParams() DelParams(key string) SetParams(key, val string) AddParams(key, val string) GetFullUrl() *url.URL SetFullUrl(u *url.URL) }
Click to show internal directories.
Click to hide internal directories.