requests.go 5.4 KB
Newer Older
E
eoLinker API Management 已提交
1 2 3 4 5 6 7 8 9 10 11
package eureka

import (
	"errors"
)

// Errors introduced by handling requests
var (
	ErrRequestCancelled = errors.New("sending request is cancelled")
)

Y
Your Name 已提交
12
//HealthStatus 健康状态
E
eoLinker API Management 已提交
13 14 15 16
type HealthStatus struct {
	Status      string `json:"status,omitempty"`
	Description string `json:"description,omitempty"`
}
Y
Your Name 已提交
17 18

//Health health
E
eoLinker API Management 已提交
19 20 21 22 23
type Health struct {
	HealthStatus
	Details map[string]interface{} `json:"details,omitempty"`
}

Y
Your Name 已提交
24
//RawRequest raw请求
E
eoLinker API Management 已提交
25 26 27 28 29 30
type RawRequest struct {
	method       string
	relativePath string
	body         []byte
	cancel       <-chan bool
}
Y
Your Name 已提交
31 32

//Applications applications
E
eoLinker API Management 已提交
33 34 35 36 37
type Applications struct {
	VersionsDelta int           `xml:"versions__delta"`
	AppsHashcode  string        `xml:"apps__hashcode"`
	Applications  []Application `xml:"application,omitempty"`
}
Y
Your Name 已提交
38 39

//Application application
E
eoLinker API Management 已提交
40 41 42 43
type Application struct {
	Name      string         `xml:"name"`
	Instances []InstanceInfo `xml:"instance"`
}
Y
Your Name 已提交
44 45

//Instance instance
E
eoLinker API Management 已提交
46 47 48
type Instance struct {
	Instance *InstanceInfo `xml:"instance" json:"instance"`
}
Y
Your Name 已提交
49 50

//Port port
E
eoLinker API Management 已提交
51 52 53 54
type Port struct {
	Port    int  `xml:",chardata" json:"$"`
	Enabled bool `xml:"enabled,attr" json:"@enabled"`
}
Y
Your Name 已提交
55 56

//InstanceInfo instanceInfo
E
eoLinker API Management 已提交
57 58
type InstanceInfo struct {
	HostName                      string          `xml:"hostName" json:"hostName"`
Y
Your Name 已提交
59 60 61
	HomePageURL                   string          `xml:"homePageUrl,omitempty" json:"homePageUrl,omitempty"`
	StatusPageURL                 string          `xml:"statusPageUrl" json:"statusPageUrl"`
	HealthCheckURL                string          `xml:"healthCheckUrl,omitempty" json:"healthCheckUrl,omitempty"`
E
eoLinker API Management 已提交
62
	App                           string          `xml:"app" json:"app"`
Y
Your Name 已提交
63
	IPAddr                        string          `xml:"ipAddr" json:"ipAddr"`
E
eoLinker API Management 已提交
64 65 66 67 68 69 70 71 72 73 74 75 76
	VipAddress                    string          `xml:"vipAddress" json:"vipAddress"`
	SecureVipAddress              string          `xml:"secureVipAddress,omitempty" json:"secureVipAddress,omitempty"`
	Status                        string          `xml:"status" json:"status"`
	Port                          *Port           `xml:"port,omitempty" json:"port,omitempty"`
	SecurePort                    *Port           `xml:"securePort,omitempty" json:"securePort,omitempty"`
	DataCenterInfo                *DataCenterInfo `xml:"dataCenterInfo" json:"dataCenterInfo"`
	LeaseInfo                     *LeaseInfo      `xml:"leaseInfo,omitempty" json:"leaseInfo,omitempty"`
	Metadata                      *MetaData       `xml:"metadata,omitempty" json:"metadata,omitempty"`
	IsCoordinatingDiscoveryServer bool            `xml:"isCoordinatingDiscoveryServer,omitempty" json:"isCoordinatingDiscoveryServer,omitempty"`
	LastUpdatedTimestamp          int             `xml:"lastUpdatedTimestamp,omitempty" json:"lastUpdatedTimestamp,omitempty"`
	LastDirtyTimestamp            int             `xml:"lastDirtyTimestamp,omitempty" json:"lastDirtyTimestamp,omitempty"`
	ActionType                    string          `xml:"actionType,omitempty" json:"actionType,omitempty"`
	Overriddenstatus              string          `xml:"overriddenstatus,omitempty" json:"overriddenstatus,omitempty"`
Y
Your Name 已提交
77
	CountryID                     int             `xml:"countryId,omitempty" json:"countryId,omitempty"`
E
eoLinker API Management 已提交
78
	//
Y
Your Name 已提交
79
	InstanceID   string `xml:"instanceId" json:"instanceId"`
E
eoLinker API Management 已提交
80 81 82
	AppName      string `xml:"appName,omitempty" json:"appName,omitempty"`
	AppGroupName string `xml:"appGroupName,omitempty" json:"appGroupName,omitempty"`
}
Y
Your Name 已提交
83 84

//DataCenterInfo dataCenterInfo
E
eoLinker API Management 已提交
85 86 87 88 89 90
type DataCenterInfo struct {
	Name     string              `xml:"name" json:"name"`
	Class    string              `xml:"class,attr" json:"@class"`
	Metadata *DataCenterMetadata `xml:"metadata,omitempty" json:"metadata,omitempty"`
}

Y
Your Name 已提交
91
//DataCenterMetadata dataCenterMetaData
E
eoLinker API Management 已提交
92 93 94 95
type DataCenterMetadata struct {
	AmiLaunchIndex   string `xml:"ami-launch-index,omitempty" json:"ami-launch-index,omitempty"`
	LocalHostname    string `xml:"local-hostname,omitempty" json:"local-hostname,omitempty"`
	AvailabilityZone string `xml:"availability-zone,omitempty" json:"availability-zone,omitempty"`
Y
Your Name 已提交
96
	InstanceID       string `xml:"instance-id,omitempty" json:"instance-id,omitempty"`
E
eoLinker API Management 已提交
97 98 99 100 101
	PublicIpv4       string `xml:"public-ipv4,omitempty" json:"public-ipv4,omitempty"`
	PublicHostname   string `xml:"public-hostname,omitempty" json:"public-hostname,omitempty"`
	AmiManifestPath  string `xml:"ami-manifest-path,omitempty" json:"ami-manifest-path,omitempty"`
	LocalIpv4        string `xml:"local-ipv4,omitempty" json:"local-ipv4,omitempty"`
	Hostname         string `xml:"hostname,omitempty" json:"hostname,omitempty"`
Y
Your Name 已提交
102
	AmiID            string `xml:"ami-id,omitempty" json:"ami-id,omitempty"`
E
eoLinker API Management 已提交
103 104 105
	InstanceType     string `xml:"instance-type,omitempty" json:"instance-type,omitempty"`
}

Y
Your Name 已提交
106
//LeaseInfo leaseInfo
E
eoLinker API Management 已提交
107 108 109 110 111 112 113 114 115
type LeaseInfo struct {
	EvictionDurationInSecs uint `xml:"evictionDurationInSecs,omitempty" json:"evictionDurationInSecs,omitempty"`
	RenewalIntervalInSecs  int  `xml:"renewalIntervalInSecs,omitempty" json:"renewalIntervalInSecs,omitempty"`
	DurationInSecs         int  `xml:"durationInSecs,omitempty" json:"durationInSecs,omitempty"`
	RegistrationTimestamp  int  `xml:"registrationTimestamp,omitempty" json:"registrationTimestamp,omitempty"`
	LastRenewalTimestamp   int  `xml:"lastRenewalTimestamp,omitempty" json:"lastRenewalTimestamp,omitempty"`
	EvictionTimestamp      int  `xml:"evictionTimestamp,omitempty" json:"evictionTimestamp,omitempty"`
	ServiceUpTimestamp     int  `xml:"serviceUpTimestamp,omitempty" json:"serviceUpTimestamp,omitempty"`
}