Class: IbmCloudPower::PVMInstanceCreate

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PVMInstanceCreate

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
269
270
271
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
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 191

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

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

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

  if attributes.key?(:'license_repository_capacity')
    self.license_repository_capacity = attributes[:'license_repository_capacity']
  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?(:'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?(:'pin_policy')
    self.pin_policy = attributes[:'pin_policy']
  end

  if attributes.key?(:'placement_group')
    self.placement_group = attributes[:'placement_group']
  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?(:'replicant_affinity_policy')
    self.replicant_affinity_policy = attributes[:'replicant_affinity_policy']
  else
    self.replicant_affinity_policy = 'none'
  end

  if attributes.key?(:'replicant_naming_scheme')
    self.replicant_naming_scheme = attributes[:'replicant_naming_scheme']
  else
    self.replicant_naming_scheme = 'suffix'
  end

  if attributes.key?(:'replicants')
    self.replicants = attributes[:'replicants']
  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?(:'software_licenses')
    self.software_licenses = attributes[:'software_licenses']
  end

  if attributes.key?(:'storage_affinity')
    self.storage_affinity = attributes[:'storage_affinity']
  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_type')
    self.storage_type = attributes[:'storage_type']
  end

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

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

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

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

Instance Attribute Details

#deployment_typeObject

The custom deployment type



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

def deployment_type
  @deployment_type
end

#image_idObject

Image ID of the image to use for the server



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

def image_id
  @image_id
end

#key_pair_nameObject

The name of the SSH key pair provided to the server for authenticating users (looked up in the tenant’s list of keys)



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

def key_pair_name
  @key_pair_name
end

#license_repository_capacityObject

The VTL license repository capacity TB value



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

def license_repository_capacity
  @license_repository_capacity
end

#memoryObject

Amount of memory allocated (in GB)



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

def memory
  @memory
end

#migratableObject

(deprecated - replaced by pinPolicy) Indicates if the server is allowed to migrate between hosts



34
35
36
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 34

def migratable
  @migratable
end

#network_idsObject

(deprecated - replaced by networks) List of Network IDs



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

def network_ids
  @network_ids
end

#networksObject

The pvm instance networks information



40
41
42
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 40

def networks
  @networks
end

#pin_policyObject

Returns the value of attribute pin_policy.



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

def pin_policy
  @pin_policy
end

#placement_groupObject

The placement group for the server



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

def placement_group
  @placement_group
end

#proc_typeObject

Processor type (dedicated, shared, capped)



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

def proc_type
  @proc_type
end

#processorsObject

Number of processors allocated



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

def processors
  @processors
end

#replicant_affinity_policyObject

Affinity policy for replicants being created; affinity for the same host, anti-affinity for different hosts, none for no preference



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

def replicant_affinity_policy
  @replicant_affinity_policy
end

#replicant_naming_schemeObject

How to name the created vms



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

def replicant_naming_scheme
  @replicant_naming_scheme
end

#replicantsObject

Number of duplicate instances to create in this request



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

def replicants
  @replicants
end

#server_nameObject

Name of the server to create



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

def server_name
  @server_name
end

#shared_processor_poolObject

The shared processor pool for server deployment



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

def shared_processor_pool
  @shared_processor_pool
end

#software_licensesObject

Returns the value of attribute software_licenses.



68
69
70
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 68

def software_licenses
  @software_licenses
end

#storage_affinityObject

Returns the value of attribute storage_affinity.



70
71
72
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 70

def storage_affinity
  @storage_affinity
end

#storage_connectionObject

The storage connection type



73
74
75
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 73

def storage_connection
  @storage_connection
end

#storage_poolObject

Storage Pool for server deployment; if provided then storageAffinity and storageType will be ignored; Only valid when you deploy one of the IBM supplied stock images. Storage type and pool for a custom image (an imported image or an image that is created from a PVMInstance capture) defaults to the storage type and pool the image was created in



76
77
78
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 76

def storage_pool
  @storage_pool
end

#storage_typeObject

Storage type for server deployment; will be ignored if storagePool or storageAffinity is provided; Only valid when you deploy one of the IBM supplied stock images. Storage type and pool for a custom image (an imported image or an image that is created from a PVMInstance capture) defaults to the storage type and pool the image was created in



79
80
81
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 79

def storage_type
  @storage_type
end

#sys_typeObject

System type used to host the instance



82
83
84
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 82

def sys_type
  @sys_type
end

#user_dataObject

Cloud init user defined data



85
86
87
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 85

def user_data
  @user_data
end

#virtual_coresObject

Returns the value of attribute virtual_cores.



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

def virtual_cores
  @virtual_cores
end

#volume_idsObject

List of volume IDs



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

def volume_ids
  @volume_ids
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



147
148
149
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 147

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



115
116
117
118
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
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 115

def self.attribute_map
  {
    :'deployment_type' => :'deploymentType',
    :'image_id' => :'imageID',
    :'key_pair_name' => :'keyPairName',
    :'license_repository_capacity' => :'licenseRepositoryCapacity',
    :'memory' => :'memory',
    :'migratable' => :'migratable',
    :'network_ids' => :'networkIDs',
    :'networks' => :'networks',
    :'pin_policy' => :'pinPolicy',
    :'placement_group' => :'placementGroup',
    :'proc_type' => :'procType',
    :'processors' => :'processors',
    :'replicant_affinity_policy' => :'replicantAffinityPolicy',
    :'replicant_naming_scheme' => :'replicantNamingScheme',
    :'replicants' => :'replicants',
    :'server_name' => :'serverName',
    :'shared_processor_pool' => :'sharedProcessorPool',
    :'software_licenses' => :'softwareLicenses',
    :'storage_affinity' => :'storageAffinity',
    :'storage_connection' => :'storageConnection',
    :'storage_pool' => :'storagePool',
    :'storage_type' => :'storageType',
    :'sys_type' => :'sysType',
    :'user_data' => :'userData',
    :'virtual_cores' => :'virtualCores',
    :'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



457
458
459
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 457

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

.openapi_nullableObject

List of attributes with nullable: true



184
185
186
187
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 184

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'deployment_type' => :'String',
    :'image_id' => :'String',
    :'key_pair_name' => :'String',
    :'license_repository_capacity' => :'Integer',
    :'memory' => :'Float',
    :'migratable' => :'Boolean',
    :'network_ids' => :'Array<String>',
    :'networks' => :'Array<PVMInstanceAddNetwork>',
    :'pin_policy' => :'PinPolicy',
    :'placement_group' => :'String',
    :'proc_type' => :'String',
    :'processors' => :'Float',
    :'replicant_affinity_policy' => :'String',
    :'replicant_naming_scheme' => :'String',
    :'replicants' => :'Float',
    :'server_name' => :'String',
    :'shared_processor_pool' => :'String',
    :'software_licenses' => :'SoftwareLicenses',
    :'storage_affinity' => :'StorageAffinity',
    :'storage_connection' => :'String',
    :'storage_pool' => :'String',
    :'storage_type' => :'String',
    :'sys_type' => :'String',
    :'user_data' => :'String',
    :'virtual_cores' => :'VirtualCores',
    :'volume_ids' => :'Array<String>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      deployment_type == o.deployment_type &&
      image_id == o.image_id &&
      key_pair_name == o.key_pair_name &&
      license_repository_capacity == o.license_repository_capacity &&
      memory == o.memory &&
      migratable == o.migratable &&
      network_ids == o.network_ids &&
      networks == o.networks &&
      pin_policy == o.pin_policy &&
      placement_group == o.placement_group &&
      proc_type == o.proc_type &&
      processors == o.processors &&
      replicant_affinity_policy == o.replicant_affinity_policy &&
      replicant_naming_scheme == o.replicant_naming_scheme &&
      replicants == o.replicants &&
      server_name == o.server_name &&
      shared_processor_pool == o.shared_processor_pool &&
      software_licenses == o.software_licenses &&
      storage_affinity == o.storage_affinity &&
      storage_connection == o.storage_connection &&
      storage_pool == o.storage_pool &&
      storage_type == o.storage_type &&
      sys_type == o.sys_type &&
      user_data == o.user_data &&
      virtual_cores == o.virtual_cores &&
      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



488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 488

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



559
560
561
562
563
564
565
566
567
568
569
570
571
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 559

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



464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 464

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  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


444
445
446
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 444

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



450
451
452
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 450

def hash
  [deployment_type, image_id, key_pair_name, license_repository_capacity, memory, migratable, network_ids, networks, pin_policy, placement_group, proc_type, processors, replicant_affinity_policy, replicant_naming_scheme, replicants, server_name, shared_processor_pool, software_licenses, storage_affinity, storage_connection, storage_pool, storage_type, sys_type, user_data, virtual_cores, 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



325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 325

def list_invalid_properties
  invalid_properties = Array.new
  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 @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 @server_name.nil?
    invalid_properties.push('invalid value for "server_name", server_name 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



535
536
537
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 535

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



541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 541

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



529
530
531
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 529

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



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/ibm_cloud_power/models/pvm_instance_create.rb', line 352

def valid?
  return false if @image_id.nil?
  return false if @memory.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?
  replicant_affinity_policy_validator = EnumAttributeValidator.new('String', ["affinity", "anti-affinity", "none"])
  return false unless replicant_affinity_policy_validator.valid?(@replicant_affinity_policy)
  replicant_naming_scheme_validator = EnumAttributeValidator.new('String', ["prefix", "suffix"])
  return false unless replicant_naming_scheme_validator.valid?(@replicant_naming_scheme)
  return false if @server_name.nil?
  storage_connection_validator = EnumAttributeValidator.new('String', ["vSCSI"])
  return false unless storage_connection_validator.valid?(@storage_connection)
  true
end