client

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPayloadCreation = errors.New("error in creating payload")
)

Errors for V2 API client

Functions

func GetContainer

func GetContainer(resp *http.Response) (*gabs.Container, error)

GetContainer parses HTTP Response and returns *gabs.Container

Types

type V2

type V2 struct {
	HostURL string
	OrgID   int
	// contains filtered or unexported fields
}

V2 client for Illumio REST APIs

func NewV2

func NewV2(hostURL string, orgID int, apiUsername string, apiKeySecret string, defaultTimeout int, rateLimiter *rate.Limiter,
	waitTime int, maxRetries int, insecure bool, caFile string, proxyURL string, proxyCreds string) (*V2, error)

NewV2 Constructor for V2 Client

defaultTimeout (in seconds) e.g. NewV2("https://pce.my-company.com:8443", 1, "api_xxxxxx", "big-secret", 30, rate.NewLimiter(rate.Limit(float64(125)/float64(60)), 1), 10, 3, false, "", "")

func (*V2) AsyncGet

func (c *V2) AsyncGet(endpoint string, queryParams *map[string]string) (*http.Response, *gabs.Container, error)

AsyncGet Performs HTTP GET on endpoint with queryParams and polls until data is ready

Illumio GET APIs return json response on success, available as *gabs.Container

func (*V2) Create

func (c *V2) Create(endpoint string, model models.Model) (*http.Response, *gabs.Container, error)

Create Performs HTTP POST on endpoint with model

Illumio POST APIs return json response on success, available as *gabs.Container

func (*V2) Delete

func (c *V2) Delete(endpoint string) (*http.Response, error)

Delete Performs HTTP DELETE on endpoint

Illumio DELETE APIs does not return any response

func (*V2) Do

func (c *V2) Do(req *http.Request) (*http.Response, error)

Do function performs HTTP API Call

func (*V2) Get

func (c *V2) Get(endpoint string, queryParams *map[string]string) (*http.Response, *gabs.Container, error)

Get Performs HTTP GET on endpoint with queryParams

Illumio GET APIs return json response on success, available as *gabs.Container

func (*V2) PrepareModel

func (c *V2) PrepareModel(model models.Model) (*gabs.Container, error)

PrepareModel Creates container from model

func (*V2) PrepareRequest

func (c *V2) PrepareRequest(method string, endpoint string, body *gabs.Container, queryParams *map[string]string) (*http.Request, error)

PrepareRequest Creates *http.Request with required headers

func (*V2) Update

func (c *V2) Update(endpoint string, model models.Model) (*http.Response, error)

Update Performs HTTP UPDATE on endpoint

Illumio UPDATE APIs does not return any response

Jump to

Keyboard shortcuts

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