From 872d909cfa9b89baa7c42817cf05f6595c22baa4 Mon Sep 17 00:00:00 2001 From: Boramey Chhay Date: Mon, 5 Aug 2024 13:35:51 -0600 Subject: [PATCH] SYN-4078: add createdBy and updatedBy to /tests responses --- syntheticsclientv2/common_models.go | 10 ++++++++++ syntheticsclientv2/get_apicheckv2_test.go | 2 +- syntheticsclientv2/get_browsercheckv2_test.go | 2 +- syntheticsclientv2/get_checksv2_test.go | 2 +- syntheticsclientv2/get_httpcheckv2_test.go | 2 +- syntheticsclientv2/get_portcheckv2_test.go | 2 +- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/syntheticsclientv2/common_models.go b/syntheticsclientv2/common_models.go index b31af28..9490c58 100644 --- a/syntheticsclientv2/common_models.go +++ b/syntheticsclientv2/common_models.go @@ -155,6 +155,8 @@ type Tests []struct { Lastrunstatus string `json:"lastRunStatus"` Lastrunat time.Time `json:"lastRunAt"` Automaticretries int `json:"automaticRetries"` + Createdby string `json:"createdBy"` + Updatedby string `json:"updatedBy"` } type GetChecksV2Options struct { @@ -305,6 +307,8 @@ type PortCheckV2Response struct { Lastrunstatus string `json:"lastRunStatus"` Lastrunat time.Time `json:"lastRunAt"` Automaticretries int `json:"automaticRetries"` + Createdby string `json:"createdBy"` + Updatedby string `json:"updatedBy"` } `json:"test"` } @@ -349,6 +353,8 @@ type HttpCheckV2Response struct { Lastrunat time.Time `json:"lastRunAt"` Automaticretries int `json:"automaticRetries"` Port int `json:"port"` + Createdby string `json:"createdBy"` + Updatedby string `json:"updatedBy"` } `json:"test"` } @@ -405,6 +411,8 @@ type ApiCheckV2Response struct { Lastrunstatus string `json:"lastRunStatus"` Lastrunat time.Time `json:"lastRunAt"` Automaticretries int `json:"automaticRetries"` + Createdby string `json:"createdBy"` + Updatedby string `json:"updatedBy"` } } @@ -443,6 +451,8 @@ type BrowserCheckV2Response struct { Lastrunstatus string `json:"lastRunStatus"` Lastrunat time.Time `json:"lastRunAt"` Automaticretries int `json:"automaticRetries"` + Createdby string `json:"createdBy"` + Updatedby string `json:"updatedBy"` } `json:"test"` } diff --git a/syntheticsclientv2/get_apicheckv2_test.go b/syntheticsclientv2/get_apicheckv2_test.go index 0312777..600915e 100644 --- a/syntheticsclientv2/get_apicheckv2_test.go +++ b/syntheticsclientv2/get_apicheckv2_test.go @@ -25,7 +25,7 @@ import ( ) var ( - getApiCheckV2Body = `{"test":{"id":489,"name":"Appinspect login API","active":true, "automaticRetries": 1, "customProperties": [{"key": "Test_Key", "value": "Test Custom Properties"}], "frequency":5,"scheduling_strategy":"round_robin","created_at":"2022-08-16T15:47:43.730Z","updated_at":"2022-08-16T15:47:43.741Z","lastRunAt":"2024-03-07T00:47:43.741Z","lastRunStatus":"success","location_ids":["aws-us-east-1"],"type":"api","device":{"id":1,"label":"Desktop","user_agent":"Mozilla/5.0 (X11; Linux x86_64; Splunk Synthetics) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36","viewport_width":1366,"viewport_height":768,"network_connection":{"description":"Standard Cable","upload_bandwidth":5000,"download_bandwidth":20000,"latency":28,"packet_loss":null}},"requests":[{"configuration":{"name":"Login","url":"https://api.splunk.com/2.0/rest/login/splunk","requestMethod":"GET","headers":{},"body":null},"setup":[],"validations":[]}]}}` + getApiCheckV2Body = `{"test":{"id":489,"name":"Appinspect login API","active":true, "automaticRetries": 1, "customProperties": [{"key": "Test_Key", "value": "Test Custom Properties"}], "frequency":5,"scheduling_strategy":"round_robin","created_at":"2022-08-16T15:47:43.730Z","updated_at":"2022-08-16T15:47:43.741Z","lastRunAt":"2024-03-07T00:47:43.741Z","lastRunStatus":"success","createdBy":"abc1234","updatedBy":"abc1234","location_ids":["aws-us-east-1"],"type":"api","device":{"id":1,"label":"Desktop","user_agent":"Mozilla/5.0 (X11; Linux x86_64; Splunk Synthetics) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36","viewport_width":1366,"viewport_height":768,"network_connection":{"description":"Standard Cable","upload_bandwidth":5000,"download_bandwidth":20000,"latency":28,"packet_loss":null}},"requests":[{"configuration":{"name":"Login","url":"https://api.splunk.com/2.0/rest/login/splunk","requestMethod":"GET","headers":{},"body":null},"setup":[],"validations":[]}]}}` inputGetApiCheckV2 = verifyApiCheckV2Input(string(getApiCheckV2Body)) ) diff --git a/syntheticsclientv2/get_browsercheckv2_test.go b/syntheticsclientv2/get_browsercheckv2_test.go index 8d7dfe2..1f541c3 100644 --- a/syntheticsclientv2/get_browsercheckv2_test.go +++ b/syntheticsclientv2/get_browsercheckv2_test.go @@ -25,7 +25,7 @@ import ( ) var ( - getBrowserCheckV2Body = `{"test":{"automaticRetries": 1, "customProperties": [{"key": "Test_Key", "value": "Test Custom Properties"}], "active":true,"advancedSettings":{"authentication":{"password":"password123","username":"myuser"},"cookies":[{"key":"qux","value":"qux","domain":"splunk.com","path":"/qux"}],"headers":[{"name":"Accept","value":"application/json","domain":"splunk.com"}],"verifyCertificates":true},"createdAt":"2022-09-14T14:35:37.801Z","device":{"id":1,"label":"iPhone","networkConnection":{"description":"Mobile LTE","downloadBandwidth":12000,"latency":70,"packetLoss":0,"uploadBandwidth":12000},"viewportHeight":844,"viewportWidth":375},"frequency":5,"id":1,"locationIds":["na-us-virginia"],"name":"My Test","schedulingStrategy":"round_robin","transactions":[{"name":"Example transaction","steps":[{"name":"element step","selector":".main","selectorType":"css","type":"click_element","waitForNav":true,"waitForNavTimeout":2000}]}],"type":"browser","updatedAt":"2022-09-14T14:35:38.099Z","lastRunAt":"2024-03-07T00:47:43.741Z","lastRunStatus":"success"}}` + getBrowserCheckV2Body = `{"test":{"automaticRetries": 1, "customProperties": [{"key": "Test_Key", "value": "Test Custom Properties"}], "active":true,"advancedSettings":{"authentication":{"password":"password123","username":"myuser"},"cookies":[{"key":"qux","value":"qux","domain":"splunk.com","path":"/qux"}],"headers":[{"name":"Accept","value":"application/json","domain":"splunk.com"}],"verifyCertificates":true},"createdAt":"2022-09-14T14:35:37.801Z","device":{"id":1,"label":"iPhone","networkConnection":{"description":"Mobile LTE","downloadBandwidth":12000,"latency":70,"packetLoss":0,"uploadBandwidth":12000},"viewportHeight":844,"viewportWidth":375},"frequency":5,"id":1,"locationIds":["na-us-virginia"],"name":"My Test","schedulingStrategy":"round_robin","transactions":[{"name":"Example transaction","steps":[{"name":"element step","selector":".main","selectorType":"css","type":"click_element","waitForNav":true,"waitForNavTimeout":2000}]}],"type":"browser","updatedAt":"2022-09-14T14:35:38.099Z","lastRunAt":"2024-03-07T00:47:43.741Z","lastRunStatus":"success","createdBy":"abc1234","updatedBy":"abc1234"}}` inputGetBrowserCheckV2 = verifyBrowserCheckV2Input(string(getBrowserCheckV2Body)) ) diff --git a/syntheticsclientv2/get_checksv2_test.go b/syntheticsclientv2/get_checksv2_test.go index 486ea91..de819d9 100644 --- a/syntheticsclientv2/get_checksv2_test.go +++ b/syntheticsclientv2/get_checksv2_test.go @@ -27,7 +27,7 @@ import ( var ( getChecksV2Body = `{"testType":"","page":1,"perPage":50,"search":"","orderBy":"id"}` inputGetChecksV2 = verifyChecksV2Input(string(getChecksV2Body)) - getChecksV2Output = `{"tests":[{"id":482,"name":"Test of Splunk.com","active":true, "automaticRetries": 1, "frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-08-15T16:05:25.815Z","updatedAt":"2022-09-29T19:13:13.853Z","locationIds":["aws-us-east-1"],"type":"browser","customProperties":null,"lastRunStatus":"pending","lastRunAt":null},{"id":489,"name":"Appinspect login API","active":true,"frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-08-16T15:47:43.730Z","updatedAt":"2022-08-16T15:47:43.741Z","locationIds":["aws-us-east-1"],"type":"api","customProperties":null,"lastRunStatus":"success","lastRunAt":"2024-04-11T20:12:54.000Z"},{"id":490,"name":"Arch Linux Packages","active":true,"frequency":10,"schedulingStrategy":"round_robin","createdAt":"2022-08-16T16:48:42.119Z","updatedAt":"2022-08-16T16:48:42.131Z","locationIds":["aws-us-east-1"],"type":"http","customProperties":null,"lastRunStatus":"pending","lastRunAt":null},{"id":492,"name":"Test of Splunkbase","active":true,"frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-08-16T19:35:54.014Z","updatedAt":"2022-09-29T19:13:13.907Z","locationIds":["aws-us-east-1"],"type":"browser","customProperties":null,"lastRunStatus":"success","lastRunAt":"2024-04-11T20:09:54.000Z"},{"id":493,"name":"Brewery API","active":true,"frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-08-16T19:44:15.626Z","updatedAt":"2022-08-16T19:44:15.635Z","locationIds":["aws-us-east-1"],"type":"api","customProperties":null,"lastRunStatus":"pending","lastRunAt":null},{"id":495,"name":"Multi-step test of legacy Splunkbase","active":true,"frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-08-17T01:24:44.579Z","updatedAt":"2022-09-29T19:13:13.203Z","locationIds":["aws-us-east-1"],"type":"browser","customProperties":null,"lastRunStatus":"pending","lastRunAt":null},{"id":496,"name":"Multi-step Test of new Splunkbase","active":true,"frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-08-17T01:33:27.771Z","updatedAt":"2022-09-29T19:13:13.997Z","locationIds":["aws-us-east-1"],"type":"browser","customProperties":null,"lastRunStatus":"pending","lastRunAt":null},{"id":935,"name":"This test does test stuff","active":true,"frequency":30,"schedulingStrategy":"round_robin","createdAt":"2022-10-26T14:48:36.026Z","updatedAt":"2022-10-26T14:48:36.037Z","locationIds":["aws-us-east-1"],"type":"api","customProperties":null,"lastRunStatus":"pending","lastRunAt":null},{"id":1116,"name":"boop-test","active":true,"frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-11-16T19:18:59.603Z","updatedAt":"2022-11-16T19:20:58.911Z","locationIds":["aws-us-east-1","aws-ap-northeast-1"],"type":"api","customProperties":null,"lastRunStatus":"success","lastRunAt":"2024-04-11T20:12:32.000Z"},{"id":1128,"name":"boopbeep","active":true,"frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-11-17T14:19:49.564Z","updatedAt":"2022-11-17T14:19:49.571Z","locationIds":["aws-us-east-1"],"type":"browser","customProperties":null,"lastRunStatus":"pending","lastRunAt":null}],"page":1,"per_page":50,"next_page_link":null,"total_count":10}` + getChecksV2Output = `{"tests":[{"id":482,"name":"Test of Splunk.com","active":true, "automaticRetries": 1, "frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-08-15T16:05:25.815Z","updatedAt":"2022-09-29T19:13:13.853Z","locationIds":["aws-us-east-1"],"type":"browser","customProperties":null,"lastRunStatus":"pending","lastRunAt":null,"createdBy":"abc1234","updatedBy":"abc1234"},{"id":489,"name":"Appinspect login API","active":true,"frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-08-16T15:47:43.730Z","updatedAt":"2022-08-16T15:47:43.741Z","locationIds":["aws-us-east-1"],"type":"api","customProperties":null,"lastRunStatus":"success","lastRunAt":"2024-04-11T20:12:54.000Z","createdBy":"abc1234","updatedBy":"abc1234"},{"id":490,"name":"Arch Linux Packages","active":true,"frequency":10,"schedulingStrategy":"round_robin","createdAt":"2022-08-16T16:48:42.119Z","updatedAt":"2022-08-16T16:48:42.131Z","locationIds":["aws-us-east-1"],"type":"http","customProperties":null,"lastRunStatus":"pending","lastRunAt":null,"createdBy":"abc1234","updatedBy":"abc1234"},{"id":492,"name":"Test of Splunkbase","active":true,"frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-08-16T19:35:54.014Z","updatedAt":"2022-09-29T19:13:13.907Z","locationIds":["aws-us-east-1"],"type":"browser","customProperties":null,"lastRunStatus":"success","lastRunAt":"2024-04-11T20:09:54.000Z","createdBy":"abc1234","updatedBy":"abc1234"},{"id":493,"name":"Brewery API","active":true,"frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-08-16T19:44:15.626Z","updatedAt":"2022-08-16T19:44:15.635Z","locationIds":["aws-us-east-1"],"type":"api","customProperties":null,"lastRunStatus":"pending","lastRunAt":null,"createdBy":"abc1234","updatedBy":"abc1234"},{"id":495,"name":"Multi-step test of legacy Splunkbase","active":true,"frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-08-17T01:24:44.579Z","updatedAt":"2022-09-29T19:13:13.203Z","locationIds":["aws-us-east-1"],"type":"browser","customProperties":null,"lastRunStatus":"pending","lastRunAt":null,"createdBy":"abc1234","updatedBy":"abc1234"},{"id":496,"name":"Multi-step Test of new Splunkbase","active":true,"frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-08-17T01:33:27.771Z","updatedAt":"2022-09-29T19:13:13.997Z","locationIds":["aws-us-east-1"],"type":"browser","customProperties":null,"lastRunStatus":"pending","lastRunAt":null,"createdBy":"abc1234","updatedBy":"abc1234"},{"id":935,"name":"This test does test stuff","active":true,"frequency":30,"schedulingStrategy":"round_robin","createdAt":"2022-10-26T14:48:36.026Z","updatedAt":"2022-10-26T14:48:36.037Z","locationIds":["aws-us-east-1"],"type":"api","customProperties":null,"lastRunStatus":"pending","lastRunAt":null,"createdBy":"abc1234","updatedBy":"abc1234"},{"id":1116,"name":"boop-test","active":true,"frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-11-16T19:18:59.603Z","updatedAt":"2022-11-16T19:20:58.911Z","locationIds":["aws-us-east-1","aws-ap-northeast-1"],"type":"api","customProperties":null,"lastRunStatus":"success","lastRunAt":"2024-04-11T20:12:32.000Z","createdBy":"abc1234","updatedBy":"abc1234"},{"id":1128,"name":"boopbeep","active":true,"frequency":5,"schedulingStrategy":"round_robin","createdAt":"2022-11-17T14:19:49.564Z","updatedAt":"2022-11-17T14:19:49.571Z","locationIds":["aws-us-east-1"],"type":"browser","customProperties":null,"lastRunStatus":"pending","lastRunAt":null,"createdBy":"abc1234","updatedBy":"abc1234"}],"page":1,"per_page":50,"next_page_link":null,"total_count":10}` output = &ChecksV2Response{} ) diff --git a/syntheticsclientv2/get_httpcheckv2_test.go b/syntheticsclientv2/get_httpcheckv2_test.go index 1127745..fd1abfa 100644 --- a/syntheticsclientv2/get_httpcheckv2_test.go +++ b/syntheticsclientv2/get_httpcheckv2_test.go @@ -25,7 +25,7 @@ import ( ) var ( - getHttpCheckV2Body = `{"test":{"automaticRetries": 1, "customProperties": [{"key": "Test_Key", "value": "Test Custom Properties"}], "active":true,"createdAt":"2022-09-14T14:35:37.801Z","frequency":5,"id":1,"locationIds":["na-us-virginia"],"name":"My Test","schedulingStrategy":"round_robin","type":"http","updatedAt":"2022-09-14T14:35:38.099Z","lastRunAt":"2024-03-07T00:47:43.741Z","lastRunStatus":"success","url":"https://splunk.com","requestMethod":"GET","body":null,"headers":[{"name":"Accept","value":"application/json","domain":"splunk.com"}],"userAgent":null,"validations":[],"verifyCertificates":false,"authentication":null,"port":null}}` + getHttpCheckV2Body = `{"test":{"automaticRetries": 1, "customProperties": [{"key": "Test_Key", "value": "Test Custom Properties"}], "active":true,"createdAt":"2022-09-14T14:35:37.801Z","frequency":5,"id":1,"locationIds":["na-us-virginia"],"name":"My Test","schedulingStrategy":"round_robin","type":"http","updatedAt":"2022-09-14T14:35:38.099Z","lastRunAt":"2024-03-07T00:47:43.741Z","lastRunStatus":"success","createdBy":"abc1234","updatedBy":"abc1234","url":"https://splunk.com","requestMethod":"GET","body":null,"headers":[{"name":"Accept","value":"application/json","domain":"splunk.com"}],"userAgent":null,"validations":[],"verifyCertificates":false,"authentication":null,"port":null}}` inputGetHttpCheckV2 = verifyHttpCheckV2Input(string(getHttpCheckV2Body)) ) diff --git a/syntheticsclientv2/get_portcheckv2_test.go b/syntheticsclientv2/get_portcheckv2_test.go index 3365755..1811ffd 100644 --- a/syntheticsclientv2/get_portcheckv2_test.go +++ b/syntheticsclientv2/get_portcheckv2_test.go @@ -25,7 +25,7 @@ import ( ) var ( - getPortCheckV2Body = `{"test":{"id":1647, "automaticRetries": 1, "customProperties": [{"key": "Test_Key", "value": "Test Custom Properties"}], "name":"splunk - port 443","active":true,"frequency":10,"scheduling_strategy":"round_robin","created_at":"2022-11-21T15:38:54.546Z","updated_at":"2022-11-21T15:38:54.554Z","lastRunAt":"2024-03-07T00:47:43.741Z","lastRunStatus":"success","location_ids":["aws-us-east-1"],"type":"port","protocol":"tcp","host":"www.splunk.com","port":443}}` + getPortCheckV2Body = `{"test":{"id":1647, "automaticRetries": 1, "customProperties": [{"key": "Test_Key", "value": "Test Custom Properties"}], "name":"splunk - port 443","active":true,"frequency":10,"scheduling_strategy":"round_robin","created_at":"2022-11-21T15:38:54.546Z","updated_at":"2022-11-21T15:38:54.554Z","lastRunAt":"2024-03-07T00:47:43.741Z","lastRunStatus":"success","createdBy":"abc1234","updatedBy":"abc1234","location_ids":["aws-us-east-1"],"type":"port","protocol":"tcp","host":"www.splunk.com","port":443}}` inputGetPortCheckV2 = verifyPortCheckV2Input(string(getPortCheckV2Body)) )