/
constants.go
99 lines (89 loc) · 4.66 KB
/
constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//
// Copyright (C) 2020 IOTech Ltd
//
// SPDX-License-Identifier: Apache-2.0
package v2
// Constants related to defined routes in the v2 service APIs
const (
ApiVersion = "v2"
ApiBase = "/api/v2"
ApiEventRoute = ApiBase + "/event"
ApiAllEventRoute = ApiEventRoute + "/" + All
ApiEventIdRoute = ApiEventRoute + "/" + Id + "/{" + Id + "}"
ApiEventPushRoute = ApiEventRoute + "/" + Pushed
ApiEventCountRoute = ApiEventRoute + "/" + Count
ApiEventCountByDeviceRoute = ApiEventCountRoute + "/" + Device + "/{" + DeviceName + "}"
ApiEventByDeviceNameRoute = ApiEventRoute + "/" + Device + "/" + Name + "/{" + Name + "}"
ApiEventByTimeRangeRoute = ApiEventRoute + "/" + Start + "/{" + Start + "}/" + End + "/{" + End + "}"
ApiEventByAgeRoute = ApiEventRoute + "/" + Age + "/{" + Age + "}"
ApiEventScrubRoute = ApiEventRoute + "/" + Scrub
ApiReadingRoute = ApiBase + "/reading"
ApiAllReadingRoute = ApiReadingRoute + "/" + All
ApiReadingCountRoute = ApiReadingRoute + "/" + Count
ApiReadingIdRoute = ApiReadingRoute + "/" + Id + "/{" + Id + "}"
ApiReadingByDeviceNameRoute = ApiReadingRoute + "/" + Device + "/" + Name + "/{" + Name + "}"
ApiReadingByTypeRoute = ApiReadingRoute + "/" + Type + "/{" + Type + "}"
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 + "}"
ApiConfigRoute = ApiBase + "/config"
ApiMetricsRoute = ApiBase + "/metrics"
ApiPingRoute = ApiBase + "/ping"
ApiVersionRoute = ApiBase + "/version"
)
// Constants related to defined url path names and parameters 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"
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 the default value of query strings in the v2 service APIs
const (
DefaultOffset = 0
DefaultLimit = 20
CommaSeparator = ","
)