Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timing scope for response time assertions #1651

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.5",
"regenerated": "2023-09-12 17:52:26.336386",
"spec_repo_commit": "752c972d"
"regenerated": "2023-09-12 20:28:32.678363",
"spec_repo_commit": "bc2ae18f"
},
"v2": {
"apigentools_version": "1.6.5",
"regenerated": "2023-09-12 17:52:26.350823",
"spec_repo_commit": "752c972d"
"regenerated": "2023-09-12 20:28:32.694366",
"spec_repo_commit": "bc2ae18f"
}
}
}
11 changes: 11 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12575,13 +12575,24 @@ components:
target:
description: Value used by the operator.
example: 123456
timingsScope:
$ref: '#/components/schemas/SyntheticsAssertionTimingsScope'
type:
$ref: '#/components/schemas/SyntheticsAssertionType'
required:
- type
- operator
- target
type: object
SyntheticsAssertionTimingsScope:
description: Timings scope for response time assertions.
enum:
- all
- withoutDNS
type: string
x-enum-varnames:
- ALL
- WITHOUT_DNS
SyntheticsAssertionType:
description: Type of the assertion.
enum:
Expand Down
7 changes: 7 additions & 0 deletions docs/datadog_api_client.v1.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3641,6 +3641,13 @@ synthetics\_assertion\_target
:members:
:show-inheritance:

synthetics\_assertion\_timings\_scope
-------------------------------------

.. automodule:: datadog_api_client.v1.model.synthetics_assertion_timings_scope
:members:
:show-inheritance:

synthetics\_assertion\_type
---------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
)
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType
from datadog_api_client.v1.model.synthetics_assertion_x_path_operator import SyntheticsAssertionXPathOperator
from datadog_api_client.v1.model.synthetics_assertion_x_path_target import SyntheticsAssertionXPathTarget
Expand Down Expand Up @@ -48,6 +49,7 @@
operator=SyntheticsAssertionOperator.LESS_THAN,
target=2000,
type=SyntheticsAssertionType.RESPONSE_TIME,
timings_scope=SyntheticsAssertionTimingsScope.WITHOUT_DNS,
),
SyntheticsAssertionJSONPathTarget(
operator=SyntheticsAssertionJSONPathOperator.VALIDATES_JSON_PATH,
Expand Down
3 changes: 3 additions & 0 deletions src/datadog_api_client/v1/model/synthetics_assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def __init__(self, **kwargs):
:param target: Value used by the operator.
:type target: bool, date, datetime, dict, float, int, list, str, none_type

:param timings_scope: Timings scope for response time assertions.
:type timings_scope: SyntheticsAssertionTimingsScope, optional

:param type: Type of the assertion.
:type type: SyntheticsAssertionType
"""
Expand Down
10 changes: 10 additions & 0 deletions src/datadog_api_client/v1/model/synthetics_assertion_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@

if TYPE_CHECKING:
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType


class SyntheticsAssertionTarget(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType

return {
Expand All @@ -41,13 +43,15 @@ def openapi_types(_):
str,
none_type,
),
"timings_scope": (SyntheticsAssertionTimingsScope,),
"type": (SyntheticsAssertionType,),
}

attribute_map = {
"operator": "operator",
"_property": "property",
"target": "target",
"timings_scope": "timingsScope",
"type": "type",
}

Expand All @@ -57,6 +61,7 @@ def __init__(
target: Any,
type: SyntheticsAssertionType,
_property: Union[str, UnsetType] = unset,
timings_scope: Union[SyntheticsAssertionTimingsScope, UnsetType] = unset,
**kwargs,
):
"""
Expand All @@ -71,11 +76,16 @@ def __init__(
:param target: Value used by the operator.
:type target: bool, date, datetime, dict, float, int, list, str, none_type

:param timings_scope: Timings scope for response time assertions.
:type timings_scope: SyntheticsAssertionTimingsScope, optional

:param type: Type of the assertion.
:type type: SyntheticsAssertionType
"""
if _property is not unset:
kwargs["_property"] = _property
if timings_scope is not unset:
kwargs["timings_scope"] = timings_scope
super().__init__(kwargs)

self_.operator = operator
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelSimple,
cached_property,
)

from typing import ClassVar


class SyntheticsAssertionTimingsScope(ModelSimple):
"""
Timings scope for response time assertions.

:param value: Must be one of ["all", "withoutDNS"].
:type value: str
"""

allowed_values = {
"all",
"withoutDNS",
}
ALL: ClassVar["SyntheticsAssertionTimingsScope"]
WITHOUT_DNS: ClassVar["SyntheticsAssertionTimingsScope"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


SyntheticsAssertionTimingsScope.ALL = SyntheticsAssertionTimingsScope("all")
SyntheticsAssertionTimingsScope.WITHOUT_DNS = SyntheticsAssertionTimingsScope("withoutDNS")
2 changes: 2 additions & 0 deletions src/datadog_api_client/v1/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@
)
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType
from datadog_api_client.v1.model.synthetics_assertion_x_path_operator import SyntheticsAssertionXPathOperator
from datadog_api_client.v1.model.synthetics_assertion_x_path_target import SyntheticsAssertionXPathTarget
Expand Down Expand Up @@ -1439,6 +1440,7 @@
"SyntheticsAssertionJSONPathTargetTarget",
"SyntheticsAssertionOperator",
"SyntheticsAssertionTarget",
"SyntheticsAssertionTimingsScope",
"SyntheticsAssertionType",
"SyntheticsAssertionXPathOperator",
"SyntheticsAssertionXPathTarget",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-08-11T15:25:10.265Z
2023-09-11T14:49:13.966Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
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
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"}'
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
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"}'
headers:
accept:
- application/json
Expand All @@ -11,17 +11,17 @@ interactions:
uri: https://api.datadoghq.com/api/v1/synthetics/tests/api
response:
body:
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":"{{
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
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]"}}'
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":"{{
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
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]"}}'
headers:
content-type:
- application/json
status:
code: 200
message: OK
- request:
body: '{"public_ids":["p5t-6vv-3xj"]}'
body: '{"public_ids":["459-yrn-6c6"]}'
headers:
accept:
- application/json
Expand All @@ -31,7 +31,7 @@ interactions:
uri: https://api.datadoghq.com/api/v1/synthetics/tests/delete
response:
body:
string: '{"deleted_tests":[{"public_id":"p5t-6vv-3xj","deleted_at":"2023-08-11T15:25:10.679107+00:00"}]}
string: '{"deleted_tests":[{"public_id":"459-yrn-6c6","deleted_at":"2023-09-11T14:49:16.625763+00:00"}]}

'
headers:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-08-11T15:25:10.775Z
2023-09-11T14:49:16.770Z
Loading