consul

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_CONSUL_HOST      = "consul.ops.local"
	DEFAULT_CONSUL_LOCALHOST = "localhost"
	DEFAULT_CONSUL_PORT      = 8500
	DEFAULT_CONSUL_SCHEME    = "http"
)
View Source
const (
	SERVICE_CONSUL_API = "consulapi"
	SERVICE_DB         = "test-rds"
	SERVICE_MQ         = "test-mq"
	SERVICE_CACHE      = "test-redis"

	KEY_WAS_SETUP   = "ops/config/common"
	VALUE_WAS_SETUP = "---"
)
View Source
const (
	MS_PREFIX   = "app.ms"
	TAGS_PREFIX = "app.ms.tags"
)

Variables

This section is empty.

Functions

func AgentServiceToCatalogService

func AgentServiceToCatalogService(as *api.AgentService, client *api.Client) (res *api.CatalogService, err error)

func Backup

func Backup() (err error)

func CatalogNodeGetService

func CatalogNodeGetService(cn *api.CatalogNode, serviceName string) *api.AgentService

func GetConsulApiEntryPoint

func GetConsulApiEntryPoint(registrar *Registrar) *api.CatalogService

func MakeACLClient

func MakeACLClient() *api.Client

func MakeClient

func MakeClient() *api.Client

func MakeClientWithConfig

func MakeClientWithConfig(cb1 configCallback) *api.Client

func ModifyNodeMeta added in v0.3.2

func ModifyNodeMeta(tags map[string]string, addTags, removeTags []string, delim string, hasClear, isPlainMode, isString bool) map[string]string

func ModifyTags

func ModifyTags(tags, addTags, removeTags []string, delim string, hasClear, isPlainMode, isString bool) []string

func NodeToAgent

func NodeToAgent(registrar *Registrar, node string) *api.CatalogNode

func QueryService

func QueryService(name string, catalog *api.Catalog) ([]*api.CatalogService, error)

func QueryServiceByID

func QueryServiceByID(serviceID string, client *api.Client) (as *api.AgentService, err error)

func Restore

func Restore() (err error)

func ServiceList added in v0.5.0

func ServiceList() (err error)

func Tags

func Tags() error

func TagsList

func TagsList() (err error)

func TagsToggle

func TagsToggle() error

func WaitForResult

func WaitForResult(try testFn, fail errorFn)

Types

type Base

type Base struct {
	FirstClient *api.Client
}

type Discoverable

type Discoverable interface {
	Connect(hostOrIp string, port int) error
	Register(serviceName string, ip string, port int) error
	Deregister(serviceName string, ip string, port int) error
	Disco(serviceName string) ([]Service, error)
}

type Glyph

type Glyph struct {
	Name     string
	Position int
	ID       int // ID must > 0
	ParentID int // if ParentID equal 0, the Glyph has no parents
}

type InputZ

type InputZ interface {
	Int(name string) (int, error)
	CoolPrint(str string) (int, error)
}

type MyInputZ

type MyInputZ struct {
	Ok string
}

func (MyInputZ) Int

func (s MyInputZ) Int(name string) (int, error)

type Registrar

type Registrar struct {
	Base
	Clients       []*api.CatalogService
	CurrentClient *api.CatalogService
}

type Service

type Service interface {
	GetName() string
	GetPort() int
	GetId() string
	GetTags() []string
}

Jump to

Keyboard shortcuts

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