Class: BmcApi::Server

Inherits:
ApiModelBase 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

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ Server

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/pnap_bmc_api/models/server.rb', line 185

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
  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 `BmcApi::Server`. 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?(:'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?(:'gpu_configuration')
    self.gpu_configuration = attributes[:'gpu_configuration']
  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

#gpu_configurationObject

Returns the value of attribute gpu_configuration.



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

def gpu_configuration
  @gpu_configuration
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` or `SEA`.



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`, `ubuntu/jammy+pytorch`, `ubuntu/noble`, `centos/centos7`, `centos/centos8`, `windows/srv2019std`, `windows/srv2019dc`, `windows/srv2022std`, `windows/srv2022dc`, `windows/srv2025std`, `windows/srv2025dc`, `esxi/esxi70`, `esxi/esxi80`, `almalinux/almalinux8`, `rockylinux/rockylinux8`, `almalinux/almalinux9`, `rockylinux/rockylinux9`, `virtuozzo/virtuozzo7`, `oraclelinux/oraclelinux9`, `debian/bullseye`, `debian/bookworm`, `debian/trixie`, `proxmox/bullseye`, `proxmox/proxmox8`, `proxmox/proxmox9`, `netris/controller`, `netris/softgate_1g`, `netris/softgate_10g` , `netris/softgate_25g` or `ipxe`.



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`, `THIRTY_SIX_MONTHS_RESERVATION` or `CUSTOM_TERM_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.



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

def superseded_by
  @superseded_by
end

#supersedesObject

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



97
98
99
# File 'lib/pnap_bmc_api/models/server.rb', line 97

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.c4.small`, `d1.c4.medium`, `d1.c4.large`, `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`, `a1.c5.xlarge`, `d3.s5.xlarge`, `d3.m4.xxlarge`, `d3.m5.xxlarge`, `d3.m6.xxlarge`, `s3.c3.medium`, `s3.c3.large`, `d3.c4.medium`, `d3.c5.medium`, `d3.c6.medium`, `d3.c1.large`, `d3.c2.large`, `d3.c3.large`, `d3.m1.xlarge`, `d3.m2.xlarge`, `d3.m3.xlarge`, `d3.g2.c1.xlarge`, `d3.g2.c2.xlarge`, `d3.g2.c3.xlarge`, `d3.g3.c2.medium`, `s4.x6.c6.large`, `s4.x6.m6.xlarge`, `s5.x6.c3.medium`, `s5.x6.c3.large`, `s5.x6.c8.medium`, `s5.x6.c9.medium`, `s5.x6.c8.large`, `s5.x6.c9.large`, `s5.x6.m8.xlarge`, `s5.x6.m9.xlarge`, `s4.c3.medium`, `s4.c6.medium`, `s4.c6.large`, `s4.c6.xlarge`, `s4.s2.large`, `a2.c9.large` or `a2.c9.xlarge`.



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

def type
  @type
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



134
135
136
# File 'lib/pnap_bmc_api/models/server.rb', line 134

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



139
140
141
# File 'lib/pnap_bmc_api/models/server.rb', line 139

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

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',
    :'gpu_configuration' => :'gpuConfiguration',
    :'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



743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
# File 'lib/pnap_bmc_api/models/server.rb', line 743

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



178
179
180
181
# File 'lib/pnap_bmc_api/models/server.rb', line 178

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

.openapi_typesObject

Attribute type mapping.



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

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',
    :'gpu_configuration' => :'GpuConfiguration',
    :'superseded_by' => :'String',
    :'supersedes' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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

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 &&
      gpu_configuration == o.gpu_configuration &&
      superseded_by == o.superseded_by &&
      supersedes == o.supersedes
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


730
731
732
# File 'lib/pnap_bmc_api/models/server.rb', line 730

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



736
737
738
# File 'lib/pnap_bmc_api/models/server.rb', line 736

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, gpu_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



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

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 greater 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_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



765
766
767
768
769
770
771
772
773
774
775
776
777
# File 'lib/pnap_bmc_api/models/server.rb', line 765

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



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

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