api

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHTTPClient added in v0.9.7

func CreateHTTPClient(baseURL *url.URL) (*http.Client, error)

Types

type APICommonFunc

type APICommonFunc struct{}

func (*APICommonFunc) MakeDeletedSubResource

func (a *APICommonFunc) MakeDeletedSubResource(deleteKey []string, LbModel LoxiModel) (string, error)

func (*APICommonFunc) MakeQueryParam

func (a *APICommonFunc) MakeQueryParam(LbModel LoxiModel) (map[string]string, error)

type BGPAPI added in v0.9.0

type BGPAPI struct {
	APICommonFunc
	// contains filtered or unexported fields
}

func (*BGPAPI) CreateGlobalConfig added in v0.9.0

func (b *BGPAPI) CreateGlobalConfig(ctx context.Context, Model LoxiModel) error

func (*BGPAPI) CreateNeigh added in v0.9.0

func (b *BGPAPI) CreateNeigh(ctx context.Context, Model LoxiModel) error

func (*BGPAPI) DeleteNeigh added in v0.9.0

func (b *BGPAPI) DeleteNeigh(ctx context.Context, neighIP string, remoteAs int) error

type BGPGlobalConfig added in v0.9.0

type BGPGlobalConfig struct {
	// Local AS number
	LocalAs int64 `json:"localAs,omitempty"`
	// BGP Router ID
	RouterID string `json:"routerId,omitempty"`
	// Set Next hop self option
	SetNHSelf bool `json:"setNextHopSelf,omitempty"`
	// Listen Port
	ListenPort uint16 `json:"listenPort,omitempty"`
}

func (*BGPGlobalConfig) GetKeyStruct added in v0.9.0

func (bgpGlobalModel *BGPGlobalConfig) GetKeyStruct() LoxiModel

type BGPNeigh added in v0.9.0

type BGPNeigh struct {
	// BGP Neighbor IP address
	IPAddress string `json:"ipAddress,omitempty"`
	// Remote AS number
	RemoteAs int64 `json:"remoteAs,omitempty"`
	// Remote Connect Port (default 179)
	RemotePort int64 `json:"remotePort,omitempty"`
	// Enable multi-hop peering (if needed)
	SetMultiHop bool `json:"setMultiHop,omitempty"`
}

func (*BGPNeigh) GetKeyStruct added in v0.9.0

func (bgpNeighModel *BGPNeigh) GetKeyStruct() LoxiModel

type BGPPolicyApply added in v0.9.5

type BGPPolicyApply struct {
	NeighIPAddress string   `json:"ipAddress,omitempty"`
	PolicyType     string   `json:"policyType,omitempty"`
	Policies       []string `json:"policies,omitempty"`
	RouteAction    string   `json:"routeAction,omitempty"`
}

BGPPolicyApply - Info related to a end-point config entry

type BGPPolicyApplyAPI added in v0.9.5

type BGPPolicyApplyAPI struct {
	APICommonFunc
	// contains filtered or unexported fields
}

func (*BGPPolicyApplyAPI) CreateBGPPolicyApply added in v0.9.5

func (b *BGPPolicyApplyAPI) CreateBGPPolicyApply(ctx context.Context, Model LoxiModel) error

func (*BGPPolicyApplyAPI) DeleteBGPPolicyApply added in v0.9.5

func (b *BGPPolicyApplyAPI) DeleteBGPPolicyApply(ctx context.Context, Model LoxiModel) error

type BGPPolicyDefinedSets added in v0.9.5

type BGPPolicyDefinedSets struct {
	Name        string   `json:"name"`
	DefinedType string   `json:"definedType"`
	List        []string `json:"List,omitempty"`
	PrefixList  []Prefix `json:"prefixList,omitempty"`
}

BGPPolicyDefinedSets - Info related to a end-point config entry

type BGPPolicyDefinedSetsAPI added in v0.9.5

type BGPPolicyDefinedSetsAPI struct {
	APICommonFunc
	// contains filtered or unexported fields
}

func (*BGPPolicyDefinedSetsAPI) CreateBGPPolicyDefinedSets added in v0.9.5

func (b *BGPPolicyDefinedSetsAPI) CreateBGPPolicyDefinedSets(ctx context.Context, DefinedType string, Model LoxiModel) error

func (*BGPPolicyDefinedSetsAPI) DeleteBGPPolicyDefinedSets added in v0.9.5

func (b *BGPPolicyDefinedSetsAPI) DeleteBGPPolicyDefinedSets(ctx context.Context, DefinedType, DefinedName string) error

type BGPPolicyDefinitionAPI added in v0.9.5

type BGPPolicyDefinitionAPI struct {
	APICommonFunc
	// contains filtered or unexported fields
}

func (*BGPPolicyDefinitionAPI) CreateBGPPolicyDefinition added in v0.9.5

func (b *BGPPolicyDefinitionAPI) CreateBGPPolicyDefinition(ctx context.Context, Model LoxiModel) error

func (*BGPPolicyDefinitionAPI) DeleteBGPPolicyDefinition added in v0.9.5

func (b *BGPPolicyDefinitionAPI) DeleteBGPPolicyDefinition(ctx context.Context, DefinedName string) error

type CIStatusModel added in v0.9.0

type CIStatusModel struct {
	// Instance name
	Instance string `json:"instance,omitempty"`
	// Current Cluster Instance State
	State string `json:"state,omitempty"`
	// Instance Virtual IP address
	Vip string `json:"vip,omitempty"`
}

func (*CIStatusModel) GetKeyStruct added in v0.9.0

func (ciModel *CIStatusModel) GetKeyStruct() LoxiModel

type CiStatusAPI added in v0.9.0

type CiStatusAPI struct {
	APICommonFunc
	// contains filtered or unexported fields
}

func (*CiStatusAPI) Create added in v0.9.0

func (c *CiStatusAPI) Create(ctx context.Context, Model LoxiModel) error

type EpSelect

type EpSelect uint
const (
	// LbSelRr - select the lb end-points based on round-robin
	LbSelRr EpSelect = iota
	// LbSelHash - select the lb end-points based on hashing
	LbSelHash
	// LbSelPrio - select the lb based on weighted round-robin
	LbSelPrio
	// LbSelRrPersist - persist connectons from same client
	LbSelRrPersist
	// LbSelLeastConnections - select client based on least connections
	LbSelLeastConnections
	// LbSelN2 - select client based on N2 interface contents
	LbSelN2
)

type HealthCheckAPI

type HealthCheckAPI struct {
	APICommonFunc
	// contains filtered or unexported fields
}

func (*HealthCheckAPI) Create

func (h *HealthCheckAPI) Create(ctx context.Context, lbModel LoxiModel) error

func (*HealthCheckAPI) Delete

func (h *HealthCheckAPI) Delete(ctx context.Context, lbModel LoxiModel) error

func (*HealthCheckAPI) Get

func (h *HealthCheckAPI) Get(ctx context.Context, name string) (LoxiModel, error)

func (*HealthCheckAPI) List

func (h *HealthCheckAPI) List(ctx context.Context) (LoxiModel, error)

type LbMode

type LbMode int32

type LbOP added in v0.9.5

type LbOP int32
const (
	// LBOPAdd - Add te LB rule (replace if existing)
	LBOPAdd LbOP = iota
	// LBModeOneArm - Attach End-Points
	LBOPAttach
	// LBOPDetach - Detach End-Points
	LBOPDetach
)

type LoadBalancerAPI

type LoadBalancerAPI struct {
	APICommonFunc
	// contains filtered or unexported fields
}

func (*LoadBalancerAPI) Create

func (l *LoadBalancerAPI) Create(ctx context.Context, lbModel LoxiModel) error

func (*LoadBalancerAPI) Delete

func (l *LoadBalancerAPI) Delete(ctx context.Context, lbModel LoxiModel) error

func (*LoadBalancerAPI) DeleteByName added in v0.9.6

func (l *LoadBalancerAPI) DeleteByName(ctx context.Context, name string) error

func (*LoadBalancerAPI) Get

func (l *LoadBalancerAPI) Get(ctx context.Context, name string) (LoxiModel, error)

func (*LoadBalancerAPI) GetListModel

func (l *LoadBalancerAPI) GetListModel() LoxiModel

func (*LoadBalancerAPI) GetModel

func (l *LoadBalancerAPI) GetModel() LoxiModel

func (*LoadBalancerAPI) List

type LoadBalancerEndpoint

type LoadBalancerEndpoint struct {
	EndpointIP string `json:"endpointIP"`
	TargetPort uint16 `json:"targetPort"`
	Weight     uint8  `json:"weight"`
	State      string `json:"state"`
	Counter    string `json:"counter"`
}

type LoadBalancerListModel

type LoadBalancerListModel struct {
	Item []LoadBalancerModel `json:"lbAttr"`
}

func (*LoadBalancerListModel) GetKeyStruct

func (lbListModel *LoadBalancerListModel) GetKeyStruct() LoxiModel

type LoadBalancerModel

type LoadBalancerModel struct {
	Service      LoadBalancerService    `json:"serviceArguments"`
	SecondaryIPs []LoadBalancerSecIp    `json:"secondaryIPs"`
	Endpoints    []LoadBalancerEndpoint `json:"endpoints"`
}

func (*LoadBalancerModel) GetKeyStruct

func (lbModel *LoadBalancerModel) GetKeyStruct() LoxiModel

type LoadBalancerSecIp

type LoadBalancerSecIp struct {
	SecondaryIP string `json:"secondaryIP"`
}

type LoadBalancerService

type LoadBalancerService struct {
	ExternalIP   string   `json:"externalIP" key:"externalipaddress"`
	PrivateIP    string   `json:"privateIP" key:"privateipaddress"`
	Port         uint16   `json:"port" key:"port"`
	Protocol     string   `json:"protocol" key:"protocol"`
	Sel          EpSelect `json:"sel"`
	Mode         LbMode   `json:"mode"`
	BGP          bool     `json:"BGP" options:"bgp"`
	Monitor      bool     `json:"Monitor"`
	Timeout      uint32   `json:"inactiveTimeOut"`
	Block        uint16   `json:"block" options:"block"`
	Managed      bool     `json:"managed,omitempty"`
	ProbeType    string   `json:"probetype"`
	ProbePort    uint16   `json:"probeport"`
	ProbeReq     string   `json:"probereq"`
	ProbeResp    string   `json:"proberesp"`
	ProbeRetries int32    `json:"probeRetries,omitempty"`
	ProbeTimeout uint32   `json:"probeTimeout,omitempty"`
	Security     int32    `json:"security,omitempty"`
	Name         string   `json:"name,omitempty"`
	Oper         LbOP     `json:"oper,omitempty"`
	Host         string   `json:"host,omitempty"`
}

func (*LoadBalancerService) GetKeyStruct

func (lbService *LoadBalancerService) GetKeyStruct() LoxiModel

type LoxiAPI

type LoxiAPI interface {
	Get(context.Context, string) (LoxiModel, error)
	List(context.Context) (LoxiModel, error)
	Create(context.Context, LoxiModel) error
	Delete(context.Context, LoxiModel) error
}

type LoxiClient

type LoxiClient struct {
	RestClient  *RESTClient
	MasterLB    bool
	PeeringOnly bool
	Url         string
	Host        string
	Port        string
	IsAlive     bool
	DeadSigTs   time.Time
	DoBGPCfg    bool
	Purge       bool
	Stop        chan struct{}
	NoRole      bool
	Name        string
}

func NewLoxiClient

func NewLoxiClient(apiServer string, aliveCh chan *LoxiClient, deadCh chan struct{}, peerOnly bool, noRole bool, name string) (*LoxiClient, error)

apiServer is string. what format? http://10.0.0.1 or 10.0.0.1

func (*LoxiClient) BGP added in v0.9.0

func (l *LoxiClient) BGP() *BGPAPI

func (*LoxiClient) BGPPolicyApply added in v0.9.5

func (l *LoxiClient) BGPPolicyApply() *BGPPolicyApplyAPI

func (*LoxiClient) BGPPolicyDefinedSetsAPI added in v0.9.5

func (l *LoxiClient) BGPPolicyDefinedSetsAPI() *BGPPolicyDefinedSetsAPI

func (*LoxiClient) BGPPolicyDefinition added in v0.9.5

func (l *LoxiClient) BGPPolicyDefinition() *BGPPolicyDefinitionAPI

func (*LoxiClient) CIStatus added in v0.9.0

func (l *LoxiClient) CIStatus() *CiStatusAPI

func (*LoxiClient) GetRESTClient

func (l *LoxiClient) GetRESTClient() *RESTClient

func (*LoxiClient) HealthCheck

func (l *LoxiClient) HealthCheck() *HealthCheckAPI

func (*LoxiClient) LoadBalancer

func (l *LoxiClient) LoadBalancer() *LoadBalancerAPI

func (*LoxiClient) StartLoxiHealthCheckChan added in v0.9.0

func (l *LoxiClient) StartLoxiHealthCheckChan(aliveCh chan *LoxiClient, deadCh chan struct{})

func (*LoxiClient) StopLoxiHealthCheckChan added in v0.9.0

func (l *LoxiClient) StopLoxiHealthCheckChan()

type LoxiModel

type LoxiModel interface {
	GetKeyStruct() LoxiModel
}

type LoxiRequest

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

func NewLoxiRequest

func NewLoxiRequest(method, resource string, client *RESTClient) *LoxiRequest

func (*LoxiRequest) Body

func (l *LoxiRequest) Body(obj LoxiModel) *LoxiRequest

func (*LoxiRequest) Do

func (*LoxiRequest) Query

func (l *LoxiRequest) Query(param map[string]string) *LoxiRequest

func (*LoxiRequest) SubResource

func (l *LoxiRequest) SubResource(subresources ...string) *LoxiRequest

func (*LoxiRequest) URL

func (l *LoxiRequest) URL() *url.URL

URL make REST API url

type LoxiResponse

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

func (*LoxiResponse) UnMarshal

func (l *LoxiResponse) UnMarshal(obj LoxiModel) *LoxiResponse

type LoxiResult added in v0.9.0

type LoxiResult struct {
	Result string `json:"result"`
}

type Prefix added in v0.9.5

type Prefix struct {
	IpPrefix        string `json:"ipPrefix"`
	MasklengthRange string `json:"masklengthRange"`
}

Prefix - Info related to goBGP Policy Prefix

type RESTClient

type RESTClient struct {
	Client *http.Client
	// contains filtered or unexported fields
}

func NewRESTClient

func NewRESTClient(baseURL *url.URL, provider, version string, client *http.Client) (*RESTClient, error)

func (*RESTClient) CreateRequest

func (r *RESTClient) CreateRequest(method string, resource string) *LoxiRequest

func (*RESTClient) DELETE

func (r *RESTClient) DELETE(resource string) *LoxiRequest

func (*RESTClient) GET

func (r *RESTClient) GET(resource string) *LoxiRequest

func (*RESTClient) GetBaseURL

func (r *RESTClient) GetBaseURL() string

func (*RESTClient) POST

func (r *RESTClient) POST(resource string) *LoxiRequest

Jump to

Keyboard shortcuts

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