zcon

package
v2.4.35 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 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

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

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

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

MakeAuthRequestZCON ...

Jump to

Keyboard shortcuts

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