Documentation ¶
Overview ¶
Package senmltest implements senml testing utilities
Index ¶
- Constants
- Variables
- func CompareRecords(r1 senml.Record, r2 senml.Record) (same bool)
- func CompareSenml(s1 senml.Pack, s2 senml.Pack) (same bool)
- func Diff_name_diff_types() senml.Pack
- 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) ([]int, []int)
- func Same_name_same_types(count int, name string, decremental bool) senml.Pack
- func SetVersion(version string)
- func SupportedAggregate(a string) bool
- func SupportedPeriod(p string) bool
- func SupportedPeriods() []string
- func SupportedType(t string) bool
- 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 ObtainerConf
- type RegBackendConf
- type RegConf
- type ServiceCatalogConf
- type ValidatorConf
- 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" // Values for ParamSort ASC = "asc" // ascending DESC = "desc" // descending )
View Source
const ( STRING = "string" FLOAT = "float" BOOL = "bool" DATA = "data" )
Data source types
Variables ¶
View Source
var ( // APIVersion defines the API version APIVersion string // Default MIME type for all responses DefaultMIMEType string )
Functions ¶
func Diff_name_diff_types ¶
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 sources
func Same_name_same_types ¶
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"` // 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 ValidatorConf `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 ObtainerConf ¶ added in v0.5.0
type ObtainerConf struct { // Authentication provider name Provider string `json:"provider"` // Authentication provider BrokerURL ProviderURL string `json:"providerURL"` // Service ID ServiceID string `json:"serviceID"` // User credentials Username string `json:"username"` Password string `json:"password"` }
Ticket Obtainer Client Config
func (ObtainerConf) Validate ¶ added in v0.5.0
func (c ObtainerConf) Validate() error
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
type ServiceCatalogConf ¶ added in v0.5.0
type ServiceCatalogConf struct { Discover bool `json:"discover"` Endpoint string `json:"endpoint"` TTL uint `json:"ttl"` Auth *ObtainerConf `json:"auth"` }
LinkSmart Service Catalog registration config
type ValidatorConf ¶ added in v0.5.0
type ValidatorConf struct { // Auth switch Enabled bool `json:"enabled"` // Authentication provider name Provider string `json:"provider"` // Authentication provider BrokerURL ProviderURL string `json:"providerURL"` // Service ID ServiceID string `json:"serviceID"` // Basic Authentication switch BasicEnabled bool `json:"basicEnabled"` // Authorization config Authz *authz.Conf `json:"authorization"` }
Ticket Validator Config
func (ValidatorConf) Validate ¶ added in v0.5.0
func (c ValidatorConf) Validate() error
Click to show internal directories.
Click to hide internal directories.