Class: BmcApi::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/pnap_bmc_api/models/server.rb

Overview

Bare metal server.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Server

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/pnap_bmc_api/models/server.rb', line 176

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'pricing_model')
    self.pricing_model = attributes[:'pricing_model']
  else
    self.pricing_model = 'HOURLY'
  end

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

  if attributes.key?(:'network_type')
    self.network_type = attributes[:'network_type']
  else
    self.network_type = 'PUBLIC_AND_PRIVATE'
  end

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

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

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

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

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

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

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

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

Instance Attribute Details

#cluster_idObject

The cluster reference id if any.



77
78
79
# File 'lib/pnap_bmc_api/models/server.rb', line 77

def cluster_id
  @cluster_id
end

#cores_per_cpuObject

The number of physical cores present on each CPU.



47
48
49
# File 'lib/pnap_bmc_api/models/server.rb', line 47

def cores_per_cpu
  @cores_per_cpu
end

#cpuObject

A description of the machine CPU.



41
42
43
# File 'lib/pnap_bmc_api/models/server.rb', line 41

def cpu
  @cpu
end

#cpu_countObject

The number of CPUs available in the system.



44
45
46
# File 'lib/pnap_bmc_api/models/server.rb', line 44

def cpu_count
  @cpu_count
end

#cpu_frequencyObject

The CPU frequency in GHz.



50
51
52
# File 'lib/pnap_bmc_api/models/server.rb', line 50

def cpu_frequency
  @cpu_frequency
end

#descriptionObject

Description of server.



29
30
31
# File 'lib/pnap_bmc_api/models/server.rb', line 29

def description
  @description
end

#hostnameObject

Hostname of server.



26
27
28
# File 'lib/pnap_bmc_api/models/server.rb', line 26

def hostname
  @hostname
end

#idObject

The unique identifier of the server.



20
21
22
# File 'lib/pnap_bmc_api/models/server.rb', line 20

def id
  @id
end

#locationObject

Server location ID. Cannot be changed once a server is created. Currently this field should be set to ‘PHX`, `ASH`, `SGP`, `NLD`, `CHI`, `SEA` or `AUS`.



38
39
40
# File 'lib/pnap_bmc_api/models/server.rb', line 38

def location
  @location
end

#network_configurationObject

Returns the value of attribute network_configuration.



87
88
89
# File 'lib/pnap_bmc_api/models/server.rb', line 87

def network_configuration
  @network_configuration
end

#network_typeObject

The type of network configuration for this server. Currently this field should be set to ‘PUBLIC_AND_PRIVATE`, `PRIVATE_ONLY`, `PUBLIC_ONLY` or `NONE`.



74
75
76
# File 'lib/pnap_bmc_api/models/server.rb', line 74

def network_type
  @network_type
end

#osObject

The server’s OS ID used when the server was created. Currently this field should be set to either ‘ubuntu/bionic`, `ubuntu/focal`, `ubuntu/jammy`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux9`, `debian/bullseye`, `debian/bookworm`, `proxmox/bullseye`, `proxmox/proxmox8`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` or `netris/softgate_25g`.



32
33
34
# File 'lib/pnap_bmc_api/models/server.rb', line 32

def os
  @os
end

#os_configurationObject

Returns the value of attribute os_configuration.



85
86
87
# File 'lib/pnap_bmc_api/models/server.rb', line 85

def os_configuration
  @os_configuration
end

#passwordObject

Auto-generated password set for user ‘Admin` on Windows server, user `root` on ESXi servers, user `root` on Proxmox server and user `netris` on Netris servers.
The password is not stored and therefore will only be returned in response to provisioning a server. Copy and save it for future reference.



71
72
73
# File 'lib/pnap_bmc_api/models/server.rb', line 71

def password
  @password
end

#pricing_modelObject

The pricing model this server is being billed. Currently this field should be set to ‘HOURLY`, `ONE_MONTH_RESERVATION`, `TWELVE_MONTHS_RESERVATION`, `TWENTY_FOUR_MONTHS_RESERVATION` or `THIRTY_SIX_MONTHS_RESERVATION`.



68
69
70
# File 'lib/pnap_bmc_api/models/server.rb', line 68

def pricing_model
  @pricing_model
end

#private_ip_addressesObject

Private IP addresses assigned to server.



59
60
61
# File 'lib/pnap_bmc_api/models/server.rb', line 59

def private_ip_addresses
  @private_ip_addresses
end

#provisioned_onObject

Date and time when server was provisioned.



83
84
85
# File 'lib/pnap_bmc_api/models/server.rb', line 83

def provisioned_on
  @provisioned_on
end

#public_ip_addressesObject

Public IP addresses assigned to server.



62
63
64
# File 'lib/pnap_bmc_api/models/server.rb', line 62

def public_ip_addresses
  @public_ip_addresses
end

#ramObject

A description of the machine RAM.



53
54
55
# File 'lib/pnap_bmc_api/models/server.rb', line 53

def ram
  @ram
end

#reservation_idObject

The reservation reference id if any.



65
66
67
# File 'lib/pnap_bmc_api/models/server.rb', line 65

def reservation_id
  @reservation_id
end

#statusObject

The status of the server. Can have one of the following values: ‘creating` , `powered-on` , `powered-off` , `rebooting` , `resetting` , `deleting` , `reserved` , `error` or `reinstating`.



23
24
25
# File 'lib/pnap_bmc_api/models/server.rb', line 23

def status
  @status
end

#storageObject

A description of the machine storage.



56
57
58
# File 'lib/pnap_bmc_api/models/server.rb', line 56

def storage
  @storage
end

#storage_configurationObject

Returns the value of attribute storage_configuration.



89
90
91
# File 'lib/pnap_bmc_api/models/server.rb', line 89

def storage_configuration
  @storage_configuration
end

#superseded_byObject

Unique identifier of the server to which the reservation has been transferred.



92
93
94
# File 'lib/pnap_bmc_api/models/server.rb', line 92

def superseded_by
  @superseded_by
end

#supersedesObject

Unique identifier of the server from which the reservation has been transferred.



95
96
97
# File 'lib/pnap_bmc_api/models/server.rb', line 95

def supersedes
  @supersedes
end

#tagsObject

The tags assigned if any.



80
81
82
# File 'lib/pnap_bmc_api/models/server.rb', line 80

def tags
  @tags
end

#typeObject

Server type ID. Cannot be changed once a server is created. Currently this field should be set to either ‘s0.d1.small`, `s0.d1.medium`, `s1.c1.small`, `s1.c1.medium`, `s1.c2.medium`, `s1.c2.large`, `s1.e1.small`, `s1.e1.medium`, `s1.e1.large`, `s2.c1.small`, `s2.c1.medium`, `s2.c1.large`, `s2.c2.small`, `s2.c2.medium`, `s2.c2.large`, `d1.c1.small`, `d1.c2.small`, `d1.c3.small`, `d1.c4.small`, `d1.c1.medium`, `d1.c2.medium`, `d1.c3.medium`, `d1.c4.medium`, `d1.c1.large`, `d1.c2.large`, `d1.c3.large`, `d1.c4.large`, `d1.m1.medium`, `d1.m2.medium`, `d1.m3.medium`, `d1.m4.medium`, `d2.c1.medium`, `d2.c2.medium`, `d2.c3.medium`, `d2.c4.medium`, `d2.c5.medium`, `d2.c1.large`, `d2.c2.large`, `d2.c3.large`, `d2.c4.large`, `d2.c5.large`, `d2.m1.xlarge`, `d2.m2.xxlarge`, `d2.m3.xlarge`, `d2.m4.xlarge`, `d2.m5.xlarge`, `d2.c4.db1.pliops1`, `d3.m4.xlarge`, `d3.m5.xlarge`, `d3.m6.xlarge`, `a1.c5.large`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium` or `d3.c6.medium`.



35
36
37
# File 'lib/pnap_bmc_api/models/server.rb', line 35

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



652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
# File 'lib/pnap_bmc_api/models/server.rb', line 652

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 = BmcApi.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



131
132
133
# File 'lib/pnap_bmc_api/models/server.rb', line 131

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/pnap_bmc_api/models/server.rb', line 98

def self.attribute_map
  {
    :'id' => :'id',
    :'status' => :'status',
    :'hostname' => :'hostname',
    :'description' => :'description',
    :'os' => :'os',
    :'type' => :'type',
    :'location' => :'location',
    :'cpu' => :'cpu',
    :'cpu_count' => :'cpuCount',
    :'cores_per_cpu' => :'coresPerCpu',
    :'cpu_frequency' => :'cpuFrequency',
    :'ram' => :'ram',
    :'storage' => :'storage',
    :'private_ip_addresses' => :'privateIpAddresses',
    :'public_ip_addresses' => :'publicIpAddresses',
    :'reservation_id' => :'reservationId',
    :'pricing_model' => :'pricingModel',
    :'password' => :'password',
    :'network_type' => :'networkType',
    :'cluster_id' => :'clusterId',
    :'tags' => :'tags',
    :'provisioned_on' => :'provisionedOn',
    :'os_configuration' => :'osConfiguration',
    :'network_configuration' => :'networkConfiguration',
    :'storage_configuration' => :'storageConfiguration',
    :'superseded_by' => :'supersededBy',
    :'supersedes' => :'supersedes'
  }
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



628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
# File 'lib/pnap_bmc_api/models/server.rb', line 628

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



169
170
171
172
# File 'lib/pnap_bmc_api/models/server.rb', line 169

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

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/pnap_bmc_api/models/server.rb', line 136

def self.openapi_types
  {
    :'id' => :'String',
    :'status' => :'String',
    :'hostname' => :'String',
    :'description' => :'String',
    :'os' => :'String',
    :'type' => :'String',
    :'location' => :'String',
    :'cpu' => :'String',
    :'cpu_count' => :'Integer',
    :'cores_per_cpu' => :'Integer',
    :'cpu_frequency' => :'Float',
    :'ram' => :'String',
    :'storage' => :'String',
    :'private_ip_addresses' => :'Array<String>',
    :'public_ip_addresses' => :'Array<String>',
    :'reservation_id' => :'String',
    :'pricing_model' => :'String',
    :'password' => :'String',
    :'network_type' => :'String',
    :'cluster_id' => :'String',
    :'tags' => :'Array<TagAssignment>',
    :'provisioned_on' => :'Time',
    :'os_configuration' => :'OsConfiguration',
    :'network_configuration' => :'NetworkConfiguration',
    :'storage_configuration' => :'StorageConfiguration',
    :'superseded_by' => :'String',
    :'supersedes' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
# File 'lib/pnap_bmc_api/models/server.rb', line 581

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      status == o.status &&
      hostname == o.hostname &&
      description == o.description &&
      os == o.os &&
      type == o.type &&
      location == o.location &&
      cpu == o.cpu &&
      cpu_count == o.cpu_count &&
      cores_per_cpu == o.cores_per_cpu &&
      cpu_frequency == o.cpu_frequency &&
      ram == o.ram &&
      storage == o.storage &&
      private_ip_addresses == o.private_ip_addresses &&
      public_ip_addresses == o.public_ip_addresses &&
      reservation_id == o.reservation_id &&
      pricing_model == o.pricing_model &&
      password == o.password &&
      network_type == o.network_type &&
      cluster_id == o.cluster_id &&
      tags == o.tags &&
      provisioned_on == o.provisioned_on &&
      os_configuration == o.os_configuration &&
      network_configuration == o.network_configuration &&
      storage_configuration == o.storage_configuration &&
      superseded_by == o.superseded_by &&
      supersedes == o.supersedes
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



723
724
725
726
727
728
729
730
731
732
733
734
735
# File 'lib/pnap_bmc_api/models/server.rb', line 723

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


615
616
617
# File 'lib/pnap_bmc_api/models/server.rb', line 615

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



621
622
623
# File 'lib/pnap_bmc_api/models/server.rb', line 621

def hash
  [id, status, hostname, description, os, type, location, cpu, cpu_count, cores_per_cpu, cpu_frequency, ram, storage, private_ip_addresses, public_ip_addresses, reservation_id, pricing_model, password, network_type, cluster_id, tags, provisioned_on, os_configuration, network_configuration, storage_configuration, superseded_by, supersedes].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/pnap_bmc_api/models/server.rb', line 338

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

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

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

  if @hostname.to_s.length > 100
    invalid_properties.push('invalid value for "hostname", the character length must be smaller than or equal to 100.')
  end

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

  pattern = Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/)
  if @hostname !~ pattern
    invalid_properties.push("invalid value for \"hostname\", must conform to the pattern #{pattern}.")
  end

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

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

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

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

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

  if @cpu_count < 1
    invalid_properties.push('invalid value for "cpu_count", must be greater than or equal to 1.')
  end

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

  if @cores_per_cpu < 1
    invalid_properties.push('invalid value for "cores_per_cpu", must be greater than or equal to 1.')
  end

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

  if @cpu_frequency < 0
    invalid_properties.push('invalid value for "cpu_frequency", must be greater than or equal to 0.')
  end

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

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

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

  if @private_ip_addresses.length < 1
    invalid_properties.push('invalid value for "private_ip_addresses", number of items must be greater than or equal to 1.')
  end

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

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

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

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



699
700
701
# File 'lib/pnap_bmc_api/models/server.rb', line 699

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



705
706
707
708
709
710
711
712
713
714
715
716
717
# File 'lib/pnap_bmc_api/models/server.rb', line 705

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



693
694
695
# File 'lib/pnap_bmc_api/models/server.rb', line 693

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



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
# File 'lib/pnap_bmc_api/models/server.rb', line 443

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @status.nil?
  return false if @hostname.nil?
  return false if @hostname.to_s.length > 100
  return false if @hostname.to_s.length < 1
  return false if @hostname !~ Regexp.new(/^(?=.*[a-zA-Z])([a-zA-Z0-9().-])+$/)
  return false if !@description.nil? && @description.to_s.length > 250
  return false if @type.nil?
  return false if @location.nil?
  return false if @cpu.nil?
  return false if @cpu_count.nil?
  return false if @cpu_count < 1
  return false if @cores_per_cpu.nil?
  return false if @cores_per_cpu < 1
  return false if @cpu_frequency.nil?
  return false if @cpu_frequency < 0
  return false if @ram.nil?
  return false if @storage.nil?
  return false if @private_ip_addresses.nil?
  return false if @private_ip_addresses.length < 1
  return false if !@public_ip_addresses.nil? && @public_ip_addresses.length < 0
  return false if @pricing_model.nil?
  return false if @network_configuration.nil?
  return false if @storage_configuration.nil?
  true
end