Skip to content
Open
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
55 changes: 55 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14597,6 +14597,61 @@ components:
oneOf:
- $ref: '#/components/schemas/SyntheticsAPITestStep'
- $ref: '#/components/schemas/SyntheticsAPIWaitStep'
- $ref: '#/components/schemas/SyntheticsAPISubtestStep'
SyntheticsAPISubtestStep:
description: The subtest step used in a Synthetics multi-step API test.
properties:
allowFailure:
description: Determines whether or not to continue with test if this step
fails.
type: boolean
alwaysExecute:
description: A boolean set to always execute this step even if the previous
step failed or was skipped.
type: boolean
exitIfSucceed:
description: Determines whether or not to exit the test if the step succeeds.
type: boolean
extractedValuesFromScript:
description: Generate variables using JavaScript.
type: string
id:
description: ID of the step.
example: abc-def-123
readOnly: true
type: string
isCritical:
description: 'Determines whether or not to consider the entire test as failed
if this step fails.

Can be used only if `allowFailure` is `true`.'
type: boolean
name:
description: The name of the step.
example: Example step name
type: string
retry:
$ref: '#/components/schemas/SyntheticsTestOptionsRetry'
subtestPublicId:
description: Public ID of the test to be played as part of a `playSubTest`
step type.
example: ''
type: string
subtype:
$ref: '#/components/schemas/SyntheticsAPISubtestStepSubtype'
required:
- name
- subtype
- subtestPublicId
type: object
SyntheticsAPISubtestStepSubtype:
description: The subtype of the Synthetic multi-step API subtest step.
enum:
- playSubTest
example: playSubTest
type: string
x-enum-varnames:
- PLAY_SUB_TEST
SyntheticsAPITest:
description: Object containing details about a Synthetic API test.
properties:
Expand Down
14 changes: 14 additions & 0 deletions docs/datadog_api_client.v1.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4106,6 +4106,20 @@ datadog\_api\_client.v1.model.synthetics\_api\_step module
:members:
:show-inheritance:

datadog\_api\_client.v1.model.synthetics\_api\_subtest\_step module
-------------------------------------------------------------------

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

datadog\_api\_client.v1.model.synthetics\_api\_subtest\_step\_subtype module
----------------------------------------------------------------------------

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

datadog\_api\_client.v1.model.synthetics\_api\_test module
----------------------------------------------------------

Expand Down
72 changes: 72 additions & 0 deletions examples/v1/synthetics/CreateSyntheticsAPITest_2106135939.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
"""
Create a multistep test with subtest returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_api_subtest_step import SyntheticsAPISubtestStep
from datadog_api_client.v1.model.synthetics_api_subtest_step_subtype import SyntheticsAPISubtestStepSubtype
from datadog_api_client.v1.model.synthetics_api_test import SyntheticsAPITest
from datadog_api_client.v1.model.synthetics_api_test_config import SyntheticsAPITestConfig
from datadog_api_client.v1.model.synthetics_api_test_step import SyntheticsAPITestStep
from datadog_api_client.v1.model.synthetics_api_test_step_subtype import SyntheticsAPITestStepSubtype
from datadog_api_client.v1.model.synthetics_api_test_type import SyntheticsAPITestType
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_type import SyntheticsAssertionType
from datadog_api_client.v1.model.synthetics_basic_auth_web import SyntheticsBasicAuthWeb
from datadog_api_client.v1.model.synthetics_test_details_sub_type import SyntheticsTestDetailsSubType
from datadog_api_client.v1.model.synthetics_test_options import SyntheticsTestOptions
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest

# there is a valid "synthetics_api_test" in the system
SYNTHETICS_API_TEST_PUBLIC_ID = environ["SYNTHETICS_API_TEST_PUBLIC_ID"]

body = SyntheticsAPITest(
config=SyntheticsAPITestConfig(
steps=[
SyntheticsAPITestStep(
assertions=[
SyntheticsAssertionTarget(
operator=SyntheticsAssertionOperator.IS,
type=SyntheticsAssertionType.STATUS_CODE,
target=200,
),
],
name="request is sent",
request=SyntheticsTestRequest(
url="https://httpbin.org/status/200",
method="GET",
basic_auth=SyntheticsBasicAuthWeb(
password="password",
username="username",
),
),
subtype=SyntheticsAPITestStepSubtype.HTTP,
),
SyntheticsAPISubtestStep(
subtype=SyntheticsAPISubtestStepSubtype.PLAY_SUB_TEST,
subtest_public_id=SYNTHETICS_API_TEST_PUBLIC_ID,
name="subtest step",
),
],
),
locations=[
"aws:us-east-2",
],
message="BDD test payload: synthetics_api_test_multi_step_with_subtest.json",
name="Example-Synthetic",
options=SyntheticsTestOptions(
tick_every=60,
),
subtype=SyntheticsTestDetailsSubType.MULTI,
type=SyntheticsAPITestType.API,
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = SyntheticsApi(api_client)
response = api_instance.create_synthetics_api_test(body=body)

print(response)
8 changes: 8 additions & 0 deletions src/datadog_api_client/v1/model/synthetics_api_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ def __init__(self, **kwargs):

:param value: The time to wait in seconds. Minimum value: 0. Maximum value: 180.
:type value: int

:param always_execute: A boolean set to always execute this step even if the previous step failed or was skipped.
:type always_execute: bool, optional

:param subtest_public_id: Public ID of the test to be played as part of a `playSubTest` step type.
:type subtest_public_id: str
"""
super().__init__(kwargs)

Expand All @@ -65,10 +71,12 @@ def _composed_schemas(_):
# loading
from datadog_api_client.v1.model.synthetics_api_test_step import SyntheticsAPITestStep
from datadog_api_client.v1.model.synthetics_api_wait_step import SyntheticsAPIWaitStep
from datadog_api_client.v1.model.synthetics_api_subtest_step import SyntheticsAPISubtestStep

return {
"oneOf": [
SyntheticsAPITestStep,
SyntheticsAPIWaitStep,
SyntheticsAPISubtestStep,
],
}
122 changes: 122 additions & 0 deletions src/datadog_api_client/v1/model/synthetics_api_subtest_step.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# 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 typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_api_subtest_step_subtype import SyntheticsAPISubtestStepSubtype


class SyntheticsAPISubtestStep(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_api_subtest_step_subtype import SyntheticsAPISubtestStepSubtype

return {
"allow_failure": (bool,),
"always_execute": (bool,),
"exit_if_succeed": (bool,),
"extracted_values_from_script": (str,),
"id": (str,),
"is_critical": (bool,),
"name": (str,),
"retry": (SyntheticsTestOptionsRetry,),
"subtest_public_id": (str,),
"subtype": (SyntheticsAPISubtestStepSubtype,),
}

attribute_map = {
"allow_failure": "allowFailure",
"always_execute": "alwaysExecute",
"exit_if_succeed": "exitIfSucceed",
"extracted_values_from_script": "extractedValuesFromScript",
"id": "id",
"is_critical": "isCritical",
"name": "name",
"retry": "retry",
"subtest_public_id": "subtestPublicId",
"subtype": "subtype",
}
read_only_vars = {
"id",
}

def __init__(
self_,
name: str,
subtest_public_id: str,
subtype: SyntheticsAPISubtestStepSubtype,
allow_failure: Union[bool, UnsetType] = unset,
always_execute: Union[bool, UnsetType] = unset,
exit_if_succeed: Union[bool, UnsetType] = unset,
extracted_values_from_script: Union[str, UnsetType] = unset,
id: Union[str, UnsetType] = unset,
is_critical: Union[bool, UnsetType] = unset,
retry: Union[SyntheticsTestOptionsRetry, UnsetType] = unset,
**kwargs,
):
"""
The subtest step used in a Synthetics multi-step API test.

:param allow_failure: Determines whether or not to continue with test if this step fails.
:type allow_failure: bool, optional

:param always_execute: A boolean set to always execute this step even if the previous step failed or was skipped.
:type always_execute: bool, optional

:param exit_if_succeed: Determines whether or not to exit the test if the step succeeds.
:type exit_if_succeed: bool, optional

:param extracted_values_from_script: Generate variables using JavaScript.
:type extracted_values_from_script: str, optional

:param id: ID of the step.
:type id: str, optional

:param is_critical: Determines whether or not to consider the entire test as failed if this step fails.
Can be used only if ``allowFailure`` is ``true``.
:type is_critical: bool, optional

:param name: The name of the step.
:type name: str

:param retry: Object describing the retry strategy to apply to a Synthetic test.
:type retry: SyntheticsTestOptionsRetry, optional

:param subtest_public_id: Public ID of the test to be played as part of a ``playSubTest`` step type.
:type subtest_public_id: str

:param subtype: The subtype of the Synthetic multi-step API subtest step.
:type subtype: SyntheticsAPISubtestStepSubtype
"""
if allow_failure is not unset:
kwargs["allow_failure"] = allow_failure
if always_execute is not unset:
kwargs["always_execute"] = always_execute
if exit_if_succeed is not unset:
kwargs["exit_if_succeed"] = exit_if_succeed
if extracted_values_from_script is not unset:
kwargs["extracted_values_from_script"] = extracted_values_from_script
if id is not unset:
kwargs["id"] = id
if is_critical is not unset:
kwargs["is_critical"] = is_critical
if retry is not unset:
kwargs["retry"] = retry
super().__init__(kwargs)

self_.name = name
self_.subtest_public_id = subtest_public_id
self_.subtype = subtype
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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 SyntheticsAPISubtestStepSubtype(ModelSimple):
"""
The subtype of the Synthetic multi-step API subtest step.

:param value: If omitted defaults to "playSubTest". Must be one of ["playSubTest"].
:type value: str
"""

allowed_values = {
"playSubTest",
}
PLAY_SUB_TEST: ClassVar["SyntheticsAPISubtestStepSubtype"]

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


SyntheticsAPISubtestStepSubtype.PLAY_SUB_TEST = SyntheticsAPISubtestStepSubtype("playSubTest")
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from datadog_api_client.v1.model.synthetics_assertion_javascript import SyntheticsAssertionJavascript
from datadog_api_client.v1.model.synthetics_api_test_step import SyntheticsAPITestStep
from datadog_api_client.v1.model.synthetics_api_wait_step import SyntheticsAPIWaitStep
from datadog_api_client.v1.model.synthetics_api_subtest_step import SyntheticsAPISubtestStep


class SyntheticsAPITestConfig(ModelNormal):
Expand Down Expand Up @@ -70,7 +71,10 @@ def __init__(
] = unset,
config_variables: Union[List[SyntheticsConfigVariable], UnsetType] = unset,
request: Union[SyntheticsTestRequest, UnsetType] = unset,
steps: Union[List[Union[SyntheticsAPIStep, SyntheticsAPITestStep, SyntheticsAPIWaitStep]], UnsetType] = unset,
steps: Union[
List[Union[SyntheticsAPIStep, SyntheticsAPITestStep, SyntheticsAPIWaitStep, SyntheticsAPISubtestStep]],
UnsetType,
] = unset,
variables_from_script: Union[str, UnsetType] = unset,
**kwargs,
):
Expand Down
4 changes: 4 additions & 0 deletions src/datadog_api_client/v1/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,8 @@
from datadog_api_client.v1.model.sunburst_widget_legend_table_type import SunburstWidgetLegendTableType
from datadog_api_client.v1.model.sunburst_widget_request import SunburstWidgetRequest
from datadog_api_client.v1.model.synthetics_api_step import SyntheticsAPIStep
from datadog_api_client.v1.model.synthetics_api_subtest_step import SyntheticsAPISubtestStep
from datadog_api_client.v1.model.synthetics_api_subtest_step_subtype import SyntheticsAPISubtestStepSubtype
from datadog_api_client.v1.model.synthetics_api_test import SyntheticsAPITest
from datadog_api_client.v1.model.synthetics_api_test_config import SyntheticsAPITestConfig
from datadog_api_client.v1.model.synthetics_api_test_result_data import SyntheticsAPITestResultData
Expand Down Expand Up @@ -1709,6 +1711,8 @@
"SunburstWidgetLegendTableType",
"SunburstWidgetRequest",
"SyntheticsAPIStep",
"SyntheticsAPISubtestStep",
"SyntheticsAPISubtestStepSubtype",
"SyntheticsAPITest",
"SyntheticsAPITestConfig",
"SyntheticsAPITestResultData",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-12-26T15:22:45.114Z
Loading