Documentation ¶
Index ¶
- Constants
- Variables
- type ApiErr
- type AuthRequest
- type AuthToken
- type BackoffConfig
- type Client
- type ConfigSetter
- func WithDebug(debug bool) ConfigSetter
- func WithHttpClientPtr(httpClient *http.Client) ConfigSetter
- func WithProxyHost(host string) ConfigSetter
- func WithProxyPassword(pass string) ConfigSetter
- func WithProxyPort(i int32) ConfigSetter
- func WithProxyUsername(username string) ConfigSetter
- func WithRateLimitMaxRetries(maxRetries int32) ConfigSetter
- func WithRateLimitMaxWait(maxWait time.Duration) ConfigSetter
- func WithRateLimitMinWait(minWait time.Duration) ConfigSetter
- func WithRequestTimeout(requestTimeout time.Duration) ConfigSetter
- func WithTestingDisableHttpsCheck(httpsCheck bool) ConfigSetter
- func WithUserAgentExtra(userAgent string) ConfigSetter
- func WithZDXAPIKeyID(keyID string) ConfigSetter
- func WithZDXAPISecret(apiSecret string) ConfigSetter
- func WithZDXCloud(cloud string) ConfigSetter
- type Configuration
Constants ¶
View Source
const ( JSessionIDTimeout = 30 // minutes. MaxNumOfRetries = 100 RetryWaitMaxSeconds = 20 RetryWaitMinSeconds = 5 )
View Source
const ( VERSION = "3.0.0" ZDX_API_KEY_ID = "ZDX_API_KEY_ID" ZDX_API_SECRET = "ZDX_API_SECRET" )
Variables ¶
View Source
var (
// ContextAccessToken takes a string OAuth2 access token as authentication for the request.
ContextAccessToken = contextKey("access_token")
)
Functions ¶
This section is empty.
Types ¶
type AuthRequest ¶
type AuthToken ¶
type AuthToken struct { TokenType string `json:"token_type"` AccessToken string `json:"token"` ExpiresIn int `json:"expires_in"` }
func Authenticate ¶ added in v3.0.11
type BackoffConfig ¶
type Client ¶
type Client struct { sync.Mutex Config *Configuration }
func NewClient ¶
func NewClient(config *Configuration) (*Client, error)
type ConfigSetter ¶ added in v3.0.11
type ConfigSetter func(*Configuration)
func WithDebug ¶ added in v3.0.11
func WithDebug(debug bool) ConfigSetter
func WithHttpClientPtr ¶ added in v3.0.11
func WithHttpClientPtr(httpClient *http.Client) ConfigSetter
WithHttpClient sets the HttpClient in the Config.
func WithProxyHost ¶ added in v3.0.11
func WithProxyHost(host string) ConfigSetter
func WithProxyPassword ¶ added in v3.0.11
func WithProxyPassword(pass string) ConfigSetter
func WithProxyPort ¶ added in v3.0.11
func WithProxyPort(i int32) ConfigSetter
func WithProxyUsername ¶ added in v3.0.11
func WithProxyUsername(username string) ConfigSetter
func WithRateLimitMaxRetries ¶ added in v3.0.11
func WithRateLimitMaxRetries(maxRetries int32) ConfigSetter
func WithRateLimitMaxWait ¶ added in v3.0.11
func WithRateLimitMaxWait(maxWait time.Duration) ConfigSetter
func WithRateLimitMinWait ¶ added in v3.0.11
func WithRateLimitMinWait(minWait time.Duration) ConfigSetter
func WithRequestTimeout ¶ added in v3.0.11
func WithRequestTimeout(requestTimeout time.Duration) ConfigSetter
func WithTestingDisableHttpsCheck ¶ added in v3.0.11
func WithTestingDisableHttpsCheck(httpsCheck bool) ConfigSetter
func WithUserAgentExtra ¶ added in v3.0.11
func WithUserAgentExtra(userAgent string) ConfigSetter
WithUserAgent sets the UserAgent in the Config.
func WithZDXAPIKeyID ¶ added in v3.0.11
func WithZDXAPIKeyID(keyID string) ConfigSetter
ConfigSetter type defines a function that modifies a Config struct. WithClientID sets the ClientID in the Config.
func WithZDXAPISecret ¶ added in v3.0.11
func WithZDXAPISecret(apiSecret string) ConfigSetter
WithClientSecret sets the ClientSecret in the Config.
func WithZDXCloud ¶ added in v3.0.11
func WithZDXCloud(cloud string) ConfigSetter
type Configuration ¶ added in v3.0.11
type Configuration struct { sync.Mutex Logger logger.Logger HTTPClient *http.Client BaseURL *url.URL DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` Debug bool `json:"debug,omitempty"` UserAgentExtra string Context context.Context ZDX struct { Client struct { ZDXAPIKeyID string `yaml:"apiKey" envconfig:"ZDX_API_KEY_ID"` ZDXAPISecret string `yaml:"secretKey" envconfig:"ZDX_API_SECRET"` ZDXCloud string `yaml:"cloud" envconfig:"ZDX_CLOUD"` AuthToken *AuthToken `yaml:"authToken"` AccessToken *AuthToken `yaml:"accessToken"` Proxy struct { Port int32 `yaml:"port" envconfig:"ZDX_CLIENT_PROXY_PORT"` Host string `yaml:"host" envconfig:"ZDX_CLIENT_PROXY_HOST"` Username string `yaml:"username" envconfig:"ZDX_CLIENT_PROXY_USERNAME"` Password string `yaml:"password" envconfig:"ZDX_CLIENT_PROXY_PASSWORD"` } `yaml:"proxy"` RequestTimeout time.Duration `yaml:"requestTimeout" envconfig:"ZDX_CLIENT_REQUEST_TIMEOUT"` RateLimit struct { MaxRetries int32 `yaml:"maxRetries" envconfig:"ZDX_CLIENT_RATE_LIMIT_MAX_RETRIES"` RetryWaitMin time.Duration `yaml:"minWait" envconfig:"ZDX_CLIENT_RATE_LIMIT_MIN_WAIT"` RetryWaitMax time.Duration `yaml:"maxWait" envconfig:"ZDX_CLIENT_RATE_LIMIT_MAX_WAIT"` BackoffConf *BackoffConfig } `yaml:"rateLimit"` } `yaml:"client"` Testing struct { DisableHttpsCheck bool `yaml:"disableHttpsCheck" envconfig:"ZDX_TESTING_DISABLE_HTTPS_CHECK"` } `yaml:"testing"` } `yaml:"zdx"` }
func NewConfiguration ¶ added in v3.0.11
func NewConfiguration(conf ...ConfigSetter) (*Configuration, error)
func (*Configuration) AddDefaultHeader ¶ added in v3.0.11
func (c *Configuration) AddDefaultHeader(key string, value string)
AddDefaultHeader adds a new HTTP header to the default header in the request
func (*Configuration) SetBackoffConfig ¶ added in v3.0.11
func (cfg *Configuration) SetBackoffConfig(backoffConf *BackoffConfig)
Click to show internal directories.
Click to hide internal directories.