Class: SmplkitGeneratedClient::Jobs::RetryPolicy
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- SmplkitGeneratedClient::Jobs::RetryPolicy
- Defined in:
- lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb
Overview
A named, reusable automatic-retry policy. A policy decides whether and how a failed run is retried. Reference it from a job’s ‘retry_policy` (and optionally override it per environment). A job that references nothing uses the built-in `Default` policy, which never retries.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#backoff ⇒ Object
How the wait between retries grows.
-
#created_at ⇒ Object
When the policy was created.
-
#delay_seconds ⇒ Object
The wait before a retry, in seconds.
-
#deleted_at ⇒ Object
When the policy was deleted.
-
#max_delay_seconds ⇒ Object
The ceiling on the wait between retries, in seconds, for ‘exponential` backoff — once the doubling reaches it, every subsequent retry waits this long.
-
#max_retries ⇒ Object
How many times a failed run is retried, after the initial attempt — so ‘max_retries` of 3 means up to 4 attempts in total.
-
#name ⇒ Object
Human-readable name for the policy.
-
#retry_on_connection_error ⇒ Object
Retry a run that failed because the destination could not be reached (DNS, connection refused, TLS, or transport error).
-
#retry_on_timeout ⇒ Object
Retry a run that failed because the request did not complete within the job’s timeout.
-
#retry_statuses ⇒ Object
Allowlist of response status patterns to retry when a run fails because the response did not match the job’s success status.
-
#retry_statuses_except ⇒ Object
Subtractions from ‘retry_statuses`, using the same exact-code or class syntax.
-
#updated_at ⇒ Object
When the policy was last modified.
-
#version ⇒ Object
Monotonic counter incremented on every update, starting at 1.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ RetryPolicy
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ RetryPolicy
Initializes the object
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 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 141 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::RetryPolicy` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::RetryPolicy`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] else self.name = nil end if attributes.key?(:'max_retries') self.max_retries = attributes[:'max_retries'] else self.max_retries = nil end if attributes.key?(:'backoff') self.backoff = attributes[:'backoff'] else self.backoff = nil end if attributes.key?(:'delay_seconds') self.delay_seconds = attributes[:'delay_seconds'] else self.delay_seconds = nil end if attributes.key?(:'max_delay_seconds') self.max_delay_seconds = attributes[:'max_delay_seconds'] end if attributes.key?(:'retry_on_timeout') self.retry_on_timeout = attributes[:'retry_on_timeout'] else self.retry_on_timeout = false end if attributes.key?(:'retry_on_connection_error') self.retry_on_connection_error = attributes[:'retry_on_connection_error'] else self.retry_on_connection_error = false end if attributes.key?(:'retry_statuses') if (value = attributes[:'retry_statuses']).is_a?(Array) self.retry_statuses = value end end if attributes.key?(:'retry_statuses_except') if (value = attributes[:'retry_statuses_except']).is_a?(Array) self.retry_statuses_except = value end end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] end if attributes.key?(:'deleted_at') self.deleted_at = attributes[:'deleted_at'] end if attributes.key?(:'version') self.version = attributes[:'version'] end end |
Instance Attribute Details
#backoff ⇒ Object
How the wait between retries grows. ‘fixed` waits `delay_seconds` before every retry. `exponential` doubles the wait each time — `delay_seconds`, then `2×`, `4×`, … — capped at `max_delay_seconds`.
26 27 28 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 26 def backoff @backoff end |
#created_at ⇒ Object
When the policy was created.
47 48 49 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 47 def created_at @created_at end |
#delay_seconds ⇒ Object
The wait before a retry, in seconds. For ‘fixed` backoff it is the constant wait before every retry; for `exponential` it is the base wait that doubles each retry.
29 30 31 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 29 def delay_seconds @delay_seconds end |
#deleted_at ⇒ Object
When the policy was deleted. ‘null` for active policies.
53 54 55 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 53 def deleted_at @deleted_at end |
#max_delay_seconds ⇒ Object
The ceiling on the wait between retries, in seconds, for ‘exponential` backoff — once the doubling reaches it, every subsequent retry waits this long. Only valid with `exponential` backoff; omit it for `fixed`.
32 33 34 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 32 def max_delay_seconds @max_delay_seconds end |
#max_retries ⇒ Object
How many times a failed run is retried, after the initial attempt — so ‘max_retries` of 3 means up to 4 attempts in total. `0` disables retries. Maximum 10.
23 24 25 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 23 def max_retries @max_retries end |
#name ⇒ Object
Human-readable name for the policy.
20 21 22 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 20 def name @name end |
#retry_on_connection_error ⇒ Object
Retry a run that failed because the destination could not be reached (DNS, connection refused, TLS, or transport error). Defaults to ‘false` (connection errors are not retried).
38 39 40 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 38 def retry_on_connection_error @retry_on_connection_error end |
#retry_on_timeout ⇒ Object
Retry a run that failed because the request did not complete within the job’s timeout. Defaults to ‘false` (timeouts are not retried).
35 36 37 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 35 def retry_on_timeout @retry_on_timeout end |
#retry_statuses ⇒ Object
Allowlist of response status patterns to retry when a run fails because the response did not match the job’s success status. Each element is either an exact 3-digit HTTP code (e.g. ‘429`) or a status class (`1xx`, `2xx`, `3xx`, `4xx`, `5xx`) — for example `["429", "5xx"]` to retry on rate-limit and any server error. Empty (the default) matches no status, so nothing is retried on a non-success response.
41 42 43 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 41 def retry_statuses @retry_statuses end |
#retry_statuses_except ⇒ Object
Subtractions from ‘retry_statuses`, using the same exact-code or class syntax. A status that matches both lists is not retried — `except` wins on overlap — so `retry_statuses` of `["5xx"]` with `retry_statuses_except` of `["501"]` retries every server error except `501`. An element that does not overlap `retry_statuses` is allowed and simply has no effect. Empty (the default) subtracts nothing.
44 45 46 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 44 def retry_statuses_except @retry_statuses_except end |
#updated_at ⇒ Object
When the policy was last modified.
50 51 52 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 50 def updated_at @updated_at end |
#version ⇒ Object
Monotonic counter incremented on every update, starting at 1.
56 57 58 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 56 def version @version end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
100 101 102 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 100 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
105 106 107 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 105 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 81 def self.attribute_map { :'name' => :'name', :'max_retries' => :'max_retries', :'backoff' => :'backoff', :'delay_seconds' => :'delay_seconds', :'max_delay_seconds' => :'max_delay_seconds', :'retry_on_timeout' => :'retry_on_timeout', :'retry_on_connection_error' => :'retry_on_connection_error', :'retry_statuses' => :'retry_statuses', :'retry_statuses_except' => :'retry_statuses_except', :'created_at' => :'created_at', :'updated_at' => :'updated_at', :'deleted_at' => :'deleted_at', :'version' => :'version' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 396 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
129 130 131 132 133 134 135 136 137 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 129 def self.openapi_nullable Set.new([ :'max_delay_seconds', :'created_at', :'updated_at', :'deleted_at', :'version' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 110 def self.openapi_types { :'name' => :'String', :'max_retries' => :'Integer', :'backoff' => :'String', :'delay_seconds' => :'Integer', :'max_delay_seconds' => :'Integer', :'retry_on_timeout' => :'Boolean', :'retry_on_connection_error' => :'Boolean', :'retry_statuses' => :'Array<String>', :'retry_statuses_except' => :'Array<String>', :'created_at' => :'Time', :'updated_at' => :'Time', :'deleted_at' => :'Time', :'version' => :'Integer' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 363 def ==(o) return true if self.equal?(o) self.class == o.class && name == o.name && max_retries == o.max_retries && backoff == o.backoff && delay_seconds == o.delay_seconds && max_delay_seconds == o.max_delay_seconds && retry_on_timeout == o.retry_on_timeout && retry_on_connection_error == o.retry_on_connection_error && retry_statuses == o.retry_statuses && retry_statuses_except == o.retry_statuses_except && created_at == o.created_at && updated_at == o.updated_at && deleted_at == o.deleted_at && version == o.version end |
#eql?(o) ⇒ Boolean
383 384 385 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 383 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
389 390 391 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 389 def hash [name, max_retries, backoff, delay_seconds, max_delay_seconds, retry_on_timeout, retry_on_connection_error, retry_statuses, retry_statuses_except, created_at, updated_at, deleted_at, version].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 262 263 264 265 266 267 268 269 270 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 226 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @name.to_s.length > 200 invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 200.') end if @name.to_s.length < 1 invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end if @max_retries.nil? invalid_properties.push('invalid value for "max_retries", max_retries cannot be nil.') end if @max_retries > 10 invalid_properties.push('invalid value for "max_retries", must be smaller than or equal to 10.') end if @max_retries < 0 invalid_properties.push('invalid value for "max_retries", must be greater than or equal to 0.') end if @backoff.nil? invalid_properties.push('invalid value for "backoff", backoff cannot be nil.') end if @delay_seconds.nil? invalid_properties.push('invalid value for "delay_seconds", delay_seconds cannot be nil.') end if @delay_seconds < 1 invalid_properties.push('invalid value for "delay_seconds", must be greater than or equal to 1.') end if !@max_delay_seconds.nil? && @max_delay_seconds < 1 invalid_properties.push('invalid value for "max_delay_seconds", must be greater than or equal to 1.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
418 419 420 421 422 423 424 425 426 427 428 429 430 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 418 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 hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb', line 274 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @name.nil? return false if @name.to_s.length > 200 return false if @name.to_s.length < 1 return false if @max_retries.nil? return false if @max_retries > 10 return false if @max_retries < 0 return false if @backoff.nil? backoff_validator = EnumAttributeValidator.new('String', ["fixed", "exponential"]) return false unless backoff_validator.valid?(@backoff) return false if @delay_seconds.nil? return false if @delay_seconds < 1 return false if !@max_delay_seconds.nil? && @max_delay_seconds < 1 true end |