Skip to content

Commit 46bca07

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add timing scope for response time assertions (#1651)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 5b125cd commit 46bca07

18 files changed

+122
-49
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.5",
7-
"regenerated": "2023-09-12 17:52:26.336386",
8-
"spec_repo_commit": "752c972d"
7+
"regenerated": "2023-09-12 20:28:32.678363",
8+
"spec_repo_commit": "bc2ae18f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.5",
12-
"regenerated": "2023-09-12 17:52:26.350823",
13-
"spec_repo_commit": "752c972d"
12+
"regenerated": "2023-09-12 20:28:32.694366",
13+
"spec_repo_commit": "bc2ae18f"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12575,13 +12575,24 @@ components:
1257512575
target:
1257612576
description: Value used by the operator.
1257712577
example: 123456
12578+
timingsScope:
12579+
$ref: '#/components/schemas/SyntheticsAssertionTimingsScope'
1257812580
type:
1257912581
$ref: '#/components/schemas/SyntheticsAssertionType'
1258012582
required:
1258112583
- type
1258212584
- operator
1258312585
- target
1258412586
type: object
12587+
SyntheticsAssertionTimingsScope:
12588+
description: Timings scope for response time assertions.
12589+
enum:
12590+
- all
12591+
- withoutDNS
12592+
type: string
12593+
x-enum-varnames:
12594+
- ALL
12595+
- WITHOUT_DNS
1258512596
SyntheticsAssertionType:
1258612597
description: Type of the assertion.
1258712598
enum:

docs/datadog_api_client.v1.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3641,6 +3641,13 @@ synthetics\_assertion\_target
36413641
:members:
36423642
:show-inheritance:
36433643

3644+
synthetics\_assertion\_timings\_scope
3645+
-------------------------------------
3646+
3647+
.. automodule:: datadog_api_client.v1.model.synthetics_assertion_timings_scope
3648+
:members:
3649+
:show-inheritance:
3650+
36443651
synthetics\_assertion\_type
36453652
---------------------------
36463653

examples/v1/synthetics/CreateSyntheticsAPITest_1487281163.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
)
1515
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
1616
from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget
17+
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
1718
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType
1819
from datadog_api_client.v1.model.synthetics_assertion_x_path_operator import SyntheticsAssertionXPathOperator
1920
from datadog_api_client.v1.model.synthetics_assertion_x_path_target import SyntheticsAssertionXPathTarget
@@ -48,6 +49,7 @@
4849
operator=SyntheticsAssertionOperator.LESS_THAN,
4950
target=2000,
5051
type=SyntheticsAssertionType.RESPONSE_TIME,
52+
timings_scope=SyntheticsAssertionTimingsScope.WITHOUT_DNS,
5153
),
5254
SyntheticsAssertionJSONPathTarget(
5355
operator=SyntheticsAssertionJSONPathOperator.VALIDATES_JSON_PATH,

src/datadog_api_client/v1/model/synthetics_assertion.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ def __init__(self, **kwargs):
2525
:param target: Value used by the operator.
2626
:type target: bool, date, datetime, dict, float, int, list, str, none_type
2727
28+
:param timings_scope: Timings scope for response time assertions.
29+
:type timings_scope: SyntheticsAssertionTimingsScope, optional
30+
2831
:param type: Type of the assertion.
2932
:type type: SyntheticsAssertionType
3033
"""

src/datadog_api_client/v1/model/synthetics_assertion_target.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818

1919
if TYPE_CHECKING:
2020
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
21+
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
2122
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType
2223

2324

2425
class SyntheticsAssertionTarget(ModelNormal):
2526
@cached_property
2627
def openapi_types(_):
2728
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
29+
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
2830
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType
2931

3032
return {
@@ -41,13 +43,15 @@ def openapi_types(_):
4143
str,
4244
none_type,
4345
),
46+
"timings_scope": (SyntheticsAssertionTimingsScope,),
4447
"type": (SyntheticsAssertionType,),
4548
}
4649

4750
attribute_map = {
4851
"operator": "operator",
4952
"_property": "property",
5053
"target": "target",
54+
"timings_scope": "timingsScope",
5155
"type": "type",
5256
}
5357

@@ -57,6 +61,7 @@ def __init__(
5761
target: Any,
5862
type: SyntheticsAssertionType,
5963
_property: Union[str, UnsetType] = unset,
64+
timings_scope: Union[SyntheticsAssertionTimingsScope, UnsetType] = unset,
6065
**kwargs,
6166
):
6267
"""
@@ -71,11 +76,16 @@ def __init__(
7176
:param target: Value used by the operator.
7277
:type target: bool, date, datetime, dict, float, int, list, str, none_type
7378
79+
:param timings_scope: Timings scope for response time assertions.
80+
:type timings_scope: SyntheticsAssertionTimingsScope, optional
81+
7482
:param type: Type of the assertion.
7583
:type type: SyntheticsAssertionType
7684
"""
7785
if _property is not unset:
7886
kwargs["_property"] = _property
87+
if timings_scope is not unset:
88+
kwargs["timings_scope"] = timings_scope
7989
super().__init__(kwargs)
8090

8191
self_.operator = operator
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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 SyntheticsAssertionTimingsScope(ModelSimple):
16+
"""
17+
Timings scope for response time assertions.
18+
19+
:param value: Must be one of ["all", "withoutDNS"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"all",
25+
"withoutDNS",
26+
}
27+
ALL: ClassVar["SyntheticsAssertionTimingsScope"]
28+
WITHOUT_DNS: ClassVar["SyntheticsAssertionTimingsScope"]
29+
30+
@cached_property
31+
def openapi_types(_):
32+
return {
33+
"value": (str,),
34+
}
35+
36+
37+
SyntheticsAssertionTimingsScope.ALL = SyntheticsAssertionTimingsScope("all")
38+
SyntheticsAssertionTimingsScope.WITHOUT_DNS = SyntheticsAssertionTimingsScope("withoutDNS")

src/datadog_api_client/v1/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@
590590
)
591591
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
592592
from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget
593+
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
593594
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType
594595
from datadog_api_client.v1.model.synthetics_assertion_x_path_operator import SyntheticsAssertionXPathOperator
595596
from datadog_api_client.v1.model.synthetics_assertion_x_path_target import SyntheticsAssertionXPathTarget
@@ -1439,6 +1440,7 @@
14391440
"SyntheticsAssertionJSONPathTargetTarget",
14401441
"SyntheticsAssertionOperator",
14411442
"SyntheticsAssertionTarget",
1443+
"SyntheticsAssertionTimingsScope",
14421444
"SyntheticsAssertionType",
14431445
"SyntheticsAssertionXPathOperator",
14441446
"SyntheticsAssertionXPathTarget",
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2023-08-11T15:25:10.265Z
1+
2023-09-11T14:49:13.966Z

tests/v1/cassettes/test_scenarios/test_create_an_api_http_test_returns_ok_returns_the_created_test_details_response.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interactions:
22
- request:
3-
body: '{"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","resource":"resource","scope":"yoyo","tokenApiAuthentication":"header","type":"oauth-client"},"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":"testcreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse1691767510"},"method":"GET","persistCookies":true,"proxy":{"headers":{},"url":"https://datadoghq.com"},"timeout":10,"url":"https://datadoghq.com"}},"locations":["aws:us-east-2"],"message":"BDD
4-
test payload: synthetics_api_http_test_payload.json","name":"Test-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1691767510","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"httpVersion":"http2","min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1691767510","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"}'
3+
body: '{"config":{"assertions":[{"operator":"is","property":"{{ PROPERTY }}","target":"text/html","type":"header"},{"operator":"lessThan","target":2000,"timingsScope":"withoutDNS","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","resource":"resource","scope":"yoyo","tokenApiAuthentication":"header","type":"oauth-client"},"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":"testcreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse1694443753"},"method":"GET","persistCookies":true,"proxy":{"headers":{},"url":"https://datadoghq.com"},"timeout":10,"url":"https://datadoghq.com"}},"locations":["aws:us-east-2"],"message":"BDD
4+
test payload: synthetics_api_http_test_payload.json","name":"Test-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1694443753","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"httpVersion":"http2","min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1694443753","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"subtype":"http","tags":["testing:api"],"type":"api"}'
55
headers:
66
accept:
77
- application/json
@@ -11,17 +11,17 @@ interactions:
1111
uri: https://api.datadoghq.com/api/v1/synthetics/tests/api
1212
response:
1313
body:
14-
string: '{"public_id":"p5t-6vv-3xj","name":"Test-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1691767510","status":"live","type":"api","tags":["testing:api"],"created_at":"2023-08-11T15:25:10.474768+00:00","modified_at":"2023-08-11T15:25:10.474768+00:00","config":{"assertions":[{"operator":"is","property":"{{
15-
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","resource":"resource","scope":"yoyo","tokenApiAuthentication":"header","type":"oauth-client"},"certificate":{"cert":{"filename":"cert-filename","updatedAt":"2020-10-16T09:23:24.857Z"},"key":{"filename":"key-filename","updatedAt":"2020-10-16T09:23:24.857Z"}},"headers":{"unique":"testcreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse1691767510"},"method":"GET","persistCookies":true,"proxy":{"headers":{},"url":"https://datadoghq.com"},"timeout":10,"url":"https://datadoghq.com"}},"message":"BDD
16-
test payload: synthetics_api_http_test_payload.json","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"httpVersion":"http2","min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1691767510","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":null,"handle":"[email protected]","email":"[email protected]"},"deleted_at":null,"monitor_id":128997418,"org_id":321813,"modified_by":{"name":null,"handle":"[email protected]","email":"[email protected]"}}'
14+
string: '{"public_id":"459-yrn-6c6","name":"Test-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1694443753","status":"live","type":"api","tags":["testing:api"],"created_at":"2023-09-11T14:49:14.209609+00:00","modified_at":"2023-09-11T14:49:14.209609+00:00","config":{"assertions":[{"operator":"is","property":"{{
15+
PROPERTY }}","target":"text/html","type":"header"},{"operator":"lessThan","target":2000,"timingsScope":"withoutDNS","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","resource":"resource","scope":"yoyo","tokenApiAuthentication":"header","type":"oauth-client"},"certificate":{"cert":{"filename":"cert-filename","updatedAt":"2020-10-16T09:23:24.857Z"},"key":{"filename":"key-filename","updatedAt":"2020-10-16T09:23:24.857Z"}},"headers":{"unique":"testcreateanapihttptestreturnsokreturnsthecreatedtestdetailsresponse1694443753"},"method":"GET","persistCookies":true,"proxy":{"headers":{},"url":"https://datadoghq.com"},"timeout":10,"url":"https://datadoghq.com"}},"message":"BDD
16+
test payload: synthetics_api_http_test_payload.json","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"httpVersion":"http2","min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_an_API_HTTP_test_returns_OK_Returns_the_created_test_details_response-1694443753","monitor_priority":5,"retry":{"count":3,"interval":10},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"http","created_by":{"name":null,"handle":"[email protected]","email":"[email protected]"},"deleted_at":null,"monitor_id":131183718,"org_id":321813,"modified_by":{"name":null,"handle":"[email protected]","email":"[email protected]"}}'
1717
headers:
1818
content-type:
1919
- application/json
2020
status:
2121
code: 200
2222
message: OK
2323
- request:
24-
body: '{"public_ids":["p5t-6vv-3xj"]}'
24+
body: '{"public_ids":["459-yrn-6c6"]}'
2525
headers:
2626
accept:
2727
- application/json
@@ -31,7 +31,7 @@ interactions:
3131
uri: https://api.datadoghq.com/api/v1/synthetics/tests/delete
3232
response:
3333
body:
34-
string: '{"deleted_tests":[{"public_id":"p5t-6vv-3xj","deleted_at":"2023-08-11T15:25:10.679107+00:00"}]}
34+
string: '{"deleted_tests":[{"public_id":"459-yrn-6c6","deleted_at":"2023-09-11T14:49:16.625763+00:00"}]}
3535
3636
'
3737
headers:

0 commit comments

Comments
 (0)