catalog

package
v0.0.0-...-7350472 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

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

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

func DiscoverCatalogEndpoint(serviceType string) (endpoint string, err error)

Discovers a catalog endpoint given the serviceType

func GetPageOfSlice

func GetPageOfSlice(slice []string, page, perPage, maxPerPage int) ([]string, error)

Returns a 'slice' of the given slice based on the requested 'page'

func GetPagingAttr

func GetPagingAttr(total, page, perPage, maxPerPage int) (int, int, error)

Returns offset and limit representing a subset of the given slice total size

based on the requested 'page'

func HTTPDoAuth

func HTTPDoAuth(req *http.Request, ticket *obtainer.Client) (*http.Response, error)

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 MatchObject(object interface{}, path []string, op string, value string) (bool, error)

func NewStaticHandler

func NewStaticHandler(staticDir string) http.HandlerFunc

Serves static and all /static/ctx files as ld+json

func ParsePagingParams

func ParsePagingParams(page, perPage string, maxPerPage int) (int, int, error)

Parses string paging parameters to integers

func ValidatePagingParams

func ValidatePagingParams(page, perPage, maxPerPage int) error

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.

Jump to

Keyboard shortcuts

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