Documentation ¶
Index ¶
- Constants
- func SetAuthToken(authToken string) func(*AviSession) error
- func SetCloud(cloud string) func(*ApiOptions) error
- func SetCloudUUID(cloudUUID string) func(*ApiOptions) error
- func SetIncludeName(includeName bool) func(*ApiOptions) error
- func SetInsecure(avisess *AviSession) error
- func SetName(name string) func(*ApiOptions) error
- func SetOptTenant(tenant string) func(*ApiOptions) error
- func SetParams(params map[string]string) func(*ApiOptions) error
- func SetPassword(password string) func(*AviSession) error
- func SetRefreshAuthTokenCallback(f func() string) func(*AviSession) error
- func SetResult(result interface{}) func(*ApiOptions) error
- func SetSkipDefault(skipDefault bool) func(*ApiOptions) error
- func SetTenant(tenant string) func(*AviSession) error
- func SetTimeout(timeout time.Duration) func(*AviSession) error
- func SetTransport(transport *http.Transport) func(*AviSession) error
- func SetVersion(version string) func(*AviSession) error
- type ApiOptions
- type ApiOptionsParams
- type AviCollectionResult
- type AviError
- type AviResult
- type AviSession
- func (avisess *AviSession) CheckControllerStatus() (bool, error)
- func (avisess *AviSession) Delete(uri string, params ...interface{}) error
- func (avisess *AviSession) DeleteObject(uri string, options ...ApiOptionsParams) error
- func (avisess *AviSession) Get(uri string, response interface{}, options ...ApiOptionsParams) error
- func (avisess *AviSession) GetCollection(uri string, objList interface{}, options ...ApiOptionsParams) error
- func (avisess *AviSession) GetCollectionRaw(uri string, options ...ApiOptionsParams) (AviCollectionResult, error)
- func (avisess *AviSession) GetControllerVersion() (string, error)
- func (avisess *AviSession) GetMultipartRaw(verb string, uri string, file_loc_ptr *os.File, options ...ApiOptionsParams) error
- func (avisess *AviSession) GetObject(obj string, options ...ApiOptionsParams) error
- func (avisess *AviSession) GetObjectByName(obj string, name string, result interface{}, options ...ApiOptionsParams) error
- func (avisess *AviSession) GetRaw(uri string) ([]byte, error)
- func (avisess *AviSession) GetUri(obj string, options ...ApiOptionsParams) (string, error)
- func (avisess *AviSession) Logout() error
- func (avisess *AviSession) Patch(uri string, payload interface{}, patchOp string, response interface{}, ...) error
- func (avisess *AviSession) Post(uri string, payload interface{}, response interface{}, ...) error
- func (avisess *AviSession) PostMultipartRequest(verb string, uri string, file_loc_ptr *os.File, options ...ApiOptionsParams) error
- func (avisess *AviSession) PostRaw(uri string, payload interface{}) ([]byte, error)
- func (avisess *AviSession) Put(uri string, payload interface{}, response interface{}, ...) error
Constants ¶
const DEFAULT_API_TENANT = "admin"
const DEFAULT_API_TIMEOUT = time.Duration(60 * time.Second)
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 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 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
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.