zia

package
v3.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: MIT Imports: 25 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

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 ... Client ...

func NewClient

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

NewClient Returns a Client from credentials passed as parameters.

func (*Client) BulkDelete

func (c *Client) BulkDelete(endpoint string, payload interface{}) (*http.Response, error)

BulkDelete sends an HTTP POST request for bulk deletion and expects a 204 No Content response.

func (*Client) Create

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

Create sends an HTTP POST request.

func (*Client) CreateWithRawPayload

func (c *Client) CreateWithRawPayload(endpoint string, payload string) ([]byte, error)

CreateWithRawPayload sends an HTTP POST request with a raw string payload.

func (*Client) CreateWithSlicePayload

func (c *Client) CreateWithSlicePayload(endpoint string, slice interface{}) ([]byte, error)

func (*Client) Delete

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

Delete ...

func (*Client) GenericRequest

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

func (c *Client) GetSandboxToken() string

func (*Client) GetSandboxURL

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) UpdateWithSlicePayload

func (c *Client) UpdateWithSlicePayload(endpoint string, slice interface{}) ([]byte, error)

func (*Client) WithCache

func (c *Client) WithCache(cache bool)

func (*Client) WithCacheCleanWindow

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

func (*Client) WithCacheTtl

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

func (*Client) WithFreshCache

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 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 authenticates using the provided credentials and returns the session or an error.

Directories

Path Synopsis
services

Jump to

Keyboard shortcuts

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