zia

package
v2.3.8 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSessionIDTimeout = 30 // minutes.

	MaxNumOfRetries     = 100
	RetryWaitMaxSeconds = 20
	RetryWaitMinSeconds = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiErr added in v2.1.0

type ApiErr struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type Client

type Client struct {
	sync.Mutex

	URL        string
	HTTPClient *http.Client
	Logger     logger.Logger
	UserAgent  string
	// contains filtered or unexported fields
}

Client ...

func NewClient

func NewClient(username, password, apiKey, ziaCloud, userAgent string) (*Client, error)

NewClient Returns a Client from credentials passed as parameters.

func (*Client) Create

func (c *Client) Create(endpoint string, o interface{}) (interface{}, error)

Create send HTTP Post request.

func (*Client) Delete

func (c *Client) Delete(endpoint string) error

Delete ...

func (*Client) GenericRequest added in v2.2.0

func (c *Client) GenericRequest(baseUrl, endpoint, method string, body io.Reader, urlParams url.Values, contentType string) ([]byte, error)

Request ... // Needs to review this function.

func (*Client) GetContentType

func (c *Client) GetContentType() string

func (*Client) GetSandboxToken added in v2.2.0

func (c *Client) GetSandboxToken() string

func (*Client) GetSandboxURL added in v2.2.0

func (c *Client) GetSandboxURL() string

func (*Client) Logout

func (c *Client) Logout() error

func (*Client) Read

func (c *Client) Read(endpoint string, o interface{}) error

Read ...

func (*Client) Request

func (c *Client) Request(endpoint, method string, data []byte, contentType string) ([]byte, error)

Request ... // Needs to review this function.

func (*Client) Update

func (c *Client) Update(endpoint string, o interface{}) (interface{}, error)

Update ...

func (*Client) UpdateWithPut

func (c *Client) UpdateWithPut(endpoint string, o interface{}) (interface{}, error)

Update ...

func (*Client) WithCache added in v2.0.2

func (c *Client) WithCache(cache bool)

func (*Client) WithCacheCleanWindow added in v2.0.2

func (c *Client) WithCacheCleanWindow(i time.Duration)

func (*Client) WithCacheTtl added in v2.0.2

func (c *Client) WithCacheTtl(i time.Duration)

func (*Client) WithFreshCache added in v2.0.2

func (client *Client) WithFreshCache()

type Credentials

type Credentials struct {
	Username  string `json:"username"`
	Password  string `json:"password"`
	APIKey    string `json:"apiKey"`
	TimeStamp string `json:"timestamp"`
}

Credentials ...

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response
	Err      error
	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).

type Session

type Session struct {
	AuthType           string `json:"authType"`
	ObfuscateAPIKey    bool   `json:"obfuscateApiKey"`
	PasswordExpiryTime int    `json:"passwordExpiryTime"`
	PasswordExpiryDays int    `json:"passwordExpiryDays"`
	Source             string `json:"source"`
	JSessionID         string `json:"jSessionID,omitempty"`
}

Session ...

func MakeAuthRequestZIA

func MakeAuthRequestZIA(credentials *Credentials, url string, client *http.Client, userAgent string) (*Session, error)

MakeAuthRequestZIA ...

Directories

Path Synopsis
services

Jump to

Keyboard shortcuts

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