client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ECX declare ECX API type
	ECX = iota
)

Variables

This section is empty.

Functions

func ReflectStructField

func ReflectStructField(Iface interface{}, FieldName string) error

Reflect if an interface is either a struct or a pointer to a struct and has the defined member field, if error is nil, the given FieldName exists and is accessible with reflect.

func ResponseFilter

func ResponseFilter(response ECXAPIResponse, filters map[string]string)

ResponseFilter applies a set of map string filters to a Response and sets the new value to Response items

Types

type APIHandler

type APIHandler interface {
	Authenticate() error
	GetToken() (runtime.ClientAuthInfoWriter, error)
}

APIHandler implements common Equinix API handlers commands

type ECXAPIPayload

type ECXAPIPayload interface {
	Get() []interface{}
	Count() int64
}

type ECXAPIResponse

type ECXAPIResponse interface {
	GetItems() []interface{}
	AppendItems(items []interface{})
	SetItems(items []interface{})
	FilterItems(filters map[string]string)
	Count() int
}

type EquinixAPIClient

type EquinixAPIClient struct {
	Buyer  *apibuyerclient.GoEcxfabricBuyer
	Seller *apisellerclient.GoEcxfabricSeller
	Params *EquinixAPIParams

	Debug bool
	// contains filtered or unexported fields
}

EquinixAPIClient containing structure for Client, params and apitoken TODO: Implement token refresh

func NewEcxAPIClient

func NewEcxAPIClient(params *EquinixAPIParams, endpoint string, ignoreSSL bool) *EquinixAPIClient

NewEcxAPIClient returns an instantiated ECX client with token

func (*EquinixAPIClient) Authenticate

func (ec *EquinixAPIClient) Authenticate() error

Authenticate tries to authenticate and stores token from remote endpoint

func (*EquinixAPIClient) GetToken

GetToken returns local token, if token doesn't exists tries to authenticate and retrieve token

type EquinixAPIParams

type EquinixAPIParams struct {
	AppID           string
	AppSecret       string
	GrantType       string
	UserName        string
	UserPassword    string
	Endpoint        string
	PlaygroundToken string
	Debug           bool
}

EquinixAPIParams struct for generic Equinix params

Jump to

Keyboard shortcuts

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