Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorResponse(code int, msg string, w http.ResponseWriter)
- func ParsePagingParams(page, perPage string, maxPerPage int) (int, int, error)
- func PerItemPagination(_qLimit, _page, _perPage, _numOfSrcs int) (perItems []int, offsets []int)
- func SetVersion(version string)
- func SupportedAggregate(a string) bool
- func SupportedPeriod(p string) bool
- func SupportedPeriods() []string
- func ValidatePagingParams(page, perPage, maxPerPage int) error
- func ValidatePerItemLimit(_qLimit, _perPage, _numOfSrcs int) error
- type AggrConf
- type Config
- type DataBackendConf
- type DataConf
- type Error
- type HTTPConf
- type RegBackendConf
- type RegConf
- type ServiceCatalogConf
- type WebConfig
Constants ¶
View Source
const ( // IDSeparator is used for separation of IDs in the BrokerURL IDSeparator = "," // Location of APIs RegistryAPILoc = "/registry" DataAPILoc = "/data" // Query parameters ParamPage = "page" ParamPerPage = "perPage" ParamLimit = "limit" ParamFrom = "from" ParamTo = "to" ParamSort = "sort" ParamDenormalize = "denormalize" ParamCount = "count" // Values for ParamSort Asc = "asc" // ascending Desc = "desc" // descending //values for auth providers Keycloak = "keycloak" DNSSDServiceType = "_linksmart-hds._tcp" )
Variables ¶
View Source
var ( // APIVersion defines the API version APIVersion string // Default MIME type for all responses DefaultMIMEType string )
Functions ¶
func ErrorResponse ¶
func ErrorResponse(code int, msg string, w http.ResponseWriter)
ErrorResponse writes error to HTTP ResponseWriter
func ParsePagingParams ¶
func PerItemPagination ¶
Calculate perItem and offset given the page, perPage, limit, and number of streams
func SetVersion ¶
func SetVersion(version string)
func SupportedAggregate ¶
SupportedAggregate validates an aggregate
func SupportedPeriod ¶ added in v0.5.0
SupportedPeriod validates a period
func SupportedPeriods ¶ added in v0.6.1
func SupportedPeriods() []string
SupportedPeriods returns supported periods
func ValidatePagingParams ¶
func ValidatePerItemLimit ¶
Check if the parameters match the criteria required by PerItemPagination function
Types ¶
type Config ¶ added in v0.5.0
type Config struct { // Service ID ServiceID string `json:"serviceID"` // HDS API addr HTTP HTTPConf `json:"http"` //DNS service discovery DnssdEnabled bool `json:"dnssdEnabled"` //DNS-SD description Description string `json:"description"` // Registry API Config Reg RegConf `json:"registry"` // Data API Config Data DataConf `json:"data"` // Aggregation API Config Aggr AggrConf `json:"aggregation"` // LinkSmart Service Catalog registration config ServiceCatalog ServiceCatalogConf `json:"serviceCatalog"` // Auth config Auth validator.Conf `json:"auth"` }
type DataBackendConf ¶ added in v0.5.0
Data backend config
type DataConf ¶ added in v0.5.0
type DataConf struct { Backend DataBackendConf `json:"backend"` // RetentionPeriods is deprecated, will be removed from v0.6.0. Use registry.retentionPeriods instead. RetentionPeriods []string `json:"retentionPeriods"` AutoRegistration bool `json:"autoRegistration"` }
Data config
type Error ¶
type Error struct { // Code is the (http) code of the error Code int `json:"code"` // Message is the (human-readable) error message Message string `json:"message"` }
Error describes an API error (serializable in JSON)
type HTTPConf ¶ added in v0.5.0
type HTTPConf struct { PublicEndpoint string `json:"publicEndpoint"` BindAddr string `json:"bindAddr"` BindPort uint16 `json:"bindPort"` }
HTTP config
type RegBackendConf ¶ added in v0.5.0
Registry backend config
type RegConf ¶ added in v0.5.0
type RegConf struct { Backend RegBackendConf `json:"backend"` RetentionPeriods []string `json:"retentionPeriods"` }
Registry config
func (RegConf) ConfiguredRetention ¶ added in v0.5.2
Click to show internal directories.
Click to hide internal directories.