-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathsynthetics_api_test_step.py
More file actions
134 lines (113 loc) · 5.29 KB
/
synthetics_api_test_step.py
File metadata and controls
134 lines (113 loc) · 5.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# 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 List, 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_parsing_options import SyntheticsParsingOptions
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_api_test_step_subtype import SyntheticsAPITestStepSubtype
class SyntheticsAPITestStep(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v1.model.synthetics_assertion import SyntheticsAssertion
from datadog_api_client.v1.model.synthetics_parsing_options import SyntheticsParsingOptions
from datadog_api_client.v1.model.synthetics_test_request import SyntheticsTestRequest
from datadog_api_client.v1.model.synthetics_test_options_retry import SyntheticsTestOptionsRetry
from datadog_api_client.v1.model.synthetics_api_test_step_subtype import SyntheticsAPITestStepSubtype
return {
"allow_failure": (bool,),
"assertions": ([SyntheticsAssertion],),
"exit_if_succeed": (bool,),
"extracted_values": ([SyntheticsParsingOptions],),
"extracted_values_from_script": (str,),
"id": (str,),
"is_critical": (bool,),
"name": (str,),
"request": (SyntheticsTestRequest,),
"retry": (SyntheticsTestOptionsRetry,),
"subtype": (SyntheticsAPITestStepSubtype,),
}
attribute_map = {
"allow_failure": "allowFailure",
"assertions": "assertions",
"exit_if_succeed": "exitIfSucceed",
"extracted_values": "extractedValues",
"extracted_values_from_script": "extractedValuesFromScript",
"id": "id",
"is_critical": "isCritical",
"name": "name",
"request": "request",
"retry": "retry",
"subtype": "subtype",
}
read_only_vars = {
"id",
}
def __init__(
self_,
name: str,
request: SyntheticsTestRequest,
subtype: SyntheticsAPITestStepSubtype,
allow_failure: Union[bool, UnsetType] = unset,
exit_if_succeed: Union[bool, UnsetType] = unset,
extracted_values: Union[List[SyntheticsParsingOptions], 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 Test step used in a Synthetic 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 assertions: Array of assertions used for the test.
:type assertions: [SyntheticsAssertion]
: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: Array of values to parse and save as variables from the response.
:type extracted_values: [SyntheticsParsingOptions], 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 request: Object describing the Synthetic test request.
:type request: SyntheticsTestRequest
:param retry: Object describing the retry strategy to apply to a Synthetic test.
:type retry: SyntheticsTestOptionsRetry, optional
:param subtype: The subtype of the Synthetic multi-step API test step.
:type subtype: SyntheticsAPITestStepSubtype
"""
if allow_failure is not unset:
kwargs["allow_failure"] = allow_failure
if exit_if_succeed is not unset:
kwargs["exit_if_succeed"] = exit_if_succeed
if extracted_values is not unset:
kwargs["extracted_values"] = extracted_values
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)
assertions = kwargs.get("assertions", [])
self_.assertions = assertions
self_.name = name
self_.request = request
self_.subtype = subtype