Skip to content

Commit 95dcce0

Browse files
Merge pull request #8 from greatestusername/additional-fields-useragent
Updates to fields, breaking pointer change for useragent
2 parents 3a9117c + 5904da3 commit 95dcce0

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

syntheticsclientv2/common_models.go

+17-8
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ type Networkconnection struct {
2828
}
2929

3030
type Advancedsettings struct {
31-
Authentication *Authentication `json:"authentication"`
32-
Cookiesv2 []Cookiesv2 `json:"cookies"`
33-
BrowserHeaders []BrowserHeaders `json:"headers,omitempty"`
34-
HostOverrides []HostOverrides `json:"hostOverrides,omitempty"`
35-
UserAgent string `json:"userAgent,omitempty"`
36-
Verifycertificates bool `json:"verifyCertificates"`
31+
Authentication *Authentication `json:"authentication"`
32+
Cookiesv2 []Cookiesv2 `json:"cookies"`
33+
BrowserHeaders []BrowserHeaders `json:"headers,omitempty"`
34+
HostOverrides []HostOverrides `json:"hostOverrides,omitempty"`
35+
UserAgent *string `json:"userAgent"`
36+
CollectInteractiveMetrics bool `json:"collectInteractiveMetrics"`
37+
Verifycertificates bool `json:"verifyCertificates"`
3738
}
3839

3940
type Authentication struct {
@@ -83,6 +84,7 @@ type StepsV2 struct {
8384
VariableName string `json:"variableName,omitempty"`
8485
Value string `json:"value,omitempty"`
8586
Options Options `json:"options,omitempty"`
87+
Duration int `json:"duration,omitempty"`
8688
}
8789

8890
type Options struct {
@@ -120,14 +122,21 @@ type Setup struct {
120122
Source string `json:"source,omitempty"`
121123
Type string `json:"type,omitempty"`
122124
Variable string `json:"variable,omitempty"`
125+
Code string `json:"code,omitempty"`
126+
Value string `json:"value,omitempty"`
123127
}
124128

125129
type Validations struct {
126130
Actual string `json:"actual,omitempty"`
127131
Comparator string `json:"comparator,omitempty"`
128132
Expected string `json:"expected,omitempty"`
133+
Extractor string `json:"extractor,omitempty"`
129134
Name string `json:"name,omitempty"`
135+
Source string `json:"source,omitempty"`
130136
Type string `json:"type,omitempty"`
137+
Variable string `json:"variable,omitempty"`
138+
Code string `json:"code,omitempty"`
139+
Value string `json:"value,omitempty"`
131140
}
132141

133142
type Tests []struct {
@@ -273,7 +282,7 @@ type HttpCheckV2Response struct {
273282
RequestMethod string `json:"requestMethod"`
274283
Body string `json:"body,omitempty"`
275284
Authentication *Authentication `json:"authentication"`
276-
UserAgent string `json:"userAgent,omitempty"`
285+
UserAgent *string `json:"userAgent"`
277286
Verifycertificates bool `json:"verifyCertificates"`
278287
HttpHeaders []HttpHeaders `json:"headers,omitempty"`
279288
} `json:"test"`
@@ -291,7 +300,7 @@ type HttpCheckV2Input struct {
291300
RequestMethod string `json:"requestMethod"`
292301
Body string `json:"body,omitempty"`
293302
Authentication *Authentication `json:"authentication"`
294-
UserAgent string `json:"userAgent,omitempty"`
303+
UserAgent *string `json:"userAgent"`
295304
Verifycertificates bool `json:"verifyCertificates"`
296305
HttpHeaders []HttpHeaders `json:"headers,omitempty"`
297306
} `json:"test"`

syntheticsclientv2/integration_test.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var (
4040
inputHttpCheckV2Data = HttpCheckV2Input{}
4141
updateHttpCheckV2Body = `{"test":{"name":"a-maximal-http-integration-test-update","type":"http","url":"https://www.splunk.com/updated","locationIds":["aws-us-east-1","aws-ap-southeast-2","aws-ap-southeast-4"],"frequency":30,"schedulingStrategy":"round_robin","active":true,"requestMethod":"GET","body":null,"headers":[{"name":"header-1","value":"value-1"},{"name":"header_2","value":"value_2"}],"validations":[{"type":"assert_string","actual":"{{response.first_byte_time}}","expected":"100","comparator":"equals"},{"type":"assert_string","actual":"{{headers.Content-Length}}","expected":"100","comparator":"does_not_equal"}],"userAgent":"user-agent_standards met","authentication":{"username":"beepusers","password":"{{env.terraform-test-foo-301}}"},"verifyCertificates":true}}`
4242
updateHttpCheckV2Data = HttpCheckV2Input{}
43-
createMaximalBrowserCheckV2Body = `{"test":{"name":"a-maximal-browser-beep-test","transactions":[{"name":"Synthetic transaction 1","steps":[{"name":"Go to URL","type":"go_to_url","url":"https://splunk.com","action":"go_to_url","options":{"url":"https://splunk.com"},"waitForNav":true},{"name":"click","type":"click_element","selectorType":"id","selector":"clicky","waitForNav":true},{"name":"fill in fieldz","type":"enter_value","selectorType":"id","selector":"beep","value":"{{env.beep-var}}","waitForNav":false},{"name":"accept---Alert","type":"accept_alert"},{"name":"Select-Val-Index","type":"select_option","selectorType":"id","selector":"selectionz","optionSelectorType":"index","optionSelector":"{{env.beep-var}}","waitForNav":false},{"name":"Select-val-text","type":"select_option","selectorType":"id","selector":"textzz","optionSelectorType":"text","optionSelector":"sdad","waitForNav":false},{"name":"Select-Val-Val","type":"select_option","selectorType":"id","selector":"valz","optionSelectorType":"value","optionSelector":"{{env.beep-var}}","waitForNav":false},{"name":"Run JS","type":"run_javascript","value":"beeeeeeep","waitForNav":true},{"name":"Save as text","type":"store_variable_from_element","selectorType":"link","selector":"beepval","variableName":"{{env.terraform-test-foo-301}}"},{"name":"Save JS return Val","type":"store_variable_from_javascript","value":"sdasds","variableName":"{{env.terraform-test-foo-301}}","waitForNav":true}]}],"urlProtocol":"https://","startUrl":"www.splunk.com","locationIds":["aws-us-east-1"],"deviceId":1,"frequency":5,"schedulingStrategy":"round_robin","active":true,"advancedSettings":{"verifyCertificates":true,"authentication":{"username":"boopuser","password":"{{env.beep-var}}"},"headers":[{"name":"batman","value":"Agentoz","domain":"www.batmansagent.com"}],"cookies":[{"key":"super","value":"duper","domain":"www.batmansagent.com","path":"/boom/goes/beep"}]}}}`
43+
createMaximalBrowserCheckV2Body = `{"test":{"name":"a-maximal-browser-beep-test","transactions":[{"name":"Synthetic transaction 1","steps":[{"name":"Go to URL","type":"go_to_url","url":"https://splunk.com","action":"go_to_url","options":{"url":"https://splunk.com"},"waitForNav":true},{"name":"click","type":"click_element","selectorType":"id","selector":"clicky","waitForNav":true},{"name":"fill in fieldz","type":"enter_value","selectorType":"id","selector":"beep","value":"{{env.beep-var}}","waitForNav":false},{"name":"accept---Alert","type":"accept_alert"},{"name":"Select-Val-Index","type":"select_option","selectorType":"id","selector":"selectionz","optionSelectorType":"index","optionSelector":"{{env.beep-var}}","waitForNav":false},{"name":"Select-val-text","type":"select_option","selectorType":"id","selector":"textzz","optionSelectorType":"text","optionSelector":"sdad","waitForNav":false},{"name":"Select-Val-Val","type":"select_option","selectorType":"id","selector":"valz","optionSelectorType":"value","optionSelector":"{{env.beep-var}}","waitForNav":false},{"name":"Run JS","type":"run_javascript","value":"beeeeeeep","waitForNav":true},{"name":"Save as text","type":"store_variable_from_element","selectorType":"link","selector":"beepval","variableName":"{{env.terraform-test-foo-301}}"},{"name":"Wait","type":"wait","duration":1312},{"name":"Save JS return Val","type":"store_variable_from_javascript","value":"sdasds","variableName":"{{env.terraform-test-foo-301}}","waitForNav":true}]}],"urlProtocol":"https://","startUrl":"www.splunk.com","locationIds":["aws-us-east-1"],"deviceId":1,"frequency":5,"schedulingStrategy":"round_robin","active":true,"advancedSettings":{"verifyCertificates":true,"authentication":{"username":"boopuser","password":"{{env.beep-var}}"},"headers":[{"name":"batman","value":"Agentoz","domain":"www.batmansagent.com"}],"cookies":[{"key":"super","value":"duper","domain":"www.batmansagent.com","path":"/boom/goes/beep"}]}}}`
4444
createMinimalBrowserCheckV2Body = `{"test":{"name":"a-minimal-browser-beep-test","transactions":[{"name":"Synthetic transaction 1","steps":[{"name":"Go to URL","type":"go_to_url","url":"https://splunk.com","action":"go_to_url"}]}],"locationIds":["aws-us-east-1"],"deviceId":1,"frequency":5,"schedulingStrategy":"round_robin","active":true,"advancedSettings":{"verifyCertificates":true}}}`
4545
inputBrowserCheckV2Data = BrowserCheckV2Input{}
4646
updateBrowserCheckV2Body = `{"test":{"name":"a-browser-beep-test","transactions":[{"name":"Synthetic transaction 1","steps":[{"name":"Go to URL","type":"go_to_url","url":"https://splunk.com","action":"go_to_url","options":{"url":"https://splunk.com"},"waitForNav":true},{"name":"click","type":"click_element","selectorType":"id","selector":"clicky","waitForNav":true},{"name":"fill in fieldz","type":"enter_value","selectorType":"id","selector":"beep","value":"{{env.beep-var}}","waitForNav":false},{"name":"accept---Alert","type":"accept_alert"},{"name":"Select-Val-Index","type":"select_option","selectorType":"id","selector":"selectionz","optionSelectorType":"index","optionSelector":"{{env.beep-var}}","waitForNav":false},{"name":"Select-val-text","type":"select_option","selectorType":"id","selector":"textzz","optionSelectorType":"text","optionSelector":"sdad","waitForNav":false},{"name":"Select-Val-Val","type":"select_option","selectorType":"id","selector":"valz","optionSelectorType":"value","optionSelector":"{{env.beep-var}}","waitForNav":false},{"name":"Run JS","type":"run_javascript","value":"beeeeeeep","waitForNav":true},{"name":"Save as text","type":"store_variable_from_element","selectorType":"link","selector":"beepval","variableName":"{{env.terraform-test-foo-301}}"},{"name":"Save JS return Val","type":"store_variable_from_javascript","value":"sdasds","variableName":"{{env.terraform-test-foo-301}}","waitForNav":true}]}],"urlProtocol":"https://","startUrl":"www.splunk.com","locationIds":["aws-us-east-1"],"deviceId":1,"frequency":15,"schedulingStrategy":"round_robin","active":true,"advancedSettings":{"verifyCertificates":true,"authentication":{"username":"boopuser","password":"{{env.beep-var}}"},"headers":[{"name":"batman","value":"Agentoz","domain":"www.batmansagent.com"}],"cookies":[{"key":"super","value":"dooper","domain":"www.batmansagent.com","path":"/boom/goes/beep"}]}}}`
@@ -49,7 +49,7 @@ var (
4949
inputPortCheckV2Data = PortCheckV2Input{}
5050
updatePortCheckV2Body = `{"test":{"name":"a2 - port 443 check","type":"port","url":"","port":448,"protocol":"tcp","host":"www.splunk.com","locationIds":["aws-us-east-1"],"frequency":10,"schedulingStrategy":"round_robin","active":true}}`
5151
updatePortCheckV2Data = PortCheckV2Input{}
52-
createApiV2Body = `{"test":{"active":true,"deviceId":1,"frequency":5,"locationIds":["aws-us-east-1"],"name":"a-maximual-API-boop-test","schedulingStrategy":"round_robin","requests":[{"configuration":{"name":"Get-Test","requestMethod": "GET","url":"https://api.us1.signalfx.com/v2/synthetics/tests/api/489","headers":{"X-SF-TOKEN":"jinglebellsbatmanshells", "beep":"boop"},"body":null},"setup":[{"name":"Extract from response body","type":"extract_json","source":"{{response.body}}","extractor":"$.requests","variable":"custom-varz"}],"validations":[{"name":"Assert response code equals 200","type":"assert_numeric","actual":"{{response.code}}","expected":"200","comparator":"equals"}]}]}}`
52+
createApiV2Body = `{"test":{"active":true,"deviceId":1,"frequency":5,"locationIds":["aws-us-east-1"],"name":"a-maximual-API-boop-test","schedulingStrategy":"round_robin","requests":[{"configuration":{"name":"Get-Test","requestMethod":"GET","url":"https://api.us1.signalfx.com/v2/synthetics/tests/api/489","headers":{"X-SF-TOKEN":"jinglebellsbatmanshells","beep":"boop"},"body":null},"setup":[{"name":"Extract from response body","type":"extract_json","source":"{{response.body}}","extractor":"sd","variable":"extractsetupvar"},{"name":"JavaScript run","type":"javascript","code":"asdasd","variable":"jsvarsetup"},{"name":"Save response body","type":"save","value":"{{response.body}}","variable":"savesetupvar"}],"validations":[{"name":"JavaScript run","type":"javascript","code":"codetorun","variable":"jscodevar"},{"name":"Save response body","type":"save","value":"{{response.body}}","variable":"saverespvar"},{"name":"Assert response code equals 200","type":"assert_numeric","actual":"{{response.code}}","expected":"200","comparator":"equals"},{"name":"Extract from response body","type":"extract_json","source":"{{response.body}}","extractor":"js.extractor","variable":"extractjvar"}]}]}}`
5353
createMinimalApiV2Body = `{"test":{"active":true,"deviceId":1,"frequency":5,"locationIds":["aws-us-east-1"],"name":"a-minimal-API-boop-test","schedulingStrategy":"round_robin","requests":[{"configuration":{"name":"apishortGet-Test","requestMethod":"GET","url":"https://api.us1.signalfx.com/v2/synthetics/tests/api/489"}}]}}`
5454
inputApiCheckV2Data = ApiCheckV2Input{}
5555
updateApiCheckV2Body = `{"test":{"active":true,"deviceId":1,"frequency":5,"locationIds":["aws-us-east-1"],"name":"a-API-boop-test","schedulingStrategy":"round_robin","requests":[{"configuration":{"name":"Get-Test","requestMethod": "GET","url":"https://api.us1.signalfx.com/v2/synthetics/tests/api/4892","headers":{"X-SF-TOKEN":"jinglebellsbatmanshells", "beep":"boop"},"body":null},"setup":[{"name":"Extract from response body","type":"extract_json","source":"{{response.body}}","extractor":"$.requests","variable":"custom-varz"}],"validations":[{"name":"Assert response code equals 200","type":"assert_numeric","actual":"{{response.code}}","expected":"200","comparator":"equals"}]}]}}`
@@ -411,7 +411,7 @@ func UpdateBrowserCheckV2(checkId int, test string, c *Client) error {
411411
}
412412
fmt.Println(reqDetail)
413413
JsonPrint(res)
414-
414+
415415
return nil
416416
}
417417

@@ -420,7 +420,7 @@ func GetBrowserCheckV2(checkId int, c *Client) error {
420420
res, _, err := c.GetBrowserCheckV2(checkId)
421421
if err != nil {
422422
return err
423-
}
423+
}
424424
JsonPrint(res)
425425

426426
return nil
@@ -433,7 +433,7 @@ func DeleteBrowserCheckV2(checkId int, c *Client) error {
433433
return err
434434
}
435435
JsonPrint(res)
436-
436+
437437
return nil
438438
}
439439

@@ -517,7 +517,7 @@ func UpdateApiCheckV2(checkId int, test string, c *Client) error {
517517
}
518518
fmt.Println(reqDetail)
519519
JsonPrint(res)
520-
520+
521521
return nil
522522
}
523523

@@ -526,7 +526,7 @@ func GetApiCheckV2(checkId int, c *Client) error {
526526
res, _, err := c.GetApiCheckV2(checkId)
527527
if err != nil {
528528
return err
529-
}
529+
}
530530
JsonPrint(res)
531531

532532
return nil
@@ -539,7 +539,7 @@ func DeleteApiCheckV2(checkId int, c *Client) error {
539539
return err
540540
}
541541
JsonPrint(res)
542-
542+
543543
return nil
544544
}
545545

@@ -661,7 +661,7 @@ func UpdatePortCheckV2(checkId int, test string, c *Client) error {
661661
}
662662
fmt.Println(reqDetail)
663663
JsonPrint(res)
664-
664+
665665
return nil
666666
}
667667

@@ -670,7 +670,7 @@ func GetPortCheckV2(checkId int, c *Client) error {
670670
res, _, err := c.GetPortCheckV2(checkId)
671671
if err != nil {
672672
return err
673-
}
673+
}
674674
JsonPrint(res)
675675

676676
return nil
@@ -683,7 +683,7 @@ func DeletePortCheckV2(checkId int, c *Client) error {
683683
return err
684684
}
685685
JsonPrint(res)
686-
686+
687687
return nil
688688
}
689689

0 commit comments

Comments
 (0)