core

package
v0.0.0-...-7904037 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: EPL-1.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	STATUS_UP             = "UP"
	STATUS_DOWN           = "DOWN"
	STATUS_STARTING       = "STARTING"
	STATUS_OUT_OF_SERVICE = "OUT_OF_SERVICE"
	STATUS_UNKNOWN        = "UNKNOWN"

	DC_NAME_TYPE_MY_OWN = "MyOwn"
	DC_NAME_TYPE_AMAZON = "Amazon"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	Name      string     `json:"name"`
	Instances []Instance `json:"instance"`
}

Application eureka服务端注册的app

type Applications

type Applications struct {
	VersionsDelta string        `json:"versions__delta,omitempty"`
	AppsHashcode  string        `json:"apps__hashcode,omitempty"`
	Applications  []Application `json:"application,omitempty"`
}

applications eureka服务端注册的apps

type DataCenterInfo

type DataCenterInfo struct {
	Name     string              `json:"name"`
	Class    string              `json:"@class"`
	Metadata *DataCenterMetadata `json:"metadata,omitempty"`
}

DataCenterInfo 数据中心信息

type DataCenterMetadata

type DataCenterMetadata struct {
	AmiLaunchIndex   string `json:"ami-launch-index,omitempty"`
	LocalHostname    string `json:"local-hostname,omitempty"`
	AvailabilityZone string `json:"availability-zone,omitempty"`
	InstanceId       string `json:"instance-id,omitempty"`
	PublicIpv4       string `json:"public-ipv4,omitempty"`
	PublicHostname   string `json:"public-hostname,omitempty"`
	AmiManifestPath  string `json:"ami-manifest-path,omitempty"`
	LocalIpv4        string `json:"local-ipv4,omitempty"`
	Hostname         string `json:"hostname,omitempty"`
	AmiID            string `json:"ami-id,omitempty"`
	InstanceType     string `json:"instance-type,omitempty"`
}

DataCenterMetadata 数据中心信息元数据

type EurekaApp

type EurekaApp struct {
	Application Application `json:"application,omitempty"`
}

type EurekaApps

type EurekaApps struct {
	Applications Applications `json:"applications,omitempty"`
}

type EurekaInstance

type EurekaInstance struct {
	Instance Instance `json:"instance,omitempty"`
}

type EurekaServerApi

type EurekaServerApi struct {
	BaseUrl string
}

wiki: https://github.com/Netflix/eureka/wiki/Eureka-REST-operations

func NewEurekaServerApi

func NewEurekaServerApi(baseUrl string) *EurekaServerApi

func (*EurekaServerApi) DeRegisterInstance

func (api *EurekaServerApi) DeRegisterInstance(appId, instanceID string) error

DeRegisterInstance 删除实例 DELETE /eureka/v2/apps/appID/instanceID

func (*EurekaServerApi) QueryAllInstanceByAppId

func (api *EurekaServerApi) QueryAllInstanceByAppId(appId string) (*Application, error)

GET /eureka/v2/apps/appID Query for all instances by appId

func (*EurekaServerApi) QueryAllInstances

func (api *EurekaServerApi) QueryAllInstances() (*Applications, error)

Refresh 查询所有服务实例 GET /eureka/v2/apps Query for all instances

func (*EurekaServerApi) QueryAllInstancesBySvipAddress

func (api *EurekaServerApi) QueryAllInstancesBySvipAddress(svipAddress string) (*Applications, error)

Query for all instances under a particular secure vip address

func (*EurekaServerApi) QueryAllInstancesByVipAddress

func (api *EurekaServerApi) QueryAllInstancesByVipAddress(vipAddress string) (*Applications, error)

Query for all instances under a particular vip address

func (*EurekaServerApi) QuerySpecificAppInstance

func (api *EurekaServerApi) QuerySpecificAppInstance(instanceId string) (*Instance, error)

查询单个实例详情 query specific instanceId

func (*EurekaServerApi) RegisterInstance

func (api *EurekaServerApi) RegisterInstance(appId string, instance *Instance) error

Register new application instance by brief info

func (*EurekaServerApi) SendHeartbeat

func (api *EurekaServerApi) SendHeartbeat(appId, instanceID string) error

Heartbeat 发送心跳 PUT /eureka/v2/apps/appID/instanceID

func (*EurekaServerApi) UpdateInstanceStatus

func (api *EurekaServerApi) UpdateInstanceStatus(appId, instanceId, status string) error

更新实例状态 update instance status

func (*EurekaServerApi) UpdateMeta

func (api *EurekaServerApi) UpdateMeta(appId, instanceId string, metadata map[string]string) error

更新实例的元数据 Update metadata

type Instance

type Instance struct {
	// Register application instance needed -- BEGIN
	InstanceId       string          `json:"instanceId,omitempty"`
	HostName         string          `json:"hostName"`
	App              string          `json:"app"`
	IpAddr           string          `json:"ipAddr"`
	Status           string          `json:"status"`
	VipAddress       string          `json:"vipAddress"`
	SecureVipAddress string          `json:"secureVipAddress,omitempty"`
	Port             *Port           `json:"port,omitempty"`
	SecurePort       *Port           `json:"securePort,omitempty"`
	HomePageUrl      string          `json:"homePageUrl,omitempty"`
	StatusPageUrl    string          `json:"statusPageUrl"`
	HealthCheckUrl   string          `json:"healthCheckUrl,omitempty"`
	DataCenterInfo   *DataCenterInfo `json:"dataCenterInfo"`
	LeaseInfo        *LeaseInfo      `json:"leaseInfo,omitempty"`

	OverriddenStatus              string                 `json:"overriddenstatus,omitempty"`
	LastUpdatedTimestamp          string                 `json:"lastUpdatedTimestamp,omitempty"`
	LastDirtyTimestamp            string                 `json:"lastDirtyTimestamp,omitempty"`
	ActionType                    string                 `json:"actionType,omitempty"`
	Metadata                      map[string]interface{} `json:"metadata,omitempty"`
	IsCoordinatingDiscoveryServer string                 `json:"isCoordinatingDiscoveryServer,omitempty"`
	CountryID                     int                    `json:"countryId,omitempty"`
}

InstanceConfig 服务实例

type LeaseInfo

type LeaseInfo struct {
	RenewalIntervalInSecs int   `json:"renewalIntervalInSecs,omitempty"`
	DurationInSecs        int   `json:"durationInSecs,omitempty"`
	RegistrationTimestamp int64 `json:"registrationTimestamp,omitempty"`
	LastRenewalTimestamp  int64 `json:"lastRenewalTimestamp,omitempty"`
	EvictionTimestamp     int64 `json:"evictionTimestamp,omitempty"`
	ServiceUpTimestamp    int64 `json:"serviceUpTimestamp,omitempty"`
}

LeaseInfo 续约信息

type Port

type Port struct {
	Port    int    `json:"$"`
	Enabled string `json:"@enabled"`
}

Port 端口

Jump to

Keyboard shortcuts

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