|
| 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 | +from typing import Union, TYPE_CHECKING |
| 7 | + |
| 8 | +from datadog_api_client.model_utils import ( |
| 9 | + ModelNormal, |
| 10 | + cached_property, |
| 11 | + unset, |
| 12 | + UnsetType, |
| 13 | +) |
| 14 | + |
| 15 | + |
| 16 | +if TYPE_CHECKING: |
| 17 | + from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry |
| 18 | + from datadog_api_client.v1.model.synthetics_api_subtest_step_subtype import SyntheticsAPISubtestStepSubtype |
| 19 | + |
| 20 | + |
| 21 | +class SyntheticsAPISubtestStep(ModelNormal): |
| 22 | + @cached_property |
| 23 | + def openapi_types(_): |
| 24 | + from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry |
| 25 | + from datadog_api_client.v1.model.synthetics_api_subtest_step_subtype import SyntheticsAPISubtestStepSubtype |
| 26 | + |
| 27 | + return { |
| 28 | + "allow_failure": (bool,), |
| 29 | + "always_execute": (bool,), |
| 30 | + "exit_if_succeed": (bool,), |
| 31 | + "extracted_values_from_script": (str,), |
| 32 | + "id": (str,), |
| 33 | + "is_critical": (bool,), |
| 34 | + "name": (str,), |
| 35 | + "retry": (SyntheticsTestOptionsRetry,), |
| 36 | + "subtest_public_id": (str,), |
| 37 | + "subtype": (SyntheticsAPISubtestStepSubtype,), |
| 38 | + } |
| 39 | + |
| 40 | + attribute_map = { |
| 41 | + "allow_failure": "allowFailure", |
| 42 | + "always_execute": "alwaysExecute", |
| 43 | + "exit_if_succeed": "exitIfSucceed", |
| 44 | + "extracted_values_from_script": "extractedValuesFromScript", |
| 45 | + "id": "id", |
| 46 | + "is_critical": "isCritical", |
| 47 | + "name": "name", |
| 48 | + "retry": "retry", |
| 49 | + "subtest_public_id": "subtestPublicId", |
| 50 | + "subtype": "subtype", |
| 51 | + } |
| 52 | + read_only_vars = { |
| 53 | + "id", |
| 54 | + } |
| 55 | + |
| 56 | + def __init__( |
| 57 | + self_, |
| 58 | + name: str, |
| 59 | + subtest_public_id: str, |
| 60 | + subtype: SyntheticsAPISubtestStepSubtype, |
| 61 | + allow_failure: Union[bool, UnsetType] = unset, |
| 62 | + always_execute: Union[bool, UnsetType] = unset, |
| 63 | + exit_if_succeed: Union[bool, UnsetType] = unset, |
| 64 | + extracted_values_from_script: Union[str, UnsetType] = unset, |
| 65 | + id: Union[str, UnsetType] = unset, |
| 66 | + is_critical: Union[bool, UnsetType] = unset, |
| 67 | + retry: Union[SyntheticsTestOptionsRetry, UnsetType] = unset, |
| 68 | + **kwargs, |
| 69 | + ): |
| 70 | + """ |
| 71 | + The subtest step used in a Synthetics multi-step API test. |
| 72 | +
|
| 73 | + :param allow_failure: Determines whether or not to continue with test if this step fails. |
| 74 | + :type allow_failure: bool, optional |
| 75 | +
|
| 76 | + :param always_execute: A boolean set to always execute this step even if the previous step failed or was skipped. |
| 77 | + :type always_execute: bool, optional |
| 78 | +
|
| 79 | + :param exit_if_succeed: Determines whether or not to exit the test if the step succeeds. |
| 80 | + :type exit_if_succeed: bool, optional |
| 81 | +
|
| 82 | + :param extracted_values_from_script: Generate variables using JavaScript. |
| 83 | + :type extracted_values_from_script: str, optional |
| 84 | +
|
| 85 | + :param id: ID of the step. |
| 86 | + :type id: str, optional |
| 87 | +
|
| 88 | + :param is_critical: Determines whether or not to consider the entire test as failed if this step fails. |
| 89 | + Can be used only if ``allowFailure`` is ``true``. |
| 90 | + :type is_critical: bool, optional |
| 91 | +
|
| 92 | + :param name: The name of the step. |
| 93 | + :type name: str |
| 94 | +
|
| 95 | + :param retry: Object describing the retry strategy to apply to a Synthetic test. |
| 96 | + :type retry: SyntheticsTestOptionsRetry, optional |
| 97 | +
|
| 98 | + :param subtest_public_id: Public ID of the test to be played as part of a ``playSubTest`` step type. |
| 99 | + :type subtest_public_id: str |
| 100 | +
|
| 101 | + :param subtype: The subtype of the Synthetic multi-step API subtest step. |
| 102 | + :type subtype: SyntheticsAPISubtestStepSubtype |
| 103 | + """ |
| 104 | + if allow_failure is not unset: |
| 105 | + kwargs["allow_failure"] = allow_failure |
| 106 | + if always_execute is not unset: |
| 107 | + kwargs["always_execute"] = always_execute |
| 108 | + if exit_if_succeed is not unset: |
| 109 | + kwargs["exit_if_succeed"] = exit_if_succeed |
| 110 | + if extracted_values_from_script is not unset: |
| 111 | + kwargs["extracted_values_from_script"] = extracted_values_from_script |
| 112 | + if id is not unset: |
| 113 | + kwargs["id"] = id |
| 114 | + if is_critical is not unset: |
| 115 | + kwargs["is_critical"] = is_critical |
| 116 | + if retry is not unset: |
| 117 | + kwargs["retry"] = retry |
| 118 | + super().__init__(kwargs) |
| 119 | + |
| 120 | + self_.name = name |
| 121 | + self_.subtest_public_id = subtest_public_id |
| 122 | + self_.subtype = subtype |
0 commit comments