gozscaler

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZPA_CLIENT_ID     = "ZPA_CLIENT_ID"
	ZPA_CLIENT_SECRET = "ZPA_CLIENT_SECRET"
	ZPA_CUSTOMER_ID   = "ZPA_CUSTOMER_ID"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthToken

type AuthToken struct {
	TokenType   string `json:"token_type"`
	AccessToken string `json:"access_token"`
}

Need to implement exponential back off to comply with the API rate limit. https://help.zscaler.com/zpa/about-rate-limiting 20 times in a 10 second interval for a GET call. 10 times in a 10 second interval for any POST/PUT/DELETE call. See example: https://github.com/okta/terraform-provider-okta/blob/master/okta/config.go

type BackoffConfig

type BackoffConfig struct {
	Enabled             bool // Set to true to enable backoff and retry mechanism
	RetryWaitMinSeconds int  // Minimum time to wait
	RetryWaitMaxSeconds int  // Maximum time to wait
	MaxNumOfRetries     int  // Maximum number of retries
}

BackoffConfig contains all the configuration for the backoff and retry mechanism

type Config

type Config struct {
	BaseURL           *url.URL
	PrivateAPIBaseURL *url.URL

	// The logger writer interface to write logging messages to. Defaults to standard out.
	Logger *log.Logger
	// Credentials for basic authentication.
	ClientID, ClientSecret, CustomerID string
	// Backoff config
	BackoffConf *BackoffConfig
	AuthToken   *AuthToken
	sync.Mutex
	// contains filtered or unexported fields
}

Config contains all the configuration data for the API client

func NewConfig

func NewConfig(clientID, clientSecret, customerID, rawUrl string) (*Config, error)

NewConfig returns a default configuration for the client. By default it will try to read the access and te secret from the environment variable.

Need to implement exponential back off to comply with the API rate limit. https://help.zscaler.com/zpa/about-rate-limiting 20 times in a 10 second interval for a GET call. 10 times in a 10 second interval for any POST/PUT/DELETE call. See example: https://github.com/okta/terraform-provider-okta/blob/master/okta/config.go TODO Add healthCheck method to NewConfig

func (*Config) GetHTTPClient

func (c *Config) GetHTTPClient() *http.Client

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL