package v2

import "github.com/edgexfoundry/go-mod-core-contracts/v2"

Index

Constants

const (
	ApiVersion = "v2"
	ApiBase    = "/api/v2"

	ApiEventRoute                      = ApiBase + "/event"
	ApiEventProfileNameDeviceNameRoute = ApiEventRoute + "/{" + ProfileName + "}" + "/{" + DeviceName + "}"
	ApiAllEventRoute                   = ApiEventRoute + "/" + All
	ApiEventIdRoute                    = ApiEventRoute + "/" + Id + "/{" + Id + "}"
	ApiEventCountRoute                 = ApiEventRoute + "/" + Count
	ApiEventCountByDeviceNameRoute     = ApiEventCountRoute + "/" + Device + "/" + Name + "/{" + Name + "}"
	ApiEventByDeviceNameRoute          = ApiEventRoute + "/" + Device + "/" + Name + "/{" + Name + "}"
	ApiEventByTimeRangeRoute           = ApiEventRoute + "/" + Start + "/{" + Start + "}/" + End + "/{" + End + "}"
	ApiEventByAgeRoute                 = ApiEventRoute + "/" + Age + "/{" + Age + "}"

	ApiReadingRoute                  = ApiBase + "/reading"
	ApiAllReadingRoute               = ApiReadingRoute + "/" + All
	ApiReadingCountRoute             = ApiReadingRoute + "/" + Count
	ApiReadingCountByDeviceNameRoute = ApiReadingCountRoute + "/" + Device + "/" + Name + "/{" + Name + "}"
	ApiReadingByDeviceNameRoute      = ApiReadingRoute + "/" + Device + "/" + Name + "/{" + Name + "}"
	ApiReadingByResourceNameRoute    = ApiReadingRoute + "/" + ResourceName + "/{" + ResourceName + "}"
	ApiReadingByTimeRangeRoute       = ApiReadingRoute + "/" + Start + "/{" + Start + "}/" + End + "/{" + End + "}"

	ApiDeviceProfileRoute                       = ApiBase + "/deviceprofile"
	ApiDeviceProfileUploadFileRoute             = ApiDeviceProfileRoute + "/uploadfile"
	ApiDeviceProfileByNameRoute                 = ApiDeviceProfileRoute + "/" + Name + "/{" + Name + "}"
	ApiDeviceProfileByIdRoute                   = ApiDeviceProfileRoute + "/" + Id + "/{" + Id + "}"
	ApiAllDeviceProfileRoute                    = ApiDeviceProfileRoute + "/" + All
	ApiDeviceProfileByManufacturerRoute         = ApiDeviceProfileRoute + "/" + Manufacturer + "/{" + Manufacturer + "}"
	ApiDeviceProfileByModelRoute                = ApiDeviceProfileRoute + "/" + Model + "/{" + Model + "}"
	ApiDeviceProfileByManufacturerAndModelRoute = ApiDeviceProfileRoute + "/" + Manufacturer + "/{" + Manufacturer + "}" + "/" + Model + "/{" + Model + "}"

	ApiDeviceServiceRoute       = ApiBase + "/deviceservice"
	ApiAllDeviceServiceRoute    = ApiDeviceServiceRoute + "/" + All
	ApiDeviceServiceByNameRoute = ApiDeviceServiceRoute + "/" + Name + "/{" + Name + "}"
	ApiDeviceServiceByIdRoute   = ApiDeviceServiceRoute + "/" + Id + "/{" + Id + "}"

	ApiDeviceRoute              = ApiBase + "/device"
	ApiAllDeviceRoute           = ApiDeviceRoute + "/" + All
	ApiDeviceIdExistsRoute      = ApiDeviceRoute + "/" + Check + "/" + Id + "/{" + Id + "}"
	ApiDeviceNameExistsRoute    = ApiDeviceRoute + "/" + Check + "/" + Name + "/{" + Name + "}"
	ApiDeviceByIdRoute          = ApiDeviceRoute + "/" + Id + "/{" + Id + "}"
	ApiDeviceByNameRoute        = ApiDeviceRoute + "/" + Name + "/{" + Name + "}"
	ApiDeviceByProfileIdRoute   = ApiDeviceRoute + "/" + Profile + "/" + Id + "/{" + Id + "}"
	ApiDeviceByProfileNameRoute = ApiDeviceRoute + "/" + Profile + "/" + Name + "/{" + Name + "}"
	ApiDeviceByServiceIdRoute   = ApiDeviceRoute + "/" + Service + "/" + Id + "/{" + Id + "}"
	ApiDeviceByServiceNameRoute = ApiDeviceRoute + "/" + Service + "/" + Name + "/{" + Name + "}"

	ApiProvisionWatcherRoute              = ApiBase + "/provisionwatcher"
	ApiAllProvisionWatcherRoute           = ApiProvisionWatcherRoute + "/" + All
	ApiProvisionWatcherByIdRoute          = ApiProvisionWatcherRoute + "/" + Id + "/{" + Id + "}"
	ApiProvisionWatcherByNameRoute        = ApiProvisionWatcherRoute + "/" + Name + "/{" + Name + "}"
	ApiProvisionWatcherByProfileNameRoute = ApiProvisionWatcherRoute + "/" + Profile + "/" + Name + "/{" + Name + "}"
	ApiProvisionWatcherByServiceNameRoute = ApiProvisionWatcherRoute + "/" + Service + "/" + Name + "/{" + Name + "}"

	ApiConfigRoute  = ApiBase + "/config"
	ApiMetricsRoute = ApiBase + "/metrics"
	ApiPingRoute    = ApiBase + "/ping"
	ApiVersionRoute = ApiBase + "/version"

	ApiDeviceCallbackRoute      = ApiBase + "/callback/device"
	ApiDeviceCallbackNameRoute  = ApiBase + "/callback/device/name/{name}"
	ApiProfileCallbackRoute     = ApiBase + "/callback/profile"
	ApiProfileCallbackNameRoute = ApiBase + "/callback/profile/name/{name}"
	ApiWatcherCallbackRoute     = ApiBase + "/callback/watcher"
	ApiWatcherCallbackNameRoute = ApiBase + "/callback/watcher/name/{name}"
	ApiDiscoveryRoute           = ApiBase + "/discovery"
	ApiNameCommandRoute         = ApiBase + "/device/name/{name}/{command}"
)

Constants related to defined routes in the v2 service APIs

const (
	All          = "all"
	Id           = "id"
	Created      = "created"
	Modified     = "modified"
	Pushed       = "pushed"
	Count        = "count"
	Device       = "device"
	DeviceId     = "deviceId"
	DeviceName   = "deviceName"
	Check        = "check"
	Profile      = "profile"
	Service      = "service"
	ProfileName  = "profileName"
	ServiceName  = "serviceName"
	ResourceName = "resourceName"
	Start        = "start"
	End          = "end"
	Age          = "age"
	Scrub        = "scrub"
	Type         = "type"
	Name         = "name"
	Label        = "label"
	Manufacturer = "manufacturer"
	Model        = "model"
	ValueType    = "valueType"
	Offset       = "offset" //query string to specify the number of items to skip before starting to collect the result set.
	Limit        = "limit"  //query string to specify the numbers of items to return
	Labels       = "labels" //query string to specify associated user-defined labels for querying a given object. More than one label may be specified via a comma-delimited list
)

Constants related to defined url path names and parameters in the v2 service APIs

const (
	DefaultOffset  = 0
	DefaultLimit   = 20
	CommaSeparator = ","
)

Constants related to the default value of query strings in the v2 service APIs

const (
	ValueTypeBool         = "Bool"
	ValueTypeString       = "String"
	ValueTypeUint8        = "Uint8"
	ValueTypeUint16       = "Uint16"
	ValueTypeUint32       = "Uint32"
	ValueTypeUint64       = "Uint64"
	ValueTypeInt8         = "Int8"
	ValueTypeInt16        = "Int16"
	ValueTypeInt32        = "Int32"
	ValueTypeInt64        = "Int64"
	ValueTypeFloat32      = "Float32"
	ValueTypeFloat64      = "Float64"
	ValueTypeBinary       = "Binary"
	ValueTypeBoolArray    = "BoolArray"
	ValueTypeStringArray  = "StringArray"
	ValueTypeUint8Array   = "Uint8Array"
	ValueTypeUint16Array  = "Uint16Array"
	ValueTypeUint32Array  = "Uint32Array"
	ValueTypeUint64Array  = "Uint64Array"
	ValueTypeInt8Array    = "Int8Array"
	ValueTypeInt16Array   = "Int16Array"
	ValueTypeInt32Array   = "Int32Array"
	ValueTypeInt64Array   = "Int64Array"
	ValueTypeFloat32Array = "Float32Array"
	ValueTypeFloat64Array = "Float64Array"
)

Constants related to Reading ValueTypes

Functions

func NormalizeValueType

func NormalizeValueType(valueType string) (string, error)

// NormalizeValueType normalizes the valueType to upper camel case

func Validate

func Validate(a interface{}) error

Validate function will use the validator package to validate the struct annotation

func ValidateAutoEventFrequency

func ValidateAutoEventFrequency(fl validator.FieldLevel) bool

ValidateAutoEventFrequency validate AutoEvent's Frequency field which should follow the ISO 8601 Durations format

func ValidateDtoNoneEmptyString

func ValidateDtoNoneEmptyString(fl validator.FieldLevel) bool

ValidateDtoNoneEmptyString used to check the UpdateDTO name pointer value

func ValidateDtoRFC3986UnreservedChars

func ValidateDtoRFC3986UnreservedChars(fl validator.FieldLevel) bool

ValidateDtoRFC3986UnreservedChars used to check if DTO's name pointer value only contains unreserved characters as defined in https://tools.ietf.org/html/rfc3986#section-2.3

func ValidateDtoUuid

func ValidateDtoUuid(fl validator.FieldLevel) bool

ValidateDtoUuid used to check the UpdateDTO uuid pointer value Currently, required_without can not correct work with other tag, so write custom tag instead. Issue can refer to https://github.com/go-playground/validator/issues/624

func ValidateValueType

func ValidateValueType(fl validator.FieldLevel) bool

ValidateValueType checks whether the valueType is valid

Source Files

constants.go utils.go validator.go

Directories

PathSynopsis
v2/clients
v2/clients/http
v2/clients/http/utils
v2/clients/interfaces
v2/dtos
v2/dtos/common
v2/dtos/requests
v2/dtos/responses
v2/models
Version
v0.1.149 (latest)
Published
Jan 19, 2021
Platform
linux/amd64
Imports
8 packages
Last checked
5 days ago

Tools for package owners.