zia

package
v2.71.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 24 Imported by: 5

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 ... 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 added in v2.71.0

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) CreateWithSlicePayload added in v2.70.0

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

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) UpdateWithSlicePayload added in v2.70.0

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

func (*Client) WithCache added in v2.1.0

func (c *Client) WithCache(cache bool)

func (*Client) WithCacheCleanWindow added in v2.1.0

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

func (*Client) WithCacheTtl added in v2.1.0

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

func (*Client) WithFreshCache added in v2.1.0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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