zia

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	MaxNumOfRetries     = 100
	RetryWaitMaxSeconds = 20
	RetryWaitMinSeconds = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

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

func (c *Client) GetContentType() 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 ...

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

Jump to

Keyboard shortcuts

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