Documentation ¶
Overview ¶
Package catalog implements a device/resource catalog and services catalog RESTful API servers with various storage backends. It also contains client SDK for consuming these APIs.
Index ¶
- Constants
- func DiscoverCatalogEndpoint(serviceType string) (endpoint string, err error)
- func GetPageOfSlice(slice []string, page, perPage, maxPerPage int) ([]string, error)
- func GetPagingAttr(total, page, perPage, maxPerPage int) (int, int, error)
- func HTTPDoAuth(req *http.Request, ticket *obtainer.Client) (*http.Response, error)
- func HTTPRequest(method string, url string, headers map[string][]string, body io.Reader, ...) (*http.Response, error)
- func MatchObject(object interface{}, path []string, op string, value string) (bool, error)
- func NewStaticHandler(staticDir string) http.HandlerFunc
- func ParsePagingParams(page, perPage string, maxPerPage int) (int, int, error)
- func ValidatePagingParams(page, perPage, maxPerPage int) error
Constants ¶
View Source
const ( CatalogBackendMemory = "memory" CatalogBackendLevelDB = "leveldb" StaticLocation = "/static" )
View Source
const ( FOpEquals = "equals" FOpPrefix = "prefix" FOpSuffix = "suffix" FOpContains = "contains" )
View Source
const ( GetParamPage = "page" GetParamPerPage = "per_page" )
Variables ¶
This section is empty.
Functions ¶
func DiscoverCatalogEndpoint ¶
Discovers a catalog endpoint given the serviceType
func GetPageOfSlice ¶
Returns a 'slice' of the given slice based on the requested 'page'
func GetPagingAttr ¶
Returns offset and limit representing a subset of the given slice total size
based on the requested 'page'
func HTTPDoAuth ¶
Send an HTTP request with Authorization entity-header.
Ticket is renewed once in case of failure.
func HTTPRequest ¶
func HTTPRequest(method string, url string, headers map[string][]string, body io.Reader, ticket *obtainer.Client) (*http.Response, error)
Constructs and submits an HTTP request and returns the response
func MatchObject ¶
func NewStaticHandler ¶
func NewStaticHandler(staticDir string) http.HandlerFunc
Serves static and all /static/ctx files as ld+json
func ParsePagingParams ¶
Parses string paging parameters to integers
func ValidatePagingParams ¶
Validates paging parameters
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package catalog/device implements storage backend, RESTful API handlers, and a client SDK for device/resource catalog implementation.
|
Package catalog/device implements storage backend, RESTful API handlers, and a client SDK for device/resource catalog implementation. |
Package catalog/service implements storage backend, RESTful API handlers, and a client SDK for service catalog implementation.
|
Package catalog/service implements storage backend, RESTful API handlers, and a client SDK for service catalog implementation. |
Click to show internal directories.
Click to hide internal directories.