Skip to content

Commit 4a380c7

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add bodyType to Synthetics request (#1229)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent eece91a commit 4a380c7

File tree

8 files changed

+101
-9
lines changed

8 files changed

+101
-9
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-11-08 09:49:28.138621",
8-
"spec_repo_commit": "9146e44b"
7+
"regenerated": "2022-11-08 20:15:43.710640",
8+
"spec_repo_commit": "ce8fbc1a"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2022-11-08 09:49:28.149991",
13-
"spec_repo_commit": "9146e44b"
12+
"regenerated": "2022-11-08 20:15:43.722751",
13+
"spec_repo_commit": "ce8fbc1a"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13231,6 +13231,8 @@ components:
1323113231
body:
1323213232
description: Body to include in the test.
1323313233
type: string
13234+
bodyType:
13235+
$ref: '#/components/schemas/SyntheticsTestRequestBodyType'
1323413236
certificate:
1323513237
$ref: '#/components/schemas/SyntheticsTestRequestCertificate'
1323613238
certificateDomains:
@@ -13309,6 +13311,24 @@ components:
1330913311
example: https://example.com
1331013312
type: string
1331113313
type: object
13314+
SyntheticsTestRequestBodyType:
13315+
description: Type of the request body.
13316+
enum:
13317+
- text/plain
13318+
- application/json
13319+
- text/xml
13320+
- text/html
13321+
- application/x-www-form-urlencoded
13322+
- graphql
13323+
example: text/plain
13324+
type: string
13325+
x-enum-varnames:
13326+
- TEXT_PLAIN
13327+
- APPLICATION_JSON
13328+
- TEXT_XML
13329+
- TEXT_HTML
13330+
- APPLICATION_X_WWW_FORM_URLENCODED
13331+
- GRAPHQL
1331213332
SyntheticsTestRequestCertificate:
1331313333
description: Client certificate to use when performing the test request.
1331413334
properties:

docs/datadog_api_client.v1.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4005,6 +4005,13 @@ synthetics\_test\_request
40054005
:members:
40064006
:show-inheritance:
40074007

4008+
synthetics\_test\_request\_body\_type
4009+
-------------------------------------
4010+
4011+
.. automodule:: datadog_api_client.v1.model.synthetics_test_request_body_type
4012+
:members:
4013+
:show-inheritance:
4014+
40084015
synthetics\_test\_request\_certificate
40094016
--------------------------------------
40104017

examples/v1/synthetics/UpdateBrowserTest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
2727
from datadog_api_client.v1.model.synthetics_test_pause_status import SyntheticsTestPauseStatus
2828
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest
29+
from datadog_api_client.v1.model.synthetics_test_request_body_type import SyntheticsTestRequestBodyType
2930
from datadog_api_client.v1.model.synthetics_test_request_certificate import SyntheticsTestRequestCertificate
3031
from datadog_api_client.v1.model.synthetics_test_request_certificate_item import SyntheticsTestRequestCertificateItem
3132
from datadog_api_client.v1.model.synthetics_test_request_proxy import SyntheticsTestRequestProxy
@@ -45,6 +46,7 @@
4546
type=SyntheticsBasicAuthWebType.WEB,
4647
username="my_username",
4748
),
49+
body_type=SyntheticsTestRequestBodyType.TEXT_PLAIN,
4850
certificate=SyntheticsTestRequestCertificate(
4951
cert=SyntheticsTestRequestCertificateItem(),
5052
key=SyntheticsTestRequestCertificateItem(),

src/datadog_api_client/v1/model/synthetics_test_request.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
if TYPE_CHECKING:
1717
from datadog_api_client.v1.model.synthetics_basic_auth import SyntheticsBasicAuth
18+
from datadog_api_client.v1.model.synthetics_test_request_body_type import SyntheticsTestRequestBodyType
1819
from datadog_api_client.v1.model.synthetics_test_request_certificate import SyntheticsTestRequestCertificate
1920
from datadog_api_client.v1.model.synthetics_test_headers import SyntheticsTestHeaders
2021
from datadog_api_client.v1.model.synthetics_test_metadata import SyntheticsTestMetadata
@@ -41,6 +42,7 @@ class SyntheticsTestRequest(ModelNormal):
4142
@cached_property
4243
def openapi_types(_):
4344
from datadog_api_client.v1.model.synthetics_basic_auth import SyntheticsBasicAuth
45+
from datadog_api_client.v1.model.synthetics_test_request_body_type import SyntheticsTestRequestBodyType
4446
from datadog_api_client.v1.model.synthetics_test_request_certificate import SyntheticsTestRequestCertificate
4547
from datadog_api_client.v1.model.synthetics_test_headers import SyntheticsTestHeaders
4648
from datadog_api_client.v1.model.synthetics_test_metadata import SyntheticsTestMetadata
@@ -51,6 +53,7 @@ def openapi_types(_):
5153
"allow_insecure": (bool,),
5254
"basic_auth": (SyntheticsBasicAuth,),
5355
"body": (str,),
56+
"body_type": (SyntheticsTestRequestBodyType,),
5457
"certificate": (SyntheticsTestRequestCertificate,),
5558
"certificate_domains": ([str],),
5659
"dns_server": (str,),
@@ -77,6 +80,7 @@ def openapi_types(_):
7780
"allow_insecure": "allow_insecure",
7881
"basic_auth": "basicAuth",
7982
"body": "body",
83+
"body_type": "bodyType",
8084
"certificate": "certificate",
8185
"certificate_domains": "certificateDomains",
8286
"dns_server": "dnsServer",
@@ -111,6 +115,7 @@ def __init__(
111115
UnsetType,
112116
] = unset,
113117
body: Union[str, UnsetType] = unset,
118+
body_type: Union[SyntheticsTestRequestBodyType, UnsetType] = unset,
114119
certificate: Union[SyntheticsTestRequestCertificate, UnsetType] = unset,
115120
certificate_domains: Union[List[str], UnsetType] = unset,
116121
dns_server: Union[str, UnsetType] = unset,
@@ -145,6 +150,9 @@ def __init__(
145150
:param body: Body to include in the test.
146151
:type body: str, optional
147152
153+
:param body_type: Type of the request body.
154+
:type body_type: SyntheticsTestRequestBodyType, optional
155+
148156
:param certificate: Client certificate to use when performing the test request.
149157
:type certificate: SyntheticsTestRequestCertificate, optional
150158
@@ -213,6 +221,8 @@ def __init__(
213221
kwargs["basic_auth"] = basic_auth
214222
if body is not unset:
215223
kwargs["body"] = body
224+
if body_type is not unset:
225+
kwargs["body_type"] = body_type
216226
if certificate is not unset:
217227
kwargs["certificate"] = certificate
218228
if certificate_domains is not unset:
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class SyntheticsTestRequestBodyType(ModelSimple):
16+
"""
17+
Type of the request body.
18+
19+
:param value: Must be one of ["text/plain", "application/json", "text/xml", "text/html", "application/x-www-form-urlencoded", "graphql"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"text/plain",
25+
"application/json",
26+
"text/xml",
27+
"text/html",
28+
"application/x-www-form-urlencoded",
29+
"graphql",
30+
}
31+
TEXT_PLAIN: ClassVar["SyntheticsTestRequestBodyType"]
32+
APPLICATION_JSON: ClassVar["SyntheticsTestRequestBodyType"]
33+
TEXT_XML: ClassVar["SyntheticsTestRequestBodyType"]
34+
TEXT_HTML: ClassVar["SyntheticsTestRequestBodyType"]
35+
APPLICATION_X_WWW_FORM_URLENCODED: ClassVar["SyntheticsTestRequestBodyType"]
36+
GRAPHQL: ClassVar["SyntheticsTestRequestBodyType"]
37+
38+
@cached_property
39+
def openapi_types(_):
40+
return {
41+
"value": (str,),
42+
}
43+
44+
45+
SyntheticsTestRequestBodyType.TEXT_PLAIN = SyntheticsTestRequestBodyType("text/plain")
46+
SyntheticsTestRequestBodyType.APPLICATION_JSON = SyntheticsTestRequestBodyType("application/json")
47+
SyntheticsTestRequestBodyType.TEXT_XML = SyntheticsTestRequestBodyType("text/xml")
48+
SyntheticsTestRequestBodyType.TEXT_HTML = SyntheticsTestRequestBodyType("text/html")
49+
SyntheticsTestRequestBodyType.APPLICATION_X_WWW_FORM_URLENCODED = SyntheticsTestRequestBodyType(
50+
"application/x-www-form-urlencoded"
51+
)
52+
SyntheticsTestRequestBodyType.GRAPHQL = SyntheticsTestRequestBodyType("graphql")

src/datadog_api_client/v1/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@
652652
from datadog_api_client.v1.model.synthetics_test_pause_status import SyntheticsTestPauseStatus
653653
from datadog_api_client.v1.model.synthetics_test_process_status import SyntheticsTestProcessStatus
654654
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest
655+
from datadog_api_client.v1.model.synthetics_test_request_body_type import SyntheticsTestRequestBodyType
655656
from datadog_api_client.v1.model.synthetics_test_request_certificate import SyntheticsTestRequestCertificate
656657
from datadog_api_client.v1.model.synthetics_test_request_certificate_item import SyntheticsTestRequestCertificateItem
657658
from datadog_api_client.v1.model.synthetics_test_request_proxy import SyntheticsTestRequestProxy

tests/v1/features/synthetics.feature

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Feature: Synthetics
3434
@generated @skip @team:DataDog/synthetics-app
3535
Scenario: Create a browser test returns "- JSON format is wrong" response
3636
Given new "CreateSyntheticsBrowserTest" request
37-
And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "method": "GET", "proxy": {"url": "https://example.com"}, "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["laptop_large"], "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"}
37+
And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "method": "GET", "proxy": {"url": "https://example.com"}, "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["laptop_large"], "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"}
3838
When the request is sent
3939
Then the response status is 400 - JSON format is wrong
4040

@@ -59,7 +59,7 @@ Feature: Synthetics
5959
@generated @skip @team:DataDog/synthetics-app
6060
Scenario: Create a browser test returns "Test quota is reached" response
6161
Given new "CreateSyntheticsBrowserTest" request
62-
And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "method": "GET", "proxy": {"url": "https://example.com"}, "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["laptop_large"], "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"}
62+
And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "method": "GET", "proxy": {"url": "https://example.com"}, "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["laptop_large"], "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"}
6363
When the request is sent
6464
Then the response status is 402 Test quota is reached
6565

@@ -241,23 +241,23 @@ Feature: Synthetics
241241
Scenario: Edit a browser test returns "- JSON format is wrong" response
242242
Given new "UpdateBrowserTest" request
243243
And request contains "public_id" parameter from "REPLACE.ME"
244-
And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "method": "GET", "proxy": {"url": "https://example.com"}, "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["laptop_large"], "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"}
244+
And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "method": "GET", "proxy": {"url": "https://example.com"}, "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["laptop_large"], "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"}
245245
When the request is sent
246246
Then the response status is 400 - JSON format is wrong
247247

248248
@generated @skip @team:DataDog/synthetics-app
249249
Scenario: Edit a browser test returns "- Synthetic Monitoring is not activated for the user" response
250250
Given new "UpdateBrowserTest" request
251251
And request contains "public_id" parameter from "REPLACE.ME"
252-
And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "method": "GET", "proxy": {"url": "https://example.com"}, "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["laptop_large"], "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"}
252+
And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "method": "GET", "proxy": {"url": "https://example.com"}, "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["laptop_large"], "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"}
253253
When the request is sent
254254
Then the response status is 404 - Synthetic Monitoring is not activated for the user
255255

256256
@generated @skip @team:DataDog/synthetics-app
257257
Scenario: Edit a browser test returns "OK" response
258258
Given new "UpdateBrowserTest" request
259259
And request contains "public_id" parameter from "REPLACE.ME"
260-
And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "method": "GET", "proxy": {"url": "https://example.com"}, "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["laptop_large"], "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"}
260+
And body with value {"config": {"assertions": [], "configVariables": [{"name": "VARIABLE_NAME", "type": "text"}], "request": {"basicAuth": {"password": "PaSSw0RD!", "type": "web", "username": "my_username"}, "bodyType": "text/plain", "certificate": {"cert": {}, "key": {}}, "certificateDomains": [], "method": "GET", "proxy": {"url": "https://example.com"}, "url": "https://example.com"}, "variables": [{"name": "VARIABLE_NAME", "type": "text"}]}, "locations": ["aws:eu-west-3"], "message": "", "name": "Example test name", "options": {"ci": {"executionRule": "blocking"}, "device_ids": ["laptop_large"], "monitor_options": {}, "restricted_roles": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"], "retry": {}, "rumSettings": {"applicationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "clientTokenId": 12345, "isEnabled": true}}, "status": "live", "steps": [{"type": "assertElementContent"}], "tags": ["env:prod"], "type": "browser"}
261261
When the request is sent
262262
Then the response status is 200 OK
263263

0 commit comments

Comments
 (0)