Class: LinodeOpenapiClient::GetLinodeConfig200Response

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GetLinodeConfig200Response

Initializes the object

Parameters:

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

    Model attributes in the form of hash



119
120
121
122
123
124
125
126
127
128
129
130
131
132
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
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 119

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

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

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

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

  if attributes.key?(:'kernel')
    self.kernel = attributes[:'kernel']
  else
    self.kernel = 'linode/latest-64bit'
  end

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

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

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

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

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

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

Instance Attribute Details

#commentsObject

Optional field for arbitrary User comments on this Config.



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

def comments
  @comments
end

#devicesObject

Returns the value of attribute devices.



38
39
40
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 38

def devices
  @devices
end

#helpersObject

Returns the value of attribute helpers.



18
19
20
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 18

def helpers
  @helpers
end

#idObject

Read-only The ID of this Config.



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

def id
  @id
end

#interfacesObject

An array of Network Interfaces to add to this Linode’s Configuration Profile. At least one and up to three Interface objects can exist in this array. The position in the array determines which of the Linode’s network Interfaces is configured: - First [0]: eth0 - Second [1]: eth1 - Third [2]: eth2 When updating a Linode’s Interfaces, _each Interface must be redefined_. An empty ‘interfaces` array results in a default `public` type Interface configuration only. If no public Interface is configured, public IP addresses are still assigned to the Linode but will not be usable without manual configuration. __Note__. Changes to Linode Interface configurations can be enabled by rebooting the Linode. `vpc` details See the [VPC documentation](www.linode.com/docs/products/networking/vpc/#technical-specifications) guide for its specifications and limitations. `vlan` details - Only Next Generation Network (NGN) data centers support VLANs. Run the [List regions](techdocs.akamai.com/linode-api/reference/get-regions) operation to view the capabilities of data center regions. If a VLAN is attached to your Linode and you attempt to migrate or clone it to a non-NGN data center, the migration or cloning will not initiate. If a Linode cannot be migrated or cloned because of an incompatibility, you will be prompted to select a different data center or contact support. - See the [VLANs Overview](www.linode.com/docs/products/networking/vlans/#technical-specifications) guide to view additional specifications and limitations.



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

def interfaces
  @interfaces
end

#kernelObject

A Kernel ID to boot a Linode with. Here are examples of commonly-used kernels: - ‘linode/latest-64bit` (default): Our latest kernel at the time of instance boot/reboot. - `linode/grub2`: The upstream distribution-supplied kernel that is installed on the primary disk, or a custom kernel if installed. - `linode/direct-disk`: The MBR (Master Boot Record) of the primary disk/root device, used instead of a Linux kernel. For a complete list of options, run the [List kernels](techdocs.akamai.com/linode-api/reference/get-kernels) operation.



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

def kernel
  @kernel
end

#labelObject

__Filterable__ The Config’s label is for display purposes only.



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

def label
  @label
end

#memory_limitObject

Defaults to the total RAM of the Linode.



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

def memory_limit
  @memory_limit
end

#root_deviceObject

The root device to boot. - If no value or an invalid value is provided, root device will default to ‘/dev/sda`. - If the device specified at the root device location is not mounted, the Linode will not boot until a device is mounted.



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

def root_device
  @root_device
end

#run_levelObject

Defines the state of your Linode after booting. Defaults to ‘default`.



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

def run_level
  @run_level
end

#virt_modeObject

Controls the virtualization mode. Defaults to ‘paravirt`. - `paravirt` is suitable for most cases. Linodes running in paravirt mode share some qualities with the host, ultimately making it run faster since there is less transition between it and the host. - `fullvirt` affords more customization, but is slower because 100% of the VM is virtualized.



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

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



354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 354

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



89
90
91
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 89

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 72

def self.attribute_map
  {
    :'helpers' => :'helpers',
    :'label' => :'label',
    :'run_level' => :'run_level',
    :'memory_limit' => :'memory_limit',
    :'kernel' => :'kernel',
    :'comments' => :'comments',
    :'root_device' => :'root_device',
    :'devices' => :'devices',
    :'id' => :'id',
    :'interfaces' => :'interfaces',
    :'virt_mode' => :'virt_mode'
  }
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



330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 330

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



111
112
113
114
115
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 111

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

.openapi_typesObject

Attribute type mapping.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 94

def self.openapi_types
  {
    :'helpers' => :'PostAddLinodeConfig200ResponseHelpers',
    :'label' => :'String',
    :'run_level' => :'String',
    :'memory_limit' => :'Integer',
    :'kernel' => :'String',
    :'comments' => :'String',
    :'root_device' => :'String',
    :'devices' => :'GetLinodeConfig200ResponseDevices',
    :'id' => :'Integer',
    :'interfaces' => :'Array<GetLinodeConfig200ResponseInterfacesInner>',
    :'virt_mode' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 299

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      helpers == o.helpers &&
      label == o.label &&
      run_level == o.run_level &&
      memory_limit == o.memory_limit &&
      kernel == o.kernel &&
      comments == o.comments &&
      root_device == o.root_device &&
      devices == o.devices &&
      id == o.id &&
      interfaces == o.interfaces &&
      virt_mode == o.virt_mode
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



425
426
427
428
429
430
431
432
433
434
435
436
437
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 425

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


317
318
319
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 317

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



323
324
325
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 323

def hash
  [helpers, label, run_level, memory_limit, kernel, comments, root_device, devices, id, interfaces, virt_mode].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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

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

  pattern = Regexp.new(/a-z, A-Z, 0-9, \/, _, -/)
  if !@root_device.nil? && @root_device !~ pattern
    invalid_properties.push("invalid value for \"root_device\", must conform to the pattern #{pattern}.")
  end

  if !@interfaces.nil? && @interfaces.length > 3
    invalid_properties.push('invalid value for "interfaces", number of items must be less than or equal to 3.')
  end

  if !@interfaces.nil? && @interfaces.length < 1
    invalid_properties.push('invalid value for "interfaces", number of items must be greater than or equal to 1.')
  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



401
402
403
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 401

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



407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 407

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



395
396
397
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 395

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



212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/linode_openapi_client/models/get_linode_config200_response.rb', line 212

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@label.nil? && @label.to_s.length > 48
  return false if !@label.nil? && @label.to_s.length < 1
  run_level_validator = EnumAttributeValidator.new('String', ["default", "single", "binbash"])
  return false unless run_level_validator.valid?(@run_level)
  return false if !@root_device.nil? && @root_device !~ Regexp.new(/a-z, A-Z, 0-9, \/, _, -/)
  return false if !@interfaces.nil? && @interfaces.length > 3
  return false if !@interfaces.nil? && @interfaces.length < 1
  virt_mode_validator = EnumAttributeValidator.new('String', ["paravirt", "fullvirt"])
  return false unless virt_mode_validator.valid?(@virt_mode)
  true
end