Class: IbmCloudPower::PVMInstance

Inherits:
Object
  • Object
show all
Defined in:
lib/ibm_cloud_power/models/pvm_instance.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PVMInstance

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
351
352
353
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
392
393
394
395
396
397
398
399
400
401
402
403
404
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
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 293

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'migratable')
    self.migratable = attributes[:'migratable']
  else
    self.migratable = true
  end

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

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

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

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

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

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

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

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

  if attributes.key?(:'proc_type')
    self.proc_type = attributes[:'proc_type']
  else
    self.proc_type = 'dedicated'
  end

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'storage_pool_affinity')
    self.storage_pool_affinity = attributes[:'storage_pool_affinity']
  else
    self.storage_pool_affinity = true
  end

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

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

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

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

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

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

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

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

Instance Attribute Details

#addressesObject

(deprecated - replaced by networks) The list of addresses and their network information



19
20
21
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 19

def addresses
  @addresses
end

#console_languageObject

Returns the value of attribute console_language.



21
22
23
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 21

def console_language
  @console_language
end

#creation_dateObject

Date/Time of PVM creation



24
25
26
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 24

def creation_date
  @creation_date
end

#crnObject

Returns the value of attribute crn.



26
27
28
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 26

def crn
  @crn
end

#dedicated_host_idObject

ID of the dedicated host where the PVM Instance is running, if applicable



29
30
31
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 29

def dedicated_host_id
  @dedicated_host_id
end

#deployment_typeObject

The custom deployment type



32
33
34
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 32

def deployment_type
  @deployment_type
end

#disk_sizeObject

Size of allocated disk (in GB)



35
36
37
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 35

def disk_size
  @disk_size
end

#faultObject

Returns the value of attribute fault.



37
38
39
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 37

def fault
  @fault
end

#healthObject

Returns the value of attribute health.



39
40
41
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 39

def health
  @health
end

#host_idObject

The PVM Instance Host ID (Internal Use Only)



42
43
44
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 42

def host_id
  @host_id
end

#image_idObject

The ImageID used by the server



45
46
47
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 45

def image_id
  @image_id
end

#license_repository_capacityObject

The VTL license repository capacity TB value



48
49
50
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 48

def license_repository_capacity
  @license_repository_capacity
end

#maxmemObject

Maximum amount of memory that can be allocated (in GB, for resize)



51
52
53
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 51

def maxmem
  @maxmem
end

#maxprocObject

Maximum number of processors that can be allocated (for resize)



54
55
56
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 54

def maxproc
  @maxproc
end

#memoryObject

Amount of memory allocated (in GB)



57
58
59
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 57

def memory
  @memory
end

#migratableObject

whether the instance can be migrated



60
61
62
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 60

def migratable
  @migratable
end

#minmemObject

Minimum amount of memory that can be allocated (in GB, for resize)



63
64
65
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 63

def minmem
  @minmem
end

#minprocObject

Minimum number of processors that can be allocated (for resize)



66
67
68
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 66

def minproc
  @minproc
end

#network_idsObject

(deprecated - replaced by networks) List of Network IDs



69
70
71
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 69

def network_ids
  @network_ids
end

#networksObject

The pvm instance networks information



72
73
74
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 72

def networks
  @networks
end

#operating_systemObject

OS system information (usually version and build)



75
76
77
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 75

def operating_system
  @operating_system
end

#os_typeObject

Type of the OS [aix, ibmi, rhel, sles, vtl, rhcos]



78
79
80
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 78

def os_type
  @os_type
end

#pin_policyObject

VM pinning policy to use [none, soft, hard]



81
82
83
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 81

def pin_policy
  @pin_policy
end

#placement_groupObject

The placement group of the server



84
85
86
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 84

def placement_group
  @placement_group
end

#proc_typeObject

Processor type (dedicated, shared, capped)



87
88
89
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 87

def proc_type
  @proc_type
end

#processorsObject

Number of processors allocated



90
91
92
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 90

def processors
  @processors
end

#progressObject

The progress of an operation



93
94
95
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 93

def progress
  @progress
end

#pvm_instance_idObject

PCloud PVM Instance ID



96
97
98
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 96

def pvm_instance_id
  @pvm_instance_id
end

#sap_profileObject

Returns the value of attribute sap_profile.



98
99
100
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 98

def sap_profile
  @sap_profile
end

#server_nameObject

Name of the server



101
102
103
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 101

def server_name
  @server_name
end

#shared_processor_poolObject

The shared processor pool of the server



104
105
106
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 104

def shared_processor_pool
  @shared_processor_pool
end

#shared_processor_pool_idObject

The shared processor pool id



107
108
109
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 107

def shared_processor_pool_id
  @shared_processor_pool_id
end

#software_licensesObject

Returns the value of attribute software_licenses.



109
110
111
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 109

def software_licenses
  @software_licenses
end

#srcsObject

The pvm instance SRC lists



112
113
114
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 112

def srcs
  @srcs
end

#statusObject

The status of the instance



115
116
117
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 115

def status
  @status
end

#storage_connectionObject

The storage connection type



118
119
120
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 118

def storage_connection
  @storage_connection
end

#storage_poolObject

Storage Pool where server is deployed



121
122
123
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 121

def storage_pool
  @storage_pool
end

#storage_pool_affinityObject

Indicates if all volumes attached to the server must reside in the same storage pool; Defaults to true when initially deploying a PVMInstance



124
125
126
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 124

def storage_pool_affinity
  @storage_pool_affinity
end

#storage_typeObject

Storage type where server is deployed



127
128
129
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 127

def storage_type
  @storage_type
end

#sys_typeObject

System type used to host the instance



130
131
132
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 130

def sys_type
  @sys_type
end

#task_stateObject

Represents the task state of a virtual machine (VM).



133
134
135
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 133

def task_state
  @task_state
end

#updated_dateObject

Date/Time of PVM last update



136
137
138
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 136

def updated_date
  @updated_date
end

#user_tagsObject

Returns the value of attribute user_tags.



138
139
140
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 138

def user_tags
  @user_tags
end

#virtual_coresObject

Returns the value of attribute virtual_cores.



140
141
142
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 140

def virtual_cores
  @virtual_cores
end

#virtual_serial_numberObject

Returns the value of attribute virtual_serial_number.



142
143
144
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 142

def virtual_serial_number
  @virtual_serial_number
end

#volume_idsObject

List of volume IDs



145
146
147
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 145

def volume_ids
  @volume_ids
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



222
223
224
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 222

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 170

def self.attribute_map
  {
    :'addresses' => :'addresses',
    :'console_language' => :'consoleLanguage',
    :'creation_date' => :'creationDate',
    :'crn' => :'crn',
    :'dedicated_host_id' => :'dedicatedHostID',
    :'deployment_type' => :'deploymentType',
    :'disk_size' => :'diskSize',
    :'fault' => :'fault',
    :'health' => :'health',
    :'host_id' => :'hostID',
    :'image_id' => :'imageID',
    :'license_repository_capacity' => :'licenseRepositoryCapacity',
    :'maxmem' => :'maxmem',
    :'maxproc' => :'maxproc',
    :'memory' => :'memory',
    :'migratable' => :'migratable',
    :'minmem' => :'minmem',
    :'minproc' => :'minproc',
    :'network_ids' => :'networkIDs',
    :'networks' => :'networks',
    :'operating_system' => :'operatingSystem',
    :'os_type' => :'osType',
    :'pin_policy' => :'pinPolicy',
    :'placement_group' => :'placementGroup',
    :'proc_type' => :'procType',
    :'processors' => :'processors',
    :'progress' => :'progress',
    :'pvm_instance_id' => :'pvmInstanceID',
    :'sap_profile' => :'sapProfile',
    :'server_name' => :'serverName',
    :'shared_processor_pool' => :'sharedProcessorPool',
    :'shared_processor_pool_id' => :'sharedProcessorPoolID',
    :'software_licenses' => :'softwareLicenses',
    :'srcs' => :'srcs',
    :'status' => :'status',
    :'storage_connection' => :'storageConnection',
    :'storage_pool' => :'storagePool',
    :'storage_pool_affinity' => :'storagePoolAffinity',
    :'storage_type' => :'storageType',
    :'sys_type' => :'sysType',
    :'task_state' => :'taskState',
    :'updated_date' => :'updatedDate',
    :'user_tags' => :'userTags',
    :'virtual_cores' => :'virtualCores',
    :'virtual_serial_number' => :'virtualSerialNumber',
    :'volume_ids' => :'volumeIDs'
  }
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



662
663
664
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 662

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



279
280
281
282
283
284
285
286
287
288
289
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 279

def self.openapi_nullable
  Set.new([
    :'console_language',
    :'crn',
    :'sap_profile',
    :'software_licenses',
    :'user_tags',
    :'virtual_cores',
    :'virtual_serial_number',
  ])
end

.openapi_typesObject

Attribute type mapping.



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
269
270
271
272
273
274
275
276
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 227

def self.openapi_types
  {
    :'addresses' => :'Array<PVMInstanceNetwork>',
    :'console_language' => :'ConsoleLanguage',
    :'creation_date' => :'Time',
    :'crn' => :'String',
    :'dedicated_host_id' => :'String',
    :'deployment_type' => :'String',
    :'disk_size' => :'Float',
    :'fault' => :'PVMInstanceFault',
    :'health' => :'PVMInstanceHealth',
    :'host_id' => :'Integer',
    :'image_id' => :'String',
    :'license_repository_capacity' => :'Integer',
    :'maxmem' => :'Float',
    :'maxproc' => :'Float',
    :'memory' => :'Float',
    :'migratable' => :'Boolean',
    :'minmem' => :'Float',
    :'minproc' => :'Float',
    :'network_ids' => :'Array<String>',
    :'networks' => :'Array<PVMInstanceNetwork>',
    :'operating_system' => :'String',
    :'os_type' => :'String',
    :'pin_policy' => :'String',
    :'placement_group' => :'String',
    :'proc_type' => :'String',
    :'processors' => :'Float',
    :'progress' => :'Float',
    :'pvm_instance_id' => :'String',
    :'sap_profile' => :'SAPProfileReference',
    :'server_name' => :'String',
    :'shared_processor_pool' => :'String',
    :'shared_processor_pool_id' => :'String',
    :'software_licenses' => :'SoftwareLicenses',
    :'srcs' => :'Array<Array<SRC>>',
    :'status' => :'String',
    :'storage_connection' => :'String',
    :'storage_pool' => :'String',
    :'storage_pool_affinity' => :'Boolean',
    :'storage_type' => :'String',
    :'sys_type' => :'String',
    :'task_state' => :'String',
    :'updated_date' => :'Time',
    :'user_tags' => :'Array',
    :'virtual_cores' => :'VirtualCores',
    :'virtual_serial_number' => :'GetServerVirtualSerialNumber',
    :'volume_ids' => :'Array<String>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 596

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      addresses == o.addresses &&
      console_language == o.console_language &&
      creation_date == o.creation_date &&
      crn == o.crn &&
      dedicated_host_id == o.dedicated_host_id &&
      deployment_type == o.deployment_type &&
      disk_size == o.disk_size &&
      fault == o.fault &&
      health == o.health &&
      host_id == o.host_id &&
      image_id == o.image_id &&
      license_repository_capacity == o.license_repository_capacity &&
      maxmem == o.maxmem &&
      maxproc == o.maxproc &&
      memory == o.memory &&
      migratable == o.migratable &&
      minmem == o.minmem &&
      minproc == o.minproc &&
      network_ids == o.network_ids &&
      networks == o.networks &&
      operating_system == o.operating_system &&
      os_type == o.os_type &&
      pin_policy == o.pin_policy &&
      placement_group == o.placement_group &&
      proc_type == o.proc_type &&
      processors == o.processors &&
      progress == o.progress &&
      pvm_instance_id == o.pvm_instance_id &&
      sap_profile == o.sap_profile &&
      server_name == o.server_name &&
      shared_processor_pool == o.shared_processor_pool &&
      shared_processor_pool_id == o.shared_processor_pool_id &&
      software_licenses == o.software_licenses &&
      srcs == o.srcs &&
      status == o.status &&
      storage_connection == o.storage_connection &&
      storage_pool == o.storage_pool &&
      storage_pool_affinity == o.storage_pool_affinity &&
      storage_type == o.storage_type &&
      sys_type == o.sys_type &&
      task_state == o.task_state &&
      updated_date == o.updated_date &&
      user_tags == o.user_tags &&
      virtual_cores == o.virtual_cores &&
      virtual_serial_number == o.virtual_serial_number &&
      volume_ids == o.volume_ids
end

#_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



692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 692

def _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 = IbmCloudPower.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
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



763
764
765
766
767
768
769
770
771
772
773
774
775
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 763

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

#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



669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 669

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


649
650
651
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 649

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



655
656
657
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 655

def hash
  [addresses, console_language, creation_date, crn, dedicated_host_id, deployment_type, disk_size, fault, health, host_id, image_id, license_repository_capacity, maxmem, maxproc, memory, migratable, minmem, minproc, network_ids, networks, operating_system, os_type, pin_policy, placement_group, proc_type, processors, progress, pvm_instance_id, sap_profile, server_name, shared_processor_pool, shared_processor_pool_id, software_licenses, srcs, status, storage_connection, storage_pool, storage_pool_affinity, storage_type, sys_type, task_state, updated_date, user_tags, virtual_cores, virtual_serial_number, volume_ids].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 511

def list_invalid_properties
  invalid_properties = Array.new
  if @disk_size.nil?
    invalid_properties.push('invalid value for "disk_size", disk_size cannot be nil.')
  end

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

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

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

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

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

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

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

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

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

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

  if @volume_ids.nil?
    invalid_properties.push('invalid value for "volume_ids", volume_ids cannot be nil.')
  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



739
740
741
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 739

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



745
746
747
748
749
750
751
752
753
754
755
756
757
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 745

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



733
734
735
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 733

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



566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
# File 'lib/ibm_cloud_power/models/pvm_instance.rb', line 566

def valid?
  return false if @disk_size.nil?
  return false if @image_id.nil?
  return false if @memory.nil?
  return false if @network_ids.nil?
  return false if @os_type.nil?
  return false if @proc_type.nil?
  proc_type_validator = EnumAttributeValidator.new('String', ["dedicated", "shared", "capped", ""])
  return false unless proc_type_validator.valid?(@proc_type)
  return false if @processors.nil?
  return false if @pvm_instance_id.nil?
  return false if @server_name.nil?
  return false if @status.nil?
  return false if @storage_type.nil?
  return false if @volume_ids.nil?
  true
end