Class: LinodeOpenapiClient::GetEvents200ResponseDataInner

Inherits:
Object
  • Object
show all
Defined in:
lib/linode_openapi_client/models/get_events200_response_data_inner.rb

Overview

A collection of Event objects. An Event is an action taken against an entity related to your Account. For example, booting a Linode would create an Event. The Events returned depends on your grants.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GetEvents200ResponseDataInner

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 137

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `LinodeOpenapiClient::GetEvents200ResponseDataInner` initialize method"
  end

  # 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))
      fail ArgumentError, "`#{k}` is not a valid attribute in `LinodeOpenapiClient::GetEvents200ResponseDataInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#actionObject

__Filterable__, Read-only The action that caused this Event. New actions may be added in the future.



57
58
59
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 57

def action
  @action
end

#createdObject

__Filterable__, Read-only When this Event was created.



29
30
31
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 29

def created
  @created
end

#durationObject

Read-only The total duration in seconds that it takes for the Event to complete.



40
41
42
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 40

def duration
  @duration
end

#entityObject

Returns the value of attribute entity.



51
52
53
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 51

def entity
  @entity
end

#idObject

__Filterable__, Read-only The unique ID of this Event.



23
24
25
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 23

def id
  @id
end

#messageObject

Provides additional information about the event. Additional information may include, but is not limited to, a more detailed representation of events which can help diagnose non-obvious failures.



26
27
28
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 26

def message
  @message
end

#percent_completeObject

Read-only A percentage estimating the amount of time remaining for an Event. Returns ‘null` for notification events.



49
50
51
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 49

def percent_complete
  @percent_complete
end

#rateObject

Read-only The rate of completion of the Event. Only some Events will return rate; for example, migration and resize Events.



43
44
45
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 43

def rate
  @rate
end

#readObject

__Filterable__, Read-only If this Event has been read.



20
21
22
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 20

def read
  @read
end

#secondary_entityObject

Returns the value of attribute secondary_entity.



34
35
36
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 34

def secondary_entity
  @secondary_entity
end

#seenObject

Read-only If this Event has been seen.



46
47
48
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 46

def seen
  @seen
end

#statusObject

Read-only The current status of this Event.



37
38
39
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 37

def status
  @status
end

#time_remainingObject

Read-only The estimated time remaining until the completion of this Event. This value is only returned for some in-progress migration events. For all other in-progress events, the ‘percent_complete` attribute will indicate about how much more work is to be done.



54
55
56
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 54

def time_remaining
  @time_remaining
end

#usernameObject

Read-only The username of the User who caused the Event.



32
33
34
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 32

def username
  @username
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 306

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = LinodeOpenapiClient.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



102
103
104
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 102

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 82

def self.attribute_map
  {
    :'read' => :'read',
    :'id' => :'id',
    :'message' => :'message',
    :'created' => :'created',
    :'username' => :'username',
    :'secondary_entity' => :'secondary_entity',
    :'status' => :'status',
    :'duration' => :'duration',
    :'rate' => :'rate',
    :'seen' => :'seen',
    :'percent_complete' => :'percent_complete',
    :'entity' => :'entity',
    :'time_remaining' => :'time_remaining',
    :'action' => :'action'
  }
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



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 282

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



127
128
129
130
131
132
133
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 127

def self.openapi_nullable
  Set.new([
    :'message',
    :'username',
    :'time_remaining',
  ])
end

.openapi_typesObject

Attribute type mapping.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 107

def self.openapi_types
  {
    :'read' => :'Boolean',
    :'id' => :'Integer',
    :'message' => :'String',
    :'created' => :'Time',
    :'username' => :'String',
    :'secondary_entity' => :'GetEvents200ResponseDataInnerSecondaryEntity',
    :'status' => :'String',
    :'duration' => :'Float',
    :'rate' => :'String',
    :'seen' => :'Boolean',
    :'percent_complete' => :'Integer',
    :'entity' => :'GetEvents200ResponseDataInnerEntity',
    :'time_remaining' => :'String',
    :'action' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 248

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      read == o.read &&
      id == o.id &&
      message == o.message &&
      created == o.created &&
      username == o.username &&
      secondary_entity == o.secondary_entity &&
      status == o.status &&
      duration == o.duration &&
      rate == o.rate &&
      seen == o.seen &&
      percent_complete == o.percent_complete &&
      entity == o.entity &&
      time_remaining == o.time_remaining &&
      action == o.action
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 377

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


269
270
271
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 269

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



275
276
277
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 275

def hash
  [read, id, message, created, username, secondary_entity, status, duration, rate, seen, percent_complete, entity, time_remaining, action].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



209
210
211
212
213
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 209

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



353
354
355
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 353

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 359

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



347
348
349
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 347

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



217
218
219
220
221
222
223
224
# File 'lib/linode_openapi_client/models/get_events200_response_data_inner.rb', line 217

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  status_validator = EnumAttributeValidator.new('String', ["failed", "finished", "notification", "scheduled", "started"])
  return false unless status_validator.valid?(@status)
  action_validator = EnumAttributeValidator.new('String', ["account_update", "account_settings_update", "aclb_create", "aclb_update", "aclb_delete", "aclb_config_create", "aclb_config_update", "aclb_config_delete", "aclb_route_create", "aclb_route_update", "aclb_route_delete", "aclb_servicetarget_create", "aclb_servicetarget_update", "aclb_servicetarget_delete", "aclb_certificate_create", "aclb_certificate_update", "aclb_certificate_delete", "backups_enable", "backups_cancel", "backups_restore", "community_question_reply", "community_like", "credit_card_updated", "disk_create", "disk_delete", "disk_update", "disk_duplicate", "disk_imagize", "disk_resize", "dns_record_create", "dns_record_delete", "dns_record_update", "dns_zone_create", "dns_zone_delete", "dns_zone_import", "dns_zone_update", "entity_transfer_accept", "entity_transfer_cancel", "entity_transfer_create", "entity_transfer_fail", "entity_transfer_stale", "firewall_create", "firewall_delete", "firewall_disable", "firewall_enable", "firewall_update", "firewall_device_add", "firewall_device_remove", "host_reboot", "image_delete", "image_update", "image_upload", "ipaddress_update", "lassie_reboot", "lish_boot", "linode_addip", "linode_boot", "linode_clone", "linode_create", "linode_delete", "linode_update", "linode_deleteip", "linode_migrate", "linode_migrate_datacenter", "linode_migrate_datacenter_create", "linode_mutate", "linode_mutate_create", "linode_reboot", "linode_rebuild", "linode_resize", "linode_resize_create", "linode_shutdown", "linode_snapshot", "linode_config_create", "linode_config_delete", "linode_config_update", "lke_node_create", "longviewclient_create", "longviewclient_delete", "longviewclient_update", "managed_disabled", "managed_enabled", "managed_service_create", "managed_service_delete", "nodebalancer_create", "nodebalancer_delete", "nodebalancer_update", "nodebalancer_config_create", "nodebalancer_config_delete", "nodebalancer_config_update", "nodebalancer_node_create", "nodebalancer_node_delete", "nodebalancer_node_update", "oauth_client_create", "oauth_client_delete", "oauth_client_secret_reset", "oauth_client_update", "obj_access_key_create", "obj_access_key_delete", "obj_access_key_update", "password_reset", "payment_method_add", "payment_submitted", "placement_group_assign", "placement_group_became_compliant", "placement_group_became_non_compliant", "placement_group_create", "placement_group_delete", "placement_group_unassign", "placement_group_update", "profile_update", "stackscript_create", "stackscript_delete", "stackscript_update", "stackscript_publicize", "stackscript_revise", "subnet_create", "subnet_delete", "subnet_update", "tag_create", "tag_delete", "tfa_disabled", "tfa_enabled", "ticket_attachment_upload", "ticket_create", "ticket_update", "token_create", "token_delete", "token_update", "user_create", "user_update", "user_delete", "user_ssh_key_add", "user_ssh_key_delete", "user_ssh_key_update", "vlan_attach", "vlan_detach", "volume_attach", "volume_clone", "volume_create", "volume_delete", "volume_update", "volume_detach", "volume_resize", "vpc_create", "vpc_delete", "vpc_update"])
  return false unless action_validator.valid?(@action)
  true
end