servicediscovery

package
v0.0.1-beta.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2018 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	COLLECTION = "services"
)

Variables

View Source
var MONGO_DB string
View Source
var MONGO_HOST string
View Source
var SD_TYPE = "file"
View Source
var SERVICE_NAME = "/service-discovery"

Functions

func ConnectToMongo

func ConnectToMongo()

func CreateServiceFile

func CreateServiceFile(s Service) (string, int)

func CreateServiceMongo

func CreateServiceMongo(s Service) (string, int)

func DeleteEndpointHandler

func DeleteEndpointHandler(c *routing.Context) error

func DeleteServiceFile

func DeleteServiceFile(matchingURI string) (string, int)

func DeleteServiceMongo

func DeleteServiceMongo(matchingURI string) (string, int)

func GetEndpointHandler

func GetEndpointHandler(c *routing.Context) error

func GetMatchURI

func GetMatchURI(uri string) string

func InitMongo

func InitMongo()

func ListServicesHandler

func ListServicesHandler(c *routing.Context) error

func RegisterHandler

func RegisterHandler(c *routing.Context) error

func StartServiceDiscovery

func StartServiceDiscovery(router *routing.Router)

func UpdateFile

func UpdateFile(service Service, serviceExists Service) (string, int)

func UpdateHandler

func UpdateHandler(c *routing.Context) error

func UpdateMongo

func UpdateMongo(service Service, serviceExists Service) (string, int)

Types

type Service

type Service struct {
	ID                    bson.ObjectId `bson:"_id" json:"id"`
	Name                  string
	Domain                string
	Port                  string
	MatchingURI           string
	ToURI                 string
	Protected             bool
	APIDocumentation      string
	CachingExpirationTime int
	IsCachingActive       bool
	IsActive              bool
	HealthcheckUrl        string
}

func FindFile

func FindFile(toMatchUri string) (Service, error)

func FindMongo

func FindMongo(toMatchUri string) (Service, error)

func ListServicesFile

func ListServicesFile() []Service

func ListServicesMongo

func ListServicesMongo() []Service

func ValidateServiceBody

func ValidateServiceBody(c *routing.Context) (Service, error)

func ValidateServiceExists

func ValidateServiceExists(s Service) (Service, error)

func (*Service) Call

func (service *Service) Call(method string, uri string, headers map[string]string, body string) *fasthttp.Response

type ServiceDiscovery

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

func GetServiceDiscoveryObject

func GetServiceDiscoveryObject() *ServiceDiscovery

func (*ServiceDiscovery) FindServiceWithMatchingPrefix

func (serviceDisc *ServiceDiscovery) FindServiceWithMatchingPrefix(uri string) (Service, error)

func (*ServiceDiscovery) GetAllServices

func (serviceDisc *ServiceDiscovery) GetAllServices() ([]Service, error)

func (*ServiceDiscovery) GetEndpointForUri

func (serviceDisc *ServiceDiscovery) GetEndpointForUri(uri string) (Service, error)

func (*ServiceDiscovery) IsService

func (service *ServiceDiscovery) IsService() bool

func (*ServiceDiscovery) SaveServicesToFile

func (service *ServiceDiscovery) SaveServicesToFile()

func (*ServiceDiscovery) SetIsService

func (service *ServiceDiscovery) SetIsService(isServ bool)

func (*ServiceDiscovery) SetRegisteredServices

func (serviceDisc *ServiceDiscovery) SetRegisteredServices(rs []Service)

type ServicesConfig

type ServicesConfig struct {
	Services []Service `json:"services"`
}

func LoadServicesConfiguration

func LoadServicesConfiguration() ServicesConfig

Jump to

Keyboard shortcuts

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