Class: LinodeOpenapiClient::Linode6

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Linode6

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#alertsObject

Returns the value of attribute alerts.



66
67
68
# File 'lib/linode_openapi_client/models/linode6.rb', line 66

def alerts
  @alerts
end

#backupsObject

Returns the value of attribute backups.



61
62
63
# File 'lib/linode_openapi_client/models/linode6.rb', line 61

def backups
  @backups
end

#createdObject

Read-only When this Linode was created.



53
54
55
# File 'lib/linode_openapi_client/models/linode6.rb', line 53

def created
  @created
end

#groupObject

__Filterable__ A deprecated property denoting a group label for this Linode.



69
70
71
# File 'lib/linode_openapi_client/models/linode6.rb', line 69

def group
  @group
end

#has_user_dataObject

Read-only Whether this compute instance was provisioned utilizing ‘user_data` provided via the Metadata service. See the [Create a Linode](techdocs.akamai.com/linode-api/reference/post-linode-instance) description for more information on Metadata.



24
25
26
# File 'lib/linode_openapi_client/models/linode6.rb', line 24

def has_user_data
  @has_user_data
end

#host_uuidObject

Read-only The Linode’s host machine, as a UUID.



64
65
66
# File 'lib/linode_openapi_client/models/linode6.rb', line 64

def host_uuid
  @host_uuid
end

#hypervisorObject

Read-only The virtualization software powering this Linode.



50
51
52
# File 'lib/linode_openapi_client/models/linode6.rb', line 50

def hypervisor
  @hypervisor
end

#idObject

__Filterable__, Read-only This Linode’s ID which must be provided for all operations impacting this Linode.



44
45
46
# File 'lib/linode_openapi_client/models/linode6.rb', line 44

def id
  @id
end

#imageObject

An Image ID to deploy the Linode Disk from. Run the [List images](techdocs.akamai.com/linode-api/reference/get-images) operation with authentication to view all available Images. Official Linode Images start with ‘linode/`, while your Account’s Images start with ‘private/`. Creating a disk from a Private Image requires `read_only` or `read_write` permissions for that Image. Run the [Update a user’s grants](techdocs.akamai.com/linode-api/reference/put-user-grants) operation to adjust permissions for an Account Image.



19
20
21
# File 'lib/linode_openapi_client/models/linode6.rb', line 19

def image
  @image
end

#ipv4Object

__Filterable__, Read-only This Linode’s IPv4 Addresses. Each Linode is assigned a single public IPv4 address upon creation, and may get a single private IPv4 address if needed. You may need to [Open a support ticket](techdocs.akamai.com/linode-api/reference/post-ticket) to get additional IPv4 addresses. IPv4 addresses may be reassigned between your Linodes, or shared with other Linodes. See the [networking](techdocs.akamai.com/linode-api/reference/post-firewalls) operations for details.



56
57
58
# File 'lib/linode_openapi_client/models/linode6.rb', line 56

def ipv4
  @ipv4
end

#ipv6Object

Read-only This Linode’s IPv6 SLAAC address. This address is specific to a Linode, and may not be shared. If the Linode has not been assigned an IPv6 address, the return value will be ‘null`.



39
40
41
# File 'lib/linode_openapi_client/models/linode6.rb', line 39

def ipv6
  @ipv6
end

#labelObject

__Filterable__ The Linode’s label is for display purposes only. If no label is provided for a Linode, a default will be assigned. Linode labels have the following constraints: - Must begin and end with an alphanumeric character. - May only consist of alphanumeric characters, hyphens (‘-`), underscores (`_`) or periods (`.`). - Cannot have two hyphens (`–`), underscores (`__`) or periods (`..`) in a row.



33
34
35
# File 'lib/linode_openapi_client/models/linode6.rb', line 33

def label
  @label
end

#placement_groupObject

Returns the value of attribute placement_group.



21
22
23
# File 'lib/linode_openapi_client/models/linode6.rb', line 21

def placement_group
  @placement_group
end

#regionObject

__Filterable__, Read-only This is the [region](techdocs.akamai.com/linode-api/reference/get-regions) where the Linode was deployed. A Linode’s region can only be changed by initiating a [cross data center migration](techdocs.akamai.com/linode-api/reference/post-migrate-linode-instance).



59
60
61
# File 'lib/linode_openapi_client/models/linode6.rb', line 59

def region
  @region
end

#specsObject

Returns the value of attribute specs.



41
42
43
# File 'lib/linode_openapi_client/models/linode6.rb', line 41

def specs
  @specs
end

#statusObject

Read-only A brief description of this Linode’s current state. This field may change without direct action from you. For example, when a Linode goes into maintenance mode its status will display ‘stopped`.



72
73
74
# File 'lib/linode_openapi_client/models/linode6.rb', line 72

def status
  @status
end

#tagsObject

__Filterable__ An array of tags applied to this object. Tags are for organizational purposes only.



47
48
49
# File 'lib/linode_openapi_client/models/linode6.rb', line 47

def tags
  @tags
end

#typeObject

Read-only This is the [Linode type](techdocs.akamai.com/linode-api/reference/get-linode-types) that this Linode was deployed with. To change a Linode’s Type, use [Resize a Linode](techdocs.akamai.com/linode-api/reference/post-resize-linode-instance).



30
31
32
# File 'lib/linode_openapi_client/models/linode6.rb', line 30

def type
  @type
end

#updatedObject

Read-only When this Linode was last updated.



36
37
38
# File 'lib/linode_openapi_client/models/linode6.rb', line 36

def updated
  @updated
end

#watchdog_enabledObject

The watchdog, named Lassie, is a Shutdown Watchdog that monitors your Linode and will reboot it if it powers off unexpectedly. It works by issuing a boot job when your Linode powers off without a shutdown job being responsible. To prevent a loop, Lassie will give up if there have been more than 5 boot jobs issued within 15 minutes.



27
28
29
# File 'lib/linode_openapi_client/models/linode6.rb', line 27

def watchdog_enabled
  @watchdog_enabled
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



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/linode_openapi_client/models/linode6.rb', line 405

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



123
124
125
# File 'lib/linode_openapi_client/models/linode6.rb', line 123

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/linode_openapi_client/models/linode6.rb', line 97

def self.attribute_map
  {
    :'image' => :'image',
    :'placement_group' => :'placement_group',
    :'has_user_data' => :'has_user_data',
    :'watchdog_enabled' => :'watchdog_enabled',
    :'type' => :'type',
    :'label' => :'label',
    :'updated' => :'updated',
    :'ipv6' => :'ipv6',
    :'specs' => :'specs',
    :'id' => :'id',
    :'tags' => :'tags',
    :'hypervisor' => :'hypervisor',
    :'created' => :'created',
    :'ipv4' => :'ipv4',
    :'region' => :'region',
    :'backups' => :'backups',
    :'host_uuid' => :'host_uuid',
    :'alerts' => :'alerts',
    :'group' => :'group',
    :'status' => :'status'
  }
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



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/linode_openapi_client/models/linode6.rb', line 381

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



154
155
156
157
158
159
# File 'lib/linode_openapi_client/models/linode6.rb', line 154

def self.openapi_nullable
  Set.new([
    :'placement_group',
    :'ipv6',
  ])
end

.openapi_typesObject

Attribute type mapping.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/linode_openapi_client/models/linode6.rb', line 128

def self.openapi_types
  {
    :'image' => :'String',
    :'placement_group' => :'Linode6PlacementGroup',
    :'has_user_data' => :'Boolean',
    :'watchdog_enabled' => :'Boolean',
    :'type' => :'String',
    :'label' => :'String',
    :'updated' => :'Time',
    :'ipv6' => :'String',
    :'specs' => :'Linode6Specs',
    :'id' => :'Integer',
    :'tags' => :'Array<String>',
    :'hypervisor' => :'String',
    :'created' => :'Time',
    :'ipv4' => :'Array<String>',
    :'region' => :'String',
    :'backups' => :'Linode5Backups',
    :'host_uuid' => :'String',
    :'alerts' => :'Linode5Alerts',
    :'group' => :'String',
    :'status' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/linode_openapi_client/models/linode6.rb', line 341

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      image == o.image &&
      placement_group == o.placement_group &&
      has_user_data == o.has_user_data &&
      watchdog_enabled == o.watchdog_enabled &&
      type == o.type &&
      label == o.label &&
      updated == o.updated &&
      ipv6 == o.ipv6 &&
      specs == o.specs &&
      id == o.id &&
      tags == o.tags &&
      hypervisor == o.hypervisor &&
      created == o.created &&
      ipv4 == o.ipv4 &&
      region == o.region &&
      backups == o.backups &&
      host_uuid == o.host_uuid &&
      alerts == o.alerts &&
      group == o.group &&
      status == o.status
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



476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/linode_openapi_client/models/linode6.rb', line 476

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


368
369
370
# File 'lib/linode_openapi_client/models/linode6.rb', line 368

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



374
375
376
# File 'lib/linode_openapi_client/models/linode6.rb', line 374

def hash
  [image, placement_group, has_user_data, watchdog_enabled, type, label, updated, ipv6, specs, id, tags, hypervisor, created, ipv4, region, backups, host_uuid, alerts, group, status].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/linode_openapi_client/models/linode6.rb', line 263

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@label.nil? && @label.to_s.length > 64
    invalid_properties.push('invalid value for "label", the character length must be smaller than or equal to 64.')
  end

  if !@label.nil? && @label.to_s.length < 3
    invalid_properties.push('invalid value for "label", the character length must be great than or equal to 3.')
  end

  pattern = Regexp.new(/^[a-zA-Z]((?!--|__|..)[a-zA-Z0-9-_.])+$/)
  if !@label.nil? && @label !~ pattern
    invalid_properties.push("invalid value for \"label\", must conform to the pattern #{pattern}.")
  end

  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



452
453
454
# File 'lib/linode_openapi_client/models/linode6.rb', line 452

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



458
459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/linode_openapi_client/models/linode6.rb', line 458

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



446
447
448
# File 'lib/linode_openapi_client/models/linode6.rb', line 446

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



284
285
286
287
288
289
290
291
292
293
294
# File 'lib/linode_openapi_client/models/linode6.rb', line 284

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@label.nil? && @label.to_s.length > 64
  return false if !@label.nil? && @label.to_s.length < 3
  return false if !@label.nil? && @label !~ Regexp.new(/^[a-zA-Z]((?!--|__|..)[a-zA-Z0-9-_.])+$/)
  hypervisor_validator = EnumAttributeValidator.new('String', ["kvm"])
  return false unless hypervisor_validator.valid?(@hypervisor)
  status_validator = EnumAttributeValidator.new('String', ["running", "offline", "booting", "rebooting", "shutting_down", "provisioning", "deleting", "migrating", "rebuilding", "cloning", "restoring", "stopped", "billing_suspension"])
  return false unless status_validator.valid?(@status)
  true
end