eureka

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationInfo

type ApplicationInfo struct {
	Application *WrapperApplicationInfo `json:"application"`
}

information of eureka application

type ApplicationList

type ApplicationList struct {
	Applications *WrapperApplicationList `json:"applications"`
}

information of eureka application list

type DiscoveryClient

type DiscoveryClient interface {
	DiscoveryStatusUpdate(status string) (bool, error)
	GetApplications(regions ...string) (*ApplicationList, error)
	GetApplication(appName string) (*ApplicationInfo, error)
	GetInstance(appName, instanceId string) (*InstanceInfo, error)
	GetInstanceById(instanceId string) (*InstanceInfo, error)
	Shutdown()
}

func NewDiscoveryClient

func NewDiscoveryClient(conf *EurekaClientConfig) (registered bool, discovery DiscoveryClient, err error)

type EurekaClient

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

func NewEurekaClient

func NewEurekaClient(serviceUrlList []string, username, password string, contentIsJson bool) *EurekaClient

func (*EurekaClient) Deregister

func (hc *EurekaClient) Deregister(appName, instanceId string) (bool, error)

deregister from eureka server

func (*EurekaClient) GetApplication

func (hc *EurekaClient) GetApplication(appName string) (*ApplicationInfo, error)

get application's information by appName

func (*EurekaClient) GetApplications

func (hc *EurekaClient) GetApplications(regions ...string) (*ApplicationList, error)

if regions is nil, get all application's information if regions is not nil,get application's information by regions

func (*EurekaClient) GetInstance

func (hc *EurekaClient) GetInstance(appName, instanceId string) (*InstanceInfo, error)

get instance's information by appName and instanceId

func (*EurekaClient) GetInstanceById

func (hc *EurekaClient) GetInstanceById(instanceId string) (*InstanceInfo, error)

get instance's information by instanceId

func (*EurekaClient) HttpRequest

func (hc *EurekaClient) HttpRequest() *HttpRequest

func (*EurekaClient) Register

func (hc *EurekaClient) Register(info *InstanceInfo) (success bool, err error)

register to eureka server

func (*EurekaClient) SendHeartBeat

func (hc *EurekaClient) SendHeartBeat(appName, instanceId, status, lastDirtyTimestamp, overriddenStatus string) (int, error)

send heartbeat to eureka

func (*EurekaClient) ServiceUrl

func (hc *EurekaClient) ServiceUrl() string

func (*EurekaClient) StatusUpdate

func (hc *EurekaClient) StatusUpdate(appName, instanceId, status, lastDirtyTimestamp string) (bool, error)

update eureka client status

type EurekaClientConfig

type EurekaClientConfig struct {
	AppName           string //application name
	InstanceId        string //instance id
	HostName          string //hostname
	IpAddr            string // IPAddr
	Port              int    //port
	Username          string
	Password          string
	HeaderContentType string

	ServiceUrls           []string //url list of service
	RegisterWithEureka    bool     //register to eureka server
	RenewalIntervalInSecs int      //lease-renewal-interval-in-seconds
	DurationInSecs        int      //lease-expiration-duration-in-seconds
}

type EurekaClientStub

type EurekaClientStub struct {
	*WrapperInstanceInfo
	// contains filtered or unexported fields
}

func (*EurekaClientStub) Client

func (d *EurekaClientStub) Client() *EurekaClient

func (*EurekaClientStub) Shutdown

func (d *EurekaClientStub) Shutdown()

type EurekaDiscoveryClient

type EurekaDiscoveryClient struct {
	registry.AbstractDiscoveryClient
	// contains filtered or unexported fields
}

func CreateEurekaDiscoveryClient

func CreateEurekaDiscoveryClient() (*EurekaDiscoveryClient, error)

func (*EurekaDiscoveryClient) Client

func (d *EurekaDiscoveryClient) Client() *EurekaClient

func (*EurekaDiscoveryClient) Deregister

func (c *EurekaDiscoveryClient) Deregister(instance *registry.InstanceInfo) error

func (*EurekaDiscoveryClient) GetInstance

func (c *EurekaDiscoveryClient) GetInstance(serviceId string) *registry.InstanceInfo

func (*EurekaDiscoveryClient) GetInstanceById

func (c *EurekaDiscoveryClient) GetInstanceById(serviceId string, instanceId string) *registry.InstanceInfo

func (*EurekaDiscoveryClient) GetInstances

func (c *EurekaDiscoveryClient) GetInstances(serviceId string) ([]registry.InstanceInfo, error)

func (*EurekaDiscoveryClient) GetService

func (c *EurekaDiscoveryClient) GetService(serviceId string) (*registry.ServiceInfo, error)

func (*EurekaDiscoveryClient) GetServices

func (c *EurekaDiscoveryClient) GetServices() ([]registry.ServiceInfo, error)

func (*EurekaDiscoveryClient) Register

func (c *EurekaDiscoveryClient) Register(instance *registry.InstanceInfo) (bool, error)

func (*EurekaDiscoveryClient) SendHeartBeat

func (c *EurekaDiscoveryClient) SendHeartBeat(instance *registry.InstanceInfo, status string) (bool, error)

type HttpRequest

type HttpRequest struct {
	Base               string
	URL                string
	Method             string
	Headers            map[string]string
	Body               string
	Username, Password string
	ContentType        string
	Response           *http.Response
	StatusCode         int
	Error              error
	// contains filtered or unexported fields
}

func (*HttpRequest) BODY

func (r *HttpRequest) BODY(body string) *HttpRequest

func (*HttpRequest) DELETE

func (r *HttpRequest) DELETE(url string, params ...RequestParameters) *HttpRequest

func (*HttpRequest) Do

func (r *HttpRequest) Do() *HttpRequest

func (*HttpRequest) Fetch

func (r *HttpRequest) Fetch(data interface{}) (status int, err error)

func (*HttpRequest) GET

func (r *HttpRequest) GET(url string, params ...RequestParameters) *HttpRequest

func (*HttpRequest) HEADER

func (r *HttpRequest) HEADER(head string, value string) *HttpRequest

func (*HttpRequest) PASSWORD

func (r *HttpRequest) PASSWORD(password string) *HttpRequest

func (*HttpRequest) PATCH

func (r *HttpRequest) PATCH(url string, params ...RequestParameters) *HttpRequest

func (*HttpRequest) POST

func (r *HttpRequest) POST(url string, params ...RequestParameters) *HttpRequest

func (*HttpRequest) PUT

func (r *HttpRequest) PUT(url string, params ...RequestParameters) *HttpRequest

func (*HttpRequest) Result

func (r *HttpRequest) Result() (status int, body []byte, err error)

func (*HttpRequest) ResultTo

func (r *HttpRequest) ResultTo(result interface{}) (status int, err error)

func (*HttpRequest) String

func (r *HttpRequest) String() (result string, err error)

func (*HttpRequest) USERNAME

func (r *HttpRequest) USERNAME(username string) *HttpRequest

type InstanceInfo

type InstanceInfo struct {
	Instance *WrapperInstanceInfo `json:"instance"`
}

information of eureka instance

type RequestParameters

type RequestParameters map[string]string

type WrapperApplicationInfo

type WrapperApplicationInfo struct {
	Name     string                `json:"name"`
	Instance []WrapperInstanceInfo `json:"instance"`
}

type WrapperApplicationList

type WrapperApplicationList struct {
	Version      string                   `json:"versions__delta"`
	AppsHashCode string                   `json:"appsHashCode"`
	Applications []WrapperApplicationInfo `json:"application"`
}

type WrapperDataCenterInfo

type WrapperDataCenterInfo struct {
	Class string `json:"@class,omitempty"`
	Name  string `json:"name,omitempty"`
}

type WrapperInstanceInfo

type WrapperInstanceInfo struct {
	InstanceId                    string                 `json:"instanceId,omitempty"`
	HostName                      string                 `json:"hostName,omitempty"`
	App                           string                 `json:"app,omitempty"`
	IpAddr                        string                 `json:"ipAddr,omitempty"`
	Status                        string                 `json:"status,omitempty"`
	OverriddenStatus              string                 `json:"overriddenStatus,omitempty"`
	Port                          *WrapperPort           `json:"port,omitempty"`
	SecurePort                    *WrapperSecurePort     `json:"securePort,omitempty"`
	CountryId                     int                    `json:"countryId,omitempty"`
	DataCenterInfo                *WrapperDataCenterInfo `json:"dataCenterInfo,omitempty"`
	LeaseInfo                     *WrapperLeaseInfo      `json:"leaseInfo,omitempty"`
	Metadata                      *WrapperMetadata       `json:"metadata,omitempty"`
	HomePageUrl                   string                 `json:"homePageUrl,omitempty"`
	StatusPageUrl                 string                 `json:"statusPageUrl,omitempty"`
	HealthCheckUrl                string                 `json:"healthCheckUrl,omitempty"`
	VipAddress                    string                 `json:"vipAddress,omitempty"`
	SecureVipAddress              string                 `json:"secureVipAddress,omitempty"`
	IsCoordinatingDiscoveryServer string                 `json:"isCoordinatingDiscoveryServer,omitempty"`
	LastUpdatedTimestamp          string                 `json:"lastUpdatedTimestamp,omitempty"`
	LastDirtyTimestamp            string                 `json:"lastDirtyTimestamp,omitempty"`
	ActionType                    string                 `json:"actionType,omitempty"`
}

type WrapperLeaseInfo

type WrapperLeaseInfo 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"`
}

type WrapperMetadata

type WrapperMetadata struct {
	ManagementPort string `json:"management.port,omitempty"`
	JmxPort        string `json:"jmx.port,omitempty"`
}

type WrapperPort

type WrapperPort struct {
	Port    int         `json:"$,omitempty"`
	Enabled interface{} `json:"@enabled,omitempty"`
}

type WrapperSecurePort

type WrapperSecurePort struct {
	Port   int         `json:"$,omitempty"`
	Enable interface{} `json:"@enabled"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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