-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathsynthetics_api_test_step.rb
More file actions
261 lines (219 loc) · 7.97 KB
/
Copy pathsynthetics_api_test_step.rb
File metadata and controls
261 lines (219 loc) · 7.97 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
=begin
#Datadog API V1 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
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 2020-Present Datadog, Inc.
=end
require 'date'
require 'time'
module DatadogAPIClient::V1
# The Test step used in a Synthetic multi-step API test.
class SyntheticsAPITestStep
include BaseGenericModel
# Determines whether or not to continue with test if this step fails.
attr_accessor :allow_failure
# Array of assertions used for the test.
attr_reader :assertions
# Determines whether or not to exit the test if the step succeeds.
attr_accessor :exit_if_succeed
# Array of values to parse and save as variables from the response.
attr_accessor :extracted_values
# Generate variables using JavaScript.
attr_accessor :extracted_values_from_script
# ID of the step.
attr_accessor :id
# Determines whether or not to consider the entire test as failed if this step fails.
# Can be used only if `allowFailure` is `true`.
attr_accessor :is_critical
# The name of the step.
attr_reader :name
# Object describing the Synthetic test request.
attr_reader :request
# Object describing the retry strategy to apply to a Synthetic test.
attr_accessor :_retry
# The subtype of the Synthetic multi-step API test step.
attr_reader :subtype
attr_accessor :additional_properties
# Attribute mapping from ruby-style variable name to JSON key.
# @!visibility private
def self.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'
}
end
# Attribute type mapping.
# @!visibility private
def self.openapi_types
{
:'allow_failure' => :'Boolean',
:'assertions' => :'Array<SyntheticsAssertion>',
:'exit_if_succeed' => :'Boolean',
:'extracted_values' => :'Array<SyntheticsParsingOptions>',
:'extracted_values_from_script' => :'String',
:'id' => :'String',
:'is_critical' => :'Boolean',
:'name' => :'String',
:'request' => :'SyntheticsTestRequest',
:'_retry' => :'SyntheticsTestOptionsRetry',
:'subtype' => :'SyntheticsAPITestStepSubtype'
}
end
# Initializes the object
# @param attributes [Hash] Model attributes in the form of hash
# @!visibility private
def initialize(attributes = {})
if (!attributes.is_a?(Hash))
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::SyntheticsAPITestStep` initialize method"
end
self.additional_properties = {}
# check to see if the attribute exists and convert string to symbol for hash key
attributes = attributes.each_with_object({}) { |(k, v), h|
if (!self.class.attribute_map.key?(k.to_sym))
self.additional_properties[k.to_sym] = v
else
h[k.to_sym] = v
end
}
if attributes.key?(:'allow_failure')
self.allow_failure = attributes[:'allow_failure']
end
if attributes.key?(:'assertions')
if (value = attributes[:'assertions']).is_a?(Array)
self.assertions = value
end
end
if attributes.key?(:'exit_if_succeed')
self.exit_if_succeed = attributes[:'exit_if_succeed']
end
if attributes.key?(:'extracted_values')
if (value = attributes[:'extracted_values']).is_a?(Array)
self.extracted_values = value
end
end
if attributes.key?(:'extracted_values_from_script')
self.extracted_values_from_script = attributes[:'extracted_values_from_script']
end
if attributes.key?(:'id')
self.id = attributes[:'id']
end
if attributes.key?(:'is_critical')
self.is_critical = attributes[:'is_critical']
end
if attributes.key?(:'name')
self.name = attributes[:'name']
end
if attributes.key?(:'request')
self.request = attributes[:'request']
end
if attributes.key?(:'_retry')
self._retry = attributes[:'_retry']
end
if attributes.key?(:'subtype')
self.subtype = attributes[:'subtype']
end
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
# @!visibility private
def valid?
return false if @assertions.nil?
return false if @name.nil?
return false if @request.nil?
return false if @subtype.nil?
true
end
# Custom attribute writer method with validation
# @param assertions [Object] Object to be assigned
# @!visibility private
def assertions=(assertions)
if assertions.nil?
fail ArgumentError, 'invalid value for "assertions", assertions cannot be nil.'
end
@assertions = assertions
end
# Custom attribute writer method with validation
# @param name [Object] Object to be assigned
# @!visibility private
def name=(name)
if name.nil?
fail ArgumentError, 'invalid value for "name", name cannot be nil.'
end
@name = name
end
# Custom attribute writer method with validation
# @param request [Object] Object to be assigned
# @!visibility private
def request=(request)
if request.nil?
fail ArgumentError, 'invalid value for "request", request cannot be nil.'
end
@request = request
end
# Custom attribute writer method with validation
# @param subtype [Object] Object to be assigned
# @!visibility private
def subtype=(subtype)
if subtype.nil?
fail ArgumentError, 'invalid value for "subtype", subtype cannot be nil.'
end
@subtype = subtype
end
# Returns the object in the form of hash, with additionalProperties support.
# @return [Hash] Returns the object in the form of hash
# @!visibility private
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
if value.nil?
is_nullable = self.class.openapi_nullable.include?(attr)
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
end
hash[param] = _to_hash(value)
end
self.additional_properties.each_pair do |attr, value|
hash[attr] = value
end
hash
end
# Checks equality by comparing each attribute.
# @param o [Object] Object to be compared
# @!visibility private
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
allow_failure == o.allow_failure &&
assertions == o.assertions &&
exit_if_succeed == o.exit_if_succeed &&
extracted_values == o.extracted_values &&
extracted_values_from_script == o.extracted_values_from_script &&
id == o.id &&
is_critical == o.is_critical &&
name == o.name &&
request == o.request &&
_retry == o._retry &&
subtype == o.subtype &&
additional_properties == o.additional_properties
end
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
# @!visibility private
def hash
[allow_failure, assertions, exit_if_succeed, extracted_values, extracted_values_from_script, id, is_critical, name, request, _retry, subtype, additional_properties].hash
end
end
end