client

package
v0.0.0-...-ad57dab Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPath = "/nuova"

Default Path to send REST requests.

View Source
const LoginPayLoad = `
<aaaLogin
	inName="%s"
	inPassword="%s" />
`
View Source
const RefreshPayLoad = `
<aaaRefresh 
    inName="%s" 
    inPassword="%s" 
	inCookie="%s"/>
`

Variables

This section is empty.

Functions

func CheckForErrors

func CheckForErrors(doc *etree.Document, rootClass string) error

func CreateHierarchy

func CreateHierarchy(rootClass, subClass, confDn string, moEle *etree.Element) *etree.Document

func StrtoInt

func StrtoInt(s string, base int, bitSize int) (int64, error)

Types

type Auth

type Auth struct {
	Token         string
	RefreshPeriod int64

	Expiry time.Time
	// contains filtered or unexported fields
}

func (*Auth) CalculateExpiry

func (t *Auth) CalculateExpiry(refreshTime int64)

func (*Auth) IsValid

func (au *Auth) IsValid() bool

type Client

type Client struct {
	BaseURL  *url.URL
	UserName string
	Password string

	AuthToken *Auth
	// contains filtered or unexported fields
}

func GetClient

func GetClient(clientUrl, username string, options ...Option) *Client

func (*Client) Authenticate

func (c *Client) Authenticate() error

func (*Client) Delete

func (c *Client) Delete(obj models.Model) (*etree.Document, error)

func (*Client) DeleteByDn

func (c *Client) DeleteByDn(dn, klass string) error

func (*Client) Do

func (c *Client) Do(req *http.Request) (*etree.Document, *http.Response, error)

func (*Client) Get

func (c *Client) Get(dn string) (*etree.Document, error)

func (*Client) InjectAuthenticationHeader

func (client *Client) InjectAuthenticationHeader(body *etree.Document) (*etree.Document, error)

func (*Client) MakeRestRequest

func (c *Client) MakeRestRequest(method string, body *etree.Document, authenticated bool) (*http.Request, error)

func (*Client) PrepareModel

func (c *Client) PrepareModel(obj models.Model, rootClass, subClass, confDn, status string) (*etree.Document, string, error)

func (*Client) Save

func (c *Client) Save(obj models.Model) error

type Option

type Option func(*Client)

func Insecure

func Insecure(insecure bool) Option

func Password

func Password(password string) Option

func ProxyUrl

func ProxyUrl(pUrl string) Option

Jump to

Keyboard shortcuts

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