monitor

package
Version: v0.0.0-...-9649b88 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const MaxRetryTimesForHTTPReq int = 6

Variables

View Source
var HTTPClose = func(resp *http.Response) error {
	return resp.Body.Close()
}
View Source
var HTTPGet = func(url string) (*http.Response, error) {
	var resp *http.Response
	var err error
	for i := 1; i < MaxRetryTimesForHTTPReq; i++ {
		resp, err = get(url)
		if err == nil {
			return resp, nil
		}
		time.Sleep(time.Second * time.Duration(i))
	}
	return resp, err
}
View Source
var HTTPReadAll = func(resp *http.Response) ([]byte, error) {
	return ioutil.ReadAll(resp.Body)
}

Functions

This section is empty.

Types

type MonitorClient

type MonitorClient struct {
	// Header *http.Header
	URLKnitterMonitor string
	VMID              string
}

func (*MonitorClient) Get

func (m *MonitorClient) Get(postURL string) (int, []byte, error)

func (*MonitorClient) GetPod

func (m *MonitorClient) GetPod(podNs, PodName string) (int, []byte, error)

func (*MonitorClient) GetPodURL

func (self *MonitorClient) GetPodURL(podNs, podName string) string

func (*MonitorClient) InitClient

func (m *MonitorClient) InitClient(cfg *jason.Object) error

type Pod

type Pod struct {
	TenantId     string  `json:"tenant_id"`
	PodID        string  `json:"pod_id"`
	PodName      string  `json:"pod_name"`
	PodNs        string  `json:"pod_ns"`
	PodType      string  `json:"pod_type"`
	IsSuccessful bool    `json:"is_successful"`
	ErrorMsg     string  `json:"error_msg"`
	Ports        []*Port `json:"ports"`
}

type Port

type Port struct {
	LazyAttr  PortLazyAttr  `json:"lazy_attr"`
	EagerAttr PortEagerAttr `json:"eager_attr"`
}

type PortEagerAttr

type PortEagerAttr struct {
	NetworkName  string      `json:"network_name"`
	NetworkPlane string      `json:"network_plane"`
	PortName     string      `json:"port_name"`
	VnicType     string      `json:"vnic_type"`
	Accelerate   string      `json:"accelerate"`
	PodName      string      `json:"pod_name"`
	PodNs        string      `json:"pod_ns"`
	FixIP        string      `json:"fix_ip"`
	IPGroupName  string      `json:"ip_group_name"`
	Metadata     interface{} `json:"metadata"`
}

type PortLazyAttr

type PortLazyAttr struct {
	//NetworkID      string
	ports.IP
	ID         string     `json:"id"`
	Name       string     `json:"name"`
	TenantID   string     `json:"tenant_id"`
	MacAddress string     `json:"mac_address"`
	FixedIps   []ports.IP `json:"fixed_ips"`
	GatewayIP  string     `json:"gateway_ip"`
	Cidr       string     `json:"cidr"`
}

Jump to

Keyboard shortcuts

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