This repository has been archived by the owner on Apr 3, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
const.go
162 lines (153 loc) · 6 KB
/
const.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*******************************************************************************
* Copyright 2017 Dell Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
* @microservice: core-metadata-go service
* @author: Spencer Bull & Ryan Comer, Dell
* @version: 0.5.0
*******************************************************************************/
package main
import (
"errors"
"github.com/edgexfoundry/core-domain-go/enums"
)
// Struct used to pase the JSON configuration file
type ConfigurationStruct struct {
ApplicationName string
DBType string
MongoDatabaseName string
MongoDBUserName string
MongoDBPassword string
MongoDBHost string
MongoDBPort int
MongoDBConnectTimeout int
ReadMaxLimit int
Protocol string
ServiceName string
ServiceAddress string
ServerPort int
ServerTimeout int
HeartBeatTime int
HeartBeatMsg string
AppOpenMsg string
CheckInterval string
ConsulProfilesActive string
ConsulHost string
ConsulCheckAddress string
ConsulPort int
LoggingFile string
LoggingRemoteURL string
NotificationPostDeviceChanges bool
NotificationsSlug string
NotificationContent string
NotificationSender string
NotificationDescription string
NotificationLabel string
SupportNotificationsNotificationURL string
SupportNotificationsSubscriptionURL string
SupportNotificationsTransmissionURL string
}
// Configuration data for the metadata service
var configuration ConfigurationStruct = ConfigurationStruct{} // Needs to be initialized before used
var (
/* -------------- CONFIG for METADATA -------------------- */
DATABASE enums.DATABASE
DBTYPE = "mongodb"
PROTOCOL = "http"
SERVERPORT = "48081"
DOCKERMONGO = "edgex-mongo:27017"
DBUSER = "meta"
DBPASS = "password"
MONGODATABASE = "metadata"
CONFIG = "res/configuration.json"
METADATASERVICENAME = "core-metadata"
MAX_LIMIT int = 1000
/* ----------------------- CONSTANTS ----------------------------*/
REST = "http"
GET = "GET"
PUT = "PUT"
POST = "POST"
DELETE = "DELETE"
MONGOSTR = "mongo"
DB = "metadata"
DEVICECOL = "device"
DPCOL = "deviceProfile"
DSCOL = "deviceService"
ADDCOL = "addressable"
COMCOL = "command"
DRCOL = "deviceReport"
SECOL = "scheduleEvent"
SCOL = "schedule"
PWCOL = "provisionWatcher"
TIMELAYOUT = "20060102T150405"
/* ---------------- URL PARAM NAMES -----------------------*/
ID = "id"
_ID = "_id"
NAME = "name"
OPSTATE = "opstate"
URLADMINSTATE = "adminstate"
ADMINSTATE = "adminState"
URLLASTREPORTED = "lastreported"
LASTREPORTED = "lastReported"
LASTREPORTEDNOTIFY = "lastreportednotify"
URLLASTCONNECTED = "lastconnected"
LASTCONNECTED = "lastConnected"
LASTCONNECTEDNOTIFY = "lastconnectednotify"
ADDRESSABLE = "addressable"
ADDRESSABLENAME = "addressablename"
ADDRESSABLEID = "addressableid"
SERVICE = "service"
SERVICENAME = "servicename"
SERVICEID = "serviceid"
LABEL = "label"
LABELS = "labels"
PROFILE = "profile"
PROFILEID = "profileid"
PROFILENAME = "profilename"
DEVICEPROFILE = "deviceprofile"
UPLOADFILE = "uploadfile"
UPLOAD = "upload"
MODEL = "model"
MANUFACTURER = "manufacturer"
YAML = "yaml"
DEVICEREPORT = "devicereport"
DEVICENAME = "devicename"
DEVICESERVICE = "deviceservice"
SCHEDULEEVENT = "scheduleevent"
SCHEDULE = "schedule"
TOPIC = "topic"
PORT = "port"
PUBLISHER = "publisher"
ADDRESS = "address"
COMMAND = "command"
DEVICE = "device"
OPERATINGSTATE = "operatingState"
PROVISIONWATCHER = "provisionwatcher"
IDENTIFIER = "identifier"
IDENTIFIERS = "identifiers"
KEY = "key"
VALUE = "value"
VALUEDESCRIPTORSFOR = "valueDescriptorsFor"
DEVICEADDRESSABLES = "deviceaddressables"
DEVICEADDRESSABLESBYNAME = "deviceaddressablesbyname"
/* ----------------------- ERRORS ----------------------------*/
ErrNotFound = errors.New("Not found")
ErrDuplicateName = errors.New("Duplicate name for the resource")
ErrDuplicateCommandInProfile = errors.New("Duplicate name for command in device profile")
ErrCommandStillInUse = errors.New("Command is still in use by device profiles")
/* TODO ENUM */
LOCKED = "LOCKED"
UNLOCKED = "UNLOCKED"
ENABLED = "ENABLED"
DISABLED = "DISABLED"
QUERYTS = "-timestamp"
)