diff --git a/.apigentools-info b/.apigentools-info index ab1a08a24d0..4c80df08f45 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.5.1.dev2", - "regenerated": "2021-11-15 10:48:22.030021", - "spec_repo_commit": "ec0039a" + "regenerated": "2021-11-16 09:32:30.706371", + "spec_repo_commit": "3b593f9" }, "v2": { "apigentools_version": "1.5.1.dev2", - "regenerated": "2021-11-15 10:48:22.060268", - "spec_repo_commit": "ec0039a" + "regenerated": "2021-11-16 09:32:30.733243", + "spec_repo_commit": "3b593f9" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index ec9cbf4f05c..219ed80cebe 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -10766,7 +10766,7 @@ components: SyntheticsTestDetailsSubType: description: 'The subtype of the Synthetic API test, `http`, `ssl`, `tcp`, - `dns`, `icmp`, `udp` or `multi`.' + `dns`, `icmp`, `udp`, `websocket` or `multi`.' enum: - http - ssl @@ -10775,6 +10775,7 @@ components: - multi - icmp - udp + - websocket example: http type: string x-enum-varnames: @@ -10785,6 +10786,7 @@ components: - MULTI - ICMP - UDP + - WEBSOCKET SyntheticsTestDetailsType: description: Type of the Synthetic test, either `api` or `browser`. enum: @@ -10977,7 +10979,7 @@ components: description: Host name to perform the test with. type: string message: - description: Message to send for UDP tests. + description: Message to send for UDP or WebSocket tests. type: string method: $ref: '#/components/schemas/HTTPMethod' diff --git a/cassettes/v1/Synthetics_2658572017/Create-an-API-test-with-WEBSOCKET-subtype-returns-OK-Returns-the-created-test-details-res_4280757160/frozen.json b/cassettes/v1/Synthetics_2658572017/Create-an-API-test-with-WEBSOCKET-subtype-returns-OK-Returns-the-created-test-details-res_4280757160/frozen.json new file mode 100644 index 00000000000..51bfc845ac1 --- /dev/null +++ b/cassettes/v1/Synthetics_2658572017/Create-an-API-test-with-WEBSOCKET-subtype-returns-OK-Returns-the-created-test-details-res_4280757160/frozen.json @@ -0,0 +1 @@ +"2021-11-15T18:07:45.924Z" diff --git a/cassettes/v1/Synthetics_2658572017/Create-an-API-test-with-WEBSOCKET-subtype-returns-OK-Returns-the-created-test-details-res_4280757160/recording.har b/cassettes/v1/Synthetics_2658572017/Create-an-API-test-with-WEBSOCKET-subtype-returns-OK-Returns-the-created-test-details-res_4280757160/recording.har new file mode 100644 index 00000000000..3193a47f004 --- /dev/null +++ b/cassettes/v1/Synthetics_2658572017/Create-an-API-test-with-WEBSOCKET-subtype-returns-OK-Returns-the-created-test-details-res_4280757160/recording.har @@ -0,0 +1,316 @@ +{ + "log": { + "_recordingName": "Synthetics/Create an API test with WEBSOCKET subtype returns \"OK - Returns the created test details.\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "5.1.0" + }, + "entries": [ + { + "_id": "2a448c37dd4044dd1c0eaacf771bb7e1", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 844, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "user-agent", + "value": "datadog-api-client-typescript/1.0.0-beta.6 (node 14.18.1; os Linux; arch x64)" + }, + { + "_fromType": "array", + "name": "accept", + "value": "application/json, */*;q=0.8" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "x-datadog-parent-id", + "value": "4580709451748564676" + }, + { + "_fromType": "array", + "name": "x-datadog-trace-id", + "value": "7130359786114391756" + }, + { + "_fromType": "array", + "name": "content-length", + "value": "844" + }, + { + "_fromType": "array", + "name": "connection", + "value": "close" + }, + { + "name": "host", + "value": "api.datadoghq.com" + } + ], + "headersSize": 487, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"config\":{\"assertions\":[{\"operator\":\"is\",\"target\":\"message\",\"type\":\"receivedMessage\"},{\"operator\":\"lessThan\",\"target\":2000,\"type\":\"responseTime\"}],\"configVariables\":[],\"request\":{\"message\":\"message\",\"url\":\"ws://datadoghq.com\"}},\"locations\":[\"aws:us-east-2\"],\"message\":\"BDD test payload: synthetics_api_test_websocket_payload.json\",\"name\":\"Test-Create_an_API_test_with_WEBSOCKET_subtype_returns_OK_Returns_the_created_test_details_response-1636999665\",\"options\":{\"accept_self_signed\":false,\"allow_insecure\":true,\"follow_redirects\":true,\"min_failure_duration\":10,\"min_location_failed\":1,\"monitor_name\":\"Test-Create_an_API_test_with_WEBSOCKET_subtype_returns_OK_Returns_the_created_test_details_response-1636999665\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60},\"subtype\":\"websocket\",\"tags\":[\"testing:api\"],\"type\":\"api\"}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v1/synthetics/tests/api" + }, + "response": { + "bodySize": 1039, + "content": { + "mimeType": "application/json", + "size": 1039, + "text": "{\"status\":\"live\",\"public_id\":\"7f2-txy-a7p\",\"tags\":[\"testing:api\"],\"org_id\":321813,\"locations\":[\"aws:us-east-2\"],\"message\":\"BDD test payload: synthetics_api_test_websocket_payload.json\",\"deleted_at\":null,\"name\":\"Test-Create_an_API_test_with_WEBSOCKET_subtype_returns_OK_Returns_the_created_test_details_response-1636999665\",\"monitor_id\":54531314,\"type\":\"api\",\"created_at\":\"2021-11-15T18:07:46.215484+00:00\",\"modified_at\":\"2021-11-15T18:07:46.215484+00:00\",\"subtype\":\"websocket\",\"config\":{\"request\":{\"url\":\"ws://datadoghq.com\",\"message\":\"message\"},\"assertions\":[{\"operator\":\"is\",\"type\":\"receivedMessage\",\"target\":\"message\"},{\"operator\":\"lessThan\",\"type\":\"responseTime\",\"target\":2000}],\"configVariables\":[]},\"options\":{\"accept_self_signed\":false,\"retry\":{\"count\":3,\"interval\":10},\"min_location_failed\":1,\"allow_insecure\":true,\"follow_redirects\":true,\"min_failure_duration\":10,\"monitor_priority\":5,\"monitor_name\":\"Test-Create_an_API_test_with_WEBSOCKET_subtype_returns_OK_Returns_the_created_test_details_response-1636999665\",\"tick_every\":60}}" + }, + "cookies": [], + "headers": [ + { + "name": "date", + "value": "Mon, 15 Nov 2021 18:07:46 GMT" + }, + { + "name": "content-type", + "value": "application/json" + }, + { + "name": "content-length", + "value": "1039" + }, + { + "name": "connection", + "value": "close" + }, + { + "name": "pragma", + "value": "no-cache" + }, + { + "name": "cache-control", + "value": "no-cache" + }, + { + "name": "x-ratelimit-limit", + "value": "12000" + }, + { + "name": "x-ratelimit-period", + "value": "60" + }, + { + "name": "x-ratelimit-reset", + "value": "14" + }, + { + "name": "x-ratelimit-remaining", + "value": "11999" + }, + { + "name": "x-envoy-upstream-service-time", + "value": "264" + }, + { + "name": "vary", + "value": "Accept-Encoding" + }, + { + "name": "x-content-type-options", + "value": "nosniff" + }, + { + "name": "strict-transport-security", + "value": "max-age=15724800;" + }, + { + "name": "content-security-policy", + "value": "frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report" + }, + { + "name": "x-frame-options", + "value": "SAMEORIGIN" + } + ], + "headersSize": 523, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2021-11-15T18:07:45.950Z", + "time": 345, + "timings": { + "blocked": -1, + "connect": -1, + "dns": -1, + "receive": 0, + "send": 0, + "ssl": -1, + "wait": 345 + } + }, + { + "_id": "139366de8ae213158bd70ca04c990462", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 30, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "user-agent", + "value": "datadog-api-client-typescript/1.0.0-beta.6 (node 14.18.1; os Linux; arch x64)" + }, + { + "_fromType": "array", + "name": "accept", + "value": "application/json, */*;q=0.8" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "x-datadog-parent-id", + "value": "8010816681933148738" + }, + { + "_fromType": "array", + "name": "x-datadog-trace-id", + "value": "7130359786114391756" + }, + { + "_fromType": "array", + "name": "content-length", + "value": "30" + }, + { + "_fromType": "array", + "name": "connection", + "value": "close" + }, + { + "name": "host", + "value": "api.datadoghq.com" + } + ], + "headersSize": 489, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"public_ids\":[\"7f2-txy-a7p\"]}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v1/synthetics/tests/delete" + }, + "response": { + "bodySize": 95, + "content": { + "mimeType": "application/json", + "size": 95, + "text": "{\"deleted_tests\":[{\"deleted_at\":\"2021-11-15T18:07:46.397039+00:00\",\"public_id\":\"7f2-txy-a7p\"}]}" + }, + "cookies": [], + "headers": [ + { + "name": "date", + "value": "Mon, 15 Nov 2021 18:07:46 GMT" + }, + { + "name": "content-type", + "value": "application/json" + }, + { + "name": "content-length", + "value": "95" + }, + { + "name": "connection", + "value": "close" + }, + { + "name": "pragma", + "value": "no-cache" + }, + { + "name": "cache-control", + "value": "no-cache" + }, + { + "name": "x-ratelimit-limit", + "value": "12000" + }, + { + "name": "x-ratelimit-period", + "value": "60" + }, + { + "name": "x-ratelimit-reset", + "value": "14" + }, + { + "name": "x-ratelimit-remaining", + "value": "11999" + }, + { + "name": "x-envoy-upstream-service-time", + "value": "143" + }, + { + "name": "vary", + "value": "Accept-Encoding" + }, + { + "name": "x-content-type-options", + "value": "nosniff" + }, + { + "name": "strict-transport-security", + "value": "max-age=15724800;" + }, + { + "name": "content-security-policy", + "value": "frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report" + }, + { + "name": "x-frame-options", + "value": "SAMEORIGIN" + } + ], + "headersSize": 521, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2021-11-15T18:07:46.309Z", + "time": 159, + "timings": { + "blocked": -1, + "connect": -1, + "dns": -1, + "receive": 0, + "send": 0, + "ssl": -1, + "wait": 159 + } + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/features/v1/synthetics.feature b/features/v1/synthetics.feature index 7e70bdca624..0011ce2b23f 100644 --- a/features/v1/synthetics.feature +++ b/features/v1/synthetics.feature @@ -115,6 +115,13 @@ Feature: Synthetics Then the response status is 200 OK - Returns the created test details. And the response "name" is equal to "{{ unique }}" + Scenario: Create an API test with WEBSOCKET subtype returns "OK - Returns the created test details." response + Given new "CreateSyntheticsAPITest" request + And body from file "synthetics_api_test_websocket_payload.json" + When the request is sent + Then the response status is 200 OK - Returns the created test details. + And the response "name" is equal to "{{ unique }}" + @generated @skip Scenario: Delete a global variable returns "JSON format is wrong" response Given new "DeleteGlobalVariable" request diff --git a/features/v1/synthetics_api_test_websocket_payload.json b/features/v1/synthetics_api_test_websocket_payload.json new file mode 100644 index 00000000000..4d9cccfc27f --- /dev/null +++ b/features/v1/synthetics_api_test_websocket_payload.json @@ -0,0 +1,34 @@ +{ + "config": { + "assertions": [ + { + "operator": "is", + "target": "message", + "type": "receivedMessage" + }, + { "operator": "lessThan", "target": 2000, "type": "responseTime" } + ], + "configVariables": [], + "request": { + "url": "ws://datadoghq.com", + "message": "message" + } + }, + "locations": ["aws:us-east-2"], + "message": "BDD test payload: synthetics_api_test_websocket_payload.json", + "name": "{{ unique }}", + "options": { + "accept_self_signed": false, + "allow_insecure": true, + "follow_redirects": true, + "min_failure_duration": 10, + "min_location_failed": 1, + "monitor_name": "{{ unique }}", + "monitor_priority": 5, + "retry": { "count": 3, "interval": 10 }, + "tick_every": 60 + }, + "subtype": "websocket", + "tags": ["testing:api"], + "type": "api" +} diff --git a/packages/datadog-api-client-v1/models/ObjectSerializer.ts b/packages/datadog-api-client-v1/models/ObjectSerializer.ts index 4908db7f698..c919215fb71 100644 --- a/packages/datadog-api-client-v1/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v1/models/ObjectSerializer.ts @@ -808,6 +808,7 @@ const enumsMap: { [key: string]: any[] } = { "multi", "icmp", "udp", + "websocket", ], SyntheticsTestDetailsType: ["api", "browser"], SyntheticsTestExecutionRule: ["blocking", "non_blocking", "skipped"], diff --git a/packages/datadog-api-client-v1/models/SyntheticsTestDetailsSubType.ts b/packages/datadog-api-client-v1/models/SyntheticsTestDetailsSubType.ts index 56c1653dbdf..bb9db9cfd44 100644 --- a/packages/datadog-api-client-v1/models/SyntheticsTestDetailsSubType.ts +++ b/packages/datadog-api-client-v1/models/SyntheticsTestDetailsSubType.ts @@ -15,7 +15,8 @@ export type SyntheticsTestDetailsSubType = | typeof DNS | typeof MULTI | typeof ICMP - | typeof UDP; + | typeof UDP + | typeof WEBSOCKET; export const HTTP = "http"; export const SSL = "ssl"; export const TCP = "tcp"; @@ -23,3 +24,4 @@ export const DNS = "dns"; export const MULTI = "multi"; export const ICMP = "icmp"; export const UDP = "udp"; +export const WEBSOCKET = "websocket"; diff --git a/packages/datadog-api-client-v1/models/SyntheticsTestRequest.ts b/packages/datadog-api-client-v1/models/SyntheticsTestRequest.ts index f04f8b06fe4..9481f301201 100644 --- a/packages/datadog-api-client-v1/models/SyntheticsTestRequest.ts +++ b/packages/datadog-api-client-v1/models/SyntheticsTestRequest.ts @@ -44,7 +44,7 @@ export class SyntheticsTestRequest { */ "host"?: string; /** - * Message to send for UDP tests. + * Message to send for UDP or WebSocket tests. */ "message"?: string; "method"?: HTTPMethod;