endpoint

package
v0.0.0-...-4a20579 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PublicURLScope  = "public"
	PrivateURLScope = "private"
)

Endpoint related constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	URL      string
	Username string
	Password string
}

Endpoint represents an endpoint url with its credentials.

func NewEndpoint

func NewEndpoint(url, user, password string) *Endpoint

NewEndpoint returns new Endpoint.

type Store

type Store struct {
	Data *sync.Map
	// contains filtered or unexported fields
}

Store is used to store cluster specific endpoint targets store in-memory.

func NewStore

func NewStore() *Store

NewStore returns new Store.

func (*Store) Contains

func (s *Store) Contains(prefix string) bool

Contains check if the prefix exists in store.

func (*Store) Get

func (s *Store) Get(endpointKey string) *TargetStore

Get reads endpoint targets store from memory.

func (*Store) GetEndpointURL

func (s *Store) GetEndpointURL(clusterID, prefix string) (string, bool)

GetEndpointURL returns endpoint.

func (*Store) GetEndpointURLs

func (s *Store) GetEndpointURLs(prefix string, endpointKey string) []string

GetEndpointURLs reads the urls of endpoint targets of the given store.

func (*Store) GetPassword

func (s *Store) GetPassword(prefix string, endpointKey string) string

GetPassword reads the password of the first endpoint target of the given store.

func (*Store) GetUsername

func (s *Store) GetUsername(prefix string, endpointKey string) string

GetUsername reads the username of the first endpoint target of the given store.

func (*Store) InitScope

func (s *Store) InitScope(prefix string)

InitScope creates a new target store for a given prefix if it doesn't yet exist.

func (*Store) Remove

func (s *Store) Remove(prefix string)

Remove removes endpoint target store from memory.

func (*Store) RemoveDeleted

func (s *Store) RemoveDeleted(endpoints map[string]*models.Endpoint)

RemoveDeleted removes all endpoints that do not match the given ones.

func (*Store) UpdateEndpoint

func (s *Store) UpdateEndpoint(prefix string, endpoint *models.Endpoint) error

UpdateEndpoint writes endpoint target in memory if proxy endpoint not in store or updated.

func (*Store) Write

func (s *Store) Write(endpointKey string, endpointStore *TargetStore)

Write writes endpoint targets store in-memory.

type TargetStore

type TargetStore struct {
	Data *sync.Map
	// contains filtered or unexported fields
}

TargetStore is used to store service specific endpoint targets in-memory.

func NewTargetStore

func NewTargetStore() *TargetStore

NewTargetStore returns new TargetStore.

func (*TargetStore) Count

func (t *TargetStore) Count() int

Count returns number of endpoint targets in memory.

func (*TargetStore) Get

func (t *TargetStore) Get(id string) *models.Endpoint

Get endpoint target from memory.

func (*TargetStore) GetAll

func (t *TargetStore) GetAll(scope string) (targets []*Endpoint)

GetAll reads all endpoint targets from target store using given scope. Order of returned targets is not deterministic.

func (*TargetStore) Next

func (t *TargetStore) Next(scope string) (endpointData *Endpoint)

Next reads next endpoint target from memory in round robin fashion.

func (*TargetStore) Remove

func (t *TargetStore) Remove(endpointKey string)

Remove removes endpoint target from memory.

func (*TargetStore) Write

func (t *TargetStore) Write(id string, endpoint *models.Endpoint)

Write writes endpoint target in-memory.

Jump to

Keyboard shortcuts

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