Class: Authentik::Api::Task

Inherits:
ApiModelBase show all
Defined in:
lib/authentik/api/models/task.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ Task

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
# File 'lib/authentik/api/models/task.rb', line 133

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Authentik::Api::Task` 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 `Authentik::Api::Task`. 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?(:'message_id')
    self.message_id = attributes[:'message_id']
  end

  if attributes.key?(:'queue_name')
    self.queue_name = attributes[:'queue_name']
  end

  if attributes.key?(:'actor_name')
    self.actor_name = attributes[:'actor_name']
  else
    self.actor_name = nil
  end

  if attributes.key?(:'state')
    self.state = attributes[:'state']
  end

  if attributes.key?(:'mtime')
    self.mtime = attributes[:'mtime']
  end

  if attributes.key?(:'retries')
    self.retries = attributes[:'retries']
  end

  if attributes.key?(:'eta')
    self.eta = attributes[:'eta']
  end

  if attributes.key?(:'rel_obj_app_label')
    self.rel_obj_app_label = attributes[:'rel_obj_app_label']
  else
    self.rel_obj_app_label = nil
  end

  if attributes.key?(:'rel_obj_model')
    self.rel_obj_model = attributes[:'rel_obj_model']
  else
    self.rel_obj_model = nil
  end

  if attributes.key?(:'rel_obj_id')
    self.rel_obj_id = attributes[:'rel_obj_id']
  end

  if attributes.key?(:'uid')
    self.uid = attributes[:'uid']
  else
    self.uid = nil
  end

  if attributes.key?(:'logs')
    if (value = attributes[:'logs']).is_a?(Array)
      self.logs = value
    end
  else
    self.logs = nil
  end

  if attributes.key?(:'previous_logs')
    if (value = attributes[:'previous_logs']).is_a?(Array)
      self.previous_logs = value
    end
  else
    self.previous_logs = nil
  end

  if attributes.key?(:'aggregated_status')
    self.aggregated_status = attributes[:'aggregated_status']
  else
    self.aggregated_status = nil
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  else
    self.description = nil
  end
end

Instance Attribute Details

#actor_nameObject

Dramatiq actor name



18
19
20
# File 'lib/authentik/api/models/task.rb', line 18

def actor_name
  @actor_name
end

#aggregated_statusObject

Returns the value of attribute aggregated_status.



44
45
46
# File 'lib/authentik/api/models/task.rb', line 44

def aggregated_status
  @aggregated_status
end

#descriptionObject

Returns the value of attribute description.



46
47
48
# File 'lib/authentik/api/models/task.rb', line 46

def description
  @description
end

#etaObject

Planned execution time



30
31
32
# File 'lib/authentik/api/models/task.rb', line 30

def eta
  @eta
end

#logsObject

Returns the value of attribute logs.



40
41
42
# File 'lib/authentik/api/models/task.rb', line 40

def logs
  @logs
end

#message_idObject

Returns the value of attribute message_id.



12
13
14
# File 'lib/authentik/api/models/task.rb', line 12

def message_id
  @message_id
end

#mtimeObject

Task last modified time



24
25
26
# File 'lib/authentik/api/models/task.rb', line 24

def mtime
  @mtime
end

#previous_logsObject

Returns the value of attribute previous_logs.



42
43
44
# File 'lib/authentik/api/models/task.rb', line 42

def previous_logs
  @previous_logs
end

#queue_nameObject

Queue name



15
16
17
# File 'lib/authentik/api/models/task.rb', line 15

def queue_name
  @queue_name
end

#rel_obj_app_labelObject

Returns the value of attribute rel_obj_app_label.



32
33
34
# File 'lib/authentik/api/models/task.rb', line 32

def rel_obj_app_label
  @rel_obj_app_label
end

#rel_obj_idObject

Returns the value of attribute rel_obj_id.



36
37
38
# File 'lib/authentik/api/models/task.rb', line 36

def rel_obj_id
  @rel_obj_id
end

#rel_obj_modelObject

Returns the value of attribute rel_obj_model.



34
35
36
# File 'lib/authentik/api/models/task.rb', line 34

def rel_obj_model
  @rel_obj_model
end

#retriesObject

Number of retries



27
28
29
# File 'lib/authentik/api/models/task.rb', line 27

def retries
  @retries
end

#stateObject

Task status



21
22
23
# File 'lib/authentik/api/models/task.rb', line 21

def state
  @state
end

#uidObject

Returns the value of attribute uid.



38
39
40
# File 'lib/authentik/api/models/task.rb', line 38

def uid
  @uid
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



92
93
94
# File 'lib/authentik/api/models/task.rb', line 92

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



97
98
99
# File 'lib/authentik/api/models/task.rb', line 97

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/authentik/api/models/task.rb', line 71

def self.attribute_map
  {
    :'message_id' => :'message_id',
    :'queue_name' => :'queue_name',
    :'actor_name' => :'actor_name',
    :'state' => :'state',
    :'mtime' => :'mtime',
    :'retries' => :'retries',
    :'eta' => :'eta',
    :'rel_obj_app_label' => :'rel_obj_app_label',
    :'rel_obj_model' => :'rel_obj_model',
    :'rel_obj_id' => :'rel_obj_id',
    :'uid' => :'uid',
    :'logs' => :'logs',
    :'previous_logs' => :'previous_logs',
    :'aggregated_status' => :'aggregated_status',
    :'description' => :'description'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/authentik/api/models/task.rb', line 413

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_nullableObject

List of attributes with nullable: true



123
124
125
126
127
128
129
# File 'lib/authentik/api/models/task.rb', line 123

def self.openapi_nullable
  Set.new([
    :'eta',
    :'rel_obj_id',
    :'description'
  ])
end

.openapi_typesObject

Attribute type mapping.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/authentik/api/models/task.rb', line 102

def self.openapi_types
  {
    :'message_id' => :'String',
    :'queue_name' => :'String',
    :'actor_name' => :'String',
    :'state' => :'TaskStateEnum',
    :'mtime' => :'Time',
    :'retries' => :'Integer',
    :'eta' => :'Time',
    :'rel_obj_app_label' => :'String',
    :'rel_obj_model' => :'String',
    :'rel_obj_id' => :'String',
    :'uid' => :'String',
    :'logs' => :'Array<LogEvent>',
    :'previous_logs' => :'Array<LogEvent>',
    :'aggregated_status' => :'TaskAggregatedStatusEnum',
    :'description' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
# File 'lib/authentik/api/models/task.rb', line 378

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      message_id == o.message_id &&
      queue_name == o.queue_name &&
      actor_name == o.actor_name &&
      state == o.state &&
      mtime == o.mtime &&
      retries == o.retries &&
      eta == o.eta &&
      rel_obj_app_label == o.rel_obj_app_label &&
      rel_obj_model == o.rel_obj_model &&
      rel_obj_id == o.rel_obj_id &&
      uid == o.uid &&
      logs == o.logs &&
      previous_logs == o.previous_logs &&
      aggregated_status == o.aggregated_status &&
      description == o.description
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


400
401
402
# File 'lib/authentik/api/models/task.rb', line 400

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



406
407
408
# File 'lib/authentik/api/models/task.rb', line 406

def hash
  [message_id, queue_name, actor_name, state, mtime, retries, eta, rel_obj_app_label, rel_obj_model, rel_obj_id, uid, logs, previous_logs, aggregated_status, description].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



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/authentik/api/models/task.rb', line 230

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @actor_name.nil?
    invalid_properties.push('invalid value for "actor_name", actor_name cannot be nil.')
  end

  if !@retries.nil? && @retries > 9223372036854775807
    invalid_properties.push('invalid value for "retries", must be smaller than or equal to 9223372036854775807.')
  end

  if !@retries.nil? && @retries < 0
    invalid_properties.push('invalid value for "retries", must be greater than or equal to 0.')
  end

  if @rel_obj_app_label.nil?
    invalid_properties.push('invalid value for "rel_obj_app_label", rel_obj_app_label cannot be nil.')
  end

  if @rel_obj_model.nil?
    invalid_properties.push('invalid value for "rel_obj_model", rel_obj_model cannot be nil.')
  end

  if @uid.nil?
    invalid_properties.push('invalid value for "uid", uid cannot be nil.')
  end

  if @logs.nil?
    invalid_properties.push('invalid value for "logs", logs cannot be nil.')
  end

  if @previous_logs.nil?
    invalid_properties.push('invalid value for "previous_logs", previous_logs cannot be nil.')
  end

  if @aggregated_status.nil?
    invalid_properties.push('invalid value for "aggregated_status", aggregated_status cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



435
436
437
438
439
440
441
442
443
444
445
446
447
# File 'lib/authentik/api/models/task.rb', line 435

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

Returns:

  • (Boolean)

    true if the model is valid



274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/authentik/api/models/task.rb', line 274

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @actor_name.nil?
  return false if !@retries.nil? && @retries > 9223372036854775807
  return false if !@retries.nil? && @retries < 0
  return false if @rel_obj_app_label.nil?
  return false if @rel_obj_model.nil?
  return false if @uid.nil?
  return false if @logs.nil?
  return false if @previous_logs.nil?
  return false if @aggregated_status.nil?
  true
end