smplkit 3.0.82 → 3.0.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/jobs_api.rb +420 -0
  3. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb +281 -0
  4. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/usage_api.rb +82 -0
  5. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api_client.rb +441 -0
  6. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api_error.rb +58 -0
  7. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api_model_base.rb +88 -0
  8. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/configuration.rb +392 -0
  9. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/http_header.rb +220 -0
  10. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job.rb +401 -0
  11. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_create_request.rb +165 -0
  12. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_create_resource.rb +237 -0
  13. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_http_configuration.rb +368 -0
  14. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_list_response.rb +193 -0
  15. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_request.rb +165 -0
  16. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_resource.rb +186 -0
  17. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_response.rb +165 -0
  18. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/list_meta.rb +165 -0
  19. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/pagination_meta.rb +215 -0
  20. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb +405 -0
  21. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_list_links.rb +149 -0
  22. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_list_meta.rb +166 -0
  23. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_list_response.rb +203 -0
  24. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_resource.rb +202 -0
  25. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_response.rb +165 -0
  26. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/usage.rb +274 -0
  27. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/usage_resource.rb +187 -0
  28. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/usage_response.rb +165 -0
  29. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/version.rb +15 -0
  30. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client.rb +63 -0
  31. data/lib/smplkit/_generated/jobs/spec/api/jobs_api_spec.rb +111 -0
  32. data/lib/smplkit/_generated/jobs/spec/api/runs_api_spec.rb +85 -0
  33. data/lib/smplkit/_generated/jobs/spec/api/usage_api_spec.rb +47 -0
  34. data/lib/smplkit/_generated/jobs/spec/models/http_header_spec.rb +42 -0
  35. data/lib/smplkit/_generated/jobs/spec/models/job_create_request_spec.rb +36 -0
  36. data/lib/smplkit/_generated/jobs/spec/models/job_create_resource_spec.rb +52 -0
  37. data/lib/smplkit/_generated/jobs/spec/models/job_http_configuration_spec.rb +82 -0
  38. data/lib/smplkit/_generated/jobs/spec/models/job_list_response_spec.rb +42 -0
  39. data/lib/smplkit/_generated/jobs/spec/models/job_request_spec.rb +36 -0
  40. data/lib/smplkit/_generated/jobs/spec/models/job_resource_spec.rb +48 -0
  41. data/lib/smplkit/_generated/jobs/spec/models/job_response_spec.rb +36 -0
  42. data/lib/smplkit/_generated/jobs/spec/models/job_spec.rb +110 -0
  43. data/lib/smplkit/_generated/jobs/spec/models/list_meta_spec.rb +36 -0
  44. data/lib/smplkit/_generated/jobs/spec/models/pagination_meta_spec.rb +54 -0
  45. data/lib/smplkit/_generated/jobs/spec/models/run_list_links_spec.rb +36 -0
  46. data/lib/smplkit/_generated/jobs/spec/models/run_list_meta_spec.rb +36 -0
  47. data/lib/smplkit/_generated/jobs/spec/models/run_list_response_spec.rb +48 -0
  48. data/lib/smplkit/_generated/jobs/spec/models/run_resource_spec.rb +48 -0
  49. data/lib/smplkit/_generated/jobs/spec/models/run_response_spec.rb +36 -0
  50. data/lib/smplkit/_generated/jobs/spec/models/run_spec.rb +138 -0
  51. data/lib/smplkit/_generated/jobs/spec/models/usage_resource_spec.rb +48 -0
  52. data/lib/smplkit/_generated/jobs/spec/models/usage_response_spec.rb +36 -0
  53. data/lib/smplkit/_generated/jobs/spec/models/usage_spec.rb +60 -0
  54. data/lib/smplkit/_generated/jobs/spec/spec_helper.rb +111 -0
  55. metadata +54 -1
@@ -0,0 +1,237 @@
1
+ =begin
2
+ #smplkit Jobs API
3
+
4
+ #Scheduled HTTP job execution API for smplkit.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::Jobs
17
+ # JSON:API resource envelope for creating a job (id required).
18
+ class JobCreateResource < ApiModelBase
19
+ # Client-supplied resource id.
20
+ attr_accessor :id
21
+
22
+ attr_accessor :type
23
+
24
+ attr_accessor :attributes
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'id' => :'id',
52
+ :'type' => :'type',
53
+ :'attributes' => :'attributes'
54
+ }
55
+ end
56
+
57
+ # Returns attribute mapping this model knows about
58
+ def self.acceptable_attribute_map
59
+ attribute_map
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ acceptable_attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'id' => :'String',
71
+ :'type' => :'String',
72
+ :'attributes' => :'Job'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::JobCreateResource` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ acceptable_attribute_map = self.class.acceptable_attribute_map
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!acceptable_attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::JobCreateResource`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'id')
99
+ self.id = attributes[:'id']
100
+ else
101
+ self.id = nil
102
+ end
103
+
104
+ if attributes.key?(:'type')
105
+ self.type = attributes[:'type']
106
+ else
107
+ self.type = 'job'
108
+ end
109
+
110
+ if attributes.key?(:'attributes')
111
+ self.attributes = attributes[:'attributes']
112
+ else
113
+ self.attributes = nil
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
121
+ invalid_properties = Array.new
122
+ if @id.nil?
123
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
124
+ end
125
+
126
+ if @attributes.nil?
127
+ invalid_properties.push('invalid value for "attributes", attributes cannot be nil.')
128
+ end
129
+
130
+ invalid_properties
131
+ end
132
+
133
+ # Check to see if the all the properties in the model are valid
134
+ # @return true if the model is valid
135
+ def valid?
136
+ warn '[DEPRECATED] the `valid?` method is obsolete'
137
+ return false if @id.nil?
138
+ type_validator = EnumAttributeValidator.new('String', ["job"])
139
+ return false unless type_validator.valid?(@type)
140
+ return false if @attributes.nil?
141
+ true
142
+ end
143
+
144
+ # Custom attribute writer method with validation
145
+ # @param [Object] id Value to be assigned
146
+ def id=(id)
147
+ if id.nil?
148
+ fail ArgumentError, 'id cannot be nil'
149
+ end
150
+
151
+ @id = id
152
+ end
153
+
154
+ # Custom attribute writer method checking allowed values (enum).
155
+ # @param [Object] type Object to be assigned
156
+ def type=(type)
157
+ validator = EnumAttributeValidator.new('String', ["job"])
158
+ unless validator.valid?(type)
159
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
160
+ end
161
+ @type = type
162
+ end
163
+
164
+ # Custom attribute writer method with validation
165
+ # @param [Object] attributes Value to be assigned
166
+ def attributes=(attributes)
167
+ if attributes.nil?
168
+ fail ArgumentError, 'attributes cannot be nil'
169
+ end
170
+
171
+ @attributes = attributes
172
+ end
173
+
174
+ # Checks equality by comparing each attribute.
175
+ # @param [Object] Object to be compared
176
+ def ==(o)
177
+ return true if self.equal?(o)
178
+ self.class == o.class &&
179
+ id == o.id &&
180
+ type == o.type &&
181
+ attributes == o.attributes
182
+ end
183
+
184
+ # @see the `==` method
185
+ # @param [Object] Object to be compared
186
+ def eql?(o)
187
+ self == o
188
+ end
189
+
190
+ # Calculates hash code according to all attributes.
191
+ # @return [Integer] Hash code
192
+ def hash
193
+ [id, type, attributes].hash
194
+ end
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def self.build_from_hash(attributes)
200
+ return nil unless attributes.is_a?(Hash)
201
+ attributes = attributes.transform_keys(&:to_sym)
202
+ transformed_hash = {}
203
+ openapi_types.each_pair do |key, type|
204
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
205
+ transformed_hash["#{key}"] = nil
206
+ elsif type =~ /\AArray<(.*)>/i
207
+ # check to ensure the input is an array given that the attribute
208
+ # is documented as an array but the input is not
209
+ if attributes[attribute_map[key]].is_a?(Array)
210
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
211
+ end
212
+ elsif !attributes[attribute_map[key]].nil?
213
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
214
+ end
215
+ end
216
+ new(transformed_hash)
217
+ end
218
+
219
+ # Returns the object in the form of hash
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_hash
222
+ hash = {}
223
+ self.class.attribute_map.each_pair do |attr, param|
224
+ value = self.send(attr)
225
+ if value.nil?
226
+ is_nullable = self.class.openapi_nullable.include?(attr)
227
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
228
+ end
229
+
230
+ hash[param] = _to_hash(value)
231
+ end
232
+ hash
233
+ end
234
+
235
+ end
236
+
237
+ end
@@ -0,0 +1,368 @@
1
+ =begin
2
+ #smplkit Jobs API
3
+
4
+ #Scheduled HTTP job execution API for smplkit.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::Jobs
17
+ # HTTP request a job performs when it fires. Extends the shared forwarder configuration with the two fields a scheduled job needs beyond a forwarder.
18
+ class JobHttpConfiguration < ApiModelBase
19
+ # HTTP method used when delivering the request.
20
+ attr_accessor :method
21
+
22
+ # Destination URL. Must be an absolute `http://` or `https://` URL with a hostname (e.g. `https://siem.example.com/in`).
23
+ attr_accessor :url
24
+
25
+ # HTTP headers attached to each request.
26
+ attr_accessor :headers
27
+
28
+ # HTTP response status that indicates success. Either a specific status code (e.g. `200`, `204`) or a status class (`1xx`, `2xx`, `3xx`, `4xx`, `5xx`).
29
+ attr_accessor :success_status
30
+
31
+ # Whether to verify the destination server's TLS certificate against trusted certificate authorities. Defaults to `true` and should be left on for any production destination. Set to `false` only for development or short-lived testing against a destination that presents an untrusted certificate (e.g. a Splunk Cloud trial stack on `:8088` serving its default self-signed certificate). When `false`, deliveries proceed without certificate verification — they are vulnerable to man-in-the-middle attacks. For long-lived self-signed setups, pin the issuing CA via `ca_cert` instead of disabling verification entirely.
32
+ attr_accessor :tls_verify
33
+
34
+ # Optional PEM-encoded certificate (or bundle) used to verify the destination server's TLS certificate, in addition to the system trust store. Use this to pin a private or self-signed CA (e.g. Splunk's default `SplunkCommonCA`) without disabling verification entirely via `tls_verify`. Must contain one or more `-----BEGIN CERTIFICATE-----` blocks. Ignored when `tls_verify` is `false`.
35
+ attr_accessor :ca_cert
36
+
37
+ # Request body sent on each run. When omitted, an empty body is sent (suitable for a connectivity ping). Sent verbatim — pair with a matching `Content-Type` header. Limit 1 MiB.
38
+ attr_accessor :body
39
+
40
+ # Per-run timeout in **seconds**. A run that does not complete within this many seconds fails with reason `TIMEOUT`. Bounded by your plan's maximum timeout.
41
+ attr_accessor :timeout
42
+
43
+ class EnumAttributeValidator
44
+ attr_reader :datatype
45
+ attr_reader :allowable_values
46
+
47
+ def initialize(datatype, allowable_values)
48
+ @allowable_values = allowable_values.map do |value|
49
+ case datatype.to_s
50
+ when /Integer/i
51
+ value.to_i
52
+ when /Float/i
53
+ value.to_f
54
+ else
55
+ value
56
+ end
57
+ end
58
+ end
59
+
60
+ def valid?(value)
61
+ !value || allowable_values.include?(value)
62
+ end
63
+ end
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'method' => :'method',
69
+ :'url' => :'url',
70
+ :'headers' => :'headers',
71
+ :'success_status' => :'success_status',
72
+ :'tls_verify' => :'tls_verify',
73
+ :'ca_cert' => :'ca_cert',
74
+ :'body' => :'body',
75
+ :'timeout' => :'timeout'
76
+ }
77
+ end
78
+
79
+ # Returns attribute mapping this model knows about
80
+ def self.acceptable_attribute_map
81
+ attribute_map
82
+ end
83
+
84
+ # Returns all the JSON keys this model knows about
85
+ def self.acceptable_attributes
86
+ acceptable_attribute_map.values
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.openapi_types
91
+ {
92
+ :'method' => :'String',
93
+ :'url' => :'String',
94
+ :'headers' => :'Array<HttpHeader>',
95
+ :'success_status' => :'String',
96
+ :'tls_verify' => :'Boolean',
97
+ :'ca_cert' => :'String',
98
+ :'body' => :'String',
99
+ :'timeout' => :'Integer'
100
+ }
101
+ end
102
+
103
+ # List of attributes with nullable: true
104
+ def self.openapi_nullable
105
+ Set.new([
106
+ :'ca_cert',
107
+ :'body',
108
+ ])
109
+ end
110
+
111
+ # Initializes the object
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ def initialize(attributes = {})
114
+ if (!attributes.is_a?(Hash))
115
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::JobHttpConfiguration` initialize method"
116
+ end
117
+
118
+ # check to see if the attribute exists and convert string to symbol for hash key
119
+ acceptable_attribute_map = self.class.acceptable_attribute_map
120
+ attributes = attributes.each_with_object({}) { |(k, v), h|
121
+ if (!acceptable_attribute_map.key?(k.to_sym))
122
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::JobHttpConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
123
+ end
124
+ h[k.to_sym] = v
125
+ }
126
+
127
+ if attributes.key?(:'method')
128
+ self.method = attributes[:'method']
129
+ else
130
+ self.method = 'POST'
131
+ end
132
+
133
+ if attributes.key?(:'url')
134
+ self.url = attributes[:'url']
135
+ else
136
+ self.url = nil
137
+ end
138
+
139
+ if attributes.key?(:'headers')
140
+ if (value = attributes[:'headers']).is_a?(Array)
141
+ self.headers = value
142
+ end
143
+ end
144
+
145
+ if attributes.key?(:'success_status')
146
+ self.success_status = attributes[:'success_status']
147
+ else
148
+ self.success_status = '2xx'
149
+ end
150
+
151
+ if attributes.key?(:'tls_verify')
152
+ self.tls_verify = attributes[:'tls_verify']
153
+ else
154
+ self.tls_verify = true
155
+ end
156
+
157
+ if attributes.key?(:'ca_cert')
158
+ self.ca_cert = attributes[:'ca_cert']
159
+ end
160
+
161
+ if attributes.key?(:'body')
162
+ self.body = attributes[:'body']
163
+ end
164
+
165
+ if attributes.key?(:'timeout')
166
+ self.timeout = attributes[:'timeout']
167
+ else
168
+ self.timeout = 30
169
+ end
170
+ end
171
+
172
+ # Show invalid properties with the reasons. Usually used together with valid?
173
+ # @return Array for valid properties with the reasons
174
+ def list_invalid_properties
175
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
176
+ invalid_properties = Array.new
177
+ if @url.nil?
178
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
179
+ end
180
+
181
+ if @url.to_s.length > 2048
182
+ invalid_properties.push('invalid value for "url", the character length must be smaller than or equal to 2048.')
183
+ end
184
+
185
+ if @url.to_s.length < 1
186
+ invalid_properties.push('invalid value for "url", the character length must be greater than or equal to 1.')
187
+ end
188
+
189
+ if !@success_status.nil? && @success_status.to_s.length > 3
190
+ invalid_properties.push('invalid value for "success_status", the character length must be smaller than or equal to 3.')
191
+ end
192
+
193
+ if !@ca_cert.nil? && @ca_cert.to_s.length > 65536
194
+ invalid_properties.push('invalid value for "ca_cert", the character length must be smaller than or equal to 65536.')
195
+ end
196
+
197
+ if !@body.nil? && @body.to_s.length > 1048576
198
+ invalid_properties.push('invalid value for "body", the character length must be smaller than or equal to 1048576.')
199
+ end
200
+
201
+ if !@timeout.nil? && @timeout < 1
202
+ invalid_properties.push('invalid value for "timeout", must be greater than or equal to 1.')
203
+ end
204
+
205
+ invalid_properties
206
+ end
207
+
208
+ # Check to see if the all the properties in the model are valid
209
+ # @return true if the model is valid
210
+ def valid?
211
+ warn '[DEPRECATED] the `valid?` method is obsolete'
212
+ method_validator = EnumAttributeValidator.new('String', ["GET", "POST", "PUT", "PATCH", "DELETE"])
213
+ return false unless method_validator.valid?(@method)
214
+ return false if @url.nil?
215
+ return false if @url.to_s.length > 2048
216
+ return false if @url.to_s.length < 1
217
+ return false if !@success_status.nil? && @success_status.to_s.length > 3
218
+ return false if !@ca_cert.nil? && @ca_cert.to_s.length > 65536
219
+ return false if !@body.nil? && @body.to_s.length > 1048576
220
+ return false if !@timeout.nil? && @timeout < 1
221
+ true
222
+ end
223
+
224
+ # Custom attribute writer method checking allowed values (enum).
225
+ # @param [Object] method Object to be assigned
226
+ def method=(method)
227
+ validator = EnumAttributeValidator.new('String', ["GET", "POST", "PUT", "PATCH", "DELETE"])
228
+ unless validator.valid?(method)
229
+ fail ArgumentError, "invalid value for \"method\", must be one of #{validator.allowable_values}."
230
+ end
231
+ @method = method
232
+ end
233
+
234
+ # Custom attribute writer method with validation
235
+ # @param [Object] url Value to be assigned
236
+ def url=(url)
237
+ if url.nil?
238
+ fail ArgumentError, 'url cannot be nil'
239
+ end
240
+
241
+ if url.to_s.length > 2048
242
+ fail ArgumentError, 'invalid value for "url", the character length must be smaller than or equal to 2048.'
243
+ end
244
+
245
+ if url.to_s.length < 1
246
+ fail ArgumentError, 'invalid value for "url", the character length must be greater than or equal to 1.'
247
+ end
248
+
249
+ @url = url
250
+ end
251
+
252
+ # Custom attribute writer method with validation
253
+ # @param [Object] success_status Value to be assigned
254
+ def success_status=(success_status)
255
+ if success_status.nil?
256
+ fail ArgumentError, 'success_status cannot be nil'
257
+ end
258
+
259
+ if success_status.to_s.length > 3
260
+ fail ArgumentError, 'invalid value for "success_status", the character length must be smaller than or equal to 3.'
261
+ end
262
+
263
+ @success_status = success_status
264
+ end
265
+
266
+ # Custom attribute writer method with validation
267
+ # @param [Object] ca_cert Value to be assigned
268
+ def ca_cert=(ca_cert)
269
+ if !ca_cert.nil? && ca_cert.to_s.length > 65536
270
+ fail ArgumentError, 'invalid value for "ca_cert", the character length must be smaller than or equal to 65536.'
271
+ end
272
+
273
+ @ca_cert = ca_cert
274
+ end
275
+
276
+ # Custom attribute writer method with validation
277
+ # @param [Object] body Value to be assigned
278
+ def body=(body)
279
+ if !body.nil? && body.to_s.length > 1048576
280
+ fail ArgumentError, 'invalid value for "body", the character length must be smaller than or equal to 1048576.'
281
+ end
282
+
283
+ @body = body
284
+ end
285
+
286
+ # Custom attribute writer method with validation
287
+ # @param [Object] timeout Value to be assigned
288
+ def timeout=(timeout)
289
+ if timeout.nil?
290
+ fail ArgumentError, 'timeout cannot be nil'
291
+ end
292
+
293
+ if timeout < 1
294
+ fail ArgumentError, 'invalid value for "timeout", must be greater than or equal to 1.'
295
+ end
296
+
297
+ @timeout = timeout
298
+ end
299
+
300
+ # Checks equality by comparing each attribute.
301
+ # @param [Object] Object to be compared
302
+ def ==(o)
303
+ return true if self.equal?(o)
304
+ self.class == o.class &&
305
+ method == o.method &&
306
+ url == o.url &&
307
+ headers == o.headers &&
308
+ success_status == o.success_status &&
309
+ tls_verify == o.tls_verify &&
310
+ ca_cert == o.ca_cert &&
311
+ body == o.body &&
312
+ timeout == o.timeout
313
+ end
314
+
315
+ # @see the `==` method
316
+ # @param [Object] Object to be compared
317
+ def eql?(o)
318
+ self == o
319
+ end
320
+
321
+ # Calculates hash code according to all attributes.
322
+ # @return [Integer] Hash code
323
+ def hash
324
+ [method, url, headers, success_status, tls_verify, ca_cert, body, timeout].hash
325
+ end
326
+
327
+ # Builds the object from hash
328
+ # @param [Hash] attributes Model attributes in the form of hash
329
+ # @return [Object] Returns the model itself
330
+ def self.build_from_hash(attributes)
331
+ return nil unless attributes.is_a?(Hash)
332
+ attributes = attributes.transform_keys(&:to_sym)
333
+ transformed_hash = {}
334
+ openapi_types.each_pair do |key, type|
335
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
336
+ transformed_hash["#{key}"] = nil
337
+ elsif type =~ /\AArray<(.*)>/i
338
+ # check to ensure the input is an array given that the attribute
339
+ # is documented as an array but the input is not
340
+ if attributes[attribute_map[key]].is_a?(Array)
341
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
342
+ end
343
+ elsif !attributes[attribute_map[key]].nil?
344
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
345
+ end
346
+ end
347
+ new(transformed_hash)
348
+ end
349
+
350
+ # Returns the object in the form of hash
351
+ # @return [Hash] Returns the object in the form of hash
352
+ def to_hash
353
+ hash = {}
354
+ self.class.attribute_map.each_pair do |attr, param|
355
+ value = self.send(attr)
356
+ if value.nil?
357
+ is_nullable = self.class.openapi_nullable.include?(attr)
358
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
359
+ end
360
+
361
+ hash[param] = _to_hash(value)
362
+ end
363
+ hash
364
+ end
365
+
366
+ end
367
+
368
+ end