-
Notifications
You must be signed in to change notification settings - Fork 0
/
const.go
97 lines (73 loc) · 2.81 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
package common
// EmergencyType defines integer constants for the types of emergencies that the system expects
type EmergencyType int
// AlertTier defines integer constants for the types of alert tiers available for contacts
type AlertTier int
const (
// UsersTableName defines the DynamoDB table used to store EmergenSeek users
UsersTableName = "EmergenSeekUsers"
// LambdaSecretsTable defines the DynamoDB table used to store environment variables
LambdaSecretsTable = "LambdaSecrets"
// SettingsTableName defines the DynamoDB table used to store user settings
SettingsTableName = "EmergenSeekSettings"
// EmergencyNumsTableName defines the DynamoDB table used to global emergency phone numbers
EmergencyNumsTableName = "EmergencyNumbers"
// S3BucketName defines the name of the S3 bucket used by the application
S3BucketName = "emergenseek.com"
// S3BucketLocation defines the URL of the S3 bucket
S3BucketLocation = "https://s3.us-east-2.amazonaws.com/emergenseek.com/"
// Region defines the AWS VPC region used for development
Region = "us-east-2"
// SEVERE defines a priority 1 emergency
SEVERE EmergencyType = 1
// MILD defines a priority 2 emergency
MILD EmergencyType = 2
// CHECKIN defines a priority 3 emergency (non-emergency)
CHECKIN EmergencyType = 3
// FIRST defines a first priority alert tier
FIRST AlertTier = 1
// SECOND defines a second priority alert tier
SECOND AlertTier = 2
// THIRD defines a third priority alert tier
THIRD AlertTier = 3
// TwilioTrial defines the LambdaSecrets item ID of Twilio credentials for the trial account
TwilioTrial = "1"
// TwilioProduction defines the LambdaSecrets item ID of Twilio credentials for the paid account
TwilioProduction = "2"
// MapQuest defines the LambdaSecrets item ID containing MapQuest API credentials
MapQuest = "3"
// GoogleMaps defines the LambdaSecrets item ID containing Google Maps API credentials
GoogleMaps = "4"
// TwilioVoice defines the Amazon Polly voice used for voice calls
TwilioVoice = "Polly.Kimberly"
)
// String converts an EmergencyType to its string name
func (emergency EmergencyType) String() string {
// Map the emergency type string to an index
types := [...]string{
"SEVERE",
"MILD",
"CHECKIN",
}
// Check if the integer is between 1 and 3 inclusive
if emergency < SEVERE || emergency > CHECKIN {
return "Unknown"
}
// Return at types index - 1 because the enum begins at 1 not 0
return types[emergency-1]
}
// String converts an AlertTier to its string name
func (tier AlertTier) String() string {
// Map the tier type string to an index
types := [...]string{
"FIRST",
"SECOND",
"THIRD",
}
// Check if the integer is between 1 and 3 inclusive
if tier < FIRST || tier > THIRD {
return "Unknown"
}
// Return at types index - 1 because the enum begins at 1 not 0
return types[tier-1]
}