Version: v3.0.0-beta.2 Latest Latest

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

Go to latest
Published: Feb 2, 2021 License: Apache-2.0 Imports: 11 Imported by: 1



Package client offers utility functions for service registration



This section is empty.


This section is empty.


func ErrorMsg

func ErrorMsg(res *http.Response) string

ErrorMsg extracts the message field of a resource.Error response

func RegisterService

func RegisterService(endpoint string, service catalog.Service, ticket *obtainer.Client) (*catalog.Service, error)

RegisterService registers service into a catalog

func RegisterServiceAndKeepalive

func RegisterServiceAndKeepalive(endpoint string, service catalog.Service, ticket *obtainer.Client) (func() error, func(catalog.Service), error)

RegisterServiceAndKeepalive registers a service into a catalog and continuously updates it in order to avoid expiry endpoint: catalog endpoint. service: service registration ticket: set to nil for no auth It returns a function for stopping the keepalive and another function for updating the service in keepalive routine

func UnregisterService

func UnregisterService(endpoint string, service catalog.Service, ticket *obtainer.Client) error

UnregisterService removes service from a catalog


type FilterArgs

type FilterArgs struct {
	Path, Op, Value string

FilterArgs are the filtering arguments

type HTTPClient

type HTTPClient struct {
	// contains filtered or unexported fields

HTTPClient is the http client struct

func NewHTTPClient

func NewHTTPClient(serverEndpoint string, ticket *obtainer.Client) (*HTTPClient, error)

NewHTTPClient creates a new HTTP client for SC's REST API

func (*HTTPClient) Delete

func (c *HTTPClient) Delete(id string) error

Delete deletes a service

func (*HTTPClient) Get

func (c *HTTPClient) Get(id string) (*catalog.Service, error)

Get gets a service

func (*HTTPClient) GetMany

func (c *HTTPClient) GetMany(page, perPage int, filter *FilterArgs) ([]catalog.Service, int, error)

GetMany retrieves a page from the service collection

func (*HTTPClient) Ping

func (c *HTTPClient) Ping() (bool, error)

Ping returns true if health endpoint responds OK

func (*HTTPClient) Post

func (c *HTTPClient) Post(service *catalog.Service) (*catalog.Service, error)

Post posts a service

func (*HTTPClient) Put

func (c *HTTPClient) Put(service *catalog.Service) (*catalog.Service, error)

Put puts a service


Path Synopsis

Jump to

Keyboard shortcuts

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