Documentation ¶
Index ¶
- Constants
- Variables
- 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 WithZCCClientID(clientID string) ConfigSetter
- func WithZCCClientSecret(clientSecret string) ConfigSetter
- func WithZCCCloud(cloud string) ConfigSetter
- type Configuration
Constants ¶
View Source
const ( MaxNumOfRetries = 50 RetryWaitMaxSeconds = 20 RetryWaitMinSeconds = 5 )
View Source
const ( VERSION = "3.0.0" ZCC_CLIENT_ID = "ZCC_CLIENT_ID" ZCC_CLIENT_SECRET = "ZCC_CLIENT_SECRET" ZCC_CLOUD = "ZCC_CLOUD" )
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:"jwtToken"` ExpiresIn int `json:"-"` // Skip direct JSON unmarshaling Expiry time.Time RawExpiresIn string `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 WithZCCClientID ¶ added in v3.0.11
func WithZCCClientID(clientID string) ConfigSetter
ConfigSetter type defines a function that modifies a Config struct. WithClientID sets the ClientID in the Config.
func WithZCCClientSecret ¶ added in v3.0.11
func WithZCCClientSecret(clientSecret string) ConfigSetter
WithClientSecret sets the ClientSecret in the Config.
func WithZCCCloud ¶ added in v3.0.11
func WithZCCCloud(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 ZCC struct { Client struct { ZCCClientID string `yaml:"apiKey" envconfig:"ZCC_CLIENT_ID"` ZCCClientSecret string `yaml:"secretKey" envconfig:"ZCC_CLIENT_SECRET"` ZCCCloud string `yaml:"cloud" envconfig:"ZCC_CLOUD"` AuthToken *AuthToken `yaml:"authToken"` AccessToken *AuthToken `yaml:"accessToken"` Proxy struct { Port int32 `yaml:"port" envconfig:"ZCC_CLIENT_PROXY_PORT"` Host string `yaml:"host" envconfig:"ZCC_CLIENT_PROXY_HOST"` Username string `yaml:"username" envconfig:"ZCC_CLIENT_PROXY_USERNAME"` Password string `yaml:"password" envconfig:"ZCC_CLIENT_PROXY_PASSWORD"` } `yaml:"proxy"` RequestTimeout time.Duration `yaml:"requestTimeout" envconfig:"ZCC_CLIENT_REQUEST_TIMEOUT"` RateLimit struct { MaxRetries int32 `yaml:"maxRetries" envconfig:"ZCC_CLIENT_RATE_LIMIT_MAX_RETRIES"` RetryWaitMin time.Duration `yaml:"minWait" envconfig:"ZCC_CLIENT_RATE_LIMIT_MIN_WAIT"` RetryWaitMax time.Duration `yaml:"maxWait" envconfig:"ZCC_CLIENT_RATE_LIMIT_MAX_WAIT"` BackoffConf *BackoffConfig } `yaml:"rateLimit"` } `yaml:"client"` Testing struct { DisableHttpsCheck bool `yaml:"disableHttpsCheck" envconfig:"ZCC_TESTING_DISABLE_HTTPS_CHECK"` } `yaml:"testing"` } `yaml:"zcc"` }
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.