Class: IbmCloudPower::PVMInstanceReferenceV2

Inherits:
ApiModelBase show all
Defined in:
lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb

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

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

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

  if attributes.key?(:'cores')
    self.cores = attributes[:'cores']
  else
    self.cores = nil
  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?(:'deployment')
    self.deployment = attributes[:'deployment']
  else
    self.deployment = nil
  end

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

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

  if attributes.key?(:'href')
    self.href = attributes[:'href']
  else
    self.href = nil
  end

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

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

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

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

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

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

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  else
    self.status = nil
  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?(:'vpmem_volumes')
    if (value = attributes[:'vpmem_volumes']).is_a?(Array)
      self.vpmem_volumes = value
    end
  end
end

Instance Attribute Details

#configurationObject

The pvm instance server configuration



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

def configuration
  @configuration
end

#coresObject

The pvm instance cores information



22
23
24
# File 'lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb', line 22

def cores
  @cores
end

#creation_dateObject

Date/Time of PVM creation



25
26
27
# File 'lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb', line 25

def creation_date
  @creation_date
end

#crnObject

The CRN for this resource



28
29
30
# File 'lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb', line 28

def crn
  @crn
end

#deploymentObject

The pvm instance deployment information



31
32
33
# File 'lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb', line 31

def deployment
  @deployment
end

#healthObject

Returns the value of attribute health.



33
34
35
# File 'lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb', line 33

def health
  @health
end

#hostObject

The pvm instance host information



36
37
38
# File 'lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb', line 36

def host
  @host
end

#hrefObject

Link to Cloud Instance resource



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

def href
  @href
end

#idObject

PCloud PVM Instance ID



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

def id
  @id
end

#memoryObject

The pvm instance memory information



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

def memory
  @memory
end

#nameObject

Name of the server



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

def name
  @name
end

#network_portsObject

The pvm instance network ports information



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

def network_ports
  @network_ports
end

#operating_systemObject

The pvm instance OS system information



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

def operating_system
  @operating_system
end

#placement_groupObject

The pvm instance placement group information



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

def placement_group
  @placement_group
end

#statusObject

The status of the instance



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

def status
  @status
end

#virtual_coresObject

The pvm instance virtual CPU information



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

def virtual_cores
  @virtual_cores
end

#virtual_serial_numberObject

Information about Virtual Serial Number assigned to the PVM Instance



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

def virtual_serial_number
  @virtual_serial_number
end

#vpmem_volumesObject

List of vPMEM volumes attached to this PVM Instance



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

def vpmem_volumes
  @vpmem_volumes
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



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

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



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

def self.acceptable_attributes
  acceptable_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
87
88
89
90
91
92
93
# File 'lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb', line 72

def self.attribute_map
  {
    :'configuration' => :'configuration',
    :'cores' => :'cores',
    :'creation_date' => :'creationDate',
    :'crn' => :'crn',
    :'deployment' => :'deployment',
    :'health' => :'health',
    :'host' => :'host',
    :'href' => :'href',
    :'id' => :'id',
    :'memory' => :'memory',
    :'name' => :'name',
    :'network_ports' => :'networkPorts',
    :'operating_system' => :'operatingSystem',
    :'placement_group' => :'placementGroup',
    :'status' => :'status',
    :'virtual_cores' => :'virtualCores',
    :'virtual_serial_number' => :'virtualSerialNumber',
    :'vpmem_volumes' => :'vpmemVolumes'
  }
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



436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb', line 436

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



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

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb', line 106

def self.openapi_types
  {
    :'configuration' => :'PVMInstanceConfiguration',
    :'cores' => :'PVMInstanceCores',
    :'creation_date' => :'Time',
    :'crn' => :'String',
    :'deployment' => :'PvmInstanceDeployment',
    :'health' => :'PVMInstanceV2Health',
    :'host' => :'PvmInstanceHost',
    :'href' => :'String',
    :'id' => :'String',
    :'memory' => :'PVMInstanceMemory',
    :'name' => :'String',
    :'network_ports' => :'Array<PVMInstanceV2NetworkPort>',
    :'operating_system' => :'PVMInstanceOperatingSystem',
    :'placement_group' => :'PvmInstancePlacementGroup',
    :'status' => :'String',
    :'virtual_cores' => :'PVMInstanceVirtualCores',
    :'virtual_serial_number' => :'GetServerVirtualSerialNumber',
    :'vpmem_volumes' => :'Array<VPMemVolumeReference>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb', line 398

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      configuration == o.configuration &&
      cores == o.cores &&
      creation_date == o.creation_date &&
      crn == o.crn &&
      deployment == o.deployment &&
      health == o.health &&
      host == o.host &&
      href == o.href &&
      id == o.id &&
      memory == o.memory &&
      name == o.name &&
      network_ports == o.network_ports &&
      operating_system == o.operating_system &&
      placement_group == o.placement_group &&
      status == o.status &&
      virtual_cores == o.virtual_cores &&
      virtual_serial_number == o.virtual_serial_number &&
      vpmem_volumes == o.vpmem_volumes
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


423
424
425
# File 'lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb', line 423

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



429
430
431
# File 'lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb', line 429

def hash
  [configuration, cores, creation_date, crn, deployment, health, host, href, id, memory, name, network_ports, operating_system, placement_group, status, virtual_cores, virtual_serial_number, vpmem_volumes].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb', line 248

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @cores.nil?
    invalid_properties.push('invalid value for "cores", cores cannot be nil.')
  end

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

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

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

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

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

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

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

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

  invalid_properties
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/ibm_cloud_power/models/pvm_instance_reference_v2.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

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/ibm_cloud_power/models/pvm_instance_reference_v2.rb', line 292

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @cores.nil?
  return false if @deployment.nil?
  return false if @href.nil?
  return false if @id.nil?
  return false if @memory.nil?
  return false if @name.nil?
  return false if @network_ports.nil?
  return false if @operating_system.nil?
  return false if @status.nil?
  true
end