eureka

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const (
	UNKNOWN      = "UNKNOWN"
	UP           = "UP"
	DOWN         = "DOWN"
	STARTING     = "STARTING"
	OUTOFSERVICE = "OUTOFSERVICE"
)
View Source
const (
	PluginName = "eureka"
)

Variables

This section is empty.

Functions

func New

func New() plugins.PluginInstance

Types

type Application

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

type Applications

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

type BoolString

type BoolString string

func (BoolString) Bool

func (b BoolString) Bool() bool

func (*BoolString) Set

func (b *BoolString) Set(value bool)

type Client

type Client struct {
	*client.LBClient
	Cfg client.Config
}

func (*Client) CommonHeaders

func (c *Client) CommonHeaders(method string) http.Header

CommonHeaders Set the common header of the request

func (*Client) CreateService

func (c *Client) CreateService(ctx context.Context, domainProject string, syncService *pb.SyncService) (string, error)

CreateService Eureka's application is created with instance and does not need to be processed here.

func (*Client) DeleteService

func (c *Client) DeleteService(ctx context.Context, domainProject, serviceId string) error

DeleteService Eureka's application is created with instance and does not need to be processed here.

func (*Client) GetAll

func (c *Client) GetAll(ctx context.Context) (*pb.SyncData, error)

GetAll get and transform eureka data to SyncData

func (*Client) Heartbeat

func (c *Client) Heartbeat(ctx context.Context, domainProject, serviceId, instanceId string) error

Heartbeat sends heartbeat to servicecenter

func (*Client) RegisterInstance

func (c *Client) RegisterInstance(ctx context.Context, domainProject, serviceId string, syncInstance *pb.SyncInstance) (string, error)

RegisterInstance register instance to servicecenter

func (*Client) ServiceExistence

func (c *Client) ServiceExistence(ctx context.Context, domainProject string, syncService *pb.SyncService) (string, error)

ServiceExistence Eureka's application is created with instance and does not need to be processed here.

func (*Client) UnregisterInstance

func (c *Client) UnregisterInstance(ctx context.Context, domainProject, serviceId, instanceId string) error

UnregisterInstance unregister instance from servicecenter

type DataCenterInfo

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

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

type Instance

type Instance struct {
	InstanceId                    string          `json:"instanceId"`
	HostName                      string          `json:"hostName"`
	APP                           string          `json:"app"`
	IPAddr                        string          `json:"ipAddr"`
	Status                        string          `json:"status"`
	OverriddenStatus              string          `json:"overriddenStatus,omitempty"`
	Port                          *Port           `json:"port,omitempty"`
	SecurePort                    *Port           `json:"securePort,omitempty"`
	CountryId                     int             `json:"countryId,omitempty"`
	DataCenterInfo                *DataCenterInfo `json:"dataCenterInfo"`
	LeaseInfo                     *LeaseInfo      `json:"leaseInfo,omitempty"`
	Metadata                      *MetaData       `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 BoolString      `json:"isCoordinatingDiscoveryServer,omitempty"`
	LastUpdatedTimestamp          string          `json:"lastUpdatedTimestamp,omitempty"`
	LastDirtyTimestamp            string          `json:"lastDirtyTimestamp,omitempty"`
	ActionType                    string          `json:"actionType,omitempty"`
}

type InstanceRequest

type InstanceRequest struct {
	Instance *Instance `json:"instance"`
}

type LeaseInfo

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

type MetaData

type MetaData struct {
	Map   map[string]string
	Class string
}

func (*MetaData) MarshalJSON

func (s *MetaData) MarshalJSON() ([]byte, error)

func (*MetaData) UnmarshalJSON

func (s *MetaData) UnmarshalJSON(data []byte) error

type Port

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

Jump to

Keyboard shortcuts

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