Skip to content

Commit 32dbbcf

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Fix missing field in Synthetics tests authentication configuration (#940)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent 389383d commit 32dbbcf

File tree

8 files changed

+357
-4
lines changed

8 files changed

+357
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.4",
7-
"regenerated": "2022-12-05 18:23:31.425987",
8-
"spec_repo_commit": "1cc231e1"
7+
"regenerated": "2022-12-08 13:18:30.553175",
8+
"spec_repo_commit": "65b2053a"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2022-12-05 18:23:31.437612",
13-
"spec_repo_commit": "1cc231e1"
12+
"regenerated": "2022-12-08 13:18:30.569528",
13+
"spec_repo_commit": "65b2053a"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11716,6 +11716,8 @@ components:
1171611716
description: Scope to use when performing the authentication.
1171711717
example: scope
1171811718
type: string
11719+
tokenApiAuthentication:
11720+
$ref: '#/components/schemas/SyntheticsBasicAuthOauthTokenApiAuthentication'
1171911721
type:
1172011722
$ref: '#/components/schemas/SyntheticsBasicAuthOauthROPType'
1172111723
username:
@@ -11725,6 +11727,7 @@ components:
1172511727
required:
1172611728
- accessTokenUrl
1172711729
- password
11730+
- tokenApiAuthentication
1172811731
- username
1172911732
type: object
1173011733
SyntheticsBasicAuthOauthROPType:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2022-12-07T10:36:18.554Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
{
2+
"log": {
3+
"_recordingName": "Synthetics/Create an API HTTP with oauth-rop test returns \"OK - Returns the created test details.\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "7a314475838068c3894780495c104da2",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 1835,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 579,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"config\":{\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"target\":\"text/html\",\"type\":\"header\"},{\"operator\":\"lessThan\",\"target\":2000,\"type\":\"responseTime\"},{\"operator\":\"validatesJSONPath\",\"target\":{\"jsonPath\":\"topKey\",\"operator\":\"isNot\",\"targetValue\":\"0\"},\"type\":\"body\"},{\"operator\":\"validatesXPath\",\"target\":{\"operator\":\"contains\",\"targetValue\":\"0\",\"xPath\":\"target-xpath\"},\"type\":\"body\"}],\"configVariables\":[{\"example\":\"content-type\",\"name\":\"PROPERTY\",\"pattern\":\"content-type\",\"type\":\"text\"}],\"request\":{\"basicAuth\":{\"accessTokenUrl\":\"https://datadog-token.com\",\"audience\":\"audience\",\"clientId\":\"client-id\",\"clientSecret\":\"client-secret\",\"password\":\"oauth-password\",\"resource\":\"resource\",\"scope\":\"yoyo\",\"tokenApiAuthentication\":\"body\",\"type\":\"oauth-rop\",\"username\":\"oauth-usermame\"},\"certificate\":{\"cert\":{\"content\":\"cert-content\",\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"content\":\"key-content\",\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"headers\":{\"unique\":\"testcreateanapihttpwithoauthroptestreturnsokreturnsthecreatedtestdetailsresponse1670409378\"},\"method\":\"GET\",\"proxy\":{\"headers\":{},\"url\":\"https://datadoghq.com\"},\"timeout\":10,\"url\":\"https://datadoghq.com\"}},\"locations\":[\"aws:us-east-2\"],\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"name\":\"Test-Create_an_API_HTTP_with_oauth_rop_test_returns_OK_Returns_the_created_test_details_response-1670409378\",\"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_HTTP_with_oauth_rop_test_returns_OK_Returns_the_created_test_details_response-1670409378\",\"monitor_priority\":5,\"retry\":{\"count\":3,\"interval\":10},\"tick_every\":60},\"subtype\":\"http\",\"tags\":[\"testing:api\"],\"type\":\"api\"}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v1/synthetics/tests/api"
39+
},
40+
"response": {
41+
"bodySize": 1983,
42+
"content": {
43+
"mimeType": "application/json",
44+
"size": 1983,
45+
"text": "{\"status\":\"live\",\"public_id\":\"u7x-e98-98f\",\"tags\":[\"testing:api\"],\"org_id\":569509,\"locations\":[\"aws:us-east-2\"],\"message\":\"BDD test payload: synthetics_api_http_test_payload.json\",\"deleted_at\":null,\"name\":\"Test-Create_an_API_HTTP_with_oauth_rop_test_returns_OK_Returns_the_created_test_details_response-1670409378\",\"monitor_id\":105046994,\"type\":\"api\",\"created_at\":\"2022-12-07T10:36:19.000736+00:00\",\"modified_at\":\"2022-12-07T10:36:19.000736+00:00\",\"subtype\":\"http\",\"config\":{\"request\":{\"certificate\":{\"cert\":{\"filename\":\"cert-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"},\"key\":{\"filename\":\"key-filename\",\"updatedAt\":\"2020-10-16T09:23:24.857Z\"}},\"url\":\"https://datadoghq.com\",\"basicAuth\":{\"username\":\"oauth-usermame\",\"clientSecret\":\"client-secret\",\"resource\":\"resource\",\"accessTokenUrl\":\"https://datadog-token.com\",\"audience\":\"audience\",\"clientId\":\"client-id\",\"scope\":\"yoyo\",\"password\":\"oauth-password\",\"type\":\"oauth-rop\",\"tokenApiAuthentication\":\"body\"},\"headers\":{\"unique\":\"testcreateanapihttpwithoauthroptestreturnsokreturnsthecreatedtestdetailsresponse1670409378\"},\"proxy\":{\"url\":\"https://datadoghq.com\",\"headers\":{}},\"timeout\":10,\"method\":\"GET\"},\"assertions\":[{\"operator\":\"is\",\"property\":\"{{ PROPERTY }}\",\"type\":\"header\",\"target\":\"text/html\"},{\"operator\":\"lessThan\",\"type\":\"responseTime\",\"target\":2000},{\"operator\":\"validatesJSONPath\",\"type\":\"body\",\"target\":{\"operator\":\"isNot\",\"targetValue\":\"0\",\"jsonPath\":\"topKey\"}},{\"operator\":\"validatesXPath\",\"type\":\"body\",\"target\":{\"operator\":\"contains\",\"targetValue\":\"0\",\"xPath\":\"target-xpath\"}}],\"configVariables\":[{\"pattern\":\"content-type\",\"type\":\"text\",\"example\":\"content-type\",\"name\":\"PROPERTY\"}]},\"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_HTTP_with_oauth_rop_test_returns_OK_Returns_the_created_test_details_response-1670409378\",\"tick_every\":60}}"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/json"
52+
}
53+
],
54+
"headersSize": 624,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2022-12-07T10:36:18.560Z",
61+
"time": 517
62+
},
63+
{
64+
"_id": "a88e911d306f47fb3fe5a6b32a5049c5",
65+
"_order": 0,
66+
"cache": {},
67+
"request": {
68+
"bodySize": 30,
69+
"cookies": [],
70+
"headers": [
71+
{
72+
"_fromType": "array",
73+
"name": "accept",
74+
"value": "application/json"
75+
},
76+
{
77+
"_fromType": "array",
78+
"name": "content-type",
79+
"value": "application/json"
80+
}
81+
],
82+
"headersSize": 568,
83+
"httpVersion": "HTTP/1.1",
84+
"method": "POST",
85+
"postData": {
86+
"mimeType": "application/json",
87+
"params": [],
88+
"text": "{\"public_ids\":[\"u7x-e98-98f\"]}"
89+
},
90+
"queryString": [],
91+
"url": "https://api.datadoghq.com/api/v1/synthetics/tests/delete"
92+
},
93+
"response": {
94+
"bodySize": 96,
95+
"content": {
96+
"mimeType": "application/json",
97+
"size": 96,
98+
"text": "{\"deleted_tests\":[{\"deleted_at\":\"2022-12-07T10:36:19.441845+00:00\",\"public_id\":\"u7x-e98-98f\"}]}\n"
99+
},
100+
"cookies": [],
101+
"headers": [
102+
{
103+
"name": "content-type",
104+
"value": "application/json"
105+
}
106+
],
107+
"headersSize": 622,
108+
"httpVersion": "HTTP/1.1",
109+
"redirectURL": "",
110+
"status": 200,
111+
"statusText": "OK"
112+
},
113+
"startedDateTime": "2022-12-07T10:36:19.085Z",
114+
"time": 469
115+
}
116+
],
117+
"pages": [],
118+
"version": "1.2"
119+
}
120+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/**
2+
* Create an API HTTP with oauth-rop test returns "OK - Returns the created test details." response
3+
*/
4+
5+
import { client, v1 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v1.SyntheticsApi(configuration);
9+
10+
const params: v1.SyntheticsApiCreateSyntheticsAPITestRequest = {
11+
body: {
12+
config: {
13+
assertions: [
14+
{
15+
operator: "is",
16+
property: "{{ PROPERTY }}",
17+
target: "text/html",
18+
type: "header",
19+
},
20+
{
21+
operator: "lessThan",
22+
target: 2000,
23+
type: "responseTime",
24+
},
25+
{
26+
operator: "validatesJSONPath",
27+
target: {
28+
jsonPath: "topKey",
29+
operator: "isNot",
30+
targetValue: "0",
31+
},
32+
type: "body",
33+
},
34+
{
35+
operator: "validatesXPath",
36+
target: {
37+
xPath: "target-xpath",
38+
targetValue: "0",
39+
operator: "contains",
40+
},
41+
type: "body",
42+
},
43+
],
44+
configVariables: [
45+
{
46+
example: "content-type",
47+
name: "PROPERTY",
48+
pattern: "content-type",
49+
type: "text",
50+
},
51+
],
52+
request: {
53+
certificate: {
54+
cert: {
55+
content: "cert-content",
56+
filename: "cert-filename",
57+
updatedAt: "2020-10-16T09:23:24.857Z",
58+
},
59+
key: {
60+
content: "key-content",
61+
filename: "key-filename",
62+
updatedAt: "2020-10-16T09:23:24.857Z",
63+
},
64+
},
65+
headers: {
66+
unique:
67+
"examplecreateanapihttpwithoauthroptestreturnsokreturnsthecreatedtestdetailsresponse",
68+
},
69+
method: "GET",
70+
timeout: 10,
71+
url: "https://datadoghq.com",
72+
proxy: {
73+
url: "https://datadoghq.com",
74+
headers: {},
75+
},
76+
basicAuth: {
77+
accessTokenUrl: "https://datadog-token.com",
78+
audience: "audience",
79+
clientId: "client-id",
80+
clientSecret: "client-secret",
81+
resource: "resource",
82+
scope: "yoyo",
83+
tokenApiAuthentication: "body",
84+
type: "oauth-rop",
85+
username: "oauth-usermame",
86+
password: "oauth-password",
87+
},
88+
},
89+
},
90+
locations: ["aws:us-east-2"],
91+
message: "BDD test payload: synthetics_api_http_test_payload.json",
92+
name: "Example-Create_an_API_HTTP_with_oauth_rop_test_returns_OK_Returns_the_created_test_details_response",
93+
options: {
94+
acceptSelfSigned: false,
95+
allowInsecure: true,
96+
followRedirects: true,
97+
minFailureDuration: 10,
98+
minLocationFailed: 1,
99+
monitorName:
100+
"Example-Create_an_API_HTTP_with_oauth_rop_test_returns_OK_Returns_the_created_test_details_response",
101+
monitorPriority: 5,
102+
retry: {
103+
count: 3,
104+
interval: 10,
105+
},
106+
tickEvery: 60,
107+
},
108+
subtype: "http",
109+
tags: ["testing:api"],
110+
type: "api",
111+
},
112+
};
113+
114+
apiInstance
115+
.createSyntheticsAPITest(params)
116+
.then((data: v1.SyntheticsAPITest) => {
117+
console.log(
118+
"API called successfully. Returned data: " + JSON.stringify(data)
119+
);
120+
})
121+
.catch((error: any) => console.error(error));

features/v1/synthetics.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ Feature: Synthetics
124124
Then the response status is 200 OK - Returns the created test details.
125125
And the response "name" is equal to "{{ unique }}"
126126

127+
@team:DataDog/synthetics-app
128+
Scenario: Create an API HTTP with oauth-rop test returns "OK - Returns the created test details." response
129+
Given new "CreateSyntheticsAPITest" request
130+
And body from file "synthetics_api_http_test_oauth_rop_payload.json"
131+
When the request is sent
132+
Then the response status is 200 OK - Returns the created test details.
133+
And the response "name" is equal to "{{ unique }}"
134+
127135
@team:DataDog/synthetics-app
128136
Scenario: Create an API SSL test returns "OK - Returns the created test details." response
129137
Given new "CreateSyntheticsAPITest" request
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"config": {
3+
"assertions": [
4+
{
5+
"operator": "is",
6+
"property": "{{ '{{ PROPERTY }}' }}",
7+
"target": "text/html",
8+
"type": "header"
9+
},
10+
{ "operator": "lessThan", "target": 2000, "type": "responseTime" },
11+
{
12+
"operator": "validatesJSONPath",
13+
"target": {
14+
"jsonPath": "topKey",
15+
"operator": "isNot",
16+
"targetValue": "0"
17+
},
18+
"type": "body"
19+
},
20+
{
21+
"operator": "validatesXPath",
22+
"target": {
23+
"xPath": "target-xpath",
24+
"targetValue": "0",
25+
"operator": "contains"
26+
},
27+
"type": "body"
28+
}
29+
],
30+
"configVariables": [
31+
{
32+
"example": "content-type",
33+
"name": "PROPERTY",
34+
"pattern": "content-type",
35+
"type": "text"
36+
}
37+
],
38+
"request": {
39+
"certificate": {
40+
"cert": {
41+
"content": "cert-content",
42+
"filename": "cert-filename",
43+
"updatedAt": "2020-10-16T09:23:24.857Z"
44+
},
45+
"key": {
46+
"content": "key-content",
47+
"filename": "key-filename",
48+
"updatedAt": "2020-10-16T09:23:24.857Z"
49+
}
50+
},
51+
"headers": { "unique": "{{ unique_lower_alnum }}" },
52+
"method": "GET",
53+
"timeout": 10,
54+
"url": "https://datadoghq.com",
55+
"proxy": {
56+
"url": "https://datadoghq.com",
57+
"headers": {}
58+
},
59+
"basicAuth": {
60+
"accessTokenUrl": "https://datadog-token.com",
61+
"audience": "audience",
62+
"clientId": "client-id",
63+
"clientSecret": "client-secret",
64+
"resource": "resource",
65+
"scope": "yoyo",
66+
"tokenApiAuthentication": "body",
67+
"type": "oauth-rop",
68+
"username": "oauth-usermame",
69+
"password": "oauth-password"
70+
}
71+
}
72+
},
73+
"locations": ["aws:us-east-2"],
74+
"message": "BDD test payload: synthetics_api_http_test_payload.json",
75+
"name": "{{ unique }}",
76+
"options": {
77+
"accept_self_signed": false,
78+
"allow_insecure": true,
79+
"follow_redirects": true,
80+
"min_failure_duration": 10,
81+
"min_location_failed": 1,
82+
"monitor_name": "{{ unique }}",
83+
"monitor_priority": 5,
84+
"retry": { "count": 3, "interval": 10 },
85+
"tick_every": 60
86+
},
87+
"subtype": "http",
88+
"tags": ["testing:api"],
89+
"type": "api"
90+
}

0 commit comments

Comments
 (0)