Class: NutanixVmm::VmmV40EsxiConfigVm

Inherits:
ApiModelBase show all
Defined in:
lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb

Overview

VM configuration.

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 = {}) ⇒ VmmV40EsxiConfigVm

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
260
261
262
263
264
265
266
267
268
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 169

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#categoriesObject

Categories for the VM.



39
40
41
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 39

def categories
  @categories
end

#cd_romsObject

CD-ROMs attached to the VM.



66
67
68
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 66

def cd_roms
  @cd_roms
end

#clusterObject

Returns the value of attribute cluster.



31
32
33
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 31

def cluster
  @cluster
end

#descriptionObject

VM description.



36
37
38
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 36

def description
  @description
end

#disksObject

Disks attached to the VM.



63
64
65
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 63

def disks
  @disks
end

#ext_idObject

A globally unique identifier of an instance that is suitable for external consumption.



23
24
25
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 23

def ext_id
  @ext_id
end

#guest_os_nameObject

Name of the guest OS.



57
58
59
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 57

def guest_os_name
  @guest_os_name
end

#hostObject

Returns the value of attribute host.



33
34
35
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 33

def host
  @host
end

A HATEOAS style link for the response. Each link contains a user-friendly name identifying the link and an address for retrieving the particular resource.



26
27
28
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 26

def links
  @links
end

#memory_size_bytesObject

Memory size in bytes.



48
49
50
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 48

def memory_size_bytes
  @memory_size_bytes
end

#nameObject

VM name.



29
30
31
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 29

def name
  @name
end

#nicsObject

NICs attached to the VM.



69
70
71
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 69

def nics
  @nics
end

#num_cores_per_socketObject

Number of cores per socket.



51
52
53
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 51

def num_cores_per_socket
  @num_cores_per_socket
end

#num_cpusObject

Number of vCPUs.



54
55
56
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 54

def num_cpus
  @num_cpus
end

#nutanix_guest_toolsObject

Returns the value of attribute nutanix_guest_tools.



43
44
45
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 43

def nutanix_guest_tools
  @nutanix_guest_tools
end

#ownership_infoObject

Returns the value of attribute ownership_info.



41
42
43
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 41

def ownership_info
  @ownership_info
end

#power_stateObject

Returns the value of attribute power_state.



45
46
47
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 45

def power_state
  @power_state
end

#tenant_idObject

A globally unique identifier that represents the tenant that owns this entity. The system automatically assigns it, and it and is immutable from an API consumer perspective (some use cases may cause this Id to change - For instance, a use case may require the transfer of ownership of the entity, but these cases are handled automatically on the server).



20
21
22
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 20

def tenant_id
  @tenant_id
end

#virtual_hardware_versionObject

Virtual hardware version of the VM.



60
61
62
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 60

def virtual_hardware_version
  @virtual_hardware_version
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



119
120
121
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 119

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



124
125
126
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 124

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 94

def self.attribute_map
  {
    :'tenant_id' => :'tenantId',
    :'ext_id' => :'extId',
    :'links' => :'links',
    :'name' => :'name',
    :'cluster' => :'cluster',
    :'host' => :'host',
    :'description' => :'description',
    :'categories' => :'categories',
    :'ownership_info' => :'ownershipInfo',
    :'nutanix_guest_tools' => :'nutanixGuestTools',
    :'power_state' => :'powerState',
    :'memory_size_bytes' => :'memorySizeBytes',
    :'num_cores_per_socket' => :'numCoresPerSocket',
    :'num_cpus' => :'numCpus',
    :'guest_os_name' => :'guestOsName',
    :'virtual_hardware_version' => :'virtualHardwareVersion',
    :'disks' => :'disks',
    :'cd_roms' => :'cdRoms',
    :'nics' => :'nics'
  }
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



618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 618

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_all_ofObject

List of class defined in allOf (OpenAPI v3)



161
162
163
164
165
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 161

def self.openapi_all_of
  [
  :'CommonV10ResponseExternalizableAbstractModel'
  ]
end

.openapi_nullableObject

List of attributes with nullable: true



154
155
156
157
158
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 154

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

.openapi_typesObject

Attribute type mapping.



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/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 129

def self.openapi_types
  {
    :'tenant_id' => :'String',
    :'ext_id' => :'String',
    :'links' => :'Array<CommonV10ResponseApiLink>',
    :'name' => :'String',
    :'cluster' => :'VmmV40EsxiConfigClusterReference',
    :'host' => :'VmmV40EsxiConfigHostReference',
    :'description' => :'String',
    :'categories' => :'Array<VmmV40EsxiConfigCategoryReference>',
    :'ownership_info' => :'VmmV40EsxiConfigOwnershipInfo',
    :'nutanix_guest_tools' => :'VmmV40EsxiConfigNutanixGuestTools',
    :'power_state' => :'VmmV40EsxiConfigPowerState',
    :'memory_size_bytes' => :'Integer',
    :'num_cores_per_socket' => :'Integer',
    :'num_cpus' => :'Integer',
    :'guest_os_name' => :'String',
    :'virtual_hardware_version' => :'Integer',
    :'disks' => :'Array<VmmV40EsxiConfigDisk>',
    :'cd_roms' => :'Array<VmmV40EsxiConfigCdRom>',
    :'nics' => :'Array<VmmV40EsxiConfigNic>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 579

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      tenant_id == o.tenant_id &&
      ext_id == o.ext_id &&
      links == o.links &&
      name == o.name &&
      cluster == o.cluster &&
      host == o.host &&
      description == o.description &&
      categories == o.categories &&
      ownership_info == o.ownership_info &&
      nutanix_guest_tools == o.nutanix_guest_tools &&
      power_state == o.power_state &&
      memory_size_bytes == o.memory_size_bytes &&
      num_cores_per_socket == o.num_cores_per_socket &&
      num_cpus == o.num_cpus &&
      guest_os_name == o.guest_os_name &&
      virtual_hardware_version == o.virtual_hardware_version &&
      disks == o.disks &&
      cd_roms == o.cd_roms &&
      nics == o.nics
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


605
606
607
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 605

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



611
612
613
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 611

def hash
  [tenant_id, ext_id, links, name, cluster, host, description, categories, ownership_info, nutanix_guest_tools, power_state, memory_size_bytes, num_cores_per_socket, num_cpus, guest_os_name, virtual_hardware_version, disks, cd_roms, nics].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
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
344
345
346
347
348
349
350
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 272

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  pattern = Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  if !@tenant_id.nil? && @tenant_id !~ pattern
    invalid_properties.push("invalid value for \"tenant_id\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  if !@ext_id.nil? && @ext_id !~ pattern
    invalid_properties.push("invalid value for \"ext_id\", must conform to the pattern #{pattern}.")
  end

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

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

  if !@name.nil? && @name.to_s.length > 80
    invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 80.')
  end

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

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

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

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

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

  if !@guest_os_name.nil? && @guest_os_name.to_s.length > 256
    invalid_properties.push('invalid value for "guest_os_name", the character length must be smaller than or equal to 256.')
  end

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

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

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

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

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

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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



640
641
642
643
644
645
646
647
648
649
650
651
652
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 640

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



354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/nutanix_vmm/models/vmm_v40_esxi_config_vm.rb', line 354

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@tenant_id.nil? && @tenant_id !~ Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  return false if !@ext_id.nil? && @ext_id !~ Regexp.new(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
  return false if !@links.nil? && @links.length > 20
  return false if !@links.nil? && @links.length < 0
  return false if !@name.nil? && @name.to_s.length > 80
  return false if !@categories.nil? && @categories.length > 256
  return false if !@categories.nil? && @categories.length < 0
  return false if !@memory_size_bytes.nil? && @memory_size_bytes < 1
  return false if !@num_cores_per_socket.nil? && @num_cores_per_socket < 1
  return false if !@num_cpus.nil? && @num_cpus < 1
  return false if !@guest_os_name.nil? && @guest_os_name.to_s.length > 256
  return false if !@virtual_hardware_version.nil? && @virtual_hardware_version < 1
  return false if !@disks.nil? && @disks.length > 256
  return false if !@disks.nil? && @disks.length < 0
  return false if !@cd_roms.nil? && @cd_roms.length > 256
  return false if !@cd_roms.nil? && @cd_roms.length < 0
  return false if !@nics.nil? && @nics.length > 32
  return false if !@nics.nil? && @nics.length < 0
  true
end