-
Notifications
You must be signed in to change notification settings - Fork 95
/
enrollments_mocks.go
176 lines (167 loc) · 5.42 KB
/
enrollments_mocks.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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
package cps
import "github.com/akamai/AkamaiOPEN-edgegrid-golang/v7/pkg/cps"
func mockLetsEncryptChallenges() *cps.Change {
allowedInput := cps.AllowedInput{
Info: "/cps/v2/enrollments/27552/changes/2848126/input/info/lets-encrypt-challenges",
RequiredToProceed: false,
Type: "lets-encrypt-challenges",
Update: "/cps/v2/enrollments/27552/changes/2848126/input/update/lets-encrypt-challenges-completed",
}
statusInfo := cps.StatusInfo{
DeploymentSchedule: nil,
Description: "Coordinating domain name validation.",
Error: nil,
State: "suspended",
Status: "coodinate-domain-validation",
}
change := &cps.Change{
AllowedInput: []cps.AllowedInput{allowedInput},
StatusInfo: &statusInfo,
}
return change
}
func mockThirdPartyCSRChallenges() *cps.Change {
allowedInput := cps.AllowedInput{
Info: "/cps/v2/enrollments/10002/changes/10002/input/info/third-party-csr",
RequiredToProceed: true,
Type: "third-party-certificate",
Update: "/cps/v2/enrollments/10002/changes/10002/input/update/third-party-cert-and-trust-chain",
}
statusInfo := cps.StatusInfo{
DeploymentSchedule: nil,
Description: "Waiting for you to upload and submit your third party certificate and trust chain.",
Error: nil,
State: "awaiting-input",
Status: "wait-upload-third-party",
}
change := &cps.Change{
AllowedInput: []cps.AllowedInput{allowedInput},
StatusInfo: &statusInfo,
}
return change
}
func mockEVChallenges() *cps.Change {
allowedInput := cps.AllowedInput{
Info: "/cps/v2/enrollments/10002/changes/10002/input/info/ev",
RequiredToProceed: true,
Type: "ev",
Update: "/cps/v2/enrollments/10002/changes/10002/input/update/ev-and-trust-chain",
}
statusInfo := cps.StatusInfo{
DeploymentSchedule: nil,
Description: "Waiting for you to upload and submit your ev certificate and trust chain.",
Error: nil,
State: "awaiting-input",
Status: "wait-upload-ev",
}
change := &cps.Change{
AllowedInput: []cps.AllowedInput{allowedInput},
StatusInfo: &statusInfo,
}
return change
}
func mockEmptyChanges() *cps.Change {
allowedInput := cps.AllowedInput{}
statusInfo := cps.StatusInfo{}
change := &cps.Change{
AllowedInput: []cps.AllowedInput{allowedInput},
StatusInfo: &statusInfo,
}
return change
}
func mockDVArray() *cps.DVArray {
challenges0 := cps.Challenge{
Error: "",
FullPath: "http://TestFullPath",
RedirectFullPath: "http://TestRedirectFullPath.com",
ResponseBody: "TestResponseBody",
Status: "pending",
Token: "TestToken123",
Type: "http-01",
ValidationRecords: nil,
}
challenges1 := cps.Challenge{
Error: "",
FullPath: "TestFullPath",
RedirectFullPath: "",
ResponseBody: "TestResponseBody",
Status: "pending",
Token: "TestToken123",
Type: "dns-01",
ValidationRecords: nil,
}
dv := cps.DV{
Challenges: []cps.Challenge{challenges0, challenges1},
Domain: "TestDomain",
Error: "The domain TestDomain is not ready for HTTP validation.",
Expires: "2022-07-25T10:17:44Z",
RequestTimestamp: "2022-07-18T10:17:44Z",
Status: "Awaiting user",
ValidatedTimestamp: "2022-07-19T09:35:29Z",
ValidationStatus: "DATA_NOT_READY",
}
dvArray := &cps.DVArray{DV: []cps.DV{dv}}
return dvArray
}
func mockThirdPartyCSRDVArray() *cps.DVArray {
challenges0 := cps.Challenge{
Error: "",
FullPath: "http://testFullPath.com",
RedirectFullPath: "http://testRedirectFullPath.com",
ResponseBody: "TestResponseBody",
Status: "pending",
Token: "TestToken",
Type: "third-party",
ValidationRecords: nil,
}
dv := cps.DV{
Challenges: []cps.Challenge{challenges0},
Domain: "test.com",
Error: "2022-07-25T10:17:44Z",
Expires: "2022-07-25T10:17:44Z",
RequestTimestamp: "2022-07-25T10:17:44Z",
Status: "completed",
ValidatedTimestamp: "2022-07-25T10:17:44Z",
ValidationStatus: "done",
}
dvArray := &cps.DVArray{DV: []cps.DV{dv}}
return dvArray
}
func mockEVDVArray() *cps.DVArray {
challenges0 := cps.Challenge{
Error: "",
FullPath: "http://testFullPath.com",
RedirectFullPath: "http://testRedirectFullPath.com",
ResponseBody: "TestResponseBody",
Status: "pending",
Token: "TestToken",
Type: "ev",
ValidationRecords: nil,
}
dv := cps.DV{
Challenges: []cps.Challenge{challenges0},
Domain: "test.com",
Error: "2022-07-25T10:17:44Z",
Expires: "2022-07-25T10:17:44Z",
RequestTimestamp: "2022-07-25T10:17:44Z",
Status: "completed",
ValidatedTimestamp: "2022-07-25T10:17:44Z",
ValidationStatus: "done",
}
dvArray := &cps.DVArray{DV: []cps.DV{dv}}
return dvArray
}
func mockEmptyDVArray() *cps.DVArray {
dv := cps.DV{
Challenges: []cps.Challenge{},
Domain: "",
Error: "",
Expires: "",
RequestTimestamp: "",
Status: "",
ValidatedTimestamp: "",
ValidationStatus: "",
}
dvArray := &cps.DVArray{DV: []cps.DV{dv}}
return dvArray
}