Skip to content

Commit c5c5f21

Browse files
Merge pull request #1 from greatestusername-splunk/syntheticsv2
Syntheticsv2
2 parents 957ee18 + e98d49a commit c5c5f21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3561
-7
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,7 @@
2626
.history/
2727

2828
# Built Visual Studio Code Extensions
29-
*.vsix
29+
*.vsix
30+
31+
.DS_Store
32+
.vscode/settings.json

Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
.PHONY: default all build clean test fmtcheck testacc sonarqube
22

3-
PKG_NAME=syntheticsclient
4-
FILES=./...
3+
PKG_NAME=syntheticsclientv2
4+
FILES=./syntheticsclientv2/...
55

6-
default: test
6+
default: test
77

88
all: clean build test
99

1010
build: fmtcheck
11-
go build
11+
go build -tags=unit_tests
1212

1313
clean:
1414
@echo "==> Cleaning out old builds "
@@ -28,11 +28,11 @@ fmtcheck: fmt lint
2828

2929
test: fmtcheck
3030
@echo "==> Running all tests"
31-
go test $(FILES) -v -timeout=30s -parallel=4 -cover
31+
go test $(FILES) -v -tags=unit_tests -timeout=30s -parallel=4 -cover
3232

3333
testacc: clean fmtcheck
3434
@echo "==> Running all tests"
35-
go test $(FILES) -v -timeout=30s -parallel=8 -cover -coverprofile coverage.txt
35+
go test $(FILES) -v -tags=unit_tests -timeout=30s -parallel=8 -cover -coverprofile coverage.txt
3636

3737
sonarqube: testacc
3838
docker run -it -v "${PWD}:/usr/src" sonarsource/sonar-scanner-cli

syntheticsclientv2/common_models.go

+325
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,325 @@
1+
// Copyright 2021 Splunk, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package syntheticsclientv2
16+
17+
import (
18+
"time"
19+
)
20+
21+
// Common and shared struct models used for more complex requests
22+
type Networkconnection struct {
23+
Description string `json:"description,omitempty"`
24+
Downloadbandwidth int `json:"download_bandwidth,omitempty"`
25+
Latency int `json:"latency,omitempty"`
26+
Packetloss int `json:"packet_loss,omitempty"`
27+
Uploadbandwidth int `json:"upload_bandwidth,omitempty"`
28+
}
29+
30+
type Advancedsettings struct {
31+
Authentication `json:"authentication"`
32+
Cookiesv2 []Cookiesv2 `json:"cookies"`
33+
BrowserHeaders []BrowserHeaders `json:"headers,omitempty"`
34+
HostOverrides []HostOverrides `json:"host_overrides,omitempty"`
35+
UserAgent string `json:"user_agent,omitempty"`
36+
Verifycertificates bool `json:"verifyCertificates,omitempty"`
37+
}
38+
39+
type Authentication struct {
40+
Password string `json:"password"`
41+
Username string `json:"username"`
42+
}
43+
44+
type Cookiesv2 struct {
45+
Key string `json:"key"`
46+
Value string `json:"value"`
47+
Domain string `json:"domain"`
48+
Path string `json:"path"`
49+
}
50+
51+
type BrowserHeaders struct {
52+
Name string `json:"name"`
53+
Value string `json:"value"`
54+
Domain string `json:"domain"`
55+
}
56+
57+
type HostOverrides struct {
58+
Source string `json:"source"`
59+
Target string `json:"target"`
60+
KeepHostHeader bool `json:"keep_host_header"`
61+
}
62+
63+
type Transactions struct {
64+
Name string `json:"name"`
65+
StepsV2 []StepsV2 `json:"steps"`
66+
}
67+
68+
type BusinessTransactions struct {
69+
Name string `json:"name"`
70+
StepsV2 []StepsV2 `json:"steps"`
71+
}
72+
73+
type StepsV2 struct {
74+
Name string `json:"name"`
75+
Type string `json:"type"`
76+
URL string `json:"url,omitempty"`
77+
Action string `json:"action,omitempty"`
78+
WaitForNav bool `json:"wait_for_nav"`
79+
SelectorType string `json:"selector_type,omitempty"`
80+
Selector string `json:"selector,omitempty"`
81+
Options `json:"options,omitempty"`
82+
}
83+
84+
type BusinessTransactionStepsV2 struct {
85+
Name string `json:"name"`
86+
Type string `json:"type"`
87+
URL string `json:"url,omitempty"`
88+
Action string `json:"action,omitempty"`
89+
WaitForNav bool `json:"wait_for_nav"`
90+
SelectorType string `json:"selector_type,omitempty"`
91+
Selector string `json:"selector,omitempty"`
92+
Options `json:"options,omitempty"`
93+
}
94+
95+
type Options struct {
96+
URL string `json:"url,omitempty"`
97+
}
98+
99+
type Device struct {
100+
ID int `json:"id,omitempty"`
101+
Label string `json:"label,omitempty"`
102+
UserAgent string `json:"user_agent,omitempty"`
103+
Networkconnection `json:"network_connection,omitempty"`
104+
Viewportheight int `json:"viewport_height"`
105+
Viewportwidth int `json:"viewport_width"`
106+
}
107+
108+
type Requests struct {
109+
Configuration `json:"configuration,omitempty"`
110+
Setup []Setup `json:"setup,omitempty"`
111+
Validations []Validations `json:"validations,omitempty"`
112+
}
113+
114+
type Configuration struct {
115+
Body string `json:"body"`
116+
Headers `json:"headers,omitempty"`
117+
Name string `json:"name,omitempty"`
118+
Requestmethod string `json:"requestMethod,omitempty"`
119+
URL string `json:"url,omitempty"`
120+
}
121+
122+
type Headers map[string]interface{}
123+
124+
type Setup struct {
125+
Extractor string `json:"extractor,omitempty"`
126+
Name string `json:"name,omitempty"`
127+
Source string `json:"source,omitempty"`
128+
Type string `json:"type,omitempty"`
129+
Variable string `json:"variable,omitempty"`
130+
}
131+
132+
type Validations struct {
133+
Actual string `json:"actual,omitempty"`
134+
Comparator string `json:"comparator,omitempty"`
135+
Expected string `json:"expected,omitempty"`
136+
Name string `json:"name,omitempty"`
137+
Type string `json:"type,omitempty"`
138+
}
139+
140+
type Tests []struct {
141+
Active bool `json:"active"`
142+
Createdat time.Time `json:"created_at"`
143+
Frequency int `json:"frequency"`
144+
ID int `json:"id"`
145+
Locationids []string `json:"locationIds"`
146+
Name string `json:"name"`
147+
Schedulingstrategy string `json:"scheduling_strategy"`
148+
Type string `json:"type"`
149+
Updatedat time.Time `json:"updated_at"`
150+
}
151+
152+
type GetChecksV2Options struct {
153+
TestType string `json:"testType"`
154+
PerPage int `json:"perPage"`
155+
Page int `json:"page"`
156+
Search string `json:"search"`
157+
OrderBy string `json:"orderBy"`
158+
}
159+
160+
type Errors []struct {
161+
Title string `json:"title,omitempty"`
162+
Description string `json:"description,omitempty"`
163+
}
164+
165+
type HttpHeaders struct {
166+
Name string `json:"name,omitempty"`
167+
Value string `json:"value,omitempty"`
168+
}
169+
170+
type Variable struct {
171+
Createdat time.Time `json:"created_at,omitempty"`
172+
Description string `json:"description,omitempty"`
173+
ID int `json:"id,omitempty"`
174+
Name string `json:"name"`
175+
Secret bool `json:"secret"`
176+
Updatedat time.Time `json:"updated_at,omitempty"`
177+
Value string `json:"value"`
178+
}
179+
180+
type DeleteCheck struct {
181+
Result string `json:"result"`
182+
Message string `json:"message"`
183+
Errors Errors `json:"errors"`
184+
}
185+
186+
type VariableV2Response struct {
187+
Variable `json:"variable"`
188+
}
189+
190+
type VariableV2Input struct {
191+
Variable `json:"variable"`
192+
}
193+
194+
type ChecksV2Response struct {
195+
Nextpagelink int `json:"nextPageLink"`
196+
Perpage int `json:"perPage"`
197+
Tests `json:"tests"`
198+
Totalcount int `json:"totalCount"`
199+
}
200+
201+
type PortCheckV2Response struct {
202+
Test struct {
203+
ID int `json:"id"`
204+
Name string `json:"name"`
205+
Active bool `json:"active"`
206+
Frequency int `json:"frequency"`
207+
SchedulingStrategy string `json:"scheduling_strategy"`
208+
CreatedAt time.Time `json:"created_at"`
209+
UpdatedAt time.Time `json:"updated_at"`
210+
LocationIds []string `json:"location_ids"`
211+
Type string `json:"type"`
212+
Protocol string `json:"protocol"`
213+
Host string `json:"host"`
214+
Port int `json:"port"`
215+
} `json:"test"`
216+
}
217+
218+
type PortCheckV2Input struct {
219+
Test struct {
220+
Name string `json:"name"`
221+
Type string `json:"type"`
222+
URL string `json:"url"`
223+
Port int `json:"port"`
224+
Protocol string `json:"protocol"`
225+
Host string `json:"host"`
226+
LocationIds []string `json:"location_ids"`
227+
Frequency int `json:"frequency"`
228+
SchedulingStrategy string `json:"scheduling_strategy"`
229+
Active bool `json:"active"`
230+
} `json:"test"`
231+
}
232+
233+
type HttpCheckV2Response struct {
234+
Test struct {
235+
ID int `json:"id"`
236+
Name string `json:"name"`
237+
Active bool `json:"active"`
238+
Frequency int `json:"frequency"`
239+
SchedulingStrategy string `json:"scheduling_strategy"`
240+
CreatedAt time.Time `json:"created_at,omitempty"`
241+
UpdatedAt time.Time `json:"updated_at,omitempty"`
242+
LocationIds []string `json:"location_ids"`
243+
Type string `json:"type"`
244+
URL string `json:"url"`
245+
RequestMethod string `json:"request_method"`
246+
Body string `json:"body,omitempty"`
247+
HttpHeaders []HttpHeaders `json:"headers,omitempty"`
248+
} `json:"test"`
249+
}
250+
251+
type HttpCheckV2Input struct {
252+
Test struct {
253+
Name string `json:"name"`
254+
Type string `json:"type"`
255+
URL string `json:"url"`
256+
LocationIds []string `json:"location_ids"`
257+
Frequency int `json:"frequency"`
258+
SchedulingStrategy string `json:"scheduling_strategy"`
259+
Active bool `json:"active"`
260+
RequestMethod string `json:"request_method"`
261+
Body string `json:"body,omitempty"`
262+
HttpHeaders []HttpHeaders `json:"headers,omitempty"`
263+
} `json:"test"`
264+
}
265+
266+
type ApiCheckV2Input struct {
267+
Test struct {
268+
Active bool `json:"active"`
269+
Deviceid int `json:"device_id"`
270+
Frequency int `json:"frequency"`
271+
Locationids []string `json:"location_ids"`
272+
Name string `json:"name"`
273+
Requests []Requests `json:"requests"`
274+
Schedulingstrategy string `json:"scheduling_strategy"`
275+
} `json:"test"`
276+
}
277+
278+
type ApiCheckV2Response struct {
279+
Test struct {
280+
Active bool `json:"active,omitempty"`
281+
Createdat time.Time `json:"created_at"`
282+
Device `json:"device,omitempty"`
283+
Frequency int `json:"frequency,omitempty"`
284+
ID int `json:"id,omitempty"`
285+
Locationids []string `json:"location_ids,omitempty"`
286+
Name string `json:"name,omitempty"`
287+
Requests []Requests `json:"requests,omitempty"`
288+
Schedulingstrategy string `json:"scheduling_strategy,omitempty"`
289+
Type string `json:"type,omitempty"`
290+
Updatedat time.Time `json:"updated_at,omitempty"`
291+
}
292+
}
293+
294+
type BrowserCheckV2Input struct {
295+
Test struct {
296+
Name string `json:"name"`
297+
BusinessTransactions []BusinessTransactions `json:"business_transactions"`
298+
Urlprotocol string `json:"urlProtocol"`
299+
Starturl string `json:"startUrl"`
300+
LocationIds []string `json:"location_ids"`
301+
DeviceID int `json:"device_id"`
302+
Frequency int `json:"frequency"`
303+
Schedulingstrategy string `json:"scheduling_strategy"`
304+
Active bool `json:"active"`
305+
Advancedsettings `json:"advanced_settings"`
306+
} `json:"test"`
307+
}
308+
309+
type BrowserCheckV2Response struct {
310+
Test struct {
311+
Active bool `json:"active"`
312+
Advancedsettings `json:"advanced_settings"`
313+
BusinessTransactions []BusinessTransactions `json:"business_transactions"`
314+
Createdat time.Time `json:"created_at"`
315+
Device `json:"device"`
316+
Frequency int `json:"frequency"`
317+
ID int `json:"id"`
318+
Locationids []string `json:"location_ids"`
319+
Name string `json:"name"`
320+
Schedulingstrategy string `json:"scheduling_strategy"`
321+
Transactions []Transactions `json:"transactions"`
322+
Type string `json:"type"`
323+
Updatedat time.Time `json:"updated_at"`
324+
} `json:"test"`
325+
}

0 commit comments

Comments
 (0)