Documentation
¶
Overview ¶
Package client offers utility functions for service registration
Index ¶
- func ErrorMsg(res *http.Response) string
- func RegisterService(endpoint string, service catalog.Service, ticket *obtainer.Client) (*catalog.Service, error)
- func RegisterServiceAndKeepalive(endpoint string, service catalog.Service, ticket *obtainer.Client) (func() error, func(catalog.Service), error)
- func UnregisterService(endpoint string, service catalog.Service, ticket *obtainer.Client) error
- type FilterArgs
- type HTTPClient
- func (c *HTTPClient) Delete(id string) error
- func (c *HTTPClient) Get(id string) (*catalog.Service, error)
- func (c *HTTPClient) GetMany(page, perPage int, filter *FilterArgs) ([]catalog.Service, int, error)
- func (c *HTTPClient) Ping() (bool, error)
- func (c *HTTPClient) Post(service *catalog.Service) (*catalog.Service, error)
- func (c *HTTPClient) Put(service *catalog.Service) (*catalog.Service, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
Types ¶
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) 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