session

package
v0.0.0-...-56c4832 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_API_TENANT = "admin"
View Source
const DEFAULT_API_TIMEOUT = time.Duration(60 * time.Second)
View Source
const DEFAULT_AVI_VERSION = "17.1.2"

Variables

This section is empty.

Functions

func SetAuthToken

func SetAuthToken(authToken string) func(*AviSession) error

SetAuthToken - Use this for NewAviSession option argument for setting authToken

func SetCloud

func SetCloud(cloud string) func(*ApiOptions) error

func SetCloudUUID

func SetCloudUUID(cloudUUID string) func(*ApiOptions) error

func SetIncludeName

func SetIncludeName(includeName bool) func(*ApiOptions) error

func SetInsecure

func SetInsecure(avisess *AviSession) error

SetInsecure - Use this for NewAviSession option argument for allowing insecure connection to AviController

func SetName

func SetName(name string) func(*ApiOptions) error

func SetOptTenant

func SetOptTenant(tenant string) func(*ApiOptions) error

func SetParams

func SetParams(params map[string]string) func(*ApiOptions) error

func SetPassword

func SetPassword(password string) func(*AviSession) error

SetPassword - Use this for NewAviSession option argument for setting password

func SetRefreshAuthTokenCallback

func SetRefreshAuthTokenCallback(f func() string) func(*AviSession) error

SetAuthToken - Use this for NewAviSession option argument for setting authToken

func SetResult

func SetResult(result interface{}) func(*ApiOptions) error

func SetSkipDefault

func SetSkipDefault(skipDefault bool) func(*ApiOptions) error

func SetTenant

func SetTenant(tenant string) func(*AviSession) error

SetTenant - Use this for NewAviSession option argument for setting tenant

func SetTimeout

func SetTimeout(timeout time.Duration) func(*AviSession) error

SetTimeout -

func SetTransport

func SetTransport(transport *http.Transport) func(*AviSession) error

SetTransport - Use this for NewAviSession option argument for configuring http transport to enable connection

func SetVersion

func SetVersion(version string) func(*AviSession) error

SetVersion - Use this for NewAviSession option argument for setting version

Types

type ApiOptions

type ApiOptions struct {
	// contains filtered or unexported fields
}

type ApiOptionsParams

type ApiOptionsParams func(*ApiOptions) error

type AviCollectionResult

type AviCollectionResult struct {
	Count   int
	Results json.RawMessage
}

AviCollectionResult for representing the collection type results from Avi

type AviError

type AviError struct {
	// aviresult holds the standard header (code and message) that is included in
	// responses from Avi.
	AviResult

	// verb is the HTTP verb (GET, POST, PUT, PATCH, or DELETE) that was
	// used in the request that resulted in the error.
	Verb string

	// url is the URL that was used in the request that resulted in the error.
	Url string

	// HttpStatusCode is the HTTP response status code (e.g., 200, 404, etc.).
	HttpStatusCode int
	// contains filtered or unexported fields
}

AviError represents an error resulting from a request to the Avi Controller

func (AviError) Error

func (err AviError) Error() string

Error implements the error interface.

type AviResult

type AviResult struct {
	// Code should match the HTTP status code.
	Code int `json:"code"`

	// Message should contain a short description of the result of the requested
	// operation.
	Message *string `json:"message"`
}

type AviSession

type AviSession struct {
	// contains filtered or unexported fields
}

AviSession maintains a session to the specified Avi Controller

func NewAviSession

func NewAviSession(host string, username string, options ...func(*AviSession) error) (*AviSession, error)

NewAviSession initiates a session to AviController and returns it

func (*AviSession) CheckControllerStatus

func (avisess *AviSession) CheckControllerStatus() (bool, error)

Checking for controller up state. This is an infinite loop till the controller is in up state. Return true when controller is in up state.

func (*AviSession) Delete

func (avisess *AviSession) Delete(uri string, params ...interface{}) error

Delete issues a DELETE request against the avisess REST API.

func (*AviSession) DeleteObject

func (avisess *AviSession) DeleteObject(uri string, options ...ApiOptionsParams) error

DeleteObject performs DELETE Operation and delete the data

func (*AviSession) Get

func (avisess *AviSession) Get(uri string, response interface{}, options ...ApiOptionsParams) error

Get issues a GET request against the avisess REST API.

func (*AviSession) GetCollection

func (avisess *AviSession) GetCollection(uri string, objList interface{}, options ...ApiOptionsParams) error

GetCollection performs a collection API call and unmarshals the results into objList, which should be an array type

func (*AviSession) GetCollectionRaw

func (avisess *AviSession) GetCollectionRaw(uri string, options ...ApiOptionsParams) (AviCollectionResult, error)

GetCollectionRaw issues a GET request and returns a AviCollectionResult with unmarshaled (raw) results section.

func (*AviSession) GetControllerVersion

func (avisess *AviSession) GetControllerVersion() (string, error)

GetControllerVersion gets the version number from the Avi Controller

func (*AviSession) GetMultipartRaw

func (avisess *AviSession) GetMultipartRaw(verb string, uri string, file_loc_ptr *os.File, options ...ApiOptionsParams) error

GetMultipartRaw performs a GET API call and returns multipart raw data (File Download) The verb input is ignored and kept only for backwards compatibility

func (*AviSession) GetObject

func (avisess *AviSession) GetObject(obj string, options ...ApiOptionsParams) error

GetObject performs GET and return object data

func (*AviSession) GetObjectByName

func (avisess *AviSession) GetObjectByName(obj string, name string, result interface{}, options ...ApiOptionsParams) error

GetObjectByName performs GET with name filter

func (*AviSession) GetRaw

func (avisess *AviSession) GetRaw(uri string) ([]byte, error)

GetRaw performs a GET API call and returns raw data

func (*AviSession) GetUri

func (avisess *AviSession) GetUri(obj string, options ...ApiOptionsParams) (string, error)

GetUri returns the URI

func (*AviSession) Logout

func (avisess *AviSession) Logout() error

Logout performs log out operation of the Avi Controller

func (*AviSession) Patch

func (avisess *AviSession) Patch(uri string, payload interface{}, patchOp string, response interface{}, options ...ApiOptionsParams) error

Post issues a PATCH request against the avisess REST API. allowed patchOp - add, replace, remove

func (*AviSession) Post

func (avisess *AviSession) Post(uri string, payload interface{}, response interface{}, options ...ApiOptionsParams) error

Post issues a POST request against the avisess REST API.

func (*AviSession) PostMultipartRequest

func (avisess *AviSession) PostMultipartRequest(verb string, uri string, file_loc_ptr *os.File, options ...ApiOptionsParams) error

PostMultipartRequest performs a POST API call and uploads multipart data The verb input is ignored and kept only for backwards compatibility

func (*AviSession) PostRaw

func (avisess *AviSession) PostRaw(uri string, payload interface{}) ([]byte, error)

PostRaw performs a POST API call and returns raw data

func (*AviSession) Put

func (avisess *AviSession) Put(uri string, payload interface{}, response interface{}, options ...ApiOptionsParams) error

Put issues a PUT request against the avisess REST API.

Jump to

Keyboard shortcuts

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