zcc

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZCC_CLIENT_ID     = "ZCC_CLIENT_ID"
	ZCC_CLIENT_SECRET = "ZCC_CLIENT_SECRET"
	ZCC_CLOUD         = "ZCC_CLOUD"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRequest

type AuthRequest struct {
	APIKey    string `json:"apiKey"`
	SecretKey string `json:"secretKey"`
}

type AuthToken

type AuthToken struct {
	AccessToken string `json:"jwtToken"`
}

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
}

type Client

type Client struct {
	Config *Config
}

func NewClient

func NewClient(config *Config) (c *Client)

NewClient returns a new client for the specified apiKey.

func (*Client) NewRequestDo

func (client *Client) NewRequestDo(method, url string, options, body, v interface{}) (*http.Response, error)

type Config

type Config struct {
	BaseURL *url.URL

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

Config contains all the configuration data for the API client

func NewConfig

func NewConfig(clientID, clientSecret, cloud, userAgent 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. TODO Add healthCheck method to NewConfig

func (*Config) GetHTTPClient

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

func (*Config) SetBackoffConfig

func (c *Config) SetBackoffConfig(backoffConf BackoffConfig)

type CredentialsConfig

type CredentialsConfig struct {
	ClientID     string `json:"zpa_client_id"`
	ClientSecret string `json:"zpa_client_secret"`
	CustomerID   string `json:"zpa_customer_id"`
	ZpaCloud     string `json:"zpa_cloud"`
}

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response
	Message  string
}

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

func (ErrorResponse) IsObjectNotFound

func (r ErrorResponse) IsObjectNotFound() bool

IsObjectNotFound returns true on missing object error (404).

Directories

Path Synopsis
services

Jump to

Keyboard shortcuts

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